You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TableBlock: typed model classes for cells and column_settings instead of Dict[str, Any] #1938
TableBlock.rows is typed as Sequence[Sequence[Dict[str, Any]]] and column_settings as Optional[Sequence[Optional[Dict[str, Any]]]]. These could be typed model classes instead, similar to how other blocks use composition objects.
These could be modeled as distinct classes (e.g. RawTextCell, RichTextCell) or accepted as a Union type, giving developers autocomplete and type checking instead of hand-building dicts.
Column settings — each entry has typed fields (align: "left" | "center" | "right", is_wrapped: bool) that would benefit from a model class with validation.
Current behavior
block=TableBlock(
rows=[
[{"type": "raw_text", "text": "Header"}], # no type help
[{"type": "raw_text", "txt": "typo"}], # no validation
],
column_settings=[{"align": "right", "is_wrapped": True}], # untyped
)
Expected behavior
block=TableBlock(
rows=[
[RawTextCell(text="Header")], # typed, validated
[RichTextCell(elements=[...])], # autocomplete on elements
],
column_settings=[ColumnSettings(align="right", is_wrapped=True)],
)
Dicts should still be accepted for backwards compatibility (Union with dict).
Activity