@@ -24,11 +24,10 @@ trait IsExternalArrayFilter
2424 public array $ selectOptions = [];
2525
2626 #[On('filter-was-set ' )]
27- #[Renderless]
27+ #[Renderless]
2828 public function setFilterValues ($ tableName , $ filterKey , $ value )
2929 {
30- if ($ tableName == $ this ->tableName && $ filterKey == $ this ->filterKey )
31- {
30+ if ($ tableName == $ this ->tableName && $ filterKey == $ this ->filterKey ) {
3231 $ this ->selectedItems = $ value ;
3332 $ this ->clearFilter ();
3433 $ this ->needsUpdating = false ;
@@ -38,7 +37,7 @@ public function setFilterValues($tableName, $filterKey, $value)
3837
3938 protected function clearFilter () {}
4039
41- #[Renderless]
40+ #[Renderless]
4241 public function updatedSelectedItems ($ values )
4342 {
4443 $ this ->needsUpdating = true ;
@@ -54,18 +53,14 @@ protected function disableUpdateDispatch(): void
5453 $ this ->needsUpdating = false ;
5554 }
5655
57- #[Renderless]
56+ #[Renderless]
5857 protected function sendUpdateDispatch (array $ returnValues )
5958 {
60- if ($ this ->needsUpdating )
61- {
62- if (!empty ($ returnValues ))
63- {
64- $ this ->dispatch ('livewireArrayFilterUpdateValues ' , tableName: $ this ->tableName , filterKey: $ this ->filterKey , values: $ returnValues )->to ($ this ->tableComponent );
59+ if ($ this ->needsUpdating ) {
60+ if (! empty ($ returnValues )) {
61+ $ this ->dispatch ('livewireArrayFilterUpdateValues ' , tableName: $ this ->tableName , filterKey: $ this ->filterKey , values: $ returnValues )->to ($ this ->tableComponent );
6562 $ this ->value = array_keys ($ returnValues );
66- }
67- else
68- {
63+ } else {
6964 $ this ->value = [];
7065 }
7166 $ this ->needsUpdating = false ;
@@ -77,14 +72,11 @@ public function renderingIsExternalArrayFilter()
7772 {
7873 $ returnValues = [];
7974
80- if ($ this ->needsUpdating == true && !empty ($ this ->selectedItems ))
81- {
82- foreach ($ this ->selectedItems as $ selectedItem )
83- {
75+ if ($ this ->needsUpdating == true && ! empty ($ this ->selectedItems )) {
76+ foreach ($ this ->selectedItems as $ selectedItem ) {
8477 $ returnValues [$ selectedItem ] = $ this ->selectOptions [$ selectedItem ] ?? 'Unknown ' ;
8578 }
8679 $ this ->sendUpdateDispatch ($ returnValues );
8780 }
8881 }
89-
9082}
0 commit comments