mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Rename
This commit is contained in:
@@ -6,7 +6,7 @@ use Closure;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Filament\Schemas\Components\StateCasts\EnumArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionsArrayStateCast;
|
||||
use Filament\Support\Concerns\HasExtraAlpineAttributes;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Filament\Support\Services\RelationshipJoiner;
|
||||
@@ -338,7 +338,7 @@ class CheckboxList extends Field implements Contracts\CanDisableOptions, Contrac
|
||||
return parent::getDefaultStateCasts();
|
||||
}
|
||||
|
||||
return [app(StringArrayStateCast::class)];
|
||||
return [app(OptionsArrayStateCast::class)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Filament\Forms\Components;
|
||||
use Closure;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionsArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionStateCast;
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Support\Services\RelationshipJoiner;
|
||||
@@ -679,9 +679,9 @@ class ModalTableSelect extends Field
|
||||
}
|
||||
|
||||
if ($this->isMultiple()) {
|
||||
return [app(StringArrayStateCast::class)];
|
||||
return [app(OptionsArrayStateCast::class)];
|
||||
}
|
||||
|
||||
return [app(StringStateCast::class, ['isNullable' => true])];
|
||||
return [app(OptionStateCast::class, ['isNullable' => true])];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Filament\Forms\Components;
|
||||
use Closure;
|
||||
use Filament\Schemas\Components\StateCasts\BooleanStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionStateCast;
|
||||
|
||||
class Radio extends Field implements Contracts\CanDisableOptions
|
||||
{
|
||||
@@ -68,7 +68,7 @@ class Radio extends Field implements Contracts\CanDisableOptions
|
||||
return parent::getDefaultStateCasts();
|
||||
}
|
||||
|
||||
return [app(StringStateCast::class, ['isNullable' => true])];
|
||||
return [app(OptionStateCast::class, ['isNullable' => true])];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,8 @@ use Filament\Schemas\Components\StateCasts\BooleanStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Filament\Schemas\Components\StateCasts\EnumArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\EnumStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionsArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionStateCast;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Components\Attributes\ExposedLivewireMethod;
|
||||
use Filament\Support\Concerns\HasExtraAlpineAttributes;
|
||||
@@ -1424,10 +1424,10 @@ class Select extends Field implements Contracts\CanDisableOptions, Contracts\Has
|
||||
}
|
||||
|
||||
if ($this->isMultiple()) {
|
||||
return [app(StringArrayStateCast::class)];
|
||||
return [app(OptionsArrayStateCast::class)];
|
||||
}
|
||||
|
||||
return [app(StringStateCast::class, ['isNullable' => true])];
|
||||
return [app(OptionStateCast::class, ['isNullable' => true])];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace Filament\Forms\Components;
|
||||
|
||||
use Closure;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionsArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionStateCast;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -317,9 +317,9 @@ class TableSelect extends Field
|
||||
}
|
||||
|
||||
if ($this->isMultiple()) {
|
||||
return [app(StringArrayStateCast::class)];
|
||||
return [app(OptionsArrayStateCast::class)];
|
||||
}
|
||||
|
||||
return [app(StringStateCast::class, ['isNullable' => true])];
|
||||
return [app(OptionStateCast::class, ['isNullable' => true])];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ use Filament\Schemas\Components\StateCasts\BooleanStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Filament\Schemas\Components\StateCasts\EnumArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\EnumStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\StringStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionsArrayStateCast;
|
||||
use Filament\Schemas\Components\StateCasts\OptionStateCast;
|
||||
use Filament\Support\Facades\FilamentIcon;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
@@ -136,10 +136,10 @@ class ToggleButtons extends Field implements Contracts\CanDisableOptions
|
||||
}
|
||||
|
||||
if ($this->isMultiple()) {
|
||||
return [app(StringArrayStateCast::class)];
|
||||
return [app(OptionsArrayStateCast::class)];
|
||||
}
|
||||
|
||||
return [app(StringStateCast::class, ['isNullable' => true])];
|
||||
return [app(OptionStateCast::class, ['isNullable' => true])];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -5,13 +5,13 @@ namespace Filament\Schemas\Components\StateCasts;
|
||||
use BackedEnum;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
|
||||
class StringStateCast implements StateCast
|
||||
class OptionStateCast implements StateCast
|
||||
{
|
||||
public function __construct(
|
||||
protected bool $isNullable = true,
|
||||
) {}
|
||||
|
||||
public function get(mixed $state): ?string
|
||||
public function get(mixed $state): string | int | null
|
||||
{
|
||||
if ($this->isNullable && blank($state)) {
|
||||
return null;
|
||||
+2
-2
@@ -5,10 +5,10 @@ namespace Filament\Schemas\Components\StateCasts;
|
||||
use BackedEnum;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
|
||||
class StringArrayStateCast implements StateCast
|
||||
class OptionsArrayStateCast implements StateCast
|
||||
{
|
||||
/**
|
||||
* @return array<string>
|
||||
* @return array<string | int>
|
||||
*/
|
||||
public function get(mixed $state): array
|
||||
{
|
||||
Reference in New Issue
Block a user