ex4nicegui 0.6.7__tar.gz → 0.6.8__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.
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/PKG-INFO +33 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/README.md +32 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/__init__.py +10 -6
- ex4nicegui-0.6.8/ex4nicegui/gsap/__init__.py +23 -0
- ex4nicegui-0.6.8/ex4nicegui/helper/__init__.py +4 -0
- ex4nicegui-0.6.8/ex4nicegui/helper/client_instance_locker.py +31 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/local_file_picker.py +1 -2
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/aggrid.py +4 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/base.py +188 -86
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/button.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/checkbox.py +2 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/circular_progress.py +2 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/color_picker.py +3 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/column.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/date.py +2 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/drawer.py +2 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/echarts.py +2 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/expansion.py +2 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/grid.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/html.py +1 -3
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/icon.py +5 -6
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/image.py +2 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/input.py +4 -6
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/knob.py +2 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/label.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/linear_progress.py +5 -6
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/number.py +3 -6
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/radio.py +3 -5
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/row.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/select.py +3 -5
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/slider.py +3 -5
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/switch.py +2 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/tab.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/tab_panel.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/tab_panels.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/table.py +7 -6
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/tabs.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/textarea.py +3 -5
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/upload.py +2 -2
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/q_pagination.py +2 -2
- ex4nicegui-0.6.8/ex4nicegui/reactive/scopedStyle.js +55 -0
- ex4nicegui-0.6.8/ex4nicegui/reactive/scopedStyle.py +22 -0
- ex4nicegui-0.6.8/ex4nicegui/reactive/services/color_service.py +56 -0
- ex4nicegui-0.6.8/ex4nicegui/reactive/services/pandas_service.py +31 -0
- ex4nicegui-0.6.7/ex4nicegui/reactive/utils.py → ex4nicegui-0.6.8/ex4nicegui/reactive/services/reactive_service.py +9 -67
- ex4nicegui-0.6.8/ex4nicegui/reactive/systems/color_system.py +25 -0
- ex4nicegui-0.6.8/ex4nicegui/reactive/systems/object_system.py +33 -0
- ex4nicegui-0.6.8/ex4nicegui/reactive/systems/reactive_system.py +21 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/useMouse/UseMouse.py +4 -4
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/usePagination.py +1 -1
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/vfor.py +1 -2
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/vmodel.py +1 -1
- ex4nicegui-0.6.8/ex4nicegui/utils/refComputed.py +147 -0
- ex4nicegui-0.6.8/ex4nicegui/utils/refWrapper.py +57 -0
- ex4nicegui-0.6.8/ex4nicegui/utils/signals.py +270 -0
- ex4nicegui-0.6.8/ex4nicegui/utils/types.py +16 -0
- ex4nicegui-0.6.8/ex4nicegui/version.py +3 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/pyproject.toml +1 -1
- ex4nicegui-0.6.7/ex4nicegui/gsap/__init__.py +0 -12
- ex4nicegui-0.6.7/ex4nicegui/reactive/dropZone/__init__.py +0 -0
- ex4nicegui-0.6.7/ex4nicegui/reactive/mermaid/__init__.py +0 -0
- ex4nicegui-0.6.7/ex4nicegui/reactive/officials/__init__.py +0 -1
- ex4nicegui-0.6.7/ex4nicegui/reactive/officials/utils.py +0 -11
- ex4nicegui-0.6.7/ex4nicegui/reactive/useMouse/__init__.py +0 -0
- ex4nicegui-0.6.7/ex4nicegui/tools/__init__.py +0 -0
- ex4nicegui-0.6.7/ex4nicegui/utils/__init__.py +0 -0
- ex4nicegui-0.6.7/ex4nicegui/utils/signals.py +0 -411
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/LICENSE +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/dataSource.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/dataSourceFacade.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/containers.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/layouts.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/models.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/text.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_aggrid.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_date_picker.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_date_picker.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_echarts.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_radio.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_range.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_select.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_slider.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/elements/ui_table.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/index.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/protocols.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/bi/types.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/experimental_/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/experimental_/gridLayout/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/experimental_/gridLayout/index.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/gsap/gsap.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/gsap/timeline.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/gsap/timeline.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/gsap/wrapGsap.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/gridFlex/GridFlex.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/gridFlex/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/gridFlex/gridFlex.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/gridFlex/utils.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/rxFlex/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/rxFlex/index.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/layout/rxFlex/types.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-color.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-dispatch.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-drag.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-ease.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-interpolate.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-selection.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-timer.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-transition.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/d3/d3-zoom.ems.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/.DS_Store +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/CSSPlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/CSSRulePlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/CustomEase.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/Draggable.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/EasePack.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/EaselPlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/Flip.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/MotionPathPlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/Observer.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/PixiPlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/ScrollToPlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/ScrollTrigger.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/TextPlugin.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/all.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/gsap-core.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/gsap.mjs +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/utils/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/utils/matrix.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/utils/paths.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/libs/gsap/utils/strings.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/EChartsComponent/ECharts.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/EChartsComponent/ECharts.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/EChartsComponent/events.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/EChartsComponent/types.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/EChartsComponent/utils.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/UseDraggable/UseDraggable.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/UseDraggable/UseDraggable.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/deferredTask.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/dropZone/dropZone.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/dropZone/dropZone.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/empty.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/empty.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/fileWatcher.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/mermaid/mermaid.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/mermaid/mermaid.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/card.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/element.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/officials/html.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/rxui.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/transitionGroup.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/transitionGroup.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/useMouse/UseMouse.js +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/reactive/vfor.js +0 -0
- {ex4nicegui-0.6.7/ex4nicegui/reactive/EChartsComponent → ex4nicegui-0.6.8/ex4nicegui/tools}/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/tools/debug.py +0 -0
- {ex4nicegui-0.6.7/ex4nicegui/reactive/UseDraggable → ex4nicegui-0.6.8/ex4nicegui/utils}/__init__.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/utils/apiEffect.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/utils/asyncComputed.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/utils/clientScope.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/utils/common.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/utils/effect.py +0 -0
- {ex4nicegui-0.6.7 → ex4nicegui-0.6.8}/ex4nicegui/utils/scheduler.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ex4nicegui
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.8
|
|
4
4
|
Summary: Extension library based on nicegui, providing data responsive,BI functionality modules
|
|
5
5
|
Home-page: https://github.com/CrystalWindSnake/ex4nicegui
|
|
6
6
|
License: MIT
|
|
@@ -604,7 +604,7 @@ rxui.label("bind to ref_computed").bind_classes(
|
|
|
604
604
|
|
|
605
605
|
---
|
|
606
606
|
|
|
607
|
-
|
|
607
|
+
绑定为列表或单个字符串的响应式变量
|
|
608
608
|
|
|
609
609
|
```python
|
|
610
610
|
bg_color = to_ref("red")
|
|
@@ -617,10 +617,11 @@ rxui.select(["red", "green", "yellow"], label="bg color", value=bg_color)
|
|
|
617
617
|
rxui.select(["red", "green", "yellow"], label="text color", value=text_color)
|
|
618
618
|
|
|
619
619
|
rxui.label("binding to arrays").bind_classes([bg_color_class, text_color_class])
|
|
620
|
-
|
|
620
|
+
rxui.label("binding to single string").bind_classes(bg_color_class)
|
|
621
621
|
```
|
|
622
622
|
|
|
623
|
-
列表中每个元素为返回类名的响应式变量
|
|
623
|
+
- 列表中每个元素为返回类名的响应式变量
|
|
624
|
+
|
|
624
625
|
|
|
625
626
|
---
|
|
626
627
|
|
|
@@ -887,6 +888,34 @@ rxui.radio(names, value=current_tab).props("inline")
|
|
|
887
888
|
|
|
888
889
|
rxui.label(lambda: f"当前 tab 为:{current_tab.value}")
|
|
889
890
|
```
|
|
891
|
+
---
|
|
892
|
+
|
|
893
|
+
### scoped_style
|
|
894
|
+
|
|
895
|
+
`scoped_style` 方法允许你创建限定在组件内部的样式。
|
|
896
|
+
|
|
897
|
+
```python
|
|
898
|
+
# 所有子元素都会有红色轮廓,但排除自身
|
|
899
|
+
with rxui.row().scoped_style("*", "outline: 1px solid red;") as row:
|
|
900
|
+
ui.label("Hello")
|
|
901
|
+
ui.label("World")
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
# 所有子元素都会有红色轮廓,包括自身
|
|
905
|
+
with rxui.row().scoped_style(":self *", "outline: 1px solid red;") as row:
|
|
906
|
+
ui.label("Hello")
|
|
907
|
+
ui.label("World")
|
|
908
|
+
|
|
909
|
+
# 当鼠标悬停在 row 组件时,所有子元素都会有红色轮廓,但排除自身
|
|
910
|
+
with rxui.row().scoped_style(":hover *", "outline: 1px solid red;") as row:
|
|
911
|
+
ui.label("Hello")
|
|
912
|
+
ui.label("World")
|
|
913
|
+
|
|
914
|
+
# 当鼠标悬停在 row 组件时,所有子元素都会有红色轮廓,包括自身
|
|
915
|
+
with rxui.row().scoped_style(":self:hover *", "outline: 1px solid red;") as row:
|
|
916
|
+
ui.label("Hello")
|
|
917
|
+
ui.label("World")
|
|
918
|
+
```
|
|
890
919
|
|
|
891
920
|
|
|
892
921
|
---
|
|
@@ -581,7 +581,7 @@ rxui.label("bind to ref_computed").bind_classes(
|
|
|
581
581
|
|
|
582
582
|
---
|
|
583
583
|
|
|
584
|
-
|
|
584
|
+
绑定为列表或单个字符串的响应式变量
|
|
585
585
|
|
|
586
586
|
```python
|
|
587
587
|
bg_color = to_ref("red")
|
|
@@ -594,10 +594,11 @@ rxui.select(["red", "green", "yellow"], label="bg color", value=bg_color)
|
|
|
594
594
|
rxui.select(["red", "green", "yellow"], label="text color", value=text_color)
|
|
595
595
|
|
|
596
596
|
rxui.label("binding to arrays").bind_classes([bg_color_class, text_color_class])
|
|
597
|
-
|
|
597
|
+
rxui.label("binding to single string").bind_classes(bg_color_class)
|
|
598
598
|
```
|
|
599
599
|
|
|
600
|
-
列表中每个元素为返回类名的响应式变量
|
|
600
|
+
- 列表中每个元素为返回类名的响应式变量
|
|
601
|
+
|
|
601
602
|
|
|
602
603
|
---
|
|
603
604
|
|
|
@@ -864,6 +865,34 @@ rxui.radio(names, value=current_tab).props("inline")
|
|
|
864
865
|
|
|
865
866
|
rxui.label(lambda: f"当前 tab 为:{current_tab.value}")
|
|
866
867
|
```
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
### scoped_style
|
|
871
|
+
|
|
872
|
+
`scoped_style` 方法允许你创建限定在组件内部的样式。
|
|
873
|
+
|
|
874
|
+
```python
|
|
875
|
+
# 所有子元素都会有红色轮廓,但排除自身
|
|
876
|
+
with rxui.row().scoped_style("*", "outline: 1px solid red;") as row:
|
|
877
|
+
ui.label("Hello")
|
|
878
|
+
ui.label("World")
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
# 所有子元素都会有红色轮廓,包括自身
|
|
882
|
+
with rxui.row().scoped_style(":self *", "outline: 1px solid red;") as row:
|
|
883
|
+
ui.label("Hello")
|
|
884
|
+
ui.label("World")
|
|
885
|
+
|
|
886
|
+
# 当鼠标悬停在 row 组件时,所有子元素都会有红色轮廓,但排除自身
|
|
887
|
+
with rxui.row().scoped_style(":hover *", "outline: 1px solid red;") as row:
|
|
888
|
+
ui.label("Hello")
|
|
889
|
+
ui.label("World")
|
|
890
|
+
|
|
891
|
+
# 当鼠标悬停在 row 组件时,所有子元素都会有红色轮廓,包括自身
|
|
892
|
+
with rxui.row().scoped_style(":self:hover *", "outline: 1px solid red;") as row:
|
|
893
|
+
ui.label("Hello")
|
|
894
|
+
ui.label("World")
|
|
895
|
+
```
|
|
867
896
|
|
|
868
897
|
|
|
869
898
|
---
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
from ex4nicegui import reactive as rxui
|
|
2
|
+
from ex4nicegui.utils.refComputed import ref_computed
|
|
3
|
+
from ex4nicegui.utils.types import (
|
|
4
|
+
_TMaybeRef as TMaybeRef,
|
|
5
|
+
Ref,
|
|
6
|
+
ReadonlyRef,
|
|
7
|
+
TGetterOrReadonlyRef,
|
|
8
|
+
)
|
|
2
9
|
from ex4nicegui.utils.signals import (
|
|
3
|
-
ref_computed,
|
|
4
10
|
effect,
|
|
5
11
|
effect_refreshable,
|
|
6
12
|
to_raw,
|
|
@@ -10,9 +16,6 @@ from ex4nicegui.utils.signals import (
|
|
|
10
16
|
ref,
|
|
11
17
|
on,
|
|
12
18
|
event_batch,
|
|
13
|
-
_TMaybeRef as TMaybeRef,
|
|
14
|
-
Ref,
|
|
15
|
-
ReadonlyRef,
|
|
16
19
|
reactive,
|
|
17
20
|
deep_ref,
|
|
18
21
|
is_setter_ref,
|
|
@@ -21,6 +24,7 @@ from ex4nicegui.utils.signals import (
|
|
|
21
24
|
)
|
|
22
25
|
from ex4nicegui.utils.asyncComputed import async_computed
|
|
23
26
|
from ex4nicegui.utils.clientScope import new_scope
|
|
27
|
+
from .version import __version__
|
|
24
28
|
|
|
25
29
|
__all__ = [
|
|
26
30
|
"async_computed",
|
|
@@ -36,6 +40,7 @@ __all__ = [
|
|
|
36
40
|
"on",
|
|
37
41
|
"event_batch",
|
|
38
42
|
"TMaybeRef",
|
|
43
|
+
"TGetterOrReadonlyRef",
|
|
39
44
|
"Ref",
|
|
40
45
|
"ReadonlyRef",
|
|
41
46
|
"reactive",
|
|
@@ -44,6 +49,5 @@ __all__ = [
|
|
|
44
49
|
"to_raw",
|
|
45
50
|
"is_setter_ref",
|
|
46
51
|
"new_scope",
|
|
52
|
+
"__version__",
|
|
47
53
|
]
|
|
48
|
-
|
|
49
|
-
__version__ = "0.6.6"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from .gsap import set_defaults, from_, to, new, run_script
|
|
2
|
+
from .timeline import Timeline as timeline
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import warnings
|
|
6
|
+
|
|
7
|
+
RED = "\033[91m"
|
|
8
|
+
RESET = "\033[0m"
|
|
9
|
+
|
|
10
|
+
warnings.warn(
|
|
11
|
+
f"{RED}The gsap module is deprecated and will be removed in the next major version.{RESET}",
|
|
12
|
+
DeprecationWarning,
|
|
13
|
+
stacklevel=2,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"set_defaults",
|
|
18
|
+
"from_",
|
|
19
|
+
"to",
|
|
20
|
+
"new",
|
|
21
|
+
"run_script",
|
|
22
|
+
"timeline",
|
|
23
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Callable, TypeVar, Generic
|
|
2
|
+
from nicegui import ui, Client
|
|
3
|
+
from weakref import WeakKeyDictionary
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
_T = TypeVar("_T")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ClientInstanceLocker(Generic[_T]):
|
|
10
|
+
def __init__(self, factory: Callable[[], _T]):
|
|
11
|
+
"""Creates a new instance locker that creates a new instance for each client.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
factory (Callable[[], _T]): A factory function that creates a new instance.
|
|
15
|
+
"""
|
|
16
|
+
self._client_instances: WeakKeyDictionary[Client, _T] = WeakKeyDictionary()
|
|
17
|
+
self._factory = factory
|
|
18
|
+
|
|
19
|
+
def get_object(self):
|
|
20
|
+
if not ui.context.slot_stack:
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
client = ui.context.client
|
|
24
|
+
if client not in self._client_instances:
|
|
25
|
+
self._client_instances[client] = self._factory()
|
|
26
|
+
|
|
27
|
+
@client.on_disconnect
|
|
28
|
+
def _():
|
|
29
|
+
del self._client_instances[client]
|
|
30
|
+
|
|
31
|
+
return self._client_instances[client]
|
|
@@ -6,7 +6,6 @@ from pathlib import Path
|
|
|
6
6
|
from ex4nicegui.utils.signals import (
|
|
7
7
|
Ref,
|
|
8
8
|
effect_refreshable,
|
|
9
|
-
ReadonlyRef,
|
|
10
9
|
effect,
|
|
11
10
|
ref_computed as computed,
|
|
12
11
|
to_ref,
|
|
@@ -17,7 +16,7 @@ SelectMode = Literal["dir", "file"]
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
class LocalFilePickerResult:
|
|
20
|
-
def __init__(self, ref:
|
|
19
|
+
def __init__(self, ref: Ref[str], open_fn: Callable[..., None]) -> None:
|
|
21
20
|
self.__open_fn = open_fn
|
|
22
21
|
self._ref = ref
|
|
23
22
|
|
|
@@ -9,13 +9,13 @@ from ex4nicegui.utils.signals import (
|
|
|
9
9
|
is_ref,
|
|
10
10
|
ref_computed,
|
|
11
11
|
to_value,
|
|
12
|
-
|
|
12
|
+
TMaybeRef,
|
|
13
13
|
TGetterOrReadonlyRef,
|
|
14
14
|
)
|
|
15
|
-
from ex4nicegui.utils.apiEffect import ui_effect
|
|
16
15
|
from nicegui import ui
|
|
17
16
|
from .base import BindableUi
|
|
18
|
-
from ex4nicegui.reactive.
|
|
17
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
18
|
+
from ex4nicegui.reactive.services.pandas_service import dataframe2col_str
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class AggridBindableUi(BindableUi[ui.aggrid]):
|
|
@@ -85,7 +85,7 @@ class AggridBindableUi(BindableUi[ui.aggrid]):
|
|
|
85
85
|
return super().bind_prop(prop, ref_ui)
|
|
86
86
|
|
|
87
87
|
def bind_options(self, ref_ui: TGetterOrReadonlyRef[List[Dict]]):
|
|
88
|
-
@
|
|
88
|
+
@self._ui_effect
|
|
89
89
|
def _():
|
|
90
90
|
ele = self.element
|
|
91
91
|
data = to_value(ref_ui)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from pathlib import Path
|
|
3
4
|
from typing import (
|
|
4
5
|
Any,
|
|
5
6
|
Callable,
|
|
@@ -11,7 +12,7 @@ from typing import (
|
|
|
11
12
|
Generic,
|
|
12
13
|
Union,
|
|
13
14
|
cast,
|
|
14
|
-
|
|
15
|
+
overload,
|
|
15
16
|
)
|
|
16
17
|
|
|
17
18
|
from typing_extensions import Self
|
|
@@ -19,21 +20,18 @@ from ex4nicegui.utils.apiEffect import ui_effect
|
|
|
19
20
|
import signe
|
|
20
21
|
from ex4nicegui.utils.signals import (
|
|
21
22
|
TGetterOrReadonlyRef,
|
|
22
|
-
effect,
|
|
23
23
|
to_value,
|
|
24
24
|
is_ref,
|
|
25
25
|
WatchedState,
|
|
26
26
|
on,
|
|
27
27
|
)
|
|
28
|
+
from ex4nicegui.utils.clientScope import new_scope
|
|
28
29
|
from nicegui import Tailwind, ui
|
|
29
|
-
from nicegui.elements.mixins.color_elements import (
|
|
30
|
-
TextColorElement,
|
|
31
|
-
QUASAR_COLORS,
|
|
32
|
-
TAILWIND_COLORS,
|
|
33
|
-
)
|
|
34
30
|
from nicegui.elements.mixins.text_element import TextElement
|
|
35
31
|
from nicegui.elements.mixins.disableable_element import DisableableElement
|
|
36
|
-
|
|
32
|
+
from ex4nicegui.reactive.services.reactive_service import inject_handle_delete
|
|
33
|
+
from ex4nicegui.reactive.scopedStyle import ScopedStyle
|
|
34
|
+
from functools import partial
|
|
37
35
|
|
|
38
36
|
T = TypeVar("T")
|
|
39
37
|
|
|
@@ -42,21 +40,38 @@ TWidget = TypeVar("TWidget", bound=ui.element)
|
|
|
42
40
|
|
|
43
41
|
_T_bind_classes_type_dict = Dict[str, TGetterOrReadonlyRef[bool]]
|
|
44
42
|
_T_bind_classes_type_ref_dict = TGetterOrReadonlyRef[Dict[str, bool]]
|
|
45
|
-
|
|
43
|
+
_T_bind_classes_type_single = TGetterOrReadonlyRef[str]
|
|
44
|
+
_T_bind_classes_type_array = List[_T_bind_classes_type_single]
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
_T_bind_classes_type = Union[
|
|
49
|
-
_T_bind_classes_type_dict,
|
|
48
|
+
_T_bind_classes_type_dict,
|
|
49
|
+
_T_bind_classes_type_ref_dict,
|
|
50
|
+
_T_bind_classes_type_single,
|
|
51
|
+
_T_bind_classes_type_array,
|
|
50
52
|
]
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
class BindableUi(Generic[TWidget]):
|
|
54
56
|
def __init__(self, element: TWidget) -> None:
|
|
55
57
|
self._element = element
|
|
58
|
+
inject_handle_delete(self.element, self._on_element_delete)
|
|
56
59
|
self.tailwind = Tailwind(cast(ui.element, self._element))
|
|
60
|
+
self._effect_scope = new_scope()
|
|
57
61
|
|
|
58
|
-
def
|
|
59
|
-
|
|
62
|
+
def _on_element_delete(self):
|
|
63
|
+
self._effect_scope.dispose()
|
|
64
|
+
scope_style = ScopedStyle.get()
|
|
65
|
+
if scope_style:
|
|
66
|
+
scope_style.remove_style(self.element)
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def _ui_effect(self):
|
|
70
|
+
return partial(ui_effect, scope=self._effect_scope)
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def _ui_signal_on(self):
|
|
74
|
+
return partial(on, scope=self._effect_scope)
|
|
60
75
|
|
|
61
76
|
def props(self, add: Optional[str] = None, *, remove: Optional[str] = None):
|
|
62
77
|
cast(ui.element, self.element).props(add, remove=remove)
|
|
@@ -108,7 +123,7 @@ class BindableUi(Generic[TWidget]):
|
|
|
108
123
|
|
|
109
124
|
def delete(self) -> None:
|
|
110
125
|
"""Delete the element."""
|
|
111
|
-
self.delete()
|
|
126
|
+
self.element.delete()
|
|
112
127
|
|
|
113
128
|
def move(
|
|
114
129
|
self, target_container: Optional[ui.element] = None, target_index: int = -1
|
|
@@ -118,7 +133,7 @@ class BindableUi(Generic[TWidget]):
|
|
|
118
133
|
:param target_container: container to move the element to (default: the parent container)
|
|
119
134
|
:param target_index: index within the target slot (default: append to the end)
|
|
120
135
|
"""
|
|
121
|
-
return self.move(target_container, target_index)
|
|
136
|
+
return self.element.move(target_container, target_index)
|
|
122
137
|
|
|
123
138
|
def remove(self, element: Union[ui.element, int]) -> None:
|
|
124
139
|
"""Remove a child element.
|
|
@@ -192,6 +207,22 @@ class BindableUi(Generic[TWidget]):
|
|
|
192
207
|
def clear(self) -> None:
|
|
193
208
|
cast(ui.element, self.element).clear()
|
|
194
209
|
|
|
210
|
+
@overload
|
|
211
|
+
def bind_classes(self, classes: Dict[str, TGetterOrReadonlyRef[bool]]):
|
|
212
|
+
...
|
|
213
|
+
|
|
214
|
+
@overload
|
|
215
|
+
def bind_classes(self, classes: TGetterOrReadonlyRef[Dict[str, bool]]):
|
|
216
|
+
...
|
|
217
|
+
|
|
218
|
+
@overload
|
|
219
|
+
def bind_classes(self, classes: List[TGetterOrReadonlyRef[str]]):
|
|
220
|
+
...
|
|
221
|
+
|
|
222
|
+
@overload
|
|
223
|
+
def bind_classes(self, classes: TGetterOrReadonlyRef[str]):
|
|
224
|
+
...
|
|
225
|
+
|
|
195
226
|
def bind_classes(self, classes: _T_bind_classes_type):
|
|
196
227
|
"""data binding is manipulating an element's class list
|
|
197
228
|
|
|
@@ -199,7 +230,37 @@ class BindableUi(Generic[TWidget]):
|
|
|
199
230
|
@中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#%E7%BB%91%E5%AE%9A%E7%B1%BB%E5%90%8D
|
|
200
231
|
|
|
201
232
|
Args:
|
|
202
|
-
classes (_T_bind_classes_type):
|
|
233
|
+
classes (_T_bind_classes_type): dict of refs | ref to dict | str ref | list of refs
|
|
234
|
+
|
|
235
|
+
## usage
|
|
236
|
+
|
|
237
|
+
bind class names with dict,value is bool ref, for example:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
bg_color = to_ref(True)
|
|
241
|
+
has_error = to_ref(False)
|
|
242
|
+
|
|
243
|
+
rxui.label('Hello').bind_classes({'bg-blue':bg_color, 'text-red':has_error})
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
bind list of class names with ref
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
color = to_ref('red')
|
|
250
|
+
bg_color = lambda: f"bg-{color.value}"
|
|
251
|
+
|
|
252
|
+
rxui.label('Hello').bind_classes([bg_color])
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
bind single class name with ref
|
|
256
|
+
|
|
257
|
+
```python
|
|
258
|
+
color = to_ref('red')
|
|
259
|
+
bg_color = lambda: f"bg-{color.value}"
|
|
260
|
+
|
|
261
|
+
rxui.label('Hello').bind_classes(bg_color)
|
|
262
|
+
```
|
|
263
|
+
|
|
203
264
|
"""
|
|
204
265
|
if isinstance(classes, dict):
|
|
205
266
|
for name, ref_obj in classes.items():
|
|
@@ -213,24 +274,33 @@ class BindableUi(Generic[TWidget]):
|
|
|
213
274
|
|
|
214
275
|
elif is_ref(classes) or isinstance(classes, Callable):
|
|
215
276
|
ref_obj = to_value(classes) # type: ignore
|
|
216
|
-
assert isinstance(ref_obj, dict)
|
|
217
277
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
278
|
+
if isinstance(ref_obj, dict):
|
|
279
|
+
|
|
280
|
+
@self._ui_effect
|
|
281
|
+
def _():
|
|
282
|
+
for name, value in cast(Dict, to_value(classes)).items(): # type: ignore
|
|
283
|
+
if value:
|
|
284
|
+
self.classes(add=name)
|
|
285
|
+
else:
|
|
286
|
+
self.classes(remove=name)
|
|
287
|
+
else:
|
|
288
|
+
self._bind_single_class(cast(_T_bind_classes_type_single, classes))
|
|
289
|
+
|
|
225
290
|
elif isinstance(classes, list):
|
|
226
291
|
for ref_name in classes:
|
|
227
|
-
|
|
292
|
+
self._bind_single_class(ref_name)
|
|
228
293
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
294
|
+
return self
|
|
295
|
+
|
|
296
|
+
def _bind_single_class(self, class_name: _T_bind_classes_type_single):
|
|
297
|
+
if is_ref(class_name) or isinstance(class_name, Callable):
|
|
298
|
+
|
|
299
|
+
@on(class_name)
|
|
300
|
+
def _(state: WatchedState):
|
|
301
|
+
self.classes(add=state.current, remove=state.previous)
|
|
302
|
+
else:
|
|
303
|
+
self.classes(class_name) # type: ignore
|
|
234
304
|
|
|
235
305
|
return self
|
|
236
306
|
|
|
@@ -241,7 +311,21 @@ class BindableUi(Generic[TWidget]):
|
|
|
241
311
|
@中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#bind-style
|
|
242
312
|
|
|
243
313
|
Args:
|
|
244
|
-
style (Dict[str, Union[ReadonlyRef[str], Ref[str]]]):
|
|
314
|
+
style (Dict[str, Union[ReadonlyRef[str], Ref[str]]]): dict of style name and ref value
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
## usage
|
|
318
|
+
```python
|
|
319
|
+
bg_color = to_ref("blue")
|
|
320
|
+
text_color = to_ref("red")
|
|
321
|
+
|
|
322
|
+
rxui.label("test").bind_style(
|
|
323
|
+
{
|
|
324
|
+
"background-color": bg_color,
|
|
325
|
+
"color": text_color,
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
```
|
|
245
329
|
"""
|
|
246
330
|
if isinstance(style, dict):
|
|
247
331
|
for name, ref_obj in style.items():
|
|
@@ -254,26 +338,88 @@ class BindableUi(Generic[TWidget]):
|
|
|
254
338
|
|
|
255
339
|
return self
|
|
256
340
|
|
|
341
|
+
def scoped_style(self, selector: str, style: Union[str, Path]):
|
|
342
|
+
"""add scoped style to the element
|
|
343
|
+
|
|
344
|
+
@see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#scoped_style
|
|
345
|
+
@中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#scoped_style
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
selector (str): css selector
|
|
349
|
+
style (Union[str, Path]): path to css file or inline style string
|
|
350
|
+
|
|
351
|
+
## usage
|
|
352
|
+
```python
|
|
353
|
+
# all children of the element will have red outline, excluding itself
|
|
354
|
+
with rxui.row().scoped_style("*", "outline: 1px solid red;") as row:
|
|
355
|
+
ui.label("Hello")
|
|
356
|
+
ui.label("World")
|
|
357
|
+
|
|
358
|
+
# all children of the element will have red outline, including the element itself
|
|
359
|
+
with rxui.row().scoped_style(":self *", "outline: 1px solid red;") as row:
|
|
360
|
+
ui.label("Hello")
|
|
361
|
+
ui.label("World")
|
|
362
|
+
|
|
363
|
+
# all children of the element will have red outline when element is hovered
|
|
364
|
+
with rxui.row().scoped_style(":hover *", "outline: 1px solid red;") as row:
|
|
365
|
+
ui.label("Hello")
|
|
366
|
+
ui.label("World")
|
|
367
|
+
|
|
368
|
+
# all children of the element and itself will have red outline when element is hovered
|
|
369
|
+
with rxui.row().scoped_style(":self:hover *", "outline: 1px solid red;") as row:
|
|
370
|
+
ui.label("Hello")
|
|
371
|
+
ui.label("World")
|
|
372
|
+
```
|
|
373
|
+
"""
|
|
374
|
+
|
|
375
|
+
is_css_file = isinstance(style, Path)
|
|
376
|
+
|
|
377
|
+
if is_css_file:
|
|
378
|
+
style = style.read_text(encoding="utf-8")
|
|
379
|
+
|
|
380
|
+
id = f"c{self.element.id}"
|
|
381
|
+
selector_with_self = _utils._parent_id_with_selector(id, selector, is_css_file)
|
|
382
|
+
css = ""
|
|
383
|
+
if is_css_file:
|
|
384
|
+
css = f"{selector_with_self} {style}"
|
|
385
|
+
else:
|
|
386
|
+
css = f"{selector_with_self}{{{style}}}"
|
|
387
|
+
|
|
388
|
+
scope_style = ScopedStyle.get()
|
|
389
|
+
assert scope_style, "can not find scope style"
|
|
390
|
+
scope_style.create_style(self.element, css)
|
|
391
|
+
|
|
392
|
+
return self
|
|
393
|
+
|
|
257
394
|
def update(self):
|
|
258
395
|
"""Update the element on the client side."""
|
|
259
396
|
self.element.update()
|
|
260
397
|
|
|
261
398
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
399
|
+
class _utils:
|
|
400
|
+
@staticmethod
|
|
401
|
+
def _parent_id_with_selector(
|
|
402
|
+
parent_id: str, selector: str, is_css_file=False
|
|
403
|
+
) -> str:
|
|
404
|
+
selector_with_self = f"#{parent_id}"
|
|
405
|
+
|
|
406
|
+
selector = selector.strip()
|
|
407
|
+
if (not selector) and (not is_css_file):
|
|
408
|
+
selector = "* "
|
|
409
|
+
|
|
410
|
+
if selector.startswith(":self"):
|
|
411
|
+
selector = selector[5:].lstrip()
|
|
412
|
+
parent_selector = f"#{parent_id}"
|
|
413
|
+
if selector.startswith(":"):
|
|
414
|
+
parent_selector = f"{parent_selector}{selector.split()[0]}"
|
|
266
415
|
|
|
267
|
-
|
|
268
|
-
# def value(self) -> T:
|
|
269
|
-
# return self._ref.value # type: ignore
|
|
416
|
+
selector_with_self = f"{parent_selector},{selector_with_self}"
|
|
270
417
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
# def _():
|
|
274
|
-
# ref.value = self._ref.value # type: ignore
|
|
418
|
+
if not selector.startswith(":"):
|
|
419
|
+
selector_with_self = selector_with_self + " "
|
|
275
420
|
|
|
276
|
-
|
|
421
|
+
selector_with_self = selector_with_self + selector
|
|
422
|
+
return selector_with_self
|
|
277
423
|
|
|
278
424
|
|
|
279
425
|
_T_DisableableBinder = TypeVar("_T_DisableableBinder", bound=DisableableElement)
|
|
@@ -306,47 +452,3 @@ class DisableableMixin(Protocol):
|
|
|
306
452
|
|
|
307
453
|
|
|
308
454
|
DisableableBindableUi = DisableableMixin
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
_color_sys_type = Literal["QUASAR", "TAILWIND", "STYLE"]
|
|
312
|
-
_color_attr_name = "data-ex4ng-color"
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
def _bind_color(bindable_ui: BindableUi, ref_ui: TGetterOrReadonlyRef):
|
|
316
|
-
@effect
|
|
317
|
-
def _():
|
|
318
|
-
ele = cast(TextColorElement, bindable_ui.element)
|
|
319
|
-
color = to_value(ref_ui)
|
|
320
|
-
|
|
321
|
-
# get exists color
|
|
322
|
-
# e.g 'QUASAR:red'
|
|
323
|
-
pre_color = ele._props.get(_color_attr_name) # type: str | None
|
|
324
|
-
if pre_color:
|
|
325
|
-
color_sys, value = pre_color.split(":") # type: ignore
|
|
326
|
-
color_sys: _color_sys_type
|
|
327
|
-
|
|
328
|
-
if color_sys == "QUASAR":
|
|
329
|
-
del ele._props[ele.TEXT_COLOR_PROP]
|
|
330
|
-
elif color_sys == "TAILWIND":
|
|
331
|
-
ele.classes(remove=value)
|
|
332
|
-
else:
|
|
333
|
-
del ele._style["color"]
|
|
334
|
-
|
|
335
|
-
cur_sys: _color_sys_type = "STYLE"
|
|
336
|
-
cur_color = color
|
|
337
|
-
|
|
338
|
-
if color in QUASAR_COLORS:
|
|
339
|
-
ele._props[ele.TEXT_COLOR_PROP] = color
|
|
340
|
-
cur_sys = "QUASAR"
|
|
341
|
-
elif color in TAILWIND_COLORS:
|
|
342
|
-
cur_color = f"text-{color}"
|
|
343
|
-
ele.classes(replace=cur_color)
|
|
344
|
-
cur_sys = "TAILWIND"
|
|
345
|
-
elif color is not None:
|
|
346
|
-
ele._style["color"] = color
|
|
347
|
-
|
|
348
|
-
ele._props[_color_attr_name] = f"{cur_sys}:{color}"
|
|
349
|
-
|
|
350
|
-
ele.update()
|
|
351
|
-
|
|
352
|
-
return bindable_ui
|
|
@@ -3,7 +3,7 @@ from typing import (
|
|
|
3
3
|
Callable,
|
|
4
4
|
Optional,
|
|
5
5
|
)
|
|
6
|
-
from ex4nicegui.reactive.
|
|
6
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
7
7
|
from ex4nicegui.utils.signals import (
|
|
8
8
|
TGetterOrReadonlyRef,
|
|
9
9
|
_TMaybeRef as TMaybeRef,
|
|
@@ -4,8 +4,7 @@ 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,
|
|
@@ -51,7 +50,7 @@ class CheckboxBindableUi(BindableUi[ui.checkbox], DisableableMixin):
|
|
|
51
50
|
return super().bind_prop(prop, ref_ui)
|
|
52
51
|
|
|
53
52
|
def bind_value(self, ref_ui: TGetterOrReadonlyRef[bool]):
|
|
54
|
-
@
|
|
53
|
+
@self._ui_effect
|
|
55
54
|
def _():
|
|
56
55
|
self.element.set_value(to_value(ref_ui))
|
|
57
56
|
self.element.update()
|