Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions packages/fields/src/Fields/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static function getDefaultConfig(): array
...self::getOptionsConfig(),
'searchable' => false,
'multiple' => false,
'reorderable' => false,
'preload' => false,
'allowHtml' => false,
'selectablePlaceholder' => true,
Expand Down Expand Up @@ -82,6 +83,10 @@ public static function make(string $name, ?Field $field = null): Input
$input->maxItemsForSearch($field->config['maxItemsForSearch']);
}

if (($field->config['multiple'] ?? false) && ($field->config['reorderable'] ?? false)) {
$input->reorderable();
}

return $input;
}

Expand Down Expand Up @@ -160,8 +165,14 @@ public function getForm(): array
->live(debounce: 250),
Toggle::make('config.multiple')
->label(__('Multiple'))
->helperText(__('Only first value is used when switching from multiple to single.'))
->columnSpan(2),
->helperText(__('Only first value is kept when switching.'))
->live()
->columnSpan(1),
Toggle::make('config.reorderable')
->label(__('Reorderable'))
->helperText(__('Allow users to reorder selected items.'))
->visible(fn (Get $get): bool => $get('config.multiple'))
->columnSpan(1),
Toggle::make('config.allowHtml')
->label(__('Allow HTML')),
Toggle::make('config.selectablePlaceholder')
Expand Down
2 changes: 1 addition & 1 deletion packages/uploadcare-field/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": "^8.3",
"spatie/laravel-package-tools": "^1.16",
"illuminate/contracts": "^10.0||^11.0||^12.0",
"backstage/filament-uploadcare-field": "^1.1.0",
"backstage/filament-uploadcare-field": "self.version",
"backstage/fields": "self.version"
},
"require-dev": {
Expand Down