Skip to content

Commit

Permalink
V3.4.0 Release (#1815)
Browse files Browse the repository at this point in the history
## [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
  • Loading branch information
lrljoe authored Aug 4, 2024
1 parent 8bcca7c commit ea22d63
Show file tree
Hide file tree
Showing 69 changed files with 1,691 additions and 292 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

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

## [v3.4.0] - 2024-08-04
### New Features
- Add Helpers for TextFilters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1812
- Change method names for TextFilters handler by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1814
- Capability to set Reorder Column TH Attributes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1811
- Bulk Actions - Customise Select All Behaviours by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1810

### Bug Fixes
- Fix loading spinner for dark tailwind theme by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1809

### Tweaks
- Blade Minimisation & ColumnSelect Cleanup by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1806
- Adjust DateColumn with Missing Tests and Coping with DateTime Casts by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1813

### Docs
- Add reference to Bulk Actions TH styling in main styling by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1808
- Update docs for setPillsLocale by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1800
- Add note on label method for setAdditionalSelects by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1816

## [v3.3.4] - 2024-07-27
### New Features
- Added capability to setFilterDefaultValue for a DateRangeFilter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1796
Expand Down
Binary file removed database/database.sqlite
Binary file not shown.
9 changes: 9 additions & 0 deletions database/migrations/create_test_tables.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ class CreateTestTables extends Migration
$table->foreign('species_id')->references('id')->on('species');
});

Schema::create('owners', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->date('date_of_birth')->nullable();
});

Schema::create('pets', function (Blueprint $table) {
$table->id();
$table->integer('sort')->default(0);
Expand All @@ -34,10 +40,13 @@ class CreateTestTables extends Migration
$table->string('favorite_color')->nullable();
$table->integer('species_id')->unsigned()->nullable();
$table->integer('breed_id')->unsigned()->nullable();
$table->integer('owner_id')->unsigned()->nullable();
$table->foreign('species_id')->references('id')->on('species');
$table->foreign('breed_id')->references('id')->on('breeds');
$table->foreign('owner_id')->references('id')->on('owners');
});


Schema::create('veterinaries', function (Blueprint $table) {
$table->id();
$table->string('name')->index();
Expand Down
Binary file modified database/sqlite.database
Binary file not shown.
24 changes: 23 additions & 1 deletion docs/bulk-actions/available-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,26 @@ public function configure(): void
{
$this->setClearSelectedOnFilterDisabled();
}
```
```

## setDelaySelectAllEnabled

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.

```php
public function configure(): void
{
$this->setDelaySelectAllEnabled();
}
```

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.

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:
```
$rows = $this->getSelectedRows();
```

## setDelaySelectAllDisabled

This is the default behaviour, see setDelaySelectEnabled for details on what enabling this does.
21 changes: 21 additions & 0 deletions docs/columns/available-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Available Methods
weight: 3
---

## Styling

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.

## Sorting

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

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])
```php
public function configure(): void
{
$this->setAdditionalSelects(['users.forename as forename', 'users.surname as surname']);
}
```

You can then use the fields:
```php
Column::make('My one off column')
->label(
fn($row, Column $column) => $row->forename.' '.$row->surname
)
->html(),
```

## Collapsing

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:
Expand Down
5 changes: 4 additions & 1 deletion docs/datatable/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ public function configure(): void

### setThAttributes

Set a list of attributes to override on the th elements
Set a list of attributes to override on the th elements.

Note: If you are using Bulk Actions, then the th for Bulk Actions is [styled separately](../bulk-actions/customisations).
Note: If you are using Reorder, then the th for Reorder is [styled separately](../reordering/available-methods).

```php
public function configure(): void
Expand Down
132 changes: 131 additions & 1 deletion docs/filter-types/filters-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Text Filters
weight: 10
---

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

```php
public function filters(): array
Expand All @@ -20,3 +20,133 @@ public function filters(): array
];
}
```

### Extra Helpers

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.

#### Contains

This executes the filter and returns results where the field contains the filter value

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->contains('users.name'),
];
}
```

#### notContains

This executes the filter and returns results where the field does not contain filter value

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->notContains('users.name'),
];
}
```

#### startsWith

This executes the filter and returns results where the field starts with the filter value

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->startsWith('users.name'),
];
}
```

#### notStartsWith

This executes the filter and returns results where the field does not start with the filter value

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->notStartsWith('users.name'),
];
}
```

#### endsWith

This executes the filter and returns results where the field ends with the filter value

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->endsWith('users.name'),
];
}
```

#### notEndsWith

This executes the filter and returns results where the field does not end with the filter value

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->notEndsWith('users.name'),
];
}
```

#### setFieldName
An optional method for setting the field to use when filtering, if used, you may omit the field from the above methods, for example:

```php
public function filters(): array
{
return [
TextFilter::make('Name')
->config([
'placeholder' => 'Search Name',
'maxlength' => '25',
])
->setFieldName('users.name')
->contains(),
];
}
```
16 changes: 16 additions & 0 deletions docs/reordering/available-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,19 @@ public function configure(): void
$this->setDefaultReorderSort('order', 'desc');
}
```


## setReorderThAttributes

You may pass an array to this method, which allows you to pass Custom Attributes into the table header for the Reorder Column

```php
public function configure(): void
{

$this->setReorderThAttributes([
'class' => 'bg-red-500',
'default' => false
]);
}
```
31 changes: 31 additions & 0 deletions resources/css/bootstrap-custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.laravel-livewire-tables-cursor {
cursor:pointer;
}

.laravel-livewire-tables-btn-tiny {
width:0.5em;
height:0.5em;
}

.laravel-livewire-tables-btn-smaller {
width:1em;
height:1em;
}

.laravel-livewire-tables-btn-small
{
width:1.2em;
height:1.2em;
}

.laravel-livewire-tables-btn-md
{
width:1.3em;
height:1.3em;
}

.laravel-livewire-tables-btn-lg
{
width:1.4em;
height:1.4em;
}
1 change: 1 addition & 0 deletions resources/css/bootstrap-custom.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion resources/css/laravel-livewire-tables.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,37 @@
border-color: var(--rappasoft-table-highlight-color, rgb(255 255 255)) !important;
}

.laravel-livewire-tables-cursor {
cursor:pointer;
}

.laravel-livewire-tables-btn-tiny {
width:0.5em;
height:0.5em;
}

.laravel-livewire-tables-btn-smaller {
width:1em;
height:1em;
}

.laravel-livewire-tables-btn-small
{
width:1.2em;
height:1.2em;
}

.laravel-livewire-tables-btn-md
{
width:1.3em;
height:1.3em;
}

.laravel-livewire-tables-btn-lg
{
width:1.4em;
height:1.4em;
}

.laravel-livewire-tables-highlight-top {
border-style: solid !important;
Expand Down Expand Up @@ -381,7 +409,7 @@ label[dir=rtl] .range-slider {
}
.dark .lds-hourglass:after {
border: 32px solid #FFF;

border-color: #000 transparent #000 transparent;
}


Expand Down
Loading

0 comments on commit ea22d63

Please sign in to comment.