diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f8fe64b6..553622c32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## [v3.4.22] - 2024-09-29 +### Bug Fixes +- Fix Loading Placeholder Bug - Breaking Table by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1969 + +### New Features +- Add setPaginationWrapperAttributes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1978 +- Add configurable areas - before-wrapper and after-wrapper by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1977 +- Add ToolsAttributes and ToolbarAttributes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1982 + +### Docs +- Add getTitle reference for setTdAttributes/setTrAttributes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1976 +- Add setToolsAttributes and setToolBarAttributes docs by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1984 +- Add docs for the ColumnSelect lifecycle hooks by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1983 + ## [v3.4.21] - 2024-09-25 ### Bug Fixes - Remove persist from getFilterGenericData by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1966 diff --git a/docs/columns/styling.md b/docs/columns/styling.md index f7db2a4bd..7862c9566 100644 --- a/docs/columns/styling.md +++ b/docs/columns/styling.md @@ -45,6 +45,11 @@ Below is a copy of the relevant sections from [datatable styling](../datatable/s Set a list of attributes to override on the th elements. +If your Column does not have a field (e.g. a label column), then you may use the following, which will utilise the first parameter in Column::make() +```php + $column->getTitle() +``` + ```php public function configure(): void { @@ -204,6 +209,11 @@ public function configure(): void Set a list of attributes to override on the td elements. For example, changing the background color between red/green based on whether the "total" field is over or under 1000. +If your Column does not have a field (e.g. a label column), then you may use the following, which will utilise the first parameter in Column::make() +```php + $column->getTitle() +``` + ```php public function configure(): void { diff --git a/docs/datatable/configurable-areas.md b/docs/datatable/configurable-areas.md index bb9d78a5b..4661be63b 100644 --- a/docs/datatable/configurable-areas.md +++ b/docs/datatable/configurable-areas.md @@ -26,6 +26,7 @@ You can use the `setConfigurableAreas` method to set multiple areas that you wan public function configure(): void { $this->setConfigurableAreas([ + 'before-wrapper' => 'path.to.my.view', 'before-tools' => 'path.to.my.view', 'toolbar-left-start' => 'path.to.my.view', 'toolbar-left-end' => 'path.to.my.view', @@ -35,6 +36,7 @@ public function configure(): void 'after-toolbar' => 'path.to.my.view', 'before-pagination' => 'path.to.my.view', 'after-pagination' => 'path.to.my.view', + 'after-wrapper' => 'path.to.my.view', ]); } ``` diff --git a/docs/datatable/styling.md b/docs/datatable/styling.md index b460371bf..9353ad00e 100644 --- a/docs/datatable/styling.md +++ b/docs/datatable/styling.md @@ -150,6 +150,11 @@ public function configure(): void Set a list of attributes to override on the th elements. +If your Column does not have a field (e.g. a label column), then you may use the following, which will utilise the first parameter in Column::make() +```php + $column->getTitle() +``` + ```php public function configure(): void { @@ -311,6 +316,11 @@ public function configure(): void Set a list of attributes to override on the td elements +If your Column does not have a field (e.g. a label column), then you may use the following, which will utilise the first parameter in Column::make() +```php + $column->getTitle() +``` + ```php public function configure(): void { diff --git a/docs/misc/lifecycle-hooks.md b/docs/misc/lifecycle-hooks.md index 1e05569a9..f56ce1f9a 100644 --- a/docs/misc/lifecycle-hooks.md +++ b/docs/misc/lifecycle-hooks.md @@ -19,6 +19,12 @@ This is called prior to setting up the available Columns via the columns() metho ## columnsSet This is called immediately after the Columns are set up +## configuringColumnSelect +This is called immediately prior to setting up Column Select + +## configuredColumnSelect +This is called immediately after setting up Column Select + ## rowsRetrieved This is called immediately after the query is executed, and is passed the result from the executed query. diff --git a/docs/misc/tools.md b/docs/misc/tools.md index 7904caa0c..0d9dbc390 100644 --- a/docs/misc/tools.md +++ b/docs/misc/tools.md @@ -56,4 +56,28 @@ Disables the Toolbar, which contains the Reorder, Filters, Search, Column Select { $this->setToolBarDisabled(); } -``` \ No newline at end of file +``` + +### setToolsAttributes +Allows setting of attributes for the parent element in the tools blade + +By default, this replaces the default classes on the tools blade, if you would like to keep them, set the default-colors/default-styling flags to true as appropriate + +```php + public function configure(): void + { + $this->setToolsAttributes(['class' => ' bg-green-500', 'default-colors' => false, 'default-styling' => true]); + } +``` + +### setToolBarAttributes +Allows setting of attributes for the parent element in the toolbar blade. + +By default, this replaces the default classes on the toolbar blade, if you would like to keep them, set the default-colors/default-styling flags to true as appropriate + +```php + public function configure(): void + { + $this->setToolBarAttributes(['class' => ' bg-red-500', 'default-colors' => false, 'default-styling' => true]); + } +``` diff --git a/docs/pagination/available-methods.md b/docs/pagination/available-methods.md index 638e58a4b..eae078132 100644 --- a/docs/pagination/available-methods.md +++ b/docs/pagination/available-methods.md @@ -296,3 +296,14 @@ public function configure(): void $this->setShouldRetrieveTotalItemCountDisabled(); } ``` + +## setPaginationWrapperAttributes + +Used to set attributes for the "div" that wraps the pagination section + +```php +public function configure(): void +{ + $this->setPaginationWrapperAttributes(['class' => 'text-lg']); +} +``` diff --git a/resources/views/components/includes/loading.blade.php b/resources/views/components/includes/loading.blade.php index c07d9cb19..f22096321 100644 --- a/resources/views/components/includes/loading.blade.php +++ b/resources/views/components/includes/loading.blade.php @@ -9,15 +9,15 @@ @include($this->getLoadingPlaceHolderBlade(), ['colCount' => $colCount]) @else - merge($customAttributes['loader-wrapper']) - ->class(['w-full text-center h-screen place-items-center align-middle' => $isTailwind && ($customAttributes['loader-wrapper']['default'] ?? true)]) - ->class(['w-100 text-center h-100 align-items-center' => $isBootstrap && ($customAttributes['loader-wrapper']['default'] ?? true)]); + ->class(['hidden w-full text-center h-screen place-items-center align-middle' => $isTailwind && ($customAttributes['loader-wrapper']['default'] ?? true)]) + ->class(['d-none w-100 text-center h-100 align-items-center' => $isBootstrap && ($customAttributes['loader-wrapper']['default'] ?? true)]); }} wire:loading.class.remove="hidden d-none" > - +
hasConfigurableAreaFor('before-pagination')) - @include($this->getConfigurableAreaFor('before-pagination'), $this->getParametersForConfigurableArea('before-pagination')) -@endif +@includeWhen( + $this->hasConfigurableAreaFor('before-pagination'), + $this->getConfigurableAreaFor('before-pagination'), + $this->getParametersForConfigurableArea('before-pagination') +) @if ($this->isTailwind) -
+
getPaginationWrapperAttributesBag() }}> @if ($this->paginationVisibilityIsEnabled())
@@ -47,7 +49,7 @@ @endif
@elseif ($this->isBootstrap4) -
+
getPaginationWrapperAttributesBag() }}> @if ($this->paginationVisibilityIsEnabled()) @if ($this->paginationIsEnabled() && $this->isPaginationMethod('standard') && $this->getRows->lastPage() > 1)
@@ -100,7 +102,7 @@ @endif
@elseif ($this->isBootstrap5) -
+
getPaginationWrapperAttributesBag() }} > @if ($this->paginationVisibilityIsEnabled()) @if ($this->paginationIsEnabled() && $this->isPaginationMethod('standard') && $this->getRows->lastPage() > 1)
@@ -152,6 +154,8 @@
@endif -@if ($this->hasConfigurableAreaFor('after-pagination')) - @include($this->getConfigurableAreaFor('after-pagination'), $this->getParametersForConfigurableArea('after-pagination')) -@endif \ No newline at end of file +@includeWhen( + $this->hasConfigurableAreaFor('after-pagination'), + $this->getConfigurableAreaFor('after-pagination'), + $this->getParametersForConfigurableArea('after-pagination') +) diff --git a/resources/views/components/table/th.blade.php b/resources/views/components/table/th.blade.php index b12366dc7..3afee536c 100644 --- a/resources/views/components/table/th.blade.php +++ b/resources/views/components/table/th.blade.php @@ -20,8 +20,8 @@ @if ($isTailwind) merge($customThAttributes) - ->class(['text-gray-500 dark:bg-gray-800 dark:text-gray-400' => ($customThAttributes['default-colors'] ?? true || $customThAttributes['default'] ?? true)]) - ->class(['px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => ($customThAttributes['default-styling'] ?? true || $customThAttributes['default'] ?? true)]) + ->class(['text-gray-500 dark:bg-gray-800 dark:text-gray-400' => (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true))]) + ->class(['px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true))]) ->class(['hidden' => $column->shouldCollapseAlways()]) ->class(['hidden md:table-cell' => $column->shouldCollapseOnMobile()]) ->class(['hidden lg:table-cell' => $column->shouldCollapseOnTablet()]) @@ -35,8 +35,8 @@