File tree Expand file tree Collapse file tree 5 files changed +32
-1
lines changed
tests/Views/Traits/Configuration Expand file tree Collapse file tree 5 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function mountWithColumnSelect(): void
29
29
// Get a list of visible default columns that are not excluded
30
30
$ columns = collect ($ this ->getColumns ())
31
31
->filter (function ($ column ) {
32
- return $ column ->isVisible () && $ column ->isSelectable ();
32
+ return $ column ->isVisible () && $ column ->isSelectable () && $ column -> isSelected () ;
33
33
})
34
34
->map (fn ($ column ) => $ column ->getHash ())
35
35
->values ()
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class Column
49
49
protected $ labelCallback ;
50
50
protected bool $ hidden = false ;
51
51
protected bool $ selectable = true ;
52
+ protected bool $ selected = true ;
52
53
protected bool $ secondaryHeader = false ;
53
54
protected $ secondaryHeaderCallback ;
54
55
protected bool $ footer = false ;
Original file line number Diff line number Diff line change @@ -149,6 +149,16 @@ public function excludeFromColumnSelect(): self
149
149
return $ this ;
150
150
}
151
151
152
+ /**
153
+ * @return $this
154
+ */
155
+ public function deselected (): self
156
+ {
157
+ $ this ->selected = false ;
158
+
159
+ return $ this ;
160
+ }
161
+
152
162
/**
153
163
* @param string $field
154
164
*
Original file line number Diff line number Diff line change @@ -413,6 +413,14 @@ public function isSelectable(): bool
413
413
return $ this ->selectable === true ;
414
414
}
415
415
416
+ /**
417
+ * @return bool
418
+ */
419
+ public function isSelected (): bool
420
+ {
421
+ return $ this ->selected === true ;
422
+ }
423
+
416
424
/**
417
425
* @return bool
418
426
*/
Original file line number Diff line number Diff line change @@ -96,4 +96,16 @@ public function can_make_column_unclickable(): void
96
96
97
97
$ this ->assertFalse ($ column ->isClickable ());
98
98
}
99
+
100
+ /** @test */
101
+ public function can_deselect_column (): void
102
+ {
103
+ $ column = Column::make ('Name ' );
104
+
105
+ $ this ->assertTrue ($ column ->isSelected ());
106
+
107
+ $ column ->deselected ();
108
+
109
+ $ this ->assertFalse ($ column ->isSelected ());
110
+ }
99
111
}
You can’t perform that action at this time.
0 commit comments