Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development to Master for 3.6.0 #2174

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
01b6824
Add Tests
lrljoe Dec 16, 2024
d235860
Add Missing Test
lrljoe Dec 16, 2024
1e5d809
Add label fixes
lrljoe Dec 16, 2024
1f889cb
Fix styling
lrljoe Dec 16, 2024
493959c
Merge pull request #2130 from LowerRockLabs/AddIsSortableTestTweak
lrljoe Dec 16, 2024
4bb6b3d
Add Custom FIlter Input Attributes, Cleanup Filter Tests (#2131)
lrljoe Dec 24, 2024
ab35e6c
Enable InputAttributes for SelectFilter (#2133)
lrljoe Dec 24, 2024
eda4c5e
Tidy ComponentUtilities, Migrate ColumnSelectQueryString (#2135)
lrljoe Dec 26, 2024
c67247b
TH Fixes - Clean-up, efficiency, and Sort Icons fixes (#2140)
lrljoe Dec 31, 2024
1d991b2
Ensure Default Sorting Is Shown in Pills (#2138)
lrljoe Dec 31, 2024
660c061
Add hasCollapsedColumns as Computed (#2141)
lrljoe Dec 31, 2024
fe3abd6
Separate the Unit and Visuals Test Suites (#2144)
lrljoe Jan 4, 2025
b819109
Tidy up Blade Class Definitions (#2145)
lrljoe Jan 4, 2025
4125285
Move Filters Before Query (#2143)
lrljoe Jan 4, 2025
d17464b
Migrate Filter Code Appropriately (#2146)
lrljoe Jan 4, 2025
567b9da
Migrate Filter Status into Own Trait (#2147)
lrljoe Jan 4, 2025
15e18fb
Update PCOV Workflow (#2148)
lrljoe Jan 4, 2025
3f71383
Add configurable area test (#2149)
lrljoe Jan 5, 2025
41c0bd0
Tidy ColumnSelectHelpers & displayToolbarFilters Method (#2150)
lrljoe Jan 6, 2025
16a3590
Add SortingConfiguration Missing Test (#2151)
lrljoe Jan 6, 2025
50226f7
Add Missing Search Tests (#2152)
lrljoe Jan 6, 2025
3d279b9
Adjust SearchHelpersTest (#2153)
lrljoe Jan 6, 2025
8910778
Add test queryStringWithQueryString (#2154)
lrljoe Jan 6, 2025
940e0ac
Add missing tests (#2157)
lrljoe Jan 7, 2025
26f094b
Tidy & Improve Collapsed Columns Behaviour (#2159)
lrljoe Jan 8, 2025
f17a0d8
Tidy computed properties behaviour (#2160)
lrljoe Jan 8, 2025
2368708
Add queryStringAliasTest (#2161)
lrljoe Jan 8, 2025
a57de60
Add missing Columns Non Computed Test (#2162)
lrljoe Jan 8, 2025
6d7b59b
WithSearch Tweaks (#2163)
lrljoe Jan 8, 2025
2ecd092
Optimize Header/Footer (#2164)
lrljoe Jan 8, 2025
1d83e0e
Migrate LivewireComponentColumn methods and add some missing basic te…
lrljoe Jan 11, 2025
19b3723
Clean up Column Component View and Slot behaviours (#2169)
lrljoe Jan 11, 2025
8dc509c
Add initial tests for LivewireComponentArrayFilter (#2170)
lrljoe Jan 11, 2025
d1f6a2e
Update ChangeLog (#2171)
lrljoe Jan 11, 2025
4761dfe
Tweak tests - centralised (#2172)
lrljoe Jan 11, 2025
fe00cff
Adjustments for ComponentColumn (#2173)
lrljoe Jan 11, 2025
6598b25
Update ChangeLog
lrljoe Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Migrate Filter Status into Own Trait (#2147)
* Migrate Filter Status into Own Trait

* Fix styling

* Update setFiltersStatus to protected

* Fix styling

* Restore filters behaviour to public

---------

Co-authored-by: lrljoe <lrljoe@users.noreply.github.com>
  • Loading branch information
lrljoe and lrljoe authored Jan 4, 2025
commit 567b9da9eda7571868038f4ebd50a1a1e52bfc50
24 changes: 1 addition & 23 deletions src/Traits/Configuration/FilterConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,4 @@

namespace Rappasoft\LaravelLivewireTables\Traits\Configuration;

trait FilterConfiguration
{
public function setFiltersStatus(bool $status): self
{
$this->filtersStatus = $status;

return $this;
}

public function setFiltersEnabled(): self
{
$this->setFiltersStatus(true);

return $this;
}

public function setFiltersDisabled(): self
{
$this->setFiltersStatus(false);

return $this;
}
}
trait FilterConfiguration {}
1 change: 1 addition & 0 deletions src/Traits/Core/Filters/HandlesFilterTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ trait HandlesFilterTraits
HasFilterMenuStyling,
HasFilterPillsStyling,
HasFilterQueryString,
HasFiltersStatus,
HasFiltersVisibility;
}
47 changes: 47 additions & 0 deletions src/Traits/Core/Filters/HasFiltersStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Rappasoft\LaravelLivewireTables\Traits\Core\Filters;

use Livewire\Attributes\Locked;

trait HasFiltersStatus
{
#[Locked]
public bool $filtersStatus = true;

public function getFiltersStatus(): bool
{
return $this->filtersStatus;
}

public function filtersAreEnabled(): bool
{
return $this->getFiltersStatus() === true;
}

public function filtersAreDisabled(): bool
{
return $this->getFiltersStatus() === false;
}

public function setFiltersStatus(bool $status): self
{
$this->filtersStatus = $status;

return $this;
}

public function setFiltersEnabled(): self
{
$this->setFiltersStatus(true);

return $this;
}

public function setFiltersDisabled(): self
{
$this->setFiltersStatus(false);

return $this;
}
}
15 changes: 0 additions & 15 deletions src/Traits/Helpers/FilterHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@

trait FilterHelpers
{
public function getFiltersStatus(): bool
{
return $this->filtersStatus;
}

public function filtersAreEnabled(): bool
{
return $this->getFiltersStatus() === true;
}

public function filtersAreDisabled(): bool
{
return $this->getFiltersStatus() === false;
}

public function hasFilters(): bool
{
return $this->getFiltersCount() > 0;
Expand Down
3 changes: 0 additions & 3 deletions src/Traits/WithFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ trait WithFilters
FilterHelpers;
use HandlesFilterTraits;

#[Locked]
public bool $filtersStatus = true;

#[Locked]
public int $filterCount;

Expand Down
85 changes: 85 additions & 0 deletions tests/Unit/Traits/Core/Filters/FilterStatusTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace Rappasoft\LaravelLivewireTables\Tests\Unit\Traits\Core\Filters;

use PHPUnit\Framework\Attributes\Group;
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable;
use Rappasoft\LaravelLivewireTables\Tests\TestCase;

#[Group('Filters')]
final class FilterStatusTest extends TestCase
{
public function test_can_check_if_filters_are_enabled(): void
{
$this->assertTrue($this->basicTable->filtersAreEnabled());
}

public function test_can_check_if_filters_can_be_disabled_when_enbled(): void
{

$mock = new class extends PetsTable
{
public function configure(): void
{
parent::configure();
$this->setFiltersEnabled();
}

public function setFiltersToEnabled()
{
$this->setFiltersEnabled();
}

public function setFiltersToDisabled()
{
$this->setFiltersDisabled();
}
};

$mock->configure();
$mock->boot();

$this->assertTrue($mock->filtersAreEnabled());
$this->assertFalse($mock->filtersAreDisabled());

$mock->setFiltersToDisabled();

$this->assertFalse($mock->filtersAreEnabled());
$this->assertTrue($mock->filtersAreDisabled());

}

public function test_can_check_if_filters_can_be_enabled_when_disabled(): void
{

$mock = new class extends PetsTable
{
public function configure(): void
{
parent::configure();
$this->setFiltersDisabled();
}

public function setFiltersToEnabled()
{
$this->setFiltersEnabled();
}

public function setFiltersToDisabled()
{
$this->setFiltersDisabled();
}
};

$mock->configure();
$mock->boot();

$this->assertTrue($mock->filtersAreDisabled());
$this->assertFalse($mock->filtersAreEnabled());

$mock->setFiltersToEnabled();
$this->assertTrue($mock->filtersAreEnabled());
$this->assertFalse($mock->filtersAreDisabled());

}
}
Loading