Skip to content

Commit 6fb0016

Browse files
authored
3.3.1 Release (#1776)
### Bug Fixes - Fix NumberRangeFilter initial state when loaded by querystring by @lrljoe in #1774 - Fix SnakeCase issue with snake-cased relations for AggregateColumn types (AvgColumn, CountColumn, SumColumn) by @lrljoe in #1777 ### New Features - Set a Prefix for NumberRangeFilter by @RenoLooijmans in #1773 - Add Separator customisation for Array Filters for FilterPills by @lrljoe in #1772 - Add bulk actions button/dropdown customisations by @lrljoe in #1771 Co-authored-by: lrljoe <[email protected]>
1 parent d614186 commit 6fb0016

Some content is hidden

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

43 files changed

+745
-168
lines changed

CHANGELOG.md

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

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

5+
## [v3.3.1] - 2024-07-16
6+
### Bug Fixes
7+
- Fix NumberRangeFilter initial state when loaded by querystring by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1774
8+
- Fix SnakeCase issue with snake-cased relations for AggregateColumn types (AvgColumn, CountColumn, SumColumn) by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1777
9+
10+
### New Features
11+
- Set a Prefix for NumberRangeFilter by @RenoLooijmans in https://github.com/rappasoft/laravel-livewire-tables/pull/1773
12+
- Add Separator customisation for Array Filters for FilterPills by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1772
13+
- Add bulk actions button/dropdown customisations by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1771
14+
515
## [v3.3.0] - 2024-07-11
616
### New Features
717
- Add new columns (ArrayColumn, AvgColumn, CountColumn, SumColumn) by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1761
818
- Add new column WireLinkColumn by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1763
919
- Add Option to Retain Selected when Searching/Filtering by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1762
20+
- Add Option to set locale and default date to DateRangeFilter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1766
1021

1122
## [v3.2.8] - 2024-07-03
1223
### Bug Fixes

config/livewire-tables.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
'dateFormat' => 'Y-m-d', // Date format that will be received by the filter
7373
'earliestDate' => null, // The earliest acceptable date
7474
'latestDate' => null, // The latest acceptable date
75+
'locale' => 'en', // The default locale
7576
],
7677
],
7778

