File tree Expand file tree Collapse file tree 10 files changed +34
-20
lines changed Expand file tree Collapse file tree 10 files changed +34
-20
lines changed Original file line number Diff line number Diff line change 6
6
</button >
7
7
8
8
<div class =" dropdown-menu dropdown-menu-right w-100" aria-labelledby =" bulkActions" >
9
- @foreach ($bulkActions as $action => $title )
9
+ @foreach ($this -> bulkActions as $action => $title )
10
10
<a
11
11
href =" #"
12
- wire:click.prevent =" {{ $action } }"
13
- wire:key =" bulk-action-{{ $action } }"
14
- class =" dropdown-item"
12
+ wire:click.prevent =" {{ $action } }"
13
+ wire:key =" bulk-action-{{ $action } }"
14
+ class =" dropdown-item"
15
15
>
16
16
{{ $title } }
17
17
</a >
Original file line number Diff line number Diff line change 1
- @if ($bulkActionsEnabled && count ($bulkActions ) && (($selectPage && $rows -> total () > $rows -> count ()) || count ($selected )) )
1
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) && (($selectPage && $rows -> total () > $rows -> count ()) || count ($selected )) )
2
2
<x-livewire-tables::bs4 .table.row wire:key =" row-message" >
3
3
<x-livewire-tables::bs4 .table.cell colspan =" {{ $colspan } }" >
4
4
@if (count ($selected ) && ! $selectAll && ! $selectPage )
Original file line number Diff line number Diff line change 4
4
<x-livewire-tables::bs4 .table.heading />
5
5
@endif
6
6
7
- @if ($bulkActionsEnabled && count ($bulkActions ) )
7
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
8
8
<x-livewire-tables::bs4 .table.heading >
9
9
<input
10
10
wire:model =" selectPage"
37
37
<x-slot name =" body" >
38
38
@php
39
39
$colspan = count ($columns );
40
- if ($bulkActionsEnabled && count ($bulkActions )) $colspan ++ ;
40
+ if ($bulkActionsEnabled && count ($this -> bulkActions )) $colspan ++ ;
41
41
if ($reordering ) $colspan ++ ;
42
42
@endphp
43
43
62
62
</x-livewire-tables::bs4 .table.cell >
63
63
@endif
64
64
65
- @if ($bulkActionsEnabled && count ($bulkActions ) )
65
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
66
66
<x-livewire-tables::bs4 .table.cell >
67
67
<input
68
68
wire:model =" selected"
Original file line number Diff line number Diff line change 6
6
</button >
7
7
8
8
<div class =" dropdown-menu dropdown-menu-end w-100" aria-labelledby =" bulkActions" >
9
- @foreach ($bulkActions as $action => $title )
9
+ @foreach ($this -> bulkActions as $action => $title )
10
10
<a
11
11
href =" #"
12
12
wire:click.prevent =" {{ $action } }"
Original file line number Diff line number Diff line change 1
- @if ($bulkActionsEnabled && count ($bulkActions ) && (($selectPage && $rows -> total () > $rows -> count ()) || count ($selected )) )
1
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) && (($selectPage && $rows -> total () > $rows -> count ()) || count ($selected )) )
2
2
<x-livewire-tables::bs5 .table.row wire:key =" row-message" >
3
3
<x-livewire-tables::bs5 .table.cell colspan =" {{ $colspan } }" >
4
4
@if (count ($selected ) && ! $selectAll && ! $selectPage )
Original file line number Diff line number Diff line change 4
4
<x-livewire-tables::bs5 .table.heading />
5
5
@endif
6
6
7
- @if ($bulkActionsEnabled && count ($bulkActions ) )
7
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
8
8
<x-livewire-tables::bs5 .table.heading >
9
9
<input
10
10
wire:model =" selectPage"
@@ -38,7 +38,7 @@ class="form-check-input"
38
38
<x-slot name =" body" >
39
39
@php
40
40
$colspan = count ($columns );
41
- if ($bulkActionsEnabled && count ($bulkActions )) $colspan ++ ;
41
+ if ($bulkActionsEnabled && count ($this -> bulkActions )) $colspan ++ ;
42
42
if ($reordering ) $colspan ++ ;
43
43
@endphp
44
44
@@ -63,7 +63,7 @@ class="form-check-input"
63
63
</x-livewire-tables::bs5 .table.cell >
64
64
@endif
65
65
66
- @if ($bulkActionsEnabled && count ($bulkActions ) )
66
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
67
67
<x-livewire-tables::bs5 .table.cell class =" align-middle" >
68
68
<input
69
69
wire:model =" selected"
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class="origin-top-right absolute right-0 mt-2 w-full md:w-48 rounded-md shadow-l
39
39
>
40
40
<div class =" rounded-md bg-white shadow-xs dark:bg-gray-700 dark:text-white" >
41
41
<div class =" py-1" role =" menu" aria-orientation =" vertical" aria-labelledby =" options-menu" >
42
- @foreach ($bulkActions as $action => $title )
42
+ @foreach ($this -> bulkActions as $action => $title )
43
43
<button
44
44
wire:click =" {{ $action } }"
45
45
wire:key =" bulk-action-{{ $action } }"
Original file line number Diff line number Diff line change 1
- @if ($bulkActionsEnabled && count ($bulkActions ) && (($selectPage && $rows -> total () > $rows -> count ()) || count ($selected )) )
1
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) && (($selectPage && $rows -> total () > $rows -> count ()) || count ($selected )) )
2
2
<x-livewire-tables::table .row wire:key =" row-message" class =" bg-indigo-50 dark:bg-gray-900 dark:text-white" >
3
3
<x-livewire-tables::table .cell :colspan =" $colspan" >
4
4
@if (count ($selected ) && ! $selectAll && ! $selectPage )
Original file line number Diff line number Diff line change 4
4
<x-livewire-tables::table .heading />
5
5
@endif
6
6
7
- @if ($bulkActionsEnabled && count ($bulkActions ) )
7
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
8
8
<x-livewire-tables::table .heading >
9
9
<div class =" inline-flex rounded-md shadow-sm" >
10
10
<input
@@ -40,7 +40,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
40
40
<x-slot name =" body" >
41
41
@php
42
42
$colspan = count ($columns );
43
- if ($bulkActionsEnabled && count ($bulkActions )) $colspan ++ ;
43
+ if ($bulkActionsEnabled && count ($this -> bulkActions )) $colspan ++ ;
44
44
if ($reordering ) $colspan ++ ;
45
45
@endphp
46
46
@@ -71,7 +71,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
71
71
</x-livewire-tables::table .cell >
72
72
@endif
73
73
74
- @if ($bulkActionsEnabled && count ($bulkActions ) )
74
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
75
75
<x-livewire-tables::table .cell >
76
76
<div class =" inline-flex rounded-md shadow-sm" >
77
77
<input
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ trait WithBulkActions
15
15
public bool $ selectPage = false ;
16
16
public bool $ selectAll = false ;
17
17
public $ selected = [];
18
- public array $ bulkActions = [];
18
+
19
19
public bool $ hideBulkActionsOnEmpty = false ;
20
20
21
21
public function renderingWithBulkActions (): void
@@ -91,12 +91,26 @@ public function getSelectedKeysProperty(): array
91
91
return $ this ->selectedKeys ();
92
92
}
93
93
94
+ public function getBulkActionsProperty (): array
95
+ {
96
+ return $ this ->bulkActions ();
97
+ }
98
+
99
+ public function bulkActions (): array
100
+ {
101
+ if (property_exists ($ this , 'bulkActions ' )) {
102
+ return $ this ->bulkActions ;
103
+ }
104
+
105
+ return [];
106
+ }
107
+
94
108
public function getShowBulkActionsDropdownProperty (): bool
95
109
{
96
110
$ showBulkActions = false ;
97
111
98
112
if ($ this ->bulkActionsEnabled ) {
99
- if (count ($ this ->bulkActions )) {
113
+ if (count ($ this ->bulkActions () )) {
100
114
$ showBulkActions = true ;
101
115
}
102
116
You can’t perform that action at this time.
0 commit comments