Skip to content

Commit e19517e

Browse files
committed
Adjust For Collapse Rework
1 parent d96df8e commit e19517e

35 files changed

+426
-315
lines changed

resources/js/laravel-livewire-tables.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ document.addEventListener('alpine:init', () => {
4141
showFilterPillLabel: [],
4242
filterPillsSeparator: ', ',
4343
showFilterPillsSection: true,
44+
stripLivewireTags(data) {
45+
let localHtml = data.innerHTML;
46+
localHtml = localHtml.replace('<!--[if BLOCK]>', '')
47+
.replace('<![endif]-->','')
48+
.replace('<!--[if ENDBLOCK]>','')
49+
.replace('<![endif]-->','')
50+
.trim();
51+
return localHtml;
52+
},
4453
removeHTMLTags(htmlString) {
4554
// Create a new DOMParser instance
4655
const parser = new DOMParser();
@@ -966,10 +975,5 @@ document.addEventListener('alpine:init', () => {
966975
this.syncItems(this.selectedItems);
967976
this.$watch('selectedItems', value => this.syncItems(value));
968977
}
969-
970-
971978
}));
972-
973-
974-
975979
});

resources/js/laravel-livewire-tables.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/views/components/includes/actions.blade.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
@aware(['isTailwind', 'isBootstrap'])
22
@php($actionWrapperAttributes = $this->getActionWrapperAttributes())
3+
@php($actionsPosition = $this->getActionsPosition())
4+
@php($showActionsInToolbar = $this->showActionsInToolbar())
5+
36
<div {{ $attributes
4-
->merge($this->actionWrapperAttributes)
7+
->merge($actionWrapperAttributes)
58
->class([
69
'flex flex-cols py-2 space-x-2' => $isTailwind && ($actionWrapperAttributes['default-styling'] ?? true),
710
'' => $isTailwind && ($actionWrapperAttributes['default-colors'] ?? true),
8-
'd-flex flex-cols py-2 space-x-2' => $isBootstrap && ($this->actionWrapperAttributes['default-styling'] ?? true),
11+
'd-flex flex-cols py-2 space-x-2' => $isBootstrap && ($actionWrapperAttributes['default-styling'] ?? true),
912
'' => $isBootstrap && ($actionWrapperAttributes['default-colors'] ?? true),
10-
'justify-start' => $this->getActionsPosition === 'left',
11-
'justify-center' => $this->getActionsPosition === 'center',
12-
'justify-end' => $this->getActionsPosition === 'right',
13-
'pl-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'left',
14-
'pr-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'right',
13+
'justify-start' => $actionsPosition === 'left',
14+
'justify-center' => $actionsPosition === 'center',
15+
'justify-end' => $actionsPosition === 'right',
16+
'pl-2' => $showActionsInToolbar && $actionsPosition === 'left',
17+
'pr-2' => $showActionsInToolbar && $actionsPosition === 'right',
1518
])
1619
->except(['default','default-styling','default-colors'])
1720
}} >

resources/views/components/pagination.blade.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@if ($isTailwind)
1212
<div class="mt-4 px-4 md:p-0 sm:flex justify-between items-center space-y-4 sm:space-y-0">
1313
<div>
14-
@if ($this->paginationIsEnabled && $this->isPaginationMethod('standard') && $currentRows->lastPage() > 1 && $this->showPaginationDetails)
14+
@if ($this->paginationIsEnabled() && $this->isPaginationMethod('standard') && $currentRows->lastPage() > 1 && $this->showPaginationDetails())
1515
<p class="paged-pagination-results text-sm text-gray-700 leading-5 dark:text-white">
1616
<span>{{ __($localisationPath.'Showing') }}</span>
1717
<span class="font-medium">{{ $currentRows->firstItem() }}</span>
@@ -21,16 +21,16 @@
2121
<span class="font-medium"><span x-text="paginationTotalItemCount"></span></span>
2222
<span>{{ __($localisationPath.'results') }}</span>
2323
</p>
24-
@elseif ($this->paginationIsEnabled && $this->isPaginationMethod('simple') && $this->showPaginationDetails)
24+
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('simple') && $this->showPaginationDetails())
2525
<p class="paged-pagination-results text-sm text-gray-700 leading-5 dark:text-white">
2626
<span>{{ __($localisationPath.'Showing') }}</span>
2727
<span class="font-medium">{{ $currentRows->firstItem() }}</span>
2828
<span>{{ __($localisationPath.'to') }}</span>
2929
<span class="font-medium">{{ $currentRows->lastItem() }}</span>
3030
</p>
31-
@elseif ($this->paginationIsEnabled && $this->isPaginationMethod('cursor'))
31+
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('cursor'))
3232
@else
33-
@if($this->showPaginationDetails)
33+
@if($this->showPaginationDetails())
3434
<p class="total-pagination-results text-sm text-gray-700 leading-5 dark:text-white">
3535
<span>{{ __($localisationPath.'Showing') }}</span>
3636
<span class="font-medium">{{ $currentRows->count() }}</span>
@@ -40,12 +40,12 @@
4040
@endif
4141
</div>
4242

