remove last missing type for datadisplay

This commit is contained in:
Khaleel Al-Adhami 2024-10-21 23:52:20 -07:00
parent ba3d0e30c7
commit c66e5b0984
2 changed files with 14 additions and 27 deletions

View File

@ -109,19 +109,6 @@ class DataEditorTheme(Base):
text_medium: Optional[str] = None
def on_edit_spec(pos, data: dict[str, Any]):
"""The on edit spec function.
Args:
pos: The position of the edit event.
data: The data of the edit event.
Returns:
The position and data.
"""
return [pos, data]
class Bounds(TypedDict):
"""The bounds of the group header."""
@ -149,7 +136,7 @@ class Rectangle(TypedDict):
class GridSelectionCurrent(TypedDict):
"""The current selection."""
cell: list[int]
cell: tuple[int, int]
range: Rectangle
rangeStack: list[Rectangle]
@ -167,7 +154,7 @@ class GroupHeaderClickedEventArgs(TypedDict):
kind: str
group: str
location: list[int]
location: tuple[int, int]
bounds: Bounds
isEdge: bool
shiftKey: bool
@ -178,7 +165,7 @@ class GroupHeaderClickedEventArgs(TypedDict):
localEventY: int
button: int
buttons: int
scrollEdge: list[int]
scrollEdge: tuple[int, int]
class GridCell(TypedDict):
@ -306,10 +293,10 @@ class DataEditor(NoSSRComponent):
on_cell_context_menu: EventHandler[identity_event(Tuple[int, int])]
# Fired when a cell is edited.
on_cell_edited: EventHandler[on_edit_spec]
on_cell_edited: EventHandler[identity_event(Tuple[int, int], GridCell)]
# Fired when a group header is clicked.
on_group_header_clicked: EventHandler[on_edit_spec]
on_group_header_clicked: EventHandler[identity_event(Tuple[int, int], GridCell)]
# Fired when a group header is right-clicked.
on_group_header_context_menu: EventHandler[
@ -335,7 +322,9 @@ class DataEditor(NoSSRComponent):
on_delete: EventHandler[identity_event(GridSelection)]
# Fired when editing is finished.
on_finished_editing: EventHandler[identity_event(Union[GridCell, None], list[int])]
on_finished_editing: EventHandler[
identity_event(Union[GridCell, None], tuple[int, int])
]
# Fired when a row is appended.
on_row_appended: EventHandler[empty_event]

View File

@ -78,8 +78,6 @@ class DataEditorTheme(Base):
text_light: Optional[str]
text_medium: Optional[str]
def on_edit_spec(pos, data: dict[str, Any]): ...
class Bounds(TypedDict):
x: int
y: int
@ -96,7 +94,7 @@ class Rectangle(TypedDict):
height: int
class GridSelectionCurrent(TypedDict):
cell: list[int]
cell: tuple[int, int]
range: Rectangle
rangeStack: list[Rectangle]
@ -108,7 +106,7 @@ class GridSelection(TypedDict):
class GroupHeaderClickedEventArgs(TypedDict):
kind: str
group: str
location: list[int]
location: tuple[int, int]
bounds: Bounds
isEdge: bool
shiftKey: bool
@ -119,7 +117,7 @@ class GroupHeaderClickedEventArgs(TypedDict):
localEventY: int
button: int
buttons: int
scrollEdge: list[int]
scrollEdge: tuple[int, int]
class GridCell(TypedDict):
span: Optional[List[int]]
@ -189,17 +187,17 @@ class DataEditor(NoSSRComponent):
on_cell_activated: Optional[EventType[tuple[int, int]]] = None,
on_cell_clicked: Optional[EventType[tuple[int, int]]] = None,
on_cell_context_menu: Optional[EventType[tuple[int, int]]] = None,
on_cell_edited: Optional[EventType] = None,
on_cell_edited: Optional[EventType[tuple[int, int], GridCell]] = None,
on_click: Optional[EventType[[]]] = None,
on_column_resize: Optional[EventType[GridColumn, int]] = None,
on_context_menu: Optional[EventType[[]]] = None,
on_delete: Optional[EventType[GridSelection]] = None,
on_double_click: Optional[EventType[[]]] = None,
on_finished_editing: Optional[
EventType[Union[GridCell, None], list[int]]
EventType[Union[GridCell, None], tuple[int, int]]
] = None,
on_focus: Optional[EventType[[]]] = None,
on_group_header_clicked: Optional[EventType] = None,
on_group_header_clicked: Optional[EventType[tuple[int, int], GridCell]] = None,
on_group_header_context_menu: Optional[
EventType[int, GroupHeaderClickedEventArgs]
] = None,