Merge pull request #16396 from filamentphp/table-toolbar-actions

Table toolbar actions
This commit is contained in:
Dan Harrin
2025-06-03 17:27:26 +01:00
committed by GitHub
81 changed files with 910 additions and 613 deletions
+11 -3
View File
@@ -44,8 +44,8 @@ use Filament\Tables\Columns\TextInputColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Enums\ActionsPosition;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\Indicator;
use Filament\Tables\Filters\SelectFilter;
@@ -871,7 +871,7 @@ class TablesDemo extends Component implements HasActions, HasSchemas, HasTable
->actions([
EditAction::make(),
DeleteAction::make(),
], position: ActionsPosition::BeforeColumns);
], position: RecordActionsPosition::BeforeColumns);
}
public function actionsBeforeCells(Table $table): Table
@@ -880,7 +880,7 @@ class TablesDemo extends Component implements HasActions, HasSchemas, HasTable
->actions([
EditAction::make(),
DeleteAction::make(),
], position: ActionsPosition::BeforeCells)
], position: RecordActionsPosition::BeforeCells)
->bulkActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
@@ -918,6 +918,14 @@ class TablesDemo extends Component implements HasActions, HasSchemas, HasTable
]);
}
public function toolbarActions(Table $table): Table
{
return $this->actionsTable($table)
->toolbarActions([
CreateAction::make(),
]);
}
public function groupedActions(Table $table): Table
{
return $this->actionsTable($table)
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

+9
View File
@@ -3263,6 +3263,15 @@ export default {
deviceScaleFactor: 3,
},
},
'tables/actions/toolbar': {
url: 'tables?table=toolbarActions',
selector: 'body',
viewport: {
width: 1080,
height: 640,
deviceScaleFactor: 3,
},
},
'tables/actions/group': {
url: 'tables?table=groupedActions',
selector: 'body',
+4 -4
View File
@@ -239,10 +239,10 @@ public static function configure(Table $table): Table
->query(fn (Builder $query): Builder => $query->whereNotNull('email_verified_at')),
// ...
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
@@ -277,10 +277,10 @@ Check out the [tables](../tables) docs to find out how to add table columns, fil
->query(fn (Builder $query): Builder => $query->whereNotNull('email_verified_at')),
// ...
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
+4 -3
View File
@@ -60,9 +60,10 @@ public static function getPages(): array
If your resource is simple, you may wish to view records in modals rather than on the [View page](viewing-records). If this is the case, you can just [delete the view page](overview#deleting-resource-pages).
If your resource doesn't contain a `ViewAction`, you can add one to the `$table->actions()` array:
If your resource doesn't contain a `ViewAction`, you can add one to the `$table->recordActions()` array:
```php
use Filament\Actions\ViewAction;
use Filament\Tables\Table;
public static function table(Table $table): Table
@@ -71,8 +72,8 @@ public static function table(Table $table): Table
->columns([
// ...
])
->actions([
\Filament\Actions\ViewAction::make(),
->recordActions([
ViewAction::make(),
// ...
]);
}
+21 -13
View File
@@ -19,7 +19,14 @@ Alternatively, you may add soft-deleting functionality to an existing resource.
Firstly, you must update the resource:
```php
use Filament\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\ForceDeleteAction;
use Filament\Actions\ForceDeleteBulkAction;
use Filament\Actions\RestoreAction;
use Filament\Actions\RestoreBulkAction;
use Filament\Tables\Filters\TrashedFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -31,23 +38,23 @@ public static function table(Table $table): Table
// ...
])
->filters([
Tables\Filters\TrashedFilter::make(),
TrashedFilter::make(),
// ...
])
->actions([
->recordActions([
// You may add these actions to your table if you're using a simple
// resource, or you just want to be able to delete records without
// leaving the table.
\Filament\Actions\DeleteAction::make(),
\Filament\Actions\ForceDeleteAction::make(),
\Filament\Actions\RestoreAction::make(),
DeleteAction::make(),
ForceDeleteAction::make(),
RestoreAction::make(),
// ...
])
->bulkActions([
\Filament\Actions\BulkActionGroup::make([
\Filament\Actions\DeleteBulkAction::make(),
\Filament\Actions\ForceDeleteBulkAction::make(),
\Filament\Actions\RestoreBulkAction::make(),
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
RestoreBulkAction::make(),
// ...
]),
]);
@@ -83,6 +90,7 @@ protected function getHeaderActions(): array
By default, you can bulk-delete records in your table. You may also wish to delete single records, using a `DeleteAction`:
```php
use Filament\Actions\DeleteAction;
use Filament\Tables\Table;
public static function table(Table $table): Table
@@ -91,9 +99,9 @@ public static function table(Table $table): Table
->columns([
// ...
])
->actions([
->recordActions([
// ...
\Filament\Actions\DeleteAction::make(),
DeleteAction::make(),
]);
}
```
+44 -27
View File
@@ -259,6 +259,10 @@ php artisan make:filament-relation-manager CategoryResource posts title --attach
Alternatively, if you've already generated your resource, you can just add the actions to the `$table` arrays:
```php
use Filament\Actions\AttachAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DetachAction;
use Filament\Actions\DetachBulkAction;
use Filament\Tables\Table;
public function table(Table $table): Table
@@ -269,16 +273,16 @@ public function table(Table $table): Table
])
->headerActions([
// ...
\Filament\Actions\AttachAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
// ...
\Filament\Actions\DetachAction::make(),
DetachAction::make(),
])
->bulkActions([
\Filament\Actions\BulkActionGroup::make([
->toolbarActions([
BulkActionGroup::make([
// ...
\Filament\Actions\DetachBulkAction::make(),
DetachBulkAction::make(),
]),
]);
}
@@ -418,6 +422,10 @@ php artisan make:filament-relation-manager CategoryResource posts title --associ
Alternatively, if you've already generated your resource, you can just add the actions to the `$table` arrays:
```php
use Filament\Actions\AssociateAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DissociateAction;
use Filament\Actions\DissociateBulkAction;
use Filament\Tables\Table;
public function table(Table $table): Table
@@ -428,16 +436,16 @@ public function table(Table $table): Table
])
->headerActions([
// ...
\Filament\Actions\AssociateAction::make(),
AssociateAction::make(),
])
->actions([
->recordActions([
// ...
\Filament\Actions\DissociateAction::make(),
DissociateAction::make(),
])
->bulkActions([
\Filament\Actions\BulkActionGroup::make([
->toolbarActions([
BulkActionGroup::make([
// ...
\Filament\Actions\DissociateBulkAction::make(),
DissociateBulkAction::make(),
]),
]);
}
@@ -537,9 +545,10 @@ When generating your relation manager, you may pass the `--view` flag to also ad
php artisan make:filament-relation-manager CategoryResource posts title --view
```
Alternatively, if you've already generated your relation manager, you can just add the `ViewAction` to the `$table->actions()` array:
Alternatively, if you've already generated your relation manager, you can just add the `ViewAction` to the `$table->recordActions()` array:
```php
use Filament\Actions\ViewAction;
use Filament\Tables\Table;
public function table(Table $table): Table
@@ -548,8 +557,8 @@ public function table(Table $table): Table
->columns([
// ...
])
->actions([
\Filament\Actions\ViewAction::make(),
->recordActions([
ViewAction::make(),
// ...
]);
}
@@ -566,7 +575,13 @@ php artisan make:filament-relation-manager CategoryResource posts title --soft-d
Alternatively, you may add soft-deleting functionality to an existing relation manager:
```php
use Filament\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\ForceDeleteAction;
use Filament\Actions\ForceDeleteBulkAction;
use Filament\Actions\RestoreAction;
use Filament\Actions\RestoreBulkAction;
use Filament\Tables\Filters\TrashedFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -581,20 +596,20 @@ public function table(Table $table): Table
// ...
])
->filters([
Tables\Filters\TrashedFilter::make(),
TrashedFilter::make(),
// ...
])
->actions([
\Filament\Actions\DeleteAction::make(),
\Filament\Actions\ForceDeleteAction::make(),
\Filament\Actions\RestoreAction::make(),
->recordActions([
DeleteAction::make(),
ForceDeleteAction::make(),
RestoreAction::make(),
// ...
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
\Filament\Actions\DeleteBulkAction::make(),
\Filament\Actions\ForceDeleteBulkAction::make(),
\Filament\Actions\RestoreBulkAction::make(),
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
RestoreBulkAction::make(),
// ...
]),
]);
@@ -856,14 +871,16 @@ It is probably also useful to provide extra configuration on the relation manage
```php
use App\Filament\Resources\Blog\Posts\PostResource;
use Filament\Actions\AttachAction;
use Filament\Actions\CreateAction;
use Filament\Tables\Table;
public function table(Table $table): Table
{
return PostResource::table($table)
->headerActions([
\Filament\Actions\CreateAction::make(),
\Filament\Actions\AttachAction::make(),
CreateAction::make(),
AttachAction::make(),
]);
}
```
+1 -1
View File
@@ -173,7 +173,7 @@ public static function configure(Table $table): Table
->columns([
// ...
])
->actions([
->recordActions([
EmailCustomerAction::make(),
]);
}
+2 -2
View File
@@ -207,8 +207,8 @@ In this example, we will customize the profile page. We need to create a new PHP
namespace App\Filament\Pages\Auth;
use Filament\Auth\Pages\EditProfile as BaseEditProfile;
use Filament\Forms\Components\TextInput
;use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
class EditProfile extends BaseEditProfile
{
+2 -2
View File
@@ -63,10 +63,10 @@ class ListProducts extends Component implements HasForms, HasTable
->filters([
// ...
])
->actions([
->recordActions([
// ...
])
->bulkActions([
->toolbarActions([
// ...
]);
}
+1 -1
View File
@@ -22,7 +22,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
DeleteBulkAction::make(),
]);
}
+1 -1
View File
@@ -22,7 +22,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
ForceDeleteBulkAction::make(),
]);
}
+1 -1
View File
@@ -22,7 +22,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
RestoreBulkAction::make(),
]);
}
+3 -2
View File
@@ -69,7 +69,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
ExportBulkAction::make()
->exporter(ProductExporter::class),
]);
@@ -659,7 +659,8 @@ public function makeXlsxRow(array $values, ?Style $style = null): Row
When a user exports, they can choose which columns to export. As such, the `$this->columnMap` property may be used to determine which columns are being exported and in which order. You can replace `Row::fromValues()` with an array of `Cell` objects, which allow you to style them individually using [OpenSpout `Style` objects](https://github.com/openspout/openspout/blob/4.x/docs/documentation.md#styling). A `StyleMerger` can be used to merge the default style with the custom style for a cell, allowing you to apply additional styles on top of the default ones:
```php
use OpenSpout\Common\Entity\Cell;use OpenSpout\Common\Entity\Row;
use OpenSpout\Common\Entity\Cell;
use OpenSpout\Common\Entity\Row;
use OpenSpout\Common\Entity\Style\Style;
use OpenSpout\Writer\Common\Manager\Style\StyleMerger;
+42 -1
View File
@@ -98,6 +98,11 @@ class ActionGroup extends ViewComponent implements Arrayable, HasEmbeddedView
*/
protected string | Closure | null $defaultTriggerView = null;
/**
* @var array<array<mixed> | Closure>
*/
protected array $extraDropdownAttributes = [];
/**
* @param array<Action | ActionGroup> $actions
*/
@@ -436,7 +441,10 @@ class ActionGroup extends ViewComponent implements Arrayable, HasEmbeddedView
ob_start(); ?>
<div x-data="filamentDropdown" class="fi-dropdown">
<div
x-data="filamentDropdown"
<?= $this->getExtraDropdownAttributeBag()->class(['fi-dropdown'])->toHtml() ?>
>
<div
x-on:mousedown="toggle"
class="fi-dropdown-trigger"
@@ -653,4 +661,37 @@ class ActionGroup extends ViewComponent implements Arrayable, HasEmbeddedView
$this->flatActions,
);
}
/**
* @param array<mixed> | Closure $attributes
*/
public function extraDropdownAttributes(array | Closure $attributes, bool $merge = false): static
{
if ($merge) {
$this->extraDropdownAttributes[] = $attributes;
} else {
$this->extraDropdownAttributes = [$attributes];
}
return $this;
}
/**
* @return array<mixed>
*/
public function getExtraDropdownAttributes(): array
{
$temporaryAttributeBag = new ComponentAttributeBag;
foreach ($this->extraDropdownAttributes as $extraDropdownAttributes) {
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraDropdownAttributes), escape: false);
}
return $temporaryAttributeBag->getAttributes();
}
public function getExtraDropdownAttributeBag(): ComponentAttributeBag
{
return new ComponentAttributeBag($this->getExtraDropdownAttributes());
}
}
+11 -3
View File
@@ -10,9 +10,17 @@ class BulkAction extends Action
$this->bulk();
$this->accessSelectedRecords();
}
$this->extraAttributes([
'x-bind:disabled' => '! getSelectedRecordsCount()',
]);
/**
* @return array<mixed>
*/
public function getExtraAttributes(): array
{
return [
'x-cloak' => true,
'x-show' => 'getSelectedRecordsCount()',
...parent::getExtraAttributes(),
];
}
}
+12
View File
@@ -23,4 +23,16 @@ class BulkActionGroup extends ActionGroup
$this->labeledFrom('sm');
}
/**
* @return array<mixed>
*/
public function getExtraDropdownAttributes(): array
{
return [
'x-cloak' => true,
'x-show' => 'getSelectedRecordsCount()',
...parent::getExtraAttributes(),
];
}
}
@@ -64,8 +64,8 @@ class TableSelectLivewireComponent extends Component implements HasActions, HasF
$table
->headerActions([])
->actions([])
->bulkActions([])
->recordActions([])
->toolbarActions([])
->emptyStateActions([])
->selectable()
->trackDeselectedRecords(false)
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -81,10 +81,10 @@ trait CanGenerateResourceTables
->filters([
{$this->outputTableFilters()}
]){$headerActionsOutput}
->actions([
->recordActions([
{$this->outputTableActions()}
])
->bulkActions([
->toolbarActions([
{$this->simplifyFqn(BulkActionGroup::class)}::make([
{$this->outputTableMethodBulkActions()}
]),
+3 -3
View File
@@ -120,7 +120,7 @@ You can use any [schema component](../schemas) to build the UI for a filter. For
### Defining table actions
Filament's tables can use [actions](../actions/overview). They are buttons that can be added to the [end of any table row](actions#row-actions), or even in the [header](actions#header-actions) of a table. For instance, you may want an action to "create" a new record in the header, and then "edit" and "delete" actions on each row. [Bulk actions](actions#bulk-actions) can be used to execute code when records in the table are selected.
Filament's tables can use [actions](../actions/overview). They are buttons that can be added to the [end of any table row](actions#record-actions), or even in the [header](actions#header-actions) of a table. For instance, you may want an action to "create" a new record in the header, and then "edit" and "delete" actions on each row. [Bulk actions](actions#bulk-actions) can be used to execute code when records in the table are selected.
```php
use App\Models\Post;
@@ -134,7 +134,7 @@ public function table(Table $table): Table
->columns([
// ...
])
->actions([
->recordActions([
Action::make('feature')
->action(function (Post $record) {
$record->is_featured = true;
@@ -148,7 +148,7 @@ public function table(Table $table): Table
})
->visible(fn (Post $record): bool => $record->is_featured),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
+42 -22
View File
@@ -5,13 +5,13 @@ import AutoScreenshot from "@components/AutoScreenshot.astro"
## Introduction
Filament's tables can use [Actions](../actions). They are buttons that can be added to the [end of any table row](#row-actions), or even in the [header](#header-actions) of a table. For instance, you may want an action to "create" a new record in the header, and then "edit" and "delete" actions on each row. [Bulk actions](#bulk-actions) can be used to execute code when records in the table are selected. Additionally, actions can be added to any [table column](#column-actions), such that each cell in that column is a trigger for your action.
Filament's tables can use [Actions](../actions). They are buttons that can be added to the [end of any table row](#record-actions), or even in the [header](#header-actions) or [toolbar](#toolbar-actions) of a table. For instance, you may want an action to "create" a new record in the header, and then "edit" and "delete" actions on each row. [Bulk actions](#bulk-actions) can be used to execute code when records in the table are selected. Additionally, actions can be added to any [table column](#column-actions), such that each cell in that column is a trigger for your action.
It's highly advised that you read the documentation about [customizing action trigger buttons](../actions/overview) and [action modals](../actions/modals) to that you are aware of the full capabilities of actions.
## Row actions
## Record actions
Action buttons can be rendered at the end of each table row. You can put them in the `$table->actions()` method:
Action buttons can be rendered at the end of each table row. You can put them in the `$table->recordActions()` method:
```php
use Filament\Tables\Table;
@@ -19,7 +19,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->actions([
->recordActions([
// ...
]);
}
@@ -46,39 +46,39 @@ All methods on the action accept callback functions, where you can access the cu
<AutoScreenshot name="tables/actions/simple" alt="Table with actions" version="4.x" />
### Positioning row actions before columns
### Positioning record actions before columns
By default, the row actions in your table are rendered in the final cell of each row. You may move them before the columns by using the `position` argument:
By default, the record actions in your table are rendered in the final cell of each row. You may move them before the columns by using the `position` argument:
```php
use Filament\Tables\Enums\ActionsPosition;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->actions([
->recordActions([
// ...
], position: ActionsPosition::BeforeColumns);
], position: RecordActionsPosition::BeforeColumns);
}
```
<AutoScreenshot name="tables/actions/before-columns" alt="Table with actions before columns" version="4.x" />
### Positioning row actions before the checkbox column
### Positioning record actions before the checkbox column
By default, the row actions in your table are rendered in the final cell of each row. You may move them before the checkbox column by using the `position` argument:
By default, the record actions in your table are rendered in the final cell of each row. You may move them before the checkbox column by using the `position` argument:
```php
use Filament\Tables\Enums\ActionsPosition;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->actions([
->recordActions([
// ...
], position: ActionsPosition::BeforeCells);
], position: RecordActionsPosition::BeforeCells);
}
```
@@ -100,7 +100,7 @@ public function table(Table $table): Table
{
return $table
->selectable()
->actions([
->recordActions([
Action::make('copyToSelected')
->accessSelectedRecords()
->action(function (Model $record, Collection $selectedRecords) {
@@ -116,7 +116,7 @@ public function table(Table $table): Table
## Bulk actions
Tables also support "bulk actions". These can be used when the user selects rows in the table. Traditionally, when rows are selected, a "bulk actions" button appears in the top left corner of the table. When the user clicks this button, they are presented with a dropdown menu of actions to choose from. You can put them in the `$table->bulkActions()` method:
Tables also support "bulk actions". These can be used when the user selects rows in the table. Traditionally, when rows are selected, a "bulk actions" button appears. When the user clicks this button, they are presented with a dropdown menu of actions to choose from. You can put them in the `$table->toolbarActions()` or `$table->headerActions()` methods:
```php
use Filament\Tables\Table;
@@ -124,7 +124,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
// ...
]);
}
@@ -283,7 +283,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
BulkAction::make('delete')
->requiresConfirmation()
@@ -341,7 +341,7 @@ use Illuminate\Database\Eloquent\Model;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
// ...
])
->checkIfRecordIsSelectableUsing(
@@ -360,7 +360,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->bulkActions([
->toolbarActions([
// ...
])
->selectCurrentPageOnly();
@@ -401,7 +401,7 @@ BulkAction::make()
## Header actions
Both [row actions](#row-actions) and [bulk actions](#bulk-actions) can be rendered in the header of the table. You can put them in the `$table->headerActions()` method:
Both actions and [bulk actions](#bulk-actions) can be rendered in the header of the table. You can put them in the `$table->headerActions()` method:
```php
use Filament\Tables\Table;
@@ -419,6 +419,26 @@ This is useful for things like "create" actions, which are not related to any sp
<AutoScreenshot name="tables/actions/header" alt="Table with header actions" version="4.x" />
## Toolbar actions
Both actions and [bulk actions](#bulk-actions) can be rendered in the toolbar of the table. You can put them in the `$table->toolbarActions()` method:
```php
use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->toolbarActions([
// ...
]);
}
```
This is useful for things like "create" actions, which are not related to any specific table row, or bulk actions that need to be more visible.
<AutoScreenshot name="tables/actions/toolbar" alt="Table with toolbar actions" version="4.x" />
## Column actions
Actions can be added to columns, such that when a cell in that column is clicked, it acts as the trigger for an action. You can learn more about [column actions](columns/overview#triggering-actions) in the documentation.
@@ -437,7 +457,7 @@ use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->actions([
->recordActions([
ActionGroup::make([
ViewAction::make(),
EditAction::make(),
+6 -6
View File
@@ -361,7 +361,7 @@ public function table(Table $table): Table
TextColumn::make('title'),
TextColumn::make('slug'),
])
->actions([
->recordActions([
Action::make('view')
->color('gray')
->icon(Heroicon::Eye)
@@ -408,7 +408,7 @@ public function table(Table $table): Table
->columns([
// ...
])
->actions([
->recordActions([
BulkAction::make('feature')
->requiresConfirmation()
->action(function (Collection $records): void {
@@ -472,7 +472,7 @@ public function table(Table $table): Table
->columns([
// ...
])
->actions([
->recordActions([
BulkAction::make('feature')
->requiresConfirmation()
->action(function (Collection $records): void {
@@ -853,7 +853,7 @@ public function table(Table $table): Table
TextColumn::make('title'),
TextColumn::make('category'),
])
->actions([
->recordActions([
Action::make('edit')
->icon(Heroicon::PencilSquare)
->modalHeading('Edit product')
@@ -947,7 +947,7 @@ public function table(Table $table): Table
TextColumn::make('title'),
TextColumn::make('category'),
])
->actions([
->recordActions([
Action::make('view')
->color('gray')
->icon(Heroicon::Eye)
@@ -1030,7 +1030,7 @@ public function table(Table $table): Table
TextColumn::make('price')
->money(),
])
->actions([
->recordActions([
Action::make('delete')
->color('danger')
->icon(Heroicon::Trash)
+1 -1
View File
@@ -1,5 +1,5 @@
.fi-ta-actions {
@apply flex shrink-0 items-center justify-end gap-3;
@apply flex max-w-full shrink-0 items-center justify-end gap-3;
&.fi-wrapped {
@apply flex-wrap;
+1 -1
View File
@@ -38,7 +38,7 @@
}
& .fi-ta-header-toolbar {
@apply flex items-center justify-between gap-x-4 px-4 py-3 sm:px-6;
@apply flex flex-wrap items-center justify-between gap-4 px-4 py-3 sm:px-6;
& > * {
@apply flex items-center gap-x-4;
@@ -15,7 +15,7 @@
@php
use Filament\Support\Enums\Alignment;
use Filament\Tables\Columns\Column;
use Filament\Tables\Enums\ActionsPosition;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Enums\RecordCheckboxPosition;
if ($groupsOnly && $groupColumn) {
@@ -29,7 +29,7 @@
@if ($hasPageSummary)
<tr class="fi-ta-row fi-ta-summary-header-row fi-striped">
@if ($placeholderColumns && $actions && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns]))
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::BeforeCells, RecordActionsPosition::BeforeColumns]))
<td></td>
@endif
@@ -73,7 +73,7 @@
@endif
@endforeach
@if ($placeholderColumns && $actions && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells]))
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::AfterColumns, RecordActionsPosition::AfterCells]))
<td></td>
@endif
@@ -16,7 +16,7 @@
@php
use Filament\Support\Enums\Alignment;
use Filament\Tables\Columns\Column;
use Filament\Tables\Enums\ActionsPosition;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Enums\RecordCheckboxPosition;
if ($groupsOnly && $groupColumn) {
@@ -27,7 +27,7 @@
@endphp
<tr {{ $attributes->class(['fi-ta-row fi-ta-summary-row']) }}>
@if ($placeholderColumns && $actions && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns]))
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::BeforeCells, RecordActionsPosition::BeforeColumns]))
<td></td>
@endif
@@ -92,7 +92,7 @@
@endif
@endforeach
@if ($placeholderColumns && $actions && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells]))
@if ($placeholderColumns && $actions && in_array($actionsPosition, [RecordActionsPosition::AfterColumns, RecordActionsPosition::AfterCells]))
<td></td>
@endif
+184 -189
View File
@@ -6,20 +6,20 @@
use Filament\Tables\Actions\HeaderActionsPosition;
use Filament\Tables\Columns\Column;
use Filament\Tables\Columns\ColumnGroup;
use Filament\Tables\Enums\ActionsPosition;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Enums\RecordActionsPosition;
use Filament\Tables\Enums\RecordCheckboxPosition;
use Illuminate\Support\Str;
use Illuminate\View\ComponentAttributeBag;
$actions = $getActions();
$flatActionsCount = count($getFlatActions());
$actionsAlignment = $getActionsAlignment();
$actionsPosition = $getActionsPosition();
$actionsColumnLabel = $getActionsColumnLabel();
$recordActions = $getRecordActions();
$flatRecordActionsCount = count($getFlatRecordActions());
$recordActionsAlignment = $getRecordActionsAlignment();
$recordActionsPosition = $getRecordActionsPosition();
$recordActionsColumnLabel = $getRecordActionsColumnLabel();
if (! $actionsAlignment instanceof Alignment) {
$actionsAlignment = filled($actionsAlignment) ? (Alignment::tryFrom($actionsAlignment) ?? $actionsAlignment) : null;
if (! $recordActionsAlignment instanceof Alignment) {
$recordActionsAlignment = filled($recordActionsAlignment) ? (Alignment::tryFrom($recordActionsAlignment) ?? $recordActionsAlignment) : null;
}
$activeFiltersCount = $getActiveFiltersCount();
@@ -41,14 +41,14 @@
$header = $getHeader();
$headerActions = array_filter(
$getHeaderActions(),
fn (\Filament\Actions\Action | \Filament\Actions\BulkAction | \Filament\Actions\ActionGroup $action): bool => $action->isVisible(),
fn (\Filament\Actions\Action | \Filament\Actions\ActionGroup $action): bool => $action->isVisible(),
);
$headerActionsPosition = $getHeaderActionsPosition();
$heading = $getHeading();
$group = $getGrouping();
$bulkActions = array_filter(
$getBulkActions(),
fn (\Filament\Actions\BulkAction | \Filament\Actions\ActionGroup $action): bool => $action->isVisible(),
$toolbarActions = array_filter(
$getToolbarActions(),
fn (\Filament\Actions\Action | \Filament\Actions\ActionGroup $action): bool => $action->isVisible(),
);
$groups = $getGroups();
$description = $getDescription();
@@ -89,7 +89,7 @@
$defaultSortOptionLabel = $getDefaultSortOptionLabel();
$sortDirection = $getSortDirection();
if (count($actions) && (! $isReordering)) {
if (count($recordActions) && (! $isReordering)) {
$columnsCount++;
}
@@ -131,7 +131,7 @@
>
<div
@if (! $hasHeader) x-cloak @endif
x-show="@js($hasHeader) || (getSelectedRecordsCount() && @js(count($bulkActions)))"
x-show="@js($hasHeader) || (getSelectedRecordsCount() && @js(count($toolbarActions)))"
class="fi-ta-header-ctn"
>
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::HEADER_BEFORE, scopes: static::class) }}
@@ -206,179 +206,173 @@
<div
@if (! $hasHeaderToolbar) x-cloak @endif
x-show="@js($hasHeaderToolbar) || (getSelectedRecordsCount() && @js(count($bulkActions)))"
x-show="@js($hasHeaderToolbar) || (getSelectedRecordsCount() && @js(count($toolbarActions)))"
class="fi-ta-header-toolbar"
>
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_START, scopes: static::class) }}
<div>
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_REORDER_TRIGGER_BEFORE, scopes: static::class) }}
@if ($isReorderable || ((! $isReordering) && count($toolbarActions)) || $areGroupingSettingsVisible)
<div class="fi-ta-actions fi-align-start fi-wrapped">
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_REORDER_TRIGGER_BEFORE, scopes: static::class) }}
@if ($isReorderable)
<span x-show="! getSelectedRecordsCount()">
@if ($isReorderable)
{{ $reorderRecordsTriggerAction }}
</span>
@endif
@endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_REORDER_TRIGGER_AFTER, scopes: static::class) }}
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_REORDER_TRIGGER_AFTER, scopes: static::class) }}
@if ((! $isReordering) && count($bulkActions))
<div
x-cloak
x-show="getSelectedRecordsCount()"
class="fi-ta-actions"
>
@foreach ($bulkActions as $action)
@if ((! $isReordering) && count($toolbarActions))
@foreach ($toolbarActions as $action)
{{ $action }}
@endforeach
</div>
@endif
@endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_GROUPING_SELECTOR_BEFORE, scopes: static::class) }}
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_GROUPING_SELECTOR_BEFORE, scopes: static::class) }}
@if ($areGroupingSettingsVisible)
<div
x-data="{
direction: $wire.$entangle('tableGroupingDirection', true),
group: $wire.$entangle('tableGrouping', true),
}"
x-init="
$watch('group', function (newGroup, oldGroup) {
if (newGroup && direction) {
return
}
@if ($areGroupingSettingsVisible)
<div
x-data="{
direction: $wire.$entangle('tableGroupingDirection', true),
group: $wire.$entangle('tableGrouping', true),
}"
x-init="
$watch('group', function (newGroup, oldGroup) {
if (newGroup && direction) {
return
}
if (! newGroup) {
direction = null
if (! newGroup) {
direction = null
return
}
return
}
if (oldGroup) {
return
}
if (oldGroup) {
return
}
direction = 'asc'
})
"
class="fi-ta-grouping-settings"
>
<x-filament::dropdown
placement="bottom-start"
shift
width="xs"
wire:key="{{ $this->getId() }}.table.grouping"
@class([
'sm:fi-hidden' => ! $areGroupingSettingsInDropdownOnDesktop,
])
direction = 'asc'
})
"
class="fi-ta-grouping-settings"
>
<x-slot name="trigger">
{{ $getGroupRecordsTriggerAction() }}
</x-slot>
<x-filament::dropdown
placement="bottom-start"
shift
width="xs"
wire:key="{{ $this->getId() }}.table.grouping"
@class([
'sm:fi-hidden' => ! $areGroupingSettingsInDropdownOnDesktop,
])
>
<x-slot name="trigger">
{{ $getGroupRecordsTriggerAction() }}
</x-slot>
<div class="fi-ta-grouping-settings-fields">
<label>
<span>
{{ __('filament-tables::table.grouping.fields.group.label') }}
</span>
<x-filament::input.wrapper>
<x-filament::input.select
x-model="group"
x-on:change="resetCollapsedGroups()"
>
<option value="">-</option>
@foreach ($groups as $groupOption)
<option
value="{{ $groupOption->getId() }}"
>
{{ $groupOption->getLabel() }}
</option>
@endforeach
</x-filament::input.select>
</x-filament::input.wrapper>
</label>
@if (! $isGroupingDirectionSettingHidden)
<label x-cloak x-show="group">
<div class="fi-ta-grouping-settings-fields">
<label>
<span>
{{ __('filament-tables::table.grouping.fields.direction.label') }}
{{ __('filament-tables::table.grouping.fields.group.label') }}
</span>
<x-filament::input.wrapper>
<x-filament::input.select
x-model="direction"
x-model="group"
x-on:change="resetCollapsedGroups()"
>
<option value="asc">
{{ __('filament-tables::table.grouping.fields.direction.options.asc') }}
</option>
<option value="">-</option>
<option value="desc">
{{ __('filament-tables::table.grouping.fields.direction.options.desc') }}
</option>
@foreach ($groups as $groupOption)
<option
value="{{ $groupOption->getId() }}"
>
{{ $groupOption->getLabel() }}
</option>
@endforeach
</x-filament::input.select>
</x-filament::input.wrapper>
</label>
@endif
</div>
</x-filament::dropdown>
@if (! $areGroupingSettingsInDropdownOnDesktop)
<div class="fi-ta-grouping-settings-fields">
<label>
<span class="fi-sr-only">
{{ __('filament-tables::table.grouping.fields.group.label') }}
</span>
@if (! $isGroupingDirectionSettingHidden)
<label x-cloak x-show="group">
<span>
{{ __('filament-tables::table.grouping.fields.direction.label') }}
</span>
<x-filament::input.wrapper>
<x-filament::input.select
x-model="group"
x-on:change="resetCollapsedGroups()"
>
<option value="">
{{ __('filament-tables::table.grouping.fields.group.placeholder') }}
</option>
@foreach ($groups as $groupOption)
<option
value="{{ $groupOption->getId() }}"
<x-filament::input.wrapper>
<x-filament::input.select
x-model="direction"
>
{{ $groupOption->getLabel() }}
</option>
@endforeach
</x-filament::input.select>
</x-filament::input.wrapper>
</label>
<option value="asc">
{{ __('filament-tables::table.grouping.fields.direction.options.asc') }}
</option>
@if (! $isGroupingDirectionSettingHidden)
<label x-cloak x-show="group">
<option value="desc">
{{ __('filament-tables::table.grouping.fields.direction.options.desc') }}
</option>
</x-filament::input.select>
</x-filament::input.wrapper>
</label>
@endif
</div>
</x-filament::dropdown>
@if (! $areGroupingSettingsInDropdownOnDesktop)
<div class="fi-ta-grouping-settings-fields">
<label>
<span class="fi-sr-only">
{{ __('filament-tables::table.grouping.fields.direction.label') }}
{{ __('filament-tables::table.grouping.fields.group.label') }}
</span>
<x-filament::input.wrapper>
<x-filament::input.select
x-model="direction"
x-model="group"
x-on:change="resetCollapsedGroups()"
>
<option value="asc">
{{ __('filament-tables::table.grouping.fields.direction.options.asc') }}
<option value="">
{{ __('filament-tables::table.grouping.fields.group.placeholder') }}
</option>
<option value="desc">
{{ __('filament-tables::table.grouping.fields.direction.options.desc') }}
</option>
@foreach ($groups as $groupOption)
<option
value="{{ $groupOption->getId() }}"
>
{{ $groupOption->getLabel() }}
</option>
@endforeach
</x-filament::input.select>
</x-filament::input.wrapper>
</label>
@endif
</div>
@endif
</div>
@endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_GROUPING_SELECTOR_AFTER, scopes: static::class) }}
</div>
@if (! $isGroupingDirectionSettingHidden)
<label x-cloak x-show="group">
<span class="fi-sr-only">
{{ __('filament-tables::table.grouping.fields.direction.label') }}
</span>
<x-filament::input.wrapper>
<x-filament::input.select
x-model="direction"
>
<option value="asc">
{{ __('filament-tables::table.grouping.fields.direction.options.asc') }}
</option>
<option value="desc">
{{ __('filament-tables::table.grouping.fields.direction.options.desc') }}
</option>
</x-filament::input.select>
</x-filament::input.wrapper>
</label>
@endif
</div>
@endif
</div>
@endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_GROUPING_SELECTOR_AFTER, scopes: static::class) }}
</div>
@endif
@if ($isGlobalSearchVisible || $hasFiltersDialog || $hasColumnToggleDropdown)
<div>
@@ -797,7 +791,7 @@
$hasCollapsibleColumnsLayout = (bool) $collapsibleColumnsLayout?->isVisible();
$recordActions = array_reduce(
$actions,
$recordActions,
function (array $carry, $action) use ($record): array {
if (! $action instanceof \Filament\Actions\ActionGroup) {
$action = clone $action;
@@ -991,7 +985,7 @@
</a>
@elseif ($recordAction)
@php
$recordWireClickAction = $getAction($recordAction)
$recordWireClickAction = $getRecordAction($recordAction)
? "mountTableAction('{$recordAction}', '{$recordKey}')"
: $recordWireClickAction = "{$recordAction}('{$recordKey}')";
@endphp
@@ -1046,7 +1040,7 @@
'fi-ta-actions fi-wrapped sm:fi-not-wrapped',
'fi-align-start' => $contentGrid,
'md:fi-align-end' => ! $contentGrid,
'fi-ta-actions-before-columns-position' => $actionsPosition === ActionsPosition::BeforeColumns,
'fi-ta-actions-before-columns-position' => $recordActionsPosition === RecordActionsPosition::BeforeColumns,
])
>
@foreach ($recordActions as $action)
@@ -1126,7 +1120,7 @@
@if ($isReordering)
<th></th>
@else
@if (count($actions) && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns]))
@if (count($recordActions) && in_array($recordActionsPosition, [RecordActionsPosition::BeforeCells, RecordActionsPosition::BeforeColumns]))
<th></th>
@endif
@@ -1166,7 +1160,7 @@
@endforeach
@if ((! $isReordering) && count($records))
@if (count($actions) && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells]))
@if (count($recordActions) && in_array($recordActionsPosition, [RecordActionsPosition::AfterColumns, RecordActionsPosition::AfterCells]))
<th></th>
@endif
@@ -1182,14 +1176,14 @@
@if ($isReordering)
<th></th>
@else
@if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells)
@if ($actionsColumnLabel)
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::BeforeCells)
@if ($recordActionsColumnLabel)
<th class="fi-ta-header-cell">
{{ $actionsColumnLabel }}
{{ $recordActionsColumnLabel }}
</th>
@else
<th
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatActionsCount) }}"
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatRecordActionsCount) }}"
class="fi-ta-actions-header-cell fi-ta-empty-header-cell"
></th>
@endif
@@ -1228,14 +1222,14 @@
</th>
@endif
@if (count($actions) && $actionsPosition === ActionsPosition::BeforeColumns)
@if ($actionsColumnLabel)
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::BeforeColumns)
@if ($recordActionsColumnLabel)
<th class="fi-ta-header-cell">
{{ $actionsColumnLabel }}
{{ $recordActionsColumnLabel }}
</th>
@else
<th
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatActionsCount) }}"
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatRecordActionsCount) }}"
class="fi-ta-actions-header-cell fi-ta-empty-header-cell"
></th>
@endif
@@ -1300,16 +1294,16 @@
@endforeach
@if ((! $isReordering) && count($records))
@if (count($actions) && $actionsPosition === ActionsPosition::AfterColumns)
@if ($actionsColumnLabel)
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::AfterColumns)
@if ($recordActionsColumnLabel)
<th
class="fi-ta-header-cell fi-align-end"
>
{{ $actionsColumnLabel }}
{{ $recordActionsColumnLabel }}
</th>
@else
<th
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatActionsCount) }}"
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatRecordActionsCount) }}"
class="fi-ta-actions-header-cell fi-ta-empty-header-cell"
></th>
@endif
@@ -1348,16 +1342,16 @@
</th>
@endif
@if (count($actions) && $actionsPosition === ActionsPosition::AfterCells)
@if ($actionsColumnLabel)
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::AfterCells)
@if ($recordActionsColumnLabel)
<th
class="fi-ta-header-cell fi-align-end"
>
{{ $actionsColumnLabel }}
{{ $recordActionsColumnLabel }}
</th>
@else
<th
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatActionsCount) }}"
aria-label="{{ trans_choice('filament-tables::table.columns.actions.label', $flatRecordActionsCount) }}"
class="fi-ta-actions-header-cell fi-ta-empty-header-cell"
></th>
@endif
@@ -1387,7 +1381,7 @@
@if ($isReordering)
<td></td>
@else
@if (count($actions) && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns]))
@if (count($recordActions) && in_array($recordActionsPosition, [RecordActionsPosition::BeforeCells, RecordActionsPosition::BeforeColumns]))
<td></td>
@endif
@@ -1420,7 +1414,7 @@
@endforeach
@if ((! $isReordering) && count($records))
@if (count($actions) && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells]))
@if (count($recordActions) && in_array($recordActionsPosition, [RecordActionsPosition::AfterColumns, RecordActionsPosition::AfterCells]))
<td></td>
@endif
@@ -1449,7 +1443,7 @@
$recordGroupTitle = $group?->getTitle($record);
$recordActions = array_reduce(
$actions,
$recordActions,
function (array $carry, $action) use ($record): array {
if (! $action instanceof \Filament\Actions\ActionGroup) {
$action = clone $action;
@@ -1479,8 +1473,8 @@
@endphp
<x-filament-tables::summary.row
:actions="count($actions)"
:actions-position="$actionsPosition"
:actions="count($recordActions)"
:actions-position="$recordActionsPosition"
:columns="$columns"
:group-column="$groupColumn"
:groups-only="$isGroupsOnly"
@@ -1505,8 +1499,8 @@
if (
($recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) &&
count($actions) &&
($actionsPosition === ActionsPosition::BeforeCells)
count($recordActions) &&
($recordActionsPosition === RecordActionsPosition::BeforeCells)
) {
$groupHeaderColspan--;
}
@@ -1514,7 +1508,7 @@
@endphp
@if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells)
@if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells)
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::BeforeCells)
<td></td>
@endif
@@ -1662,17 +1656,17 @@
</td>
@endif
@if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells && (! $isReordering))
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::BeforeCells && (! $isReordering))
<td class="fi-ta-cell">
<div
@class([
'fi-ta-actions',
match ($actionsAlignment) {
match ($recordActionsAlignment) {
Alignment::Center => 'fi-align-center',
Alignment::Start, Alignment::Left => 'fi-align-start',
Alignment::Between, Alignment::Justify => 'fi-align-between',
Alignment::End, Alignment::Right => '',
default => is_string($actionsAlignment) ? $actionsAlignment : '',
default => is_string($recordActionsAlignment) ? $recordActionsAlignment : '',
},
])
>
@@ -1704,17 +1698,17 @@
</td>
@endif
@if (count($actions) && $actionsPosition === ActionsPosition::BeforeColumns && (! $isReordering))
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::BeforeColumns && (! $isReordering))
<td class="fi-ta-cell">
<div
@class([
'fi-ta-actions',
match ($actionsAlignment) {
match ($recordActionsAlignment) {
Alignment::Center => 'fi-align-center',
Alignment::Start, Alignment::Left => 'fi-align-start',
Alignment::Between, Alignment::Justify => 'fi-align-between',
Alignment::End, Alignment::Right => '',
default => is_string($actionsAlignment) ? $actionsAlignment : '',
default => is_string($recordActionsAlignment) ? $recordActionsAlignment : '',
},
])
>
@@ -1774,7 +1768,8 @@
@if ($columnWrapperTag === 'a')
{{ \Filament\Support\generate_href_html($columnUrl ?: $recordUrl, $columnUrl ? $column->shouldOpenUrlInNewTab() : $openRecordUrlInNewTab) }}
@elseif ($columnWrapperTag === 'button')
type="button"
type
="button"
wire:click.stop.prevent="{{ $columnWireClickAction }}"
wire:loading.attr="disabled"
wire:target="{{ $columnWireClickAction }}"
@@ -1789,17 +1784,17 @@
</td>
@endforeach
@if (count($actions) && $actionsPosition === ActionsPosition::AfterColumns && (! $isReordering))
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::AfterColumns && (! $isReordering))
<td class="fi-ta-cell">
<div
@class([
'fi-ta-actions',
match ($actionsAlignment) {
match ($recordActionsAlignment) {
Alignment::Center => 'fi-align-center',
Alignment::Start, Alignment::Left => 'fi-align-start',
Alignment::Between, Alignment::Justify => 'fi-align-between',
Alignment::End, Alignment::Right => '',
default => is_string($actionsAlignment) ? $actionsAlignment : '',
default => is_string($recordActionsAlignment) ? $recordActionsAlignment : '',
},
])
>
@@ -1831,17 +1826,17 @@
</td>
@endif
@if (count($actions) && $actionsPosition === ActionsPosition::AfterCells && (! $isReordering))
@if (count($recordActions) && $recordActionsPosition === RecordActionsPosition::AfterCells && (! $isReordering))
<td class="fi-ta-cell">
<div
@class([
'fi-ta-actions',
match ($actionsAlignment) {
match ($recordActionsAlignment) {
Alignment::Center => 'fi-align-center',
Alignment::Start, Alignment::Left => 'fi-align-start',
Alignment::Between, Alignment::Justify => 'fi-align-between',
Alignment::End, Alignment::Right => '',
default => is_string($actionsAlignment) ? $actionsAlignment : '',
default => is_string($recordActionsAlignment) ? $recordActionsAlignment : '',
},
])
>
@@ -1869,8 +1864,8 @@
@endphp
<x-filament-tables::summary.row
:actions="count($actions)"
:actions-position="$actionsPosition"
:actions="count($recordActions)"
:actions-position="$recordActionsPosition"
:columns="$columns"
:group-column="$groupColumn"
:groups-only="$isGroupsOnly"
@@ -1888,8 +1883,8 @@
@endphp
<x-filament-tables::summary
:actions="count($actions)"
:actions-position="$actionsPosition"
:actions="count($recordActions)"
:actions-position="$recordActionsPosition"
:columns="$columns"
:group-column="$groupColumn"
:groups-only="$isGroupsOnly"
@@ -32,10 +32,10 @@ trait CanGenerateModelTables
->headerActions([
//
])
->actions([
->recordActions([
//
])
->bulkActions([
->toolbarActions([
{$this->simplifyFqn(BulkActionGroup::class)}::make([
//
]),
@@ -2,7 +2,7 @@
namespace Filament\Tables\Enums;
enum ActionsPosition
enum RecordActionsPosition
{
case AfterCells;
+2
View File
@@ -33,9 +33,11 @@ class Table extends ViewComponent
use Table\Concerns\HasQuery;
use Table\Concerns\HasQueryStringIdentifier;
use Table\Concerns\HasRecordAction;
use Table\Concerns\HasRecordActions;
use Table\Concerns\HasRecordClasses;
use Table\Concerns\HasRecords;
use Table\Concerns\HasRecordUrl;
use Table\Concerns\HasToolbarActions;
/**
* @var view-string
+51 -126
View File
@@ -2,114 +2,31 @@
namespace Filament\Tables\Table\Concerns;
use Closure;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Support\Enums\Size;
use Filament\Tables\Enums\ActionsPosition;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Arr;
use InvalidArgumentException;
use Filament\Actions\BulkAction;
trait HasActions
{
/**
* @var array<Action | ActionGroup>
*/
protected array $actions = [];
/**
* @var array<string, Action>
*/
protected array $flatActions = [];
protected string | Htmlable | Closure | null $actionsColumnLabel = null;
protected string | Closure | null $actionsAlignment = null;
protected ActionsPosition | Closure | null $actionsPosition = null;
/**
* @param array<Action | ActionGroup> | ActionGroup $actions
* @var array<string, BulkAction>
*/
public function actions(array | ActionGroup $actions, ActionsPosition | string | Closure | null $position = null): static
{
$this->actions = [];
$this->pushActions($actions);
if ($position) {
$this->actionsPosition($position);
}
return $this;
}
/**
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function pushActions(array | ActionGroup $actions): static
{
foreach (Arr::wrap($actions) as $action) {
$action->table($this);
if ($action instanceof ActionGroup) {
if (! $action->getDropdownPlacement()) {
$action->dropdownPlacement('bottom-end');
}
/** @var array<string, Action> $flatActions */
$flatActions = $action->getFlatActions();
$this->mergeCachedFlatActions($flatActions);
} elseif ($action instanceof Action) {
$action->defaultSize(Size::Small);
$action->defaultView($action::LINK_VIEW);
$this->cacheAction($action);
} else {
throw new InvalidArgumentException('Table actions must be an instance of [' . Action::class . '] or [' . ActionGroup::class . '].');
}
$this->actions[] = $action;
}
return $this;
}
public function actionsColumnLabel(string | Htmlable | Closure | null $label): static
{
$this->actionsColumnLabel = $label;
return $this;
}
public function actionsAlignment(string | Closure | null $alignment = null): static
{
$this->actionsAlignment = $alignment;
return $this;
}
public function actionsPosition(ActionsPosition | Closure | null $position = null): static
{
$this->actionsPosition = $position;
return $this;
}
/**
* @return array<Action | ActionGroup>
*/
public function getActions(): array
{
return $this->actions;
}
protected array $flatBulkActions = [];
public function getAction(string $name): ?Action
{
return $this->getFlatActions()[$name] ?? null;
}
public function getBulkAction(string $name): ?BulkAction
{
return $this->getFlatBulkActions()[$name] ?? null;
}
/**
* @return array<string, Action>
*/
@@ -118,18 +35,43 @@ trait HasActions
return $this->flatActions;
}
/**
* @return array<string, BulkAction>
*/
public function getFlatBulkActions(): array
{
return $this->flatBulkActions;
}
public function hasAction(string $name): bool
{
return array_key_exists($name, $this->getFlatActions());
}
public function hasBulkAction(string $name): bool
{
return array_key_exists($name, $this->getFlatBulkActions());
}
protected function cacheAction(Action $action, bool $shouldOverwriteExistingAction = true): void
{
if ($shouldOverwriteExistingAction) {
$this->flatActions[$action->getName()] = $action;
} else {
$this->flatActions[$action->getName()] ??= $action;
if (! $shouldOverwriteExistingAction) {
if ($action instanceof BulkAction) {
$this->flatBulkActions[$action->getName()] ??= $action;
} else {
$this->flatActions[$action->getName()] ??= $action;
}
return;
}
if ($action instanceof BulkAction) {
$this->flatBulkActions[$action->getName()] = $action;
return;
}
$this->flatActions[$action->getName()] = $action;
}
/**
@@ -137,41 +79,24 @@ trait HasActions
*/
protected function mergeCachedFlatActions(array $actions, bool $shouldOverwriteExistingActions = true): void
{
if ($shouldOverwriteExistingActions) {
$this->flatActions = [
...$this->flatActions,
...$actions,
];
} else {
$this->flatActions = [
...$actions,
...$this->flatActions,
];
foreach ($actions as $action) {
$this->cacheAction($action, $shouldOverwriteExistingActions);
}
}
public function getActionsPosition(): ActionsPosition
/**
* @param array<Action> $actions
*/
protected function removeCachedActions(array $actions): void
{
$position = $this->evaluate($this->actionsPosition);
$this->flatActions = array_filter(
$this->flatActions,
fn (Action $existingAction): bool => ! in_array($existingAction, $actions, true),
);
if ($position) {
return $position;
}
if (! ($this->getContentGrid() || $this->hasColumnsLayout())) {
return ActionsPosition::AfterColumns;
}
return ActionsPosition::AfterContent;
}
public function getActionsAlignment(): ?string
{
return $this->evaluate($this->actionsAlignment);
}
public function getActionsColumnLabel(): string | Htmlable | null
{
return $this->evaluate($this->actionsColumnLabel);
$this->flatBulkActions = array_filter(
$this->flatBulkActions,
fn (Action $existingAction): bool => ! in_array($existingAction, $actions, true),
);
}
}
@@ -3,26 +3,14 @@
namespace Filament\Tables\Table\Concerns;
use Closure;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Tables\Enums\RecordCheckboxPosition;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use InvalidArgumentException;
trait HasBulkActions
{
/**
* @var array<BulkAction | ActionGroup>
*/
protected array $bulkActions = [];
/**
* @var array<string, BulkAction>
*/
protected array $flatBulkActions = [];
protected ?Closure $checkIfRecordIsSelectableUsing = null;
protected bool | Closure | null $selectsCurrentPageOnly = false;
@@ -40,96 +28,39 @@ trait HasBulkActions
protected bool | Closure $isSelectionDisabled = false;
/**
* @param array<BulkAction | ActionGroup> | ActionGroup $actions
* @deprecated Use `toolbarActions()` instead.
*
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function bulkActions(array | ActionGroup $actions): static
{
// We must remove the existing cached bulk actions before setting the new ones, as
// the visibility of the checkboxes is determined by which bulk actions are visible.
// The `$this->flatBulkActions` array is used to determine if any bulk actions are
// visible. We cannot simply clear it, as the bulk actions defined in the header
// of the table are also stored in this array, and we do not want to remove them,
// only the bulk actions that are stored in the `$this->bulkActions` array.
foreach ($this->bulkActions as $existingAction) {
if ($existingAction instanceof ActionGroup) {
/** @var array<BulkAction> $flatExistingActions */
$flatExistingActions = $existingAction->getFlatActions();
$this->removeCachedBulkActions($flatExistingActions);
} elseif ($existingAction instanceof BulkAction) {
$this->removeCachedBulkActions([$existingAction]);
}
}
$this->bulkActions = [];
$this->pushBulkActions($actions);
$this->toolbarActions($actions);
return $this;
}
/**
* @param array<BulkAction | ActionGroup> | ActionGroup $actions
* @deprecated Use `pushToolbarActions()` instead.
*
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function pushBulkActions(array | ActionGroup $actions): static
{
foreach (Arr::wrap($actions) as $action) {
$action->table($this);
if ($action instanceof ActionGroup) {
/** @var array<string, BulkAction> $flatActions */
$flatActions = $action->getFlatActions();
$this->mergeCachedFlatBulkActions($flatActions);
} elseif ($action instanceof BulkAction) {
$this->cacheBulkAction($action);
} else {
throw new InvalidArgumentException('Table bulk actions must be an instance of [' . BulkAction::class . '] or [' . ActionGroup::class . '].');
}
$this->bulkActions[] = $action;
}
$this->pushToolbarActions($actions);
return $this;
}
/**
* @param array<BulkAction | ActionGroup> $actions
* @param array<Action | ActionGroup> $actions
*/
public function groupedBulkActions(array $actions): static
{
$this->bulkActions([BulkActionGroup::make($actions)]);
$this->toolbarActions([BulkActionGroup::make($actions)]);
return $this;
}
protected function cacheBulkAction(BulkAction $action): void
{
$this->flatBulkActions[$action->getName()] = $action;
}
/**
* @param array<string, BulkAction> $actions
*/
protected function mergeCachedFlatBulkActions(array $actions): void
{
$this->flatBulkActions = [
...$this->flatBulkActions,
...$actions,
];
}
/**
* @param array<BulkAction> $actions
*/
protected function removeCachedBulkActions(array $actions): void
{
$this->flatBulkActions = array_filter(
$this->flatBulkActions,
fn (BulkAction $existingAction): bool => ! in_array($existingAction, $actions, true),
);
}
public function checkIfRecordIsSelectableUsing(?Closure $callback): static
{
$this->checkIfRecordIsSelectableUsing = $callback;
@@ -144,27 +75,6 @@ trait HasBulkActions
return $this;
}
/**
* @return array<BulkAction | ActionGroup>
*/
public function getBulkActions(): array
{
return $this->bulkActions;
}
/**
* @return array<string, BulkAction>
*/
public function getFlatBulkActions(): array
{
return $this->flatBulkActions;
}
public function getBulkAction(string $name): ?BulkAction
{
return $this->getFlatBulkActions()[$name] ?? null;
}
/**
* @param Model | array<string, mixed> $record
*/
@@ -200,8 +110,8 @@ trait HasBulkActions
return $isSelectable;
}
foreach ($this->getFlatBulkActions() as $bulkAction) {
if ($bulkAction->isVisible()) {
foreach ($this->getFlatBulkActions() as $action) {
if ($action->isVisible()) {
return true;
}
}
@@ -278,4 +188,14 @@ trait HasBulkActions
{
return (bool) $this->evaluate($this->isSelectionDisabled);
}
/**
* @deprecated Use `getToolbarActions()` instead.
*
* @return array<Action | ActionGroup>
*/
public function getBulkActions(): array
{
return $this->getToolbarActions();
}
}
@@ -31,7 +31,25 @@ trait HasHeaderActions
*/
public function headerActions(array | ActionGroup $actions, HeaderActionsPosition | Closure | null $position = null): static
{
// We must remove the existing cached header actions before setting the new ones, as
// the visibility of the checkboxes is determined by which bulk actions are visible.
// The `$this->flatActions` array is used to determine if any bulk actions are
// visible. We cannot simply clear it, as the bulk actions defined in the header
// of the table are also stored in this array, and we do not want to remove them,
// only the bulk actions that are stored in the `$this->headerActions` array.
foreach ($this->headerActions as $existingAction) {
if ($existingAction instanceof ActionGroup) {
/** @var array<Action> $flatExistingActions */
$flatExistingActions = $existingAction->getFlatActions();
$this->removeCachedActions($flatExistingActions);
} elseif ($existingAction instanceof Action) {
$this->removeCachedActions([$existingAction]);
}
}
$this->headerActions = [];
$this->pushHeaderActions($actions);
if ($position) {
@@ -0,0 +1,233 @@
<?php
namespace Filament\Tables\Table\Concerns;
use Closure;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Support\Enums\Size;
use Filament\Tables\Enums\RecordActionsPosition;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Arr;
use PHPUnit\Event\InvalidArgumentException;
trait HasRecordActions
{
/**
* @var array<Action | ActionGroup>
*/
protected array $recordActions = [];
protected string | Htmlable | Closure | null $recordActionsColumnLabel = null;
protected string | Closure | null $recordActionsAlignment = null;
protected RecordActionsPosition | Closure | null $recordActionsPosition = null;
/**
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function recordActions(array | ActionGroup $actions, RecordActionsPosition | string | Closure | null $position = null): static
{
$this->recordActions = [];
$this->pushRecordActions($actions);
if ($position) {
$this->recordActionsPosition($position);
}
return $this;
}
/**
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function pushRecordActions(array | ActionGroup $actions): static
{
foreach (Arr::wrap($actions) as $action) {
$action->table($this);
if ($action instanceof ActionGroup) {
if (! $action->getDropdownPlacement()) {
$action->dropdownPlacement('bottom-end');
}
/** @var array<string, Action> $flatActions */
$flatActions = $action->getFlatActions();
$this->mergeCachedFlatActions($flatActions);
} elseif ($action instanceof Action) {
$action->defaultSize(Size::Small);
$action->defaultView($action::LINK_VIEW);
$this->cacheAction($action);
} else {
throw new InvalidArgumentException('Table actions must be an instance of [' . Action::class . '] or [' . ActionGroup::class . '].');
}
$this->recordActions[] = $action;
}
return $this;
}
public function recordActionsColumnLabel(string | Htmlable | Closure | null $label): static
{
$this->recordActionsColumnLabel = $label;
return $this;
}
public function recordActionsAlignment(string | Closure | null $alignment = null): static
{
$this->recordActionsAlignment = $alignment;
return $this;
}
public function recordActionsPosition(RecordActionsPosition | Closure | null $position = null): static
{
$this->recordActionsPosition = $position;
return $this;
}
/**
* @return array<Action | ActionGroup>
*/
public function getRecordActions(): array
{
return $this->recordActions;
}
public function getRecordActionsPosition(): RecordActionsPosition
{
$position = $this->evaluate($this->recordActionsPosition);
if ($position) {
return $position;
}
if (! ($this->getContentGrid() || $this->hasColumnsLayout())) {
return RecordActionsPosition::AfterColumns;
}
return RecordActionsPosition::AfterContent;
}
public function getRecordActionsAlignment(): ?string
{
return $this->evaluate($this->recordActionsAlignment);
}
public function getRecordActionsColumnLabel(): string | Htmlable | null
{
return $this->evaluate($this->recordActionsColumnLabel);
}
/**
* @deprecated Use `recordActions()` instead.
*
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function actions(array | ActionGroup $actions, RecordActionsPosition | string | Closure | null $position = null): static
{
$this->recordActions($actions, $position);
return $this;
}
/**
* @deprecated Use `pushRecordActions()` instead.
*
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function pushActions(array | ActionGroup $actions): static
{
$this->pushRecordActions($actions);
return $this;
}
/**
* @deprecated Use `recordActionsColumnLabel()` instead.
*/
public function actionsColumnLabel(string | Htmlable | Closure | null $label): static
{
$this->recordActionsColumnLabel($label);
return $this;
}
/**
* @deprecated Use `recordActionsAlignment()` instead.
*/
public function actionsAlignment(string | Closure | null $alignment = null): static
{
$this->recordActionsAlignment($alignment);
return $this;
}
/**
* @deprecated Use `recordActionsPosition()` instead.
*/
public function actionsPosition(RecordActionsPosition | Closure | null $position = null): static
{
$this->recordActionsPosition($position);
return $this;
}
/**
* @deprecated Use `getRecordActions()` instead.
*
* @return array<Action | ActionGroup>
*/
public function getActions(): array
{
return $this->getRecordActions();
}
/**
* @deprecated Use `getRecordActionsPosition()` instead.
*/
public function getActionsPosition(): RecordActionsPosition
{
return $this->getRecordActionsPosition();
}
/**
* @deprecated Use `getRecordActionsAlignment()` instead.
*/
public function getActionsAlignment(): ?string
{
return $this->getRecordActionsAlignment();
}
/**
* @deprecated Use `getRecordActionsColumnLabel()` instead.
*/
public function getActionsColumnLabel(): string | Htmlable | null
{
return $this->getRecordActionsColumnLabel();
}
/**
* @return array<string, Action>
*/
public function getFlatRecordActions(): array
{
$flatActions = [];
foreach ($this->getRecordActions() as $action) {
if ($action instanceof ActionGroup) {
$flatActions = array_merge($flatActions, $action->getFlatActions());
} else {
$flatActions[$action->getName()] = $action;
}
}
return $flatActions;
}
}
@@ -0,0 +1,78 @@
<?php
namespace Filament\Tables\Table\Concerns;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Illuminate\Support\Arr;
use InvalidArgumentException;
trait HasToolbarActions
{
/**
* @var array<Action | ActionGroup>
*/
protected array $toolbarActions = [];
/**
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function toolbarActions(array | ActionGroup $actions): static
{
// We must remove the existing cached toolbar actions before setting the new ones, as
// the visibility of the checkboxes is determined by which bulk actions are visible.
// The `$this->flatActions` array is used to determine if any bulk actions are
// visible. We cannot simply clear it, as the bulk actions defined in the toolbar
// of the table are also stored in this array, and we do not want to remove them,
// only the bulk actions that are stored in the `$this->toolbarActions` array.
foreach ($this->toolbarActions as $existingAction) {
if ($existingAction instanceof ActionGroup) {
/** @var array<Action> $flatExistingActions */
$flatExistingActions = $existingAction->getFlatActions();
$this->removeCachedActions($flatExistingActions);
} elseif ($existingAction instanceof Action) {
$this->removeCachedActions([$existingAction]);
}
}
$this->toolbarActions = [];
$this->pushToolbarActions($actions);
return $this;
}
/**
* @param array<Action | ActionGroup> | ActionGroup $actions
*/
public function pushToolbarActions(array | ActionGroup $actions): static
{
foreach (Arr::wrap($actions) as $action) {
$action->table($this);
if ($action instanceof ActionGroup) {
/** @var array<string, Action> $flatActions */
$flatActions = $action->getFlatActions();
$this->mergeCachedFlatActions($flatActions);
} elseif ($action instanceof Action) {
$this->cacheAction($action);
} else {
throw new InvalidArgumentException('Table actions must be an instance of [' . Action::class . '] or [' . ActionGroup::class . '].');
}
$this->toolbarActions[] = $action;
}
return $this;
}
/**
* @return array<Action | ActionGroup>
*/
public function getToolbarActions(): array
{
return $this->toolbarActions;
}
}
+1
View File
@@ -249,6 +249,7 @@ return static function (RectorConfig $rectorConfig): void {
'Filament\\Resources\\Pages\\ViewRecord\\Concerns\\Translatable' => 'LaraZeus\\SpatieTranslatable\\Resources\\Pages\\ListRecords\\Concerns\\Translatable',
'Filament\\Resources\\Pages\\ManageRecords\\Concerns\\Translatable' => 'LaraZeus\\SpatieTranslatable\\Resources\\Pages\\ListRecords\\Concerns\\Translatable',
'Filament\\Tables\\Actions\\LocaleSwitcher' => 'LaraZeus\\SpatieTranslatable\\Tables\\Actions\\LocaleSwitcher',
'Filament\\Tables\\Enums\\ActionsPosition' => 'Filament\\Tables\\Enums\\RecordActionsPosition',
],
);
@@ -45,12 +45,12 @@ class ManageUserTeams extends ManageRelatedRecords
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -45,12 +45,12 @@ class ManageUserTeams extends ManageRelatedRecords
Actions\CreateAction::make(),
Actions\AssociateAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DissociateAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DissociateBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -54,12 +54,12 @@ class ManageUserTeams extends ManageRelatedRecords
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -54,13 +54,13 @@ class ManageUserTeams extends ManageRelatedRecords
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\ViewAction::make(),
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -47,14 +47,14 @@ class ManageUserTeams extends ManageRelatedRecords
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -38,12 +38,12 @@ class TeamsRelationManager extends RelationManager
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -38,12 +38,12 @@ class TeamsRelationManager extends RelationManager
Actions\CreateAction::make(),
Actions\AssociateAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DissociateAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DissociateBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -47,12 +47,12 @@ class TeamsRelationManager extends RelationManager
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -47,13 +47,13 @@ class TeamsRelationManager extends RelationManager
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\ViewAction::make(),
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -40,14 +40,14 @@ class TeamsRelationManager extends RelationManager
Actions\CreateAction::make(),
Actions\AttachAction::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DetachAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DetachBulkAction::make(),
Actions\DeleteBulkAction::make(),
@@ -36,10 +36,10 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
Actions\EditAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DeleteBulkAction::make(),
]),
@@ -36,10 +36,10 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
Actions\EditAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DeleteBulkAction::make(),
]),
@@ -38,10 +38,10 @@ class PostResource extends Resource
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
->recordActions([
Actions\EditAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DeleteBulkAction::make(),
Actions\ForceDeleteBulkAction::make(),
@@ -36,11 +36,11 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
Actions\EditAction::make(),
Actions\DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DeleteBulkAction::make(),
]),
@@ -80,10 +80,10 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
Actions\EditAction::make(),
])
->bulkActions([
->toolbarActions([
Actions\BulkActionGroup::make([
Actions\DeleteBulkAction::make(),
]),
@@ -52,12 +52,12 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -52,12 +52,12 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AssociateAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DissociateAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DissociateBulkAction::make(),
DeleteBulkAction::make(),
@@ -47,12 +47,12 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -62,12 +62,12 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -62,13 +62,13 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -59,13 +59,13 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -59,14 +59,14 @@ class ManageUserTeams extends ManageRelatedRecords
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
ForceDeleteAction::make(),
RestoreAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -45,12 +45,12 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -45,12 +45,12 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AssociateAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DissociateAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DissociateBulkAction::make(),
DeleteBulkAction::make(),
@@ -40,12 +40,12 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -55,12 +55,12 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -55,13 +55,13 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -52,13 +52,13 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -52,14 +52,14 @@ class TeamsRelationManager extends RelationManager
CreateAction::make(),
AttachAction::make(),
])
->actions([
->recordActions([
EditAction::make(),
DetachAction::make(),
DeleteAction::make(),
ForceDeleteAction::make(),
RestoreAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DetachBulkAction::make(),
DeleteBulkAction::make(),
@@ -36,10 +36,10 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
@@ -18,10 +18,10 @@ class PostsTable
->filters([
//
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
@@ -18,10 +18,10 @@ class PostsTable
->filters([
//
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
@@ -21,10 +21,10 @@ class PostsTable
->filters([
TrashedFilter::make(),
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
@@ -37,11 +37,11 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
EditAction::make(),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
@@ -113,11 +113,11 @@ class PostResource extends Resource
->filters([
//
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
@@ -43,10 +43,10 @@ class PostsTable
->filters([
//
])
->actions([
->recordActions([
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
+2 -2
View File
@@ -188,7 +188,7 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con
AttachAction::make('attachMultiple')
->multiple(),
])
->actions([
->recordActions([
EditAction::make(),
DeleteAction::make(),
ForceDeleteAction::make(),
@@ -287,7 +287,7 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con
]),
]),
])
->bulkActions([
->toolbarActions([
DeleteBulkAction::make(),
BulkAction::make('data')
->mountUsing(fn (Schema $form) => $form->fill(['foo' => 'bar']))
@@ -27,7 +27,7 @@ class DepartmentsTable
->filters([
TrashedFilter::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
DeleteAction::make(),
@@ -35,7 +35,7 @@ class DepartmentsTable
RestoreAction::make(),
ReplicateAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
@@ -64,7 +64,7 @@ class PostResource extends Resource
Tables\Filters\Filter::make('is_published')
->query(fn (Builder $query) => $query->where('is_published', true)),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
Action::make('randomize_title')
@@ -79,7 +79,7 @@ class PostResource extends Resource
}),
DeleteAction::make(),
])
->bulkActions([
->toolbarActions([
DeleteBulkAction::make(),
]);
}
@@ -22,11 +22,11 @@ class TicketMessagesTable
->filters([
TrashedFilter::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
@@ -26,7 +26,7 @@ class TicketsTable
->filters([
TrashedFilter::make(),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
DeleteAction::make(),
@@ -34,7 +34,7 @@ class TicketsTable
RestoreAction::make(),
ReplicateAction::make(),
])
->bulkActions([
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
ForceDeleteBulkAction::make(),
@@ -58,11 +58,11 @@ class UserResource extends Resource
->sum('posts', 'rating')
->label('Posts Rating Sum'),
])
->actions([
->recordActions([
ViewAction::make(),
EditAction::make(),
])
->bulkActions([
->toolbarActions([
DeleteBulkAction::make(),
]);
}