Skip to content

Commit ea22d63

Browse files
authored
V3.4.0 Release (#1815)
## [v3.4.0] - 2024-08-04 ### New Features - Add Helpers for TextFilters by @lrljoe in #1812 - Change method names for TextFilters handler by @lrljoe in #1814 - Capability to set Reorder Column TH Attributes by @lrljoe in #1811 - Bulk Actions - Customise Select All Behaviours by @lrljoe in #1810 ### Bug Fixes - Fix loading spinner for dark tailwind theme by @lrljoe in #1809 ### Tweaks - Blade Minimisation & ColumnSelect Cleanup by @lrljoe in #1806 - Adjust DateColumn with Missing Tests and Coping with DateTime Casts by @lrljoe in #1813 ### Docs - Add reference to Bulk Actions TH styling in main styling by @lrljoe in #1808 - Update docs for setPillsLocale by @lrljoe in #1800 - Add note on label method for setAdditionalSelects by @lrljoe in #1816
1 parent 8bcca7c commit ea22d63

File tree

69 files changed

+1691
-292
lines changed

Some content is hidden

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

69 files changed

+1691
-292
lines changed

CHANGELOG.md

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

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

5+
## [v3.4.0] - 2024-08-04
6+
### New Features
7+
- Add Helpers for TextFilters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1812
8+
- Change method names for TextFilters handler by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1814
9+
- Capability to set Reorder Column TH Attributes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1811
10+
- Bulk Actions - Customise Select All Behaviours by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1810
11+
12+
### Bug Fixes
13+
- Fix loading spinner for dark tailwind theme by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1809
14+
15+
### Tweaks
16+
- Blade Minimisation & ColumnSelect Cleanup by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1806
17+
- Adjust DateColumn with Missing Tests and Coping with DateTime Casts by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1813
18+
19+
### Docs
20+
- Add reference to Bulk Actions TH styling in main styling by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1808
21+
- Update docs for setPillsLocale by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1800
22+
- Add note on label method for setAdditionalSelects by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1816
23+
524
## [v3.3.4] - 2024-07-27
625
### New Features
726
- Added capability to setFilterDefaultValue for a DateRangeFilter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1796

database/database.sqlite

-40 KB
Binary file not shown.

database/migrations/create_test_tables.php.stub

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class CreateTestTables extends Migration
2525
$table->foreign('species_id')->references('id')->on('species');
2626
});
2727

28+
Schema::create('owners', function (Blueprint $table) {
29+
$table->id();
30+
$table->string('name');
31+
$table->date('date_of_birth')->nullable();
32+
});
33+
2834
Schema::create('pets', function (Blueprint $table) {
2935
$table->id();
3036
$table->integer('sort')->default(0);
@@ -34,10 +40,13 @@ class CreateTestTables extends Migration
3440
$table->string('favorite_color')->nullable();
3541
$table->integer('species_id')->unsigned()->nullable();
3642
$table->integer('breed_id')->unsigned()->nullable();
43+
$table->integer('owner_id')->unsigned()->nullable();
3744
$table->foreign('species_id')->references('id')->on('species');
3845
$table->foreign('breed_id')->references('id')->on('breeds');
46+
$table->foreign('owner_id')->references('id')->on('owners');
3947
});
4048

