Skip to content

Commit f556555

Browse files
committed
CollapseRework4
1 parent b725ff8 commit f556555

File tree

7 files changed

+107
-222
lines changed

7 files changed

+107
-222
lines changed

resources/views/components/bulk-actions/td.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@aware([ 'tableName', 'isTailwind', 'rowPk', 'tdAttributes', 'tdCheckboxAttributes', 'showBulkActionsSections'])
1+
@aware([ 'tableName', 'isTailwind', 'rowPk', 'bulkActionsTdAttributes', 'bulkActionsTdCheckboxAttributes', 'showBulkActionsSections'])
22

33
@if ($showBulkActionsSections)
4-
<x-livewire-tables::table.td.plain wire:key="{{ $tableName }}-tbody-td-bulk-actions-td-{{ $rowPk }}" :displayMinimisedOnReorder="true" :customAttributes=$tdAttributes>
4+
<x-livewire-tables::table.td.plain wire:key="{{ $tableName }}-tbody-td-bulk-actions-td-{{ $rowPk }}" :displayMinimisedOnReorder="true" :customAttributes=$bulkActionsTdAttributes>
55
<div @class($isTailwind ? [
66
'inline-flex rounded-md shadow-sm',
77
] : [
@@ -10,7 +10,7 @@
1010
<x-livewire-tables::forms.checkbox
1111
wire:key="{{ $tableName . 'selectedItems-'.$rowPk }}"
1212
value="{{ $rowPk }}"
13-
:checkboxAttributes=$tdCheckboxAttributes
13+
:checkboxAttributes=$bulkActionsTdCheckboxAttributes
1414
/>
1515
</div>
1616
</x-livewire-tables::table.td.plain>

resources/views/components/table.blade.php

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@aware(['tableName','isTailwind', 'isTailwind4', 'isBootstrap', 'currentlyReorderingStatus', 'selectedVisibleColumns','coreTableAttributes'])
2-
@props(['bulkActionsTdAttributes','bulkActionsTdCheckboxAttributes'])
1+
@aware(['tableName','primaryKey', 'isTailwind', 'isTailwind4', 'isBootstrap', 'currentlyReorderingStatus', 'selectedVisibleColumns','coreTableAttributes', 'rows', 'loadingPlaceholderDetails'])
2+
@props(['bulkActionsTdAttributes','bulkActionsTdCheckboxAttributes', 'currentRows'])
33

4-
<div>
54

5+
<div>
66
<div {{ $attributes->merge($coreTableAttributes['wrapper'])
77
->class($isTailwind ? [
88
'border-gray-200 dark:border-gray-700' => $coreTableAttributes['wrapper']['default-colors'] ?? ($coreTableAttributes['wrapper']['default'] ?? false),
@@ -14,7 +14,8 @@
1414
])
1515
->except(['default','default-styling','default-colors'])
1616
}}>
17-
<table {{ $attributes->merge($coreTableAttributes['table'])
17+
<table
18+
{{ $attributes->merge($coreTableAttributes['table'])
1819
->class($isTailwind ? [
1920
'rappasoft-livewire-table-new',
2021
'divide-gray-200 dark:divide-none' => $coreTableAttributes['table']['default-colors'] ?? ($coreTableAttributes['table']['default'] ?? true),
@@ -25,33 +26,44 @@
2526
])
2627
->except(['default','default-styling','default-colors']) }}
2728
@if($currentlyReorderingStatus)
28-
x-sort
29-
x-sort:config="{
30-
group: 'table-{{ $tableName }}',
31-
filter: '.unsortable',
32-
onMove: function (e) {
33-
return e.related.className.indexOf('unsortable') === -1;
34-
},
35-
store: {
36-
/**
37-
* Save the order of elements. Called onEnd (when the item is dropped).
38-
* @param {Sortable} sortable
39-
*/
40-
set: function (sortable) {
41-
var order = sortable.toArray();
42-
console.log('Storing Order');
43-
const result = order.filter((word) => (word !== 'thead' && word !== 'tfoot' && word !== 'loading'));
44-
console.log(result);
29+
x-sort
30+
x-sort:config="{
31+
group: 'table-{{ $tableName }}',
32+
filter: '.unsortable',
33+
onMove: function (e) {
34+
return e.related.className.indexOf('unsortable') === -1;
35+
},
36+
store: {
37+
/**
38+
* Save the order of elements. Called onEnd (when the item is dropped).
39+
* @param {Sortable} sortable
40+
*/
41+
set: function (sortable) {
42+
var order = sortable.toArray();
43+
console.log('Storing Order');
44+
const result = order.filter((word) => (word !== 'thead' && word !== 'tfoot' && word !== 'loading'));
45+
console.log(result);
4546
46-
localStorage.setItem(sortable.options.group.name, result.join('|'));
47-
}
48-
} }" @endif
49-
>
50-
<x-livewire-tables::thead />
47+
localStorage.setItem(sortable.options.group.name, result.join('|'));
48+
}
49+
}
50+
}"
51+
@endif
52+
>
53+
<x-livewire-tables::thead />
5154

52-
{{ $slot }}
55+
@if(count($currentRows) > 0)
56+
@tableloop ($currentRows as $rowIndex => $row)
57+
@php($rowPk = $row->{$primaryKey})
58+
@php($tableRowDetails = $this->getTableRowDetails($row, $rowIndex))
5359

54-
<x-livewire-tables::tfoot />
60+
<x-livewire-tables::tbody wire:key="{{ $tableName }}-row-wrap-{{ $rowPk }}" :$row :$rowIndex :$rowPk :$tableRowDetails />
61+
@endtableloop
62+
@else
63+
<x-livewire-tables::table.empty />
64+
@endif
65+
66+
<x-livewire-tables::tfoot />
5567

5668
</table>
5769
</div>

resources/views/components/thead/tr/bulk-actions.blade.php

Lines changed: 0 additions & 108 deletions
This file was deleted.

resources/views/components/tools/tools.blade.php

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,56 @@
11
@aware(['isTailwind','isBootstrap'])
22
@php($toolsAttributes = $this->getToolsAttributes())
33

4-
<div {{
5-
$attributes->merge($toolsAttributes)
6-
->class($isTailwind ? [
7-
'flex-col' => ($toolsAttributes['default-styling'] ?? true),
8-
] : [
9-
'd-flex flex-column' => ($toolsAttributes['default-styling'] ?? true)
10-
])
11-
->except(['default','default-styling','default-colors'])
12-
}}
13-
>
14-
@if ($this->showSortPillsSection())
15-
<x-livewire-tables::tools.sorting-pills />
16-
@endif
17-
@if($this->showFilterPillsSection())
18-
<x-livewire-tables::tools.filter-pills />
19-
@endif
20-
214
@includeWhen(
22-
$this->hasConfigurableAreaFor('before-toolbar'),
23-
$this->getConfigurableAreaFor('before-toolbar'),
24-
$this->getParametersForConfigurableArea('before-toolbar')
5+
$this->hasConfigurableAreaFor('before-tools'),
6+
$this->getConfigurableAreaFor('before-tools'),
7+
$this->getParametersForConfigurableArea('before-tools')
258
)
269

27-
@if($this->shouldShowToolBar())
28-
<x-livewire-tables::tools.toolbar />
29-
@endif
30-
@if (
31-
$this->filtersAreEnabled() &&
32-
$this->filtersVisibilityIsEnabled() &&
33-
$this->hasVisibleFilters() &&
34-
$this->isFilterLayoutSlideDown()
35-
)
36-
<x-livewire-tables::tools.toolbar.items.filter-slidedown />
37-
@endif
10+
<div {{
11+
$attributes->merge($toolsAttributes)
12+
->class($isTailwind ? [
13+
'flex-col' => ($toolsAttributes['default-styling'] ?? true),
14+
] : [
15+
'd-flex flex-column' => ($toolsAttributes['default-styling'] ?? true)
16+
])
17+
->except(['default','default-styling','default-colors'])
18+
}}
19+
>
20+
@if ($this->showSortPillsSection())
21+
<x-livewire-tables::tools.sorting-pills />
22+
@endif
23+
@if($this->showFilterPillsSection())
24+
<x-livewire-tables::tools.filter-pills />
25+
@endif
26+
27+
@includeWhen(
28+
$this->hasConfigurableAreaFor('before-toolbar'),
29+
$this->getConfigurableAreaFor('before-toolbar'),
30+
$this->getParametersForConfigurableArea('before-toolbar')
31+
)
32+
33+
@if($this->shouldShowToolBar())
34+
<x-livewire-tables::tools.toolbar />
35+
@endif
36+
@if (
37+
$this->filtersAreEnabled() &&
38+
$this->filtersVisibilityIsEnabled() &&
39+
$this->hasVisibleFilters() &&
40+
$this->isFilterLayoutSlideDown()
41+
)
42+
<x-livewire-tables::tools.toolbar.items.filter-slidedown />
43+
@endif
44+
@includeWhen(
45+
$this->hasConfigurableAreaFor('after-toolbar'),
46+
$this->getConfigurableAreaFor('after-toolbar'),
47+
$this->getParametersForConfigurableArea('after-toolbar')
48+
)
49+
50+
</div>
51+
3852
@includeWhen(
39-
$this->hasConfigurableAreaFor('after-toolbar'),
40-
$this->getConfigurableAreaFor('after-toolbar'),
41-
$this->getParametersForConfigurableArea('after-toolbar')
53+
$this->hasConfigurableAreaFor('after-tools'),
54+
$this->getConfigurableAreaFor('after-tools'),
55+
$this->getParametersForConfigurableArea('after-tools')
4256
)
43-
44-
</div>

resources/views/components/wrapper.blade.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
@props(['component', 'isTailwind', 'isTailwind4', 'isBootstrap','isBootstrap4', 'isBootstrap5', 'tableName', 'primaryKey', 'collapsingColumnDetails', 'tdAttributes', 'tdCheckboxAttributes', 'collapsingColumnButtonExpandAttributes', 'collapsingColumnButtonCollapseAttributes', 'hasCollapsingColumns', 'currentlyReorderingStatus', 'hasDisplayLoadingPlaceholder', 'coreTableAttributes', 'selectedVisibleColumns', 'showBulkActionsSections', 'showCollapsingColumnSections', 'hasTrAttributes', 'collapsingColumnInfo', 'filterGenericData'])
22
<div wire:key="{{ $tableName }}-wrapper" >
3-
<div {{ $attributes->merge($this->getComponentWrapperAttributes()) }}
4-
@if ($this->hasRefresh()) wire:poll{{ $this->getRefreshOptions() }} @endif
5-
@if ($this->isFilterLayoutSlideDown()) wire:ignore.self @endif>
3+
<div {{ $attributes
4+
->merge($this->getComponentWrapperAttributes())
5+
->merge($this->hasRefresh() ? [
6+
'wire:poll'.$this->getRefreshOptions() => '',
7+
] : [])
8+
->merge($this->isFilterLayoutSlideDown() ? [
9+
'wire:ignore.self' => '',
10+
] : [])
11+
}}>
612

713
<div>
8-
@if ($this->debugIsEnabled())
9-
@include('livewire-tables::includes.debug')
10-
@endif
11-
@if ($this->offlineIndicatorIsEnabled())
12-
@include('livewire-tables::includes.offline')
13-
@endif
14-
14+
@includeWhen($this->debugIsEnabled(),'livewire-tables::includes.debug')
15+
@includeWhen($this->offlineIndicatorIsEnabled(),'livewire-tables::includes.offline')
1516
{{ $slot }}
1617
</div>
1718
</div>

0 commit comments

Comments
 (0)