From 365928364d83301cd356b79c0d614500e4adfc7a Mon Sep 17 00:00:00 2001 From: lrljoe Date: Sun, 27 Oct 2024 03:39:32 +0000 Subject: [PATCH] Fix styling --- .../QueryStrings/HasQueryStringForSort.php | 153 +++++++++--------- src/Traits/WithSorting.php | 5 +- 2 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/Traits/Core/QueryStrings/HasQueryStringForSort.php b/src/Traits/Core/QueryStrings/HasQueryStringForSort.php index 06597f80c..9bb544f44 100644 --- a/src/Traits/Core/QueryStrings/HasQueryStringForSort.php +++ b/src/Traits/Core/QueryStrings/HasQueryStringForSort.php @@ -1,76 +1,77 @@ -queryStringForSortEnabled() && $this->sortingIsEnabled()) ? ['sorts' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForSort()]] : []; - - } - public function setupQueryStringStatusForSort(): void - { - if (! $this->hasQueryStringStatusForSort()) { - $this->setQueryStringForSortEnabled(); - } - } - - public function hasQueryStringStatusForSort(): bool - { - return isset($this->queryStringStatusForSort); - } - - public function getQueryStringStatusForSort(): bool - { - return $this->queryStringStatusForSort ?? true; - } - - public function queryStringForSortEnabled(): bool - { - $this->setupQueryStringStatusForSort(); - - return $this->getQueryStringStatusForSort() && $this->sortingIsEnabled(); - } - - public function setQueryStringStatusForSort(bool $status): self - { - $this->queryStringStatusForSort = $status; - - return $this; - } - - public function setQueryStringForSortEnabled(): self - { - return $this->setQueryStringStatusForSort(true); - } - - public function setQueryStringForSortDisabled(): self - { - return $this->setQueryStringStatusForSort(false); - } - - public function hasQueryStringAliasForSort(): bool - { - return isset($this->queryStringAliasForSort); - } - - public function getQueryStringAliasForSort(): string - { - return $this->queryStringAliasForSort ?? $this->getQueryStringAlias().'-sorts'; - } - - public function setQueryStringAliasForSort(string $alias): self - { - $this->queryStringAliasForSort = $alias; - - return $this; - } -} +queryStringForSortEnabled() && $this->sortingIsEnabled()) ? ['sorts' => ['except' => null, 'history' => false, 'keep' => false, 'as' => $this->getQueryStringAliasForSort()]] : []; + + } + + public function setupQueryStringStatusForSort(): void + { + if (! $this->hasQueryStringStatusForSort()) { + $this->setQueryStringForSortEnabled(); + } + } + + public function hasQueryStringStatusForSort(): bool + { + return isset($this->queryStringStatusForSort); + } + + public function getQueryStringStatusForSort(): bool + { + return $this->queryStringStatusForSort ?? true; + } + + public function queryStringForSortEnabled(): bool + { + $this->setupQueryStringStatusForSort(); + + return $this->getQueryStringStatusForSort() && $this->sortingIsEnabled(); + } + + public function setQueryStringStatusForSort(bool $status): self + { + $this->queryStringStatusForSort = $status; + + return $this; + } + + public function setQueryStringForSortEnabled(): self + { + return $this->setQueryStringStatusForSort(true); + } + + public function setQueryStringForSortDisabled(): self + { + return $this->setQueryStringStatusForSort(false); + } + + public function hasQueryStringAliasForSort(): bool + { + return isset($this->queryStringAliasForSort); + } + + public function getQueryStringAliasForSort(): string + { + return $this->queryStringAliasForSort ?? $this->getQueryStringAlias().'-sorts'; + } + + public function setQueryStringAliasForSort(string $alias): self + { + $this->queryStringAliasForSort = $alias; + + return $this; + } +} diff --git a/src/Traits/WithSorting.php b/src/Traits/WithSorting.php index d9bc7bb48..1ed30366e 100644 --- a/src/Traits/WithSorting.php +++ b/src/Traits/WithSorting.php @@ -6,15 +6,15 @@ use Illuminate\Support\Collection; use Livewire\Attributes\Locked; use Rappasoft\LaravelLivewireTables\Traits\Configuration\SortingConfiguration; -use Rappasoft\LaravelLivewireTables\Traits\Helpers\SortingHelpers; use Rappasoft\LaravelLivewireTables\Traits\Core\QueryStrings\HasQueryStringForSort; +use Rappasoft\LaravelLivewireTables\Traits\Helpers\SortingHelpers; trait WithSorting { use SortingConfiguration, SortingHelpers; use HasQueryStringForSort; - + public array $sorts = []; public Collection $sortableColumns; @@ -33,7 +33,6 @@ trait WithSorting public string $defaultSortingLabelDesc = 'Z-A'; - public function sortBy(string $columnSelectName): ?string {