49+
4150
Schema::create('veterinaries', function (Blueprint $table) {
4251
$table->id();
4352
$table->string('name')->index();

database/sqlite.database

4 KB
Binary file not shown.

docs/bulk-actions/available-methods.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,26 @@ public function configure(): void
290290
{
291291
$this->setClearSelectedOnFilterDisabled();
292292
}
293-
```
293+
```
294+
295+
## setDelaySelectAllEnabled
296+
297+
By default, using the "Select All", immediately makes a call to the backend to populate the "selected" array with the primary key of all resultant rows (based on Filter/Search). This can be slow with large result sets, but gives a good user experience with smaller results, as it allows them to "Select All" and then deselect some rows.
298+
299+
```php
300+
public function configure(): void
301+
{
302+
$this->setDelaySelectAllEnabled();
303+
}
304+
```
305+
306+
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.
307+
308+
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+
$rows = $this->getSelectedRows();
311+
```
312+
313+
## setDelaySelectAllDisabled
314+
315+
This is the default behaviour, see setDelaySelectEnabled for details on what enabling this does.

docs/columns/available-methods.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ title: Available Methods
33
weight: 3
44
---
55

6+
## Styling
7+
8+
To change the CSS classes or other attributes assigned to a Column, use can use [setTdAttributes](../datatable/styling), which allows customising attributes based on column type, name or value.
9+
610
## Sorting
711

812
See also [component sorting configuration](../sorting/available-methods).
@@ -156,6 +160,23 @@ Column::make('My one off column')
156160
),
157161
```
158162

163+
Note that any field not used elsewhere in the table, that is required (for example creating an attribute based on two unused fields, these must be added to the query with setAdditionalSelects() in the configure() method (See Here)[https://rappasoft.com/docs/laravel-livewire-tables/v3/datatable/available-methods#content-builder])
164+
```php
165+
public function configure(): void
166+
{
167+
$this->setAdditionalSelects(['users.forename as forename', 'users.surname as surname']);
168+
}
169+
```
170+
171+
You can then use the fields:
172+
```php
173+
Column::make('My one off column')
174+
->label(
175+
fn($row, Column $column) => $row->forename.' '.$row->surname
176+
)
177+
->html(),
178+
```
179+
159180
## Collapsing
160181

161182
The component has the ability to collapse certain columns at different screen sizes. It will add a plus icon as the left most column that will open up a view below the row with the information of the collapsed columns:

docs/datatable/styling.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ public function configure(): void
127127

128128
### setThAttributes
129129

130-
Set a list of attributes to override on the th elements
130+
Set a list of attributes to override on the th elements.
131+
132+
Note: If you are using Bulk Actions, then the th for Bulk Actions is [styled separately](../bulk-actions/customisations).
133+
Note: If you are using Reorder, then the th for Reorder is [styled separately](../reordering/available-methods).
131134

132135
```php
133136
public function configure(): void

docs/filter-types/filters-text.md

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Text Filters
33
weight: 10
44
---
55

6-
Text filters are just HTML text fields.
6+
Text filters are just simple text filters, allowing you to pass a string value into a builder query.
77

88
```php
99
public function filters(): array
@@ -20,3 +20,133 @@ public function filters(): array
2020
];
2121
}
2222
```
23+
24+
### Extra Helpers
25+
26+
There are a number of helpers to simplify your code, should you not wish to rewrite the filter function repeatedly for a Text Filter. You can only use one of the below methods per-filter.
27+
28+
#### Contains
29+
30+
This executes the filter and returns results where the field contains the filter value
31+
32+
```php
33+
public function filters(): array
34+
{
35+
return [
36+
TextFilter::make('Name')
37+
->config([
38+
'placeholder' => 'Search Name',
39+
'maxlength' => '25',
40+
])
41+
->contains('users.name'),
42+
];
43+
}
44+
```
45+
46+
#### notContains
47+
48+
This executes the filter and returns results where the field does not contain filter value
49+
50+
```php
51+
public function filters(): array
52+
{
53+
return [
54+
TextFilter::make('Name')
55+
->config([
56+
'placeholder' => 'Search Name',
57+
'maxlength' => '25',
58+
])
59+
->notContains('users.name'),
60+
];
61+
}
62+
```
63+
64+
#### startsWith
65+
66+
This executes the filter and returns results where the field starts with the filter value
67+
68+
```php
69+
public function filters(): array
70+
{
71+
return [
72+
TextFilter::make('Name')
73+
->config([
74+
'placeholder' => 'Search Name',
75+
'maxlength' => '25',
76+
])
77+
->startsWith('users.name'),
78+
];
79+
}
80+
```
81+
82+
#### notStartsWith
83+
84+
This executes the filter and returns results where the field does not start with the filter value
85+
86+
```php
87+
public function filters(): array
88+
{
89+
return [
90+
TextFilter::make('Name')
91+
->config([
92+
'placeholder' => 'Search Name',
93+
'maxlength' => '25',
94+
])
95+
->notStartsWith('users.name'),
96+
];
97+
}
98+
```
99+
100+
#### endsWith
101+
102+
This executes the filter and returns results where the field ends with the filter value
103+
104+
```php
105+
public function filters(): array
106+
{
107+
return [
108+
TextFilter::make('Name')
109+
->config([
110+
'placeholder' => 'Search Name',
111+
'maxlength' => '25',
112+
])
113+
->endsWith('users.name'),
114+
];
115+
}
116+
```
117+
118+
#### notEndsWith
119+
120+
This executes the filter and returns results where the field does not end with the filter value
121+
122+
```php
123+
public function filters(): array
124+
{
125+
return [
126+
TextFilter::make('Name')
127+
->config([
128+
'placeholder' => 'Search Name',
129+
'maxlength' => '25',
130+
])
131+
->notEndsWith('users.name'),
132+
];
133+
}
134+
```
135+
136+
#### setFieldName
137+
An optional method for setting the field to use when filtering, if used, you may omit the field from the above methods, for example:
138+
139+
```php
140+
public function filters(): array
141+
{
142+
return [
143+
TextFilter::make('Name')
144+
->config([
145+
'placeholder' => 'Search Name',
146+
'maxlength' => '25',
147+
])
148+
->setFieldName('users.name')
149+
->contains(),
150+
];
151+
}
152+
```

docs/reordering/available-methods.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,19 @@ public function configure(): void
142142
$this->setDefaultReorderSort('order', 'desc');
143143
}
144144
```
145+
146+
147+
## setReorderThAttributes
148+
149+
You may pass an array to this method, which allows you to pass Custom Attributes into the table header for the Reorder Column
150+
151+
```php
152+
public function configure(): void
153+
{
154+
155+
$this->setReorderThAttributes([
156+
'class' => 'bg-red-500',
157+
'default' => false
158+
]);
159+
}
160+
```

resources/css/bootstrap-custom.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.laravel-livewire-tables-cursor {
2+
cursor:pointer;
3+
}
4+
5+
.laravel-livewire-tables-btn-tiny {
6+
width:0.5em;
7+
height:0.5em;
8+
}
9+
10+
.laravel-livewire-tables-btn-smaller {
11+
width:1em;
12+
height:1em;
13+
}
14+
15+
.laravel-livewire-tables-btn-small
16+
{
17+
width:1.2em;
18+
height:1.2em;
19+
}
20+
21+
.laravel-livewire-tables-btn-md
22+
{
23+
width:1.3em;
24+
height:1.3em;
25+
}
26+
27+
.laravel-livewire-tables-btn-lg
28+
{
29+
width:1.4em;
30+
height:1.4em;
31+
}

0 commit comments

Comments
 (0)