43-
@if ($this->paginationIsEnabled)
43+
@if ($this->paginationIsEnabled())
4444
{{ $currentRows->links('livewire-tables::specific.tailwind.'.(!$this->isPaginationMethod('standard') ? 'simple-' : '').'pagination') }}
4545
@endif
4646
</div>
4747
@else
48-
@if ($this->paginationIsEnabled && $this->isPaginationMethod('standard') && $currentRows->lastPage() > 1)
48+
@if ($this->paginationIsEnabled() && $this->isPaginationMethod('standard') && $currentRows->lastPage() > 1)
4949
<div class="row mt-3">
5050
<div class="col-12 col-md-6 overflow-auto">
5151
{{ $currentRows->links('livewire-tables::specific.bootstrap-4.pagination') }}
@@ -56,7 +56,7 @@
5656
"text-md-right" => $isBootstrap4,
5757
"text-md-end" => $isBootstrap5,
5858
])>
59-
@if($this->showPaginationDetails)
59+
@if($this->showPaginationDetails())
6060
<span>{{ __($localisationPath.'Showing') }}</span>
6161
<strong>{{ $currentRows->count() ? $currentRows->firstItem() : 0 }}</strong>
6262
<span>{{ __($localisationPath.'to') }}</span>
@@ -67,7 +67,7 @@
6767
@endif
6868
</div>
6969
</div>
70-
@elseif ($this->paginationIsEnabled && $this->isPaginationMethod('simple'))
70+
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('simple'))
7171
<div class="row mt-3">
7272
<div class="col-12 col-md-6 overflow-auto">
7373
{{ $currentRows->links('livewire-tables::specific.bootstrap-4.simple-pagination') }}
@@ -78,15 +78,15 @@
7878
"text-md-right" => $isBootstrap4,
7979
"text-md-end" => $isBootstrap5,
8080
])>
81-
@if($this->showPaginationDetails)
81+
@if($this->showPaginationDetails())
8282
<span>{{ __($localisationPath.'Showing') }}</span>
8383
<strong>{{ $currentRows->count() ? $currentRows->firstItem() : 0 }}</strong>
8484
<span>{{ __($localisationPath.'to') }}</span>
8585
<strong>{{ $currentRows->count() ? $currentRows->lastItem() : 0 }}</strong>
8686
@endif
8787
</div>
8888
</div>
89-
@elseif ($this->paginationIsEnabled && $this->isPaginationMethod('cursor'))
89+
@elseif ($this->paginationIsEnabled() && $this->isPaginationMethod('cursor'))
9090
<div class="row mt-3">
9191
<div class="col-12 col-md-6 overflow-auto">
9292
{{ $currentRows->links('livewire-tables::specific.bootstrap-4.simple-pagination') }}
@@ -95,7 +95,7 @@
9595
@else
9696
<div class="row mt-3">
9797
<div class="col-12 text-muted">
98-
@if($this->showPaginationDetails)
98+
@if($this->showPaginationDetails())
9999
{{ __($localisationPath.'Showing') }}
100100
<strong>{{ $currentRows->count() }}</strong>
101101
{{ __($localisationPath.'results') }}

resources/views/components/table.blade.php

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,27 @@
1-
@aware([ 'tableName','isTailwind','isBootstrap'])
1+
@aware(['tableName','isTailwind','isBootstrap'])
2+
@props(['bulkActionsTdAttributes','bulkActionsTdCheckboxAttributes'])
23

3-
@php
4-
$customAttributes = [
5-
'wrapper' => $this->getTableWrapperAttributes(),
6-
'table' => $this->getTableAttributes(),
7-
'thead' => $this->getTheadAttributes(),
8-
'tbody' => $this->getTbodyAttributes(),
9-
];
10-
@endphp
4+
@php($coreTableAttributes = $this->getCoreTableAttributes())
115

