ex4nicegui 0.6.5__py3-none-any.whl → 0.6.7__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.
Files changed (42) hide show
  1. ex4nicegui/__init__.py +3 -2
  2. ex4nicegui/bi/elements/ui_echarts.py +2 -5
  3. ex4nicegui/libs/gsap/.DS_Store +0 -0
  4. ex4nicegui/libs/gsap/gsap.mjs +6 -0
  5. ex4nicegui/reactive/EChartsComponent/ECharts.js +69 -86
  6. ex4nicegui/reactive/EChartsComponent/ECharts.py +20 -103
  7. ex4nicegui/reactive/EChartsComponent/events.py +26 -0
  8. ex4nicegui/reactive/EChartsComponent/types.py +51 -0
  9. ex4nicegui/reactive/EChartsComponent/utils.py +44 -0
  10. ex4nicegui/reactive/deferredTask.py +29 -0
  11. ex4nicegui/reactive/officials/aggrid.py +3 -3
  12. ex4nicegui/reactive/officials/base.py +10 -0
  13. ex4nicegui/reactive/officials/button.py +4 -4
  14. ex4nicegui/reactive/officials/checkbox.py +3 -3
  15. ex4nicegui/reactive/officials/circular_progress.py +3 -3
  16. ex4nicegui/reactive/officials/color_picker.py +4 -4
  17. ex4nicegui/reactive/officials/column.py +3 -2
  18. ex4nicegui/reactive/officials/date.py +4 -9
  19. ex4nicegui/reactive/officials/echarts.py +39 -34
  20. ex4nicegui/reactive/officials/expansion.py +3 -2
  21. ex4nicegui/reactive/officials/icon.py +4 -4
  22. ex4nicegui/reactive/officials/image.py +3 -3
  23. ex4nicegui/reactive/officials/input.py +4 -4
  24. ex4nicegui/reactive/officials/knob.py +3 -3
  25. ex4nicegui/reactive/officials/label.py +4 -3
  26. ex4nicegui/reactive/officials/linear_progress.py +4 -4
  27. ex4nicegui/reactive/officials/number.py +24 -5
  28. ex4nicegui/reactive/officials/radio.py +4 -4
  29. ex4nicegui/reactive/officials/select.py +4 -4
  30. ex4nicegui/reactive/officials/slider.py +3 -3
  31. ex4nicegui/reactive/officials/switch.py +3 -3
  32. ex4nicegui/reactive/officials/tab_panels.py +14 -2
  33. ex4nicegui/reactive/officials/table.py +5 -4
  34. ex4nicegui/reactive/officials/tabs.py +3 -2
  35. ex4nicegui/reactive/officials/textarea.py +3 -3
  36. ex4nicegui/reactive/q_pagination.py +3 -2
  37. ex4nicegui/utils/clientScope.py +14 -6
  38. {ex4nicegui-0.6.5.dist-info → ex4nicegui-0.6.7.dist-info}/METADATA +1245 -1099
  39. {ex4nicegui-0.6.5.dist-info → ex4nicegui-0.6.7.dist-info}/RECORD +65 -60
  40. {ex4nicegui-0.6.5.dist-info → ex4nicegui-0.6.7.dist-info}/WHEEL +1 -2
  41. ex4nicegui-0.6.5.dist-info/top_level.txt +0 -1
  42. {ex4nicegui-0.6.5.dist-info → ex4nicegui-0.6.7.dist-info}/LICENSE +0 -0
@@ -8,7 +8,7 @@ from ex4nicegui.reactive.utils import ParameterClassifier
8
8
  from ex4nicegui.utils.apiEffect import ui_effect
9
9
 
10
10
  from ex4nicegui.utils.signals import (
11
- ReadonlyRef,
11
+ TGetterOrReadonlyRef,
12
12
  _TMaybeRef as TMaybeRef,
13
13
  to_value,
14
14
  )
@@ -49,13 +49,13 @@ class SwitchBindableUi(BindableUi[ui.switch]):
49
49
  def value(self):
50
50
  return self.element.value
51
51
 
52
- def bind_prop(self, prop: str, ref_ui: ReadonlyRef):
52
+ def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
53
53
  if prop == "value":
54
54
  return self.bind_value(ref_ui)
55
55
 
56
56
  return super().bind_prop(prop, ref_ui)
57
57
 
58
- def bind_value(self, ref_ui: ReadonlyRef[bool]):
58
+ def bind_value(self, ref_ui: TGetterOrReadonlyRef[bool]):
59
59
  @ui_effect
60
60
  def _():
61
61
  self.element.set_value(to_value(ref_ui))
@@ -1,6 +1,7 @@
1
1
  from typing import Any, Callable, Optional
