ex4nicegui 0.6.5__tar.gz → 0.6.6__tar.gz

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 (160) hide show
  1. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/PKG-INFO +26 -1
  2. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/README.md +25 -0
  3. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/__init__.py +3 -2
  4. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_echarts.py +2 -5
  5. ex4nicegui-0.6.6/ex4nicegui/reactive/EChartsComponent/ECharts.js +112 -0
  6. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/EChartsComponent/ECharts.py +20 -103
  7. ex4nicegui-0.6.6/ex4nicegui/reactive/EChartsComponent/events.py +26 -0
  8. ex4nicegui-0.6.6/ex4nicegui/reactive/EChartsComponent/types.py +51 -0
  9. ex4nicegui-0.6.6/ex4nicegui/reactive/EChartsComponent/utils.py +44 -0
  10. ex4nicegui-0.6.6/ex4nicegui/reactive/deferredTask.py +29 -0
  11. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/echarts.py +14 -27
  12. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/number.py +2 -1
  13. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/clientScope.py +14 -6
  14. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui.egg-info/PKG-INFO +26 -1
  15. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui.egg-info/SOURCES.txt +4 -0
  16. ex4nicegui-0.6.5/ex4nicegui/reactive/EChartsComponent/ECharts.js +0 -139
  17. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/LICENSE +0 -0
  18. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/__init__.py +0 -0
  19. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/dataSource.py +0 -0
  20. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/dataSourceFacade.py +0 -0
  21. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/__init__.py +0 -0
  22. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/containers.py +0 -0
  23. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/layouts.py +0 -0
  24. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/models.py +0 -0
  25. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/text.py +0 -0
  26. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_aggrid.py +0 -0
  27. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_date_picker.js +0 -0
  28. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_date_picker.py +0 -0
  29. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_radio.py +0 -0
  30. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_range.py +0 -0
  31. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_select.py +0 -0
  32. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_slider.py +0 -0
  33. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/elements/ui_table.py +0 -0
  34. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/index.py +0 -0
  35. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/protocols.py +0 -0
  36. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/bi/types.py +0 -0
  37. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/experimental_/__init__.py +0 -0
  38. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/experimental_/gridLayout/__init__.py +0 -0
  39. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/experimental_/gridLayout/index.py +0 -0
  40. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/gsap/__init__.py +0 -0
  41. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/gsap/gsap.py +0 -0
  42. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/gsap/timeline.js +0 -0
  43. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/gsap/timeline.py +0 -0
  44. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/gsap/wrapGsap.js +0 -0
  45. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/__init__.py +0 -0
  46. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/gridFlex/GridFlex.js +0 -0
  47. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/gridFlex/__init__.py +0 -0
  48. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/gridFlex/gridFlex.py +0 -0
  49. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/gridFlex/utils.py +0 -0
  50. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/rxFlex/__init__.py +0 -0
  51. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/rxFlex/index.py +0 -0
  52. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/layout/rxFlex/types.py +0 -0
  53. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/__init__.py +0 -0
  54. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/__init__.py +0 -0
  55. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-color.ems.js +0 -0
  56. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-dispatch.ems.js +0 -0
  57. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-drag.ems.js +0 -0
  58. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-ease.ems.js +0 -0
  59. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-interpolate.ems.js +0 -0
  60. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-selection.ems.js +0 -0
  61. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-timer.ems.js +0 -0
  62. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-transition.ems.js +0 -0
  63. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/d3/d3-zoom.ems.js +0 -0
  64. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/CSSPlugin.js +0 -0
  65. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/CSSRulePlugin.js +0 -0
  66. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/CustomEase.js +0 -0
  67. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/Draggable.js +0 -0
  68. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/EasePack.js +0 -0
  69. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/EaselPlugin.js +0 -0
  70. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/Flip.js +0 -0
  71. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/MotionPathPlugin.js +0 -0
  72. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/Observer.js +0 -0
  73. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/PixiPlugin.js +0 -0
  74. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/ScrollToPlugin.js +0 -0
  75. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/ScrollTrigger.js +0 -0
  76. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/TextPlugin.js +0 -0
  77. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/__init__.py +0 -0
  78. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/all.js +0 -0
  79. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/gsap-core.js +0 -0
  80. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/utils/__init__.py +0 -0
  81. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/utils/matrix.js +0 -0
  82. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/utils/paths.js +0 -0
  83. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/libs/gsap/utils/strings.js +0 -0
  84. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/EChartsComponent/__init__.py +0 -0
  85. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/UseDraggable/UseDraggable.js +0 -0
  86. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/UseDraggable/UseDraggable.py +0 -0
  87. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/UseDraggable/__init__.py +0 -0
  88. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/__init__.py +0 -0
  89. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/dropZone/__init__.py +0 -0
  90. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/dropZone/dropZone.js +0 -0
  91. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/dropZone/dropZone.py +0 -0
  92. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/empty.js +0 -0
  93. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/empty.py +0 -0
  94. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/fileWatcher.py +0 -0
  95. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/local_file_picker.py +0 -0
  96. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/mermaid/__init__.py +0 -0
  97. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/mermaid/mermaid.js +0 -0
  98. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/mermaid/mermaid.py +0 -0
  99. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/__init__.py +0 -0
  100. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/aggrid.py +0 -0
  101. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/base.py +0 -0
  102. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/button.py +0 -0
  103. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/card.py +0 -0
  104. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/checkbox.py +0 -0
  105. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/circular_progress.py +0 -0
  106. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/color_picker.py +0 -0
  107. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/column.py +0 -0
  108. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/date.py +0 -0
  109. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/drawer.py +0 -0
  110. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/element.py +0 -0
  111. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/expansion.py +0 -0
  112. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/grid.py +0 -0
  113. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/html.js +0 -0
  114. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/html.py +0 -0
  115. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/icon.py +0 -0
  116. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/image.py +0 -0
  117. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/input.py +0 -0
  118. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/knob.py +0 -0
  119. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/label.py +0 -0
  120. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/linear_progress.py +0 -0
  121. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/radio.py +0 -0
  122. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/row.py +0 -0
  123. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/select.py +0 -0
  124. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/slider.py +0 -0
  125. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/switch.py +0 -0
  126. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/tab.py +0 -0
  127. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/tab_panel.py +0 -0
  128. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/tab_panels.py +0 -0
  129. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/table.py +0 -0
  130. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/tabs.py +0 -0
  131. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/textarea.py +0 -0
  132. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/upload.py +0 -0
  133. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/officials/utils.py +0 -0
  134. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/q_pagination.py +0 -0
  135. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/rxui.py +0 -0
  136. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/transitionGroup.js +0 -0
  137. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/transitionGroup.py +0 -0
  138. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/useMouse/UseMouse.js +0 -0
  139. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/useMouse/UseMouse.py +0 -0
  140. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/useMouse/__init__.py +0 -0
  141. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/usePagination.py +0 -0
  142. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/utils.py +0 -0
  143. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/vfor.js +0 -0
  144. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/vfor.py +0 -0
  145. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/reactive/vmodel.py +0 -0
  146. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/tools/__init__.py +0 -0
  147. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/tools/debug.py +0 -0
  148. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/__init__.py +0 -0
  149. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/apiEffect.py +0 -0
  150. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/asyncComputed.py +0 -0
  151. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/common.py +0 -0
  152. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/effect.py +0 -0
  153. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/scheduler.py +0 -0
  154. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui/utils/signals.py +0 -0
  155. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui.egg-info/dependency_links.txt +0 -0
  156. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui.egg-info/not-zip-safe +0 -0
  157. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui.egg-info/requires.txt +0 -0
  158. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/ex4nicegui.egg-info/top_level.txt +0 -0
  159. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/setup.cfg +0 -0
  160. {ex4nicegui-0.6.5 → ex4nicegui-0.6.6}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ex4nicegui
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: Extension library based on nicegui, providing data responsive,BI functionality modules
5
5
  Home-page:
6
6
  Author: carson_jia
@@ -420,6 +420,31 @@ ui.button("change b", on_click=change_b)
420
420
 
421
421
  ---
422
422
 
423
+ ### `new_scope`
424
+
425
+ By default, all watch functions are automatically destroyed when the client connection is disconnected. For finer-grained control, the `new_scope` function can be utilized.
426
+
427
+ ```python
428
+ from nicegui import ui
429
+ from ex4nicegui import rxui, to_ref, effect, new_scope
430
+
431
+ a = to_ref(0.0)
432
+
433
+ scope1 = new_scope()
434
+
435
+ @scope1.run
436
+ def _():
437
+ @effect
438
+ def _():
439
+ print(f"scope 1:{a.value}")
440
+
441
+
442
+ rxui.number(value=a)
443
+ rxui.button("dispose scope 1", on_click=scope1.dispose)
444
+ ```
445
+
446
+ ---
447
+
423
448
  ## functionality
424
449
 
425
450
  ### vmodel
@@ -414,6 +414,31 @@ ui.button("change b", on_click=change_b)
414
414
 
415
415
  ---
416
416
 
417
+ ### `new_scope`
418
+
419
+ 默认情况下,所有检测函数在客户端连接断开时自动销毁。如果需要更细粒度的控制,可以使用 `new_scope`
420
+
421
+ ```python
422
+ from nicegui import ui
423
+ from ex4nicegui import rxui, to_ref, effect, new_scope
424
+
425
+ a = to_ref(0.0)
426
+
427
+ scope1 = new_scope()
428
+
429
+ @scope1.run
430
+ def _():
431
+ @effect
432
+ def _():
433
+ print(f"scope 1:{a.value}")
434
+
435
+
436
+ rxui.number(value=a)
437
+ rxui.button("dispose scope 1", on_click=scope1.dispose)
438
+ ```
439
+
440
+ ---
441
+
417
442
 
