Frontend Feature: Multiselect ui-component and merge refs hook (#2405)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
feed388857
commit
180e475cc3
10 changed files with 488 additions and 47 deletions
|
|
@ -171,7 +171,7 @@ def add_new_custom_field(
|
|||
field_config["load_from_db"] = True
|
||||
field_config["input_types"] = ["Text"]
|
||||
|
||||
# If options is a list, then it's a dropdown
|
||||
# If options is a list, then it's a dropdown or multiselect
|
||||
# If options is None, then it's a list of strings
|
||||
is_list = isinstance(field_config.get("options"), list)
|
||||
field_config["is_list"] = is_list or field_config.get("list", False) or field_contains_list
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from .inputs import (
|
|||
DataInput,
|
||||
DictInput,
|
||||
DropdownInput,
|
||||
MultiselectInput,
|
||||
FileInput,
|
||||
FloatInput,
|
||||
HandleInput,
|
||||
|
|
@ -21,6 +22,7 @@ __all__ = [
|
|||
"DataInput",
|
||||
"DictInput",
|
||||
"DropdownInput",
|
||||
"MultiselectInput",
|
||||
"FileInput",
|
||||
"FloatInput",
|
||||
"HandleInput",
|
||||
|
|
|
|||
|
|
@ -289,6 +289,23 @@ class DropdownInput(BaseInputMixin, DropDownMixin, MetadataTraceMixin):
|
|||
options: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class MultiselectInput(BaseInputMixin, ListableInputMixin, DropDownMixin, MetadataTraceMixin):
|
||||
"""
|
||||
Represents a multiselect input field.
|
||||
|
||||
This class represents a multiselect input field and provides functionality for handling multiselect values.
|
||||
It inherits from the `BaseInputMixin`, `ListableInputMixin` and `DropDownMixin` classes.
|
||||
|
||||
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.
|
||||
Default is None.
|
||||
"""
|
||||
|
||||
field_type: Optional[SerializableFieldTypes] = FieldTypes.TEXT
|
||||
options: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class FileInput(BaseInputMixin, ListableInputMixin, FileMixin, MetadataTraceMixin):
|
||||
"""
|
||||
Represents a file field.
|
||||
|
|
@ -308,6 +325,7 @@ InputTypes = Union[
|
|||
DataInput,
|
||||
DictInput,
|
||||
DropdownInput,
|
||||
MultiselectInput,
|
||||
FileInput,
|
||||
FloatInput,
|
||||
HandleInput,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from langflow.inputs import (
|
|||
DataInput,
|
||||
DictInput,
|
||||
DropdownInput,
|
||||
MultiselectInput,
|
||||
FileInput,
|
||||
FloatInput,
|
||||
HandleInput,
|
||||
|
|
@ -22,6 +23,7 @@ __all__ = [
|
|||
"DataInput",
|
||||
"DictInput",
|
||||
"DropdownInput",
|
||||
"MultiselectInput",
|
||||
"FileInput",
|
||||
"FloatInput",
|
||||
"HandleInput",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue