Skip to content

Commit 72db057

Browse files
lrljoegithub-actions[bot]
authored andcommitted
Fix styling
1 parent df39542 commit 72db057

File tree

2 files changed

+34
-37
lines changed

2 files changed

+34
-37
lines changed

src/DataTransferObjects/Filters/FilterPillData.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(
2020
protected bool $renderPillsAsHtml,
2121
protected bool $watchForEvents,
2222
protected array $customResetButtonAttributes,
23-
protected bool $renderPillsTitleAsHtml ) {}
23+
protected bool $renderPillsTitleAsHtml) {}
2424

2525
public static function make(string $filterKey, string $filterPillTitle, string|array|null $filterPillValue, string $separator = ', ', bool $isAnExternalLivewireFilter = false, bool $hasCustomPillBlade = false, ?string $customPillBlade = null, array $filterPillsItemAttributes = [], bool $renderPillsAsHtml = false, bool $watchForEvents = false, array $customResetButtonAttributes = [], bool $renderPillsTitleAsHtml = false): FilterPillData
2626
{
@@ -56,7 +56,6 @@ public function getCustomResetButtonAttributes(): array
5656
return $this->customResetButtonAttributes ?? [];
5757
}
5858

59-
6059
public function getIsAnExternalLivewireFilter(): int
6160
{
6261
return intval($this->isAnExternalLivewireFilter ?? false);
@@ -87,8 +86,7 @@ public function isPillValueAnArray(): bool
8786
return ! is_null($this->filterPillValue) && is_array($this->filterPillValue);
8887
}
8988

90-
91-
public function getSeparatedPillValue(): string|null
89+
public function getSeparatedPillValue(): ?string
9290
{
9391
if ($this->isPillValueAnArray()) {
9492
return implode($this->getSeparator(), $this->getPillValue());
@@ -97,11 +95,11 @@ public function getSeparatedPillValue(): string|null
9795
}
9896
}
9997

100-
public function getSafeSeparatedPillValue(): string|null
98+
public function getSafeSeparatedPillValue(): ?string
10199
{
102100
$string = $this->getSeparatedPillValue();
103101

104-
return htmlentities($string, ENT_QUOTES,'UTF-8');
102+
return htmlentities($string, ENT_QUOTES, 'UTF-8');
105103

106104
}
107105

@@ -110,7 +108,6 @@ public function getFilterPillsItemAttributes(): array
110108
return array_merge(['default' => true, 'default-colors' => true, 'default-styling' => true, 'default-text' => true], $this->filterPillsItemAttributes);
111109
}
112110

113-
114111
public function getFilterPillDisplayDataArray(): array
115112
{
116113
$array = [];
@@ -132,7 +129,7 @@ public function getInternalFilterPillDisplayDataArray(array $array = []): array
132129
{
133130

134131
$array['x-data'] = "{ internalDisplayString: ''}";
135-
$array['x-init'] = "internalDisplayString = updatePillValues(".json_encode($this->getSafeSeparatedPillValue()).")";
132+
$array['x-init'] = 'internalDisplayString = updatePillValues('.json_encode($this->getSafeSeparatedPillValue()).')';
136133
$array[$this->shouldUsePillsAsHtml() ? 'x-html' : 'x-text'] = 'internalDisplayString';
137134

138135
return $array;
@@ -141,6 +138,7 @@ public function getInternalFilterPillDisplayDataArray(array $array = []): array
141138
public function getFilterTitleDisplayDataArray(array $array = []): array
142139
{
143140
$array[$this->shouldUsePillsTitleAsHtml() ? 'x-html' : 'x-text'] = "localFilterTitle + ': '";
141+
144142
return $array;
145143
}
146144

src/View/Components/FilterPill.php

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\View\Components;
4-
5-
use Illuminate\View\Component;
6-
use Rappasoft\LaravelLivewireTables\DataTransferObjects\Filters\FilterPillData;
7-
8-
class FilterPill extends Component
9-
{
10-
public bool $shouldWatch = false;
11-
12-
public function __construct(public string $filterKey, public FilterPillData $filterPillData)
13-
{
14-
$this->shouldWatch = $this->filterPillData->shouldWatchForEvents() ?? 0;
15-
}
16-
17-
public function render(): null|string|\Illuminate\Support\HtmlString|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
18-
{
19-
return view('livewire-tables::includes.filter-pill')
20-
->with([
21-
'filterPillsItemAttributes' => $this->filterPillData->getFilterPillsItemAttributes(),
22-
'pillDisplayDataArray' => $this->filterPillData->getFilterPillDisplayDataArray(),
23-
'pillTitleDisplayDataArray' => $this->filterPillData->getFilterTitleDisplayDataArray(),
24-
'setupData' => $this->filterPillData->getPillSetupData($this->filterKey,$this->shouldWatch),
25-
]);
26-
27-
}
28-
29-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\View\Components;
4+
5+
use Illuminate\View\Component;
6+
use Rappasoft\LaravelLivewireTables\DataTransferObjects\Filters\FilterPillData;
7+
8+
class FilterPill extends Component
9+
{
10+
public bool $shouldWatch = false;
11+
12+
public function __construct(public string $filterKey, public FilterPillData $filterPillData)
13+
{
14+
$this->shouldWatch = $this->filterPillData->shouldWatchForEvents() ?? 0;
15+
}
16+
17+
public function render(): null|string|\Illuminate\Support\HtmlString|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
18+
{
19+
return view('livewire-tables::includes.filter-pill')
20+
->with([
21+
'filterPillsItemAttributes' => $this->filterPillData->getFilterPillsItemAttributes(),
22+
'pillDisplayDataArray' => $this->filterPillData->getFilterPillDisplayDataArray(),
23+
'pillTitleDisplayDataArray' => $this->filterPillData->getFilterTitleDisplayDataArray(),
24+
'setupData' => $this->filterPillData->getPillSetupData($this->filterKey, $this->shouldWatch),
25+
]);
26+
27+
}
28+
}

0 commit comments

Comments
 (0)