ex4nicegui 0.6.6__py3-none-any.whl → 0.6.8__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.
- ex4nicegui/__init__.py +10 -6
- ex4nicegui/gsap/__init__.py +11 -0
- ex4nicegui/helper/__init__.py +4 -0
- ex4nicegui/helper/client_instance_locker.py +31 -0
- ex4nicegui/libs/gsap/.DS_Store +0 -0
- ex4nicegui/libs/gsap/gsap.mjs +6 -0
- ex4nicegui/reactive/EChartsComponent/ECharts.js +19 -9
- ex4nicegui/reactive/local_file_picker.py +1 -2
- ex4nicegui/reactive/officials/aggrid.py +7 -7
- ex4nicegui/reactive/officials/base.py +198 -86
- ex4nicegui/reactive/officials/button.py +5 -5
- ex4nicegui/reactive/officials/checkbox.py +5 -6
- ex4nicegui/reactive/officials/circular_progress.py +5 -6
- ex4nicegui/reactive/officials/color_picker.py +7 -8
- ex4nicegui/reactive/officials/column.py +4 -3
- ex4nicegui/reactive/officials/date.py +6 -12
- ex4nicegui/reactive/officials/drawer.py +2 -3
- ex4nicegui/reactive/officials/echarts.py +32 -15
- ex4nicegui/reactive/officials/expansion.py +5 -5
- ex4nicegui/reactive/officials/grid.py +1 -1
- ex4nicegui/reactive/officials/html.py +1 -3
- ex4nicegui/reactive/officials/icon.py +9 -10
- ex4nicegui/reactive/officials/image.py +5 -7
- ex4nicegui/reactive/officials/input.py +8 -10
- ex4nicegui/reactive/officials/knob.py +5 -7
- ex4nicegui/reactive/officials/label.py +5 -4
- ex4nicegui/reactive/officials/linear_progress.py +9 -10
- ex4nicegui/reactive/officials/number.py +23 -8
- ex4nicegui/reactive/officials/radio.py +7 -9
- ex4nicegui/reactive/officials/row.py +1 -1
- ex4nicegui/reactive/officials/select.py +7 -9
- ex4nicegui/reactive/officials/slider.py +6 -8
- ex4nicegui/reactive/officials/switch.py +5 -7
- ex4nicegui/reactive/officials/tab.py +1 -1
- ex4nicegui/reactive/officials/tab_panel.py +1 -1
- ex4nicegui/reactive/officials/tab_panels.py +15 -3
- ex4nicegui/reactive/officials/table.py +12 -10
- ex4nicegui/reactive/officials/tabs.py +4 -3
- ex4nicegui/reactive/officials/textarea.py +6 -8
- ex4nicegui/reactive/officials/upload.py +2 -2
- ex4nicegui/reactive/q_pagination.py +5 -4
- ex4nicegui/reactive/scopedStyle.js +55 -0
- ex4nicegui/reactive/scopedStyle.py +22 -0
- ex4nicegui/reactive/services/color_service.py +56 -0
- ex4nicegui/reactive/services/pandas_service.py +31 -0
- ex4nicegui/reactive/{utils.py → services/reactive_service.py} +9 -67
- ex4nicegui/reactive/systems/color_system.py +25 -0
- ex4nicegui/reactive/systems/object_system.py +33 -0
- ex4nicegui/reactive/systems/reactive_system.py +21 -0
- ex4nicegui/reactive/useMouse/UseMouse.py +4 -4
- ex4nicegui/reactive/usePagination.py +1 -1
- ex4nicegui/reactive/vfor.py +1 -2
- ex4nicegui/reactive/vmodel.py +1 -1
- ex4nicegui/utils/refComputed.py +147 -0
- ex4nicegui/utils/refWrapper.py +57 -0
- ex4nicegui/utils/signals.py +51 -192
- ex4nicegui/utils/types.py +16 -0
- ex4nicegui/version.py +3 -0
- {ex4nicegui-0.6.6.dist-info → ex4nicegui-0.6.8.dist-info}/METADATA +1274 -1124
- {ex4nicegui-0.6.6.dist-info → ex4nicegui-0.6.8.dist-info}/RECORD +81 -74
- {ex4nicegui-0.6.6.dist-info → ex4nicegui-0.6.8.dist-info}/WHEEL +1 -2
- ex4nicegui/reactive/EChartsComponent/__init__.py +0 -0
- ex4nicegui/reactive/UseDraggable/__init__.py +0 -0
- ex4nicegui/reactive/dropZone/__init__.py +0 -0
- ex4nicegui/reactive/mermaid/__init__.py +0 -0
- ex4nicegui/reactive/officials/__init__.py +0 -1
- ex4nicegui/reactive/officials/utils.py +0 -11
- ex4nicegui/reactive/useMouse/__init__.py +0 -0
- ex4nicegui-0.6.6.dist-info/top_level.txt +0 -1
- {ex4nicegui-0.6.6.dist-info → ex4nicegui-0.6.8.dist-info}/LICENSE +0 -0
|
@@ -4,10 +4,9 @@ from typing import (
|
|
|
4
4
|
Optional,
|
|
5
5
|
TypeVar,
|
|
6
6
|
)
|
|
7
|
-
from ex4nicegui.reactive.
|
|
8
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
7
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
9
8
|
from ex4nicegui.utils.signals import (
|
|
10
|
-
|
|
9
|
+
TGetterOrReadonlyRef,
|
|
11
10
|
_TMaybeRef as TMaybeRef,
|
|
12
11
|
to_value,
|
|
13
12
|
)
|
|
@@ -44,14 +43,14 @@ class CheckboxBindableUi(BindableUi[ui.checkbox], DisableableMixin):
|
|
|
44
43
|
def value(self):
|
|
45
44
|
return self.element.value
|
|
46
45
|
|
|
47
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
46
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
48
47
|
if prop == "value":
|
|
49
48
|
return self.bind_value(ref_ui)
|
|
50
49
|
|
|
51
50
|
return super().bind_prop(prop, ref_ui)
|
|
52
51
|
|
|
53
|
-
def bind_value(self, ref_ui:
|
|
54
|
-
@
|
|
52
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef[bool]):
|
|
53
|
+
@self._ui_effect
|
|
55
54
|
def _():
|
|
56
55
|
self.element.set_value(to_value(ref_ui))
|
|
57
56
|
self.element.update()
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Optional,
|
|
3
3
|
)
|
|
4
|
-
from ex4nicegui.reactive.
|
|
5
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
4
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
6
5
|
|
|
7
6
|
from ex4nicegui.utils.signals import (
|
|
8
|
-
|
|
7
|
+
TGetterOrReadonlyRef,
|
|
9
8
|
_TMaybeRef as TMaybeRef,
|
|
10
9
|
to_value,
|
|
11
10
|
)
|
|
@@ -50,14 +49,14 @@ class CircularProgressBindableUi(
|
|
|
50
49
|
def value(self):
|
|
51
50
|
return self.element.value
|
|
52
51
|
|
|
53
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
52
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
54
53
|
if prop == "value":
|
|
55
54
|
return self.bind_value(ref_ui)
|
|
56
55
|
|
|
57
56
|
return super().bind_prop(prop, ref_ui)
|
|
58
57
|
|
|
59
|
-
def bind_value(self, ref_ui:
|
|
60
|
-
@
|
|
58
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef[float]):
|
|
59
|
+
@self._ui_effect
|
|
61
60
|
def _():
|
|
62
61
|
self.element.set_value(to_value(ref_ui))
|
|
63
62
|
|
|
@@ -4,11 +4,10 @@ from typing import (
|
|
|
4
4
|
Optional,
|
|
5
5
|
cast,
|
|
6
6
|
)
|
|
7
|
-
from ex4nicegui.reactive.
|
|
8
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
7
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
9
8
|
|
|
10
9
|
from ex4nicegui.utils.signals import (
|
|
11
|
-
|
|
10
|
+
TGetterOrReadonlyRef,
|
|
12
11
|
Ref,
|
|
13
12
|
_TMaybeRef as TMaybeRef,
|
|
14
13
|
is_setter_ref,
|
|
@@ -69,21 +68,21 @@ class ColorPickerBindableUi(BindableUi[ui.color_picker]):
|
|
|
69
68
|
def value(self):
|
|
70
69
|
return self.element.value
|
|
71
70
|
|
|
72
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
71
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
73
72
|
if prop == "value":
|
|
74
73
|
return self.bind_value(ref_ui)
|
|
75
74
|
|
|
76
75
|
return super().bind_prop(prop, ref_ui)
|
|
77
76
|
|
|
78
|
-
def bind_color(self, ref_ui:
|
|
79
|
-
@
|
|
77
|
+
def bind_color(self, ref_ui: TGetterOrReadonlyRef[str]):
|
|
78
|
+
@self._ui_effect
|
|
80
79
|
def _():
|
|
81
80
|
self.element.set_color(to_value(ref_ui))
|
|
82
81
|
|
|
83
82
|
return self
|
|
84
83
|
|
|
85
|
-
def bind_value(self, ref_ui:
|
|
86
|
-
@
|
|
84
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef[bool]):
|
|
85
|
+
@self._ui_effect
|
|
87
86
|
def _():
|
|
88
87
|
self.element.set_value(to_value(ref_ui))
|
|
89
88
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Any,
|
|
3
3
|
)
|
|
4
|
-
from ex4nicegui.reactive.
|
|
4
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
5
5
|
from ex4nicegui.utils.signals import (
|
|
6
|
+
TGetterOrReadonlyRef,
|
|
6
7
|
_TMaybeRef as TMaybeRef,
|
|
7
8
|
)
|
|
8
9
|
from nicegui import ui
|
|
@@ -19,13 +20,13 @@ class ColumnBindableUi(BindableUi[ui.column]):
|
|
|
19
20
|
for key, value in pc.get_bindings().items():
|
|
20
21
|
self.bind_prop(key, value) # type: ignore
|
|
21
22
|
|
|
22
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
23
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
23
24
|
if prop == "wrap":
|
|
24
25
|
return self.bind_wrap(ref_ui)
|
|
25
26
|
|
|
26
27
|
return super().bind_prop(prop, ref_ui)
|
|
27
28
|
|
|
28
|
-
def bind_wrap(self, ref_ui:
|
|
29
|
+
def bind_wrap(self, ref_ui: TGetterOrReadonlyRef):
|
|
29
30
|
self.bind_classes({"wrap": ref_ui})
|
|
30
31
|
|
|
31
32
|
def __enter__(self):
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
from typing import Any, Callable, List, Optional, TypeVar
|
|
2
2
|
from typing_extensions import TypedDict
|
|
3
|
-
from ex4nicegui.reactive.
|
|
4
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
3
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
5
4
|
|
|
6
5
|
from ex4nicegui.utils.signals import (
|
|
7
|
-
|
|
6
|
+
TGetterOrReadonlyRef,
|
|
8
7
|
_TMaybeRef as TMaybeRef,
|
|
9
8
|
to_value,
|
|
10
9
|
)
|
|
@@ -45,13 +44,8 @@ class DateBindableUi(BindableUi[ui.date]):
|
|
|
45
44
|
pc = ParameterClassifier(
|
|
46
45
|
locals(),
|
|
47
46
|
maybeRefs=[
|
|
48
|
-
"label",
|
|
49
47
|
"value",
|
|
50
|
-
"
|
|
51
|
-
"password",
|
|
52
|
-
"password_toggle_button",
|
|
53
|
-
"autocomplete",
|
|
54
|
-
"validation",
|
|
48
|
+
"mask",
|
|
55
49
|
],
|
|
56
50
|
v_model=("value", "on_change"),
|
|
57
51
|
events=["on_change"],
|
|
@@ -68,14 +62,14 @@ class DateBindableUi(BindableUi[ui.date]):
|
|
|
68
62
|
def value(self):
|
|
69
63
|
return self.element.value
|
|
70
64
|
|
|
71
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
65
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
72
66
|
if prop == "value":
|
|
73
67
|
return self.bind_value(ref_ui)
|
|
74
68
|
|
|
75
69
|
return super().bind_prop(prop, ref_ui)
|
|
76
70
|
|
|
77
|
-
def bind_value(self, ref_ui:
|
|
78
|
-
@
|
|
71
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef[bool]):
|
|
72
|
+
@self._ui_effect
|
|
79
73
|
def _():
|
|
80
74
|
self.element.set_value(to_value(ref_ui))
|
|
81
75
|
|
|
@@ -2,8 +2,7 @@ from typing import (
|
|
|
2
2
|
Any,
|
|
3
3
|
)
|
|
4
4
|
from typing_extensions import Literal
|
|
5
|
-
from ex4nicegui.reactive.
|
|
6
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
5
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
7
6
|
|
|
8
7
|
from ex4nicegui.utils.signals import (
|
|
9
8
|
is_setter_ref,
|
|
@@ -61,7 +60,7 @@ class DrawerBindableUi(BindableUi[Drawer]):
|
|
|
61
60
|
|
|
62
61
|
super().__init__(element) # type: ignore
|
|
63
62
|
|
|
64
|
-
@
|
|
63
|
+
@self._ui_effect
|
|
65
64
|
def _():
|
|
66
65
|
mvalue = "true" if to_value(value) else "false"
|
|
67
66
|
element.props(f":model-value={mvalue}")
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import Any, Callable, Dict, List, Union, cast, Optional
|
|
3
|
-
from ex4nicegui.reactive.
|
|
2
|
+
from typing import Any, Callable, Dict, List, Union, cast, Optional, Literal
|
|
3
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
4
4
|
from ex4nicegui.utils.signals import (
|
|
5
|
-
|
|
5
|
+
TGetterOrReadonlyRef,
|
|
6
6
|
is_ref,
|
|
7
7
|
ref_computed,
|
|
8
8
|
_TMaybeRef as TMaybeRef,
|
|
9
9
|
to_value,
|
|
10
10
|
to_raw,
|
|
11
|
-
on,
|
|
12
11
|
)
|
|
13
12
|
from .base import BindableUi
|
|
14
13
|
from ex4nicegui.reactive.EChartsComponent.ECharts import echarts
|
|
@@ -17,6 +16,7 @@ from ex4nicegui.reactive.EChartsComponent.events import EChartsMouseEventArgumen
|
|
|
17
16
|
|
|
18
17
|
from nicegui.awaitable_response import AwaitableResponse
|
|
19
18
|
from nicegui import ui, app
|
|
19
|
+
import orjson as json
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class EChartsBindableUi(BindableUi[echarts]):
|
|
@@ -46,7 +46,14 @@ class EChartsBindableUi(BindableUi[echarts]):
|
|
|
46
46
|
self.bind_prop(key, value) # type: ignore
|
|
47
47
|
|
|
48
48
|
@classmethod
|
|
49
|
-
def register_map(
|
|
49
|
+
def register_map(
|
|
50
|
+
cls,
|
|
51
|
+
map_name: str,
|
|
52
|
+
src: Union[str, Path],
|
|
53
|
+
*,
|
|
54
|
+
type: Literal["geoJSON", "svg"] = "geoJSON",
|
|
55
|
+
special_areas: Optional[Dict[str, Any]] = None,
|
|
56
|
+
):
|
|
50
57
|
"""Registers available maps. This can only be used after including geo component or chart series of map.
|
|
51
58
|
|
|
52
59
|
@see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#rxuiechartsregister_map
|
|
@@ -55,6 +62,8 @@ class EChartsBindableUi(BindableUi[echarts]):
|
|
|
55
62
|
Args:
|
|
56
63
|
map_name (str): Map name, referring to map value set in geo component or map.
|
|
57
64
|
src (Union[str, Path]): Map data. If str, it should be a network address. If path, it should be a valid file.
|
|
65
|
+
type (Literal["geoJSON", "svg"], optional): Map data type. Defaults to "geoJSON".
|
|
66
|
+
special_areas (Optional[Dict[str, Any]], optional): Special areas. Defaults to None.
|
|
58
67
|
"""
|
|
59
68
|
if isinstance(src, Path):
|
|
60
69
|
src = app.add_static_file(local_file=src)
|
|
@@ -63,13 +72,21 @@ class EChartsBindableUi(BindableUi[echarts]):
|
|
|
63
72
|
|
|
64
73
|
ui.add_body_html(
|
|
65
74
|
rf"""
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
<script>
|
|
76
|
+
(function () {{
|
|
77
|
+
if (typeof window.ex4ngEchartsMapTasks === "undefined") {{
|
|
78
|
+
window.ex4ngEchartsMapTasks = new Map();
|
|
79
|
+
}}
|
|
80
|
+
|
|
81
|
+
const value = {{
|
|
82
|
+
src: '{src}',
|
|
83
|
+
type: '{type}',
|
|
84
|
+
specialAreas: {json.dumps(special_areas).decode('utf-8')}
|
|
85
|
+
}}
|
|
86
|
+
|
|
87
|
+
window.ex4ngEchartsMapTasks.set('{map_name}', value);
|
|
88
|
+
}})()
|
|
89
|
+
</script>
|
|
73
90
|
"""
|
|
74
91
|
)
|
|
75
92
|
|
|
@@ -116,14 +133,14 @@ class EChartsBindableUi(BindableUi[echarts]):
|
|
|
116
133
|
code = code.read_text("utf8")
|
|
117
134
|
return cls(code=code)
|
|
118
135
|
|
|
119
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
136
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
120
137
|
if prop == "options":
|
|
121
138
|
return self.bind_options(ref_ui)
|
|
122
139
|
|
|
123
140
|
return super().bind_prop(prop, ref_ui)
|
|
124
141
|
|
|
125
|
-
def bind_options(self, ref_ui:
|
|
126
|
-
@
|
|
142
|
+
def bind_options(self, ref_ui: TGetterOrReadonlyRef[Dict]):
|
|
143
|
+
@self._ui_signal_on(ref_ui)
|
|
127
144
|
def _():
|
|
128
145
|
ele = self.element
|
|
129
146
|
ele.update_options(to_raw(to_value(ref_ui)), self.__update_setting)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from typing import Any, Optional, Callable
|
|
2
2
|
from nicegui import ui
|
|
3
|
-
from ex4nicegui.reactive.
|
|
4
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
3
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
5
4
|
from ex4nicegui.utils.signals import (
|
|
5
|
+
TGetterOrReadonlyRef,
|
|
6
6
|
_TMaybeRef as TMaybeRef,
|
|
7
7
|
to_value,
|
|
8
8
|
)
|
|
@@ -45,14 +45,14 @@ class ExpansionBindableUi(BindableUi[ui.expansion]):
|
|
|
45
45
|
def value(self):
|
|
46
46
|
return self.element.value
|
|
47
47
|
|
|
48
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
48
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
49
49
|
if prop == "value":
|
|
50
50
|
return self.bind_value(ref_ui)
|
|
51
51
|
|
|
52
52
|
return super().bind_prop(prop, ref_ui)
|
|
53
53
|
|
|
54
|
-
def bind_value(self, ref_ui:
|
|
55
|
-
@
|
|
54
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef):
|
|
55
|
+
@self._ui_effect
|
|
56
56
|
def _():
|
|
57
57
|
self.element.set_value(to_value(ref_ui))
|
|
58
58
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
2
|
-
|
|
3
1
|
from ex4nicegui.utils.signals import (
|
|
4
2
|
_TMaybeRef as TMaybeRef,
|
|
5
3
|
to_value,
|
|
@@ -20,7 +18,7 @@ class html(BindableUi[HtmlComponent]):
|
|
|
20
18
|
|
|
21
19
|
super().__init__(element)
|
|
22
20
|
|
|
23
|
-
@
|
|
21
|
+
@self._ui_effect
|
|
24
22
|
def _():
|
|
25
23
|
element._props["content"] = to_value(content)
|
|
26
24
|
element.update()
|
|
@@ -2,11 +2,9 @@ from typing import (
|
|
|
2
2
|
Optional,
|
|
3
3
|
cast,
|
|
4
4
|
)
|
|
5
|
-
from ex4nicegui.reactive.
|
|
6
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
7
|
-
|
|
5
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
8
6
|
from ex4nicegui.utils.signals import (
|
|
9
|
-
|
|
7
|
+
TGetterOrReadonlyRef,
|
|
10
8
|
_TMaybeRef as TMaybeRef,
|
|
11
9
|
to_value,
|
|
12
10
|
)
|
|
@@ -14,7 +12,8 @@ from nicegui import ui
|
|
|
14
12
|
from nicegui.elements.mixins.color_elements import (
|
|
15
13
|
TextColorElement,
|
|
16
14
|
)
|
|
17
|
-
from .base import BindableUi
|
|
15
|
+
from .base import BindableUi
|
|
16
|
+
from ex4nicegui.reactive.services import color_service
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
class IconBindableUi(BindableUi[ui.icon]):
|
|
@@ -35,7 +34,7 @@ class IconBindableUi(BindableUi[ui.icon]):
|
|
|
35
34
|
for key, value in pc.get_bindings().items():
|
|
36
35
|
self.bind_prop(key, value) # type: ignore
|
|
37
36
|
|
|
38
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
37
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
39
38
|
if prop == "name":
|
|
40
39
|
return self.bind_name(ref_ui)
|
|
41
40
|
|
|
@@ -44,11 +43,11 @@ class IconBindableUi(BindableUi[ui.icon]):
|
|
|
44
43
|
|
|
45
44
|
return super().bind_prop(prop, ref_ui)
|
|
46
45
|
|
|
47
|
-
def bind_color(self, ref_ui:
|
|
48
|
-
return
|
|
46
|
+
def bind_color(self, ref_ui: TGetterOrReadonlyRef):
|
|
47
|
+
return color_service.bind_color(self, ref_ui)
|
|
49
48
|
|
|
50
|
-
def bind_name(self, ref_ui:
|
|
51
|
-
@
|
|
49
|
+
def bind_name(self, ref_ui: TGetterOrReadonlyRef):
|
|
50
|
+
@self._ui_effect
|
|
52
51
|
def _():
|
|
53
52
|
ele = cast(TextColorElement, self.element)
|
|
54
53
|
ele._props["name"] = to_value(ref_ui)
|
|
@@ -2,11 +2,9 @@ from pathlib import Path
|
|
|
2
2
|
from typing import (
|
|
3
3
|
Union,
|
|
4
4
|
)
|
|
5
|
-
from ex4nicegui.reactive.
|
|
6
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
7
|
-
|
|
5
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
8
6
|
from ex4nicegui.utils.signals import (
|
|
9
|
-
|
|
7
|
+
TGetterOrReadonlyRef,
|
|
10
8
|
_TMaybeRef as TMaybeRef,
|
|
11
9
|
to_value,
|
|
12
10
|
)
|
|
@@ -27,13 +25,13 @@ class ImageBindableUi(BindableUi[ui.image]):
|
|
|
27
25
|
for key, value in pc.get_bindings().items():
|
|
28
26
|
self.bind_prop(key, value) # type: ignore
|
|
29
27
|
|
|
30
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
28
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
31
29
|
if prop == "source":
|
|
32
30
|
return self.bind_source(ref_ui)
|
|
33
31
|
|
|
34
32
|
return super().bind_prop(prop, ref_ui)
|
|
35
33
|
|
|
36
|
-
def bind_source(self, ref_ui:
|
|
37
|
-
@
|
|
34
|
+
def bind_source(self, ref_ui: TGetterOrReadonlyRef[Union[str, Path]]):
|
|
35
|
+
@self._ui_effect
|
|
38
36
|
def _():
|
|
39
37
|
self.element.set_source(to_value(ref_ui))
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
from typing import Any, Callable, List, Optional, Dict, cast
|
|
2
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
from ex4nicegui.utils.signals import (
|
|
6
|
-
|
|
5
|
+
TGetterOrReadonlyRef,
|
|
7
6
|
Ref,
|
|
8
7
|
_TMaybeRef as TMaybeRef,
|
|
9
|
-
effect,
|
|
10
8
|
is_setter_ref,
|
|
11
9
|
to_value,
|
|
12
10
|
)
|
|
@@ -14,7 +12,7 @@ from ex4nicegui.utils.signals import (
|
|
|
14
12
|
from nicegui import ui
|
|
15
13
|
from nicegui.events import handle_event
|
|
16
14
|
from .base import BindableUi, DisableableMixin
|
|
17
|
-
from ex4nicegui.reactive.
|
|
15
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
18
16
|
|
|
19
17
|
|
|
20
18
|
class InputBindableUi(BindableUi[ui.input], DisableableMixin):
|
|
@@ -53,7 +51,7 @@ class InputBindableUi(BindableUi[ui.input], DisableableMixin):
|
|
|
53
51
|
for key, value in pc.get_bindings().items():
|
|
54
52
|
self.bind_prop(key, value) # type: ignore
|
|
55
53
|
|
|
56
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
54
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
57
55
|
if prop == "value":
|
|
58
56
|
return self.bind_value(ref_ui)
|
|
59
57
|
if prop == "password":
|
|
@@ -61,16 +59,16 @@ class InputBindableUi(BindableUi[ui.input], DisableableMixin):
|
|
|
61
59
|
|
|
62
60
|
return super().bind_prop(prop, ref_ui)
|
|
63
61
|
|
|
64
|
-
def bind_value(self, ref_ui:
|
|
65
|
-
@
|
|
62
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef[str]):
|
|
63
|
+
@self._ui_effect
|
|
66
64
|
def _():
|
|
67
65
|
self.element.set_value(to_value(ref_ui))
|
|
68
66
|
self.element.update()
|
|
69
67
|
|
|
70
68
|
return self
|
|
71
69
|
|
|
72
|
-
def bind_password(self, ref_ui:
|
|
73
|
-
@
|
|
70
|
+
def bind_password(self, ref_ui: TGetterOrReadonlyRef[bool]):
|
|
71
|
+
@self._ui_effect
|
|
74
72
|
def _():
|
|
75
73
|
self.element._props["type"] = "password" if to_value(ref_ui) else "text"
|
|
76
74
|
self.element.update()
|
|
@@ -116,7 +114,7 @@ class LazyInputBindableUi(InputBindableUi):
|
|
|
116
114
|
|
|
117
115
|
ele = self.element
|
|
118
116
|
|
|
119
|
-
@
|
|
117
|
+
@self._ui_effect
|
|
120
118
|
def _():
|
|
121
119
|
ele.value = ref.value
|
|
122
120
|
|
|
@@ -3,13 +3,11 @@ from typing import (
|
|
|
3
3
|
Callable,
|
|
4
4
|
Optional,
|
|
5
5
|
)
|
|
6
|
-
from ex4nicegui.reactive.
|
|
7
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
8
|
-
|
|
6
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
9
7
|
from ex4nicegui.utils.signals import (
|
|
10
|
-
ReadonlyRef,
|
|
11
8
|
_TMaybeRef as TMaybeRef,
|
|
12
9
|
to_value,
|
|
10
|
+
TGetterOrReadonlyRef,
|
|
13
11
|
)
|
|
14
12
|
from nicegui import ui
|
|
15
13
|
from .base import BindableUi, DisableableMixin
|
|
@@ -61,14 +59,14 @@ class KnobBindableUi(
|
|
|
61
59
|
def value(self):
|
|
62
60
|
return self.element.value
|
|
63
61
|
|
|
64
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
62
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
65
63
|
if prop == "value":
|
|
66
64
|
return self.bind_value(ref_ui)
|
|
67
65
|
|
|
68
66
|
return super().bind_prop(prop, ref_ui)
|
|
69
67
|
|
|
70
|
-
def bind_value(self, ref_ui:
|
|
71
|
-
@
|
|
68
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef[float]):
|
|
69
|
+
@self._ui_effect
|
|
72
70
|
def _():
|
|
73
71
|
self.element.set_value(to_value(ref_ui))
|
|
74
72
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from ex4nicegui.reactive.
|
|
2
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
3
3
|
from ex4nicegui.utils.signals import (
|
|
4
|
+
TGetterOrReadonlyRef,
|
|
4
5
|
to_value,
|
|
5
6
|
_TMaybeRef as TMaybeRef,
|
|
6
7
|
)
|
|
@@ -25,7 +26,7 @@ class LabelBindableUi(BindableUi[ui.label]):
|
|
|
25
26
|
def text(self):
|
|
26
27
|
return self.element.text
|
|
27
28
|
|
|
28
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
29
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
29
30
|
if prop == "text":
|
|
30
31
|
return self.bind_text(ref_ui)
|
|
31
32
|
|
|
@@ -34,7 +35,7 @@ class LabelBindableUi(BindableUi[ui.label]):
|
|
|
34
35
|
|
|
35
36
|
return super().bind_prop(prop, ref_ui)
|
|
36
37
|
|
|
37
|
-
def bind_color(self, ref_ui:
|
|
38
|
+
def bind_color(self, ref_ui: TGetterOrReadonlyRef):
|
|
38
39
|
@self._ui_effect
|
|
39
40
|
def _():
|
|
40
41
|
ele = self.element
|
|
@@ -42,7 +43,7 @@ class LabelBindableUi(BindableUi[ui.label]):
|
|
|
42
43
|
ele._style["color"] = color
|
|
43
44
|
ele.update()
|
|
44
45
|
|
|
45
|
-
def bind_text(self, ref_ui:
|
|
46
|
+
def bind_text(self, ref_ui: TGetterOrReadonlyRef):
|
|
46
47
|
@self._ui_effect
|
|
47
48
|
def _():
|
|
48
49
|
self.element.set_text(str(to_value(ref_ui)))
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Optional,
|
|
3
3
|
)
|
|
4
|
-
from ex4nicegui.reactive.
|
|
5
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
6
|
-
|
|
4
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
7
5
|
from ex4nicegui.utils.signals import (
|
|
8
|
-
|
|
6
|
+
TGetterOrReadonlyRef,
|
|
9
7
|
_TMaybeRef as TMaybeRef,
|
|
10
8
|
to_value,
|
|
11
9
|
)
|
|
12
10
|
from nicegui import ui
|
|
13
11
|
|
|
14
|
-
from .base import BindableUi
|
|
12
|
+
from .base import BindableUi
|
|
13
|
+
from ex4nicegui.reactive.services import color_service
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
class LinearProgressBindableUi(BindableUi[ui.linear_progress]):
|
|
@@ -47,7 +46,7 @@ class LinearProgressBindableUi(BindableUi[ui.linear_progress]):
|
|
|
47
46
|
def value(self):
|
|
48
47
|
return self.element.value
|
|
49
48
|
|
|
50
|
-
def bind_prop(self, prop: str, ref_ui:
|
|
49
|
+
def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
|
|
51
50
|
if prop == "value":
|
|
52
51
|
return self.bind_value(ref_ui)
|
|
53
52
|
|
|
@@ -56,11 +55,11 @@ class LinearProgressBindableUi(BindableUi[ui.linear_progress]):
|
|
|
56
55
|
|
|
57
56
|
return super().bind_prop(prop, ref_ui)
|
|
58
57
|
|
|
59
|
-
def bind_color(self, ref_ui:
|
|
60
|
-
return
|
|
58
|
+
def bind_color(self, ref_ui: TGetterOrReadonlyRef):
|
|
59
|
+
return color_service.bind_color(self, ref_ui)
|
|
61
60
|
|
|
62
|
-
def bind_value(self, ref_ui:
|
|
63
|
-
@
|
|
61
|
+
def bind_value(self, ref_ui: TGetterOrReadonlyRef):
|
|
62
|
+
@self._ui_effect
|
|
64
63
|
def _():
|
|
65
64
|
self.element.set_value(to_value(ref_ui))
|
|
66
65
|
|