Skip to content

Commit 540e526

Browse files
authored
v3.4.3 (#1826)
## [v3.4.3] - 2024-08-08 ### New Features - Boolean/Toggle Filter by @lrljoe in #1830 ### Bug Fixes - View component column fixes by @lrljoe in #1825 ### Docs - Update setDelaySelectAllEnabled Docs by @lrljoe in #1829 - ViewComponentColumn - New method docs by @lrljoe in #1828
1 parent d90aecb commit 540e526

Some content is hidden

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

53 files changed

+748
-307
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@
3737
/resources/js/partials/filter-date-range.js export-ignore
3838
/resources/js/partials/filter-number-range.js export-ignore
3939
/resources/js/partials/reorder.js export-ignore
40+
/minifyJs export-ignore

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ phpunit.xml.dist.dev
2020
phpunit.xml.bak
2121
phpstan.txt
2222
coverage.xml
23-
./tmp/**
23+
./tmp/**

CHANGELOG.md

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

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

5+
## [v3.4.3] - 2024-08-08
6+
### New Features
7+
- Boolean/Toggle Filter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1830
8+
9+
### Bug Fixes
10+
- View component column fixes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1825
11+
12+
### Docs
13+
- Update setDelaySelectAllEnabled Docs by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1829
14+
- ViewComponentColumn - New method docs by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1828
15+
516
## [v3.4.2] - 2024-08-04
617
### New Features
718
- Additional Events & Customisable Behaviour by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1820

docs/bulk-actions/available-methods.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,29 @@ public function configure(): void
305305

306306
This prevents the default behaviour from firing, which improves performance when working with very large sets of data. With this feature enabled, the backend update will not fire, however an indication that all result rows have been selected will be passed to the backend, and the frontend will behave as if all rows are selected.
307307

308+
308309
When running your Bulk Action, having used "Select All", you may then access the array of "all rows" based on your most recent search/filter results:
309-
```
310+
```php
310311
$rows = $this->getSelectedRows();
311312
```
312313

314+
Once your bulk action completes, ensure that you call:
315+
```php
316+
$this->clearSelected();
317+
```
318+
319+
### IMPORTANT NOTES
320+
#### Actions After Frontend Select All
321+
If you apply a filter/search/sort, then the delay select will be abandoned, and the array will be populated. Ensure that you do not do this!
322+
323+
#### Use of setSelectAll
324+
Do NOT call either of these methods, as they will prevent the correct method from working. These two methods SELECT ALL regardless of what the frontend is doing.
325+
```php
326+
$this->setSelectAllStatus(true);
327+
$this->setSelectAllEnabled();
328+
```
329+
330+
313331
## setDelaySelectAllDisabled
314332

315333
This is the default behaviour, see setDelaySelectEnabled for details on what enabling this does.

docs/column-types/sum_column.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ weight: 13
55

66
Sum columns provide an easy way to display the "Sum" of a field on a relation.
77

8-
```
8+
```php
99
SumColumn::make('Total Age of Related Users')
1010
->setDataSource('users','age')
1111
->sortable(),

docs/column-types/view_component_column.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ ViewComponentColumn::make('E-mail', 'email')
1515
]),
1616
```
1717

18+
### customComponent
19+
20+
Should you wish to render the Custom Component in it's entirety, then you may use the customComponent method. Otherwise it will pass in the values directly to the blade, rather than executing your View Component.
21+
22+
```php
23+
ViewComponentColumn::make('Weight', 'grams')
24+
->customComponent(\App\View\Components\TestWeight::class)
25+
->attributes(fn ($value, $row, Column $column) => [
26+
'weight' => new Weight($value),
27+
]),
28+
```
29+
1830
Please also see the following for other available methods:
1931
<ul>
2032
<li>

docs/columns/reusable-columns.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ To mitigate the pain of maintaining this, two new methods have been introduced.
1010
These methods both function in exactly the same way as your standard columns(), and expect an array of columns.
1111

1212
Any columns defined in prependColumns() will be the first columns in your list of columns.
13-
```
13+
```php
1414
public function prependColumns(): array
1515
{
1616
return [];
1717
}
1818
```
1919

2020
Any columns defined in appendColumns() will be the last columns in your list of columns.
21-
```
21+
```php
2222
public function appendColumns(): array
2323
{
2424
return [];
@@ -28,7 +28,7 @@ public function appendColumns(): array
2828
You can call these in your trait, and they will be automatically appended/prepended to tables.
2929

3030
For example, to append a Column for Updated At
31-
```
31+
```php
3232
public function appendColumns(): array
3333
{
3434
return [
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Boolean Filters (beta)
3+
weight: 2
4+
---
5+
6+
## Beta
7+
This is currently in beta, and will only work with Tailwind.
8+
9+
## Details
10+
11+
The BooleanFilter is designed so that you can toggle a more complex query/filter, as opposed to being a yes/no type of filter (which is what the SelectFilter is perfect for)
12+
13+
For example, your filter may look like this, toggling the filter from true to false would apply/not apply a more complex query to the query.
14+
15+
```php
16+
BooleanFilter::make('Limit to Older Enabled Users')
17+
->filter(function (Builder $builder, bool $enabled) {
18+
if ($enabled)
19+
{
20+
$builder->where('status',true)->where('age', '>', 60);
21+
}
22+
})
23+
```
24+
25+
Many of the standard methods are available, for example
26+
```php
27+
BooleanFilter::make('Limit to Older Enabled Users')
28+
->filter(function (Builder $builder, bool $enabled) {
29+
if ($enabled)
30+
{
31+
$builder->where('status',true)->where('age', '>', 60);
32+
}
33+
})
34+
->setFilterPillValues([
35+
true => 'Active',
36+
false => 'Inactive',
37+
])
38+
->setFilterDefaultValue(true)
39+
```

docs/filter-types/filters-date.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Date Filters
3-
weight: 2
3+
weight: 3
44
---
55

66
Date filters are HTML date elements.

docs/filter-types/filters-daterange.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: DateRange Filters
3-
weight: 3
3+
weight: 4
44
---
55

66
DateRange filters are Flatpickr based components, and simply filtering by a date range. If you would like to more smoothly filter your query by a start and end date, you can use the DateRangeFilter:
@@ -70,17 +70,17 @@ A full list of options is below, please see the Flatpickr documentation for refe
7070

7171
You may use this to set a default value for the filter that will be applied on first load (but may be cleared by the user). This should be an array:
7272

73-
```
73+
```php
7474
DateRangeFilter::make('EMail Verified Range')
7575
->setFilterDefaultValue(['minDate' => '2024-05-05', 'maxDate' => '2024-06-06'])
7676
```
7777
or
78-
```
78+
```php
7979
DateRangeFilter::make('EMail Verified Range')
8080
->setFilterDefaultValue(['min' => '2024-05-05', 'max' => '2024-06-06'])
8181
```
8282
or
83-
```
83+
```php
8484
DateRangeFilter::make('EMail Verified Range')
8585
->setFilterDefaultValue(['2024-05-05', '2024-06-06'])
8686
```
@@ -117,26 +117,26 @@ public function filters(): array
117117
By default, this filter will inject the Flatpickr JS Library and CSS. However, you can customise this behaviour using the configuration file.
118118

119119
### Option 1 - The default behaviour:
120-
```
120+
```php
121121
'inject_third_party_assets_enabled' => true,
122122
```
123123

124124
### Option 2 - Bundled
125125
If you choose to bundle the Tables JS/CSS (recommended) by adding the following to your build process:
126126

127-
```
127+
```js
128128
'vendor/rappasoft/laravel-livewire-tables/resources/js/laravel-livewire-tables-thirdparty.min.js';
129129
```
130130

131131
or in your app.js
132132

133-
```
133+
```js
134134
import '../../vendor/rappasoft/livewire-tables/resources/js/laravel-livewire-tables-thirdparty.min.js';
135135
```
136136

137137
Then you should disable injection to avoid conflicts:
138138

139-
```
139+
```php
140140
'inject_third_party_assets_enabled' => false,
141141
```
142142

@@ -146,12 +146,12 @@ You must ensure that Flatpickr is present PRIOR to the tables loading. For exam
146146
It is typically recommended not to utilise the CDN approach, as changes to core code may impact behaviour, and you may need to implement changes to your CSP if present.
147147

148148
If using the CDN approach, ensure the following config matches:
149-
```
149+
```js
150150
'inject_third_party_assets_enabled' => false,
151151
```
152152

153153
Then include the following in your layout:
154-
```
154+
```html
155155
// Flatpickr Core Script
156156
<script src="https://npmcdn.com/flatpickr" async></script>
157157

@@ -161,7 +161,7 @@ Then include the following in your layout:
161161

162162
### Option 4 - Locally Installed
163163
If you have a locally installed version of Flatpickr already, you can set injection to false, and your local version will be used instead.
164-
```
164+
```js
165165
'inject_third_party_assets_enabled' => false,
166166
```
167167

@@ -170,7 +170,7 @@ The default installation includes only the English (en) locale.
170170

171171
### Bundling
172172
Should you wish to localise, you must include the Flatpickr locale files in your build pipeline. This applies to only the specific locales that you require in your app.js (requires adding the flatpickr library to your package.json by executing "npm i flatpickr --save")
173-
```
173+
```js
174174
import { Arabic } from "../imports/flatpickr/l10n/ar.js";
175175
import { Catalan } from "../imports/flatpickr/l10n/cat.js";
176176
import { Danish } from "../imports/flatpickr/l10n/da.js";
@@ -192,6 +192,6 @@ import { Ukrainian } from "../imports/flatpickr/l10n/uk.js"
192192
You can also add locales using the Flatpickr CDN, ensuring that these are loaded before the page renders.
193193

194194
For example to add German (de), ensure that the following is in the "head" section of your layout, ideally before your app.js
195-
```
195+
```html
196196
<script src="https://npmcdn.com/flatpickr/dist/l10n/de.js" async></script>
197197
```

0 commit comments

Comments
 (0)