fix missing event triggers from docs (#3495)
* fix missing event triggers from docs * fix nit * go for simpler fix
This commit is contained in:
parent
69e4bbc301
commit
44d2bd4970
@ -582,6 +582,7 @@ class Component(BaseComponent, ABC):
|
||||
|
||||
Returns:
|
||||
The event triggers.
|
||||
|
||||
"""
|
||||
default_triggers = {
|
||||
EventTriggers.ON_FOCUS: lambda: [],
|
||||
@ -600,6 +601,7 @@ class Component(BaseComponent, ABC):
|
||||
EventTriggers.ON_MOUNT: lambda: [],
|
||||
EventTriggers.ON_UNMOUNT: lambda: [],
|
||||
}
|
||||
|
||||
# Look for component specific triggers,
|
||||
# e.g. variable declared as EventHandler types.
|
||||
for field in self.get_fields().values():
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Data Editor component from glide-data-grid."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
@ -391,14 +392,6 @@ class DataEditor(NoSSRComponent):
|
||||
)
|
||||
}
|
||||
|
||||
def get_event_triggers(self) -> dict[str, Any]:
|
||||
"""Remove the default event triggers from Component.
|
||||
|
||||
Returns:
|
||||
An empty dictionary.
|
||||
"""
|
||||
return {}
|
||||
|
||||
|
||||
@serializer
|
||||
def serialize_dataeditortheme(theme: DataEditorTheme):
|
||||
|
@ -133,38 +133,105 @@ class DataEditor(NoSSRComponent):
|
||||
theme: Optional[
|
||||
Union[Var[Union[DataEditorTheme, Dict]], Union[DataEditorTheme, Dict]]
|
||||
] = None,
|
||||
on_cell_activated: Optional[EventHandler[lambda pos: [pos]]] = None,
|
||||
on_cell_clicked: Optional[EventHandler[lambda pos: [pos]]] = None,
|
||||
on_cell_context_menu: Optional[EventHandler[lambda pos: [pos]]] = None,
|
||||
on_cell_edited: Optional[EventHandler[on_edit_spec]] = None,
|
||||
on_group_header_clicked: Optional[EventHandler[on_edit_spec]] = None,
|
||||
on_group_header_context_menu: Optional[
|
||||
EventHandler[lambda grp_idx, data: [grp_idx, data]]
|
||||
] = None,
|
||||
on_group_header_renamed: Optional[
|
||||
EventHandler[lambda idx, val: [idx, val]]
|
||||
] = None,
|
||||
on_header_clicked: Optional[EventHandler[lambda pos: [pos]]] = None,
|
||||
on_header_context_menu: Optional[EventHandler[lambda pos: [pos]]] = None,
|
||||
on_header_menu_click: Optional[
|
||||
EventHandler[lambda col, pos: [col, pos]]
|
||||
] = None,
|
||||
on_item_hovered: Optional[EventHandler[lambda pos: [pos]]] = None,
|
||||
on_delete: Optional[EventHandler[lambda selection: [selection]]] = None,
|
||||
on_finished_editing: Optional[
|
||||
EventHandler[lambda new_value, movement: [new_value, movement]]
|
||||
] = None,
|
||||
on_row_appended: Optional[EventHandler[lambda: []]] = None,
|
||||
on_selection_cleared: Optional[EventHandler[lambda: []]] = None,
|
||||
on_column_resize: Optional[
|
||||
EventHandler[lambda col, width: [col, width]]
|
||||
] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
class_name: Optional[Any] = None,
|
||||
autofocus: Optional[bool] = None,
|
||||
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
||||
on_blur: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_cell_activated: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_cell_clicked: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_cell_context_menu: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_cell_edited: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_click: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_column_resize: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_context_menu: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_delete: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_double_click: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_finished_editing: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_focus: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_group_header_clicked: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_group_header_context_menu: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_group_header_renamed: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_header_clicked: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_header_context_menu: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_header_menu_click: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_item_hovered: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mount: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_down: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_enter: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_leave: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_move: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_out: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_over: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_mouse_up: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_row_appended: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_scroll: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_selection_cleared: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_unmount: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
**props
|
||||
) -> "DataEditor":
|
||||
"""Create the DataEditor component.
|
||||
@ -200,22 +267,6 @@ class DataEditor(NoSSRComponent):
|
||||
scroll_offset_x: Initial scroll offset on the horizontal axis.
|
||||
scroll_offset_y: Initial scroll offset on the vertical axis.
|
||||
theme: global theme
|
||||
on_cell_activated: Fired when a cell is activated.
|
||||
on_cell_clicked: Fired when a cell is clicked.
|
||||
on_cell_context_menu: Fired when a cell is right-clicked.
|
||||
on_cell_edited: Fired when a cell is edited.
|
||||
on_group_header_clicked: Fired when a group header is clicked.
|
||||
on_group_header_context_menu: Fired when a group header is right-clicked.
|
||||
on_group_header_renamed: Fired when a group header is renamed.
|
||||
on_header_clicked: Fired when a header is clicked.
|
||||
on_header_context_menu: Fired when a header is right-clicked.
|
||||
on_header_menu_click: Fired when a header menu item is clicked.
|
||||
on_item_hovered: Fired when an item is hovered.
|
||||
on_delete: Fired when a selection is deleted.
|
||||
on_finished_editing: Fired when editing is finished.
|
||||
on_row_appended: Fired when a row is appended.
|
||||
on_selection_cleared: Fired when the selection is cleared.
|
||||
on_column_resize: Fired when a column is resized.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -231,7 +282,6 @@ class DataEditor(NoSSRComponent):
|
||||
The DataEditor component.&
|
||||
"""
|
||||
...
|
||||
def get_event_triggers(self) -> dict[str, Any]: ...
|
||||
|
||||
@serializer
|
||||
def serialize_dataeditortheme(theme: DataEditorTheme): ...
|
||||
|
Loading…
Reference in New Issue
Block a user