Skip to content

Commit 28cc21a

Browse files
authored
Merge pull request #2174 from rappasoft/development
Development to Master for 3.6.0
2 parents 692d780 + 6598b25 commit 28cc21a

File tree

214 files changed

+4702
-3739
lines changed

Some content is hidden

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

214 files changed

+4702
-3739
lines changed

.github/workflows/run-tests-pcov-pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8989

9090
- name: Run Unit Tests
91-
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Unit Test Suite" --cache-directory=".phpunit.cache/code-coverage" --strict-coverage --coverage-clover ./coverage.xml
91+
run: php ./vendor/bin/phpunit --cache-directory=".phpunit.cache/code-coverage" --strict-coverage --coverage-clover ./coverage.xml --testsuite "Laravel Livewire Tables Unit Test Suite","Laravel Livewire Tables Visuals Test Suite"
9292

9393
- name: Upload coverage reports to Codecov
9494
uses: codecov/codecov-action@v5

.github/workflows/run-tests-pull.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
fail-fast: false
14-
max-parallel: 3
14+
max-parallel: 2
1515
matrix:
1616
os: [ubuntu-latest]
17-
php: [8.1, 8.2, 8.3, 8.4]
17+
php: [8.2, 8.3, 8.4]
1818
laravel: [10.*]
1919
stability: [prefer-dist]
2020

@@ -85,8 +85,10 @@ jobs:
8585
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8686

8787
- name: Run Unit Tests
88-
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
88+
run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
8989

90+
- name: Run Visuals Tests
91+
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage
9092

9193
test-laravel11:
9294
runs-on: ${{ matrix.os }}
@@ -166,4 +168,7 @@ jobs:
166168
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
167169

168170
- name: Run Unit Tests
169-
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
171+
run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
172+
173+
- name: Run Visuals Tests
174+
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage

.github/workflows/run-tests.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
16-
max-parallel: 3
16+
max-parallel: 2
1717
matrix:
1818
os: [ubuntu-24.04]
19-
php: [8.1, 8.2, 8.3, 8.4]
19+
php: [8.2, 8.3, 8.4]
2020
laravel: [10.*]
2121
stability: [prefer-dist]
2222

@@ -87,8 +87,10 @@ jobs:
8787
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8888

8989
- name: Run Unit Tests
90-
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
90+
run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
9191

92+
- name: Run Visuals Tests
93+
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage
9294

9395
test-laravel11:
9496
runs-on: ${{ matrix.os }}
@@ -168,4 +170,7 @@ jobs:
168170
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
169171

170172
- name: Run Unit Tests
171-
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
173+
run: php ./vendor/bin/paratest --testsuite "Laravel Livewire Tables Unit Test Suite" --no-coverage
174+
175+
- name: Run Visuals Tests
176+
run: php ./vendor/bin/phpunit --testsuite "Laravel Livewire Tables Visuals Test Suite" --no-coverage

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22

33
All notable changes to `laravel-livewire-tables` will be documented in this file
44

5+
6+
## [v3.6.0] - UNRELEASED
7+
8+
### Bug Fixes
9+
- Ensure Default Sorting Is Shown in Pills by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2138
10+
- Filters
11+
- Find Filters Before Query by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2143
12+
- Migrate Filter Code Appropriately by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2146
13+
- Migrate Filter Status into Own Trait by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2147
14+
15+
### Tweaks
16+
- Enable InputAttributes for SelectFilter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2133
17+
- Tidy ComponentUtilities, Migrate ColumnSelectQueryString by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2135
18+
- TH Fixes - Clean-up, efficiency, and Sort Icons fixes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2140
19+
- Add hasCollapsedColumns as Computed by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2141
20+
- Tidy up Blade Class Definitions by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2145
21+
- Tidy ColumnSelectHelpers & displayToolbarFilters Method by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2150
22+
- Tidy & Improve Collapsed Columns Behaviour by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2159
23+
- Tidy computed properties behaviour by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2160
24+
- WithSearch Tweaks by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2163
25+
- Optimize Header/Footer by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2164
26+
- Clean up Column Component View and Slot behaviours by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2169
27+
- Adjustments for ComponentColumn - cleaning up behaviours by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2173
28+
29+
### Testing
30+
- Add Missing Test for getCustomSortingPillDirectionsLabel with invalid direction by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2130
31+
- Add Custom FIlter Input Attributes, Cleanup Filter Tests by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2131
32+
- Separate the Unit and Visuals Test Suites by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2144
33+
- Update PCOV Workflow by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2148
34+
- Add configurable area test by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2149
35+
- Add SortingConfiguration Missing Test by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2151
36+
- Add Missing Search Tests by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2152
37+
- Adjust SearchHelpersTest by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2153
38+
- Add test queryStringWithQueryString by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2154
39+
- Add missing tests by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2157
40+
- Add queryStringAliasTest by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2161
41+
- Migrate LivewireComponentColumn methods and add some missing basic tests by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2168
42+
- Add initial tests for LivewireComponentArrayFilter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2170
43+
- Improve centralisation of tests by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2172
44+
545
## [v3.5.10] - 2024-12-11
646
### Tweaks
747
- Migrate additional Styling into separate traits by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2127

