From 6d514d5116ac46f875a0f9da485152e9759665ca Mon Sep 17 00:00:00 2001 From: Byron DeLaMatre Date: Fri, 15 Oct 2021 15:55:38 -0400 Subject: [PATCH 01/21] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e8d52bd3d..55f95ac18 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "rappasoft/laravel-livewire-tables", + "name": "deltasystems/laravel-livewire-tables", "description": "A dynamic table component for Laravel Livewire", "keywords": [ "rappasoft", From 40add5239d444c582c3daa1e0a24141f2a17c715 Mon Sep 17 00:00:00 2001 From: Byron DeLaMatre Date: Fri, 22 Oct 2021 12:17:53 -0400 Subject: [PATCH 02/21] adjusting table row wire:key so that it's unique --- resources/views/tailwind/includes/table.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/tailwind/includes/table.blade.php b/resources/views/tailwind/includes/table.blade.php index c101cfe48..c7a43bb94 100644 --- a/resources/views/tailwind/includes/table.blade.php +++ b/resources/views/tailwind/includes/table.blade.php @@ -96,7 +96,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150 @forelse ($rows as $index => $row) Date: Tue, 2 Nov 2021 11:43:13 +0100 Subject: [PATCH 03/21] adds filter name as filter pills default fallback value --- resources/views/bootstrap-4/includes/filter-pills.blade.php | 2 +- resources/views/bootstrap-5/includes/filter-pills.blade.php | 2 +- resources/views/tailwind/includes/filter-pills.blade.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/bootstrap-4/includes/filter-pills.blade.php b/resources/views/bootstrap-4/includes/filter-pills.blade.php index 4e748b4a4..020ad9775 100644 --- a/resources/views/bootstrap-4/includes/filter-pills.blade.php +++ b/resources/views/bootstrap-4/includes/filter-pills.blade.php @@ -9,7 +9,7 @@ wire:key="filter-pill-{{ $key }}" class="badge badge-pill badge-info d-inline-flex align-items-center" > - {{ $filterNames[$key] ?? collect($this->columns())->pluck('text', 'column')->get($key, ucwords(strtr($key, ['_' => ' ', '-' => ' ']))) }}: + {{ $filterNames[$key] ?? collect($this->columns())->pluck('text', 'column')->get($key, isset($customFilters[$key]) && property_exists($customFilters[$key], 'name') ? $customFilters[$key]->name : ucwords(strtr($key, ['_' => ' ', '-' => ' ']))) }}: @if(isset($customFilters[$key]) && method_exists($customFilters[$key], 'options')) @if(is_array($value)) @foreach($value as $selectedValue) diff --git a/resources/views/bootstrap-5/includes/filter-pills.blade.php b/resources/views/bootstrap-5/includes/filter-pills.blade.php index 6c8c30ea3..dc4cf08d7 100644 --- a/resources/views/bootstrap-5/includes/filter-pills.blade.php +++ b/resources/views/bootstrap-5/includes/filter-pills.blade.php @@ -9,7 +9,7 @@ wire:key="filter-pill-{{ $key }}" class="badge rounded-pill bg-info d-inline-flex align-items-center" > - {{ $filterNames[$key] ?? collect($this->columns())->pluck('text', 'column')->get($key, ucwords(strtr($key, ['_' => ' ', '-' => ' ']))) }}: + {{ $filterNames[$key] ?? collect($this->columns())->pluck('text', 'column')->get($key, isset($customFilters[$key]) && property_exists($customFilters[$key], 'name') ? $customFilters[$key]->name : ucwords(strtr($key, ['_' => ' ', '-' => ' ']))) }}: @if(isset($customFilters[$key]) && method_exists($customFilters[$key], 'options')) @if(is_array($value)) @foreach($value as $selectedValue) diff --git a/resources/views/tailwind/includes/filter-pills.blade.php b/resources/views/tailwind/includes/filter-pills.blade.php index 2491d9437..3919030b2 100644 --- a/resources/views/tailwind/includes/filter-pills.blade.php +++ b/resources/views/tailwind/includes/filter-pills.blade.php @@ -9,7 +9,7 @@ wire:key="filter-pill-{{ $key }}" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium leading-4 bg-indigo-100 text-indigo-800 capitalize dark:bg-indigo-200 dark:text-indigo-900" > - {{ $filterNames[$key] ?? collect($this->columns())->pluck('text', 'column')->get($key, ucwords(strtr($key, ['_' => ' ', '-' => ' ']))) }}: + {{ $filterNames[$key] ?? collect($this->columns())->pluck('text', 'column')->get($key, isset($customFilters[$key]) && property_exists($customFilters[$key], 'name') ? $customFilters[$key]->name : ucwords(strtr($key, ['_' => ' ', '-' => ' ']))) }}: @if(isset($customFilters[$key]) && method_exists($customFilters[$key], 'options')) @if(is_array($value)) @foreach($value as $selectedValue) From ac0cbf5bba4b32a58fdde19f42167356d73798b5 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Tue, 2 Nov 2021 12:25:32 +0100 Subject: [PATCH 04/21] add tests for filters --- tests/DataTableComponentTest.php | 40 +++++++++++++++++++++++++++++++ tests/Http/Livewire/PetsTable.php | 27 +++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/tests/DataTableComponentTest.php b/tests/DataTableComponentTest.php index 470d6875d..8726fc42a 100644 --- a/tests/DataTableComponentTest.php +++ b/tests/DataTableComponentTest.php @@ -3,7 +3,11 @@ namespace Rappasoft\LaravelLivewireTables\Tests; use Illuminate\Contracts\Pagination\LengthAwarePaginator; +use Illuminate\Encryption\Encrypter; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Hash; +use Illuminate\View\View; +use Livewire\Livewire; use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsAltQueryTable; use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; @@ -115,6 +119,42 @@ public function search_filter_alt_query_relation() $this->assertEquals(2, $this->tableAltQuery->rows->total()); } + /** @test */ + public function custom_filter() + { + $this->table->filters['species.name'] = 1; + + $this->assertTrue($this->table->getRowsProperty()->where('name', 'Cartman')->isNotEmpty()); + $this->assertTrue($this->table->getRowsProperty()->where('name', 'Tux')->isNotEmpty()); + $this->assertFalse($this->table->getRowsProperty()->where('May', 'Tux')->isNotEmpty()); + $this->assertFalse($this->table->getRowsProperty()->where('Ben', 'Tux')->isNotEmpty()); + $this->assertFalse($this->table->getRowsProperty()->where('Chico', 'Tux')->isNotEmpty()); + } + + /** @test */ + public function custom_filters_pills_label_use_column_name_when_possible() + { + config()->set('app.key', Encrypter::generateKey(config('app.cipher'))); + + Livewire::test(PetsTable::class) + ->set('filters', [ + 'species.name' => 1, + ]) + ->assertSeeTextInOrder(['Applied Filters:', 'Species:', 'Cat', 'Filters']); + } + + /** @test */ + public function custom_filters_pills_label_use_filter_name_when_is_not_bound_to_a_column() + { + config()->set('app.key', Encrypter::generateKey(config('app.cipher'))); + + Livewire::test(PetsTable::class) + ->set('filters', [ + 'breed_id' => 1 + ]) + ->assertSeeTextInOrder(['Applied Filters:', 'Filter Breed:', 'American Shorthair', 'Filters']); + } + /** @test */ public function bulk_actions_defined_through_function() { diff --git a/tests/Http/Livewire/PetsTable.php b/tests/Http/Livewire/PetsTable.php index 707290505..4dcdbd47a 100644 --- a/tests/Http/Livewire/PetsTable.php +++ b/tests/Http/Livewire/PetsTable.php @@ -6,9 +6,30 @@ use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\Tests\Models\Pet; use Rappasoft\LaravelLivewireTables\Views\Column; +use Rappasoft\LaravelLivewireTables\Views\Filter; class PetsTable extends DataTableComponent { + public function filters(): array + { + return [ + 'species.name' => Filter::make('Filter Species')->select([ + '' => 'All', + 1 => 'Cat', + 2 => 'Dog', + 3 => 'Horse', + 4 => 'Bird', + ]), + 'breed_id' => Filter::make('Filter Breed')->select([ + '' => 'All', + 1 => 'American Shorthair', + 2 => 'Maine Coon', + 3 => 'Persian', + 4 => 'Norwegian Forest', + ]), + ]; + } + public function bulkActions(): array { return ['count' => 'Count selected']; @@ -17,11 +38,13 @@ public function bulkActions(): array /** * @return Builder */ - public function query() : Builder + public function query(): Builder { return Pet::query() ->with('species') - ->with('breed'); + ->with('breed') + ->when($this->getFilter('species.name'), fn (Builder $query, $specimen_id) => $query->where('species_id', $specimen_id)) + ->when($this->getFilter('breed_id'), fn (Builder $query, $breed_id) => $query->where('breed_id', $breed_id)); } public function columns(): array From f10990d484b205712d0e209bc14e73b77fada3ce Mon Sep 17 00:00:00 2001 From: fabio-ivona Date: Tue, 2 Nov 2021 11:25:57 +0000 Subject: [PATCH 05/21] Fix styling --- tests/DataTableComponentTest.php | 4 +--- tests/Http/Livewire/PetsTable.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/DataTableComponentTest.php b/tests/DataTableComponentTest.php index 8726fc42a..4dfca67b3 100644 --- a/tests/DataTableComponentTest.php +++ b/tests/DataTableComponentTest.php @@ -5,8 +5,6 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Encryption\Encrypter; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Hash; -use Illuminate\View\View; use Livewire\Livewire; use Rappasoft\LaravelLivewireTables\DataTableComponent; use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsAltQueryTable; @@ -150,7 +148,7 @@ public function custom_filters_pills_label_use_filter_name_when_is_not_bound_to_ Livewire::test(PetsTable::class) ->set('filters', [ - 'breed_id' => 1 + 'breed_id' => 1, ]) ->assertSeeTextInOrder(['Applied Filters:', 'Filter Breed:', 'American Shorthair', 'Filters']); } diff --git a/tests/Http/Livewire/PetsTable.php b/tests/Http/Livewire/PetsTable.php index 4dcdbd47a..564494475 100644 --- a/tests/Http/Livewire/PetsTable.php +++ b/tests/Http/Livewire/PetsTable.php @@ -15,17 +15,17 @@ public function filters(): array return [ 'species.name' => Filter::make('Filter Species')->select([ '' => 'All', - 1 => 'Cat', - 2 => 'Dog', - 3 => 'Horse', - 4 => 'Bird', + 1 => 'Cat', + 2 => 'Dog', + 3 => 'Horse', + 4 => 'Bird', ]), - 'breed_id' => Filter::make('Filter Breed')->select([ + 'breed_id' => Filter::make('Filter Breed')->select([ '' => 'All', - 1 => 'American Shorthair', - 2 => 'Maine Coon', - 3 => 'Persian', - 4 => 'Norwegian Forest', + 1 => 'American Shorthair', + 2 => 'Maine Coon', + 3 => 'Persian', + 4 => 'Norwegian Forest', ]), ]; } From 9ea0f1ffb6444673fb22c438d081c2bf877f0a51 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Tue, 2 Nov 2021 12:47:35 +0100 Subject: [PATCH 06/21] fix tests prefer-lowest error --- resources/views/bootstrap-4/components/table/row.blade.php | 2 +- resources/views/bootstrap-5/components/table/row.blade.php | 2 +- resources/views/tailwind/components/table/row.blade.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/bootstrap-4/components/table/row.blade.php b/resources/views/bootstrap-4/components/table/row.blade.php index 6a0f27458..9fa710eee 100644 --- a/resources/views/bootstrap-4/components/table/row.blade.php +++ b/resources/views/bootstrap-4/components/table/row.blade.php @@ -1,6 +1,6 @@ @props(['url' => null, 'target' => '_self', 'reordering' => false, 'customAttributes' => []]) -@if (!$reordering && $attributes->has('wire:sortable.item')) +@if (!$reordering && (method_exists($attributes, 'has') ? $attributes->has('wire:sortable.item') : array_key_exists('wire:sortable.item', $attributes->getAttributes()))) @php $attributes = $attributes->filter(fn ($value, $key) => $key !== 'wire:sortable.item'); @endphp diff --git a/resources/views/bootstrap-5/components/table/row.blade.php b/resources/views/bootstrap-5/components/table/row.blade.php index 6a0f27458..9fa710eee 100644 --- a/resources/views/bootstrap-5/components/table/row.blade.php +++ b/resources/views/bootstrap-5/components/table/row.blade.php @@ -1,6 +1,6 @@ @props(['url' => null, 'target' => '_self', 'reordering' => false, 'customAttributes' => []]) -@if (!$reordering && $attributes->has('wire:sortable.item')) +@if (!$reordering && (method_exists($attributes, 'has') ? $attributes->has('wire:sortable.item') : array_key_exists('wire:sortable.item', $attributes->getAttributes()))) @php $attributes = $attributes->filter(fn ($value, $key) => $key !== 'wire:sortable.item'); @endphp diff --git a/resources/views/tailwind/components/table/row.blade.php b/resources/views/tailwind/components/table/row.blade.php index c6cf88265..1c40c5531 100644 --- a/resources/views/tailwind/components/table/row.blade.php +++ b/resources/views/tailwind/components/table/row.blade.php @@ -1,6 +1,6 @@ @props(['url' => null, 'target' => '_self', 'reordering' => false, 'customAttributes' => []]) -@if (!$reordering && $attributes->has('wire:sortable.item')) +@if (!$reordering && (method_exists($attributes, 'has') ? $attributes->has('wire:sortable.item') : array_key_exists('wire:sortable.item', $attributes->getAttributes()))) @php $attributes = $attributes->filter(fn ($value, $key) => $key !== 'wire:sortable.item'); @endphp From 36986f2eaf7b5d63e0e3f0a89999ebf144c607ac Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Tue, 2 Nov 2021 12:53:43 +0100 Subject: [PATCH 07/21] fix tests prefer-lowest error --- resources/views/tailwind/components/table/row.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/tailwind/components/table/row.blade.php b/resources/views/tailwind/components/table/row.blade.php index 1c40c5531..f22f7e99d 100644 --- a/resources/views/tailwind/components/table/row.blade.php +++ b/resources/views/tailwind/components/table/row.blade.php @@ -7,7 +7,7 @@ @endif merge($customAttributes)->class(['cursor-pointer' => $url]) }} + {{ $attributes->merge($customAttributes)->merge(['class' => $url ? 'cursor-pointer' : '']) }} @if ($url) onclick="window.open('{{ $url }}', '{{ $target }}')" From bd149f5d51f3d446286ad85c8c8da0cad2c0cf0a Mon Sep 17 00:00:00 2001 From: Sam Chen Date: Wed, 3 Nov 2021 16:39:45 +0800 Subject: [PATCH 08/21] add traditional chinese translation --- resources/lang/tw.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 resources/lang/tw.json diff --git a/resources/lang/tw.json b/resources/lang/tw.json new file mode 100644 index 000000000..eae977ca5 --- /dev/null +++ b/resources/lang/tw.json @@ -0,0 +1,26 @@ +{ + "All": "全部", + "Applied Filters": "已套用的過濾規則", + "Applied Sorting": "已套用的搜尋規則", + "Bulk Actions": "批次操作", + "Clear": "清除", + "Columns": "欄位", + "Done Reordering": "排序完成", + "Filters": "過濾規則", + "Remove filter option": "移除過濾規則", + "Remove sort option": "移除排序規則", + "Search": "搜尋", + "Select All": "搜尋全部", + "Showing": "顯示", + "Unselect All": "取消選擇", + "You are currently selecting all": "您目前已選擇全部資料", + "You are not connected to the internet.": "目前為離線模式", + "You have selected": "您已選擇", + "of": "筆資料,共", + "Reorder": "重新排序", + "results": "筆資料", + "rows": "筆資料", + "rows, do you want to select all": "筆資料,您是否要全選", + "No items found. Try to broaden your search.": "無資料呈現。請嘗試擴大搜尋範圍。", + "to": "至" +} From a43d96d9d43a24a98f961d72d92ad79c9c70fa82 Mon Sep 17 00:00:00 2001 From: "Julio Renzi C. Motol" Date: Fri, 12 Nov 2021 11:17:50 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E2=9C=A8=20Add=20select=20all=20in=20mul?= =?UTF-8?q?ti=20select=20filters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julio Renzi C. Motol --- .../includes/filter-type-multiselect.blade.php | 11 +++++++++++ .../includes/filter-type-multiselect.blade.php | 10 ++++++++++ .../includes/filter-type-multiselect.blade.php | 9 +++++++++ src/Traits/WithFilters.php | 16 ++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/resources/views/bootstrap-4/includes/filter-type-multiselect.blade.php b/resources/views/bootstrap-4/includes/filter-type-multiselect.blade.php index 1c777621d..e9a839e65 100644 --- a/resources/views/bootstrap-4/includes/filter-type-multiselect.blade.php +++ b/resources/views/bootstrap-4/includes/filter-type-multiselect.blade.php @@ -1,3 +1,14 @@ +
+ options()) ? 'checked' : ''}} + > + +
@foreach($filter->options() as $optionKey => $value)
+ options()) ? 'checked' : ''}} + > + +
@foreach($filter->options() as $optionKey => $value)
+
+ options()) ? 'checked' : ''}} + > + +
@foreach($filter->options() as $optionKey => $value)
toArray(); } + public function selectAllFilters($filterKey): void + { + $filter = $this->filters()[$filterKey]; + + if (! $filter->isMultiSelect()) { + return; + } + + if (count($this->filters[$filterKey]) === count($filter->options())) { + $this->removeFilter($filterKey); + return; + } + + $this->filters[$filterKey] = array_keys($filter->options()); + } + /** * Define the string location to a view to be included as the filters view * From ea373ea6a67cf871b4793b3c841f54bb12860ec1 Mon Sep 17 00:00:00 2001 From: Byron DeLaMatre Date: Mon, 15 Nov 2021 09:35:38 -0500 Subject: [PATCH 10/21] adding attributes to filter, allows for attributes in use with custom filter views, maybe allow for future support of attributes on generic filter views --- src/Views/Filter.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Views/Filter.php b/src/Views/Filter.php index 761b7d9d4..798bb0413 100644 --- a/src/Views/Filter.php +++ b/src/Views/Filter.php @@ -28,14 +28,20 @@ class Filter */ public array $options = []; + /** + * @var array + */ + public array $attributes = []; + /** * Filter constructor. * * @param string $name */ - public function __construct(string $name) + public function __construct(string $name, ?array $attributes = []) { $this->name = $name; + $this->attributes = $attributes; } /** @@ -43,9 +49,9 @@ public function __construct(string $name) * * @return Filter */ - public static function make(string $name): Filter + public static function make(string $name, ?array $attributes = []): Filter { - return new static($name); + return new static($name, $attributes); } /** From 1b97c5c95393abb95957ce2701322e1879b83465 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Thu, 18 Nov 2021 23:50:33 -0500 Subject: [PATCH 11/21] Change log --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaa00ab33..91a8ef038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ## [Unreleased] +## [1.21.0] - 2021-11-XX + +### Added + +- Added Chinese translation - https://github.com/rappasoft/laravel-livewire-tables/pull/540 + ## [1.20.1] - 2021-11-01 ### Changed From 688777b822101049fd404b676da08e20aeae9551 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Fri, 19 Nov 2021 00:00:56 -0500 Subject: [PATCH 12/21] Remove excess padding --- .../bootstrap-5/includes/filter-type-multiselect.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/bootstrap-5/includes/filter-type-multiselect.blade.php b/resources/views/bootstrap-5/includes/filter-type-multiselect.blade.php index adf4d1dd3..1dfd1e033 100644 --- a/resources/views/bootstrap-5/includes/filter-type-multiselect.blade.php +++ b/resources/views/bootstrap-5/includes/filter-type-multiselect.blade.php @@ -1,4 +1,4 @@ -
+
@lang('All')
@foreach($filter->options() as $optionKey => $value) -
+
Date: Fri, 19 Nov 2021 00:01:48 -0500 Subject: [PATCH 13/21] Change log --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91a8ef038..1b7170bf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ### Added - Added Chinese translation - https://github.com/rappasoft/laravel-livewire-tables/pull/540 +- Added 'select all' checkbox for multiselect filters - https://github.com/rappasoft/laravel-livewire-tables/pull/551 + +### Changed + +- Removed excess left padding on Bootstrap 5 form check on multiselect filters. ## [1.20.1] - 2021-11-01 From 37fc048fc2ae126ad3565a1e49de979907996fb7 Mon Sep 17 00:00:00 2001 From: rappasoft Date: Fri, 19 Nov 2021 05:02:10 +0000 Subject: [PATCH 14/21] Fix styling --- src/Traits/WithFilters.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Traits/WithFilters.php b/src/Traits/WithFilters.php index 84b68b8e4..112e84251 100644 --- a/src/Traits/WithFilters.php +++ b/src/Traits/WithFilters.php @@ -206,6 +206,7 @@ public function selectAllFilters($filterKey): void if (count($this->filters[$filterKey]) === count($filter->options())) { $this->removeFilter($filterKey); + return; } From 044cfe4c50109953b126f6c4f3b45bb354ea5410 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Fri, 19 Nov 2021 00:02:59 -0500 Subject: [PATCH 15/21] Change log --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b7170bf3..deabbfec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -572,7 +572,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file - Initial release [Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.20.1...development -[1.20.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.19.3...v1.20.1 +[1.21.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.20.1...v1.21.0 +[1.20.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.20.0...v1.20.1 [1.20.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.19.3...v1.20.0 [1.19.3]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.19.2...v1.19.3 [1.19.2]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.19.1...v1.19.2 From d89ad07c1274e5c36310fcfbcb4edd7ace0cd4fe Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Fri, 19 Nov 2021 00:19:57 -0500 Subject: [PATCH 16/21] Update other templates --- composer.json | 2 +- .../bootstrap-4/includes/table.blade.php | 4 +-- .../bootstrap-5/includes/table.blade.php | 4 +-- .../views/tailwind/includes/table.blade.php | 4 +-- src/DataTableComponent.php | 16 ++------- src/Traits/ComponentHelpers.php | 35 +++++++++++++++++++ 6 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 src/Traits/ComponentHelpers.php diff --git a/composer.json b/composer.json index db5c59d0f..ac441e240 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "deltasystems/laravel-livewire-tables", + "name": "rappasoft/laravel-livewire-tables", "description": "A dynamic table component for Laravel Livewire", "keywords": [ "rappasoft", diff --git a/resources/views/bootstrap-4/includes/table.blade.php b/resources/views/bootstrap-4/includes/table.blade.php index fcae6054c..0c5cb6537 100644 --- a/resources/views/bootstrap-4/includes/table.blade.php +++ b/resources/views/bootstrap-4/includes/table.blade.php @@ -93,7 +93,7 @@ @forelse ($rows as $index => $row) diff --git a/resources/views/bootstrap-5/includes/table.blade.php b/resources/views/bootstrap-5/includes/table.blade.php index 593fdc787..3c55611cd 100644 --- a/resources/views/bootstrap-5/includes/table.blade.php +++ b/resources/views/bootstrap-5/includes/table.blade.php @@ -94,7 +94,7 @@ class="form-check-input" @forelse ($rows as $index => $row) $this->bulkActions, ]); } - - /** - * Get a column object by its field - * - * @param string $column - * - * @return mixed - */ - protected function getColumn(string $column) - { - return collect($this->columns()) - ->where('column', $column) - ->first(); - } } diff --git a/src/Traits/ComponentHelpers.php b/src/Traits/ComponentHelpers.php new file mode 100644 index 000000000..f484201bb --- /dev/null +++ b/src/Traits/ComponentHelpers.php @@ -0,0 +1,35 @@ +columns()) + ->where('column', $column) + ->first(); + } + + /** + * @param string $field + * + * @return string + */ + protected function parseField(string $field): string + { + return ColumnUtilities::parseField($field); + } +} From fd5e0047bc914f7ce652dd67a68dfc3b0c0f16d3 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Fri, 19 Nov 2021 00:20:37 -0500 Subject: [PATCH 17/21] Change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index deabbfec5..665c6781a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ### Changed - Removed excess left padding on Bootstrap 5 form check on multiselect filters. +- Patch bulk actions random wire:key - https://github.com/rappasoft/laravel-livewire-tables/pull/557 ## [1.20.1] - 2021-11-01 From fbb81ebdd6437a3b62dd2eb8d83853b6836420a7 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Sat, 20 Nov 2021 16:25:54 -0500 Subject: [PATCH 18/21] Fix --- composer.json | 2 +- src/Views/Filter.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index db5c59d0f..ac441e240 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "deltasystems/laravel-livewire-tables", + "name": "rappasoft/laravel-livewire-tables", "description": "A dynamic table component for Laravel Livewire", "keywords": [ "rappasoft", diff --git a/src/Views/Filter.php b/src/Views/Filter.php index 798bb0413..a74d0bb97 100644 --- a/src/Views/Filter.php +++ b/src/Views/Filter.php @@ -34,9 +34,8 @@ class Filter public array $attributes = []; /** - * Filter constructor. - * - * @param string $name + * @param string $name + * @param array|null $attributes */ public function __construct(string $name, ?array $attributes = []) { @@ -45,7 +44,8 @@ public function __construct(string $name, ?array $attributes = []) } /** - * @param string $name + * @param string $name + * @param array|null $attributes * * @return Filter */ From 7744a13dfcfe8e8c023014120cba29df43754f75 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Sat, 20 Nov 2021 16:27:04 -0500 Subject: [PATCH 19/21] Change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 665c6781a..9953f7708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file - Added Chinese translation - https://github.com/rappasoft/laravel-livewire-tables/pull/540 - Added 'select all' checkbox for multiselect filters - https://github.com/rappasoft/laravel-livewire-tables/pull/551 +- Added attributes to filters - https://github.com/rappasoft/laravel-livewire-tables/pull/558 ### Changed From d6274cab82b6ae9585c95f6f554c44e1f785b823 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Sat, 20 Nov 2021 22:26:24 -0500 Subject: [PATCH 20/21] Change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9953f7708..6a469d685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file - Added Chinese translation - https://github.com/rappasoft/laravel-livewire-tables/pull/540 - Added 'select all' checkbox for multiselect filters - https://github.com/rappasoft/laravel-livewire-tables/pull/551 - Added attributes to filters - https://github.com/rappasoft/laravel-livewire-tables/pull/558 +- Added 4th option for pills fallback value - https://github.com/rappasoft/laravel-livewire-tables/pull/538 ### Changed From 274ab1d657687a5bfdbb7a105c977ccb361dedb5 Mon Sep 17 00:00:00 2001 From: Anthony Rappa Date: Sat, 20 Nov 2021 22:33:31 -0500 Subject: [PATCH 21/21] Change log --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a469d685..21ef49b15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ## [Unreleased] -## [1.21.0] - 2021-11-XX +## [1.21.0] - 2021-11-20 ### Added