418
443
  ## 组件功能
419
444
 
@@ -20,7 +20,7 @@ from ex4nicegui.utils.signals import (
20
20
  is_reactive,
21
21
  )
22
22
  from ex4nicegui.utils.asyncComputed import async_computed
23
-
23
+ from ex4nicegui.utils.clientScope import new_scope
24
24
 
25
25
  __all__ = [
26
26
  "async_computed",
@@ -43,6 +43,7 @@ __all__ = [
43
43
  "batch",
44
44
  "to_raw",
45
45
  "is_setter_ref",
46
+ "new_scope",
46
47
  ]
47
48
 
48
- __version__ = "0.6.5"
49
+ __version__ = "0.6.6"
@@ -2,10 +2,7 @@ from __future__ import annotations
2
2
  from typing import TYPE_CHECKING, Any, Callable, Dict, Union, cast
3
3
  from nicegui.events import UiEventArguments
4
4
  from ex4nicegui.reactive import rxui
5
- from ex4nicegui.reactive.EChartsComponent.ECharts import (
6
- EChartsMouseEventArguments,
7
- echarts,
8
- )
5
+ from ex4nicegui.reactive.EChartsComponent.ECharts import echarts
9
6
  from nicegui import ui
10
7
  from ex4nicegui.bi.dataSource import DataSource
11
8
  from .models import UiResult
@@ -21,7 +18,7 @@ class EChartsResult(UiResult[echarts]):
21
18
  super().__init__(element, dataSource)
22
19
  self.chart_update = chart_update
23
20
 
24
- def on_chart_click(self, handler: Callable[[EChartsMouseEventArguments], Any]):
21
+ def on_chart_click(self, handler: Callable[[UiEventArguments], Any]):
25
22
  return self.element.echarts_on("click", handler)
26
23
 
27
24
  def on_chart_click_blank(self, handler: Callable[[UiEventArguments], Any]):
@@ -0,0 +1,112 @@
1
+ import { convertDynamicProperties } from "../../static/utils/dynamic_properties.js";
2
+
3
+ function collectMapRegisterTask() {
4
+ const tasks = new Map();
5
+
6
+ if (typeof window.ex4ngEchartsMapTasks !== "undefined") {
7
+
8
+ for (const [mapName, src] of window.ex4ngEchartsMapTasks.entries()) {
9
+
10
+ const registerPromise = new Promise((resolve, reject) => {
11
+ fetch(src)
12
+ .then((response) => response.json())
13
+ .then((data) => {
14
+ echarts.registerMap(mapName, data);
15
+ resolve();
16
+ });
17
+
18
+ });
19
+
20
+ tasks.set(mapName, registerPromise);
21
+ }
22
+ }
23
+
24
+ return tasks;
25
+ }
26
+
27
+ function hasMapOrGeo(options) {
28
+ if (options) {
29
+ const hasMapSeries = options.series && Array.isArray(options.series) &&
30
+ options.series.some(seriesItem =>
31
+ seriesItem.type === 'map' ||
32
+ seriesItem.type === 'lines'
33
+ );
34
+
35
+ const hasGeoConfig = options.geo && (typeof options.geo === 'object' || Array.isArray(options.geo));
36
+
37
+ return hasMapSeries || hasGeoConfig;
38
+ }
39
+ return false;
40
+ }
41
+
42
+ const mapRegisterTasks = collectMapRegisterTask();
43
+
44
+ export default {
45
+ template: "<div></div>",
46
+ async mounted() {
47
+ await this.$nextTick(); // wait for Tailwind classes to be applied
48
+
49
+ if (hasMapOrGeo(this.options)) {
50
+ await Promise.all(Array.from(mapRegisterTasks.values()));
51
+ }
52
+
53
+ this.chart = echarts.init(this.$el, this.theme);
54
+
55
+ this.resizeObs = new ResizeObserver(this.chart.resize)
56
+
57
+ // Prevent interruption of chart animations due to resize operations.
58
+ // It is recommended to register the callbacks for such an event before setOption.
59
+ const createResizeObserver = () => {
60
+ this.resizeObs.observe(this.$el);
61
+ this.chart.off("finished", createResizeObserver);
62
+ };
63
+ this.chart.on("finished", createResizeObserver);
64
+
65
+ if (this.options) {
66
+ this.update_chart();
67
+ } else {
68
+ const fn = new Function('return ' + this.code)()
69
+ fn(this.chart)
70
+ this.$emit("__update_options_from_client", this.chart.getOption())
71
+ }
72
+ this.chart.getZr().on("click", (e) => {
73
+ if (!e.target) {
74
+ this.$emit("clickBlank")
75
+ }
76
+ });
77
+
78
+ },
79
+ beforeDestroy() {
80
+ this.chart.dispose();
81
+ this.resizeObs.unobserve();
82
+ },
83
+ beforeUnmount() {
84
+ this.chart.dispose();
85
+ this.resizeObs.unobserve();
86
+ },
87
+ methods: {
88
+ update_chart(opts) {
89
+ convertDynamicProperties(this.options, true);
90
+ this.chart.setOption(this.options, opts ?? { notMerge: this.chart.options?.series.length != this.options.series.length });
91
+ },
92
+
93
+ echarts_on(eventName, query) {
94
+ this.chart.on(eventName.replace(/^chart:/, ''), query, (e) => {
95
+ this.$emit(eventName, e);
96
+ });
97
+ },
98
+
99
+ run_chart_method(name, ...args) {
100
+ if (name.startsWith(":")) {
101
+ name = name.slice(1);
102
+ args = args.map((arg) => new Function("return " + arg)());
103
+ }
104
+ return runMethod(this.chart, name, args);
105
+ },
106
+ },
107
+ props: {
108
+ options: Object | undefined,
109
+ theme: String | Object | undefined,
110
+ code: String | undefined,
111
+ },
112
+ };
@@ -3,70 +3,26 @@ from typing import (
3
3
  Any,
4
4
  Callable,
5
5
  Dict,
6
- List,
7
6
  Optional,
8
7
  Union,
9
8
  )
10
- from typing_extensions import Literal
11
- from dataclasses import dataclass
12
- from nicegui.dataclasses import KWONLY_SLOTS
13
- from nicegui.events import (
14
- handle_event,
15
- UiEventArguments,
16
- )
9
+
10
+ from nicegui.events import handle_event, UiEventArguments, GenericEventArguments
17
11
  from nicegui.element import Element
18
12
  from nicegui.awaitable_response import AwaitableResponse
19
- from nicegui import ui
20
13
  from pathlib import Path
21
14
  import nicegui
22
- import uuid
15
+
16
+ from .types import (
17
+ _T_event_name,
18
+ )
19
+ from ex4nicegui.reactive.deferredTask import DeferredTask
20
+ from .utils import get_bound_event_args, create_event_handler_args
23
21
 
24
22
  NG_ROOT = Path(nicegui.__file__).parent / "elements"
25
23
  libraries = [NG_ROOT / "lib/echarts/echarts.min.js"]
26
24
 
27
25
 
28
- _Chart_Click_Args = [
29
- "componentType",
30
- "seriesType",
31
- "seriesIndex",
32
- "seriesName",
33
- "name",
34
- "dataIndex",
35
- "data",
36
- "dataType",
37
- "value",
38
- "color",
39
- ]
40
-
41
-
42
- @dataclass(**KWONLY_SLOTS)
43
- class EChartsMouseEventArguments(UiEventArguments):
44
- componentType: str
45
- seriesType: str
46
- seriesIndex: int
47
- seriesName: str
48
- name: str
49
- dataIndex: int
50
- data: dict
51
- dataType: Optional[str]
52
- value: Any
53
- color: str
54
-
55
-
56
- _T_echats_on_callback = Callable[[EChartsMouseEventArguments], Any]
57
- _T_mouse_event_name = Literal[
58
- "click",
59
- "dblclick",
60
- "mousedown",
61
- "mousemove",
62
- "mouseup",
63
- "mouseover",
64
- "mouseout",
65
- "globalout",
66
- "contextmenu",
67
- ]
68
-
69
-
70
26
  class echarts(Element, component="ECharts.js", libraries=libraries): # type: ignore
71
27
  def __init__(
72
28
  self,
@@ -74,6 +30,7 @@ class echarts(Element, component="ECharts.js", libraries=libraries): # type: ig
74
30
  code: Optional[str] = None,
75
31
  ) -> None:
76
32
  super().__init__()
33
+ self.__deferred_task = DeferredTask()
77
34
 
78
35
  if (options is None) and (bool(code) is False):
79
36
  raise ValueError("At least one of options and code must be valid.")
@@ -89,36 +46,6 @@ class echarts(Element, component="ECharts.js", libraries=libraries): # type: ig
89
46
  self._props["options"] = options
90
47
  self._props["code"] = code
91
48
 
92
- self._echarts_on_tasks: List[Callable] = []
93
- self._echarts_on_callback_map: Dict[str, _T_echats_on_callback] = {}
94
-
95
- async def on_client_connect(
96
- client: nicegui.Client,
97
- ) -> Any:
98
- await client.connected()
99
-
100
- for func in self._echarts_on_tasks:
101
- func()
102
-
103
- client.connect_handlers.remove(on_client_connect) # type: ignore
104
-
105
- ui.context.client.on_connect(on_client_connect)
106
-
107
- def echartsOn_handler(e):
108
- callbackId = e.args["callbackId"]
109
- params: Dict = e.args["params"]
110
- params["dataType"] = params.get("dataType")
111
-
112
- if callbackId in self._echarts_on_callback_map:
113
- event_args = EChartsMouseEventArguments(
114
- sender=e.sender, client=e.client, **params
115
- )
116
- handler = self._echarts_on_callback_map[callbackId]
117
-
118
- handle_event(handler, event_args)
119
-
120
- self.on("event_on", echartsOn_handler)
121
-
122
49
  def update_chart(
123
50
  self,
124
51
  merge_opts: Optional[dict] = None,
@@ -164,34 +91,24 @@ class echarts(Element, component="ECharts.js", libraries=libraries): # type: ig
164
91
  ),
165
92
  )
