Skip to content

Commit df1ebce

Browse files
committed
Tidy CollapsedColumns
1 parent 300929b commit df1ebce

File tree

1 file changed

+38
-74
lines changed

1 file changed

+38
-74
lines changed

resources/views/components/table/td/collapsed-columns.blade.php

Lines changed: 38 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,44 @@
22
@props(['rowIndex', 'hidden' => false])
33

44
@if ($this->collapsingColumnsAreEnabled() && $this->hasCollapsedColumns())
5-
@if ($isTailwind)
6-
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}"
7-
{{
8-
$attributes->merge()
9-
->class(['p-3 table-cell text-center' => $this->isTailwind])
10-
->class(['sm:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
11-
->class(['md:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
12-
->class(['lg:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
13-
->class(['d-sm-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
14-
->class(['d-md-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
15-
->class(['d-lg-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
5+
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}"
6+
{{
7+
$attributes->merge()
8+
->class(['p-3 table-cell text-center' => $this->isTailwind])
9+
->class(['sm:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
10+
->class(['md:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
11+
->class(['lg:hidden' => $this->isTailwind && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
12+
->class(['d-sm-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet()])
13+
->class(['d-md-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile()])
14+
->class(['d-lg-none' => $this->isBootstrap && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile())])
1615
17-
}}
18-
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
19-
>
20-
@if (! $hidden)
21-
<button
22-
x-cloak x-show="!currentlyReorderingStatus"
23-
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open"
24-
>
25-
<x-heroicon-o-plus-circle x-cloak x-show="!open"
26-
{{
27-
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes)
28-
->class([
29-
'h-6 w-6' => $this->getCollapsingColumnButtonExpandAttributes['default-styling'] ?? true,
30-
'text-green-600' => $this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true,
31-
])
32-
->except(['default','default-styling','default-colors'])
33-
}}
34-
/>
35-
<x-heroicon-o-minus-circle x-cloak x-show="open"
36-
{{
37-
$attributes->merge($this->getCollapsingColumnButtonCollapseAttributes)
38-
->class([
39-
'h-6 w-6' => $this->getCollapsingColumnButtonCollapseAttributes['default-styling'] ?? true,
40-
'text-yellow-600' => $this->getCollapsingColumnButtonCollapseAttributes['default-colors'] ?? true,
41-
])
42-
->except(['default','default-styling','default-colors'])
43-
}}
44-
/>
45-
</button>
46-
@endif
47-
</td>
48-
@elseif ($isBootstrap)
49-
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}"
16+
}}
17+
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
18+
>
19+
@if (! $hidden)
20+
<button x-cloak x-show="!currentlyReorderingStatus" x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open" @class([
21+
"border-0 bg-transparent p-0" => $this->isBootstrap
22+
])>
23+
<x-heroicon-o-plus-circle x-cloak x-show="!open" {{
24+
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes)
25+
->class([
26+
'h-6 w-6' => $this->isTailwind && ($this->getCollapsingColumnButtonExpandAttributes['default-styling'] ?? true),
27+
'text-green-600' => $this->isTailwind && ($this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true),
28+
'laravel-livewire-tables-btn-lg text-success' => $this->isBootstrap && ($this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true),
29+
])
30+
->except(['default','default-styling','default-colors'])
31+
}} />
32+
<x-heroicon-o-minus-circle x-cloak x-show="open" {{
33+
$attributes->merge($this->getCollapsingColumnButtonCollapseAttributes)
34+
->class([
35+
'h-6 w-6' => $this->isTailwind && ($this->getCollapsingColumnButtonCollapseAttributes['default-styling'] ?? true),
36+
'text-yellow-600' => $this->isTailwind && ($this->getCollapsingColumnButtonCollapseAttributes['default-colors'] ?? true),
37+
'laravel-livewire-tables-btn-lg text-warning' => $this->isBootstrap && ($this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true),
5038
51-
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
52-
>
53-
@if (! $hidden)
54-
<button
55-
x-cloak x-show="!currentlyReorderingStatus"
56-
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}});open = !open"
57-
class="border-0 bg-transparent p-0"
58-
>
59-
<x-heroicon-o-plus-circle x-cloak x-show="!open"
60-
{{
61-
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes)
62-
->class([
63-
'laravel-livewire-tables-btn-lg text-success' => $this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true,
64-
])
65-
->except(['default','default-styling','default-colors'])
66-
}}
67-
/>
68-
<x-heroicon-o-minus-circle x-cloak x-show="open"
69-
{{
70-
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes)
71-
->class([
72-
'laravel-livewire-tables-btn-lg text-warning' => $this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true,
73-
])
74-
->except(['default','default-styling','default-colors'])
75-
}}
76-
/>
77-
</button>
78-
@endif
79-
</td>
80-
@endif
39+
])
40+
->except(['default','default-styling','default-colors'])
41+
}} />
42+
</button>
43+
@endif
44+
</td>
8145
@endif

0 commit comments

Comments
 (0)