Skip to content

Commit d02a13c

Browse files
committed
Add more properties to WithReordering
- Change all @ to x-on as @ apparently has issues with livewire - Fix dropdowns on tailwind to be uniform - Add bulkActionsEnabled to bs5
1 parent 1d5f458 commit d02a13c

File tree

9 files changed

+30
-24
lines changed

9 files changed

+30
-24
lines changed

resources/views/bootstrap-5/includes/bulk-actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@if (count($bulkActions))
1+
@if ($bulkActionsEnabled && count($bulkActions))
22
<div class="dropdown mb-3 mb-md-0 d-block d-md-inline">
33
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="bulkActions" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
44
@lang('Bulk Actions')

resources/views/bootstrap-5/includes/bulk-select-row.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@if (count($bulkActions) && (($selectPage && $rows->total() > $rows->count()) || count($selected)))
1+
@if ($bulkActionsEnabled && count($bulkActions) && (($selectPage && $rows->total() > $rows->count()) || count($selected)))
22
<x-livewire-tables::bs5.table.row wire:key="row-message">
33
<x-livewire-tables::bs5.table.cell colspan="{{ $colspan }}">
44
@if (count($selected) && !$selectAll && !$selectPage)

resources/views/bootstrap-5/includes/column-select.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<div
33
x-cloak
44
x-data="{ open: false }"
5-
@keydown.escape.stop="open = false"
6-
@mousedown.away="open = false"
5+
x-on:keydown.escape.stop="open = false"
6+
x-on:mousedown.away="open = false"
77
class="dropdown mb-3 mb-md-0 md-0 ms-md-3 d-block d-md-inline"
88
>
99
<button
10-
@click="open = !open"
10+
x-on:click="open = !open"
1111
class="btn dropdown-toggle d-block w-100 d-md-inline"
1212
type="button"
1313
id="columnSelect"

resources/views/bootstrap-5/includes/filters.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<div
33
x-cloak
44
x-data="{ open: false }"
5-
@keydown.escape.stop="open = false"
6-
@mousedown.away="open = false"
5+
x-on:keydown.escape.stop="open = false"
6+
x-on:mousedown.away="open = false"
77
class="btn-group d-block d-md-inline"
88
>
99
<button
10-
@click="open = !open"
10+
x-on:click="open = !open"
1111
type="button"
1212
class="btn dropdown-toggle d-block w-100 d-md-inline"
1313
>
@@ -50,7 +50,7 @@ class="dropdown-menu w-200 mt-3"
5050

5151
<button
5252
wire:click.prevent="resetFilters"
53-
@click="open = false"
53+
x-on:click="open = false"
5454
class="dropdown-item text-center"
5555
>
5656
@lang('Clear')

resources/views/bootstrap-5/includes/table.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<x-livewire-tables::bs5.table.heading />
55
@endif
66

7-
@if (count($bulkActions))
7+
@if ($bulkActionsEnabled && count($bulkActions))
88
<x-livewire-tables::bs5.table.heading>
99
<input
1010
wire:model="selectPage"
@@ -37,7 +37,7 @@ class="form-check-input"
3737
<x-slot name="body">
3838
@php
3939
$colspan = count($columns);
40-
if (count($bulkActions)) $colspan++;
40+
if ($bulkActionsEnabled && count($bulkActions)) $colspan++;
4141
if ($reordering) $colspan++;
4242
@endphp
4343

@@ -61,7 +61,7 @@ class="form-check-input"
6161
</x-livewire-tables::bs5.table.cell>
6262
@endif
6363

64-
@if (count($bulkActions))
64+
@if ($bulkActionsEnabled && count($bulkActions))
6565
<x-livewire-tables::bs5.table.cell class="align-middle">
6666
<input
6767
wire:model="selected"
@@ -78,7 +78,7 @@ class="form-check-input"
7878
</x-livewire-tables::bs5.table.row>
7979
@empty
8080
<x-livewire-tables::bs5.table.row>
81-
<x-livewire-tables::bs5.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
81+
<x-livewire-tables::bs5.table.cell :colspan="$colspan">
8282
@lang($emptyMessage)
8383
</x-livewire-tables::bs5.table.cell>
8484
</x-livewire-tables::bs5.table.row>

