ex4nicegui 0.7.0__tar.gz → 0.7.1__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.7.0 → ex4nicegui-0.7.1}/PKG-INFO +5 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/README.md +4 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/__init__.py +6 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/base.py +3 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/mixins/backgroundColor.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/mixins/textColor.py +1 -1
- ex4nicegui-0.7.1/ex4nicegui/reactive/officials/avatar.py +86 -0
- ex4nicegui-0.7.1/ex4nicegui/reactive/officials/badge.py +102 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/checkbox.py +1 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/chip.py +1 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/circular_progress.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/color_picker.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/date.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/dialog.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/echarts.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/expansion.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/icon.py +2 -8
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/image.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/input.py +2 -3
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/knob.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/label.py +6 -4
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/linear_progress.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/number.py +2 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/radio.py +2 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/select.py +2 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/slider.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/switch.py +1 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/textarea.py +1 -1
- ex4nicegui-0.7.1/ex4nicegui/reactive/officials/toggle.py +88 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/tooltip.py +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/systems/reactive_system.py +2 -2
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/view_model.py +4 -4
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/pyproject.toml +1 -1
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/LICENSE +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/dataSource.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/dataSourceFacade.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/containers.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/layouts.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/models.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/text.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_aggrid.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_date_picker.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_date_picker.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_echarts.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_radio.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_range.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_select.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_slider.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/elements/ui_table.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/index.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/protocols.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/bi/types.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/experimental_/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/experimental_/gridLayout/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/experimental_/gridLayout/index.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/gsap/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/gsap/gsap.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/gsap/timeline.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/gsap/timeline.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/gsap/wrapGsap.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/helper/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/helper/client_instance_locker.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/gridFlex/GridFlex.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/gridFlex/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/gridFlex/gridFlex.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/gridFlex/utils.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/rxFlex/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/rxFlex/index.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/layout/rxFlex/types.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-color.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-dispatch.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-drag.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-ease.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-interpolate.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-selection.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-timer.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-transition.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/d3/d3-zoom.ems.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/.DS_Store +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/CSSPlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/CSSRulePlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/CustomEase.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/Draggable.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/EasePack.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/EaselPlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/Flip.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/MotionPathPlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/Observer.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/PixiPlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/ScrollToPlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/ScrollTrigger.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/TextPlugin.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/all.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/gsap-core.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/gsap.mjs +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/utils/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/utils/matrix.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/utils/paths.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/libs/gsap/utils/strings.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/EChartsComponent/ECharts.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/EChartsComponent/ECharts.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/EChartsComponent/events.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/EChartsComponent/types.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/EChartsComponent/utils.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/UseDraggable/UseDraggable.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/UseDraggable/UseDraggable.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/deferredTask.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/dropZone/dropZone.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/dropZone/dropZone.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/empty.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/empty.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/fileWatcher.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/local_file_picker.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/mermaid/mermaid.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/mermaid/mermaid.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/mixins/disableable.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/aggrid.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/base.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/button.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/card.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/column.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/drawer.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/element.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/grid.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/html.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/html.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/row.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/tab.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/tab_panel.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/tab_panels.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/table.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/tabs.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/officials/upload.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/q_pagination.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/rxui.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/scopedStyle.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/scopedStyle.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/services/pandas_service.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/services/reactive_service.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/systems/color_system.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/systems/object_system.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/transitionGroup.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/transitionGroup.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/useMouse/UseMouse.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/useMouse/UseMouse.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/usePagination.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/vfor.js +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/vfor.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/reactive/vmodel.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/tools/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/tools/debug.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/__init__.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/apiEffect.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/asyncComputed.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/clientScope.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/common.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/effect.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/refComputed.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/refWrapper.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/scheduler.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/signals.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/utils/types.py +0 -0
- {ex4nicegui-0.7.0 → ex4nicegui-0.7.1}/ex4nicegui/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ex4nicegui
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
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
|
|
@@ -38,6 +38,10 @@ Description-Content-Type: text/markdown
|
|
|
38
38
|
对 [nicegui](https://github.com/zauberzeug/nicegui) 做的扩展库。内置响应式组件,完全实现数据响应式界面编程。
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
[查看更多示例](https://github.com/CrystalWindSnake/ex4nicegui-examples)
|
|
44
|
+
|
|
41
45
|
## 教程
|
|
42
46
|
[头条文章-秒杀官方实现,python界面库,去掉90%事件代码的nicegui](https://www.toutiao.com/item/7253786340574265860/)
|
|
43
47
|
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
对 [nicegui](https://github.com/zauberzeug/nicegui) 做的扩展库。内置响应式组件,完全实现数据响应式界面编程。
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
[查看更多示例](https://github.com/CrystalWindSnake/ex4nicegui-examples)
|
|
21
|
+
|
|
18
22
|
## 教程
|
|
19
23
|
[头条文章-秒杀官方实现,python界面库,去掉90%事件代码的nicegui](https://www.toutiao.com/item/7253786340574265860/)
|
|
20
24
|
|
|
@@ -55,6 +55,9 @@ from .officials.tab_panels import LazyTabPanelsBindableUi as lazy_tab_panels
|
|
|
55
55
|
from .q_pagination import PaginationBindableUi as q_pagination
|
|
56
56
|
from .officials.chip import ChipBindableUi as chip
|
|
57
57
|
from .officials.tooltip import TooltipBindableUi as tooltip
|
|
58
|
+
from .officials.toggle import ToggleBindableUi as toggle
|
|
59
|
+
from .officials.avatar import AvatarBindableUi as avatar
|
|
60
|
+
from .officials.badge import BadgeBindableUi as badge
|
|
58
61
|
|
|
59
62
|
from .local_file_picker import local_file_picker
|
|
60
63
|
from .UseDraggable.UseDraggable import use_draggable
|
|
@@ -132,4 +135,7 @@ __all__ = [
|
|
|
132
135
|
"chip",
|
|
133
136
|
"dialog",
|
|
134
137
|
"tooltip",
|
|
138
|
+
"toggle",
|
|
139
|
+
"avatar",
|
|
140
|
+
"badge",
|
|
135
141
|
]
|
|
@@ -73,7 +73,9 @@ class BindableUi(Generic[TWidget]):
|
|
|
73
73
|
|
|
74
74
|
@property
|
|
75
75
|
def _ui_signal_on(self):
|
|
76
|
-
|
|
76
|
+
"""equivalent to `on`, but with the effect scope,and with `onchanges`=True and `deep` = False"""
|
|
77
|
+
|
|
78
|
+
return partial(on, scope=self._effect_scope, onchanges=True, deep=False)
|
|
77
79
|
|
|
78
80
|
def props(self, add: Optional[str] = None, *, remove: Optional[str] = None):
|
|
79
81
|
cast(ui.element, self.element).props(add, remove=remove)
|
|
@@ -21,7 +21,7 @@ class BackgroundColorableMixin(Protocol):
|
|
|
21
21
|
...
|
|
22
22
|
|
|
23
23
|
def _bind_background_color(self, value: TGetterOrReadonlyRef[str]):
|
|
24
|
-
@self._ui_signal_on(value) # type: ignore
|
|
24
|
+
@self._ui_signal_on(value, onchanges=False) # type: ignore
|
|
25
25
|
def _(state: WatchedState):
|
|
26
26
|
if state.previous is not None:
|
|
27
27
|
color_system.remove_background_color(self.element, state.previous)
|
|
@@ -22,7 +22,7 @@ class TextColorableMixin(Protocol):
|
|
|
22
22
|
...
|
|
23
23
|
|
|
24
24
|
def _bind_text_color(self, color: TGetterOrReadonlyRef[str]):
|
|
25
|
-
@self._ui_signal_on(color) # type: ignore
|
|
25
|
+
@self._ui_signal_on(color, onchanges=False) # type: ignore
|
|
26
26
|
def _(state: WatchedState):
|
|
27
27
|
if state.previous is not None:
|
|
28
28
|
color_system.remove_text_color(self.element, state.previous)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
3
|
+
from ex4nicegui.utils.signals import (
|
|
4
|
+
TGetterOrReadonlyRef,
|
|
5
|
+
_TMaybeRef as TMaybeRef,
|
|
6
|
+
)
|
|
7
|
+
from nicegui import ui
|
|
8
|
+
from .base import BindableUi
|
|
9
|
+
from ex4nicegui.reactive.mixins.backgroundColor import BackgroundColorableMixin
|
|
10
|
+
from ex4nicegui.reactive.mixins.textColor import TextColorableMixin
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AvatarBindableUi(
|
|
14
|
+
BindableUi[ui.avatar], TextColorableMixin, BackgroundColorableMixin
|
|
15
|
+
):
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
icon: Optional[TMaybeRef[str]] = None,
|
|
19
|
+
*,
|
|
20
|
+
color: Optional[TMaybeRef[str]] = "primary",
|
|
21
|
+
text_color: Optional[TMaybeRef[str]] = None,
|
|
22
|
+
size: Optional[TMaybeRef[str]] = None,
|
|
23
|
+
font_size: Optional[TMaybeRef[str]] = None,
|
|
24
|
+
square: TMaybeRef[bool] = False,
|
|
25
|
+
rounded: TMaybeRef[bool] = False,
|
|
26
|
+
) -> None:
|
|
27
|
+
"""Avatar
|
|
28
|
+
|
|
29
|
+
A avatar element wrapping Quasar's
|
|
30
|
+
`QAvatar <https://quasar.dev/vue-components/avatar>`_ component.
|
|
31
|
+
|
|
32
|
+
:param icon: name of the icon or image path with "img:" prefix (e.g. "map", "img:path/to/image.png")
|
|
33
|
+
:param color: background color (either a Quasar, Tailwind, or CSS color or `None`, default: "primary")
|
|
34
|
+
:param text_color: color name from the Quasar Color Palette (e.g. "primary", "teal-10")
|
|
35
|
+
:param size: size in CSS units, including unit name or standard size name (xs|sm|md|lg|xl) (e.g. "16px", "2rem")
|
|
36
|
+
:param font_size: size in CSS units, including unit name, of the content (icon, text) (e.g. "18px", "2rem")
|
|
37
|
+
:param square: removes border-radius so borders are squared (default: False)
|
|
38
|
+
:param rounded: applies a small standard border-radius for a squared shape of the component (default: False)
|
|
39
|
+
"""
|
|
40
|
+
pc = ParameterClassifier(
|
|
41
|
+
locals(),
|
|
42
|
+
maybeRefs=[
|
|
43
|
+
"icon",
|
|
44
|
+
"color",
|
|
45
|
+
"text_color",
|
|
46
|
+
"size",
|
|
47
|
+
"font_size",
|
|
48
|
+
"square",
|
|
49
|
+
"rounded",
|
|
50
|
+
],
|
|
51
|
+
events=[],
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
init_kws = pc.get_values_kws()
|
|
55
|
+
element = ui.avatar(**init_kws)
|
|
56
|
+
super().__init__(element)
|
|
57
|
+
|
|
58
|
+
for key, value in pc.get_bindings().items():
|
|
59
|
+
self.bind_prop(key, value) # type: ignore
|
|
60
|
+
|
|
61
|
+
def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
|
|
62
|
+
if prop == "color":
|
|
63
|
+
return self.bind_color(value)
|
|
64
|
+
if prop == "text-color":
|
|
65
|
+
return self.bind_text_color(value)
|
|
66
|
+
|
|
67
|
+
return super().bind_prop(prop, value)
|
|
68
|
+
|
|
69
|
+
def bind_color(self, color: TGetterOrReadonlyRef):
|
|
70
|
+
"""Binds the background color property of the chip to a ui element.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
color (TGetterOrReadonlyRef): background color ui element or getter function
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
BackgroundColorableMixin.bind_color(self, color)
|
|
77
|
+
return self
|
|
78
|
+
|
|
79
|
+
def bind_text_color(self, color: TGetterOrReadonlyRef):
|
|
80
|
+
"""Binds the text color property of the chip to a ui element.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
color (TGetterOrReadonlyRef): text color ui element or getter function
|
|
84
|
+
"""
|
|
85
|
+
TextColorableMixin.bind_color(self, color)
|
|
86
|
+
return self
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
3
|
+
from ex4nicegui.utils.signals import (
|
|
4
|
+
TGetterOrReadonlyRef,
|
|
5
|
+
to_value,
|
|
6
|
+
_TMaybeRef as TMaybeRef,
|
|
7
|
+
)
|
|
8
|
+
from nicegui import ui
|
|
9
|
+
from .base import BindableUi
|
|
10
|
+
from ex4nicegui.reactive.mixins.backgroundColor import BackgroundColorableMixin
|
|
11
|
+
from ex4nicegui.reactive.mixins.textColor import TextColorableMixin
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BadgeBindableUi(
|
|
15
|
+
BindableUi[ui.badge],
|
|
16
|
+
BackgroundColorableMixin,
|
|
17
|
+
TextColorableMixin,
|
|
18
|
+
):
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
text: TMaybeRef[str] = "",
|
|
22
|
+
*,
|
|
23
|
+
color: Optional[TMaybeRef[str]] = "primary",
|
|
24
|
+
text_color: Optional[TMaybeRef[str]] = None,
|
|
25
|
+
outline: TMaybeRef[bool] = False,
|
|
26
|
+
) -> None:
|
|
27
|
+
"""Badge
|
|
28
|
+
|
|
29
|
+
A badge element wrapping Quasar's
|
|
30
|
+
`QBadge <https://quasar.dev/vue-components/badge>`_ component.
|
|
31
|
+
|
|
32
|
+
:param text: the initial value of the text field
|
|
33
|
+
:param color: the color name for component (either a Quasar, Tailwind, or CSS color or `None`, default: "primary")
|
|
34
|
+
:param text_color: text color (either a Quasar, Tailwind, or CSS color or `None`, default: `None`)
|
|
35
|
+
:param outline: use 'outline' design (colored text and borders only) (default: False)
|
|
36
|
+
"""
|
|
37
|
+
pc = ParameterClassifier(
|
|
38
|
+
locals(),
|
|
39
|
+
maybeRefs=[
|
|
40
|
+
"text",
|
|
41
|
+
"color",
|
|
42
|
+
"text_color",
|
|
43
|
+
"outline",
|
|
44
|
+
],
|
|
45
|
+
events=[],
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
element = ui.badge(**pc.get_values_kws())
|
|
49
|
+
super().__init__(element)
|
|
50
|
+
|
|
51
|
+
for key, value in pc.get_bindings().items():
|
|
52
|
+
self.bind_prop(key, value) # type: ignore
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def text(self):
|
|
56
|
+
return self.element.text
|
|
57
|
+
|
|
58
|
+
def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
|
|
59
|
+
if prop == "text":
|
|
60
|
+
return self.bind_text(value)
|
|
61
|
+
|
|
62
|
+
if prop == "color":
|
|
63
|
+
return self.bind_color(value)
|
|
64
|
+
if prop == "text-color":
|
|
65
|
+
return self.bind_text_color(value)
|
|
66
|
+
|
|
67
|
+
return super().bind_prop(prop, value)
|
|
68
|
+
|
|
69
|
+
def bind_color(self, color: TGetterOrReadonlyRef):
|
|
70
|
+
"""Binds the background color property of the chip to a ui element.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
color (TGetterOrReadonlyRef): background color ui element or getter function
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
BackgroundColorableMixin.bind_color(self, color)
|
|
77
|
+
return self
|
|
78
|
+
|
|
79
|
+
def bind_text_color(self, color: TGetterOrReadonlyRef):
|
|
80
|
+
"""Binds the text color property of the chip to a ui element.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
color (TGetterOrReadonlyRef): text color ui element or getter function
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
"""
|
|
87
|
+
TextColorableMixin.bind_color(self, color)
|
|
88
|
+
return self
|
|
89
|
+
|
|
90
|
+
def bind_text(self, text: TGetterOrReadonlyRef):
|
|
91
|
+
"""Binds the text property of the chip to a ui element.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
text (TGetterOrReadonlyRef): text ui element or getter function
|
|
95
|
+
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
@self._ui_signal_on(text)
|
|
99
|
+
def _():
|
|
100
|
+
self.element.set_text(str(to_value(text)))
|
|
101
|
+
|
|
102
|
+
return self
|
|
@@ -50,9 +50,8 @@ class CheckboxBindableUi(BindableUi[ui.checkbox], DisableableMixin):
|
|
|
50
50
|
return super().bind_prop(prop, value)
|
|
51
51
|
|
|
52
52
|
def bind_value(self, value: TGetterOrReadonlyRef[bool]):
|
|
53
|
-
@self.
|
|
53
|
+
@self._ui_signal_on(value)
|
|
54
54
|
def _():
|
|
55
55
|
self.element.set_value(to_value(value))
|
|
56
|
-
self.element.update()
|
|
57
56
|
|
|
58
57
|
return self
|
|
@@ -139,7 +139,7 @@ class EChartsBindableUi(BindableUi[echarts]):
|
|
|
139
139
|
return super().bind_prop(prop, value)
|
|
140
140
|
|
|
141
141
|
def bind_options(self, options: TGetterOrReadonlyRef[Dict]):
|
|
142
|
-
@self._ui_signal_on(options)
|
|
142
|
+
@self._ui_signal_on(options, deep=True)
|
|
143
143
|
def _():
|
|
144
144
|
ele = self.element
|
|
145
145
|
ele.update_options(to_raw(to_value(options)), self.__update_setting)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Optional,
|
|
3
|
-
cast,
|
|
4
3
|
)
|
|
5
4
|
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
6
5
|
from ex4nicegui.utils.signals import (
|
|
@@ -9,9 +8,6 @@ from ex4nicegui.utils.signals import (
|
|
|
9
8
|
to_value,
|
|
10
9
|
)
|
|
11
10
|
from nicegui import ui
|
|
12
|
-
from nicegui.elements.mixins.color_elements import (
|
|
13
|
-
TextColorElement,
|
|
14
|
-
)
|
|
15
11
|
from .base import BindableUi
|
|
16
12
|
from ex4nicegui.reactive.mixins.textColor import TextColorableMixin
|
|
17
13
|
|
|
@@ -44,10 +40,8 @@ class IconBindableUi(BindableUi[ui.icon], TextColorableMixin):
|
|
|
44
40
|
return super().bind_prop(prop, value)
|
|
45
41
|
|
|
46
42
|
def bind_name(self, name: TGetterOrReadonlyRef):
|
|
47
|
-
@self.
|
|
43
|
+
@self._ui_signal_on(name)
|
|
48
44
|
def _():
|
|
49
|
-
|
|
50
|
-
ele._props["name"] = to_value(name)
|
|
51
|
-
ele.update()
|
|
45
|
+
self.element.set_name(to_value(name))
|
|
52
46
|
|
|
53
47
|
return self
|
|
@@ -32,6 +32,6 @@ class ImageBindableUi(BindableUi[ui.image]):
|
|
|
32
32
|
return super().bind_prop(prop, value)
|
|
33
33
|
|
|
34
34
|
def bind_source(self, source: TGetterOrReadonlyRef[Union[str, Path]]):
|
|
35
|
-
@self.
|
|
35
|
+
@self._ui_signal_on(source, deep=False)
|
|
36
36
|
def _():
|
|
37
37
|
self.element.set_source(to_value(source))
|
|
@@ -60,15 +60,14 @@ class InputBindableUi(BindableUi[ui.input], DisableableMixin):
|
|
|
60
60
|
return super().bind_prop(prop, value)
|
|
61
61
|
|
|
62
62
|
def bind_value(self, value: TGetterOrReadonlyRef[str]):
|
|
63
|
-
@self.
|
|
63
|
+
@self._ui_signal_on(value)
|
|
64
64
|
def _():
|
|
65
65
|
self.element.set_value(to_value(value))
|
|
66
|
-
self.element.update()
|
|
67
66
|
|
|
68
67
|
return self
|
|
69
68
|
|
|
70
69
|
def bind_password(self, password: TGetterOrReadonlyRef[bool]):
|
|
71
|
-
@self.
|
|
70
|
+
@self._ui_signal_on(password)
|
|
72
71
|
def _():
|
|
73
72
|
self.element._props["type"] = "password" if to_value(password) else "text"
|
|
74
73
|
self.element.update()
|
|
@@ -3,6 +3,7 @@ from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
|
3
3
|
from ex4nicegui.utils.signals import (
|
|
4
4
|
TGetterOrReadonlyRef,
|
|
5
5
|
to_value,
|
|
6
|
+
to_raw,
|
|
6
7
|
_TMaybeRef as TMaybeRef,
|
|
7
8
|
)
|
|
8
9
|
from nicegui import ui
|
|
@@ -17,7 +18,9 @@ class LabelBindableUi(BindableUi[ui.label], HtmlTextColorableMixin):
|
|
|
17
18
|
) -> None:
|
|
18
19
|
pc = ParameterClassifier(locals(), maybeRefs=["text"], events=[])
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
init_kws = pc.get_values_kws()
|
|
22
|
+
init_kws.update({"text": str(init_kws.get("text", ""))})
|
|
23
|
+
element = ui.label(**init_kws)
|
|
21
24
|
super().__init__(element)
|
|
22
25
|
|
|
23
26
|
for key, value in pc.get_bindings().items():
|
|
@@ -37,9 +40,8 @@ class LabelBindableUi(BindableUi[ui.label], HtmlTextColorableMixin):
|
|
|
37
40
|
return super().bind_prop(prop, value)
|
|
38
41
|
|
|
39
42
|
def bind_text(self, text: TGetterOrReadonlyRef):
|
|
40
|
-
@self.
|
|
43
|
+
@self._ui_signal_on(text, deep=True)
|
|
41
44
|
def _():
|
|
42
|
-
self.element.set_text(str(to_value(text)))
|
|
43
|
-
self.element.update()
|
|
45
|
+
self.element.set_text(str(to_raw(to_value(text))))
|
|
44
46
|
|
|
45
47
|
return self
|
|
@@ -56,7 +56,7 @@ class LinearProgressBindableUi(BindableUi[ui.linear_progress], TextColorableMixi
|
|
|
56
56
|
return super().bind_prop(prop, value)
|
|
57
57
|
|
|
58
58
|
def bind_value(self, value: TGetterOrReadonlyRef):
|
|
59
|
-
@self.
|
|
59
|
+
@self._ui_signal_on(value)
|
|
60
60
|
def _():
|
|
61
61
|
self.element.set_value(to_value(value))
|
|
62
62
|
|
|
@@ -80,14 +80,14 @@ class NumberBindableUi(BindableUi[ui.number]):
|
|
|
80
80
|
return super().bind_prop(prop, value)
|
|
81
81
|
|
|
82
82
|
def bind_value(self, value: TGetterOrReadonlyRef[float]):
|
|
83
|
-
@self.
|
|
83
|
+
@self._ui_signal_on(value)
|
|
84
84
|
def _():
|
|
85
85
|
self.element.set_value(to_value(value))
|
|
86
86
|
|
|
87
87
|
return self
|
|
88
88
|
|
|
89
89
|
def _bind_precision(self, precision: TGetterOrReadonlyRef[int]):
|
|
90
|
-
@self._ui_signal_on(precision
|
|
90
|
+
@self._ui_signal_on(precision)
|
|
91
91
|
def _():
|
|
92
92
|
self.element.precision = to_value(precision)
|
|
93
93
|
self.element.sanitize()
|
|
@@ -61,14 +61,14 @@ class RadioBindableUi(BindableUi[ui.radio]):
|
|
|
61
61
|
return super().bind_prop(prop, value)
|
|
62
62
|
|
|
63
63
|
def bind_options(self, options: TGetterOrReadonlyRef):
|
|
64
|
-
@self.
|
|
64
|
+
@self._ui_signal_on(options, deep=True)
|
|
65
65
|
def _():
|
|
66
66
|
self.element.set_options(to_value(options))
|
|
67
67
|
|
|
68
68
|
return self
|
|
69
69
|
|
|
70
70
|
def bind_value(self, value: TGetterOrReadonlyRef):
|
|
71
|
-
@self.
|
|
71
|
+
@self._ui_signal_on(value)
|
|
72
72
|
def _():
|
|
73
73
|
cast(ValueElement, self.element).set_value(to_value(value))
|
|
74
74
|
|
|
@@ -84,14 +84,14 @@ class SelectBindableUi(BindableUi[ui.select]):
|
|
|
84
84
|
return super().bind_prop(prop, value)
|
|
85
85
|
|
|
86
86
|
def bind_options(self, options: TGetterOrReadonlyRef):
|
|
87
|
-
@self.
|
|
87
|
+
@self._ui_signal_on(options, deep=True)
|
|
88
88
|
def _():
|
|
89
89
|
self.element.set_options(to_value(options))
|
|
90
90
|
|
|
91
91
|
return self
|
|
92
92
|
|
|
93
93
|
def bind_value(self, value: TGetterOrReadonlyRef):
|
|
94
|
-
@self.
|
|
94
|
+
@self._ui_signal_on(value, deep=True)
|
|
95
95
|
def _():
|
|
96
96
|
cast(ValueElement, self.element).set_value(to_raw(to_value(value)) or None)
|
|
97
97
|
|
|
@@ -35,7 +35,6 @@ class SwitchBindableUi(BindableUi[ui.switch]):
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
value_kws = pc.get_values_kws()
|
|
38
|
-
value_kws.update({"value": 0 if value is None else value})
|
|
39
38
|
|
|
40
39
|
element = ui.switch(**value_kws)
|
|
41
40
|
super().__init__(element) # type: ignore
|
|
@@ -54,7 +53,7 @@ class SwitchBindableUi(BindableUi[ui.switch]):
|
|
|
54
53
|
return super().bind_prop(prop, value)
|
|
55
54
|
|
|
56
55
|
def bind_value(self, value: TGetterOrReadonlyRef[bool]):
|
|
57
|
-
@self.
|
|
56
|
+
@self._ui_signal_on(value)
|
|
58
57
|
def _():
|
|
59
58
|
self.element.set_value(to_value(value))
|
|
60
59
|
|
|
@@ -59,7 +59,7 @@ class TextareaBindableUi(BindableUi[ui.textarea]):
|
|
|
59
59
|
return super().bind_prop(prop, value)
|
|
60
60
|
|
|
61
61
|
def bind_value(self, value: TGetterOrReadonlyRef[str]):
|
|
62
|
-
@self.
|
|
62
|
+
@self._ui_signal_on(value)
|
|
63
63
|
def _():
|
|
64
64
|
self.element.set_value(to_value(value))
|
|
65
65
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
Any,
|
|
3
|
+
Callable,
|
|
4
|
+
List,
|
|
5
|
+
Optional,
|
|
6
|
+
TypeVar,
|
|
7
|
+
Dict,
|
|
8
|
+
Union,
|
|
9
|
+
)
|
|
10
|
+
from ex4nicegui.reactive.services.reactive_service import ParameterClassifier
|
|
11
|
+
from ex4nicegui.utils.signals import (
|
|
12
|
+
TGetterOrReadonlyRef,
|
|
13
|
+
_TMaybeRef as TMaybeRef,
|
|
14
|
+
to_value,
|
|
15
|
+
to_raw,
|
|
16
|
+
)
|
|
17
|
+
from nicegui import ui
|
|
18
|
+
from .base import BindableUi
|
|
19
|
+
|
|
20
|
+
T = TypeVar("T")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ToggleBindableUi(BindableUi[ui.toggle]):
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
options: Union[TMaybeRef[List], TMaybeRef[Dict]],
|
|
27
|
+
*,
|
|
28
|
+
value: TMaybeRef[Any] = None,
|
|
29
|
+
on_change: Optional[Callable[..., Any]] = None,
|
|
30
|
+
clearable: TMaybeRef[bool] = False,
|
|
31
|
+
) -> None:
|
|
32
|
+
"""Toggle
|
|
33
|
+
|
|
34
|
+
This element is based on Quasar's `QBtnToggle <https://quasar.dev/vue-components/button-toggle>`_ component.
|
|
35
|
+
|
|
36
|
+
The options can be specified as a list of values, or as a dictionary mapping values to labels.
|
|
37
|
+
After manipulating the options, call `update()` to update the options in the UI.
|
|
38
|
+
|
|
39
|
+
:param options: a list ['value1', ...] or dictionary `{'value1':'label1', ...}` specifying the options
|
|
40
|
+
:param value: the initial value
|
|
41
|
+
:param on_change: callback to execute when selection changes
|
|
42
|
+
:param clearable: whether the toggle can be cleared by clicking the selected option
|
|
43
|
+
"""
|
|
44
|
+
pc = ParameterClassifier(
|
|
45
|
+
locals(),
|
|
46
|
+
maybeRefs=[
|
|
47
|
+
"options",
|
|
48
|
+
"value",
|
|
49
|
+
"clearable",
|
|
50
|
+
],
|
|
51
|
+
v_model=("value", "on_change"),
|
|
52
|
+
events=["on_change"],
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
value_kws = pc.get_values_kws()
|
|
56
|
+
|
|
57
|
+
element = ui.toggle(**value_kws)
|
|
58
|
+
super().__init__(element) # type: ignore
|
|
59
|
+
|
|
60
|
+
for key, value in pc.get_bindings().items():
|
|
61
|
+
self.bind_prop(key, value) # type: ignore
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def value(self):
|
|
65
|
+
return self.element.value
|
|
66
|
+
|
|
67
|
+
def bind_prop(self, prop: str, value: TGetterOrReadonlyRef):
|
|
68
|
+
if prop == "value":
|
|
69
|
+
return self.bind_value(value)
|
|
70
|
+
|
|
71
|
+
if prop == "options":
|
|
72
|
+
return self.bind_options(value)
|
|
73
|
+
|
|
74
|
+
return super().bind_prop(prop, value)
|
|
75
|
+
|
|
76
|
+
def bind_options(self, options: TGetterOrReadonlyRef):
|
|
77
|
+
@self._ui_signal_on(options, deep=True)
|
|
78
|
+
def _():
|
|
79
|
+
self.element.set_options(to_value(options))
|
|
80
|
+
|
|
81
|
+
return self
|
|
82
|
+
|
|
83
|
+
def bind_value(self, value: TGetterOrReadonlyRef):
|
|
84
|
+
@self._ui_signal_on(value, deep=True)
|
|
85
|
+
def _():
|
|
86
|
+
self.element.set_value(to_raw(to_value(value)) or None)
|
|
87
|
+
|
|
88
|
+
return self
|