@@ -87,6 +88,7 @@
8788
'minRange' => 0, // The minimum possible value
8889
'maxRange' => 100, // The maximum possible value
8990
'suffix' => '', // A suffix to append to the values when displayed
91+
'prefix' => '', // A prefix to prepend to the values when displayed
9092
],
9193
],
9294
/**
@@ -105,7 +107,7 @@
105107
],
106108

107109
/**
108-
* Configuration options for MultiSelectFilter
110+
* Configuration options for MultiSelectDropdownFilter
109111
*/
110112
'multiSelectDropdownFilter' => [
111113
'defaultOptions' => [],

docs/bulk-actions/available-methods.md

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -184,61 +184,6 @@ public function configure(): void
184184
}
185185
```
186186

187-
## setBulkActionsThAttributes
188-
189-
You may pass an array to this method, which allows you to pass Custom Attributes into the table header
190-
191-
```php
192-
public function configure(): void
193-
{
194-
$this->setBulkActionsThAttributes([
195-
'class' => 'bg-red-500',
196-
'default' => false
197-
]);
198-
}
199-
```
200-
201-
## setBulkActionsThCheckboxAttributes
202-
203-
You may pass an array to this method, which allows you to pass Custom Attributes into the Select All/None checkbox in the Table Header
204-
205-
```php
206-
public function configure(): void
207-
{
208-
$this->setBulkActionsThCheckboxAttributes([
209-
'class' => 'bg-blue-500',
210-
'default' => false
211-
]);
212-
}
213-
```
214-
215-
## setBulkActionsTdAttributes
216-
217-
You may pass an array to this method, which allows you to pass Custom Attributes into the td containing the Bulk Actions Checkbox for the row
218-
219-
```php
220-
public function configure(): void
221-
{
222-
$this->setBulkActionsTdAttributes([
223-
'class' => 'bg-green-500',
224-
'default' => true
225-
]);
226-
}
227-
```
228-
229-
## setBulkActionsTdCheckboxAttributes
230-
231-
You may pass an array to this method, which allows you to pass Custom Attributes into the Bulk Actions Checkbox for the row
232-
233-
```php
234-
public function configure(): void
235-
{
236-
$this->setBulkActionsTdCheckboxAttributes([
237-
'class' => 'bg-green-500',
238-
'default' => true
239-
]);
240-
}
241-
```
242187

243188
## setShouldAlwaysHideBulkActionsDropdownOption
244189

@@ -345,4 +290,4 @@ public function configure(): void
345290
{
346291
$this->setClearSelectedOnFilterDisabled();
347292
}
348-
```
293+
```

docs/bulk-actions/customisations.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: Customising Style
3+
weight: 5
4+
---
5+
6+
## setBulkActionsThAttributes
7+
8+
You may pass an array to this method, which allows you to pass Custom Attributes into the table header
9+
10+
```php
11+
public function configure(): void
12+
{
13+
$this->setBulkActionsThAttributes([
14+
'class' => 'bg-red-500',
15+
'default' => false
16+
]);
17+
}
18+
```
19+
20+
## setBulkActionsThCheckboxAttributes
21+
22+
You may pass an array to this method, which allows you to pass Custom Attributes into the Select All/None checkbox in the Table Header
23+
24+
```php
25+
public function configure(): void
26+
{
27+
$this->setBulkActionsThCheckboxAttributes([
28+
'class' => 'bg-blue-500',
29+
'default' => false
30+
]);
31+
}
32+
```
33+
34+
## setBulkActionsTdAttributes
35+
36+
You may pass an array to this method, which allows you to pass Custom Attributes into the td containing the Bulk Actions Checkbox for the row
37+
38+
```php
39+
public function configure(): void
40+
{
41+
$this->setBulkActionsTdAttributes([
42+
'class' => 'bg-green-500',
43+
'default' => true
44+
]);
45+
}
46+
```
47+
48+
## setBulkActionsTdCheckboxAttributes
49+
50+
You may pass an array to this method, which allows you to pass Custom Attributes into the Bulk Actions Checkbox for the row
51+
52+
```php
53+
public function configure(): void
54+
{
55+
$this->setBulkActionsTdCheckboxAttributes([
56+
'class' => 'bg-green-500',
57+
'default' => true
58+
]);
59+
}
60+
```
61+
62+
## setBulkActionsButtonAttributes
63+
64+
You may pass an array to this method, which allows you to pass Custom Attributes into the Bulk Actions Button in the Toolbar
65+
66+
```php
67+
public function configure(): void
68+
{
69+
$this->setBulkActionsButtonAttributes([
70+
'class' => 'bg-green-500',
71+
'default-colors' => true,
72+
'default-styling' => true,
73+
]);
74+
}
75+
```
76+
77+
## setBulkActionsMenuAttributes
78+
79+
You may pass an array to this method, which allows you to pass Custom Attributes into the Bulk Actions Menu
80+
81+
```php
82+
public function configure(): void
83+
{
84+
$this->setBulkActionsMenuAttributes([
85+
'class' => 'bg-green-500',
86+
'default-colors' => true,
87+
'default-styling' => true,
88+
]);
89+
}
90+
```
91+
92+
93+
## setBulkActionsMenuItemAttributes
94+
95+
You may pass an array to this method, which allows you to pass Custom Attributes into Items on the Bulk Actions Menu
96+
97+
```php
98+
public function configure(): void
99+
{
100+
$this->setBulkActionsMenuItemAttributes([
101+
'class' => 'bg-green-500',
102+
'default-colors' => true,
103+
'default-styling' => true,
104+
]);
105+
}
106+
```

docs/column-types/standard_column.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ A standard Column has a multitude of different options, making it simple for you
2828
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/anonymous_columns">Anonymous Columns</a>
2929
</li>
3030

31-
</ul>
31+
</ul>

docs/filter-types/filters-date.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Date Filters
33
weight: 2
44
---
55

6-
## Date Filters
7-
86
Date filters are HTML date elements.
97

108
```php

docs/filter-types/filters-daterange.md

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: DateRange Filters
33
weight: 3
44
---
55

6-
## DateRange Filters
7-
86
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:
97

108
```php
@@ -33,6 +31,7 @@ public function filters(): array
3331
'earliestDate' => '2020-01-01', // The earliest acceptable date
3432
'latestDate' => '2023-08-01', // The latest acceptable date
3533
'placeholder' => 'Enter Date Range', // A placeholder value
34+
'locale' => 'en',
3635
])
3736
->setFilterPillValues([0 => 'minDate', 1 => 'maxDate']) // The values that will be displayed for the Min/Max Date Values
3837
->filter(function (Builder $builder, array $dateRange) { // Expects an array.
@@ -44,31 +43,85 @@ public function filters(): array
4443
}
4544
```
4645

46+
## Configuration
47+
By default, this filter will inject the Flatpickr JS Library and CSS. However, you can customise this behaviour using the configuration file.
48+
49+
### Option 1 - The default behaviour:
50+
```
51+
'inject_third_party_assets_enabled' => true,
52+
```
4753

