From fed150799508a236356aeff1eb232382ca16846c Mon Sep 17 00:00:00 2001 From: cawecoy91 Date: Wed, 7 Feb 2024 04:39:49 -0300 Subject: [PATCH 1/3] HTMLable filter indicator label --- .../tables/src/Filters/Concerns/HasIndicators.php | 5 +++-- packages/tables/src/Filters/Indicator.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/tables/src/Filters/Concerns/HasIndicators.php b/packages/tables/src/Filters/Concerns/HasIndicators.php index 19d3b885c40..5b8494105d1 100644 --- a/packages/tables/src/Filters/Concerns/HasIndicators.php +++ b/packages/tables/src/Filters/Concerns/HasIndicators.php @@ -5,14 +5,15 @@ use Closure; use Filament\Tables\Filters\Indicator; use Illuminate\Support\Arr; +use Illuminate\Contracts\Support\Htmlable; trait HasIndicators { protected string | Closure | null $indicateUsing = null; - protected Indicator | string | Closure | null $indicator = null; + protected Indicator | string | Htmlable | Closure | null $indicator = null; - public function indicator(Indicator | string | Closure | null $indicator): static + public function indicator(Indicator | string | Htmlable | Closure | null $indicator): static { $this->indicator = $indicator; diff --git a/packages/tables/src/Filters/Indicator.php b/packages/tables/src/Filters/Indicator.php index 40cc2684fa9..4d6967037e7 100644 --- a/packages/tables/src/Filters/Indicator.php +++ b/packages/tables/src/Filters/Indicator.php @@ -5,6 +5,7 @@ use Closure; use Filament\Support\Components\Component; use Filament\Support\Concerns\HasColor; +use Illuminate\Contracts\Support\Htmlable; class Indicator extends Component { @@ -12,7 +13,7 @@ class Indicator extends Component protected bool | Closure $isRemovable = true; - protected string | Closure $label; + protected string | Htmlable | Closure $label; protected string | Closure | null $removeField = null; @@ -20,24 +21,24 @@ class Indicator extends Component protected string $evaluationIdentifier = 'indicator'; - final public function __construct(string | Closure $label) + final public function __construct(string | Htmlable | Closure $label) { $this->label($label); } - public static function make(string | Closure $label): static + public static function make(string | Htmlable | Closure $label): static { return app(static::class, ['label' => $label]); } - public function label(string | Closure $label): static + public function label(string | Htmlable | Closure $label): static { $this->label = $label; return $this; } - public function getLabel(): string + public function getLabel(): string | Htmlable { return $this->evaluate($this->label); } @@ -54,14 +55,14 @@ public function isRemovable(): bool return (bool) $this->evaluate($this->isRemovable); } - public function removeField(string | Closure | null $name): static + public function removeField(string | Htmlable | Closure | null $name): static { $this->removeField = $name; return $this; } - public function getRemoveField(): ?string + public function getRemoveField(): string | Htmlable | null { return $this->evaluate($this->removeField); } From e860a955297e0a201c31ca822ddece958ed181d3 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Wed, 7 Feb 2024 09:29:49 +0000 Subject: [PATCH 2/3] Update HasIndicators.php --- packages/tables/src/Filters/Concerns/HasIndicators.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tables/src/Filters/Concerns/HasIndicators.php b/packages/tables/src/Filters/Concerns/HasIndicators.php index 5b8494105d1..324fe5f7190 100644 --- a/packages/tables/src/Filters/Concerns/HasIndicators.php +++ b/packages/tables/src/Filters/Concerns/HasIndicators.php @@ -60,7 +60,7 @@ public function getIndicators(): array return $indicators; } - public function getIndicator(): Indicator | string + public function getIndicator(): Indicator | string | Htmlable { $state = $this->getState(); From a3ed068abe2ccf44de906d466d44e095acde8721 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Wed, 7 Feb 2024 09:30:11 +0000 Subject: [PATCH 3/3] Update Indicator.php --- packages/tables/src/Filters/Indicator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tables/src/Filters/Indicator.php b/packages/tables/src/Filters/Indicator.php index 4d6967037e7..3074267eab2 100644 --- a/packages/tables/src/Filters/Indicator.php +++ b/packages/tables/src/Filters/Indicator.php @@ -55,14 +55,14 @@ public function isRemovable(): bool return (bool) $this->evaluate($this->isRemovable); } - public function removeField(string | Htmlable | Closure | null $name): static + public function removeField(string | Closure | null $name): static { $this->removeField = $name; return $this; } - public function getRemoveField(): string | Htmlable | null + public function getRemoveField(): ?string { return $this->evaluate($this->removeField); }