|
2 | 2 |
|
3 | 3 | namespace Rappasoft\LaravelLivewireTables\Traits; |
4 | 4 |
|
5 | | -use Illuminate\Support\Collection; |
6 | | -use Livewire\Attributes\Computed; |
7 | | -use Rappasoft\LaravelLivewireTables\Views\Action; |
| 5 | +use Rappasoft\LaravelLivewireTables\Traits\Configuration\ActionsConfiguration; |
| 6 | +use Rappasoft\LaravelLivewireTables\Traits\Helpers\ActionsHelpers; |
8 | 7 |
|
9 | 8 | trait WithActions |
10 | 9 | { |
11 | | - protected array $actionWrapperAttributes = ['default-styling' => true, 'default-colors' => true]; |
| 10 | + use ActionsConfiguration, |
| 11 | + ActionsHelpers; |
12 | 12 |
|
13 | | - protected function actions(): array |
14 | | - { |
15 | | - return []; |
16 | | - } |
| 13 | + protected array $actionWrapperAttributes = ['class' => '', 'default-styling' => true, 'default-colors' => true]; |
17 | 14 |
|
18 | | - public function setActionWrapperAttributes(array $actionWrapperAttributes): self |
19 | | - { |
20 | | - $this->actionWrapperAttributes = [...['default-styling' => true, 'default-colors' => true], ...$actionWrapperAttributes]; |
| 15 | + protected bool $displayActionsInToolbar = false; |
21 | 16 |
|
22 | | - return $this; |
23 | | - } |
| 17 | + protected string $actionsPosition = 'right'; |
24 | 18 |
|
25 | | - #[Computed] |
26 | | - public function getActionWrapperAttributes(): array |
27 | | - { |
28 | | - return [...['default-styling' => true, 'default-colors' => true], ...$this->actionWrapperAttributes]; |
29 | | - } |
30 | | - |
31 | | - #[Computed] |
32 | | - public function hasActions(): bool |
33 | | - { |
34 | | - return (new Collection($this->actions())) |
35 | | - ->filter(fn ($action) => $action instanceof Action)->count() > 0; |
36 | | - } |
37 | | - |
38 | | - #[Computed] |
39 | | - public function getActions(): Collection |
| 19 | + protected function actions(): array |
40 | 20 | { |
41 | | - return (new Collection($this->actions())) |
42 | | - ->filter(fn ($action) => $action instanceof Action) |
43 | | - ->each(function (Action $action, int $key) { |
44 | | - $action->setTheme($this->getTheme()); |
45 | | - }); |
46 | | - |
| 21 | + return []; |
47 | 22 | } |
48 | 23 | } |
0 commit comments