File tree Expand file tree Collapse file tree 7 files changed +146
-2
lines changed Expand file tree Collapse file tree 7 files changed +146
-2
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,15 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
4
4
5
5
## [ Unreleased]
6
6
7
+ ## [ 2.4.0] - 2022-04-30
8
+
7
9
### Added
8
10
9
11
- Added table event listeners to sort/filter/clear from other components.
10
12
- Added text filter.
11
13
- Added $row as second parameter to BooleanColumn ` setCallback() ` .
12
14
- Added ` setThSortButtonAttributes() ` to set attributes for th sort button.
15
+ - Added ` setHideConfigurableAreasWhenReorderingStatus() ` to hide configurable areas when reordering status which now defaults to true.
13
16
14
17
### Changed
15
18
@@ -630,7 +633,8 @@ Ground Up Rebuild
630
633
631
634
- Initial release
632
635
633
- [ Unreleased ] : https://github.com/rappasoft/laravel-livewire-tables/compare/v2.3.0...development
636
+ [ Unreleased ] : https://github.com/rappasoft/laravel-livewire-tables/compare/v2.4.0...development
637
+ [ 2.4.0 ] : https://github.com/rappasoft/laravel-livewire-tables/compare/v2.3.0...v2.4.0
634
638
[ 2.3.0 ] : https://github.com/rappasoft/laravel-livewire-tables/compare/v2.2.1...v2.3.0
635
639
[ 2.2.1 ] : https://github.com/rappasoft/laravel-livewire-tables/compare/v2.2.0...v2.2.1
636
640
[ 2.2.0 ] : https://github.com/rappasoft/laravel-livewire-tables/compare/v2.1.0...v2.2.0
Original file line number Diff line number Diff line change @@ -29,6 +29,43 @@ public function configure(): void
29
29
30
30
** Note:** Only specify the keys you are actually implementing, otherwise you may get uneven spacing.
31
31
32
+ ### setHideConfigurableAreasWhenReorderingStatus
33
+
34
+ Defaults to ** true** , set whether or not configurable areas are hidden during reordering.
35
+
36
+ ``` php
37
+ public function configure(): void
38
+ {
39
+ $this->setHideConfigurableAreasWhenReorderingStatus(true);
40
+ $this->setHideConfigurableAreasWhenReorderingStatus(false);
41
+ }
42
+ ```
43
+
44
+ ### setHideConfigurableAreasWhenReorderingEnabled
45
+
46
+ Hide configurable areas when reordering.
47
+
48
+ ``` php
49
+ public function configure(): void
50
+ {
51
+ // Shorthand for $this->setHideConfigurableAreasWhenReorderingStatus(true)
52
+ $this->setHideConfigurableAreasWhenReorderingEnabled();
53
+ }
54
+ ```
55
+
56
+ ### setHideConfigurableAreasWhenReorderingDisabled
57
+
58
+ Show configurable areas when reordering.
59
+
60
+ ``` php
61
+ public function configure(): void
62
+ {
63
+ // Shorthand for $this->setHideConfigurableAreasWhenReorderingStatus(false)
64
+ $this->setHideConfigurableAreasWhenReorderingDisabled();
65
+ }
66
+ ```
67
+
68
+
32
69
## Example View
33
70
34
71
Example dropdown for the toolbar:
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ trait ComponentUtilities
35
35
protected $ collapsingColumnsStatus = true ;
36
36
protected string $ emptyMessage = 'No items found. Try to broaden your search. ' ;
37
37
protected array $ additionalSelects = [];
38
+ protected bool $ hideConfigurableAreasWhenReorderingStatus = true ;
38
39
protected array $ configurableAreas = [
39
40
'toolbar-left-start ' => null ,
40
41
'toolbar-left-end ' => null ,
Original file line number Diff line number Diff line change @@ -323,4 +323,36 @@ public function setConfigurableAreas(array $areas): self
323
323
324
324
return $ this ;
325
325
}
326
+
327
+ /**
328
+ * @param bool $status
329
+ *
330
+ * @return $this
331
+ */
332
+ public function setHideConfigurableAreasWhenReorderingStatus (bool $ status ): self
333
+ {
334
+ $ this ->hideConfigurableAreasWhenReorderingStatus = $ status ;
335
+
336
+ return $ this ;
337
+ }
338
+
339
+ /**
340
+ * @return $this
341
+ */
342
+ public function setHideConfigurableAreasWhenReorderingEnabled (): self
343
+ {
344
+ $ this ->setHideConfigurableAreasWhenReorderingStatus (true );
345
+
346
+ return $ this ;
347
+ }
348
+
349
+ /**
350
+ * @return $this
351
+ */
352
+ public function setHideConfigurableAreasWhenReorderingDisabled (): self
353
+ {
354
+ $ this ->setHideConfigurableAreasWhenReorderingStatus (false );
355
+
356
+ return $ this ;
357
+ }
326
358
}
Original file line number Diff line number Diff line change @@ -354,6 +354,10 @@ public function getConfigurableAreas(): array
354
354
*/
355
355
public function hasConfigurableAreaFor (string $ area ): bool
356
356
{
357
+ if ($ this ->hideConfigurableAreasWhenReorderingIsEnabled () && $ this ->reorderIsEnabled () && $ this ->currentlyReorderingIsEnabled ()) {
358
+ return false ;
359
+ }
360
+
357
361
return isset ($ this ->configurableAreas [$ area ]) && $ this ->getConfigurableAreaFor ($ area ) !== null ;
358
362
}
359
363
@@ -366,4 +370,28 @@ public function getConfigurableAreaFor(string $area): ?string
366
370
{
367
371
return $ this ->configurableAreas [$ area ] ?? null ;
368
372
}
373
+
374
+ /**
375
+ * @return bool
376
+ */
377
+ public function getHideConfigurableAreasWhenReorderingStatus (): bool
378
+ {
379
+ return $ this ->hideConfigurableAreasWhenReorderingStatus ;
380
+ }
381
+
382
+ /**
383
+ * @return bool
384
+ */
385
+ public function hideConfigurableAreasWhenReorderingIsEnabled (): bool
386
+ {
387
+ return $ this ->getHideConfigurableAreasWhenReorderingStatus () === true ;
388
+ }
389
+
390
+ /**
391
+ * @return bool
392
+ */
393
+ public function hideConfigurableAreasWhenReorderingIsDisabled (): bool
394
+ {
395
+ return $ this ->getHideConfigurableAreasWhenReorderingStatus () === false ;
396
+ }
369
397
}
Original file line number Diff line number Diff line change @@ -250,4 +250,26 @@ public function can_set_tr_url_target(): void
250
250
251
251
$ this ->assertSame ($ this ->basicTable ->getTableRowUrlTarget (1 ), '_blank ' );
252
252
}
253
+
254
+ /** @test */
255
+ public function can_set_hide_configurable_areas_when_reordering_status (): void
256
+ {
257
+ $ this ->assertTrue ($ this ->basicTable ->getHideConfigurableAreasWhenReorderingStatus ());
258
+
259
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingStatus (false );
260
+
261
+ $ this ->assertFalse ($ this ->basicTable ->getHideConfigurableAreasWhenReorderingStatus ());
262
+
263
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingStatus (true );
264
+
265
+ $ this ->assertTrue ($ this ->basicTable ->getHideConfigurableAreasWhenReorderingStatus ());
266
+
267
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingDisabled ();
268
+
269
+ $ this ->assertFalse ($ this ->basicTable ->getHideConfigurableAreasWhenReorderingStatus ());
270
+
271
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingEnabled ();
272
+
273
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingStatus (true );
274
+ }
253
275
}
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ public function can_check_if_table_has_page_name(): void
110
110
/** @test */
111
111
public function can_get_eager_load_relations_status (): void
112
112
{
113
- $ this ->assertFalse ($ this ->basicTable ->getEagerLoadAllRelationsStatus ());
113
+ $ this ->assertFalse ($ this ->basicTable ->getHideReorderColumnUnlessReorderingStatus ());
114
114
115
115
$ this ->assertFalse ($ this ->basicTable ->eagerLoadAllRelationsIsEnabled ());
116
116
@@ -183,4 +183,24 @@ public function can_get_configurable_areas(): void
183
183
184
184
$ this ->assertEquals ('includes.areas.toolbar-left-start ' , $ this ->basicTable ->getConfigurableAreaFor ('toolbar-left-start ' ));
185
185
}
186
+
187
+ /** @test */
188
+ public function can_get_hide_configurable_areas_when_reordering_status (): void
189
+ {
190
+ $ this ->assertTrue ($ this ->basicTable ->getHideConfigurableAreasWhenReorderingStatus ());
191
+
192
+ $ this ->assertTrue ($ this ->basicTable ->hideConfigurableAreasWhenReorderingIsEnabled ());
193
+
194
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingDisabled ();
195
+
196
+ $ this ->assertTrue ($ this ->basicTable ->hideConfigurableAreasWhenReorderingIsDisabled ());
197
+
198
+ $ this ->assertFalse ($ this ->basicTable ->hideConfigurableAreasWhenReorderingIsEnabled ());
199
+
200
+ $ this ->basicTable ->setHideConfigurableAreasWhenReorderingEnabled ();
201
+
202
+ $ this ->assertTrue ($ this ->basicTable ->hideConfigurableAreasWhenReorderingIsEnabled ());
203
+
204
+ $ this ->assertFalse ($ this ->basicTable ->hideConfigurableAreasWhenReorderingIsDisabled ());
205
+ }
186
206
}
You can’t perform that action at this time.
0 commit comments