Skip to content

Commit b725ff8

Browse files
committed
v4 Pre Commit
1 parent 467b123 commit b725ff8

File tree

67 files changed

+790
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+790
-447
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ phpunit.xml.bak
2121
phpstan.txt
2222
coverage.xml
2323
./tmp/**
24+
./*.php.bk

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ parameters:
4141
- src/Views/Filters/Traits/HasOptions.php
4242
- src/Views/Traits/Core/HasTheme.php
4343
- src/Views/Traits/Core/HasView.php
44+
- message: '# \$view of function view expects view-string\|null, string given.#'

resources/views/components/table/td/bulk-actions.blade.php renamed to resources/views/components/bulk-actions/td.blade.php

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

3-
@if ($this->showBulkActionsSections())
3+
@if ($showBulkActionsSections)
44
<x-livewire-tables::table.td.plain wire:key="{{ $tableName }}-tbody-td-bulk-actions-td-{{ $rowPk }}" :displayMinimisedOnReorder="true" :customAttributes=$tdAttributes>
55
<div @class($isTailwind ? [
66
'inline-flex rounded-md shadow-sm',
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
@aware([ 'tableName', 'isTailwind', 'isBootstrap', 'localisationPath'])
2+
3+
@if ($this->bulkActionsAreEnabled() && $this->hasBulkActions())
4+
@php
5+
$colspan = $this->getColspanCount();
6+
$selectAll = $this->selectAllIsEnabled();
7+
$simplePagination = $this->isPaginationMethod('simple');
8+
@endphp
9+
10+
11+
<x-livewire-tables::table.tr.plain
12+
x-cloak x-show="selectedItems.length > 0 && !currentlyReorderingStatus" data-id="bil"
13+
wire:key="{{ $tableName }}-bulk-select-message"
14+
@class([
15+
'bg-indigo-50 dark:bg-gray-900 dark:text-white' => $isTailwind,
16+
])
17+
18+
>
19+
<x-livewire-tables::table.td.plain :colIndex="'bulkactions'" :colspan="$colspan">
20+
<template x-if="selectedItems.length == paginationTotalItemCount || selectAllStatus">
21+
<div wire:key="{{ $tableName }}-all-selected">
22+
<span>
23+
{{ __($localisationPath.'You are currently selecting all') }}
24+
@if(!$simplePagination) <strong><span x-text="paginationTotalItemCount"></span></strong> @endif
25+
{{ __($localisationPath.'rows') }}.
26+
</span>
27+
28+
<button
29+
x-on:click="clearSelected"
30+
wire:loading.attr="disabled"
31+
type="button"
32+
{{
33+
$this->getBulkActionsRowButtonAttributesBag()->class($isTailwind ?
34+
[
35+
'ml-1 underline text-sm leading-5 font-medium focus:outline-none focus:underline transition duration-150 ease-in-out' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true),
36+
'text-blue-600 text-gray-700 focus:text-gray-800 dark:text-white dark:hover:text-gray-400' => ($this->getBulkActionsRowButtonAttributes()['default-colors'] ?? true),
37+
]:[
38+
'btn btn-primary btn-sm' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true)
39+
])
40+
}}
41+
>
42+
{{ __($localisationPath.'Deselect All') }}
43+
</button>
44+
</div>
45+
</template>
46+
47+
<template x-if="selectedItems.length !== paginationTotalItemCount && !selectAllStatus">
48+
<div wire:key="{{ $tableName }}-some-selected">
49+
<span>
50+
{{ __($localisationPath.'You have selected') }}
51+
<strong><span x-text="selectedItems.length"></span></strong>
52+
{{ __($localisationPath.'rows, do you want to select all') }}
53+
@if(!$simplePagination) <strong><span x-text="paginationTotalItemCount"></span></strong> @endif
54+
</span>
55+
56+
<button
57+
x-on:click="selectAllOnPage()"
58+
wire:loading.attr="disabled"
59+
type="button"
60+
{{
61+
$this->getBulkActionsRowButtonAttributesBag()->class($isTailwind ? [
62+
'ml-1 underline text-sm leading-5 font-medium focus:outline-none focus:underline transition duration-150 ease-in-out' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true),
63+
'text-blue-600 text-gray-700 focus:text-gray-800 dark:text-white dark:hover:text-gray-400' =>($this->getBulkActionsRowButtonAttributes()['default-colors'] ?? true),
64+
]: [
65+
'btn btn-primary btn-sm' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true)
66+
])
67+
}}
68+
69+
>{{ __($localisationPath.'Select All On Page') }}
70+
</button>&nbsp;
71+
72+
<button
73+
x-on:click="setAllSelected()"
74+
wire:loading.attr="disabled"
75+
type="button"
76+
{{
77+
$this->getBulkActionsRowButtonAttributesBag()->class($isTailwind ?
78+
[
79+
'ml-1 underline text-sm leading-5 font-medium focus:outline-none focus:underline transition duration-150 ease-in-out' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true),
80+
'text-blue-600 text-gray-700 focus:text-gray-800 dark:text-white dark:hover:text-gray-400' => ($this->getBulkActionsRowButtonAttributes()['default-colors'] ?? true),
81+
]: [
82+
'btn btn-primary btn-sm' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true)
83+
])
84+
}}
85+
>
86+
{{ __($localisationPath.'Select All') }}
87+
</button>
88+
89+
<button
90+
x-on:click="clearSelected"
91+
wire:loading.attr="disabled"
92+
type="button"
93+
{{
94+
$this->getBulkActionsRowButtonAttributesBag()->class($isTailwind ?
95+
[
96+
'ml-1 underline text-sm leading-5 font-medium focus:outline-none focus:underline transition duration-150 ease-in-out' =>($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true),
97+
'text-blue-600 text-gray-700 focus:text-gray-800 dark:text-white dark:hover:text-gray-400' => ($this->getBulkActionsRowButtonAttributes()['default-colors'] ?? true),
98+
]:[
99+
'btn btn-primary btn-sm' => ($this->getBulkActionsRowButtonAttributes()['default-styling'] ?? true)
100+
])
101+
}}
102+
>
103+
{{ __($localisationPath.'Deselect All') }}
104+
</button>
105+
</div>
106+
</template>
107+
</x-livewire-tables::table.td.plain>
108+
</x-livewire-tables::table.tr.plain>
109+
@endif
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@aware(['isTailwind', 'tableName'])
2+
<x-livewire-tables::table.tr.plain {{ $attributes->merge(
3+
[
4+
'x-cloak' => '',
5+
'x-show' => 'selectedItems.length > 0 && !currentlyReorderingStatus',
6+
'data-id' => 'bil',
7+
'wire:key' => $tableName . "-bulk-select-message",
8+
9+
]
10+
)->class(
11+
'bg-indigo-50 dark:bg-gray-900 dark:text-white' => $isTailwind,
12+
) }}>
13+
{{ $slot }}
14+
</x-livewire-tables::table.tr.plain>

resources/views/components/table/collapsed-columns.blade.php renamed to resources/views/components/collapsed-columns/collapsed-columns.blade.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
@aware([ 'tableName', 'primaryKey','isTailwind','isBootstrap', 'collapsingColumnDetails', 'row', 'rowIndex', 'rowPk', 'hasCollapsingColumns', 'hasTrAttributes'])
1+
@aware([ 'tableName', 'isTailwind','isBootstrap', 'collapsingColumnInfo', 'row', 'rowIndex', 'rowPk', 'tableRowDetails'])
22

3-
@if ($hasCollapsingColumns)
4-
@php($customAttributes = $hasTrAttributes ? $this->getTrAttributes($row, $rowIndex) : ['default' => true])
3+
@if ($collapsingColumnInfo['hasCollapsingColumns'] ?? false)
54
<tr x-data
65
@toggle-row-content.window="($event.detail.tableName === '{{ $tableName }}' && $event.detail.row === {{ $rowIndex }}) ? $el.classList.toggle('{{ $isBootstrap ? 'd-none' : 'hidden' }}') : null"
76
{{
87
$attributes->merge([
98
'wire:loading.class.delay' => 'opacity-50 dark:bg-gray-900 dark:opacity-60',
109
'wire:key' => $tableName.'-row-'.$rowPk.'-collapsed-contents',
1110
])
12-
->merge($customAttributes)
11+
->merge($tableRowDetails['attributes'])
1312
->class($isTailwind ? [
14-
'hidden rappasoft-striped-row' => $customAttributes['default'] ?? true,
13+
'hidden rappasoft-striped-row' => $tableRowDetails['attributes']['default'] ?? true,
1514
] : [
16-
'd-none bg-light rappasoft-striped-row' => ($rowIndex % 2 === 0 && ($customAttributes['default'] ?? true)),
17-
'd-none bg-white rappasoft-striped-row' => ($rowIndex % 2 !== 0 && ($customAttributes['default'] ?? true)),
15+
'd-none bg-light rappasoft-striped-row' => ($rowIndex % 2 === 0 && ($tableRowDetails['attributes']['default'] ?? true)),
16+
'd-none bg-white rappasoft-striped-row' => ($rowIndex % 2 !== 0 && ($tableRowDetails['attributes']['default'] ?? true)),
1817
])
1918
->except(['default','default-styling','default-colors'])
2019
}}
@@ -26,7 +25,7 @@
2625
<div >
2726

2827

29-
@tableloop($collapsingColumnDetails as $colIndex => $columnData)
28+
@tableloop($collapsingColumnInfo['collapsingColumnDetails'] as $colIndex => $columnData)
3029
@php($key = $tableName . '_' . $rowIndex.'_'.$colIndex)
3130
<div wire:key="{{ $tableName }}-row-{{ $rowPk }}-collapsed-contents-{{ $colIndex }}"
3231
x-data="{ value: '',
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
@aware([ 'tableName','isTailwind','isBootstrap','rowIndex', 'collapsingColumnInfo'])
2+
@props(['hidden' => false])
3+
4+
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}"
5+
{{
6+
$attributes
7+
->merge()
8+
->class($isTailwind ? [
9+
'p-3 table-cell text-center',
10+
'sm:hidden' => !($collapsingColumnInfo['shouldCollapseAlways'] ?? false) && !($collapsingColumnInfo['shouldCollapseOnTablet'] ?? false),
11+
'md:hidden' => !($collapsingColumnInfo['shouldCollapseAlways'] ?? false) && !($collapsingColumnInfo['shouldCollapseOnTablet'] ?? false) && ($collapsingColumnInfo['shouldCollapseOnMobile'] ?? false),
12+
'lg:hidden' => !($collapsingColumnInfo['shouldCollapseAlways'] ?? false) && (($collapsingColumnInfo['shouldCollapseOnTablet'] ?? false) || ($collapsingColumnInfo['shouldCollapseOnMobile'] ?? false)),
13+
] :
14+
[
15+
'd-sm-none' => !($collapsingColumnInfo['shouldCollapseAlways'] ?? false) && !($collapsingColumnInfo['shouldCollapseOnTablet'] ?? false),
16+
'd-md-none' => !($collapsingColumnInfo['shouldCollapseAlways'] ?? false) && !($collapsingColumnInfo['shouldCollapseOnTablet'] ?? false) && ($collapsingColumnInfo['shouldCollapseOnMobile'] ?? false),
17+
'd-lg-none' => !($collapsingColumnInfo['shouldCollapseAlways'] ?? false) && (($collapsingColumnInfo['shouldCollapseOnTablet'] ?? false) || ($collapsingColumnInfo['shouldCollapseOnMobile'] ?? false)),
18+
19+
])
20+
}}
21+
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''"
22+
>
23+
@if (! $hidden)
24+
<button
25+
x-cloak x-show="!currentlyReorderingStatus"
26+
@mouseover="if(opening != true) { opening = true }; "
27+
x-on:click.prevent="if(opening != true) { opening = true }; $dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open;"
28+
@class([
29+
'border-0 bg-transparent p-0' => $isBootstrap,
30+
'w-full h-full',
31+
])
32+
>
33+
<x-heroicon-o-plus-circle x-cloak x-show="!open" {{
34+
$attributes->merge($collapsingColumnInfo['buttonExpandAttributes'])
35+
->class($isTailwind ?
36+
[
37+
'h-6 w-6' => ($collapsingColumnInfo['buttonExpandAttributes']['default-styling'] ?? true),
38+
'text-green-600' => ($collapsingColumnInfo['buttonExpandAttributes']['default-colors'] ?? true),
39+
] :
40+
[
41+
'laravel-livewire-tables-btn-lg text-success' => ($collapsingColumnInfo['buttonExpandAttributes']['default-colors'] ?? true)
42+
43+
])
44+
->except(['default','default-styling','default-colors'])
45+
}}
46+
/>
47+
<x-heroicon-o-minus-circle x-cloak x-show="open" {{
48+
$attributes->merge($collapsingColumnInfo['buttonCollapseAttributes'])
49+
->class($isTailwind ?
50+
[
51+
'h-6 w-6' => ($collapsingColumnInfo['buttonCollapseAttributes']['default-styling'] ?? true),
52+
'text-yellow-600' => ($collapsingColumnInfo['buttonCollapseAttributes']['default-colors'] ?? true),
53+
] : [
54+
'laravel-livewire-tables-btn-lg text-warning' => ($collapsingColumnInfo['buttonCollapseAttributes']['default-colors'] ?? true),
55+
])
56+
->except(['default','default-styling','default-colors'])
57+
}}
58+
/>
59+
</button>
60+
@endif
61+
</td>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@aware(['isTailwind', 'isBootstrap','collapsingColumnInfo'])
2+
@if ($collapsingColumnInfo['hasCollapsingColumns'])
3+
<th scope="col" :class="{ 'laravel-livewire-tables-reorderingMinimised': ! currentlyReorderingStatus }" {{
4+
$attributes->merge()
5+
->class($isTailwind ? [
6+
'table-cell dark:bg-gray-800 laravel-livewire-tables-reorderingMinimised',
7+
'sm:hidden' => !$collapsingColumnInfo['shouldCollapseOnTablet'] && !$collapsingColumnInfo['shouldCollapseAlways'],
8+
'md:hidden' => !$collapsingColumnInfo['shouldCollapseOnMobile'] && !$collapsingColumnInfo['shouldCollapseOnTablet'] && !$collapsingColumnInfo['shouldCollapseAlways'],
9+
'lg:hidden' => !$collapsingColumnInfo['shouldCollapseAlways'],
10+
] : [
11+
'd-table-cell laravel-livewire-tables-reorderingMinimised',
12+
'd-sm-none' => !$collapsingColumnInfo['shouldCollapseOnTablet'] && !$collapsingColumnInfo['shouldCollapseAlways'],
13+
'd-md-none' => !$collapsingColumnInfo['shouldCollapseOnMobile'] && !$collapsingColumnInfo['shouldCollapseOnTablet'] && !$collapsingColumnInfo['shouldCollapseAlways'],
14+
'd-lg-none' => !$collapsingColumnInfo['shouldCollapseAlways'],
15+
])
16+
}}></th>
17+
@endif

0 commit comments

Comments
 (0)