Skip to content

Commit 7c9d80b

Browse files
committed
Merge branch 'feature/column-select' into develop
2 parents 8ff083d + 4acc422 commit 7c9d80b

File tree

16 files changed

+188
-0
lines changed

16 files changed

+188
-0
lines changed

resources/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"Applied Sorting": "Applied Sorting",
55
"Bulk Actions": "Bulk Actions",
66
"Clear": "Clear",
7+
"Columns": "Columns",
78
"Filters": "Filters",
89
"Remove filter option": "Remove filter option",
910
"Remove sort option": "Remove sort option",

resources/views/bootstrap-4/components/table/row-columns.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@foreach($columns as $column)
22
@if ($column->isVisible())
3+
@continue($columnSelect && ! $this->isColumnSelectEnabled($column))
4+
35
<x-livewire-tables::bs4.table.cell
46
:class="method_exists($this, 'setTableDataClass') ? $this->setTableDataClass($column, $row) : ''"
57
:id="method_exists($this, 'setTableDataId') ? $this->setTableDataId($column, $row) : ''"

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

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

3131
<div class="d-md-flex">
3232
@include('livewire-tables::bootstrap-4.includes.bulk-actions')
33+
@include('livewire-tables::bootstrap-4.includes.column-select')
3334
@include('livewire-tables::bootstrap-4.includes.per-page')
3435
</div>
3536
</div>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@if ($columnSelect)
2+
<div class="dropdown mb-3 mb-md-0 pl-0 pl-md-3 d-block d-md-inline">
3+
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="columnSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4+
@lang('Columns')
5+
</button>
6+
7+
<div class="dropdown-menu dropdown-menu-right w-100" aria-labelledby="columnSelect">
8+
@foreach($columns as $column)
9+
@if ($column->isVisible() && $column->isSelectable())
10+
<div>
11+
<label class="px-2 {{ $loop->last ? 'mb-0' : 'mb-1' }}">
12+
<input wire:model="columnSelectEnabled" type="checkbox" value="{{ $column->column() }}">
13+
<span class="ml-2">{{ $column->text() }}</span>
14+
</label>
15+
</div>
16+
@endif
17+
@endforeach
18+
</div>
19+
</div>
20+
@endif

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
@foreach($columns as $column)
1313
@if ($column->isVisible())
14+
@continue($columnSelect && ! $this->isColumnSelectEnabled($column))
15+
1416
@if ($column->isBlank())
1517
<x-livewire-tables::bs4.table.heading />
1618
@else

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@foreach($columns as $column)
22
@if ($column->isVisible())
3+
@continue($columnSelect && ! $this->isColumnSelectEnabled($column))
4+
35
<x-livewire-tables::bs5.table.cell
46
:class="method_exists($this, 'setTableDataClass') ? $this->setTableDataClass($column, $row) : ''"
57
:id="method_exists($this, 'setTableDataId') ? $this->setTableDataId($column, $row) : ''"

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

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

3131
<div class="d-md-flex">
3232
@include('livewire-tables::bootstrap-5.includes.bulk-actions')
33+
@include('livewire-tables::bootstrap-5.includes.column-select')
3334
@include('livewire-tables::bootstrap-5.includes.per-page')
3435
</div>
3536
</div>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@if ($columnSelect)
2+
<div class="dropdown mb-3 mb-md-0 md-0 ms-md-3 d-block d-md-inline">
3+
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="columnSelect" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4+
@lang('Columns')
5+
</button>
6+
7+
<div class="dropdown-menu dropdown-menu-end w-100" aria-labelledby="columnSelect">
8+
@foreach($columns as $column)
9+
@if ($column->isVisible() && $column->isSelectable())
10+
<div>
11+
<label class="px-2 {{ $loop->last ? 'mb-0' : 'mb-1' }}">
12+
<input wire:model="columnSelectEnabled" type="checkbox" value="{{ $column->column() }}">
13+
<span class="ml-2">{{ $column->text() }}</span>
14+
</label>
15+
</div>
16+
@endif
17+
@endforeach
18+
</div>
19+
</div>
20+
@endif

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class="form-check-input"
1212

1313
@foreach($columns as $column)
1414
@if ($column->isVisible())
15+
@continue($columnSelect && ! $this->isColumnSelectEnabled($column))
16+
1517
@if ($column->isBlank())
1618
<x-livewire-tables::bs5.table.heading />
1719
@else

resources/views/tailwind/components/table/row-columns.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@foreach($columns as $column)
22
@if ($column->isVisible())
3+
@continue($columnSelect && ! $this->isColumnSelectEnabled($column))
4+
35
<x-livewire-tables::table.cell
46
:class="method_exists($this, 'setTableDataClass') ? $this->setTableDataClass($column, $row) : ''"
57
:id="method_exists($this, 'setTableDataId') ? $this->setTableDataId($column, $row) : ''"

0 commit comments

Comments
 (0)