reflex 0.6.4a3__py3-none-any.whl → 0.6.5a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reflex/.templates/jinja/web/pages/custom_component.js.jinja2 +0 -14
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +4 -8
- reflex/.templates/web/components/shiki/code.js +16 -11
- reflex/.templates/web/utils/state.js +29 -21
- reflex/__init__.py +4 -0
- reflex/__init__.pyi +4 -0
- reflex/app.py +148 -154
- reflex/app_mixins/lifespan.py +5 -1
- reflex/app_mixins/middleware.py +3 -1
- reflex/app_mixins/mixin.py +3 -2
- reflex/base.py +2 -4
- reflex/compiler/compiler.py +111 -37
- reflex/components/base/app_wrap.pyi +17 -17
- reflex/components/base/bare.py +72 -3
- reflex/components/base/body.pyi +17 -17
- reflex/components/base/document.pyi +81 -81
- reflex/components/base/error_boundary.pyi +25 -18
- reflex/components/base/fragment.pyi +17 -17
- reflex/components/base/head.pyi +33 -33
- reflex/components/base/link.pyi +33 -33
- reflex/components/base/meta.pyi +65 -65
- reflex/components/base/script.py +4 -4
- reflex/components/base/script.pyi +23 -20
- reflex/components/component.py +250 -31
- reflex/components/core/banner.py +1 -1
- reflex/components/core/banner.pyi +81 -81
- reflex/components/core/client_side_routing.pyi +33 -33
- reflex/components/core/clipboard.py +2 -2
- reflex/components/core/clipboard.pyi +24 -18
- reflex/components/core/debounce.py +2 -2
- reflex/components/core/debounce.pyi +18 -18
- reflex/components/core/html.pyi +17 -17
- reflex/components/core/upload.py +82 -28
- reflex/components/core/upload.pyi +77 -72
- reflex/components/datadisplay/code.py +55 -40
- reflex/components/datadisplay/code.pyi +46 -44
- reflex/components/datadisplay/dataeditor.py +21 -20
- reflex/components/datadisplay/dataeditor.pyi +103 -35
- reflex/components/datadisplay/shiki_code_block.py +60 -27
- reflex/components/datadisplay/shiki_code_block.pyi +86 -65
- reflex/components/dynamic.py +9 -5
- reflex/components/el/element.pyi +17 -17
- reflex/components/el/elements/base.pyi +17 -17
- reflex/components/el/elements/forms.py +12 -3
- reflex/components/el/elements/forms.pyi +293 -233
- reflex/components/el/elements/inline.pyi +449 -449
- reflex/components/el/elements/media.pyi +401 -401
- reflex/components/el/elements/metadata.pyi +97 -97
- reflex/components/el/elements/other.pyi +113 -113
- reflex/components/el/elements/scripts.pyi +49 -49
- reflex/components/el/elements/sectioning.pyi +241 -241
- reflex/components/el/elements/tables.pyi +161 -161
- reflex/components/el/elements/typography.pyi +241 -241
- reflex/components/gridjs/datatable.pyi +33 -33
- reflex/components/lucide/icon.py +1 -1
- reflex/components/lucide/icon.pyi +33 -33
- reflex/components/markdown/markdown.py +180 -49
- reflex/components/markdown/markdown.pyi +36 -19
- reflex/components/moment/moment.py +17 -21
- reflex/components/moment/moment.pyi +26 -21
- reflex/components/next/base.pyi +17 -17
- reflex/components/next/image.py +3 -3
- reflex/components/next/image.pyi +21 -19
- reflex/components/next/link.pyi +17 -17
- reflex/components/next/video.pyi +17 -17
- reflex/components/plotly/plotly.py +79 -78
- reflex/components/plotly/plotly.pyi +91 -41
- reflex/components/props.py +34 -0
- reflex/components/radix/primitives/accordion.py +15 -8
- reflex/components/radix/primitives/accordion.pyi +121 -118
- reflex/components/radix/primitives/base.pyi +33 -33
- reflex/components/radix/primitives/drawer.py +41 -20
- reflex/components/radix/primitives/drawer.pyi +279 -190
- reflex/components/radix/primitives/form.py +2 -2
- reflex/components/radix/primitives/form.pyi +200 -167
- reflex/components/radix/primitives/progress.pyi +81 -81
- reflex/components/radix/primitives/slider.pyi +89 -83
- reflex/components/radix/themes/base.py +27 -1
- reflex/components/radix/themes/base.pyi +286 -113
- reflex/components/radix/themes/color_mode.py +17 -9
- reflex/components/radix/themes/color_mode.pyi +68 -56
- reflex/components/radix/themes/components/alert_dialog.py +8 -5
- reflex/components/radix/themes/components/alert_dialog.pyi +125 -117
- reflex/components/radix/themes/components/aspect_ratio.pyi +17 -17
- reflex/components/radix/themes/components/avatar.py +1 -5
- reflex/components/radix/themes/components/avatar.pyi +17 -17
- reflex/components/radix/themes/components/badge.py +1 -5
- reflex/components/radix/themes/components/badge.pyi +17 -17
- reflex/components/radix/themes/components/button.pyi +18 -21
- reflex/components/radix/themes/components/callout.py +1 -4
- reflex/components/radix/themes/components/callout.pyi +81 -81
- reflex/components/radix/themes/components/card.py +1 -3
- reflex/components/radix/themes/components/card.pyi +17 -17
- reflex/components/radix/themes/components/checkbox.py +4 -8
- reflex/components/radix/themes/components/checkbox.pyi +61 -52
- reflex/components/radix/themes/components/checkbox_cards.pyi +33 -33
- reflex/components/radix/themes/components/checkbox_group.pyi +33 -33
- reflex/components/radix/themes/components/context_menu.py +121 -28
- reflex/components/radix/themes/components/context_menu.pyi +250 -147
- reflex/components/radix/themes/components/data_list.pyi +65 -65
- reflex/components/radix/themes/components/dialog.py +11 -11
- reflex/components/radix/themes/components/dialog.pyi +135 -120
- reflex/components/radix/themes/components/dropdown_menu.py +14 -25
- reflex/components/radix/themes/components/dropdown_menu.pyi +157 -145
- reflex/components/radix/themes/components/hover_card.py +19 -7
- reflex/components/radix/themes/components/hover_card.pyi +102 -67
- reflex/components/radix/themes/components/icon_button.pyi +18 -21
- reflex/components/radix/themes/components/inset.py +1 -3
- reflex/components/radix/themes/components/inset.pyi +17 -17
- reflex/components/radix/themes/components/popover.py +22 -13
- reflex/components/radix/themes/components/popover.pyi +98 -72
- reflex/components/radix/themes/components/progress.pyi +17 -17
- reflex/components/radix/themes/components/radio.pyi +17 -17
- reflex/components/radix/themes/components/radio_cards.py +2 -2
- reflex/components/radix/themes/components/radio_cards.pyi +37 -34
- reflex/components/radix/themes/components/radio_group.py +3 -7
- reflex/components/radix/themes/components/radio_group.pyi +69 -66
- reflex/components/radix/themes/components/scroll_area.py +1 -3
- reflex/components/radix/themes/components/scroll_area.pyi +17 -17
- reflex/components/radix/themes/components/segmented_control.pyi +37 -34
- reflex/components/radix/themes/components/select.py +7 -11
- reflex/components/radix/themes/components/select.pyi +175 -154
- reflex/components/radix/themes/components/separator.py +1 -4
- reflex/components/radix/themes/components/separator.pyi +17 -17
- reflex/components/radix/themes/components/skeleton.pyi +17 -17
- reflex/components/radix/themes/components/slider.py +12 -21
- reflex/components/radix/themes/components/slider.pyi +47 -25
- reflex/components/radix/themes/components/spinner.py +1 -4
- reflex/components/radix/themes/components/spinner.pyi +17 -17
- reflex/components/radix/themes/components/switch.py +3 -6
- reflex/components/radix/themes/components/switch.pyi +21 -18
- reflex/components/radix/themes/components/table.py +21 -5
- reflex/components/radix/themes/components/table.pyi +392 -116
- reflex/components/radix/themes/components/tabs.py +3 -6
- reflex/components/radix/themes/components/tabs.pyi +89 -83
- reflex/components/radix/themes/components/text_area.py +1 -5
- reflex/components/radix/themes/components/text_area.pyi +43 -20
- reflex/components/radix/themes/components/text_field.py +1 -5
- reflex/components/radix/themes/components/text_field.pyi +101 -55
- reflex/components/radix/themes/components/tooltip.py +5 -7
- reflex/components/radix/themes/components/tooltip.pyi +25 -22
- reflex/components/radix/themes/layout/base.py +2 -27
- reflex/components/radix/themes/layout/base.pyi +82 -82
- reflex/components/radix/themes/layout/box.pyi +17 -17
- reflex/components/radix/themes/layout/center.pyi +17 -17
- reflex/components/radix/themes/layout/container.pyi +17 -17
- reflex/components/radix/themes/layout/flex.py +1 -6
- reflex/components/radix/themes/layout/flex.pyi +17 -17
- reflex/components/radix/themes/layout/grid.py +1 -6
- reflex/components/radix/themes/layout/grid.pyi +17 -17
- reflex/components/radix/themes/layout/list.py +20 -15
- reflex/components/radix/themes/layout/list.pyi +175 -92
- reflex/components/radix/themes/layout/section.pyi +17 -17
- reflex/components/radix/themes/layout/spacer.pyi +17 -17
- reflex/components/radix/themes/layout/stack.py +6 -6
- reflex/components/radix/themes/layout/stack.pyi +91 -62
- reflex/components/radix/themes/typography/blockquote.py +2 -8
- reflex/components/radix/themes/typography/blockquote.pyi +17 -17
- reflex/components/radix/themes/typography/code.py +4 -10
- reflex/components/radix/themes/typography/code.pyi +19 -18
- reflex/components/radix/themes/typography/heading.py +4 -11
- reflex/components/radix/themes/typography/heading.pyi +19 -18
- reflex/components/radix/themes/typography/link.py +4 -10
- reflex/components/radix/themes/typography/link.pyi +19 -18
- reflex/components/radix/themes/typography/text.py +4 -11
- reflex/components/radix/themes/typography/text.pyi +115 -114
- reflex/components/react_player/audio.pyi +58 -33
- reflex/components/react_player/react_player.py +17 -17
- reflex/components/react_player/react_player.pyi +55 -33
- reflex/components/react_player/video.pyi +58 -33
- reflex/components/recharts/cartesian.py +45 -45
- reflex/components/recharts/cartesian.pyi +389 -304
- reflex/components/recharts/charts.py +22 -22
- reflex/components/recharts/charts.pyi +226 -179
- reflex/components/recharts/general.py +26 -27
- reflex/components/recharts/general.pyi +106 -99
- reflex/components/recharts/polar.py +33 -33
- reflex/components/recharts/polar.pyi +70 -64
- reflex/components/recharts/recharts.pyi +33 -33
- reflex/components/sonner/toast.py +9 -36
- reflex/components/sonner/toast.pyi +20 -24
- reflex/components/suneditor/editor.py +8 -8
- reflex/components/suneditor/editor.pyi +50 -25
- reflex/components/tags/iter_tag.py +1 -10
- reflex/components/tags/tag.py +1 -4
- reflex/config.py +198 -35
- reflex/constants/__init__.py +4 -16
- reflex/constants/base.py +7 -14
- reflex/constants/colors.py +0 -1
- reflex/constants/installer.py +12 -7
- reflex/constants/state.py +4 -0
- reflex/custom_components/custom_components.py +6 -6
- reflex/event.py +486 -241
- reflex/experimental/client_state.py +9 -9
- reflex/experimental/layout.py +2 -2
- reflex/experimental/layout.pyi +95 -87
- reflex/experimental/misc.py +1 -1
- reflex/istate/__init__.py +1 -0
- reflex/istate/proxy.py +33 -0
- reflex/istate/wrappers.py +27 -0
- reflex/model.py +7 -7
- reflex/page.py +2 -1
- reflex/reflex.py +142 -8
- reflex/state.py +127 -46
- reflex/testing.py +9 -7
- reflex/utils/console.py +0 -1
- reflex/utils/exceptions.py +31 -3
- reflex/utils/exec.py +33 -14
- reflex/utils/format.py +15 -12
- reflex/utils/net.py +1 -1
- reflex/utils/path_ops.py +2 -2
- reflex/utils/prerequisites.py +82 -46
- reflex/utils/pyi_generator.py +63 -20
- reflex/utils/registry.py +1 -1
- reflex/utils/serializers.py +75 -36
- reflex/utils/telemetry.py +3 -2
- reflex/utils/types.py +125 -10
- reflex/vars/base.py +131 -119
- reflex/vars/function.py +59 -12
- reflex/vars/number.py +3 -1
- reflex/vars/object.py +30 -24
- reflex/vars/sequence.py +7 -7
- {reflex-0.6.4a3.dist-info → reflex-0.6.5a1.dist-info}/METADATA +3 -3
- reflex-0.6.5a1.dist-info/RECORD +394 -0
- reflex-0.6.4a3.dist-info/RECORD +0 -391
- {reflex-0.6.4a3.dist-info → reflex-0.6.5a1.dist-info}/LICENSE +0 -0
- {reflex-0.6.4a3.dist-info → reflex-0.6.5a1.dist-info}/WHEEL +0 -0
- {reflex-0.6.4a3.dist-info → reflex-0.6.5a1.dist-info}/entry_points.txt +0 -0
|
@@ -8,11 +8,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Union, overload
|
|
|
8
8
|
|
|
9
9
|
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
|
10
10
|
from reflex.constants import Dirs
|
|
11
|
-
from reflex.event import
|
|
12
|
-
CallableEventSpec,
|
|
13
|
-
EventSpec,
|
|
14
|
-
EventType,
|
|
15
|
-
)
|
|
11
|
+
from reflex.event import BASE_STATE, CallableEventSpec, EventSpec, EventType
|
|
16
12
|
from reflex.style import Style
|
|
17
13
|
from reflex.utils.imports import ImportVar
|
|
18
14
|
from reflex.vars import VarData
|
|
@@ -53,22 +49,22 @@ class UploadFilesProvider(Component):
|
|
|
53
49
|
id: Optional[Any] = None,
|
|
54
50
|
class_name: Optional[Any] = None,
|
|
55
51
|
autofocus: Optional[bool] = None,
|
|
56
|
-
custom_attrs: Optional[Dict[str, Union[Var,
|
|
57
|
-
on_blur: Optional[EventType[[]]] = None,
|
|
58
|
-
on_click: Optional[EventType[[]]] = None,
|
|
59
|
-
on_context_menu: Optional[EventType[[]]] = None,
|
|
60
|
-
on_double_click: Optional[EventType[[]]] = None,
|
|
61
|
-
on_focus: Optional[EventType[[]]] = None,
|
|
62
|
-
on_mount: Optional[EventType[[]]] = None,
|
|
63
|
-
on_mouse_down: Optional[EventType[[]]] = None,
|
|
64
|
-
on_mouse_enter: Optional[EventType[[]]] = None,
|
|
65
|
-
on_mouse_leave: Optional[EventType[[]]] = None,
|
|
66
|
-
on_mouse_move: Optional[EventType[[]]] = None,
|
|
67
|
-
on_mouse_out: Optional[EventType[[]]] = None,
|
|
68
|
-
on_mouse_over: Optional[EventType[[]]] = None,
|
|
69
|
-
on_mouse_up: Optional[EventType[[]]] = None,
|
|
70
|
-
on_scroll: Optional[EventType[[]]] = None,
|
|
71
|
-
on_unmount: Optional[EventType[[]]] = None,
|
|
52
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
53
|
+
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
|
54
|
+
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
55
|
+
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
|
56
|
+
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
57
|
+
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
|
58
|
+
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
|
59
|
+
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
|
60
|
+
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
61
|
+
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
62
|
+
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
63
|
+
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
64
|
+
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
65
|
+
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
66
|
+
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
67
|
+
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
72
68
|
**props,
|
|
73
69
|
) -> "UploadFilesProvider":
|
|
74
70
|
"""Create the component.
|
|
@@ -110,23 +106,25 @@ class Upload(MemoizationLeaf):
|
|
|
110
106
|
id: Optional[Any] = None,
|
|
111
107
|
class_name: Optional[Any] = None,
|
|
112
108
|
autofocus: Optional[bool] = None,
|
|
113
|
-
custom_attrs: Optional[Dict[str, Union[Var,
|
|
114
|
-
on_blur: Optional[EventType[[]]] = None,
|
|
115
|
-
on_click: Optional[EventType[[]]] = None,
|
|
116
|
-
on_context_menu: Optional[EventType[[]]] = None,
|
|
117
|
-
on_double_click: Optional[EventType[[]]] = None,
|
|
118
|
-
on_drop: Optional[
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
109
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
110
|
+
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
|
111
|
+
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
112
|
+
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
|
113
|
+
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
114
|
+
on_drop: Optional[
|
|
115
|
+
Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
|
|
116
|
+
] = None,
|
|
117
|
+
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
|
118
|
+
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
|
119
|
+
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
|
120
|
+
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
121
|
+
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
122
|
+
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
123
|
+
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
124
|
+
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
125
|
+
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
126
|
+
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
127
|
+
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
130
128
|
**props,
|
|
131
129
|
) -> "Upload":
|
|
132
130
|
"""Create an upload component.
|
|
@@ -142,6 +140,7 @@ class Upload(MemoizationLeaf):
|
|
|
142
140
|
no_click: Whether to disable click to upload.
|
|
143
141
|
no_drag: Whether to disable drag and drop.
|
|
144
142
|
no_keyboard: Whether to disable using the space/enter keys to upload.
|
|
143
|
+
on_drop: Fired when files are dropped.
|
|
145
144
|
style: The style of the component.
|
|
146
145
|
key: A unique key for the component.
|
|
147
146
|
id: The id for the component.
|
|
@@ -175,23 +174,25 @@ class StyledUpload(Upload):
|
|
|
175
174
|
id: Optional[Any] = None,
|
|
176
175
|
class_name: Optional[Any] = None,
|
|
177
176
|
autofocus: Optional[bool] = None,
|
|
178
|
-
custom_attrs: Optional[Dict[str, Union[Var,
|
|
179
|
-
on_blur: Optional[EventType[[]]] = None,
|
|
180
|
-
on_click: Optional[EventType[[]]] = None,
|
|
181
|
-
on_context_menu: Optional[EventType[[]]] = None,
|
|
182
|
-
on_double_click: Optional[EventType[[]]] = None,
|
|
183
|
-
on_drop: Optional[
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
177
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
178
|
+
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
|
179
|
+
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
180
|
+
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
|
181
|
+
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
182
|
+
on_drop: Optional[
|
|
183
|
+
Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
|
|
184
|
+
] = None,
|
|
185
|
+
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
|
186
|
+
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
|
187
|
+
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
|
188
|
+
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
189
|
+
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
190
|
+
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
191
|
+
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
192
|
+
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
193
|
+
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
194
|
+
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
195
|
+
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
195
196
|
**props,
|
|
196
197
|
) -> "StyledUpload":
|
|
197
198
|
"""Create the styled upload component.
|
|
@@ -207,6 +208,7 @@ class StyledUpload(Upload):
|
|
|
207
208
|
no_click: Whether to disable click to upload.
|
|
208
209
|
no_drag: Whether to disable drag and drop.
|
|
209
210
|
no_keyboard: Whether to disable using the space/enter keys to upload.
|
|
211
|
+
on_drop: Fired when files are dropped.
|
|
210
212
|
style: The style of the component.
|
|
211
213
|
key: A unique key for the component.
|
|
212
214
|
id: The id for the component.
|
|
@@ -240,23 +242,25 @@ class UploadNamespace(ComponentNamespace):
|
|
|
240
242
|
id: Optional[Any] = None,
|
|
241
243
|
class_name: Optional[Any] = None,
|
|
242
244
|
autofocus: Optional[bool] = None,
|
|
243
|
-
custom_attrs: Optional[Dict[str, Union[Var,
|
|
244
|
-
on_blur: Optional[EventType[[]]] = None,
|
|
245
|
-
on_click: Optional[EventType[[]]] = None,
|
|
246
|
-
on_context_menu: Optional[EventType[[]]] = None,
|
|
247
|
-
on_double_click: Optional[EventType[[]]] = None,
|
|
248
|
-
on_drop: Optional[
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
245
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
246
|
+
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
|
247
|
+
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
248
|
+
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
|
249
|
+
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
250
|
+
on_drop: Optional[
|
|
251
|
+
Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
|
|
252
|
+
] = None,
|
|
253
|
+
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
|
254
|
+
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
|
255
|
+
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
|
256
|
+
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
257
|
+
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
258
|
+
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
259
|
+
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
260
|
+
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
261
|
+
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
262
|
+
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
263
|
+
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
260
264
|
**props,
|
|
261
265
|
) -> "StyledUpload":
|
|
262
266
|
"""Create the styled upload component.
|
|
@@ -272,6 +276,7 @@ class UploadNamespace(ComponentNamespace):
|
|
|
272
276
|
no_click: Whether to disable click to upload.
|
|
273
277
|
no_drag: Whether to disable drag and drop.
|
|
274
278
|
no_keyboard: Whether to disable using the space/enter keys to upload.
|
|
279
|
+
on_drop: Fired when files are dropped.
|
|
275
280
|
style: The style of the component.
|
|
276
281
|
key: A unique key for the component.
|
|
277
282
|
id: The id for the component.
|
|
@@ -8,13 +8,14 @@ from typing import ClassVar, Dict, Literal, Optional, Union
|
|
|
8
8
|
from reflex.components.component import Component, ComponentNamespace
|
|
9
9
|
from reflex.components.core.cond import color_mode_cond
|
|
10
10
|
from reflex.components.lucide.icon import Icon
|
|
11
|
+
from reflex.components.markdown.markdown import _LANGUAGE, MarkdownComponentMap
|
|
11
12
|
from reflex.components.radix.themes.components.button import Button
|
|
12
13
|
from reflex.components.radix.themes.layout.box import Box
|
|
13
14
|
from reflex.constants.colors import Color
|
|
14
15
|
from reflex.event import set_clipboard
|
|
15
16
|
from reflex.style import Style
|
|
16
17
|
from reflex.utils import console, format
|
|
17
|
-
from reflex.utils.imports import
|
|
18
|
+
from reflex.utils.imports import ImportVar
|
|
18
19
|
from reflex.vars.base import LiteralVar, Var, VarData
|
|
19
20
|
|
|
20
21
|
LiteralCodeLanguage = Literal[
|
|
@@ -378,7 +379,7 @@ for theme_name in dir(Theme):
|
|
|
378
379
|
setattr(Theme, theme_name, getattr(Theme, theme_name)._replace(_var_type=Theme))
|
|
379
380
|
|
|
380
381
|
|
|
381
|
-
class CodeBlock(Component):
|
|
382
|
+
class CodeBlock(Component, MarkdownComponentMap):
|
|
382
383
|
"""A code block."""
|
|
383
384
|
|
|
384
385
|
library = "react-syntax-highlighter@15.6.1"
|
|
@@ -391,7 +392,7 @@ class CodeBlock(Component):
|
|
|
391
392
|
theme: Var[Union[Theme, str]] = Theme.one_light
|
|
392
393
|
|
|
393
394
|
# The language to use.
|
|
394
|
-
language: Var[LiteralCodeLanguage] = "python"
|
|
395
|
+
language: Var[LiteralCodeLanguage] = Var.create("python")
|
|
395
396
|
|
|
396
397
|
# The code to display.
|
|
397
398
|
code: Var[str]
|
|
@@ -411,53 +412,22 @@ class CodeBlock(Component):
|
|
|
411
412
|
# Props passed down to the code tag.
|
|
412
413
|
code_tag_props: Var[Dict[str, str]]
|
|
413
414
|
|
|
414
|
-
|
|
415
|
-
|
|
415
|
+
# Whether a copy button should appear.
|
|
416
|
+
can_copy: Optional[bool] = False
|
|
416
417
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
"""
|
|
420
|
-
imports_: ImportDict = {}
|
|
421
|
-
|
|
422
|
-
if (
|
|
423
|
-
self.language is not None
|
|
424
|
-
and (language_without_quotes := str(self.language).replace('"', ""))
|
|
425
|
-
in LiteralCodeLanguage.__args__ # type: ignore
|
|
426
|
-
):
|
|
427
|
-
imports_[
|
|
428
|
-
f"react-syntax-highlighter/dist/cjs/languages/prism/{language_without_quotes}"
|
|
429
|
-
] = [
|
|
430
|
-
ImportVar(
|
|
431
|
-
tag=format.to_camel_case(language_without_quotes),
|
|
432
|
-
is_default=True,
|
|
433
|
-
install=False,
|
|
434
|
-
)
|
|
435
|
-
]
|
|
436
|
-
|
|
437
|
-
return imports_
|
|
438
|
-
|
|
439
|
-
def _get_custom_code(self) -> Optional[str]:
|
|
440
|
-
if (
|
|
441
|
-
self.language is not None
|
|
442
|
-
and (language_without_quotes := str(self.language).replace('"', ""))
|
|
443
|
-
in LiteralCodeLanguage.__args__ # type: ignore
|
|
444
|
-
):
|
|
445
|
-
return f"{self.alias}.registerLanguage('{language_without_quotes}', {format.to_camel_case(language_without_quotes)})"
|
|
418
|
+
# A custom copy button to override the default one.
|
|
419
|
+
copy_button: Optional[Union[bool, Component]] = None
|
|
446
420
|
|
|
447
421
|
@classmethod
|
|
448
422
|
def create(
|
|
449
423
|
cls,
|
|
450
424
|
*children,
|
|
451
|
-
can_copy: Optional[bool] = False,
|
|
452
|
-
copy_button: Optional[Union[bool, Component]] = None,
|
|
453
425
|
**props,
|
|
454
426
|
):
|
|
455
427
|
"""Create a text component.
|
|
456
428
|
|
|
457
429
|
Args:
|
|
458
430
|
*children: The children of the component.
|
|
459
|
-
can_copy: Whether a copy button should appears.
|
|
460
|
-
copy_button: A custom copy button to override the default one.
|
|
461
431
|
**props: The props to pass to the component.
|
|
462
432
|
|
|
463
433
|
Returns:
|
|
@@ -465,6 +435,8 @@ class CodeBlock(Component):
|
|
|
465
435
|
"""
|
|
466
436
|
# This component handles style in a special prop.
|
|
467
437
|
custom_style = props.pop("custom_style", {})
|
|
438
|
+
can_copy = props.pop("can_copy", False)
|
|
439
|
+
copy_button = props.pop("copy_button", None)
|
|
468
440
|
|
|
469
441
|
if "theme" not in props:
|
|
470
442
|
# Default color scheme responds to global color mode.
|
|
@@ -530,12 +502,55 @@ class CodeBlock(Component):
|
|
|
530
502
|
|
|
531
503
|
theme = self.theme
|
|
532
504
|
|
|
533
|
-
out.add_props(style=theme).remove_props("theme", "code").add_props(
|
|
534
|
-
children=self.code
|
|
505
|
+
out.add_props(style=theme).remove_props("theme", "code", "language").add_props(
|
|
506
|
+
children=self.code, language=_LANGUAGE
|
|
535
507
|
)
|
|
536
508
|
|
|
537
509
|
return out
|
|
538
510
|
|
|
511
|
+
def _exclude_props(self) -> list[str]:
|
|
512
|
+
return ["can_copy", "copy_button"]
|
|
513
|
+
|
|
514
|
+
@classmethod
|
|
515
|
+
def _get_language_registration_hook(cls) -> str:
|
|
516
|
+
"""Get the hook to register the language.
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
The hook to register the language.
|
|
520
|
+
"""
|
|
521
|
+
return f"""
|
|
522
|
+
if ({str(_LANGUAGE)}) {{
|
|
523
|
+
(async () => {{
|
|
524
|
+
try {{
|
|
525
|
+
const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${{{str(_LANGUAGE)}}}`);
|
|
526
|
+
SyntaxHighlighter.registerLanguage({str(_LANGUAGE)}, module.default);
|
|
527
|
+
}} catch (error) {{
|
|
528
|
+
console.error(`Error importing language module for ${{{str(_LANGUAGE)}}}:`, error);
|
|
529
|
+
}}
|
|
530
|
+
}})();
|
|
531
|
+
}}
|
|
532
|
+
"""
|
|
533
|
+
|
|
534
|
+
@classmethod
|
|
535
|
+
def get_component_map_custom_code(cls) -> str:
|
|
536
|
+
"""Get the custom code for the component.
|
|
537
|
+
|
|
538
|
+
Returns:
|
|
539
|
+
The custom code for the component.
|
|
540
|
+
"""
|
|
541
|
+
return cls._get_language_registration_hook()
|
|
542
|
+
|
|
543
|
+
def add_hooks(self) -> list[str | Var]:
|
|
544
|
+
"""Add hooks for the component.
|
|
545
|
+
|
|
546
|
+
Returns:
|
|
547
|
+
The hooks for the component.
|
|
548
|
+
"""
|
|
549
|
+
return [
|
|
550
|
+
f"const {str(_LANGUAGE)} = {str(self.language)}",
|
|
551
|
+
self._get_language_registration_hook(),
|
|
552
|
+
]
|
|
553
|
+
|
|
539
554
|
|
|
540
555
|
class CodeblockNamespace(ComponentNamespace):
|
|
541
556
|
"""Namespace for the CodeBlock component."""
|
|
@@ -7,10 +7,10 @@ import dataclasses
|
|
|
7
7
|
from typing import Any, ClassVar, Dict, Literal, Optional, Union, overload
|
|
8
8
|
|
|
9
9
|
from reflex.components.component import Component, ComponentNamespace
|
|
10
|
+
from reflex.components.markdown.markdown import MarkdownComponentMap
|
|
10
11
|
from reflex.constants.colors import Color
|
|
11
|
-
from reflex.event import EventType
|
|
12
|
+
from reflex.event import BASE_STATE, EventType
|
|
12
13
|
from reflex.style import Style
|
|
13
|
-
from reflex.utils.imports import ImportDict
|
|
14
14
|
from reflex.vars.base import Var
|
|
15
15
|
|
|
16
16
|
LiteralCodeLanguage = Literal[
|
|
@@ -349,15 +349,12 @@ for theme_name in dir(Theme):
|
|
|
349
349
|
continue
|
|
350
350
|
setattr(Theme, theme_name, getattr(Theme, theme_name)._replace(_var_type=Theme))
|
|
351
351
|
|
|
352
|
-
class CodeBlock(Component):
|
|
353
|
-
def add_imports(self) -> ImportDict: ...
|
|
352
|
+
class CodeBlock(Component, MarkdownComponentMap):
|
|
354
353
|
@overload
|
|
355
354
|
@classmethod
|
|
356
355
|
def create( # type: ignore
|
|
357
356
|
cls,
|
|
358
357
|
*children,
|
|
359
|
-
can_copy: Optional[bool] = False,
|
|
360
|
-
copy_button: Optional[Union[Component, bool]] = None,
|
|
361
358
|
theme: Optional[Union[Theme, Var[Union[Theme, str]], str]] = None,
|
|
362
359
|
language: Optional[
|
|
363
360
|
Union[
|
|
@@ -933,35 +930,35 @@ class CodeBlock(Component):
|
|
|
933
930
|
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
|
|
934
931
|
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
|
|
935
932
|
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
|
|
933
|
+
can_copy: Optional[bool] = None,
|
|
934
|
+
copy_button: Optional[Union[Component, bool]] = None,
|
|
936
935
|
style: Optional[Style] = None,
|
|
937
936
|
key: Optional[Any] = None,
|
|
938
937
|
id: Optional[Any] = None,
|
|
939
938
|
class_name: Optional[Any] = None,
|
|
940
939
|
autofocus: Optional[bool] = None,
|
|
941
|
-
custom_attrs: Optional[Dict[str, Union[Var,
|
|
942
|
-
on_blur: Optional[EventType[[]]] = None,
|
|
943
|
-
on_click: Optional[EventType[[]]] = None,
|
|
944
|
-
on_context_menu: Optional[EventType[[]]] = None,
|
|
945
|
-
on_double_click: Optional[EventType[[]]] = None,
|
|
946
|
-
on_focus: Optional[EventType[[]]] = None,
|
|
947
|
-
on_mount: Optional[EventType[[]]] = None,
|
|
948
|
-
on_mouse_down: Optional[EventType[[]]] = None,
|
|
949
|
-
on_mouse_enter: Optional[EventType[[]]] = None,
|
|
950
|
-
on_mouse_leave: Optional[EventType[[]]] = None,
|
|
951
|
-
on_mouse_move: Optional[EventType[[]]] = None,
|
|
952
|
-
on_mouse_out: Optional[EventType[[]]] = None,
|
|
953
|
-
on_mouse_over: Optional[EventType[[]]] = None,
|
|
954
|
-
on_mouse_up: Optional[EventType[[]]] = None,
|
|
955
|
-
on_scroll: Optional[EventType[[]]] = None,
|
|
956
|
-
on_unmount: Optional[EventType[[]]] = None,
|
|
940
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
941
|
+
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
|
942
|
+
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
943
|
+
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
|
944
|
+
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
945
|
+
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
|
946
|
+
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
|
947
|
+
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
|
948
|
+
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
949
|
+
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
950
|
+
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
951
|
+
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
952
|
+
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
953
|
+
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
954
|
+
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
955
|
+
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
957
956
|
**props,
|
|
958
957
|
) -> "CodeBlock":
|
|
959
958
|
"""Create a text component.
|
|
960
959
|
|
|
961
960
|
Args:
|
|
962
961
|
*children: The children of the component.
|
|
963
|
-
can_copy: Whether a copy button should appears.
|
|
964
|
-
copy_button: A custom copy button to override the default one.
|
|
965
962
|
theme: The theme to use ("light" or "dark").
|
|
966
963
|
language: The language to use.
|
|
967
964
|
code: The code to display.
|
|
@@ -970,6 +967,8 @@ class CodeBlock(Component):
|
|
|
970
967
|
wrap_long_lines: Whether to wrap long lines.
|
|
971
968
|
custom_style: A custom style for the code block.
|
|
972
969
|
code_tag_props: Props passed down to the code tag.
|
|
970
|
+
can_copy: Whether a copy button should appear.
|
|
971
|
+
copy_button: A custom copy button to override the default one.
|
|
973
972
|
style: The style of the component.
|
|
974
973
|
key: A unique key for the component.
|
|
975
974
|
id: The id for the component.
|
|
@@ -984,6 +983,9 @@ class CodeBlock(Component):
|
|
|
984
983
|
...
|
|
985
984
|
|
|
986
985
|
def add_style(self): ...
|
|
986
|
+
@classmethod
|
|
987
|
+
def get_component_map_custom_code(cls) -> str: ...
|
|
988
|
+
def add_hooks(self) -> list[str | Var]: ...
|
|
987
989
|
|
|
988
990
|
class CodeblockNamespace(ComponentNamespace):
|
|
989
991
|
themes = Theme
|
|
@@ -991,8 +993,6 @@ class CodeblockNamespace(ComponentNamespace):
|
|
|
991
993
|
@staticmethod
|
|
992
994
|
def __call__(
|
|
993
995
|
*children,
|
|
994
|
-
can_copy: Optional[bool] = False,
|
|
995
|
-
copy_button: Optional[Union[Component, bool]] = None,
|
|
996
996
|
theme: Optional[Union[Theme, Var[Union[Theme, str]], str]] = None,
|
|
997
997
|
language: Optional[
|
|
998
998
|
Union[
|
|
@@ -1568,35 +1568,35 @@ class CodeblockNamespace(ComponentNamespace):
|
|
|
1568
1568
|
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
|
|
1569
1569
|
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
|
|
1570
1570
|
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
|
|
1571
|
+
can_copy: Optional[bool] = None,
|
|
1572
|
+
copy_button: Optional[Union[Component, bool]] = None,
|
|
1571
1573
|
style: Optional[Style] = None,
|
|
1572
1574
|
key: Optional[Any] = None,
|
|
1573
1575
|
id: Optional[Any] = None,
|
|
1574
1576
|
class_name: Optional[Any] = None,
|
|
1575
1577
|
autofocus: Optional[bool] = None,
|
|
1576
|
-
custom_attrs: Optional[Dict[str, Union[Var,
|
|
1577
|
-
on_blur: Optional[EventType[[]]] = None,
|
|
1578
|
-
on_click: Optional[EventType[[]]] = None,
|
|
1579
|
-
on_context_menu: Optional[EventType[[]]] = None,
|
|
1580
|
-
on_double_click: Optional[EventType[[]]] = None,
|
|
1581
|
-
on_focus: Optional[EventType[[]]] = None,
|
|
1582
|
-
on_mount: Optional[EventType[[]]] = None,
|
|
1583
|
-
on_mouse_down: Optional[EventType[[]]] = None,
|
|
1584
|
-
on_mouse_enter: Optional[EventType[[]]] = None,
|
|
1585
|
-
on_mouse_leave: Optional[EventType[[]]] = None,
|
|
1586
|
-
on_mouse_move: Optional[EventType[[]]] = None,
|
|
1587
|
-
on_mouse_out: Optional[EventType[[]]] = None,
|
|
1588
|
-
on_mouse_over: Optional[EventType[[]]] = None,
|
|
1589
|
-
on_mouse_up: Optional[EventType[[]]] = None,
|
|
1590
|
-
on_scroll: Optional[EventType[[]]] = None,
|
|
1591
|
-
on_unmount: Optional[EventType[[]]] = None,
|
|
1578
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
1579
|
+
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
|
1580
|
+
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
1581
|
+
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
|
1582
|
+
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
|
1583
|
+
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
|
1584
|
+
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
|
1585
|
+
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
|
1586
|
+
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
|
1587
|
+
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
|
1588
|
+
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
|
1589
|
+
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
|
1590
|
+
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
|
1591
|
+
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
|
1592
|
+
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
1593
|
+
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
1592
1594
|
**props,
|
|
1593
1595
|
) -> "CodeBlock":
|
|
1594
1596
|
"""Create a text component.
|
|
1595
1597
|
|
|
1596
1598
|
Args:
|
|
1597
1599
|
*children: The children of the component.
|
|
1598
|
-
can_copy: Whether a copy button should appears.
|
|
1599
|
-
copy_button: A custom copy button to override the default one.
|
|
1600
1600
|
theme: The theme to use ("light" or "dark").
|
|
1601
1601
|
language: The language to use.
|
|
1602
1602
|
code: The code to display.
|
|
@@ -1605,6 +1605,8 @@ class CodeblockNamespace(ComponentNamespace):
|
|
|
1605
1605
|
wrap_long_lines: Whether to wrap long lines.
|
|
1606
1606
|
custom_style: A custom style for the code block.
|
|
1607
1607
|
code_tag_props: Props passed down to the code tag.
|
|
1608
|
+
can_copy: Whether a copy button should appear.
|
|
1609
|
+
copy_button: A custom copy button to override the default one.
|
|
1608
1610
|
style: The style of the component.
|
|
1609
1611
|
key: A unique key for the component.
|
|
1610
1612
|
id: The id for the component.
|
|
@@ -10,7 +10,7 @@ from typing_extensions import TypedDict
|
|
|
10
10
|
from reflex.base import Base
|
|
11
11
|
from reflex.components.component import Component, NoSSRComponent
|
|
12
12
|
from reflex.components.literals import LiteralRowMarker
|
|
13
|
-
from reflex.event import EventHandler,
|
|
13
|
+
from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
|
|
14
14
|
from reflex.utils import console, format, types
|
|
15
15
|
from reflex.utils.imports import ImportDict, ImportVar
|
|
16
16
|
from reflex.utils.serializers import serializer
|
|
@@ -189,7 +189,6 @@ class DataEditor(NoSSRComponent):
|
|
|
189
189
|
library: str = "@glideapps/glide-data-grid@^6.0.3"
|
|
190
190
|
lib_dependencies: List[str] = [
|
|
191
191
|
"lodash@^4.17.21",
|
|
192
|
-
"marked@^14.1.2",
|
|
193
192
|
"react-responsive-carousel@^3.2.7",
|
|
194
193
|
]
|
|
195
194
|
|
|
@@ -206,7 +205,7 @@ class DataEditor(NoSSRComponent):
|
|
|
206
205
|
get_cell_content: Var[str]
|
|
207
206
|
|
|
208
207
|
# Allow selection for copying.
|
|
209
|
-
|
|
208
|
+
get_cells_for_selection: Var[bool]
|
|
210
209
|
|
|
211
210
|
# Allow paste.
|
|
212
211
|
on_paste: Var[bool]
|
|
@@ -284,56 +283,58 @@ class DataEditor(NoSSRComponent):
|
|
|
284
283
|
theme: Var[Union[DataEditorTheme, Dict]]
|
|
285
284
|
|
|
286
285
|
# Fired when a cell is activated.
|
|
287
|
-
on_cell_activated: EventHandler[
|
|
286
|
+
on_cell_activated: EventHandler[passthrough_event_spec(Tuple[int, int])]
|
|
288
287
|
|
|
289
288
|
# Fired when a cell is clicked.
|
|
290
|
-
on_cell_clicked: EventHandler[
|
|
289
|
+
on_cell_clicked: EventHandler[passthrough_event_spec(Tuple[int, int])]
|
|
291
290
|
|
|
292
291
|
# Fired when a cell is right-clicked.
|
|
293
|
-
on_cell_context_menu: EventHandler[
|
|
292
|
+
on_cell_context_menu: EventHandler[passthrough_event_spec(Tuple[int, int])]
|
|
294
293
|
|
|
295
294
|
# Fired when a cell is edited.
|
|
296
|
-
on_cell_edited: EventHandler[
|
|
295
|
+
on_cell_edited: EventHandler[passthrough_event_spec(Tuple[int, int], GridCell)]
|
|
297
296
|
|
|
298
297
|
# Fired when a group header is clicked.
|
|
299
|
-
on_group_header_clicked: EventHandler[
|
|
298
|
+
on_group_header_clicked: EventHandler[
|
|
299
|
+
passthrough_event_spec(Tuple[int, int], GridCell)
|
|
300
|
+
]
|
|
300
301
|
|
|
301
302
|
# Fired when a group header is right-clicked.
|
|
302
303
|
on_group_header_context_menu: EventHandler[
|
|
303
|
-
|
|
304
|
+
passthrough_event_spec(int, GroupHeaderClickedEventArgs)
|
|
304
305
|
]
|
|
305
306
|
|
|
306
307
|
# Fired when a group header is renamed.
|
|
307
|
-
on_group_header_renamed: EventHandler[
|
|
308
|
+
on_group_header_renamed: EventHandler[passthrough_event_spec(str, str)]
|
|
308
309
|
|
|
309
310
|
# Fired when a header is clicked.
|
|
310
|
-
on_header_clicked: EventHandler[
|
|
311
|
+
on_header_clicked: EventHandler[passthrough_event_spec(Tuple[int, int])]
|
|
311
312
|
|
|
312
313
|
# Fired when a header is right-clicked.
|
|
313
|
-
on_header_context_menu: EventHandler[
|
|
314
|
+
on_header_context_menu: EventHandler[passthrough_event_spec(Tuple[int, int])]
|
|
314
315
|
|
|
315
316
|
# Fired when a header menu item is clicked.
|
|
316
|
-
on_header_menu_click: EventHandler[
|
|
317
|
+
on_header_menu_click: EventHandler[passthrough_event_spec(int, Rectangle)]
|
|
317
318
|
|
|
318
319
|
# Fired when an item is hovered.
|
|
319
|
-
on_item_hovered: EventHandler[
|
|
320
|
+
on_item_hovered: EventHandler[passthrough_event_spec(Tuple[int, int])]
|
|
320
321
|
|
|
321
322
|
# Fired when a selection is deleted.
|
|
322
|
-
on_delete: EventHandler[
|
|
323
|
+
on_delete: EventHandler[passthrough_event_spec(GridSelection)]
|
|
323
324
|
|
|
324
325
|
# Fired when editing is finished.
|
|
325
326
|
on_finished_editing: EventHandler[
|
|
326
|
-
|
|
327
|
+
passthrough_event_spec(Union[GridCell, None], tuple[int, int])
|
|
327
328
|
]
|
|
328
329
|
|
|
329
330
|
# Fired when a row is appended.
|
|
330
|
-
on_row_appended: EventHandler[
|
|
331
|
+
on_row_appended: EventHandler[no_args_event_spec]
|
|
331
332
|
|
|
332
333
|
# Fired when the selection is cleared.
|
|
333
|
-
on_selection_cleared: EventHandler[
|
|
334
|
+
on_selection_cleared: EventHandler[no_args_event_spec]
|
|
334
335
|
|
|
335
336
|
# Fired when a column is resized.
|
|
336
|
-
on_column_resize: EventHandler[
|
|
337
|
+
on_column_resize: EventHandler[passthrough_event_spec(GridColumn, int)]
|
|
337
338
|
|
|
338
339
|
def add_imports(self) -> ImportDict:
|
|
339
340
|
"""Add imports for the component.
|
|
@@ -424,7 +425,7 @@ class DataEditor(NoSSRComponent):
|
|
|
424
425
|
props["theme"] = DataEditorTheme(**theme)
|
|
425
426
|
|
|
426
427
|
# Allow by default to select a region of cells in the grid.
|
|
427
|
-
props.setdefault("
|
|
428
|
+
props.setdefault("get_cells_for_selection", True)
|
|
428
429
|
|
|
429
430
|
# Disable on_paste by default if not provided.
|
|
430
431
|
props.setdefault("on_paste", False)
|