Skip to content

Commit 2fc7339

Browse files
committed
Ground Up Rebuild
### Added - Config file to choose frontend framework - currently limited to bootstrap - Render method to columns which returns whatever you put into it, you can return a view, html, an attribute, etc. - Pulled in and modified the HTML component library from laravelcollective so you an return html components from the render method. i.e.: $this->image(...); - Added new loading config on whether to keep displaying the current data while loading or collapse it ### Changed - Extracted the sorting icons out to their actual HTML so you can use whatever you want, not limited to the 'i' tag. ### Removed - Checkbox functionality for now - Component functionality pending debate - All class and styling based properties. It's better to publish the views to change something. - Readme WIP - Changelog WIP
1 parent 00f3b66 commit 2fc7339

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+730
-975
lines changed

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
- 7.2
6+
- 7.3
7+
8+
env:
9+
matrix:
10+
- COMPOSER_FLAGS="--prefer-lowest"
11+
- COMPOSER_FLAGS=""
12+
13+
before_script:
14+
- travis_retry composer self-update
15+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
16+
17+
script:
18+
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
19+
20+
after_script:
21+
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7+
## [0.3] - 2020-XX-XX
8+
9+
- Ground up rebuild
10+
11+
### Added
12+
13+
- Config file to choose frontend framework - currently limited to bootstrap
14+
- Render method to columns which returns whatever you put into it, you can return a view, html, an attribute, etc.
15+
- Pulled in and modified the HTML component library from laravelcollective so you an return html components from the render method. i.e.: $this->image(...);
16+
- Added new loading config on whether to keep displaying the current data while loading or collapse it
17+
18+
### Changed
19+
20+
- Extracted the sorting icons out to their actual HTML so you can use whatever you want, not limited to the 'i' tag.
21+
22+
### Removed
23+
24+
- Checkbox functionality for now
25+
- Component functionality pending debate
26+
- All class and styling based properties. It's better to publish the views to change something.
27+
728
## [0.2.1] - 2020-09-10
829

930
### Added
@@ -90,7 +111,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
90111

91112
- Initial release
92113

93-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.2.1...development
114+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.3.0...development
115+
[0.3.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.2.1...v0.3.0
94116
[0.2.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.2.0...v0.2.1
95117
[0.2.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.6...v0.2.0
96118
[0.1.6]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.5...v0.1.6

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
}
2020
],
2121
"require": {
22-
"php": "^7.2.5",
23-
"livewire/livewire": "^1.3|^2.0"
22+
"php": "^7.3",
23+
"livewire/livewire": "^2.0"
2424
},
2525
"require-dev": {
2626
"friendsofphp/php-cs-fixer": "^2.16",
2727
"orchestra/testbench": "^5.0",
28-
"phpunit/phpunit": "^8.0|^9.0"
28+
"phpunit/phpunit": "^9.0"
2929
},
3030
"autoload": {
3131
"psr-4": {
@@ -48,7 +48,7 @@
4848
"extra": {
4949
"laravel": {
5050
"providers": [
51-
"Rappasoft\\LaravelLivewireTables\\LivewireTablesServiceProvider"
51+
"Rappasoft\\LaravelLivewireTables\\LaravelLivewireTablesServiceProvider"
5252
]
5353
}
5454
}

config/config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
* The frontend styling framework to use
7+
* Options: bootstrap-4
8+
*/
9+
'theme' => 'bootstrap-4',
10+
];
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<tr>
2+
@foreach($columns as $column)
3+
@if ($column->isVisible())
4+
@if($column->isSortable())
5+
<th
6+
class="{{ $this->setTableHeadClass($column->getAttribute()) }}"
7+
id="{{ $this->setTableHeadId($column->getAttribute()) }}"
8+
@foreach ($this->setTableHeadAttributes($column->getAttribute()) as $key => $value)
9+
{{ $key }}="{{ $value }}"
10+
@endforeach
11+
wire:click="sort('{{ $column->getAttribute() }}')"
12+
style="cursor:pointer;"
13+
>
14+
{{ $column->getText() }}
15+
16+
@if ($sortField !== $column->getAttribute())
17+
{{ new \Illuminate\Support\HtmlString($sortDefaultIcon) }}
18+
@elseif ($sortDirection === 'asc')
19+
{{ new \Illuminate\Support\HtmlString($ascSortIcon) }}
20+
@else
21+
{{ new \Illuminate\Support\HtmlString($descSortIcon) }}
22+
@endif
23+
</th>
24+
@else
25+
<th>{{ $column->getText() }}</th>
26+
@endif
27+
@endif
28+
@endforeach
29+
</tr>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@foreach($models as $model)
2+
<tr
3+
class="{{ $this->setTableRowClass($model) }}"
4+
id="{{ $this->setTableRowId($model) }}"
5+
@foreach ($this->setTableRowAttributes($model) as $key => $value)
6+
{{ $key }}="{{ $value }}"
7+
@endforeach
8+
@if ($this->getTableRowUrl($model))
9+
onclick="window.location='{{ $this->getTableRowUrl($model) }}';"
10+
style="cursor:pointer"
11+
@endif
12+
>
13+
@foreach($columns as $column)
14+
@if ($column->isVisible())
15+
<td
16+
class="{{ $this->setTableDataClass($column->getAttribute(), data_get($model, $column->getAttribute())) }}"
17+
id="{{ $this->setTableDataId($column->getAttribute(), data_get($model, $column->getAttribute())) }}"
18+
@foreach ($this->setTableDataAttributes($column->getAttribute(), data_get($model, $column->getAttribute())) as $key => $value)
19+
{{ $key }}="{{ $value }}"
20+
@endforeach
21+
>
22+
@if ($column->isFormatted())
23+
@if ($column->isRaw())
24+
{!! $column->formatted($model, $column) !!}
25+
@else
26+
{{ $column->formatted($model, $column) }}
27+
@endif
28+
@else
29+
@if ($column->isRaw())
30+
{!! data_get($model, $column->getAttribute()) !!}
31+
@else
32+
{{ data_get($model, $column->getAttribute()) }}
33+
@endif
34+
@endif
35+
</td>
36+
@endif
37+
@endforeach
38+
</tr>
39+
@endforeach
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<tr>
2+
<td colspan="{{ collect($columns)->count() }}">@lang('laravel-livewire-tables::strings.no_results')</td>
3+
</tr>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@if ($loadingIndicator)
2+
<tbody wire:loading.class.remove="d-none" class="d-none">
3+
<tr>
4+
<td colspan="{{ collect($columns)->count() }}">
5+
@lang('laravel-livewire-tables::strings.loading')
6+
</td>
7+
</tr>
8+
</tbody>
9+
10+
<tbody @if($collapseDataOnLoading) wire:loading.remove @endif>
11+
@else
12+
<tbody>
13+
@endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@if ($offlineIndicator)
2+
<div wire:offline.class="d-block" wire:offline.class.remove="d-none" class="alert alert-danger d-none">
3+
@lang('laravel-livewire-tables::strings.offline')
4+
</div>
5+
@endif
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@if ($paginationEnabled || $searchEnabled)
2+
<div class="row mb-4">
3+
@if ($paginationEnabled && count($perPageOptions))
4+
<div class="col form-inline">
5+
@lang('laravel-livewire-tables::strings.per_page'): &nbsp;
6+
7+
<select wire:model="perPage" class="form-control">
8+
@foreach ($perPageOptions as $option)
9+
<option>{{ $option }}</option>
10+
@endforeach
11+
</select>
12+
</div><!--col-->
13+
@endif
14+
15+
@if ($searchEnabled)
16+
<div class="col">
17+
@if ($clearSearchButton)
18+
<div class="input-group">
19+
@endif
20+
<input
21+
@if (is_numeric($searchDebounce) && $searchUpdateMethod === 'debounce') wire:model.debounce.{{ $searchDebounce }}ms="search" @endif
22+
@if ($searchUpdateMethod === 'lazy') wire:model.lazy="search" @endif
23+
@if ($disableSearchOnLoading) wire:loading.attr="disabled" @endif
24+
class="form-control"
25+
type="text"
26+
placeholder="{{ __('laravel-livewire-tables::strings.search') }}"
27+
/>
28+
@if ($clearSearchButton)
29+
<div class="input-group-append">
30+
<button class="btn btn-outline-dark" type="button" wire:click="clearSearch">@lang('laravel-livewire-tables::strings.clear')</button>
31+
</div>
32+
</div>
33+
@endif
34+
</div>
35+
@endif
36+
</div><!--row-->
37+
@endif

0 commit comments

Comments
 (0)