2
2
  from ex4nicegui.reactive.utils import ParameterClassifier
3
3
  from ex4nicegui.utils.signals import (
4
+ TGetterOrReadonlyRef,
4
5
  to_value,
5
6
  _TMaybeRef as TMaybeRef,
6
7
  )
@@ -17,6 +18,17 @@ class TabPanelsBindableUi(BindableUi[ui.tab_panels]):
17
18
  animated: TMaybeRef[bool] = True,
18
19
  keep_alive: TMaybeRef[bool] = True,
19
20
  ) -> None:
21
+ """Tab Panels
22
+
23
+ @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#tab_panels
24
+ @中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#tab_panels
25
+
26
+ Args:
27
+ value (TMaybeRef[str], optional): The value of the tab panel. Defaults to None.
28
+ on_change (Callable[..., Any], optional): The callback function when the value of the tab panel changes. Defaults to None.
29
+ animated (TMaybeRef[bool], optional): Whether to animate the tab panel. Defaults to True.
30
+ keep_alive (TMaybeRef[bool], optional): Whether to keep the tab panel alive. Defaults to True.
31
+ """
20
32
  pc = ParameterClassifier(
21
33
  locals(),
22
34
  maybeRefs=["value", "animated", "keep_alive"],
@@ -34,13 +46,13 @@ class TabPanelsBindableUi(BindableUi[ui.tab_panels]):
34
46
  def value(self):
35
47
  return self.element.value
36
48
 
37
- def bind_prop(self, prop: str, ref_ui: TMaybeRef):
49
+ def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
38
50
  if prop == "value":
39
51
  return self.bind_value(ref_ui)
40
52
 
41
53
  return super().bind_prop(prop, ref_ui)
42
54
 
43
- def bind_value(self, ref_ui: TMaybeRef):
55
+ def bind_value(self, ref_ui: TGetterOrReadonlyRef):
44
56
  @self._ui_effect
45
57
  def _():
46
58
  self.element.set_value(to_value(ref_ui))
@@ -9,6 +9,7 @@ from typing_extensions import Literal
9
9
  from ex4nicegui.reactive.utils import ParameterClassifier, dataframe2col_str
10
10
  import ex4nicegui.utils.common as utils_common
11
11
  from ex4nicegui.utils.signals import (
12
+ TGetterOrReadonlyRef,
12
13
  ReadonlyRef,
13
14
  is_ref,
14
15
  ref_computed,
@@ -143,7 +144,7 @@ class TableBindableUi(BindableUi[ui.table]):
143
144
  ]
144
145
  return cls(cols, rows, **other_kws)
145
146
 
146
- def bind_prop(self, prop: str, ref_ui: ReadonlyRef):
147
+ def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
147
148
  if prop == "dataframe":
148
149
  return self.bind_dataframe(ref_ui)
149
150
 
@@ -155,7 +156,7 @@ class TableBindableUi(BindableUi[ui.table]):
155
156
 
156
157
  return super().bind_prop(prop, ref_ui)
157
158
 
158
- def bind_dataframe(self, ref_df: ReadonlyRef):
159
+ def bind_dataframe(self, ref_df: TGetterOrReadonlyRef):
159
160
  @ref_computed
160
161
  def cp_converted_df():
161
162
  df = ref_df.value
@@ -180,7 +181,7 @@ class TableBindableUi(BindableUi[ui.table]):
180
181
 
181
182
  return self
182
183
 
183
- def bind_rows(self, ref_ui: ReadonlyRef[List[Dict]]):
184
+ def bind_rows(self, ref_ui: TGetterOrReadonlyRef[List[Dict]]):
184
185
  @on(ref_ui, deep=True)
185
186
  def _():
186
187
  ele = self.element
@@ -189,7 +190,7 @@ class TableBindableUi(BindableUi[ui.table]):
189
190
 
190
191
  return self
191
192
 
192
- def bind_columns(self, ref_ui: ReadonlyRef[List[Dict]]):
193
+ def bind_columns(self, ref_ui: TGetterOrReadonlyRef[List[Dict]]):
193
194
  @on(ref_ui, deep=True)
194
195
  def _():
195
196
  ele = self.element
@@ -1,6 +1,7 @@
1
1
  from typing import Any, Callable, Optional
2
2
  from ex4nicegui.reactive.utils import ParameterClassifier
3
3
  from ex4nicegui.utils.signals import (
4
+ TGetterOrReadonlyRef,
4
5
  to_value,
5
6
  _TMaybeRef as TMaybeRef,
6
7
  )
@@ -31,13 +32,13 @@ class TabsBindableUi(BindableUi[ui.tabs]):
31
32
  def value(self):
32
33
  return self.element.value
33
34
 
34
- def bind_prop(self, prop: str, ref_ui: TMaybeRef):
35
+ def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
35
36
  if prop == "value":
36
37
  return self.bind_value(ref_ui)
37
38
 
38
39
  return super().bind_prop(prop, ref_ui)
39
40
 
40
- def bind_value(self, ref_ui: TMaybeRef):
41
+ def bind_value(self, ref_ui: TGetterOrReadonlyRef):
41
42
  @self._ui_effect
42
43
  def _():
43
44
  self.element.set_value(to_value(ref_ui))
@@ -8,7 +8,7 @@ from typing import (
8
8
  from ex4nicegui.reactive.utils import ParameterClassifier
9
9
  from ex4nicegui.utils.apiEffect import ui_effect
10
10
  from ex4nicegui.utils.signals import (
11
- ReadonlyRef,
11
+ TGetterOrReadonlyRef,
12
12
  Ref,
13
13
  _TMaybeRef as TMaybeRef,
14
14
  effect,
@@ -54,13 +54,13 @@ class TextareaBindableUi(BindableUi[ui.textarea]):
54
54
  def value(self):
55
55
  return self.element.value
56
56
 
57
- def bind_prop(self, prop: str, ref_ui: ReadonlyRef):
57
+ def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
58
58
  if prop == "value":
59
59
  return self.bind_value(ref_ui)
60
60
 
61
61
  return super().bind_prop(prop, ref_ui)
62
62
 
63
- def bind_value(self, ref_ui: ReadonlyRef[str]):
63
+ def bind_value(self, ref_ui: TGetterOrReadonlyRef[str]):
64
64
  @ui_effect
65
65
  def _():
66
66
  self.element.set_value(to_value(ref_ui))
@@ -1,6 +1,7 @@
1
1
  from typing import Any, Optional, Callable
2
2
  from ex4nicegui.reactive.utils import ParameterClassifier
3
3
  from ex4nicegui.utils.signals import (
4
+ TGetterOrReadonlyRef,
4
5
  to_value,
5
6
  _TMaybeRef as TMaybeRef,
6
7
  )
@@ -35,13 +36,13 @@ class PaginationBindableUi(BindableUi[ui.pagination]):
35
36
  def value(self):
36
37
  return self.element.value
37
38
 
38
- def bind_prop(self, prop: str, ref_ui: TMaybeRef):
39
+ def bind_prop(self, prop: str, ref_ui: TGetterOrReadonlyRef):
39
40
  if prop == "value":
40
41
  return self.bind_value(ref_ui)
41
42
 
42
43
  return super().bind_prop(prop, ref_ui)
43
44
 
44
- def bind_value(self, ref_ui: TMaybeRef[int]):
45
+ def bind_value(self, ref_ui: TGetterOrReadonlyRef[int]):
45
46
  @self._ui_effect
46
47
  def _():
47
48
  self.element.set_value(to_value(ref_ui))
@@ -2,7 +2,6 @@ from typing import Dict
2
2
  from signe.core.scope import ScopeSuite
3
3
  from nicegui import Client, ui
4
4
 
5
-
6
5
  _TClientID = str
7
6
 
8
7
 
@@ -18,12 +17,18 @@ class NgClientScopeManager:
18
17
  self._client_scope_map: Dict[_TClientID, NgScopeSuite] = {}
19
18
 
20
19
  def new_scope(self, detached: bool = False):
21
- return self.get_current_scope().scope(detached)
20
+ """Create a scope that can collect all reactive watch functions within it, allowing for a unified destruction process.
22
21
 
23
- def get_current_scope(self):
24
- # if len(ng_context.get_slot_stack()) <= 0:
25
- # return
22
+ @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#new_scope
23
+ @中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#new_scope
24
+
25
+ Args:
26
+ detached (bool, optional): Whether the scope should be detached from the client. Defaults to False.
27
+
28
+ """
29
+ return self.get_current_scope().scope(detached=detached)
26
30
 
31
+ def get_current_scope(self):
27
32
  client = ui.context.client
28
33
 
29
34
  if client.id not in self._client_scope_map:
@@ -35,10 +40,13 @@ class NgClientScopeManager:
35
40
  @client.on_disconnect
36
41
  def _(e: Client):
37
42
  if e.id in self._client_scope_map:
38
- self._client_scope_map[e.id]._top_scope.dispose()
43
+ self._client_scope_map[e.id]._top_scope.dispose() # type: ignore
39
44
  del self._client_scope_map[e.id]
40
45
 
41
46
  return self._client_scope_map[client.id]
42
47
 
43
48
 
44
49
  _CLIENT_SCOPE_MANAGER = NgClientScopeManager()
50
+
51
+
52
+ new_scope = _CLIENT_SCOPE_MANAGER.new_scope