File tree Expand file tree Collapse file tree 12 files changed +51
-20
lines changed Expand file tree Collapse file tree 12 files changed +51
-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 8
8
<x-livewire-tables::bs4 .table.heading />
9
9
@endif
10
10
11
- @if ($bulkActionsEnabled && count ($bulkActions ) )
11
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
12
12
<x-livewire-tables::bs4 .table.heading >
13
13
<input
14
14
wire:model =" selectPage"
41
41
<x-slot name =" body" >
42
42
@php
43
43
$colspan = count ($columns );
44
- if ($bulkActionsEnabled && count ($bulkActions )) $colspan ++ ;
44
+ if ($bulkActionsEnabled && count ($this -> bulkActions )) $colspan ++ ;
45
45
if ($reordering ) $colspan ++ ;
46
46
@endphp
47
47
66
66
</x-livewire-tables::bs4 .table.cell >
67
67
@endif
68
68
69
- @if ($bulkActionsEnabled && count ($bulkActions ) )
69
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
70
70
<x-livewire-tables::bs4 .table.cell >
71
71
<input
72
72
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 8
8
<x-livewire-tables::bs5 .table.heading />
9
9
@endif
10
10
11
- @if ($bulkActionsEnabled && count ($bulkActions ) )
11
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
12
12
<x-livewire-tables::bs5 .table.heading >
13
13
<input
14
14
wire:model =" selectPage"
@@ -42,7 +42,7 @@ class="form-check-input"
42
42
<x-slot name =" body" >
43
43
@php
44
44
$colspan = count ($columns );
45
- if ($bulkActionsEnabled && count ($bulkActions )) $colspan ++ ;
45
+ if ($bulkActionsEnabled && count ($this -> bulkActions )) $colspan ++ ;
46
46
if ($reordering ) $colspan ++ ;
47
47
@endphp
48
48
@@ -67,7 +67,7 @@ class="form-check-input"
67
67
</x-livewire-tables::bs5 .table.cell >
68
68
@endif
69
69
70
- @if ($bulkActionsEnabled && count ($bulkActions ) )
70
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
71
71
<x-livewire-tables::bs5 .table.cell class =" align-middle" >
72
72
<input
73
73
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 8
8
<x-livewire-tables::table .heading />
9
9
@endif
10
10
11
- @if ($bulkActionsEnabled && count ($bulkActions ) )
11
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
12
12
<x-livewire-tables::table .heading >
13
13
<div class =" inline-flex rounded-md shadow-sm" >
14
14
<input
@@ -44,7 +44,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
44
44
<x-slot name =" body" >
45
45
@php
46
46
$colspan = count ($columns );
47
- if ($bulkActionsEnabled && count ($bulkActions )) $colspan ++ ;
47
+ if ($bulkActionsEnabled && count ($this -> bulkActions )) $colspan ++ ;
48
48
if ($reordering ) $colspan ++ ;
49
49
@endphp
50
50
@@ -75,7 +75,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
75
75
</x-livewire-tables::table .cell >
76
76
@endif
77
77
78
- @if ($bulkActionsEnabled && count ($bulkActions ) )
78
+ @if ($bulkActionsEnabled && count ($this -> bulkActions ) )
79
79
<x-livewire-tables::table .cell >
80
80
<div class =" inline-flex rounded-md shadow-sm" >
81
81
<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