166
93
 
167
- self.on(
168
- "clickBlank",
169
- inner_handler,
170
- _Chart_Click_Args,
171
- )
94
+ self.on("clickBlank", inner_handler)
172
95
 
173
96
  def echarts_on(
174
97
  self,
175
- event_name: _T_mouse_event_name,
176
- handler: _T_echats_on_callback,
98
+ event_name: _T_event_name,
99
+ handler: Callable[[UiEventArguments], None],
177
100
  query: Optional[Union[str, Dict]] = None,
178
101
  ):
179
- if not ui.context.client.has_socket_connection:
102
+ def org_handler(e: GenericEventArguments) -> None:
103
+ event_args = create_event_handler_args(event_name, e)
104
+ handle_event(handler, event_args)
180
105
 
181
- def task_func():
182
- self.echarts_on(event_name, handler, query)
106
+ ui_event_name = f"chart:{event_name}"
107
+ super().on(ui_event_name, org_handler, args=get_bound_event_args(event_name))
183
108
 
184
- self._echarts_on_tasks.append(task_func)
185
- return
186
-
187
- callback_id = uuid.uuid4().hex
188
- self.run_method(
189
- "echarts_on",
190
- event_name,
191
- query,
192
- callback_id,
193
- )
194
- self._echarts_on_callback_map[callback_id] = handler
109
+ @self.__deferred_task.register
110
+ def _():
111
+ self.run_method("echarts_on", ui_event_name, query)
195
112
 