docs/filter-types/filters-number.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ weight: 9
55

66
Number filters are just HTML number inputs.
77

8+
```php
9+
public function filters(): array
10+
{
11+
return [
12+
NumberFilter::make('Amount')
13+
->filter(function(Builder $builder, string $value) {
14+
$builder->where('amount', '<', $value);
15+
}),
16+
];
17+
}
18+
```
19+
20+
Historically, min/max/placeholders were set using the "config" option, which is still available. However, it is strongly recommended to use the new setInputAttributes for enhanced customisation.
21+
22+
## Old Behaviour
23+
The following would:
24+
- Set a min of 0
25+
- Set a max of 100
26+
- Add a placeholder
27+
- Keep the default colors & styling
28+
829
```php
930
public function filters(): array
1031
{
@@ -21,3 +42,28 @@ public function filters(): array
2142
];
2243
}
2344
```
45+
46+
## New Behaviour
47+
The following would:
48+
- Set a min of 5
49+
- Set a max of 20
50+
- Set steps to be 0.5
51+
- Add a placeholder
52+
- Keep the default colors & styling
53+
54+
```php
55+
public function filters(): array
56+
{
57+
return [
58+
NumberFilter::make('Age')
59+
->setInputAttributes([
60+
'min' => '5', // Minimum Value Accepted
61+
'max' => '20', // Maximum Value Accepted
62+
'step' => '0.5', // Set step
63+
'placeholder' => 'Enter Number 0 - 100', // A placeholder value
64+
'default-colors' => true,
65+
'default-styling' => true,
66+
]),
67+
];
68+
}
69+
```

