File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
resources/views/components/tools Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,7 @@ class="inline-flex items-center px-2 py-1 disabled:opacity-50 disabled:cursor-wa
253
253
>
254
254
<input
255
255
class =" text-indigo-600 transition duration-150 ease-in-out border-gray-300 rounded shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-900 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600 dark:focus:bg-gray-600 disabled:opacity-50 disabled:cursor-wait"
256
- @if (count ( $component -> selectedColumns ) === count ( $component -> getDefaultVisibleColumns () ) )
256
+ @if ($component -> allDefaultVisibleColumnsAreSelected ( ) )
257
257
checked
258
258
wire:click =" deselectAllColumns"
259
259
@else
@@ -524,7 +524,7 @@ class="dropdown-menu dropdown-menu-right w-100 mt-0 mt-md-3"
524
524
class =" mb-1"
525
525
>
526
526
<input
527
- @if (count ( $component -> selectedColumns ) === count ( $component -> getDefaultVisibleColumns () ) )
527
+ @if ($component -> allDefaultVisibleColumnsAreSelected ( ) )
528
528
checked
529
529
wire:click =" deselectAllColumns"
530
530
@else
@@ -786,7 +786,7 @@ class="dropdown-menu dropdown-menu-end w-100"
786
786
class =" mb-1"
787
787
>
788
788
<input
789
- @if (count ( $component -> selectedColumns ) === count ( $component -> getDefaultVisibleColumns () ) )
789
+ @if ($component -> allDefaultVisibleColumnsAreSelected ( ) )
790
790
checked
791
791
wire:click =" deselectAllColumns"
792
792
@else
Original file line number Diff line number Diff line change @@ -70,11 +70,21 @@ public function deselectAllColumns()
70
70
public function updatedSelectedColumns (): void
71
71
{
72
72
// The query string isn't needed if it's the same as the default
73
- if ( count ( $ this ->selectedColumns ) === count ( $ this ->getDefaultVisibleColumns ())) {
73
+ if ( $ this ->allDefaultVisibleColumnsAreSelected () && $ this ->allSelectedColumnsAreVisibleByDefault ()) {
74
74
$ this ->selectAllColumns ();
75
- }else {
75
+ } else {
76
76
$ this ->{$ this ->tableName }['columns ' ] = $ this ->selectedColumns ;
77
77
session ([$ this ->getColumnSelectSessionKey () => $ this ->{$ this ->tableName }['columns ' ]]);
78
78
}
79
79
}
80
+
81
+ public function allDefaultVisibleColumnsAreSelected (): bool
82
+ {
83
+ return count (array_intersect ($ this ->selectedColumns , $ this ->getDefaultVisibleColumns ())) === count ($ this ->getDefaultVisibleColumns ());
84
+ }
85
+
86
+ public function allSelectedColumnsAreVisibleByDefault (): bool
87
+ {
88
+ return count (array_intersect ($ this ->selectedColumns , $ this ->getDefaultVisibleColumns ())) === count ($ this ->selectedColumns );
89
+ }
80
90
}
You can’t perform that action at this time.
0 commit comments