fix: multiselect dropdown not visible (#3044)
* Fixed refresh button and refresh parameter * Refactored Multiselect component and implemented custom values on it * Fixed default values * Made Backend support combobox on Dropdown and Multiselect
This commit is contained in:
parent
4e9367badf
commit
7fa3d33d8a
9 changed files with 261 additions and 325 deletions
|
|
@ -135,17 +135,14 @@ class RangeMixin(BaseModel):
|
|||
class DropDownMixin(BaseModel):
|
||||
options: Optional[list[str]] = None
|
||||
"""List of options for the field. Only used when is_list=True. Default is an empty list."""
|
||||
combobox: CoalesceBool = False
|
||||
"""Variable that defines if the user can insert custom values in the dropdown."""
|
||||
|
||||
|
||||
class MultilineMixin(BaseModel):
|
||||
multiline: CoalesceBool = True
|
||||
|
||||
|
||||
class ComboboxMixin(BaseModel):
|
||||
combobox: CoalesceBool = False
|
||||
"""Variable that defines if the user can insert custom values in the dropdown."""
|
||||
|
||||
|
||||
class TableMixin(BaseModel):
|
||||
table_schema: Optional[TableSchema | list[Column]] = None
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from .input_mixin import (
|
|||
BaseInputMixin,
|
||||
DatabaseLoadMixin,
|
||||
DropDownMixin,
|
||||
ComboboxMixin,
|
||||
FieldTypes,
|
||||
FileMixin,
|
||||
InputTraceMixin,
|
||||
|
|
@ -307,7 +306,7 @@ class DictInput(BaseInputMixin, ListableInputMixin, InputTraceMixin):
|
|||
value: Optional[dict] = {}
|
||||
|
||||
|
||||
class DropdownInput(BaseInputMixin, DropDownMixin, MetadataTraceMixin, ComboboxMixin):
|
||||
class DropdownInput(BaseInputMixin, DropDownMixin, MetadataTraceMixin):
|
||||
"""
|
||||
Represents a dropdown input field.
|
||||
|
||||
|
|
@ -316,7 +315,7 @@ class DropdownInput(BaseInputMixin, DropDownMixin, MetadataTraceMixin, ComboboxM
|
|||
|
||||
Attributes:
|
||||
field_type (Optional[SerializableFieldTypes]): The field type of the input. Defaults to FieldTypes.TEXT.
|
||||
options (Optional[Union[list[str], Callable]]): List of options for the field. Only used when is_list=True.
|
||||
options (Optional[Union[list[str], Callable]]): List of options for the field.
|
||||
Default is None.
|
||||
"""
|
||||
|
||||
|
|
@ -341,6 +340,18 @@ class MultiselectInput(BaseInputMixin, ListableInputMixin, DropDownMixin, Metada
|
|||
field_type: Optional[SerializableFieldTypes] = FieldTypes.TEXT
|
||||
options: list[str] = Field(default_factory=list)
|
||||
is_list: bool = Field(default=True, serialization_alias="list")
|
||||
combobox: CoalesceBool = False
|
||||
|
||||
@field_validator("value")
|
||||
@classmethod
|
||||
def validate_value(cls, v: Any, _info):
|
||||
# Check if value is a list of dicts
|
||||
if not isinstance(v, list):
|
||||
raise ValueError(f"MultiselectInput value must be a list. Value: '{v}'")
|
||||
for item in v:
|
||||
if not isinstance(item, str):
|
||||
raise ValueError(f"MultiselectInput value must be a list of strings. Item: '{item}' is not a string")
|
||||
return v
|
||||
|
||||
|
||||
class FileInput(BaseInputMixin, ListableInputMixin, FileMixin, MetadataTraceMixin):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue