Skip to content

Commit 961d2f1

Browse files
committed
Test Fix
1 parent c0b0143 commit 961d2f1

16 files changed

+364
-103
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
])
1919
->except(['default','default-styling','default-colors'])
2020
}} >
21-
@foreach($this->getActions() as $action)
21+
@tableloop($this->getActions() as $action)
2222
{{ $action->render() }}
23-
@endforeach
23+
@endtableloop
2424
</div>
Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,49 @@
11
@aware([ 'tableName', 'primaryKey','isTailwind','isBootstrap', 'collapsingColumnDetails', 'rowPk','row', 'rowIndex','customAttributes', 'hasCollapsingColumns', 'colspanCount'])
22

3-
@if ($hasCollapsingColumns)
4-
<tr data-id="tr-collapsed" x-data
5-
@toggle-row-content.window="($event.detail.tableName === '{{ $tableName }}' && $event.detail.row === {{ $rowIndex }}) ? $el.classList.toggle('{{ $isBootstrap ? 'd-none' : 'hidden' }}') : null"
6-
{{
7-
$attributes->merge([
8-
'wire:loading.class.delay' => 'opacity-50 dark:bg-gray-900 dark:opacity-60',
9-
'wire:key' => $tableName.'-row-'.$rowPk.'-collapsed-contents',
10-
])
11-
->merge($customAttributes)
12-
->class($isTailwind ? [
13-
'hidden rappasoft-striped-row' => $customAttributes['default'] ?? true,
14-
] : [
15-
'd-none rappasoft-striped-row' => ($rowIndex % 2 === 0 && ($customAttributes['default'] ?? true)),
16-
'd-none rappasoft-striped-row' => ($rowIndex % 2 !== 0 && ($customAttributes['default'] ?? true)),
17-
])
18-
->except(['default','default-styling','default-colors'])
19-
}}
20-
>
21-
<td colspan="{{ $colspanCount }}" @class([
22-
'text-left pt-4 pb-2 px-4' => $isTailwind,
23-
'text-start pt-3 p-2' => $isBootstrap,
24-
])>
25-
<div>
3+
<tr data-id="tr-collapsed" x-data x-show="showCollapsed" x-cloak {{
4+
$attributes->merge([
5+
'wire:loading.class.delay' => 'opacity-50 dark:bg-gray-900 dark:opacity-60',
6+
'wire:key' => $tableName.'-row-'.$rowPk.'-collapsed-contents',
7+
])
8+
->merge($customAttributes)
9+
->class($isTailwind ? [
10+
'rappasoft-striped-row' => $customAttributes['default'] ?? true,
11+
] : [
12+
'rappasoft-striped-row' => ($rowIndex % 2 === 0 && ($customAttributes['default'] ?? true)),
13+
'rappasoft-striped-row' => ($rowIndex % 2 !== 0 && ($customAttributes['default'] ?? true)),
14+
])
15+
->except(['default','default-styling','default-colors'])
16+
}}
17+
>
18+
<td colspan="{{ $colspanCount }}" @class([
19+
'text-left pt-4 pb-2 px-4' => $isTailwind,
20+
'text-start pt-3 p-2' => $isBootstrap,
21+
])>
22+
<div>
2623

24+
@tableloop($collapsingColumnDetails as $colIndex => $columnData)
25+
<div wire:key="{{ $tableName }}-row-{{ $rowPk }}-collapsed-contents-{{ $colIndex }}" x-data="{ value: '',
26+
init() {
27+
$nextTick(() => {
28+
this.value = stripLivewireTags($refs.{{ $tableName . '_' . $rowIndex.'_'.$colIndex }});
29+
});
30+
}
31+
}" @class($isTailwind ? [
32+
'block mb-2 hidden',
33+
'sm:block' => $columnData['shouldCollapseAlways'],
34+
'sm:block md:hidden' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && $columnData['shouldCollapseOnMobile'],
35+
'sm:block lg:hidden' => !$columnData['shouldCollapseAlways'] && ($columnData['shouldCollapseOnTablet'] || $columnData['shouldCollapseOnMobile']),
36+
] : [
37+
'd-block mb-2',
38+
'd-sm-none' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && !$columnData['shouldCollapseOnMobile'],
39+
'd-md-none' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && $columnData['shouldCollapseOnMobile'],
40+
'd-lg-none' => !$columnData['shouldCollapseAlways'] && ($columnData['shouldCollapseOnTablet'] || $columnData['shouldCollapseOnMobile']),
2741
28-
@tableloop($collapsingColumnDetails as $colIndex => $columnData)
29-
<div wire:key="{{ $tableName }}-row-{{ $rowPk }}-collapsed-contents-{{ $colIndex }}"
30-
x-data="{ value: '',
31-
init() {
32-
$nextTick(() => {
33-
this.value = stripLivewireTags($refs.{{ $tableName . '_' . $rowIndex.'_'.$colIndex }});
34-
});
35-
}
36-
}" @class($isTailwind ? [
37-
'block mb-2 hidden',
38-
'sm:block' => $columnData['shouldCollapseAlways'],
39-
'sm:block md:hidden' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && $columnData['shouldCollapseOnMobile'],
40-
'sm:block lg:hidden' => !$columnData['shouldCollapseAlways'] && ($columnData['shouldCollapseOnTablet'] || $columnData['shouldCollapseOnMobile']),
41-
] : [
42-
'd-block mb-2',
43-
'd-sm-none' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && !$columnData['shouldCollapseOnMobile'],
44-
'd-md-none' => !$columnData['shouldCollapseAlways'] && !$columnData['shouldCollapseOnTablet'] && $columnData['shouldCollapseOnMobile'],
45-
'd-lg-none' => !$columnData['shouldCollapseAlways'] && ($columnData['shouldCollapseOnTablet'] || $columnData['shouldCollapseOnMobile']),
46-
47-
])>
48-
<strong>{{ $columnData['title'] }}</strong>: <br />
49-
<span @if($columnData['isHtml'])x-html="value" @else x-text="value"@endif></span>
50-
</div>
51-
@endtableloop
52-
</div>
53-
</td>
54-
</tr>
55-
@endif
42+
])>
43+
<strong>{{ $columnData['title'] }}</strong>: <br />
44+
<span @if($columnData['isHtml'])x-html="value" @else x-text="value"@endif></span>
45+
</div>
46+
@endtableloop
47+
</div>
48+
</td>
49+
</tr>

resources/views/components/table/tbody.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
'divide-y' => $coreTableAttributes['tbody']['default-styling'] ?? ($coreTableAttributes['tbody']['default'] ?? true),
1010
])
1111
->except(['default','default-styling','default-colors'])
12-
}} x-data
12+
}} x-data="{ showCollapsed: false }"
1313
>
14-
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $rowPk }}" :rowUrl="$hasTableRowUrl ? $this->getTableRowUrl($row) : ''" :rowTarget="$hasTableRowUrl ? $this->getTableRowUrlTarget($row) : ''">
14+
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $rowPk }}" :rowUrl="$hasTableRowUrl ? $this->getTableRowUrl($row) : ''" :rowTarget="$hasTableRowUrl ? $this->getTableRowUrlTarget($row) : ''">
1515

1616
@if($currentlyReorderingStatus)
1717
<x-livewire-tables::table.td.reorder x-cloak x-show="currentlyReorderingStatus" />
@@ -35,6 +35,6 @@
3535
</x-livewire-tables::table.tr>
3636

3737
@if ($showCollapsingColumnSections)
38-
<x-livewire-tables::table.collapsed-columns />
38+
<x-livewire-tables::table.collapsed-columns />
3939
@endif
4040
</tbody>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@props(['hidden' => false])
33
@if ($hasCollapsingColumns)
44

