Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe authored and github-actions[bot] committed Oct 1, 2024
1 parent 6bc6850 commit e53d95a
Show file tree
Hide file tree
Showing 8 changed files with 281 additions and 298 deletions.
1 change: 0 additions & 1 deletion src/Traits/Configuration/PaginationConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,4 @@ public function setShouldRetrieveTotalItemCountDisabled(): self

return $this;
}

}
3 changes: 0 additions & 3 deletions src/Traits/Helpers/PaginationHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,9 @@ private function getPerPagePaginationSessionKey(): string
return $this->tableName.'-perPage';
}


#[Computed]
public function getShouldRetrieveTotalItemCount(): bool
{
return $this->shouldRetrieveTotalItemCount;
}


}
84 changes: 41 additions & 43 deletions src/Traits/Styling/Configuration/PaginationStylingConfiguration.php
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;
}
}
58 changes: 29 additions & 29 deletions src/Traits/Styling/HasPaginationStyling.php
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 src/Traits/Styling/Helpers/PaginationStylingHelpers.php
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 ?? '';
}
}
1 change: 0 additions & 1 deletion src/Traits/WithPagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ trait WithPagination

protected bool $shouldRetrieveTotalItemCount = true;


public function mountWithPagination(): void
{
$sessionPerPage = session()->get($this->getPerPagePaginationSessionKey(), $this->getPerPageAccepted()[0] ?? 10);
Expand Down
2 changes: 0 additions & 2 deletions tests/Traits/Helpers/PaginationHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public function test_can_disable_detailed_pagination(): void

}


public function test_can_toggle_total_item_count_retrieval(): void
{

Expand Down Expand Up @@ -150,5 +149,4 @@ public function test_can_toggle_total_item_count_retrieval_via_status(): void
$this->assertTrue($this->basicTable->getShouldRetrieveTotalItemCount());

}

}
Loading

0 comments on commit e53d95a

Please sign in to comment.