diff --git a/src/Traits/Configuration/ActionsConfiguration.php b/src/Traits/Configuration/ActionsConfiguration.php index 89b5e08b6..4c9e76ce5 100644 --- a/src/Traits/Configuration/ActionsConfiguration.php +++ b/src/Traits/Configuration/ActionsConfiguration.php @@ -4,13 +4,6 @@ trait ActionsConfiguration { - public function setActionWrapperAttributes(array $actionWrapperAttributes): self - { - $this->actionWrapperAttributes = [...$this->actionWrapperAttributes, ...$actionWrapperAttributes]; - - return $this; - } - public function setActionsInToolbar(bool $status): self { $this->displayActionsInToolbar = $status; diff --git a/src/Traits/Configuration/CollapsingColumnConfiguration.php b/src/Traits/Configuration/CollapsingColumnConfiguration.php index d39e648a5..88e883e7d 100644 --- a/src/Traits/Configuration/CollapsingColumnConfiguration.php +++ b/src/Traits/Configuration/CollapsingColumnConfiguration.php @@ -24,28 +24,4 @@ public function setCollapsingColumnsDisabled(): self return $this; } - - /** - * Used to set attributes for the Collapsed Column Collapse Button - * - * @param array $collapsingColumnButtonCollapseAttributes - */ - public function setCollapsingColumnButtonCollapseAttributes(array $collapsingColumnButtonCollapseAttributes): self - { - $this->collapsingColumnButtonCollapseAttributes = [...['default-colors' => false, 'default-styling' => false], ...$collapsingColumnButtonCollapseAttributes]; - - return $this; - } - - /** - * Used to set attributes for the Collapsed Column Expand Button - * - * @param array $collapsingColumnButtonExpandAttributes - */ - public function setCollapsingColumnButtonExpandAttributes(array $collapsingColumnButtonExpandAttributes): self - { - $this->collapsingColumnButtonExpandAttributes = [...['default-colors' => false, 'default-styling' => false], ...$collapsingColumnButtonExpandAttributes]; - - return $this; - } } diff --git a/src/Traits/Configuration/FooterConfiguration.php b/src/Traits/Configuration/FooterConfiguration.php index 2a32b6fa3..8d20480b4 100644 --- a/src/Traits/Configuration/FooterConfiguration.php +++ b/src/Traits/Configuration/FooterConfiguration.php @@ -47,18 +47,4 @@ public function setUseHeaderAsFooterDisabled(): self return $this; } - - public function setFooterTrAttributes(Closure $callback): self - { - $this->footerTrAttributesCallback = $callback; - - return $this; - } - - public function setFooterTdAttributes(Closure $callback): self - { - $this->footerTdAttributesCallback = $callback; - - return $this; - } } diff --git a/src/Traits/Configuration/PaginationConfiguration.php b/src/Traits/Configuration/PaginationConfiguration.php index a74677255..4f43c688b 100644 --- a/src/Traits/Configuration/PaginationConfiguration.php +++ b/src/Traits/Configuration/PaginationConfiguration.php @@ -154,13 +154,6 @@ public function setDefaultPerPage(int $defaultPerPage): self return $this; } - public function setPerPageFieldAttributes(array $attributes = []): self - { - $this->perPageFieldAttributes = [...$this->perPageFieldAttributes, ...$attributes]; - - return $this; - } - public function setShouldRetrieveTotalItemCountStatus(bool $status): self { $this->shouldRetrieveTotalItemCount = $status; @@ -182,11 +175,4 @@ public function setShouldRetrieveTotalItemCountDisabled(): self return $this; } - - public function setPaginationWrapperAttributes(array $paginationWrapperAttributes): self - { - $this->paginationWrapperAttributes = array_merge(['class' => ''], $paginationWrapperAttributes); - - return $this; - } } diff --git a/src/Traits/Configuration/ReorderingConfiguration.php b/src/Traits/Configuration/ReorderingConfiguration.php index 8dae181ea..f926b0227 100644 --- a/src/Traits/Configuration/ReorderingConfiguration.php +++ b/src/Traits/Configuration/ReorderingConfiguration.php @@ -81,14 +81,4 @@ public function setDefaultReorderSort(string $field, string $direction = 'asc'): return $this; } - - /** - * Used to set attributes for the for Reorder Column - */ - public function setReorderThAttributes(array $reorderThAttributes): self - { - $this->reorderThAttributes = [...$this->reorderThAttributes, ...$reorderThAttributes]; - - return $this; - } } diff --git a/src/Traits/Configuration/SecondaryHeaderConfiguration.php b/src/Traits/Configuration/SecondaryHeaderConfiguration.php index 42ce2f574..736bf2ed9 100644 --- a/src/Traits/Configuration/SecondaryHeaderConfiguration.php +++ b/src/Traits/Configuration/SecondaryHeaderConfiguration.php @@ -2,8 +2,6 @@ namespace Rappasoft\LaravelLivewireTables\Traits\Configuration; -use Closure; - trait SecondaryHeaderConfiguration { public function setSecondaryHeaderStatus(bool $status): self @@ -26,18 +24,4 @@ public function setSecondaryHeaderDisabled(): self return $this; } - - public function setSecondaryHeaderTrAttributes(Closure $callback): self - { - $this->secondaryHeaderTrAttributesCallback = $callback; - - return $this; - } - - public function setSecondaryHeaderTdAttributes(Closure $callback): self - { - $this->secondaryHeaderTdAttributesCallback = $callback; - - return $this; - } } diff --git a/src/Traits/Helpers/ActionsHelpers.php b/src/Traits/Helpers/ActionsHelpers.php index 116ea60c9..47b3880c1 100644 --- a/src/Traits/Helpers/ActionsHelpers.php +++ b/src/Traits/Helpers/ActionsHelpers.php @@ -20,12 +20,6 @@ public function getActionsPosition(): string return $this->actionsPosition ?? 'right'; } - #[Computed] - public function getActionWrapperAttributes(): array - { - return [...['class' => '', 'default-styling' => true, 'default-colors' => true], ...$this->actionWrapperAttributes]; - } - #[Computed] public function hasActions(): bool { diff --git a/src/Traits/Helpers/CollapsingColumnHelpers.php b/src/Traits/Helpers/CollapsingColumnHelpers.php index 62ec86573..131e43b65 100644 --- a/src/Traits/Helpers/CollapsingColumnHelpers.php +++ b/src/Traits/Helpers/CollapsingColumnHelpers.php @@ -26,28 +26,6 @@ public function collapsingColumnsAreDisabled(): bool return $this->getCollapsingColumnsStatus() === false; } - /** - * Retrieves attributes for the Collapsed Column Collapse Button - * - * @return array - */ - #[Computed] - public function getCollapsingColumnButtonCollapseAttributes(): array - { - return [...['default-styling' => true, 'default-colors' => true], ...$this->collapsingColumnButtonCollapseAttributes]; - } - - /** - * Retrieves attributes for the Collapsed Column Expand Button - * - * @return array - */ - #[Computed] - public function getCollapsingColumnButtonExpandAttributes(): array - { - return [...['default-styling' => true, 'default-colors' => true], ...$this->collapsingColumnButtonExpandAttributes]; - } - #[Computed] public function showCollapsingColumnSections(): bool { diff --git a/src/Traits/Helpers/FooterHelpers.php b/src/Traits/Helpers/FooterHelpers.php index df220e3c0..655a38cf5 100644 --- a/src/Traits/Helpers/FooterHelpers.php +++ b/src/Traits/Helpers/FooterHelpers.php @@ -40,22 +40,4 @@ public function useHeaderAsFooterIsDisabled(): bool { return $this->getUseHeaderAsFooterStatus() === false; } - - /** - * @param mixed $rows - * @return array - */ - public function getFooterTrAttributes($rows): array - { - return isset($this->footerTrAttributesCallback) ? call_user_func($this->footerTrAttributesCallback, $rows) : ['default' => true]; - } - - /** - * @param mixed $rows - * @return array - */ - public function getFooterTdAttributes(Column $column, $rows, int $index): array - { - return isset($this->footerTdAttributesCallback) ? call_user_func($this->footerTdAttributesCallback, $column, $rows, $index) : ['default' => true]; - } } diff --git a/src/Traits/Helpers/PaginationHelpers.php b/src/Traits/Helpers/PaginationHelpers.php index 07ee59f59..801ee7a49 100644 --- a/src/Traits/Helpers/PaginationHelpers.php +++ b/src/Traits/Helpers/PaginationHelpers.php @@ -152,26 +152,9 @@ private function getPerPagePaginationSessionKey(): string return $this->tableName.'-perPage'; } - #[Computed] - public function getPerPageFieldAttributes(): array - { - return $this->perPageFieldAttributes; - } - #[Computed] public function getShouldRetrieveTotalItemCount(): bool { return $this->shouldRetrieveTotalItemCount; } - - public function getPaginationWrapperAttributes(): array - { - return $this->paginationWrapperAttributes ?? ['class' => '']; - } - - #[Computed] - public function getPaginationWrapperAttributesBag(): ComponentAttributeBag - { - return new ComponentAttributeBag($this->getPaginationWrapperAttributes()); - } } diff --git a/src/Traits/Helpers/ReorderingHelpers.php b/src/Traits/Helpers/ReorderingHelpers.php index c6ad8bd9a..df431d21c 100644 --- a/src/Traits/Helpers/ReorderingHelpers.php +++ b/src/Traits/Helpers/ReorderingHelpers.php @@ -93,23 +93,6 @@ public function getReorderingBackupSessionKey(): string return $this->getTableName().'-reordering-backup'; } - /** - * Used to get attributes for the for Bulk Actions - * - * @return array - */ - #[Computed] - public function getReorderThAttributes(): array - { - return $this->reorderThAttributes ?? ['default' => true]; - } - - #[Computed] - public function hasReorderThAttributes(): bool - { - return $this->getReorderThAttributes() != ['default' => true]; - } - public function getReorderColumn(): Column { return Column::make('reorder')->label(fn () => null); diff --git a/src/Traits/Helpers/SecondaryHeaderHelpers.php b/src/Traits/Helpers/SecondaryHeaderHelpers.php index 6af852483..7abc4c1b1 100644 --- a/src/Traits/Helpers/SecondaryHeaderHelpers.php +++ b/src/Traits/Helpers/SecondaryHeaderHelpers.php @@ -2,8 +2,6 @@ namespace Rappasoft\LaravelLivewireTables\Traits\Helpers; -use Rappasoft\LaravelLivewireTables\Views\Column; - trait SecondaryHeaderHelpers { public function hasColumnsWithSecondaryHeader(): bool @@ -25,22 +23,4 @@ public function secondaryHeaderIsDisabled(): bool { return $this->getSecondaryHeaderStatus() === false; } - - /** - * @param mixed $rows - * @return array - */ - public function getSecondaryHeaderTrAttributes($rows): array - { - return isset($this->secondaryHeaderTrAttributesCallback) ? call_user_func($this->secondaryHeaderTrAttributesCallback, $rows) : ['default' => true]; - } - - /** - * @param mixed $rows - * @return array - */ - public function getSecondaryHeaderTdAttributes(Column $column, $rows, int $index): array - { - return isset($this->secondaryHeaderTdAttributesCallback) ? call_user_func($this->secondaryHeaderTdAttributesCallback, $column, $rows, $index) : ['default' => true]; - } } diff --git a/src/Traits/Styling/Configuration/ActionsStylingConfiguration.php b/src/Traits/Styling/Configuration/ActionsStylingConfiguration.php new file mode 100644 index 000000000..51b3a3f99 --- /dev/null +++ b/src/Traits/Styling/Configuration/ActionsStylingConfiguration.php @@ -0,0 +1,13 @@ +actionWrapperAttributes = [...$this->actionWrapperAttributes, ...$actionWrapperAttributes]; + + return $this; + } +} diff --git a/src/Traits/Styling/Configuration/CollapsingColumnsStylingConfiguration.php b/src/Traits/Styling/Configuration/CollapsingColumnsStylingConfiguration.php new file mode 100644 index 000000000..9ab487907 --- /dev/null +++ b/src/Traits/Styling/Configuration/CollapsingColumnsStylingConfiguration.php @@ -0,0 +1,30 @@ + $collapsingColumnButtonCollapseAttributes + */ + public function setCollapsingColumnButtonCollapseAttributes(array $collapsingColumnButtonCollapseAttributes): self + { + $this->collapsingColumnButtonCollapseAttributes = [...['default-colors' => false, 'default-styling' => false], ...$collapsingColumnButtonCollapseAttributes]; + + return $this; + } + + /** + * Used to set attributes for the Collapsed Column Expand Button + * + * @param array $collapsingColumnButtonExpandAttributes + */ + public function setCollapsingColumnButtonExpandAttributes(array $collapsingColumnButtonExpandAttributes): self + { + $this->collapsingColumnButtonExpandAttributes = [...['default-colors' => false, 'default-styling' => false], ...$collapsingColumnButtonExpandAttributes]; + + return $this; + } +} diff --git a/src/Traits/Styling/Configuration/FooterStylingConfiguration.php b/src/Traits/Styling/Configuration/FooterStylingConfiguration.php new file mode 100644 index 000000000..cd1348520 --- /dev/null +++ b/src/Traits/Styling/Configuration/FooterStylingConfiguration.php @@ -0,0 +1,22 @@ +footerTrAttributesCallback = $callback; + + return $this; + } + + public function setFooterTdAttributes(Closure $callback): self + { + $this->footerTdAttributesCallback = $callback; + + return $this; + } +} diff --git a/src/Traits/Styling/Configuration/PaginationStylingConfiguration.php b/src/Traits/Styling/Configuration/PaginationStylingConfiguration.php new file mode 100644 index 000000000..20b3cb898 --- /dev/null +++ b/src/Traits/Styling/Configuration/PaginationStylingConfiguration.php @@ -0,0 +1,20 @@ +perPageFieldAttributes = [...$this->perPageFieldAttributes, ...$attributes]; + + return $this; + } + + public function setPaginationWrapperAttributes(array $paginationWrapperAttributes): self + { + $this->paginationWrapperAttributes = array_merge(['class' => ''], $paginationWrapperAttributes); + + return $this; + } +} diff --git a/src/Traits/Styling/Configuration/ReorderStylingConfiguration.php b/src/Traits/Styling/Configuration/ReorderStylingConfiguration.php new file mode 100644 index 000000000..893d249b4 --- /dev/null +++ b/src/Traits/Styling/Configuration/ReorderStylingConfiguration.php @@ -0,0 +1,16 @@ + for Reorder Column + */ + public function setReorderThAttributes(array $reorderThAttributes): self + { + $this->reorderThAttributes = [...$this->reorderThAttributes, ...$reorderThAttributes]; + + return $this; + } +} diff --git a/src/Traits/Styling/Configuration/SecondaryHeaderStylingConfiguration.php b/src/Traits/Styling/Configuration/SecondaryHeaderStylingConfiguration.php new file mode 100644 index 000000000..b01c1d008 --- /dev/null +++ b/src/Traits/Styling/Configuration/SecondaryHeaderStylingConfiguration.php @@ -0,0 +1,22 @@ +secondaryHeaderTrAttributesCallback = $callback; + + return $this; + } + + public function setSecondaryHeaderTdAttributes(Closure $callback): self + { + $this->secondaryHeaderTdAttributesCallback = $callback; + + return $this; + } +} diff --git a/src/Traits/Styling/HasActionsStyling.php b/src/Traits/Styling/HasActionsStyling.php new file mode 100644 index 000000000..9e32c1dac --- /dev/null +++ b/src/Traits/Styling/HasActionsStyling.php @@ -0,0 +1,14 @@ + '', 'default-styling' => true, 'default-colors' => true]; +} diff --git a/src/Traits/Styling/HasCollapsingColumnsStyling.php b/src/Traits/Styling/HasCollapsingColumnsStyling.php new file mode 100644 index 000000000..080130f78 --- /dev/null +++ b/src/Traits/Styling/HasCollapsingColumnsStyling.php @@ -0,0 +1,16 @@ + true, 'default-colors' => true]; + + protected array $collapsingColumnButtonExpandAttributes = ['default-styling' => true, 'default-colors' => true]; +} diff --git a/src/Traits/Styling/HasFooterStyling.php b/src/Traits/Styling/HasFooterStyling.php new file mode 100644 index 000000000..1ef3dc394 --- /dev/null +++ b/src/Traits/Styling/HasFooterStyling.php @@ -0,0 +1,17 @@ + true, 'default-colors' => true, 'class' => '']; + + protected array $paginationWrapperAttributes = ['class' => '']; +} diff --git a/src/Traits/Styling/HasReorderStyling.php b/src/Traits/Styling/HasReorderStyling.php new file mode 100644 index 000000000..cc946cd61 --- /dev/null +++ b/src/Traits/Styling/HasReorderStyling.php @@ -0,0 +1,14 @@ + true]; +} diff --git a/src/Traits/Styling/HasSecondaryHeaderStyling.php b/src/Traits/Styling/HasSecondaryHeaderStyling.php new file mode 100644 index 000000000..036084bbd --- /dev/null +++ b/src/Traits/Styling/HasSecondaryHeaderStyling.php @@ -0,0 +1,17 @@ + '', 'default-styling' => true, 'default-colors' => true], ...$this->actionWrapperAttributes]; + } +} diff --git a/src/Traits/Styling/Helpers/CollapsingColumnsStylingHelpers.php b/src/Traits/Styling/Helpers/CollapsingColumnsStylingHelpers.php new file mode 100644 index 000000000..416c79444 --- /dev/null +++ b/src/Traits/Styling/Helpers/CollapsingColumnsStylingHelpers.php @@ -0,0 +1,30 @@ + + */ + #[Computed] + public function getCollapsingColumnButtonCollapseAttributes(): array + { + return [...['default-styling' => true, 'default-colors' => true], ...$this->collapsingColumnButtonCollapseAttributes]; + } + + /** + * Retrieves attributes for the Collapsed Column Expand Button + * + * @return array + */ + #[Computed] + public function getCollapsingColumnButtonExpandAttributes(): array + { + return [...['default-styling' => true, 'default-colors' => true], ...$this->collapsingColumnButtonExpandAttributes]; + } +} diff --git a/src/Traits/Styling/Helpers/FooterStylingHelpers.php b/src/Traits/Styling/Helpers/FooterStylingHelpers.php new file mode 100644 index 000000000..8fc76e056 --- /dev/null +++ b/src/Traits/Styling/Helpers/FooterStylingHelpers.php @@ -0,0 +1,26 @@ + + */ + public function getFooterTrAttributes($rows): array + { + return isset($this->footerTrAttributesCallback) ? call_user_func($this->footerTrAttributesCallback, $rows) : ['default' => true]; + } + + /** + * @param mixed $rows + * @return array + */ + public function getFooterTdAttributes(Column $column, $rows, int $index): array + { + return isset($this->footerTdAttributesCallback) ? call_user_func($this->footerTdAttributesCallback, $column, $rows, $index) : ['default' => true]; + } +} diff --git a/src/Traits/Styling/Helpers/PaginationStylingHelpers.php b/src/Traits/Styling/Helpers/PaginationStylingHelpers.php new file mode 100644 index 000000000..064db4cdf --- /dev/null +++ b/src/Traits/Styling/Helpers/PaginationStylingHelpers.php @@ -0,0 +1,26 @@ +perPageFieldAttributes; + } + + public function getPaginationWrapperAttributes(): array + { + return $this->paginationWrapperAttributes ?? ['class' => '']; + } + + #[Computed] + public function getPaginationWrapperAttributesBag(): ComponentAttributeBag + { + return new ComponentAttributeBag($this->getPaginationWrapperAttributes()); + } +} diff --git a/src/Traits/Styling/Helpers/ReorderStylingHelpers.php b/src/Traits/Styling/Helpers/ReorderStylingHelpers.php new file mode 100644 index 000000000..2f6020d55 --- /dev/null +++ b/src/Traits/Styling/Helpers/ReorderStylingHelpers.php @@ -0,0 +1,25 @@ + for Bulk Actions + * + * @return array + */ + #[Computed] + public function getReorderThAttributes(): array + { + return $this->reorderThAttributes ?? ['default' => true]; + } + + #[Computed] + public function hasReorderThAttributes(): bool + { + return $this->getReorderThAttributes() != ['default' => true]; + } +} diff --git a/src/Traits/Styling/Helpers/SecondaryHeaderStylingHelpers.php b/src/Traits/Styling/Helpers/SecondaryHeaderStylingHelpers.php new file mode 100644 index 000000000..785acc107 --- /dev/null +++ b/src/Traits/Styling/Helpers/SecondaryHeaderStylingHelpers.php @@ -0,0 +1,26 @@ + + */ + public function getSecondaryHeaderTrAttributes($rows): array + { + return isset($this->secondaryHeaderTrAttributesCallback) ? call_user_func($this->secondaryHeaderTrAttributesCallback, $rows) : ['default' => true]; + } + + /** + * @param mixed $rows + * @return array + */ + public function getSecondaryHeaderTdAttributes(Column $column, $rows, int $index): array + { + return isset($this->secondaryHeaderTdAttributesCallback) ? call_user_func($this->secondaryHeaderTdAttributesCallback, $column, $rows, $index) : ['default' => true]; + } +} diff --git a/src/Traits/WithActions.php b/src/Traits/WithActions.php index b9531e755..d8bd5dea2 100644 --- a/src/Traits/WithActions.php +++ b/src/Traits/WithActions.php @@ -5,13 +5,13 @@ use Illuminate\Support\Collection; use Rappasoft\LaravelLivewireTables\Traits\Configuration\ActionsConfiguration; use Rappasoft\LaravelLivewireTables\Traits\Helpers\ActionsHelpers; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasActionsStyling; trait WithActions { use ActionsConfiguration, - ActionsHelpers; - - protected array $actionWrapperAttributes = ['class' => '', 'default-styling' => true, 'default-colors' => true]; + ActionsHelpers, + HasActionsStyling; protected bool $displayActionsInToolbar = false; diff --git a/src/Traits/WithCollapsingColumns.php b/src/Traits/WithCollapsingColumns.php index 60e454970..37fef32d1 100644 --- a/src/Traits/WithCollapsingColumns.php +++ b/src/Traits/WithCollapsingColumns.php @@ -4,15 +4,13 @@ use Rappasoft\LaravelLivewireTables\Traits\Configuration\CollapsingColumnConfiguration; use Rappasoft\LaravelLivewireTables\Traits\Helpers\CollapsingColumnHelpers; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasCollapsingColumnsStyling; trait WithCollapsingColumns { - use CollapsingColumnConfiguration; - use CollapsingColumnHelpers; + use CollapsingColumnConfiguration, + CollapsingColumnHelpers, + HasCollapsingColumnsStyling; protected bool $collapsingColumnsStatus = true; - - protected array $collapsingColumnButtonCollapseAttributes = ['default-styling' => true, 'default-colors' => true]; - - protected array $collapsingColumnButtonExpandAttributes = ['default-styling' => true, 'default-colors' => true]; } diff --git a/src/Traits/WithFooter.php b/src/Traits/WithFooter.php index 8f163dc93..44b9f7dc0 100644 --- a/src/Traits/WithFooter.php +++ b/src/Traits/WithFooter.php @@ -5,11 +5,13 @@ use Closure; use Rappasoft\LaravelLivewireTables\Traits\Configuration\FooterConfiguration; use Rappasoft\LaravelLivewireTables\Traits\Helpers\FooterHelpers; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasFooterStyling; trait WithFooter { use FooterConfiguration, - FooterHelpers; + FooterHelpers, + HasFooterStyling; protected bool $footerStatus = true; @@ -17,10 +19,6 @@ trait WithFooter protected bool $columnsWithFooter = false; - protected ?Closure $footerTrAttributesCallback; - - protected ?Closure $footerTdAttributesCallback; - public function setupFooter(): void { foreach ($this->getColumns() as $column) { diff --git a/src/Traits/WithPagination.php b/src/Traits/WithPagination.php index 70e9d508e..264e1d806 100644 --- a/src/Traits/WithPagination.php +++ b/src/Traits/WithPagination.php @@ -6,12 +6,14 @@ use Livewire\WithPagination as LivewirePagination; use Rappasoft\LaravelLivewireTables\Traits\Configuration\PaginationConfiguration; use Rappasoft\LaravelLivewireTables\Traits\Helpers\PaginationHelpers; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasPaginationStyling; trait WithPagination { use LivewirePagination, PaginationConfiguration, - PaginationHelpers; + PaginationHelpers, + HasPaginationStyling; public ?string $pageName = null; @@ -51,13 +53,8 @@ trait WithPagination protected bool $shouldShowPaginationDetails = true; - protected array $perPageFieldAttributes = ['default-styling' => true, 'default-colors' => true, 'class' => '']; - protected bool $shouldRetrieveTotalItemCount = true; - // Used In Frontend - protected array $paginationWrapperAttributes = ['class' => '']; - public function mountWithPagination(): void { $sessionPerPage = session()->get($this->getPerPagePaginationSessionKey(), $this->getPerPage()); diff --git a/src/Traits/WithReordering.php b/src/Traits/WithReordering.php index 006e7a715..49d36f78f 100644 --- a/src/Traits/WithReordering.php +++ b/src/Traits/WithReordering.php @@ -4,11 +4,13 @@ use Rappasoft\LaravelLivewireTables\Traits\Configuration\ReorderingConfiguration; use Rappasoft\LaravelLivewireTables\Traits\Helpers\ReorderingHelpers; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasReorderStyling; trait WithReordering { use ReorderingConfiguration, - ReorderingHelpers; + ReorderingHelpers, + HasReorderStyling; // Entangled in JS public bool $reorderStatus = false; @@ -31,8 +33,6 @@ trait WithReordering protected string $defaultReorderDirection = 'asc'; - protected array $reorderThAttributes = ['default' => true]; - public function setupReordering(): void { if ($this->reorderIsDisabled()) { diff --git a/src/Traits/WithSecondaryHeader.php b/src/Traits/WithSecondaryHeader.php index d3fe2f459..11b08d51a 100644 --- a/src/Traits/WithSecondaryHeader.php +++ b/src/Traits/WithSecondaryHeader.php @@ -2,23 +2,20 @@ namespace Rappasoft\LaravelLivewireTables\Traits; -use Closure; use Rappasoft\LaravelLivewireTables\Traits\Configuration\SecondaryHeaderConfiguration; use Rappasoft\LaravelLivewireTables\Traits\Helpers\SecondaryHeaderHelpers; +use Rappasoft\LaravelLivewireTables\Traits\Styling\HasSecondaryHeaderStyling; trait WithSecondaryHeader { use SecondaryHeaderConfiguration, - SecondaryHeaderHelpers; + SecondaryHeaderHelpers, + HasSecondaryHeaderStyling; protected bool $secondaryHeaderStatus = true; protected bool $columnsWithSecondaryHeader = false; - protected ?Closure $secondaryHeaderTrAttributesCallback; - - protected ?Closure $secondaryHeaderTdAttributesCallback; - public function bootedWithSecondaryHeader(): void { $this->setupSecondaryHeader();