-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bc6850
commit e53d95a
Showing
8 changed files
with
281 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,5 +163,4 @@ public function setShouldRetrieveTotalItemCountDisabled(): self | |
|
||
return $this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 41 additions & 43 deletions
84
src/Traits/Styling/Configuration/PaginationStylingConfiguration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,41 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration; | ||
|
||
trait PaginationStylingConfiguration | ||
{ | ||
public function setCustomPaginationBlade(string $customPaginationBlade): self | ||
{ | ||
$this->customPaginationBlade = $customPaginationBlade; | ||
|
||
return $this; | ||
} | ||
|
||
public function setPaginationTheme(string $theme): self | ||
{ | ||
$this->paginationTheme = $theme; | ||
|
||
return $this; | ||
} | ||
|
||
public function setPaginationWrapperAttributes(array $paginationWrapperAttributes = []): self | ||
{ | ||
$this->setCustomAttributes(propertyName: 'paginationWrapperAttributes', customAttributes: array_merge($this->getPaginationWrapperAttributes(), $paginationWrapperAttributes)); | ||
|
||
return $this; | ||
} | ||
|
||
public function setPerPageFieldAttributes(array $perPageFieldAttributes = []): self | ||
{ | ||
$this->setCustomAttributes(propertyName: 'perPageFieldAttributes', customAttributes: array_merge($this->getPerPageFieldAttributes(), $perPageFieldAttributes)); | ||
|
||
return $this; | ||
} | ||
|
||
public function setPerPageWrapperAttributes(array $perPageWrapperAttributes = []): self | ||
{ | ||
$this->setCustomAttributes(propertyName: 'perPageWrapperAttributes', customAttributes: array_merge($this->getPerPageWrapperAttributes(), $perPageWrapperAttributes)); | ||
|
||
return $this; | ||
} | ||
|
||
|
||
} | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration; | ||
|
||
trait PaginationStylingConfiguration | ||
{ | ||
public function setCustomPaginationBlade(string $customPaginationBlade): self | ||
{ | ||
$this->customPaginationBlade = $customPaginationBlade; | ||
|
||
return $this; | ||
} | ||
|
||
public function setPaginationTheme(string $theme): self | ||
{ | ||
$this->paginationTheme = $theme; | ||
|
||
return $this; | ||
} | ||
|
||
public function setPaginationWrapperAttributes(array $paginationWrapperAttributes = []): self | ||
{ | ||
$this->setCustomAttributes(propertyName: 'paginationWrapperAttributes', customAttributes: array_merge($this->getPaginationWrapperAttributes(), $paginationWrapperAttributes)); | ||
|
||
return $this; | ||
} | ||
|
||
public function setPerPageFieldAttributes(array $perPageFieldAttributes = []): self | ||
{ | ||
$this->setCustomAttributes(propertyName: 'perPageFieldAttributes', customAttributes: array_merge($this->getPerPageFieldAttributes(), $perPageFieldAttributes)); | ||
|
||
return $this; | ||
} | ||
|
||
public function setPerPageWrapperAttributes(array $perPageWrapperAttributes = []): self | ||
{ | ||
$this->setCustomAttributes(propertyName: 'perPageWrapperAttributes', customAttributes: array_merge($this->getPerPageWrapperAttributes(), $perPageWrapperAttributes)); | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling; | ||
|
||
use Livewire\Attributes\Locked; | ||
use Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration\PaginationStylingConfiguration; | ||
use Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers\PaginationStylingHelpers; | ||
|
||
trait HasPaginationStyling | ||
{ | ||
use PaginationStylingConfiguration, | ||
PaginationStylingHelpers; | ||
|
||
// Used In Frontend | ||
#[Locked] | ||
public string $paginationTheme = 'tailwind'; | ||
// Used In Frontend | ||
protected array $perPageFieldAttributes = ['class' => '', 'default-colors' => true, 'default-styling' => true]; | ||
// Used In Frontend | ||
protected array $perPageWrapperAttributes = ['class' => '', 'default-colors' => true, 'default-styling' => true]; | ||
|
||
// Used In Frontend | ||
protected array $paginationWrapperAttributes = ['class' => '']; | ||
// Used In Frontend | ||
protected ?string $customPaginationBlade; | ||
} | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling; | ||
|
||
use Livewire\Attributes\Locked; | ||
use Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration\PaginationStylingConfiguration; | ||
use Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers\PaginationStylingHelpers; | ||
|
||
trait HasPaginationStyling | ||
{ | ||
use PaginationStylingConfiguration, | ||
PaginationStylingHelpers; | ||
|
||
// Used In Frontend | ||
#[Locked] | ||
public string $paginationTheme = 'tailwind'; | ||
|
||
// Used In Frontend | ||
protected array $perPageFieldAttributes = ['class' => '', 'default-colors' => true, 'default-styling' => true]; | ||
|
||
// Used In Frontend | ||
protected array $perPageWrapperAttributes = ['class' => '', 'default-colors' => true, 'default-styling' => true]; | ||
|
||
// Used In Frontend | ||
protected array $paginationWrapperAttributes = ['class' => '']; | ||
|
||
// Used In Frontend | ||
protected ?string $customPaginationBlade; | ||
} |
132 changes: 65 additions & 67 deletions
132
src/Traits/Styling/Helpers/PaginationStylingHelpers.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,65 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers; | ||
|
||
use Livewire\Attributes\Computed; | ||
use Illuminate\View\ComponentAttributeBag; | ||
|
||
trait PaginationStylingHelpers | ||
{ | ||
#[Computed] | ||
public function getPaginationTheme(): string | ||
{ | ||
return $this->paginationTheme; | ||
} | ||
|
||
#[Computed] | ||
public function getPaginationWrapperAttributes(): array | ||
{ | ||
return $this->getCustomAttributes(propertyName: 'paginationWrapperAttributes', default: false, classicMode: true); | ||
} | ||
|
||
#[Computed] | ||
public function getPaginationWrapperAttributesBag(): ComponentAttributeBag | ||
{ | ||
return $this->getCustomAttributesBagFromArray($this->getPaginationWrapperAttributes()); | ||
} | ||
|
||
|
||
#[Computed] | ||
public function getPerPageFieldAttributes(): array | ||
{ | ||
return $this->getCustomAttributes(propertyName: 'perPageFieldAttributes', default: false, classicMode: false); | ||
|
||
} | ||
|
||
#[Computed] | ||
public function getPerPageFieldAttributesBag(): ComponentAttributeBag | ||
{ | ||
return new ComponentAttributeBag($this->getPerPageFieldAttributes()); | ||
} | ||
|
||
#[Computed] | ||
public function getPerPageWrapperAttributes(): array | ||
{ | ||
return $this->getCustomAttributes(propertyName: 'perPageWrapperAttributes', default: false, classicMode: false); | ||
|
||
} | ||
|
||
#[Computed] | ||
public function getPerPageWrapperAttributesBag(): ComponentAttributeBag | ||
{ | ||
return new ComponentAttributeBag($this->getPerPageWrapperAttributes()); | ||
} | ||
|
||
#[Computed] | ||
public function hasCustomPaginationBlade(): bool | ||
{ | ||
return (isset($this->customPaginationBlade) && $this->customPaginationBlade !== null); | ||
} | ||
|
||
#[Computed] | ||
public function getCustomPaginationBlade(): string | ||
{ | ||
return $this->customPaginationBlade ?? ''; | ||
} | ||
|
||
} | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers; | ||
|
||
use Illuminate\View\ComponentAttributeBag; | ||
use Livewire\Attributes\Computed; | ||
|
||
trait PaginationStylingHelpers | ||
{ | ||
#[Computed] | ||
public function getPaginationTheme(): string | ||
{ | ||
return $this->paginationTheme; | ||
} | ||
|
||
#[Computed] | ||
public function getPaginationWrapperAttributes(): array | ||
{ | ||
return $this->getCustomAttributes(propertyName: 'paginationWrapperAttributes', default: false, classicMode: true); | ||
} | ||
|
||
#[Computed] | ||
public function getPaginationWrapperAttributesBag(): ComponentAttributeBag | ||
{ | ||
return $this->getCustomAttributesBagFromArray($this->getPaginationWrapperAttributes()); | ||
} | ||
|
||
#[Computed] | ||
public function getPerPageFieldAttributes(): array | ||
{ | ||
return $this->getCustomAttributes(propertyName: 'perPageFieldAttributes', default: false, classicMode: false); | ||
|
||
} | ||
|
||
#[Computed] | ||
public function getPerPageFieldAttributesBag(): ComponentAttributeBag | ||
{ | ||
return new ComponentAttributeBag($this->getPerPageFieldAttributes()); | ||
} | ||
|
||
#[Computed] | ||
public function getPerPageWrapperAttributes(): array | ||
{ | ||
return $this->getCustomAttributes(propertyName: 'perPageWrapperAttributes', default: false, classicMode: false); | ||
|
||
} | ||
|
||
#[Computed] | ||
public function getPerPageWrapperAttributesBag(): ComponentAttributeBag | ||
{ | ||
return new ComponentAttributeBag($this->getPerPageWrapperAttributes()); | ||
} | ||
|
||
#[Computed] | ||
public function hasCustomPaginationBlade(): bool | ||
{ | ||
return isset($this->customPaginationBlade) && $this->customPaginationBlade !== null; | ||
} | ||
|
||
#[Computed] | ||
public function getCustomPaginationBlade(): string | ||
{ | ||
return $this->customPaginationBlade ?? ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.