Skip to content

Commit 65d3bb0

Browse files
committed
BS5 reorder
1 parent 306c61e commit 65d3bb0

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

resources/views/bootstrap-5/components/table/row.blade.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
@props(['url' => null, 'customAttributes' => []])
1+
@props(['url' => null, 'reordering' => false, 'customAttributes' => []])
2+
3+
@if (!$reordering && $attributes->has('wire:sortable.item'))
4+
@php
5+
$attributes = $attributes->filter(fn ($value, $key) => $key !== 'wire:sortable.item');
6+
@endphp
7+
@endif
28

39
<tr
410
{{ $attributes->merge($customAttributes) }}

resources/views/bootstrap-5/datatable.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class="container-fluid p-0"
1919

2020
<div class="d-md-flex justify-content-between mb-3">
2121
<div class="d-md-flex">
22+
@include('livewire-tables::bootstrap-5.includes.reorder')
2223
@include('livewire-tables::bootstrap-5.includes.search')
2324

2425
@if ($filtersEnabled && $showFilterDropdown)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class="btn dropdown-toggle d-block w-100 d-md-inline"
2222
<span class="caret"></span>
2323
</button>
2424
<ul
25-
class="dropdown-menu w-200 mt-3"
25+
class="dropdown-menu w-100"
2626
:class="{'show' : open}"
2727
role="menu"
2828
>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@if ($reorderEnabled)
2+
<div class="me-0 me-md-3 mb-3 mb-md-0">
3+
<button
4+
wire:click="{{ $reordering ? 'disableReordering' : 'enableReordering' }}"
5+
type="button"
6+
class="btn btn-default d-block w-100 d-md-inline"
7+
>
8+
@if ($reordering)
9+
@lang('Done Reordering')
10+
@else
11+
@lang('Reorder')
12+
@endif
13+
</button>
14+
</div>
15+
@endif

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<x-livewire-tables::bs5.table wire:sortable="{{ $reorderingMethod }}">
1+
<x-livewire-tables::bs5.table wire:sortable="{{ $reordering ? $reorderingMethod : '' }}">
22
<x-slot name="head">
33
@if ($reordering)
44
<x-livewire-tables::bs5.table.heading />
@@ -48,14 +48,15 @@ class="form-check-input"
4848
wire:loading.class.delay="text-muted"
4949
wire:key="table-row-{{ $row->{$primaryKey} }}"
5050
wire:sortable.item="{{ $row->{$primaryKey} }}"
51+
:reordering="$reordering"
5152
:url="method_exists($this, 'getTableRowUrl') ? $this->getTableRowUrl($row) : ''"
5253
:class="method_exists($this, 'setTableRowClass') ? ' ' . $this->setTableRowClass($row) : ''"
5354
:id="method_exists($this, 'setTableRowId') ? $this->setTableRowId($row) : ''"
5455
:customAttributes="method_exists($this, 'setTableRowAttributes') ? $this->setTableRowAttributes($row) : []"
5556
>
5657
@if ($reordering)
5758
<x-livewire-tables::bs5.table.cell wire:sortable.handle>
58-
<svg xmlns="http://www.w3.org/2000/svg" style="width:1em;height:1em;" fill="none" viewBox="0 0 24 24" stroke="currentColor">
59+
<svg xmlns="http://www.w3.org/2000/svg" class="d-inline" style="width:1em;height:1em;" fill="none" viewBox="0 0 24 24" stroke="currentColor">
5960
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
6061
</svg>
6162
</x-livewire-tables::bs5.table.cell>

0 commit comments

Comments
 (0)