5-
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}"
5+
<td wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}"
66
{{
77
$attributes
88
->merge()
@@ -24,12 +24,12 @@
2424
@if (! $hidden)
2525
<button
2626
x-cloak x-show="!currentlyReorderingStatus"
27-
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open"
27+
x-on:click.prevent="showCollapsed = !showCollapsed"
2828
@class([
2929
'border-0 bg-transparent p-0' => $isBootstrap
3030
])
3131
>
32-
<x-heroicon-o-plus-circle x-cloak x-show="!open" {{
32+
<x-heroicon-o-plus-circle x-cloak x-show="!showCollapsed" {{
3333
$attributes->merge($collapsingColumnButtonExpandAttributes)
3434
->class($isTailwind ?
3535
[
@@ -43,7 +43,7 @@
4343
->except(['default','default-styling','default-colors'])
4444
}}
4545
/>
46-
<x-heroicon-o-minus-circle x-cloak x-show="open" {{
46+
<x-heroicon-o-minus-circle x-cloak x-show="showCollapsed" {{
4747
$attributes->merge($collapsingColumnButtonCollapseAttributes)
4848
->class($isTailwind ?
4949
[
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@aware([ 'rowIndex', 'rowID','isTailwind','isBootstrap', 'hideUntilReorder', 'filterGenericData'])
2+
@props(['column', 'customAttributes' => [], 'displayMinimisedOnReorder' => false])
3+
4+
<td {{ $attributes
5+
->merge($customAttributes)
6+
->merge([
7+
'x-cloak' => $isTailwind
8+
])
9+
->class($isTailwind ? [
10+
'px-6 py-4 whitespace-nowrap text-sm font-medium dark:text-white' => $customAttributes['default'] ?? true,
11+
'hidden' => $column && $column->shouldCollapseAlways(),
12+
'hidden md:table-cell' => $column && $column->shouldCollapseOnMobile(),
13+
'hidden lg:table-cell' => $column && $column->shouldCollapseOnTablet(),
14+
] : [
15+
'' => $customAttributes['default'] ?? true,
16+
'd-none' => $column && $column->shouldCollapseAlways(),
17+
'd-none d-md-table-cell' => $column && $column->shouldCollapseOnMobile(),
18+
'd-none d-lg-table-cell' => $column && $column->shouldCollapseOnTablet(),
19+
])
20+
->except(['default','default-styling','default-colors'])
21+
}} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif >
22+
@if($column->hasSecondaryHeader() && $column->hasSecondaryHeaderCallback())
23+
@if( $column->secondaryHeaderCallbackIsFilter())
24+
{{ $column->getSecondaryHeaderFilter($column->getSecondaryHeaderCallback(), $filterGenericData) }}
25+
@elseif($column->secondaryHeaderCallbackIsString())
26+
{{ $column->getSecondaryHeaderFilter($this->getFilterByKey($column->getSecondaryHeaderCallback()), $filterGenericData) }}
27+
@else
28+
{{ $column->getNewSecondaryHeaderContents($this->getRows) }}
29+
@endif
30+
@endif
31+
32+
</td>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
@aware(['isTailwind','isBootstrap'])
2+
@props(['column', 'index'])
3+
4+
@php
5+
$allThAttributes = $this->getAllThAttributes($column);
6+
$customThAttributes = $allThAttributes['customAttributes'];
7+
$customSortButtonAttributes = $allThAttributes['sortButtonAttributes'];
8+
$customLabelAttributes = $allThAttributes['labelAttributes'];
9+
$customIconAttributes = $this->getThSortIconAttributes($column);
10+
$direction = $column->hasField() ? $this->getSort($column->getColumnSelectName()) : $this->getSort($column->getSlug()) ?? null;
11+
@endphp
12+
13+
<th {{
14+
$attributes->merge($customThAttributes)
15+
->class($isTailwind ?
16+
[
17+
'text-gray-500 dark:bg-gray-800 dark:text-gray-400' => (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true)),
18+
'px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true)),
19+
'hidden' => $column->shouldCollapseAlways(),
20+
'hidden md:table-cell' => $column->shouldCollapseOnMobile(),
21+
'hidden lg:table-cell' => $column->shouldCollapseOnTablet(),
22+
] : [
23+
'' => ($customThAttributes['default'] ?? true),
24+
'd-none' => $column->shouldCollapseAlways(),
25+
'd-none d-md-table-cell' => $column->shouldCollapseOnMobile(),
26+
'd-none d-lg-table-cell' => $column->shouldCollapseOnTablet(),
27+
])
28+
->except(['default', 'default-colors', 'default-styling'])
29+
}}>
30+
@if($column->getColumnLabelStatus())
31+
@unless ($this->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback()))
32+
<x-livewire-tables::table.th.label :$customLabelAttributes :columnTitle="$column->getTitle()" />
33+
@else
34+
@if ($isTailwind)
35+
36+
<button wire:click="sortBy('{{ $column->getColumnSortKey() }}')" {{
37+
$attributes->merge($customSortButtonAttributes)
38+
->class([
39+
'text-gray-500 dark:text-gray-400' => (($customSortButtonAttributes['default-colors'] ?? true) || ($customSortButtonAttributes['default'] ?? true)),
40+
'flex items-center space-x-1 text-left text-xs leading-4 font-medium uppercase tracking-wider group focus:outline-none' => (($customSortButtonAttributes['default-styling'] ?? true) || ($customSortButtonAttributes['default'] ?? true)),
41+
])
42+
->except(['default', 'default-colors', 'default-styling', 'wire:key'])
43+
}}>
44+
<x-livewire-tables::table.th.label :$customLabelAttributes :columnTitle="$column->getTitle()" />
45+
<x-livewire-tables::table.th.sort-icons :$direction :$customIconAttributes />
46+
</button>
47+
@elseif ($isBootstrap)
48+
<div wire:click="sortBy('{{ $column->getColumnSortKey() }}')" {{
49+
$attributes->merge($customSortButtonAttributes)
50+
->class([
51+
'd-flex align-items-center laravel-livewire-tables-cursor' => (($customSortButtonAttributes['default-styling'] ?? true) || ($customSortButtonAttributes['default'] ?? true))
52+
])
53+
->except(['default', 'default-colors', 'default-styling', 'wire:key'])
54+
}}>
55+
<x-livewire-tables::table.th.label :$customLabelAttributes :columnTitle="$column->getTitle()" />
56+
<x-livewire-tables::table.th.sort-icons :$direction :$customIconAttributes />
57+
58+
</div>
59+
@endif
60+
61+
@endunless
62+
@endif
63+
</th>

0 commit comments

Comments
 (0)