reflex 0.5.10a3__py3-none-any.whl → 0.6.0a1__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.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +4 -4
- reflex/.templates/jinja/web/utils/context.js.jinja2 +1 -1
- reflex/.templates/jinja/web/utils/theme.js.jinja2 +1 -1
- reflex/__init__.py +3 -2
- reflex/__init__.pyi +2 -2
- reflex/app.py +43 -9
- reflex/base.py +3 -2
- reflex/compiler/compiler.py +6 -6
- reflex/compiler/utils.py +5 -3
- reflex/components/base/app_wrap.py +2 -4
- reflex/components/base/app_wrap.pyi +17 -17
- reflex/components/base/bare.py +7 -4
- reflex/components/base/body.pyi +17 -17
- reflex/components/base/document.pyi +81 -81
- reflex/components/base/error_boundary.py +10 -8
- reflex/components/base/error_boundary.pyi +20 -19
- reflex/components/base/fragment.pyi +17 -17
- reflex/components/base/head.pyi +33 -33
- reflex/components/base/link.pyi +34 -33
- reflex/components/base/meta.pyi +65 -65
- reflex/components/base/script.py +2 -1
- reflex/components/base/script.pyi +21 -20
- reflex/components/component.py +116 -145
- reflex/components/core/banner.py +59 -60
- reflex/components/core/banner.pyi +86 -150
- reflex/components/core/client_side_routing.py +2 -1
- reflex/components/core/client_side_routing.pyi +34 -33
- reflex/components/core/clipboard.py +2 -2
- reflex/components/core/clipboard.pyi +19 -18
- reflex/components/core/cond.py +21 -44
- reflex/components/core/debounce.py +6 -8
- reflex/components/core/debounce.pyi +19 -18
- reflex/components/core/foreach.py +5 -14
- reflex/components/core/html.pyi +18 -17
- reflex/components/core/match.py +36 -43
- reflex/components/core/upload.py +32 -25
- reflex/components/core/upload.pyi +84 -73
- reflex/components/datadisplay/code.py +55 -28
- reflex/components/datadisplay/code.pyi +20 -17
- reflex/components/datadisplay/dataeditor.py +17 -11
- reflex/components/datadisplay/dataeditor.pyi +34 -33
- reflex/components/el/__init__.py +0 -1
- reflex/components/el/__init__.pyi +0 -11
- reflex/components/el/element.pyi +17 -17
- reflex/components/el/elements/__init__.py +1 -7
- reflex/components/el/elements/__init__.pyi +1 -15
- reflex/components/el/elements/base.pyi +18 -17
- reflex/components/el/elements/forms.py +24 -31
- reflex/components/el/elements/forms.pyi +237 -236
- reflex/components/el/elements/inline.pyi +450 -449
- reflex/components/el/elements/media.py +0 -21
- reflex/components/el/elements/media.pyi +338 -337
- reflex/components/el/elements/metadata.py +3 -2
- reflex/components/el/elements/metadata.pyi +98 -97
- reflex/components/el/elements/other.pyi +114 -113
- reflex/components/el/elements/scripts.pyi +50 -49
- reflex/components/el/elements/sectioning.pyi +242 -241
- reflex/components/el/elements/tables.pyi +162 -161
- reflex/components/el/elements/typography.pyi +242 -241
- reflex/components/gridjs/datatable.py +13 -14
- reflex/components/gridjs/datatable.pyi +34 -33
- reflex/components/lucide/icon.py +2 -126
- reflex/components/lucide/icon.pyi +34 -142
- reflex/components/markdown/markdown.py +30 -35
- reflex/components/markdown/markdown.pyi +29 -32
- reflex/components/moment/moment.pyi +19 -18
- reflex/components/next/base.pyi +17 -17
- reflex/components/next/image.py +0 -4
- reflex/components/next/image.pyi +20 -19
- reflex/components/next/link.pyi +18 -17
- reflex/components/next/video.pyi +18 -17
- reflex/components/plotly/plotly.py +16 -28
- reflex/components/plotly/plotly.pyi +36 -35
- reflex/components/props.py +21 -10
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/__init__.pyi +0 -1
- reflex/components/radix/primitives/accordion.py +7 -8
- reflex/components/radix/primitives/accordion.pyi +117 -116
- reflex/components/radix/primitives/base.pyi +34 -33
- reflex/components/radix/primitives/drawer.pyi +169 -168
- reflex/components/radix/primitives/form.pyi +168 -167
- reflex/components/radix/primitives/progress.pyi +82 -81
- reflex/components/radix/primitives/slider.pyi +84 -83
- reflex/components/radix/themes/base.py +8 -4
- reflex/components/radix/themes/base.pyi +114 -113
- reflex/components/radix/themes/color_mode.py +12 -21
- reflex/components/radix/themes/color_mode.pyi +67 -67
- reflex/components/radix/themes/components/__init__.pyi +1 -0
- reflex/components/radix/themes/components/alert_dialog.pyi +118 -117
- reflex/components/radix/themes/components/aspect_ratio.pyi +18 -17
- reflex/components/radix/themes/components/avatar.pyi +18 -17
- reflex/components/radix/themes/components/badge.pyi +18 -17
- reflex/components/radix/themes/components/button.pyi +18 -17
- reflex/components/radix/themes/components/callout.pyi +82 -81
- reflex/components/radix/themes/components/card.pyi +18 -17
- reflex/components/radix/themes/components/checkbox.py +2 -3
- reflex/components/radix/themes/components/checkbox.pyi +53 -52
- reflex/components/radix/themes/components/checkbox_cards.pyi +34 -33
- reflex/components/radix/themes/components/checkbox_group.pyi +34 -33
- reflex/components/radix/themes/components/context_menu.pyi +140 -139
- reflex/components/radix/themes/components/data_list.py +5 -0
- reflex/components/radix/themes/components/data_list.pyi +71 -65
- reflex/components/radix/themes/components/dialog.pyi +121 -120
- reflex/components/radix/themes/components/dropdown_menu.pyi +142 -141
- reflex/components/radix/themes/components/hover_card.pyi +68 -67
- reflex/components/radix/themes/components/icon_button.py +2 -1
- reflex/components/radix/themes/components/icon_button.pyi +18 -17
- reflex/components/radix/themes/components/inset.pyi +18 -17
- reflex/components/radix/themes/components/popover.pyi +73 -72
- reflex/components/radix/themes/components/progress.pyi +18 -17
- reflex/components/radix/themes/components/radio.pyi +18 -17
- reflex/components/radix/themes/components/radio_cards.pyi +35 -34
- reflex/components/radix/themes/components/radio_group.py +35 -31
- reflex/components/radix/themes/components/radio_group.pyi +73 -66
- reflex/components/radix/themes/components/scroll_area.pyi +18 -17
- reflex/components/radix/themes/components/segmented_control.pyi +35 -34
- reflex/components/radix/themes/components/select.py +2 -1
- reflex/components/radix/themes/components/select.pyi +155 -154
- reflex/components/radix/themes/components/separator.py +2 -3
- reflex/components/radix/themes/components/separator.pyi +18 -17
- reflex/components/radix/themes/components/skeleton.pyi +18 -17
- reflex/components/radix/themes/components/slider.py +2 -1
- reflex/components/radix/themes/components/slider.pyi +20 -19
- reflex/components/radix/themes/components/spinner.pyi +18 -17
- reflex/components/radix/themes/components/switch.pyi +19 -18
- reflex/components/radix/themes/components/table.pyi +114 -113
- reflex/components/radix/themes/components/tabs.pyi +84 -83
- reflex/components/radix/themes/components/text_area.pyi +21 -20
- reflex/components/radix/themes/components/text_field.py +0 -79
- reflex/components/radix/themes/components/text_field.pyi +57 -63
- reflex/components/radix/themes/components/tooltip.pyi +21 -20
- reflex/components/radix/themes/layout/base.pyi +18 -17
- reflex/components/radix/themes/layout/box.pyi +18 -17
- reflex/components/radix/themes/layout/center.pyi +18 -17
- reflex/components/radix/themes/layout/container.py +2 -3
- reflex/components/radix/themes/layout/container.pyi +18 -17
- reflex/components/radix/themes/layout/flex.pyi +18 -17
- reflex/components/radix/themes/layout/grid.pyi +18 -17
- reflex/components/radix/themes/layout/list.py +5 -4
- reflex/components/radix/themes/layout/list.pyi +86 -85
- reflex/components/radix/themes/layout/section.py +2 -3
- reflex/components/radix/themes/layout/section.pyi +18 -17
- reflex/components/radix/themes/layout/spacer.pyi +18 -17
- reflex/components/radix/themes/layout/stack.pyi +50 -49
- reflex/components/radix/themes/typography/blockquote.pyi +18 -17
- reflex/components/radix/themes/typography/code.pyi +18 -17
- reflex/components/radix/themes/typography/heading.pyi +18 -17
- reflex/components/radix/themes/typography/link.pyi +18 -17
- reflex/components/radix/themes/typography/text.pyi +114 -113
- reflex/components/react_player/audio.pyi +34 -33
- reflex/components/react_player/react_player.pyi +34 -33
- reflex/components/react_player/video.pyi +34 -33
- reflex/components/recharts/cartesian.py +23 -19
- reflex/components/recharts/cartesian.pyi +297 -296
- reflex/components/recharts/charts.py +6 -5
- reflex/components/recharts/charts.pyi +179 -178
- reflex/components/recharts/general.py +8 -7
- reflex/components/recharts/general.pyi +82 -81
- reflex/components/recharts/polar.py +14 -13
- reflex/components/recharts/polar.pyi +76 -75
- reflex/components/recharts/recharts.pyi +33 -33
- reflex/components/sonner/toast.py +30 -33
- reflex/components/sonner/toast.pyi +27 -25
- reflex/components/suneditor/editor.py +2 -1
- reflex/components/suneditor/editor.pyi +27 -26
- reflex/components/tags/iter_tag.py +16 -16
- reflex/components/tags/tag.py +8 -10
- reflex/constants/base.py +3 -1
- reflex/constants/event.py +1 -0
- reflex/event.py +89 -79
- reflex/experimental/__init__.py +25 -6
- reflex/experimental/client_state.py +34 -58
- reflex/experimental/hooks.py +13 -18
- reflex/experimental/layout.py +5 -5
- reflex/experimental/layout.pyi +84 -83
- reflex/{experimental/vars → ivars}/__init__.py +0 -1
- reflex/ivars/base.py +2180 -0
- reflex/ivars/function.py +200 -0
- reflex/ivars/number.py +1137 -0
- reflex/ivars/object.py +564 -0
- reflex/ivars/sequence.py +1601 -0
- reflex/model.py +22 -0
- reflex/reflex.py +4 -0
- reflex/state.py +388 -73
- reflex/style.py +52 -34
- reflex/testing.py +8 -3
- reflex/utils/exceptions.py +12 -0
- reflex/utils/exec.py +0 -14
- reflex/utils/format.py +74 -223
- reflex/utils/net.py +43 -0
- reflex/utils/path_ops.py +13 -1
- reflex/utils/prerequisites.py +46 -26
- reflex/utils/pyi_generator.py +5 -4
- reflex/utils/serializers.py +13 -31
- reflex/utils/types.py +44 -9
- reflex/vars.py +127 -2230
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/METADATA +4 -6
- reflex-0.6.0a1.dist-info/RECORD +384 -0
- reflex/.templates/apps/demo/.gitignore +0 -4
- reflex/.templates/apps/demo/assets/favicon.ico +0 -0
- reflex/.templates/apps/demo/assets/github.svg +0 -10
- reflex/.templates/apps/demo/assets/icon.svg +0 -37
- reflex/.templates/apps/demo/assets/logo.svg +0 -68
- reflex/.templates/apps/demo/assets/paneleft.svg +0 -13
- reflex/.templates/apps/demo/code/__init__.py +0 -1
- reflex/.templates/apps/demo/code/demo.py +0 -127
- reflex/.templates/apps/demo/code/pages/__init__.py +0 -7
- reflex/.templates/apps/demo/code/pages/chatapp.py +0 -31
- reflex/.templates/apps/demo/code/pages/datatable.py +0 -360
- reflex/.templates/apps/demo/code/pages/forms.py +0 -257
- reflex/.templates/apps/demo/code/pages/graphing.py +0 -253
- reflex/.templates/apps/demo/code/pages/home.py +0 -56
- reflex/.templates/apps/demo/code/sidebar.py +0 -178
- reflex/.templates/apps/demo/code/state.py +0 -22
- reflex/.templates/apps/demo/code/states/form_state.py +0 -40
- reflex/.templates/apps/demo/code/states/pie_state.py +0 -47
- reflex/.templates/apps/demo/code/styles.py +0 -68
- reflex/.templates/apps/demo/code/webui/__init__.py +0 -0
- reflex/.templates/apps/demo/code/webui/components/__init__.py +0 -4
- reflex/.templates/apps/demo/code/webui/components/chat.py +0 -118
- reflex/.templates/apps/demo/code/webui/components/loading_icon.py +0 -19
- reflex/.templates/apps/demo/code/webui/components/modal.py +0 -56
- reflex/.templates/apps/demo/code/webui/components/navbar.py +0 -70
- reflex/.templates/apps/demo/code/webui/components/sidebar.py +0 -66
- reflex/.templates/apps/demo/code/webui/state.py +0 -146
- reflex/.templates/apps/demo/code/webui/styles.py +0 -88
- reflex/experimental/vars/base.py +0 -583
- reflex/experimental/vars/function.py +0 -290
- reflex/experimental/vars/number.py +0 -1458
- reflex/experimental/vars/object.py +0 -804
- reflex/experimental/vars/sequence.py +0 -1764
- reflex/utils/watch.py +0 -96
- reflex/vars.pyi +0 -218
- reflex-0.5.10a3.dist-info/RECORD +0 -413
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/LICENSE +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/WHEEL +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/entry_points.txt +0 -0
reflex/components/core/match.py
CHANGED
|
@@ -5,13 +5,13 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
|
5
5
|
|
|
6
6
|
from reflex.components.base import Fragment
|
|
7
7
|
from reflex.components.component import BaseComponent, Component, MemoizationLeaf
|
|
8
|
-
from reflex.components.core.colors import Color
|
|
9
8
|
from reflex.components.tags import MatchTag, Tag
|
|
9
|
+
from reflex.ivars.base import ImmutableVar, LiteralVar
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.utils import format, types
|
|
12
12
|
from reflex.utils.exceptions import MatchTypeError
|
|
13
13
|
from reflex.utils.imports import ImportDict
|
|
14
|
-
from reflex.vars import
|
|
14
|
+
from reflex.vars import Var, VarData
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class Match(MemoizationLeaf):
|
|
@@ -27,7 +27,7 @@ class Match(MemoizationLeaf):
|
|
|
27
27
|
default: Any
|
|
28
28
|
|
|
29
29
|
@classmethod
|
|
30
|
-
def create(cls, cond: Any, *cases) -> Union[Component,
|
|
30
|
+
def create(cls, cond: Any, *cases) -> Union[Component, ImmutableVar]:
|
|
31
31
|
"""Create a Match Component.
|
|
32
32
|
|
|
33
33
|
Args:
|
|
@@ -46,7 +46,7 @@ class Match(MemoizationLeaf):
|
|
|
46
46
|
|
|
47
47
|
cls._validate_return_types(match_cases)
|
|
48
48
|
|
|
49
|
-
if default is None and types._issubclass(type(match_cases[0][-1]),
|
|
49
|
+
if default is None and types._issubclass(type(match_cases[0][-1]), Var):
|
|
50
50
|
raise ValueError(
|
|
51
51
|
"For cases with return types as Vars, a default case must be provided"
|
|
52
52
|
)
|
|
@@ -56,7 +56,7 @@ class Match(MemoizationLeaf):
|
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
@classmethod
|
|
59
|
-
def _create_condition_var(cls, cond: Any) ->
|
|
59
|
+
def _create_condition_var(cls, cond: Any) -> ImmutableVar:
|
|
60
60
|
"""Convert the condition to a Var.
|
|
61
61
|
|
|
62
62
|
Args:
|
|
@@ -68,16 +68,16 @@ class Match(MemoizationLeaf):
|
|
|
68
68
|
Raises:
|
|
69
69
|
ValueError: If the condition is not provided.
|
|
70
70
|
"""
|
|
71
|
-
match_cond_var =
|
|
71
|
+
match_cond_var = LiteralVar.create(cond)
|
|
72
72
|
|
|
73
73
|
if match_cond_var is None:
|
|
74
74
|
raise ValueError("The condition must be set")
|
|
75
|
-
return match_cond_var
|
|
75
|
+
return match_cond_var
|
|
76
76
|
|
|
77
77
|
@classmethod
|
|
78
78
|
def _process_cases(
|
|
79
79
|
cls, cases: List
|
|
80
|
-
) -> Tuple[List, Optional[Union[
|
|
80
|
+
) -> Tuple[List, Optional[Union[ImmutableVar, BaseComponent]]]:
|
|
81
81
|
"""Process the list of match cases and the catchall default case.
|
|
82
82
|
|
|
83
83
|
Args:
|
|
@@ -94,6 +94,9 @@ class Match(MemoizationLeaf):
|
|
|
94
94
|
if len([case for case in cases if not isinstance(case, tuple)]) > 1:
|
|
95
95
|
raise ValueError("rx.match can only have one default case.")
|
|
96
96
|
|
|
97
|
+
if not cases:
|
|
98
|
+
raise ValueError("rx.match should have at least one case.")
|
|
99
|
+
|
|
97
100
|
# Get the default case which should be the last non-tuple arg
|
|
98
101
|
if not isinstance(cases[-1], tuple):
|
|
99
102
|
default = cases.pop()
|
|
@@ -103,7 +106,7 @@ class Match(MemoizationLeaf):
|
|
|
103
106
|
else default
|
|
104
107
|
)
|
|
105
108
|
|
|
106
|
-
return cases, default
|
|
109
|
+
return cases, default
|
|
107
110
|
|
|
108
111
|
@classmethod
|
|
109
112
|
def _create_case_var_with_var_data(cls, case_element):
|
|
@@ -117,17 +120,12 @@ class Match(MemoizationLeaf):
|
|
|
117
120
|
Returns:
|
|
118
121
|
The case element Var.
|
|
119
122
|
"""
|
|
120
|
-
_var_data = case_element._var_data if isinstance(case_element, Style) else None
|
|
121
|
-
case_element =
|
|
122
|
-
case_element,
|
|
123
|
-
_var_is_string=isinstance(case_element, (str, Color)),
|
|
124
|
-
)
|
|
125
|
-
if _var_data is not None:
|
|
126
|
-
case_element._var_data = VarData.merge(case_element._var_data, _var_data) # type: ignore
|
|
123
|
+
_var_data = case_element._var_data if isinstance(case_element, Style) else None
|
|
124
|
+
case_element = LiteralVar.create(case_element, _var_data=_var_data)
|
|
127
125
|
return case_element
|
|
128
126
|
|
|
129
127
|
@classmethod
|
|
130
|
-
def _process_match_cases(cls, cases: List) -> List[List[
|
|
128
|
+
def _process_match_cases(cls, cases: List) -> List[List[ImmutableVar]]:
|
|
131
129
|
"""Process the individual match cases.
|
|
132
130
|
|
|
133
131
|
Args:
|
|
@@ -159,7 +157,7 @@ class Match(MemoizationLeaf):
|
|
|
159
157
|
if not isinstance(element, BaseComponent)
|
|
160
158
|
else element
|
|
161
159
|
)
|
|
162
|
-
if not isinstance(el, (
|
|
160
|
+
if not isinstance(el, (ImmutableVar, BaseComponent)):
|
|
163
161
|
raise ValueError("Case element must be a var or component")
|
|
164
162
|
case_list.append(el)
|
|
165
163
|
|
|
@@ -168,7 +166,7 @@ class Match(MemoizationLeaf):
|
|
|
168
166
|
return match_cases
|
|
169
167
|
|
|
170
168
|
@classmethod
|
|
171
|
-
def _validate_return_types(cls, match_cases: List[List[
|
|
169
|
+
def _validate_return_types(cls, match_cases: List[List[ImmutableVar]]) -> None:
|
|
172
170
|
"""Validate that match cases have the same return types.
|
|
173
171
|
|
|
174
172
|
Args:
|
|
@@ -182,24 +180,24 @@ class Match(MemoizationLeaf):
|
|
|
182
180
|
|
|
183
181
|
if types._isinstance(first_case_return, BaseComponent):
|
|
184
182
|
return_type = BaseComponent
|
|
185
|
-
elif types._isinstance(first_case_return,
|
|
186
|
-
return_type =
|
|
183
|
+
elif types._isinstance(first_case_return, ImmutableVar):
|
|
184
|
+
return_type = ImmutableVar
|
|
187
185
|
|
|
188
186
|
for index, case in enumerate(match_cases):
|
|
189
187
|
if not types._issubclass(type(case[-1]), return_type):
|
|
190
188
|
raise MatchTypeError(
|
|
191
189
|
f"Match cases should have the same return types. Case {index} with return "
|
|
192
|
-
f"value `{case[-1]._var_name if isinstance(case[-1],
|
|
190
|
+
f"value `{case[-1]._var_name if isinstance(case[-1], ImmutableVar) else textwrap.shorten(str(case[-1]), width=250)}`"
|
|
193
191
|
f" of type {type(case[-1])!r} is not {return_type}"
|
|
194
192
|
)
|
|
195
193
|
|
|
196
194
|
@classmethod
|
|
197
195
|
def _create_match_cond_var_or_component(
|
|
198
196
|
cls,
|
|
199
|
-
match_cond_var:
|
|
200
|
-
match_cases: List[List[
|
|
201
|
-
default: Optional[Union[
|
|
202
|
-
) -> Union[Component,
|
|
197
|
+
match_cond_var: ImmutableVar,
|
|
198
|
+
match_cases: List[List[ImmutableVar]],
|
|
199
|
+
default: Optional[Union[ImmutableVar, BaseComponent]],
|
|
200
|
+
) -> Union[Component, ImmutableVar]:
|
|
203
201
|
"""Create and return the match condition var or component.
|
|
204
202
|
|
|
205
203
|
Args:
|
|
@@ -230,28 +228,22 @@ class Match(MemoizationLeaf):
|
|
|
230
228
|
|
|
231
229
|
# Validate the match cases (as well as the default case) to have Var return types.
|
|
232
230
|
if any(
|
|
233
|
-
case for case in match_cases if not types._isinstance(case[-1],
|
|
234
|
-
) or not types._isinstance(default,
|
|
231
|
+
case for case in match_cases if not types._isinstance(case[-1], Var)
|
|
232
|
+
) or not types._isinstance(default, Var):
|
|
235
233
|
raise ValueError("Return types of match cases should be Vars.")
|
|
236
234
|
|
|
237
|
-
|
|
238
|
-
# Retrieve var data of every var in the match cases and default.
|
|
239
|
-
var_data = [
|
|
240
|
-
*[el._var_data for case in match_cases for el in case],
|
|
241
|
-
default._var_data, # type: ignore
|
|
242
|
-
]
|
|
243
|
-
|
|
244
|
-
return match_cond_var._replace(
|
|
235
|
+
return ImmutableVar(
|
|
245
236
|
_var_name=format.format_match(
|
|
246
|
-
cond=match_cond_var
|
|
247
|
-
match_cases=match_cases,
|
|
237
|
+
cond=str(match_cond_var),
|
|
238
|
+
match_cases=match_cases,
|
|
248
239
|
default=default, # type: ignore
|
|
249
240
|
),
|
|
250
241
|
_var_type=default._var_type, # type: ignore
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
_var_data=VarData.merge(
|
|
243
|
+
match_cond_var._get_all_var_data(),
|
|
244
|
+
*[el._get_all_var_data() for case in match_cases for el in case],
|
|
245
|
+
default._get_all_var_data(), # type: ignore
|
|
246
|
+
),
|
|
255
247
|
)
|
|
256
248
|
|
|
257
249
|
def _render(self) -> Tag:
|
|
@@ -275,7 +267,8 @@ class Match(MemoizationLeaf):
|
|
|
275
267
|
Returns:
|
|
276
268
|
The import dict.
|
|
277
269
|
"""
|
|
278
|
-
|
|
270
|
+
var_data = VarData.merge(self.cond._get_all_var_data())
|
|
271
|
+
return var_data.old_school_imports() if var_data else {}
|
|
279
272
|
|
|
280
273
|
|
|
281
274
|
match = Match.create
|
reflex/components/core/upload.py
CHANGED
|
@@ -19,8 +19,10 @@ from reflex.event import (
|
|
|
19
19
|
call_script,
|
|
20
20
|
parse_args_spec,
|
|
21
21
|
)
|
|
22
|
+
from reflex.ivars.base import ImmutableCallableVar, ImmutableVar, LiteralVar
|
|
23
|
+
from reflex.ivars.sequence import LiteralStringVar
|
|
22
24
|
from reflex.utils.imports import ImportVar
|
|
23
|
-
from reflex.vars import
|
|
25
|
+
from reflex.vars import Var, VarData
|
|
24
26
|
|
|
25
27
|
DEFAULT_UPLOAD_ID: str = "default"
|
|
26
28
|
|
|
@@ -35,8 +37,8 @@ upload_files_context_var_data: VarData = VarData(
|
|
|
35
37
|
)
|
|
36
38
|
|
|
37
39
|
|
|
38
|
-
@
|
|
39
|
-
def upload_file(id_: str = DEFAULT_UPLOAD_ID) ->
|
|
40
|
+
@ImmutableCallableVar
|
|
41
|
+
def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar:
|
|
40
42
|
"""Get the file upload drop trigger.
|
|
41
43
|
|
|
42
44
|
This var is passed to the dropzone component to update the file list when a
|
|
@@ -48,23 +50,25 @@ def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar:
|
|
|
48
50
|
Returns:
|
|
49
51
|
A var referencing the file upload drop trigger.
|
|
50
52
|
"""
|
|
51
|
-
id_var =
|
|
53
|
+
id_var = LiteralStringVar.create(id_)
|
|
52
54
|
var_name = f"""e => setFilesById(filesById => {{
|
|
53
55
|
const updatedFilesById = Object.assign({{}}, filesById);
|
|
54
|
-
updatedFilesById[{id_var
|
|
56
|
+
updatedFilesById[{str(id_var)}] = e;
|
|
55
57
|
return updatedFilesById;
|
|
56
58
|
}})
|
|
57
59
|
"""
|
|
58
60
|
|
|
59
|
-
return
|
|
61
|
+
return ImmutableVar(
|
|
60
62
|
_var_name=var_name,
|
|
61
63
|
_var_type=EventChain,
|
|
62
|
-
_var_data=VarData.merge(
|
|
64
|
+
_var_data=VarData.merge(
|
|
65
|
+
upload_files_context_var_data, id_var._get_all_var_data()
|
|
66
|
+
),
|
|
63
67
|
)
|
|
64
68
|
|
|
65
69
|
|
|
66
|
-
@
|
|
67
|
-
def selected_files(id_: str = DEFAULT_UPLOAD_ID) ->
|
|
70
|
+
@ImmutableCallableVar
|
|
71
|
+
def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar:
|
|
68
72
|
"""Get the list of selected files.
|
|
69
73
|
|
|
70
74
|
Args:
|
|
@@ -73,12 +77,14 @@ def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar:
|
|
|
73
77
|
Returns:
|
|
74
78
|
A var referencing the list of selected file paths.
|
|
75
79
|
"""
|
|
76
|
-
id_var =
|
|
77
|
-
return
|
|
78
|
-
_var_name=f"(filesById[{id_var
|
|
80
|
+
id_var = LiteralStringVar.create(id_)
|
|
81
|
+
return ImmutableVar(
|
|
82
|
+
_var_name=f"(filesById[{str(id_var)}] ? filesById[{str(id_var)}].map((f) => (f.path || f.name)) : [])",
|
|
79
83
|
_var_type=List[str],
|
|
80
|
-
_var_data=VarData.merge(
|
|
81
|
-
|
|
84
|
+
_var_data=VarData.merge(
|
|
85
|
+
upload_files_context_var_data, id_var._get_all_var_data()
|
|
86
|
+
),
|
|
87
|
+
).guess_type()
|
|
82
88
|
|
|
83
89
|
|
|
84
90
|
@CallableEventSpec
|
|
@@ -107,7 +113,7 @@ def cancel_upload(upload_id: str) -> EventSpec:
|
|
|
107
113
|
An event spec that cancels the upload when triggered.
|
|
108
114
|
"""
|
|
109
115
|
return call_script(
|
|
110
|
-
f"upload_controllers[{
|
|
116
|
+
f"upload_controllers[{str(LiteralVar.create(upload_id))}]?.abort()"
|
|
111
117
|
)
|
|
112
118
|
|
|
113
119
|
|
|
@@ -126,16 +132,15 @@ def get_upload_dir() -> Path:
|
|
|
126
132
|
return uploaded_files_dir
|
|
127
133
|
|
|
128
134
|
|
|
129
|
-
uploaded_files_url_prefix
|
|
130
|
-
"
|
|
131
|
-
_var_is_string=False,
|
|
135
|
+
uploaded_files_url_prefix = ImmutableVar(
|
|
136
|
+
_var_name="getBackendURL(env.UPLOAD)",
|
|
132
137
|
_var_data=VarData(
|
|
133
138
|
imports={
|
|
134
139
|
f"/{Dirs.STATE_PATH}": "getBackendURL",
|
|
135
140
|
"/env.json": ImportVar(tag="env", is_default=True),
|
|
136
141
|
}
|
|
137
142
|
),
|
|
138
|
-
)
|
|
143
|
+
).to(str)
|
|
139
144
|
|
|
140
145
|
|
|
141
146
|
def get_upload_url(file_path: str) -> Var[str]:
|
|
@@ -149,9 +154,7 @@ def get_upload_url(file_path: str) -> Var[str]:
|
|
|
149
154
|
"""
|
|
150
155
|
Upload.is_used = True
|
|
151
156
|
|
|
152
|
-
return
|
|
153
|
-
f"{uploaded_files_url_prefix}/{file_path}", _var_is_string=True
|
|
154
|
-
)
|
|
157
|
+
return uploaded_files_url_prefix + "/" + file_path
|
|
155
158
|
|
|
156
159
|
|
|
157
160
|
def _on_drop_spec(files: Var):
|
|
@@ -245,7 +248,7 @@ class Upload(MemoizationLeaf):
|
|
|
245
248
|
# The file input to use.
|
|
246
249
|
upload = Input.create(type="file")
|
|
247
250
|
upload.special_props = {
|
|
248
|
-
|
|
251
|
+
ImmutableVar(_var_name="{...getInputProps()}", _var_type=None)
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
# The dropzone to use.
|
|
@@ -254,7 +257,9 @@ class Upload(MemoizationLeaf):
|
|
|
254
257
|
*children,
|
|
255
258
|
**{k: v for k, v in props.items() if k not in supported_props},
|
|
256
259
|
)
|
|
257
|
-
zone.special_props = {
|
|
260
|
+
zone.special_props = {
|
|
261
|
+
ImmutableVar(_var_name="{...getRootProps()}", _var_type=None)
|
|
262
|
+
}
|
|
258
263
|
|
|
259
264
|
# Create the component.
|
|
260
265
|
upload_props["id"] = props.get("id", DEFAULT_UPLOAD_ID)
|
|
@@ -282,7 +287,9 @@ class Upload(MemoizationLeaf):
|
|
|
282
287
|
)
|
|
283
288
|
|
|
284
289
|
@classmethod
|
|
285
|
-
def _update_arg_tuple_for_on_drop(
|
|
290
|
+
def _update_arg_tuple_for_on_drop(
|
|
291
|
+
cls, arg_value: tuple[ImmutableVar, ImmutableVar]
|
|
292
|
+
):
|
|
286
293
|
"""Helper to update caller-provided EventSpec args for direct use with on_drop.
|
|
287
294
|
|
|
288
295
|
Args:
|
|
@@ -7,27 +7,38 @@ from pathlib import Path
|
|
|
7
7
|
from typing import Any, Callable, ClassVar, Dict, List, Optional, Union, overload
|
|
8
8
|
|
|
9
9
|
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
|
10
|
+
from reflex.constants import Dirs
|
|
10
11
|
from reflex.event import (
|
|
11
12
|
CallableEventSpec,
|
|
12
13
|
EventHandler,
|
|
13
14
|
EventSpec,
|
|
14
15
|
)
|
|
16
|
+
from reflex.ivars.base import ImmutableCallableVar, ImmutableVar
|
|
15
17
|
from reflex.style import Style
|
|
16
|
-
from reflex.
|
|
18
|
+
from reflex.utils.imports import ImportVar
|
|
19
|
+
from reflex.vars import Var, VarData
|
|
17
20
|
|
|
18
21
|
DEFAULT_UPLOAD_ID: str
|
|
19
22
|
upload_files_context_var_data: VarData
|
|
20
23
|
|
|
21
|
-
@
|
|
22
|
-
def upload_file(id_: str = DEFAULT_UPLOAD_ID) ->
|
|
23
|
-
@
|
|
24
|
-
def selected_files(id_: str = DEFAULT_UPLOAD_ID) ->
|
|
24
|
+
@ImmutableCallableVar
|
|
25
|
+
def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: ...
|
|
26
|
+
@ImmutableCallableVar
|
|
27
|
+
def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: ...
|
|
25
28
|
@CallableEventSpec
|
|
26
29
|
def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec: ...
|
|
27
30
|
def cancel_upload(upload_id: str) -> EventSpec: ...
|
|
28
31
|
def get_upload_dir() -> Path: ...
|
|
29
32
|
|
|
30
|
-
uploaded_files_url_prefix
|
|
33
|
+
uploaded_files_url_prefix = ImmutableVar(
|
|
34
|
+
_var_name="getBackendURL(env.UPLOAD)",
|
|
35
|
+
_var_data=VarData(
|
|
36
|
+
imports={
|
|
37
|
+
f"/{Dirs.STATE_PATH}": "getBackendURL",
|
|
38
|
+
"/env.json": ImportVar(tag="env", is_default=True),
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
).to(str)
|
|
31
42
|
|
|
32
43
|
def get_upload_url(file_path: str) -> Var[str]: ...
|
|
33
44
|
|
|
@@ -42,51 +53,51 @@ class UploadFilesProvider(Component):
|
|
|
42
53
|
id: Optional[Any] = None,
|
|
43
54
|
class_name: Optional[Any] = None,
|
|
44
55
|
autofocus: Optional[bool] = None,
|
|
45
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
56
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
46
57
|
on_blur: Optional[
|
|
47
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
58
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
48
59
|
] = None,
|
|
49
60
|
on_click: Optional[
|
|
50
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
61
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
51
62
|
] = None,
|
|
52
63
|
on_context_menu: Optional[
|
|
53
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
64
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
54
65
|
] = None,
|
|
55
66
|
on_double_click: Optional[
|
|
56
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
67
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
57
68
|
] = None,
|
|
58
69
|
on_focus: Optional[
|
|
59
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
70
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
60
71
|
] = None,
|
|
61
72
|
on_mount: Optional[
|
|
62
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
73
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
63
74
|
] = None,
|
|
64
75
|
on_mouse_down: Optional[
|
|
65
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
76
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
66
77
|
] = None,
|
|
67
78
|
on_mouse_enter: Optional[
|
|
68
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
79
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
69
80
|
] = None,
|
|
70
81
|
on_mouse_leave: Optional[
|
|
71
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
82
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
72
83
|
] = None,
|
|
73
84
|
on_mouse_move: Optional[
|
|
74
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
85
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
75
86
|
] = None,
|
|
76
87
|
on_mouse_out: Optional[
|
|
77
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
88
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
78
89
|
] = None,
|
|
79
90
|
on_mouse_over: Optional[
|
|
80
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
91
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
81
92
|
] = None,
|
|
82
93
|
on_mouse_up: Optional[
|
|
83
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
94
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
84
95
|
] = None,
|
|
85
96
|
on_scroll: Optional[
|
|
86
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
97
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
87
98
|
] = None,
|
|
88
99
|
on_unmount: Optional[
|
|
89
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
100
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
90
101
|
] = None,
|
|
91
102
|
**props,
|
|
92
103
|
) -> "UploadFilesProvider":
|
|
@@ -129,54 +140,54 @@ class Upload(MemoizationLeaf):
|
|
|
129
140
|
id: Optional[Any] = None,
|
|
130
141
|
class_name: Optional[Any] = None,
|
|
131
142
|
autofocus: Optional[bool] = None,
|
|
132
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
143
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
133
144
|
on_blur: Optional[
|
|
134
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
145
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
135
146
|
] = None,
|
|
136
147
|
on_click: Optional[
|
|
137
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
148
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
138
149
|
] = None,
|
|
139
150
|
on_context_menu: Optional[
|
|
140
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
151
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
141
152
|
] = None,
|
|
142
153
|
on_double_click: Optional[
|
|
143
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
154
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
144
155
|
] = None,
|
|
145
156
|
on_drop: Optional[
|
|
146
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
157
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
147
158
|
] = None,
|
|
148
159
|
on_focus: Optional[
|
|
149
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
160
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
150
161
|
] = None,
|
|
151
162
|
on_mount: Optional[
|
|
152
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
163
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
153
164
|
] = None,
|
|
154
165
|
on_mouse_down: Optional[
|
|
155
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
166
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
156
167
|
] = None,
|
|
157
168
|
on_mouse_enter: Optional[
|
|
158
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
169
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
159
170
|
] = None,
|
|
160
171
|
on_mouse_leave: Optional[
|
|
161
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
172
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
162
173
|
] = None,
|
|
163
174
|
on_mouse_move: Optional[
|
|
164
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
175
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
165
176
|
] = None,
|
|
166
177
|
on_mouse_out: Optional[
|
|
167
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
178
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
168
179
|
] = None,
|
|
169
180
|
on_mouse_over: Optional[
|
|
170
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
181
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
171
182
|
] = None,
|
|
172
183
|
on_mouse_up: Optional[
|
|
173
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
184
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
174
185
|
] = None,
|
|
175
186
|
on_scroll: Optional[
|
|
176
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
187
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
177
188
|
] = None,
|
|
178
189
|
on_unmount: Optional[
|
|
179
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
190
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
180
191
|
] = None,
|
|
181
192
|
**props,
|
|
182
193
|
) -> "Upload":
|
|
@@ -226,54 +237,54 @@ class StyledUpload(Upload):
|
|
|
226
237
|
id: Optional[Any] = None,
|
|
227
238
|
class_name: Optional[Any] = None,
|
|
228
239
|
autofocus: Optional[bool] = None,
|
|
229
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
240
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
230
241
|
on_blur: Optional[
|
|
231
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
242
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
232
243
|
] = None,
|
|
233
244
|
on_click: Optional[
|
|
234
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
245
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
235
246
|
] = None,
|
|
236
247
|
on_context_menu: Optional[
|
|
237
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
248
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
238
249
|
] = None,
|
|
239
250
|
on_double_click: Optional[
|
|
240
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
251
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
241
252
|
] = None,
|
|
242
253
|
on_drop: Optional[
|
|
243
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
254
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
244
255
|
] = None,
|
|
245
256
|
on_focus: Optional[
|
|
246
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
257
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
247
258
|
] = None,
|
|
248
259
|
on_mount: Optional[
|
|
249
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
260
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
250
261
|
] = None,
|
|
251
262
|
on_mouse_down: Optional[
|
|
252
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
263
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
253
264
|
] = None,
|
|
254
265
|
on_mouse_enter: Optional[
|
|
255
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
266
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
256
267
|
] = None,
|
|
257
268
|
on_mouse_leave: Optional[
|
|
258
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
269
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
259
270
|
] = None,
|
|
260
271
|
on_mouse_move: Optional[
|
|
261
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
272
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
262
273
|
] = None,
|
|
263
274
|
on_mouse_out: Optional[
|
|
264
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
275
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
265
276
|
] = None,
|
|
266
277
|
on_mouse_over: Optional[
|
|
267
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
278
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
268
279
|
] = None,
|
|
269
280
|
on_mouse_up: Optional[
|
|
270
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
281
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
271
282
|
] = None,
|
|
272
283
|
on_scroll: Optional[
|
|
273
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
284
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
274
285
|
] = None,
|
|
275
286
|
on_unmount: Optional[
|
|
276
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
287
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
277
288
|
] = None,
|
|
278
289
|
**props,
|
|
279
290
|
) -> "StyledUpload":
|
|
@@ -323,54 +334,54 @@ class UploadNamespace(ComponentNamespace):
|
|
|
323
334
|
id: Optional[Any] = None,
|
|
324
335
|
class_name: Optional[Any] = None,
|
|
325
336
|
autofocus: Optional[bool] = None,
|
|
326
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
337
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
327
338
|
on_blur: Optional[
|
|
328
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
339
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
329
340
|
] = None,
|
|
330
341
|
on_click: Optional[
|
|
331
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
342
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
332
343
|
] = None,
|
|
333
344
|
on_context_menu: Optional[
|
|
334
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
345
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
335
346
|
] = None,
|
|
336
347
|
on_double_click: Optional[
|
|
337
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
348
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
338
349
|
] = None,
|
|
339
350
|
on_drop: Optional[
|
|
340
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
351
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
341
352
|
] = None,
|
|
342
353
|
on_focus: Optional[
|
|
343
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
354
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
344
355
|
] = None,
|
|
345
356
|
on_mount: Optional[
|
|
346
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
357
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
347
358
|
] = None,
|
|
348
359
|
on_mouse_down: Optional[
|
|
349
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
360
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
350
361
|
] = None,
|
|
351
362
|
on_mouse_enter: Optional[
|
|
352
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
363
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
353
364
|
] = None,
|
|
354
365
|
on_mouse_leave: Optional[
|
|
355
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
366
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
356
367
|
] = None,
|
|
357
368
|
on_mouse_move: Optional[
|
|
358
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
369
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
359
370
|
] = None,
|
|
360
371
|
on_mouse_out: Optional[
|
|
361
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
372
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
362
373
|
] = None,
|
|
363
374
|
on_mouse_over: Optional[
|
|
364
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
375
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
365
376
|
] = None,
|
|
366
377
|
on_mouse_up: Optional[
|
|
367
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
378
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
368
379
|
] = None,
|
|
369
380
|
on_scroll: Optional[
|
|
370
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
381
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
371
382
|
] = None,
|
|
372
383
|
on_unmount: Optional[
|
|
373
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
384
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
374
385
|
] = None,
|
|
375
386
|
**props,
|
|
376
387
|
) -> "StyledUpload":
|