diff --git a/src/SelectTree.php b/src/SelectTree.php index c4bb6bc..57b13dd 100644 --- a/src/SelectTree.php +++ b/src/SelectTree.php @@ -36,8 +36,6 @@ class SelectTree extends Field implements HasAffixActions protected bool $alwaysOpen = false; - protected string $emptyLabel = ''; - protected bool $independent = true; protected ?string $customKey = null; @@ -138,6 +136,8 @@ protected function setUp(): void $this->dehydrated(fn (SelectTree $component): bool => ! $component->getRelationship() instanceof BelongsToMany); + $this->placeholder(static fn (SelectTree $component): ?string => $component->isDisabled() ? null : __('filament-forms::components.select.placeholder')); + $this->suffixActions([ static fn (SelectTree $component): ?Action => $component->getCreateOptionAction(), ]); @@ -338,7 +338,7 @@ public function expandSelected(bool $expandSelected = true): static public function emptyLabel(string $emptyLabel): static { - $this->emptyLabel = $emptyLabel; + $this->noSearchResultsMessage($emptyLabel); return $this; } @@ -459,7 +459,7 @@ public function getDefaultOpenLevel(): int public function getEmptyLabel(): string { - return $this->emptyLabel ? $this->evaluate($this->emptyLabel) : __('No options match your search.'); + return $this->getNoSearchResultsMessage(); } public function getDirection(): string