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/src/Traits/Configuration/PaginationConfiguration.php b/src/Traits/Configuration/PaginationConfiguration.php
index a8877653a..35c618e0c 100644
--- a/src/Traits/Configuration/PaginationConfiguration.php
+++ b/src/Traits/Configuration/PaginationConfiguration.php
@@ -177,4 +177,11 @@ 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/Helpers/PaginationHelpers.php b/src/Traits/Helpers/PaginationHelpers.php
index 717af7c12..9654b3a72 100644
--- a/src/Traits/Helpers/PaginationHelpers.php
+++ b/src/Traits/Helpers/PaginationHelpers.php
@@ -2,6 +2,7 @@
namespace Rappasoft\LaravelLivewireTables\Traits\Helpers;
+use Illuminate\View\ComponentAttributeBag;
use Livewire\Attributes\Computed;
trait PaginationHelpers
@@ -155,4 +156,15 @@ 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/WithPagination.php b/src/Traits/WithPagination.php
index c8c56a3c9..8e6a44aa0 100644
--- a/src/Traits/WithPagination.php
+++ b/src/Traits/WithPagination.php
@@ -52,6 +52,9 @@ trait WithPagination
protected bool $shouldRetrieveTotalItemCount = true;
+ // Used In Frontend
+ protected array $paginationWrapperAttributes = ['class' => ''];
+
public function mountWithPagination(): void
{
$sessionPerPage = session()->get($this->getPerPagePaginationSessionKey(), $this->getPerPageAccepted()[0] ?? 10);
diff --git a/tests/Traits/Helpers/PaginationHelpersTest.php b/tests/Traits/Helpers/PaginationHelpersTest.php
index d3744c326..067c0e208 100644
--- a/tests/Traits/Helpers/PaginationHelpersTest.php
+++ b/tests/Traits/Helpers/PaginationHelpersTest.php
@@ -173,4 +173,33 @@ public function test_can_toggle_total_item_count_retrieval_via_status(): void
$this->assertTrue($this->basicTable->getShouldRetrieveTotalItemCount());
}
+
+ public function test_can_get_pagination_wrapper_attributes(): void
+ {
+
+ $this->assertSame(['class' => ''], $this->basicTable->getPaginationWrapperAttributes());
+
+ $this->basicTable->setPaginationWrapperAttributes(['class' => 'text-lg']);
+
+ $this->assertSame(['class' => 'text-lg'], $this->basicTable->getPaginationWrapperAttributes());
+
+ $this->basicTable->setPaginationWrapperAttributes(['class' => 'text-lg', 'testval' => '456']);
+
+ $this->assertSame(['class' => 'text-lg', 'testval' => '456'], $this->basicTable->getPaginationWrapperAttributes());
+
+ }
+
+ public function test_can_get_pagination_wrapper_attributes_bag(): void
+ {
+ $this->assertSame((new \Illuminate\View\ComponentAttributeBag(['class' => '']))->getAttributes(), $this->basicTable->getPaginationWrapperAttributesBag()->getAttributes());
+
+ $this->basicTable->setPaginationWrapperAttributes(['class' => 'text-lg']);
+
+ $this->assertSame((new \Illuminate\View\ComponentAttributeBag(['class' => 'text-lg']))->getAttributes(), $this->basicTable->getPaginationWrapperAttributesBag()->getAttributes());
+
+ $this->basicTable->setPaginationWrapperAttributes(['class' => 'text-lg', 'testval' => '123']);
+
+ $this->assertSame((new \Illuminate\View\ComponentAttributeBag(['class' => 'text-lg', 'testval' => '123']))->getAttributes(), $this->basicTable->getPaginationWrapperAttributesBag()->getAttributes());
+
+ }
}