docs/filters/available-filter-methods.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,58 @@ TextFilter::make('Name')
208208
),
209209
```
210210

211+
## setInputAttributes
212+
Allows for customising the attributes that will apply to the input field for the filter.
213+
214+
By default, this replaces the default classes on the Filter Input, if you would like to keep them, set the default-styling and/or default-colors flags to true.
215+
216+
### TextFilter Example
217+
The following would:
218+
- Set a maxlength of 75
219+
- Set a placeholder of "Enter a Name"
220+
- Replace the default colors
221+
- Retain the default styling (e.g. rounding/shadow)
222+
223+
```php
224+
public function filters(): array
225+
{
226+
return [
227+
TextFilter::make('Name')
228+
->setInputAttributes([
229+
'maxlength' => '75',
230+
'placeholder' => 'Enter a Name',
231+
'class' => 'text-white bg-red-500 dark:bg-red-500',
232+
'default-colors' => false,
233+
'default-styling' => true,
234+
]),
235+
];
236+
}
237+
```
238+
239+
### NumberFilter Example
240+
The following would:
241+
- Set a min of 5
242+
- Set a max of 20
243+
- Set steps to be 0.5
244+
- Keep the default colors & styling
245+
246+
```php
247+
public function filters(): array
248+
{
249+
return [
250+
NumberFilter::make('Age')
251+
->setInputAttributes([
252+
'min' => '5',
253+
'max' => '20',
254+
'step' => '0.5',
255+
'default-colors' => true,
256+
'default-styling' => true,
257+
]),
258+
];
259+
}
260+
```
261+
262+
211263
## setCustomView
212264
Use a fully custom view for a filter. This will utilise solely your view when rendering this filter. Note that the following methods will no longer apply to a filter using this:
213265
- setCustomFilterLabel

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<testsuite name="Laravel Livewire Tables Unit Test Suite">
1313
<directory>tests/Unit</directory>
1414
</testsuite>
15+
<testsuite name="Laravel Livewire Tables Visuals Test Suite">
16+
<directory>tests/Visuals</directory>
17+
</testsuite>
1518
<testsuite name="Laravel Livewire Tables Localisations Unit">
1619
<directory>tests/Localisations/Unit</directory>
1720
</testsuite>

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<div {{ $attributes
22
->merge($this->getActionWrapperAttributes)
3-
->class(['flex flex-cols py-2 space-x-2' => $this->isTailwind && $this->getActionWrapperAttributes['default-styling'] ?? true])
4-
->class(['' => $this->isTailwind && $this->getActionWrapperAttributes['default-colors'] ?? true])
5-
->class(['d-flex flex-cols py-2 space-x-2' => $this->isBootstrap && $this->getActionWrapperAttributes['default-styling'] ?? true])
6-
->class(['' => $this->isBootstrap && $this->getActionWrapperAttributes['default-colors'] ?? true])
7-
->class(['justify-start' => $this->getActionsPosition === 'left'])
8-
->class(['justify-center' => $this->getActionsPosition === 'center'])
9-
->class(['justify-end' => $this->getActionsPosition === 'right'])
10-
->class(['pl-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'left'])
11-
->class(['pr-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'right'])
3+
->class([
4+
'flex flex-cols py-2 space-x-2' => $this->isTailwind && ($this->getActionWrapperAttributes['default-styling'] ?? true),
5+
'' => $this->isTailwind && ($this->getActionWrapperAttributes['default-colors'] ?? true),
6+
'd-flex flex-cols py-2 space-x-2' => $this->isBootstrap && ($this->getActionWrapperAttributes['default-styling'] ?? true),
7+
'' => $this->isBootstrap && ($this->getActionWrapperAttributes['default-colors'] ?? true),
8+
'justify-start' => $this->getActionsPosition === 'left',
9+
'justify-center' => $this->getActionsPosition === 'center',
10+
'justify-end' => $this->getActionsPosition === 'right',
11+
'pl-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'left',
12+
'pr-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'right',
13+
])
1214
->except(['default','default-styling','default-colors'])
1315
}} >
1416
@foreach($this->getActions as $action)

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
99

1010
<tr wire:key="{{ $tableName }}-loader" wire:loading.class.remove="hidden d-none" {{
1111
$attributes->merge($loaderRow)
12-
->class(['hidden w-full text-center place-items-center align-middle' => $this->isTailwind && ($loaderRow['default'] ?? true)])
13-
->class(['d-none w-100 text-center align-items-center' => $this->isBootstrap && ($loaderRow['default'] ?? true)])
12+
->class([
13+
'hidden w-full text-center place-items-center align-middle' => $this->isTailwind && ($loaderRow['default'] ?? true),
14+
'd-none w-100 text-center align-items-center' => $this->isBootstrap && ($loaderRow['default'] ?? true),
15+
])
1416
->except(['default','default-styling','default-colors'])
1517
}}>
1618
<td colspan="{{ $colCount }}" wire:key="{{ $tableName }}-loader-column" {{
1719
$attributes->merge($loaderCell)
18-
->class(['py-4' => $this->isTailwind && ($loaderCell['default'] ?? true)])
19-
->class(['py-4' => $this->isBootstrap && ($loaderCell['default'] ?? true)])
20+
->class([
21+
'py-4' => $this->isTailwind && ($loaderCell['default'] ?? true),
22+
'py-4' => $this->isBootstrap && ($loaderCell['default'] ?? true),
23+
])
2024
->except(['default','default-styling','default-colors', 'colspan','wire:key'])
2125
}}>
2226
@if($this->hasLoadingPlaceholderBlade())
@@ -25,8 +29,10 @@
2529
<div class="h-min self-center align-middle text-center">
2630
<div class="lds-hourglass"{{
2731
$attributes->merge($loaderIcon)
28-
->class(['lds-hourglass' => $this->isTailwind && ($loaderIcon['default'] ?? true)])
29-
->class(['lds-hourglass' => $this->isBootstrap && ($loaderIcon['default'] ?? true)])
32+
->class([
33+
'lds-hourglass' => $this->isTailwind && ($loaderIcon['default'] ?? true),
34+
'lds-hourglass' => $this->isBootstrap && ($loaderIcon['default'] ?? true),
35+
])
3036
->except(['default','default-styling','default-colors'])
3137
}}></div>
3238
<div>{!! $this->getLoadingPlaceholderContent() !!}</div>

resources/views/components/table.blade.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
<div
1414
wire:key="{{ $tableName }}-twrap"
1515
{{ $attributes->merge($customAttributes['wrapper'])
16-
->class(['shadow overflow-y-auto border-b border-gray-200 dark:border-gray-700 sm:rounded-lg' => $customAttributes['wrapper']['default'] ?? true])
16+
->class([
17+
'shadow overflow-y-auto border-b border-gray-200 dark:border-gray-700 sm:rounded-lg' => $customAttributes['wrapper']['default'] ?? true
18+
])
1719
->except(['default','default-styling','default-colors']) }}
1820
>
1921
<table
@@ -25,7 +27,9 @@
2527
>
2628
<thead wire:key="{{ $tableName }}-thead"
2729
{{ $attributes->merge($customAttributes['thead'])
28-
->class(['bg-gray-50 dark:bg-gray-800' => $customAttributes['thead']['default'] ?? true])
30+
->class([
31+
'bg-gray-50 dark:bg-gray-800' => $customAttributes['thead']['default'] ?? true
32+
])
2933
->except(['default','default-styling','default-colors']) }}
3034
>
3135
<tr>
@@ -37,7 +41,9 @@
3741
wire:key="{{ $tableName }}-tbody"
3842
id="{{ $tableName }}-tbody"
3943
{{ $attributes->merge($customAttributes['tbody'])
40-
->class(['bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-none' => $customAttributes['tbody']['default'] ?? true])
44+
->class([
45+
'bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-none' => $customAttributes['tbody']['default'] ?? true
46+
])
4147
->except(['default','default-styling','default-colors']) }}
4248
>
4349
{{ $slot }}

0 commit comments

Comments
 (0)