Skip to content
Merged

v3.7.1 #2222

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
edbaf69
Enable setting styles for column select (button and menu option check…
HussamAlhennawi Jan 14, 2025
7f2beaa
Merge pull request #2175 from HussamAlhennawi/configuration-for-colum…
lrljoe Jan 16, 2025
19ebe02
Fix styling
lrljoe Jan 16, 2025
4f0c1c2
Enable setting styles for filter pills (item, reset button and reset …
HussamAlhennawi Jan 17, 2025
52a80ef
Enable setting styles for sorting pills (item, clear sort button and …
HussamAlhennawi Jan 18, 2025
a941a16
Merge pull request #2179 from HussamAlhennawi/configuration-for-sorti…
lrljoe Jan 18, 2025
e58bfba
Merge pull request #2178 from HussamAlhennawi/configuration-for-filte…
lrljoe Jan 18, 2025
06ee93d
Add "after-tools" configurable area
lrljoe Jan 19, 2025
74f6a5f
Adjust configurable areas test
lrljoe Jan 19, 2025
bdf338e
Fix Search Field in bootstrap
yparitcher Jan 20, 2025
31561e5
ConfigurableArea Test Tidying
lrljoe Jan 23, 2025
731349b
Fix styling
lrljoe Jan 23, 2025
9259ceb
Add PHPDoc
lrljoe Jan 24, 2025
880f583
Fix styling
lrljoe Jan 24, 2025
5968c00
Merge pull request #2180 from LowerRockLabs/AddAfterToolsConfigurable…
lrljoe Jan 24, 2025
5b23dfb
Merge pull request #2183 from sheavescapital/css
lrljoe Jan 24, 2025
424ab84
Filter Trait - Reorganization (#2181)
lrljoe Jan 24, 2025
3f18055
Filters urgent fixes - correct Filter Default QueryString (#2188)
lrljoe Jan 26, 2025
d56dc78
Move Filter View Traits (#2189)
lrljoe Jan 26, 2025
203d7ad
Filter Rationalisation & Livewire Array Filter improvements (#2191)
lrljoe Feb 9, 2025
c5b63fc
Migrate Column/Filter Traits (#2202)
lrljoe Feb 16, 2025
b2d36c5
BulkActionTweaks - Adding default checkbox, customising attribute beh…
lrljoe Feb 16, 2025
b14f456
Add setFilterPillTitleAsHtml (#2204)
lrljoe Feb 16, 2025
ae34672
Tweak Return Types (#2205)
lrljoe Feb 16, 2025
3ecfb1d
Tweak for text pill title (#2206)
lrljoe Feb 17, 2025
6fe770b
Update for v12 support (#2217)
lrljoe Feb 27, 2025
7542020
Update ChangeLog (#2218)
lrljoe Feb 28, 2025
a99b5b3
DateRangeFilter - fix broken pills, and add missing test (#2219)
lrljoe Feb 28, 2025
80a269b
Add handling for From field for "LinkColumn" (#2221)
lrljoe Feb 28, 2025
aa98a14
Merge branch 'master' into development
lrljoe Feb 28, 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
2 changes: 1 addition & 1 deletion src/Traits/Filters/HandlesPillsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function getPillDataForFilter(): array
$filters = [];

foreach ($this->getAppliedFiltersWithValuesForPills() as $filterKey => $value) {
if (! is_null($filter = $this->getFilterByKey($filterKey))) {
if (! is_null($filter = $this->getFilterByKey($filterKey)) && ! $filter->isEmpty($filter->validate($value))) {
$filters[$filter->getKey()] = FilterPillData::make(
filterKey: $filter->getKey(),
customPillBlade: $filter->getCustomPillBlade() ?? null,
Expand Down
4 changes: 3 additions & 1 deletion src/Traits/Filters/Helpers/FilterPillsHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ public function getAppliedFiltersWithValuesForPills(): array
}

$validatedValue = $filter->validate($item);

if ($filter instanceof BooleanFilter) {
return ! ($filter->isEmpty($validatedValue));
} elseif ($validatedValue === null || $validatedValue === 'null') {
} elseif ($validatedValue === null || $validatedValue === 'null' || $filter->isEmpty($validatedValue)) {
return false;
} elseif (is_array($validatedValue)) {
$filter->isEmpty($validatedValue);
if (array_key_exists(0, $validatedValue) && (is_null($validatedValue[0]) || $validatedValue[0] == 'null')) {
return false;
}
Expand Down
9 changes: 5 additions & 4 deletions src/Views/Filters/DateRangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ public function validate(array|string|null $values): array|bool
return false;
}

$startDate = $this->createCarbonDate($returnedValues['minDate']);
$endDate = $this->createCarbonDate($returnedValues['maxDate']);

if (! ($startDate instanceof Carbon) || ! ($endDate instanceof Carbon)) {
if (! (($startDate = $this->createCarbonDate($returnedValues['minDate'])) instanceof Carbon) || ! (($endDate = $this->createCarbonDate($returnedValues['maxDate'])) instanceof Carbon)) {
return false;
}

if ($startDate->gt($endDate)) {
return false;
}
Expand Down Expand Up @@ -198,6 +196,9 @@ public function getFilterPillValue($value): array|string|bool|null

public function isEmpty(array|string|null $value): bool
{
if (is_null($value) || empty($value)) {
return true;
}
$values = [];
if (is_array($value)) {
if (! isset($value['minDate']) || ! isset($value['maxDate'])) {
Expand Down
23 changes: 23 additions & 0 deletions tests/Unit/Views/Filters/DateRangeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,27 @@ public function test_check_if_can_get_locale(): void
$this->assertSame('de', self::$filterInstance->getPillsLocale());
$this->assertTrue(self::$filterInstance->hasPillsLocale());
}

public function test_can_check_validation_rejects_invalid_values_array(): void
{
$missingStartDate = self::$filterInstance->validate([null, '2020-01-01']);
$missingEndDate = self::$filterInstance->validate(['2020-01-01', null]);
$missingBoth = self::$filterInstance->validate([null, null]);

$this->assertFalse($missingStartDate);
$this->assertFalse($missingEndDate);
$this->assertFalse($missingBoth);
$this->assertTrue(self::$filterInstance->isEmpty($missingStartDate));
$this->assertTrue(self::$filterInstance->isEmpty($missingEndDate));
$this->assertTrue(self::$filterInstance->isEmpty($missingBoth));
}

public function test_can_check_validation_rejects_broken_values_array(): void
{
$this->assertFalse(self::$filterInstance->validate(['minDate' => 'asdf', 'maxDate' => '2020-02-02']));
$this->assertFalse(self::$filterInstance->validate(['minDate' => '4121-31-31', 'maxDate' => '2020-02-02']));
$this->assertFalse(self::$filterInstance->validate(['minDate' => '2020-02-02', 'maxDate' => 'asdf']));
$this->assertFalse(self::$filterInstance->validate(['minDate' => '2020-02-02', 'maxDate' => '4121-31-31']));

}
}