resources/views/tailwind/includes/bulk-actions.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<div
44
x-data="{ open: false }"
55
@keydown.window.escape="open = false"
6-
@click.away="open = false"
6+
x-on:click.away="open = false"
77
class="relative inline-block text-left z-10 w-full md:w-auto"
88
>
99
<div>
1010
<span class="rounded-md shadow-sm">
1111
<button
12-
@click="open = !open"
12+
x-on:click="open = !open"
1313
type="button"
1414
class="inline-flex justify-center w-full rounded-md border border-gray-300 px-4 py-2 bg-white text-sm leading-5 font-medium text-gray-700 hover:text-gray-500 focus:outline-none focus:border-indigo-300 focus:shadow-outline-indigo active:bg-gray-50 active:text-gray-800 transition ease-in-out duration-150"
1515
id="options-menu"
@@ -35,7 +35,7 @@ class="inline-flex justify-center w-full rounded-md border border-gray-300 px-4
3535
x-transition:leave="transition ease-in duration-75"
3636
x-transition:leave-start="transform opacity-100 scale-100"
3737
x-transition:leave-end="transform opacity-0 scale-95"
38-
class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50"
38+
class="origin-top-right absolute right-0 mt-2 w-full md:w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 divide-y divide-gray-100 focus:outline-none z-50"
3939
>
4040
<div class="rounded-md bg-white shadow-xs">
4141
<div class="py-1" role="menu" aria-orientation="vertical" aria-labelledby="options-menu">

resources/views/tailwind/includes/column-select.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<div
44
x-data="{ open: false }"
55
@keydown.window.escape="open = false"
6-
@click.away="open = false"
7-
class="relative inline-block text-left z-10 w-full md:w-auto"
6+
x-on:click.away="open = false"
7+
class="relative inline-block text-left w-full md:w-auto"
88
>
99
<div>
1010
<span class="rounded-md shadow-sm">
1111
<button
12-
@click="open = !open"
12+
x-on:click="open = !open"
1313
type="button"
1414
class="inline-flex justify-center w-full rounded-md border border-gray-300 px-4 py-2 bg-white text-sm leading-5 font-medium text-gray-700 hover:text-gray-500 focus:outline-none focus:border-indigo-300 focus:shadow-outline-indigo active:bg-gray-50 active:text-gray-800 transition ease-in-out duration-150"
1515
id="column-select-menu"
@@ -35,7 +35,7 @@ class="inline-flex justify-center w-full rounded-md border border-gray-300 px-4
3535
x-transition:leave="transition ease-in duration-75"
3636
x-transition:leave-start="transform opacity-100 scale-100"
3737
x-transition:leave-end="transform opacity-0 scale-95"
38-
class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50"
38+
class="origin-top-right absolute right-0 mt-2 w-full md:w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 divide-y divide-gray-100 focus:outline-none z-50"
3939
>
4040
<div class="rounded-md bg-white shadow-xs">
4141
<div class="p-2" role="menu" aria-orientation="vertical" aria-labelledby="column-select-menu">

resources/views/tailwind/includes/filters.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
@if ($filtersEnabled && $showFilterDropdown && ($filtersView || count($customFilters)))
22
<div
33
x-data="{ open: false }"
4-
@keydown.escape.stop="open = false"
5-
@mousedown.away="open = false"
4+
x-on:keydown.escape.stop="open = false"
5+
x-on:mousedown.away="open = false"
66
class="relative block md:inline-block text-left"
77
>
88
<div>
99
<button
1010
type="button"
1111
class="inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:border-indigo-300 focus:shadow-outline-indigo"
1212
id="filters-menu"
13-
@click="open = !open"
13+
x-on:click="open = !open"
1414
aria-haspopup="true"
1515
x-bind:aria-expanded="open"
1616
aria-expanded="true"
@@ -71,7 +71,7 @@ class="block text-sm font-medium leading-5 text-gray-700">
7171
<div class="block px-4 py-2 text-sm text-gray-700" role="menuitem">
7272
<button
7373
wire:click.prevent="resetFilters"
74-
@click="open = false"
74+
x-on:click="open = false"
7575
type="button"
7676
class="w-full inline-flex items-center justify-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
7777
>

src/Traits/WithReordering.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ private function setReorderingProperties(): void
5252
if ($this->hasReorderingSession()) {
5353
$this->reordering = true;
5454
$this->bulkActionsEnabled = false;
55+
$this->selectPage = false;
56+
$this->selectAll = false;
57+
$this->selected = [];
5558
$this->showSorting = false;
5659
$this->sortingEnabled = false;
5760
$this->filtersEnabled = false;
@@ -67,6 +70,9 @@ private function setReorderingProperties(): void
6770
$this->reordering = false;
6871
$this->reset([
6972
'bulkActionsEnabled',
73+
'selectPage',
74+
'selectAll',
75+
'selected',
7076
'showSorting',
7177
'sortingEnabled',
7278
'filtersEnabled',

0 commit comments

Comments
 (0)