diff --git a/src/Traits/Configuration/ActionsConfiguration.php b/src/Traits/Configuration/ActionsConfiguration.php index 89b5e08b6..31cd4f13e 100644 --- a/src/Traits/Configuration/ActionsConfiguration.php +++ b/src/Traits/Configuration/ActionsConfiguration.php @@ -4,12 +4,7 @@ trait ActionsConfiguration { - public function setActionWrapperAttributes(array $actionWrapperAttributes): self - { - $this->actionWrapperAttributes = [...$this->actionWrapperAttributes, ...$actionWrapperAttributes]; - return $this; - } public function setActionsInToolbar(bool $status): self { diff --git a/src/Traits/Configuration/CollapsingColumnConfiguration.php b/src/Traits/Configuration/CollapsingColumnConfiguration.php index d39e648a5..815209017 100644 --- a/src/Traits/Configuration/CollapsingColumnConfiguration.php +++ b/src/Traits/Configuration/CollapsingColumnConfiguration.php @@ -25,27 +25,5 @@ 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..39a10ea60 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; @@ -183,10 +176,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..1c1b3ed46 100644 --- a/src/Traits/Configuration/ReorderingConfiguration.php +++ b/src/Traits/Configuration/ReorderingConfiguration.php @@ -82,13 +82,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..7fc22ec70 100644 --- a/src/Traits/Helpers/ActionsHelpers.php +++ b/src/Traits/Helpers/ActionsHelpers.php @@ -20,11 +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..9b825deb0 100644 --- a/src/Traits/Helpers/FooterHelpers.php +++ b/src/Traits/Helpers/FooterHelpers.php @@ -41,21 +41,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..343a8d308 100644 --- a/src/Traits/Helpers/PaginationHelpers.php +++ b/src/Traits/Helpers/PaginationHelpers.php @@ -152,26 +152,10 @@ 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..3e18d60f1 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 @@ -26,21 +24,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..042e0c17b --- /dev/null +++ b/src/Traits/Styling/Configuration/ActionsStylingConfiguration.php @@ -0,0 +1,13 @@ +actionWrapperAttributes = [...$this->actionWrapperAttributes, ...$actionWrapperAttributes]; + + return $this; + } +} \ No newline at end of file diff --git a/src/Traits/Styling/Configuration/CollapsingColumnsStylingConfiguration.php b/src/Traits/Styling/Configuration/CollapsingColumnsStylingConfiguration.php new file mode 100644 index 000000000..d78a413ed --- /dev/null +++ b/src/Traits/Styling/Configuration/CollapsingColumnsStylingConfiguration.php @@ -0,0 +1,31 @@ + $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; + } + +} \ No newline at end of file diff --git a/src/Traits/Styling/Configuration/FooterStylingConfiguration.php b/src/Traits/Styling/Configuration/FooterStylingConfiguration.php new file mode 100644 index 000000000..640e8891c --- /dev/null +++ b/src/Traits/Styling/Configuration/FooterStylingConfiguration.php @@ -0,0 +1,23 @@ +footerTrAttributesCallback = $callback; + + return $this; + } + + public function setFooterTdAttributes(Closure $callback): self + { + $this->footerTdAttributesCallback = $callback; + + return $this; + } + +} \ No newline at end of file diff --git a/src/Traits/Styling/Configuration/PaginationStylingConfiguration.php b/src/Traits/Styling/Configuration/PaginationStylingConfiguration.php new file mode 100644 index 000000000..73a25aa2e --- /dev/null +++ b/src/Traits/Styling/Configuration/PaginationStylingConfiguration.php @@ -0,0 +1,21 @@ +perPageFieldAttributes = [...$this->perPageFieldAttributes, ...$attributes]; + + return $this; + } + + public function setPaginationWrapperAttributes(array $paginationWrapperAttributes): self + { + $this->paginationWrapperAttributes = array_merge(['class' => ''], $paginationWrapperAttributes); + + return $this; + } +} \ No newline at end of file diff --git a/src/Traits/Styling/Configuration/ReorderStylingConfiguration.php b/src/Traits/Styling/Configuration/ReorderStylingConfiguration.php new file mode 100644 index 000000000..a705eeb74 --- /dev/null +++ b/src/Traits/Styling/Configuration/ReorderStylingConfiguration.php @@ -0,0 +1,18 @@ + for Reorder Column + */ + public function setReorderThAttributes(array $reorderThAttributes): self + { + $this->reorderThAttributes = [...$this->reorderThAttributes, ...$reorderThAttributes]; + + return $this; + } + +} \ No newline at end of file diff --git a/src/Traits/Styling/Configuration/SecondaryHeaderStylingConfiguration.php b/src/Traits/Styling/Configuration/SecondaryHeaderStylingConfiguration.php new file mode 100644 index 000000000..0b0c3dde3 --- /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; + } +} \ No newline at end of file diff --git a/src/Traits/Styling/HasActionsStyling.php b/src/Traits/Styling/HasActionsStyling.php new file mode 100644 index 000000000..57d6a691f --- /dev/null +++ b/src/Traits/Styling/HasActionsStyling.php @@ -0,0 +1,15 @@ + '', 'default-styling' => true, 'default-colors' => true]; + +} \ No newline at end of file diff --git a/src/Traits/Styling/HasCollapsingColumnsStyling.php b/src/Traits/Styling/HasCollapsingColumnsStyling.php new file mode 100644 index 000000000..261ff3ddf --- /dev/null +++ b/src/Traits/Styling/HasCollapsingColumnsStyling.php @@ -0,0 +1,17 @@ + true, 'default-colors' => true]; + + protected array $collapsingColumnButtonExpandAttributes = ['default-styling' => true, 'default-colors' => true]; + +} \ No newline at end of file diff --git a/src/Traits/Styling/HasFooterStyling.php b/src/Traits/Styling/HasFooterStyling.php new file mode 100644 index 000000000..9d829919c --- /dev/null +++ b/src/Traits/Styling/HasFooterStyling.php @@ -0,0 +1,18 @@ + true, 'default-colors' => true, 'class' => '']; + + protected array $paginationWrapperAttributes = ['class' => '']; +} \ No newline at end of file diff --git a/src/Traits/Styling/HasReorderStyling.php b/src/Traits/Styling/HasReorderStyling.php new file mode 100644 index 000000000..ad6f168a2 --- /dev/null +++ b/src/Traits/Styling/HasReorderStyling.php @@ -0,0 +1,15 @@ + true]; + +} \ No newline at end of file diff --git a/src/Traits/Styling/HasSecondaryHeaderStyling.php b/src/Traits/Styling/HasSecondaryHeaderStyling.php new file mode 100644 index 000000000..06cc43c44 --- /dev/null +++ b/src/Traits/Styling/HasSecondaryHeaderStyling.php @@ -0,0 +1,18 @@ + '', 'default-styling' => true, 'default-colors' => true], ...$this->actionWrapperAttributes]; + } + + +} \ No newline at end of file diff --git a/src/Traits/Styling/Helpers/CollapsingColumnsStylingHelpers.php b/src/Traits/Styling/Helpers/CollapsingColumnsStylingHelpers.php new file mode 100644 index 000000000..70e7a757d --- /dev/null +++ b/src/Traits/Styling/Helpers/CollapsingColumnsStylingHelpers.php @@ -0,0 +1,32 @@ + + */ + #[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]; + } + + +} \ No newline at end of file diff --git a/src/Traits/Styling/Helpers/FooterStylingHelpers.php b/src/Traits/Styling/Helpers/FooterStylingHelpers.php new file mode 100644 index 000000000..fe8ba78fe --- /dev/null +++ b/src/Traits/Styling/Helpers/FooterStylingHelpers.php @@ -0,0 +1,27 @@ + + */ + 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]; + } + +} \ No newline at end of file diff --git a/src/Traits/Styling/Helpers/PaginationStylingHelpers.php b/src/Traits/Styling/Helpers/PaginationStylingHelpers.php new file mode 100644 index 000000000..ee112d9ca --- /dev/null +++ b/src/Traits/Styling/Helpers/PaginationStylingHelpers.php @@ -0,0 +1,27 @@ +perPageFieldAttributes; + } + + public function getPaginationWrapperAttributes(): array + { + return $this->paginationWrapperAttributes ?? ['class' => '']; + } + + #[Computed] + public function getPaginationWrapperAttributesBag(): ComponentAttributeBag + { + return new ComponentAttributeBag($this->getPaginationWrapperAttributes()); + } + +} \ No newline at end of file diff --git a/src/Traits/Styling/Helpers/ReorderStylingHelpers.php b/src/Traits/Styling/Helpers/ReorderStylingHelpers.php new file mode 100644 index 000000000..d7d2592a4 --- /dev/null +++ b/src/Traits/Styling/Helpers/ReorderStylingHelpers.php @@ -0,0 +1,27 @@ + 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]; + } + +} \ No newline at end of file diff --git a/src/Traits/Styling/Helpers/SecondaryHeaderStylingHelpers.php b/src/Traits/Styling/Helpers/SecondaryHeaderStylingHelpers.php new file mode 100644 index 000000000..5ed24a6fd --- /dev/null +++ b/src/Traits/Styling/Helpers/SecondaryHeaderStylingHelpers.php @@ -0,0 +1,27 @@ + + */ + 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]; + } + +} \ No newline at end of file diff --git a/src/Traits/WithActions.php b/src/Traits/WithActions.php index b9531e755..153581f19 100644 --- a/src/Traits/WithActions.php +++ b/src/Traits/WithActions.php @@ -5,14 +5,14 @@ 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; protected string $actionsPosition = 'right'; 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..1d4b40f16 100644 --- a/src/Traits/WithSecondaryHeader.php +++ b/src/Traits/WithSecondaryHeader.php @@ -2,22 +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 {