-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Development to Master (3.3.0) (#1764)
* Adjust for HTML Columns * Update ChangeLog and SP * fix: Apply cursor pointer only on clickable columns when using Bootst… (#1742) * Ensure HTML Columns Return HTML Correctly (#1737) * Adjust for HTML Columns * fix: Apply cursor pointer only on clickable columns when using Bootstrap --------- Co-authored-by: Joe <104938042+lrljoe@users.noreply.github.com> * Fix styling * Fix hide bulk actions when empty not reflecting in frontend (#1747) * Fix issue with Hide Bulk Actions When Empty not reflecting in frontend * Fix styling * Add development branch into tests --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Change Return Type for attributes() to static (#1749) * Switch to using Composer\InstalledVersions for AboutCommand to reduce necessity to update ServiceProvider with each update (#1748) * Two improvements to improve typehinting, migrate to larastan/larastan, cleanup of test (#1750) * Add ArrayColumn (BETA) (#1751) * Add ArrayColumn * Fix styling --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Always hide bulk actions option (#1752) * Add option to "Always Hide Bulk Actions" * Fix styling * Fix test function name clash --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Optionally disable count for simple pagination (#1755) * Add option for setShouldRetrieveTotalItemCountStatus * Fix styling --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Update ChangeLog For 3.2.8 Release (#1754) * Update ChangeLog for 3.2.8 * Add release date * Fix phpstan unescaped | * Fix missing typehints (#1757) * Add additional typehints * Fix styling * Add filterCollection typehint * Fix styling * trUrlCallback fixes * Use Collection rather than collect() helper * Fix styling * Add ignore for "Unable to resolve the template type" for Illuminate Collection, add typehint for empty * Add ignore for $model has no defined type (allows for non Eloquent Model to be used longer term) * Adjust concurrency * Adjust Test * Adjust Again * Adjust PHPStan * Add Max Parallel * Use v4 of checkout/cache * Run one at a time * Add Clear Cache Workflow * Fix * Migrate to v4 and adjust workflows * Adjust workflow run rules * Adjust Run-Tests to separate L10 and L11 jobs * Adjust run-tests * Adjust Test * Add Laravel matrix * Adjust Concurrency * Adjust * Adjust Pull Jobs to Match Push jobs --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Add CountColumn, simpler adding of WithCounts, With (#1761) * Initial Commit * Adjust CountColumn * Add ExtraWiths * Add AggregateColumn * Add SumColumn * Update Docs - Add Column Types Section * Add exceptions for empty data source, add standard tests * Ensure pcov runs on push to master/development/develop * Update to use codecov v4 --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Add Option to Retain Selected when Searching/Filtering (#1762) * Initial Commit for Retaining Selected * Update Test for Search/Filter --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Add WireLink Column (#1763) * Add WireLinkColumn * Add Tests for WireLinkColumn --------- Co-authored-by: lrljoe <lrljoe@users.noreply.github.com> * Fix styling --------- Co-authored-by: Matt Pickering <mattukp+gh@gmail.com> Co-authored-by: lrljoe <lrljoe@users.noreply.github.com>
- Loading branch information
1 parent
1099d17
commit 3a260dc
Showing
67 changed files
with
1,691 additions
and
3,159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,6 @@ phpunit.xml.dist.dev | |
.history/* | ||
.env | ||
phpunit.xml.bak | ||
phpstan.txt | ||
phpstan.txt | ||
coverage.xml | ||
./tmp/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
title: Bulk Actions | ||
weight: 9 | ||
weight: 10 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: Column Types | ||
weight: 5 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: Array Columns (beta) | ||
weight: 1 | ||
--- | ||
|
||
Array columns provide an easy way to work with and display an array of data from a field. | ||
|
||
``` | ||
ArrayColumn::make('notes', 'name') | ||
->data(fn($value, $row) => ($row->notes)) | ||
->outputFormat(fn($index, $value) => "<a href='".$value->id."'>".$value->name."</a>") | ||
->separator('<br />') | ||
->sortable(), | ||
``` | ||
|
||
### Empty Value | ||
You may define the default/empty value using the "emptyValue" method | ||
|
||
``` | ||
ArrayColumn::make('notes', 'name') | ||
->emptyValue('Unknown'), | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Avg Columns (beta) | ||
weight: 2 | ||
--- | ||
|
||
Avg columns provide an easy way to display the "Average" of a field on a relation. | ||
|
||
``` | ||
AvgColumn::make('Average Related User Age') | ||
->setDataSource('users','age') | ||
->sortable(), | ||
``` | ||
|
||
The "sortable()" callback can accept a callback, or you can use the default behaviour, which calculates the correct field to sort on. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
title: Boolean Columns | ||
weight: 3 | ||
--- | ||
|
||
Boolean columns are good if you have a column type that is a true/false, or 0/1 value. | ||
|
||
For example: | ||
|
||
```php | ||
BooleanColumn::make('Active') | ||
``` | ||
|
||
Would yield: | ||
|
||
![Boolean Column](https://imgur.com/LAk6gHY.png) | ||
|
||
### Using your own view | ||
|
||
If you don't want to use the default view and icons you can set your own: | ||
|
||
```php | ||
BooleanColumn::make('Active') | ||
->setView('my.active.view') | ||
``` | ||
|
||
You will have access to `$component`, `$status`, and `$successValue`. | ||
|
||
To help you better understand, this is the Tailwind implementation of BooleanColumn: | ||
|
||
```html | ||
@if ($status) | ||
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block h-5 w-5 @if ($successValue === true) text-green-500 @else text-red-500 @endif" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> | ||
</svg> | ||
@else | ||
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block h-5 w-5 @if ($successValue === false) text-green-500 @else text-red-500 @endif" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /> | ||
</svg> | ||
@endif | ||
``` | ||
|
||
### Setting the truthy value | ||
|
||
If you want the false value to be the green option, you can set: | ||
|
||
```php | ||
BooleanColumn::make('Active') | ||
->setSuccessValue(false); // Makes false the 'successful' option | ||
``` | ||
|
||
That would swap the colors of the icons in the image above. | ||
|
||
### Setting the status value | ||
|
||
By default, the `$status` is set to: | ||
|
||
```php | ||
(bool)$value === true | ||
``` | ||
|
||
You can override this functionality: | ||
|
||
```php | ||
BooleanColumn::make('Active') | ||
// Note: Parameter `$row` available as of v2.4 | ||
->setCallback(function(string $value, $row) { | ||
// Figure out what makes $value true | ||
}), | ||
``` | ||
|
||
### Different types of boolean display | ||
|
||
By default, the BooleanColumn displays icons. | ||
|
||
If you would like the BooleanColumn to display a plain Yes/No, you can set: | ||
|
||
```php | ||
BooleanColumn::make('Active') | ||
->yesNo() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: Button Group Columns | ||
weight: 4 | ||
--- | ||
|
||
Button group columns let you provide an array of LinkColumns to display in a single cell. | ||
|
||
```php | ||
ButtonGroupColumn::make('Actions') | ||
->attributes(function($row) { | ||
return [ | ||
'class' => 'space-x-2', | ||
]; | ||
}) | ||
->buttons([ | ||
LinkColumn::make('View') // make() has no effect in this case but needs to be set anyway | ||
->title(fn($row) => 'View ' . $row->name) | ||
->location(fn($row) => route('user.show', $row)) | ||
->attributes(function($row) { | ||
return [ | ||
'class' => 'underline text-blue-500 hover:no-underline', | ||
]; | ||
}), | ||
LinkColumn::make('Edit') | ||
->title(fn($row) => 'Edit ' . $row->name) | ||
->location(fn($row) => route('user.edit', $row)) | ||
->attributes(function($row) { | ||
return [ | ||
'target' => '_blank', | ||
'class' => 'underline text-blue-500 hover:no-underline', | ||
]; | ||
}), | ||
]), | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: Color Columns | ||
weight: 5 | ||
--- | ||
|
||
Color columns provide an easy way to a Color in a Column | ||
|
||
You may pass either pass a CSS-compliant colour as a field | ||
```php | ||
ColorColumn::make('Favourite Colour', 'favourite_color'), | ||
``` | ||
|
||
Or you may use a Callback | ||
```php | ||
ColorColumn::make('Favourite Colour') | ||
->color( | ||
function ($row) { | ||
if ($row->success_rate < 40) | ||
{ | ||
return '#ff0000'; | ||
} | ||
else if ($row->success_rate > 90) | ||
{ | ||
return '#008000'; | ||
} | ||
else return '#ffa500'; | ||
|
||
} | ||
), | ||
``` | ||
|
||
You may also specify attributes to use on the div displaying the color, to adjust the size or appearance, this receives the full row. By default, this will replace the standard classes, to retain them, set "default" to true. To then over-ride, you should prefix your classes with "!" to signify importance. | ||
```php | ||
ColorColumn::make('Favourite Colour') | ||
->attributes(function ($row) { | ||
return [ | ||
'class' => '!rounded-lg self-center', | ||
'default' => true, | ||
]; | ||
}), | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: Component Columns | ||
weight: 6 | ||
--- | ||
|
||
Component columns let you specify a component name and attributes and provides the column value to the slot. | ||
|
||
```php | ||
// Before | ||
Column::make("Email", "email") | ||
->format(function ($value) { | ||
return view('components.alert') | ||
->with('attributes', new ComponentAttributeBag([ | ||
'type' => Str::endsWith($value, 'example.org') ? 'success' : 'danger', | ||
'dismissible' => true, | ||
])) | ||
->with('slot', $value); | ||
}), | ||
|
||
// After | ||
ComponentColumn::make('E-mail', 'email') | ||
->component('email') | ||
->attributes(fn ($value, $row, Column $column) => [ | ||
'type' => Str::endsWith($value, 'example.org') ? 'success' : 'danger', | ||
'dismissible' => true, | ||
]), | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Count Columns (beta) | ||
weight: 7 | ||
--- | ||
|
||
Count columns provide an easy way to display the "Count" of a relation. | ||
|
||
``` | ||
CountColumn::make('Related Users') | ||
->setDataSource('users') | ||
->sortable(), | ||
``` | ||
|
||
The "sortable()" callback can accept a callback, or you can use the default behaviour, which calculates the correct field to sort on. |
Oops, something went wrong.