54+
### Option 2 - Bundled
55+
If you choose to bundle the Tables JS/CSS (recommended) by adding the following to your build process:
4856

49-
## Configuration
50-
By default, this filter will use a CDN to include the Flatpickr JS Library and CSS. However, you can customise this behaviour using the configuration file.
57+
```
58+
'vendor/rappasoft/laravel-livewire-tables/resources/js/laravel-livewire-tables-thirdparty.min.js';
59+
```
60+
61+
or in your app.js
62+
63+
```
64+
import '../../vendor/rappasoft/livewire-tables/resources/js/laravel-livewire-tables-thirdparty.min.js';
65+
```
5166

52-
### Option 1 - The default CDN behaviour:
67+
Then you should disable injection to avoid conflicts:
68+
69+
```
70+
'inject_third_party_assets_enabled' => false,
71+
```
72+
73+
### Option 3 - CDN
74+
You must ensure that Flatpickr is present PRIOR to the tables loading. For example, to add Flatpickr with the Spanish locale, ensure that the following is present in your Layout head section. Noting the "async" presence to ensure that the script is present before a page renders.
75+
76+
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.
77+
78+
If using the CDN approach, ensure the following config matches:
5379
```
54-
'published_third_party_assets' => false,
55-
'remote_third_party_assets' => true,
80+
'inject_third_party_assets_enabled' => false,
5681
```
5782

58-
### Option 2 - Publish included version
59-
You may publish the included version of Flatpickr. To do so, run:
83+
Then include the following in your layout:
6084
```
61-
php artisan vendor:publish --tag=livewire-tables-public
85+
// Flatpickr Core Script
86+
<script src="https://npmcdn.com/flatpickr" async></script>
87+
88+
// Flatpickr Core CSS
89+
<link rel="stylesheet" href="https://npmcdn.com/flatpickr/dist/flatpickr.min.css">
6290
```
63-
This will publish the tested version of Flatpickr to your public directory. You should then set
91+
92+
### Option 4 - Locally Installed
93+
If you have a locally installed version of Flatpickr already, you can set injection to false, and your local version will be used instead.
6494
```
65-
'published_third_party_assets' => true,
66-
'remote_third_party_assets' => false,
95+
'inject_third_party_assets_enabled' => false,
6796
```
6897

69-
### Option 3 - Locally Installed
70-
If you have a locally installed version of Flatpickr already, you can set both options to false, and your local version will be used instead.
98+
## Localisation (BETA)
99+
The default installation includes only the English (en) locale.
100+
101+
### Bundling
102+
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")
71103
```
72-
'published_third_party_assets' => false,
73-
'remote_third_party_assets' => false,
104+
import { Arabic } from "../imports/flatpickr/l10n/ar.js";
105+
import { Catalan } from "../imports/flatpickr/l10n/cat.js";
106+
import { Danish } from "../imports/flatpickr/l10n/da.js";
107+
import { German } from "../imports/flatpickr/l10n/de.js";
108+
import { Spanish } from "../imports/flatpickr/l10n/es.js";
109+
import { French } from "../imports/flatpickr/l10n/fr.js";
110+
import { Indonesian } from "../imports/flatpickr/l10n/id.js";
111+
import { Italian } from "../imports/flatpickr/l10n/it.js";
112+
import { Malaysian } from "../imports/flatpickr/l10n/ms.js";
113+
import { Dutch } from "../imports/flatpickr/l10n/nl.js";
114+
import { Portuguese } from "../imports/flatpickr/l10n/pt.js";
115+
import { Russian } from "../imports/flatpickr/l10n/ru.js"
116+
import { Thai } from "../imports/flatpickr/l10n/th.js"
117+
import { Turkish } from "../imports/flatpickr/l10n/tr.js"
118+
import { Ukrainian } from "../imports/flatpickr/l10n/uk.js"
119+
```
120+
121+
### CDN
122+
You can also add locales using the Flatpickr CDN, ensuring that these are loaded before the page renders.
123+
124+
For example to add German (de), ensure that the following is in the "head" section of your layout, ideally before your app.js
74125
```
126+
<script src="https://npmcdn.com/flatpickr/dist/l10n/de.js" async></script>
127+
```

docs/filter-types/filters-datetime.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: DateTime Filters
33
weight: 4
44
---
55

6-
## DateTime Filters
7-
86
DateTime filters are HTML datetime-local elements and act the same as date filters.
97

108
```php

docs/filter-types/filters-livewire-component.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Livewire Custom Filter (Beta)
33
weight: 11
44
---
55

6-
## Livewire Custom Filter
7-
86
**IN BETA**
97
This feature is currently in beta, and use in production is not recommended.
108

0 commit comments

Comments
 (0)