196
113
  def run_chart_method(
197
114
  self, name: str, *args, timeout: float = 1, check_interval: float = 0.01
@@ -0,0 +1,26 @@
1
+ from typing import (
2
+ Any,
3
+ Optional,
4
+ )
5
+ from dataclasses import dataclass, fields
6
+ from nicegui.dataclasses import KWONLY_SLOTS
7
+ from nicegui.events import (
8
+ UiEventArguments,
9
+ )
10
+
11
+
12
+ @dataclass(**KWONLY_SLOTS)
13
+ class EChartsMouseEventArguments(UiEventArguments):
14
+ componentType: str
15
+ seriesType: str
16
+ seriesIndex: int
17
+ seriesName: str
18
+ name: str
19
+ dataIndex: int
20
+ data: dict
21
+ dataType: Optional[str]
22
+ value: Any
23
+ color: str
24
+
25
+
26
+ _Mouse_Event_Arguments_Fields = [f.name for f in fields(EChartsMouseEventArguments)]
@@ -0,0 +1,51 @@
1
+ from typing import (
2
+ Union,
3
+ )
4
+ from typing_extensions import Literal
5
+
6
+
7
+ _T_mouse_event_name = Literal[
8
+ "click",
9
+ "dblclick",
10
+ "mousedown",
11
+ "mousemove",
12
+ "mouseup",
13
+ "mouseover",
14
+ "mouseout",
15
+ "globalout",
16
+ "contextmenu",
17
+ ]
18
+
19
+ _T_generic_event_name = Literal[
20
+ "highlight",
21
+ "downplay",
22
+ "selectchanged",
23
+ "legendselectchanged",
24
+ "legendselected",
25
+ "legendunselected",
26
+ "legendselectall",
27
+ "legendinverseselect",
28
+ "legendscroll",
29
+ "datazoom",
30
+ "datarangeselected",
31
+ "graphroam",
32
+ "georoam",
33
+ "treeroam",
34
+ "timelinechanged",
35
+ "timelineplaychanged",
36
+ "restore",
37
+ "dataviewchanged",
38
+ "magictypechanged",
39
+ "geoselectchanged",
40
+ "geoselected",
41
+ "geounselected",
42
+ "axisareaselected",
43
+ "brush",
44
+ "brushEnd",
45
+ "brushselected",
46
+ "globalcursortaken",
47
+ "rendered",
48
+ "finished",
49
+ ]
50
+
51
+ _T_event_name = Union[_T_mouse_event_name, _T_generic_event_name]
@@ -0,0 +1,44 @@
1
+ from typing import List, Optional
2
+ import typing
3
+ from .types import _T_event_name, _T_mouse_event_name
4
+ from .events import EChartsMouseEventArguments, _Mouse_Event_Arguments_Fields
5
+ from nicegui.events import UiEventArguments, GenericEventArguments
6
+ from functools import lru_cache
7
+
8
+
9
+ @lru_cache(maxsize=1)
10
+ def _get_mouse_event_names():
11
+ return set(typing.get_args(_T_mouse_event_name))
12
+
13
+
14
+ def is_mouse_event(event_name: _T_event_name) -> bool:
15
+ return event_name in _get_mouse_event_names()
16
+
17
+
18
+ def get_bound_event_args(event_name: _T_event_name) -> Optional[List[str]]:
19
+ if is_mouse_event(event_name):
20
+ return _Mouse_Event_Arguments_Fields
21
+
22
+ return None
23
+
24
+
25
+ def create_event_handler_args(
26
+ event_name: _T_event_name, e: GenericEventArguments
27
+ ) -> UiEventArguments:
28
+ if is_mouse_event(event_name):
29
+ return EChartsMouseEventArguments(
30
+ sender=e.sender,
31
+ client=e.client,
32
+ componentType=e.args["componentType"],
33
+ seriesType=e.args["seriesType"],
34
+ seriesIndex=e.args["seriesIndex"],
35
+ seriesName=e.args["seriesName"],
36
+ name=e.args["name"],
37
+ dataIndex=e.args["dataIndex"],
38
+ data=e.args["data"],
39
+ dataType=e.args.get("dataType"),
40
+ value=e.args["value"],
41
+ color=e.args["color"],
42
+ )
43
+
44
+ return GenericEventArguments(sender=e.sender, client=e.client, args=e.args)
@@ -0,0 +1,29 @@
1
+ from typing import Callable
2
+ from nicegui import ui, Client as ng_client
3
+
4
+
5
+ class DeferredTask:
6
+ def __init__(self):
7
+ self._tasks = []
8
+
9
+ async def on_client_connect(
10
+ client: ng_client,
11
+ ):
12
+ await client.connected()
13
+
14
+ for task in self._tasks:
15
+ task()
16
+
17
+ self._tasks.clear()
18
+
19
+ # Avoid events becoming ineffective due to page refresh when sharing the client.
20
+ if not client.shared:
21
+ client.connect_handlers.remove(on_client_connect) # type: ignore
22
+
23
+ ui.context.client.on_connect(on_client_connect)
24
+
25
+ def register(self, task: Callable[..., None]):
26
+ if ui.context.client.has_socket_connection:
27
+ task()
28
+ else:
29
+ self._tasks.append(task)
@@ -1,9 +1,6 @@
1
1
  from pathlib import Path
2
2
  from typing import Any, Callable, Dict, List, Union, cast, Optional
3
- from typing_extensions import Literal
4
3
  from ex4nicegui.reactive.utils import ParameterClassifier
5
- from ex4nicegui.utils.signals import on
6
-
7
4
  from ex4nicegui.utils.signals import (
8
5
  ReadonlyRef,
9
6
  is_ref,
@@ -11,28 +8,16 @@ from ex4nicegui.utils.signals import (
11
8
  _TMaybeRef as TMaybeRef,
12
9
  to_value,
13
10
  to_raw,
11
+ on,
14
12
  )
15
13
  from .base import BindableUi
16
- from ex4nicegui.reactive.EChartsComponent.ECharts import (
17
- echarts,
18
- EChartsMouseEventArguments,
19
- )
14
+ from ex4nicegui.reactive.EChartsComponent.ECharts import echarts
15
+ from ex4nicegui.reactive.EChartsComponent.types import _T_event_name
16
+ from ex4nicegui.reactive.EChartsComponent.events import EChartsMouseEventArguments
20
17
 
21
18
  from nicegui.awaitable_response import AwaitableResponse
22
19
  from nicegui import ui, app
23
20
 
24
- _TEventName = Literal[
25
- "click",
26
- "dblclick",
27
- "mousedown",
28
- "mousemove",
29
- "mouseup",
30
- "mouseover",
31
- "mouseout",
32
- "globalout",
33
- "contextmenu",
34
- ]
35
-
36
21
 
37
22
  class EChartsBindableUi(BindableUi[echarts]):
38
23
  EChartsMouseEventArguments = EChartsMouseEventArguments
@@ -50,6 +35,7 @@ class EChartsBindableUi(BindableUi[echarts]):
50
35
  value_kws = pc.get_values_kws()
51
36
 
52
37
  element = echarts(**value_kws).classes("grow self-stretch h-[16rem]")
38
+
53
39
  super().__init__(element) # type: ignore
54
40
 
55
41
  self.__update_setting = None
@@ -78,17 +64,17 @@ class EChartsBindableUi(BindableUi[echarts]):
78
64
  ui.add_body_html(
79
65
  rf"""
80
66
  <script>
81
- window.addEventListener('DOMContentLoaded', () => {{
82
- fetch("{src}")
83
- .then((response) => response.json())
84
- .then((data) => {{
85
- echarts.registerMap('{map_name}', data);
86
- }});
87
- }});
67
+ if (typeof window.ex4ngEchartsMapTasks === "undefined") {{
68
+ window.ex4ngEchartsMapTasks = new Map();
69
+ }}
70
+
71
+ window.ex4ngEchartsMapTasks.set('{map_name}', '{src}');
88
72
  </script>
89
73
  """
90
74
  )
91
75
 
76
+ return cls
77
+
92
78
  @classmethod
93
79
  def from_pyecharts(cls, chart: TMaybeRef):
94
80
  if is_ref(chart):
@@ -147,7 +133,7 @@ class EChartsBindableUi(BindableUi[echarts]):
147
133
 
148
134
  def on(
149
135
  self,
150
- event_name: _TEventName,
136
+ event_name: _T_event_name,
151
137
  handler: Callable[..., Any],
152
138
  query: Optional[Union[str, Dict]] = None,
153
139
  ):
@@ -224,6 +210,7 @@ class EChartsBindableUi(BindableUi[echarts]):
224
210
  ---
225
211
  """
226
212
  self.element.echarts_on(event_name, handler, query)
213
+ return self
227
214
 
228
215
  def run_chart_method(
229
216
  self, name: str, *args, timeout: float = 1, check_interval: float = 0.01
@@ -4,6 +4,7 @@ from typing import (
4
4
  Optional,
5
5
  TypeVar,
6
6
  Dict,
7
+ Union,
7
8
  )
8
9
  from ex4nicegui.reactive.utils import ParameterClassifier
9
10
  from ex4nicegui.utils.apiEffect import ui_effect
@@ -25,7 +26,7 @@ class NumberBindableUi(BindableUi[ui.number]):
25
26
  label: Optional[TMaybeRef[str]] = None,
26
27
  *,
27
28
  placeholder: Optional[TMaybeRef[str]] = None,
28
- value: Optional[TMaybeRef[float]] = None,
29
+ value: Optional[Union[TMaybeRef[float], TMaybeRef[int]]] = None,
29
30
  min: Optional[TMaybeRef[float]] = None,
30
31
  max: Optional[TMaybeRef[float]] = None,
31
32
  step: Optional[TMaybeRef[float]] = None,