126
@if ($isTailwind)
13-
<div
14-
wire:key="{{ $tableName }}-twrap"
15-
{{ $attributes->merge($customAttributes['wrapper'])
7+
<div {{ $attributes->merge($coreTableAttributes['wrapper'])
168
->class([
17-
'shadow overflow-y-auto border-b border-gray-200 dark:border-gray-700 sm:rounded-lg' => $customAttributes['wrapper']['default'] ?? true
9+
'border-gray-200 dark:border-gray-700' => $coreTableAttributes['wrapper']['default-colors'] ?? ($coreTableAttributes['wrapper']['default'] ?? false),
10+
'shadow overflow-y-auto border-b sm:rounded-lg' => $coreTableAttributes['wrapper']['default-styling'] ?? ($coreTableAttributes['wrapper']['default'] ?? false),
1811
])
19-
->except(['default','default-styling','default-colors']) }}
20-
>
21-
<table
22-
wire:key="{{ $tableName }}-table"
23-
{{ $attributes->merge($customAttributes['table'])
24-
->class(['min-w-full divide-y divide-gray-200 dark:divide-none' => $customAttributes['table']['default'] ?? true])
12+
->except(['default','default-styling','default-colors'])
13+
}}>
14+
<table {{ $attributes->merge($coreTableAttributes['table'])
15+
->class([
16+
'divide-gray-200 dark:divide-none' => $coreTableAttributes['table']['default-colors'] ?? ($coreTableAttributes['table']['default'] ?? true),
17+
'min-w-full divide-y' => $coreTableAttributes['table']['default-styling'] ?? ($coreTableAttributes['table']['default'] ?? true),
18+
])
2519
->except(['default','default-styling','default-colors']) }}
26-
2720
>
28-
<thead wire:key="{{ $tableName }}-thead"
29-
{{ $attributes->merge($customAttributes['thead'])
21+
<thead {{ $attributes->merge($coreTableAttributes['thead'])
3022
->class([
31-
'bg-gray-50 dark:bg-gray-800' => $customAttributes['thead']['default'] ?? true
23+
'bg-gray-50 dark:bg-gray-800' => $coreTableAttributes['thead']['default-colors'] ?? ($coreTableAttributes['thead']['default'] ?? true),
24+
'' => $coreTableAttributes['thead']['default-styling'] ?? ($coreTableAttributes['thead']['default'] ?? true),
3225
])
3326
->except(['default','default-styling','default-colors']) }}
3427
>
@@ -37,17 +30,8 @@
3730
</tr>
3831
</thead>
3932

40-
<tbody
41-
wire:key="{{ $tableName }}-tbody"
42-
id="{{ $tableName }}-tbody"
43-
{{ $attributes->merge($customAttributes['tbody'])
44-
->class([
45-
'bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-none' => $customAttributes['tbody']['default'] ?? true
46-
])
47-
->except(['default','default-styling','default-colors']) }}
48-
>
49-
{{ $slot }}
50-
</tbody>
33+
{{ $slot }}
34+
5135

5236
@isset($tfoot)
5337
<tfoot wire:key="{{ $tableName }}-tfoot">
@@ -57,35 +41,40 @@
5741
</table>
5842
</div>
5943
@elseif ($isBootstrap)
60-
<div wire:key="{{ $tableName }}-twrap"
61-
{{ $attributes->merge($customAttributes['wrapper'])
62-
->class(['table-responsive' => $customAttributes['wrapper']['default'] ?? true])
63-
->except(['default','default-styling','default-colors']) }}
44+
<div {{ $attributes->merge($coreTableAttributes['wrapper'])
45+
->class([
46+
'' => $coreTableAttributes['wrapper']['default-colors'] ?? ($coreTableAttributes['wrapper']['default'] ?? true),
47+
'table-responsive' => $coreTableAttributes['wrapper']['default-styling'] ?? ($coreTableAttributes['wrapper']['default'] ?? true),
48+
])
49+
->except(['default','default-styling','default-colors'])
50+
}}
6451
>
65-
<table
66-
wire:key="{{ $tableName }}-table"
67-
{{ $attributes->merge($customAttributes['table'])
68-
->class(['laravel-livewire-table table' => $customAttributes['table']['default'] ?? true])
52+
<table {{ $attributes->merge($coreTableAttributes['table'])
53+
->class([
54+
'' => $coreTableAttributes['table']['default-colors'] ?? ($coreTableAttributes['table']['default'] ?? true),
55+
'laravel-livewire-table table' => $coreTableAttributes['table']['default-styling'] ?? ($coreTableAttributes['table']['default'] ?? true),
56+
])
6957
->except(['default','default-styling','default-colors'])
7058
}}
7159
>
72-
<thead
73-
wire:key="{{ $tableName }}-thead"
74-
{{ $attributes->merge($customAttributes['thead'])
75-
->class(['' => $customAttributes['thead']['default'] ?? true])
60+
<thead {{ $attributes->merge($coreTableAttributes['thead'])
61+
->class([
62+
'' => $coreTableAttributes['thead']['default-colors'] ?? ($coreTableAttributes['thead']['default'] ?? true),
63+
'' => $coreTableAttributes['thead']['default-styling'] ?? ($coreTableAttributes['thead']['default'] ?? true),
64+
])
7665
->except(['default','default-styling','default-colors']) }}
7766
>
7867
<tr>
7968
{{ $thead }}
8069
</tr>
8170
</thead>
8271

83-
<tbody
84-
wire:key="{{ $tableName }}-tbody"
85-
id="{{ $tableName }}-tbody"
86-
{{ $attributes->merge($customAttributes['tbody'])
87-
->class(['' => $customAttributes['tbody']['default'] ?? true])
88-
->except(['default','default-styling','default-colors']) }}
72+
<tbody {{ $attributes->merge($coreTableAttributes['tbody'])
73+
->class([
74+
'' => $coreTableAttributes['tbody']['default-colors'] ?? ($coreTableAttributes['tbody']['default'] ?? true),
75+
'' => $coreTableAttributes['tbody']['default-styling'] ?? ($coreTableAttributes['tbody']['default'] ?? true),
76+
])
77+
->except(['default','default-styling','default-colors']) }}
8978
>
9079
{{ $slot }}
9180
</tbody>

0 commit comments

Comments
 (0)