fix: adds table dropdown cell editor using options defined in TableInput column (#6825)

* Added options parameter to table

* Removed shadow from no-border on ag cell

* Added Table Dropdown Cell Editor

* Added options to column field type

* Rendered dropdown instead of text if column has options

* Changed structured output to use new options

* Updated starter projects

* Refactor: Simplify TableOptions field definitions

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Lucas Oliveira 2025-02-26 18:37:09 -03:00 • committed by GitHub
commit 45536d55e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 73 additions and 11 deletions

View file

@ -5,7 +5,14 @@ from pydantic import BaseModel, Field, create_model
from langflow.base.models.chat_result import get_chat_result
from langflow.custom import Component
from langflow.helpers.base_model import build_model_from_schema
from langflow.io import BoolInput, HandleInput, MessageTextInput, MultilineInput, Output, TableInput
from langflow.io import (
BoolInput,
HandleInput,
MessageTextInput,
MultilineInput,
Output,
TableInput,
)
from langflow.schema.data import Data
from langflow.schema.dataframe import DataFrame
from langflow.schema.table import EditMode
@ -92,7 +99,8 @@ class StructuredOutputComponent(Component):
"description": (
"Indicate the data type of the output field (e.g., str, int, float, bool, list, dict)."
),
"default": "text",
"options": ["str", "int", "float", "bool", "list", "dict"],
"default": "str",
},
{
"name": "multiple",
@ -103,7 +111,14 @@ class StructuredOutputComponent(Component):
"edit_mode": EditMode.INLINE,
},
],
value=[{"name": "field", "description": "description of field", "type": "text", "multiple": "False"}],
value=[
{
"name": "field",
"description": "description of field",
"type": "str",
"multiple": "False",
}
],
),
BoolInput(
name="multiple",
@ -115,8 +130,16 @@ class StructuredOutputComponent(Component):
]
outputs = [
Output(name="structured_output", display_name="Structured Output", method="build_structured_output"),
Output(name="structured_output_dataframe", display_name="DataFrame", method="as_dataframe"),
Output(
name="structured_output",
display_name="Structured Output",
method="build_structured_output",
),
Output(
name="structured_output_dataframe",
display_name="DataFrame",
method="as_dataframe",
),
]
def build_structured_output_base(self) -> Data:

File diff suppressed because one or more lines are too long

View file

@ -34,6 +34,7 @@ class Column(BaseModel):
model_config = ConfigDict(populate_by_name=True)
name: str
display_name: str = Field(default="")
options: list[str] | None = Field(default=None)
sortable: bool = Field(default=True)
filterable: bool = Field(default=True)
formatter: FormatterType | str | None = Field(default=None)