File tree Expand file tree Collapse file tree 9 files changed +59
-52
lines changed Expand file tree Collapse file tree 9 files changed +59
-52
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to ` laravel-livewire-tables ` will be documented in this file
44
5- ## [ v3.2.0] - 2023-01-04
5+ ## [ v3.2.1] - 2024-02-24
6+ ### Bug Fixes
7+ - Fix collapsing columns not respecting view point collapse points by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1665
8+
9+ ### Tweaks
10+ - Migrate "updated" Search and FilterComponents calls to WithSearch and WithFilters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1666
11+ - Allow nullable search/filter values by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1666
12+
13+ ## [ v3.2.0] - 2024-01-04
614### Tweaks
715- Migration to new Core Traits, and de-duplication of code by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1623
816
Original file line number Diff line number Diff line change 1515 $attributes -> merge ($customAttributes )
1616 -> class ([' px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $component -> isTailwind () && ($customAttributes [' default' ] ?? true )])
1717 -> class ([' hidden' => $component -> isTailwind () && $column && $column -> shouldCollapseAlways ()])
18- -> class ([' hidden sm :table-cell' => $component -> isTailwind () && $column && $column -> shouldCollapseOnMobile ()])
19- -> class ([' hidden md :table-cell' => $component -> isTailwind () && $column && $column -> shouldCollapseOnTablet ()])
18+ -> class ([' hidden md :table-cell' => $component -> isTailwind () && $column && $column -> shouldCollapseOnMobile ()])
19+ -> class ([' hidden lg :table-cell' => $component -> isTailwind () && $column && $column -> shouldCollapseOnTablet ()])
2020 -> class ([' ' => $component -> isBootstrap () && ($customAttributes [' default' ] ?? true )])
2121 -> class ([' d-none' => $component -> isBootstrap () && $column && $column -> shouldCollapseAlways ()])
22- -> class ([' d-none d-sm -table-cell' => $component -> isBootstrap () && $column && $column -> shouldCollapseOnMobile ()])
23- -> class ([' d-none d-md -table-cell' => $component -> isBootstrap () && $column && $column -> shouldCollapseOnTablet ()])
22+ -> class ([' d-none d-md -table-cell' => $component -> isBootstrap () && $column && $column -> shouldCollapseOnMobile ()])
23+ -> class ([' d-none d-lg -table-cell' => $component -> isBootstrap () && $column && $column -> shouldCollapseOnTablet ()])
2424 -> style ([' cursor:pointer' => $component -> isBootstrap ()])
2525 -> except (' default' )
2626 } }
Original file line number Diff line number Diff line change 66 -> merge ($customAttributes )
77 -> class ([' px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $customAttributes [' default' ] ?? true ])
88 -> class ([' hidden' => $column && $column -> shouldCollapseAlways ()])
9- -> class ([' hidden sm :table-cell' => $column && $column -> shouldCollapseOnMobile ()])
10- -> class ([' hidden md :table-cell' => $column && $column -> shouldCollapseOnTablet ()])
9+ -> class ([' hidden md :table-cell' => $column && $column -> shouldCollapseOnMobile ()])
10+ -> class ([' hidden lg :table-cell' => $column && $column -> shouldCollapseOnTablet ()])
1111 -> except (' default' )
1212 } } @if ($hideUntilReorder ) x-show =" reorderDisplayColumn" @endif >
1313 {{ $slot } }
1717 -> merge ($customAttributes )
1818 -> class ([' ' => $customAttributes [' default' ] ?? true ])
1919 -> class ([' d-none' => $column && $column -> shouldCollapseAlways ()])
20- -> class ([' d-none d-sm -table-cell' => $column && $column -> shouldCollapseOnMobile ()])
21- -> class ([' d-none d-md -table-cell' => $column && $column -> shouldCollapseOnTablet ()])
20+ -> class ([' d-none d-md -table-cell' => $column && $column -> shouldCollapseOnMobile ()])
21+ -> class ([' d-none d-lg -table-cell' => $column && $column -> shouldCollapseOnTablet ()])
2222 -> except (' default' )
2323 } } >
2424 {{ $slot } }
Original file line number Diff line number Diff line change 1414
1515 <x-livewire-tables::table >
1616 <x-slot name =" thead" >
17- <x-livewire-tables::table .th.reorder x-cloak x-show =" currentlyReorderingStatus" />
18- <x-livewire-tables::table .th.bulk-actions :displayMinimisedOnReorder =" true" />
17+ @if ($this -> getCurrentlyReorderingStatus () )
18+ <x-livewire-tables::table .th.reorder x-cloak x-show =" currentlyReorderingStatus" />
19+ @endif
20+ @if ($this -> bulkActionsAreEnabled () && $this -> hasBulkActions () )
21+ <x-livewire-tables::table .th.bulk-actions :displayMinimisedOnReorder =" true" />
22+ @endif
1923 <x-livewire-tables::table .th.collapsed-columns />
2024
2125 @foreach ($columns as $index => $column )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class LaravelLivewireTablesServiceProvider extends ServiceProvider
1414 public function boot (): void
1515 {
1616
17- AboutCommand::add ('Rappasoft Laravel Livewire Tables ' , fn () => ['Version ' => '3.0.0 ' ]);
17+ AboutCommand::add ('Rappasoft Laravel Livewire Tables ' , fn () => ['Version ' => '3.2.1 ' ]);
1818
1919 $ this ->mergeConfigFrom (
2020 __DIR__ .'/../config/livewire-tables.php ' , 'livewire-tables '
Original file line number Diff line number Diff line change @@ -87,40 +87,6 @@ protected function generateDataTableFingerprint(): string
8787 return base_convert ($ crc32 , 10 , 36 );
8888 }
8989
90- /**
91- * Keep track of any properties on the custom query string key for this specific table
92- */
93- public function updated (string $ name , string |array $ value ): void
94- {
95- if ($ name === 'search ' ) {
96- $ this ->resetComputedPage ();
97-
98- // Clear bulk actions on search
99- $ this ->clearSelected ();
100- $ this ->setSelectAllDisabled ();
101-
102- if ($ value === '' ) {
103- $ this ->clearSearch ();
104- }
105- }
106-
107- if (Str::contains ($ name , 'filterComponents ' )) {
108- $ this ->resetComputedPage ();
109-
110- // Clear bulk actions on filter
111- $ this ->clearSelected ();
112- $ this ->setSelectAllDisabled ();
113-
114- // Clear filters on empty value
115- $ filterName = Str::after ($ name , 'filterComponents. ' );
116- $ filter = $ this ->getFilterByKey ($ filterName );
117-
118- if ($ filter && $ filter ->isEmpty ($ value )) {
119- $ this ->resetFilter ($ filterName );
120- }
121- }
122- }
123-
12490 /**
12591 * 1. After the sorting method is hit we need to tell the table to go back into reordering mode
12692 */
Original file line number Diff line number Diff line change @@ -16,47 +16,47 @@ public function getComponentWrapperAttributes(): array
1616 }
1717
1818 /**
19- * @return array<mixed>
19+ * @return array<mixed>
2020 */
2121 public function getTableWrapperAttributes (): array
2222 {
2323 return count ($ this ->tableWrapperAttributes ) ? $ this ->tableWrapperAttributes : ['default ' => true ];
2424 }
2525
2626 /**
27- * @return array<mixed>
27+ * @return array<mixed>
2828 */
2929 public function getTableAttributes (): array
3030 {
3131 return count ($ this ->tableAttributes ) ? $ this ->tableAttributes : ['id ' => 'table- ' .$ this ->getTableName (), 'default ' => true ];
3232 }
3333
3434 /**
35- * @return array<mixed>
35+ * @return array<mixed>
3636 */
3737 public function getTheadAttributes (): array
3838 {
3939 return count ($ this ->theadAttributes ) ? $ this ->theadAttributes : ['default ' => true ];
4040 }
4141
4242 /**
43- * @return array<mixed>
43+ * @return array<mixed>
4444 */
4545 public function getTbodyAttributes (): array
4646 {
4747 return count ($ this ->tbodyAttributes ) ? $ this ->tbodyAttributes : ['default ' => true ];
4848 }
4949
5050 /**
51- * @return array<mixed>
51+ * @return array<mixed>
5252 */
5353 public function getThAttributes (Column $ column ): array
5454 {
5555 return $ this ->thAttributesCallback ? call_user_func ($ this ->thAttributesCallback , $ column ) : ['default ' => true ];
5656 }
5757
5858 /**
59- * @return array<mixed>
59+ * @return array<mixed>
6060 */
6161 public function getThSortButtonAttributes (Column $ column ): array
6262 {
Original file line number Diff line number Diff line change @@ -68,4 +68,20 @@ public function applyFilters(): Builder
6868
6969 return $ this ->getBuilder ();
7070 }
71+
72+ public function updatedFilterComponents (string |array |null $ value , string $ filterName ): void
73+ {
74+ $ this ->resetComputedPage ();
75+
76+ // Clear bulk actions on filter
77+ $ this ->clearSelected ();
78+ $ this ->setSelectAllDisabled ();
79+
80+ // Clear filters on empty value
81+ $ filter = $ this ->getFilterByKey ($ filterName );
82+
83+ if ($ filter && $ filter ->isEmpty ($ value )) {
84+ $ this ->resetFilter ($ filterName );
85+ }
86+ }
7187}
Original file line number Diff line number Diff line change @@ -65,4 +65,17 @@ public function applySearch(): Builder
6565
6666 return $ this ->getBuilder ();
6767 }
68+
69+ public function updatedSearch (string |array |null $ value ): void
70+ {
71+ $ this ->resetComputedPage ();
72+
73+ // Clear bulk actions on search
74+ $ this ->clearSelected ();
75+ $ this ->setSelectAllDisabled ();
76+
77+ if (is_null ($ value ) || $ value === '' ) {
78+ $ this ->clearSearch ();
79+ }
80+ }
6881}
You can’t perform that action at this time.
0 commit comments