neutralino-python 0.1.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- neutralino/__init__.py +88 -0
- neutralino/_catalog.py +297 -0
- neutralino/_data/LICENSE.neutralino-js-client +21 -0
- neutralino/_data/LICENSE.neutralinojs +1066 -0
- neutralino/_data/docs/cli.md +315 -0
- neutralino/_data/docs/custom-components.md +107 -0
- neutralino/_data/docs/custom-frontends.md +80 -0
- neutralino/_data/docs/desktop-helpers.md +296 -0
- neutralino/_data/docs/guide.md +131 -0
- neutralino/_data/docs/llms-full.txt +3921 -0
- neutralino/_data/docs/llms.txt +43 -0
- neutralino/_data/docs/manifests/components.json +20128 -0
- neutralino/_data/docs/manifests/examples.json +52 -0
- neutralino/_data/docs/manifests/native.json +3024 -0
- neutralino/_data/docs/manifests/schema.json +43 -0
- neutralino/_data/docs/manual-checklist.md +189 -0
- neutralino/_data/docs/packaging.md +252 -0
- neutralino/_data/docs/performance.md +15 -0
- neutralino/_data/docs/platforms.md +15 -0
- neutralino/_data/docs/reference/components.md +1685 -0
- neutralino/_data/docs/reference/native.md +148 -0
- neutralino/_data/docs/security.md +60 -0
- neutralino/_data/docs/ui.md +249 -0
- neutralino/_data/docs/updates.md +366 -0
- neutralino/_data/examples/README.md +6 -0
- neutralino/_data/examples/crud/README.md +36 -0
- neutralino/_data/examples/crud/app.py +243 -0
- neutralino/_data/examples/dashboard/README.md +36 -0
- neutralino/_data/examples/dashboard/app.py +367 -0
- neutralino/_data/examples/editor/README.md +35 -0
- neutralino/_data/examples/editor/app.py +190 -0
- neutralino/_data/examples/file-manager/README.md +40 -0
- neutralino/_data/examples/file-manager/app.py +120 -0
- neutralino/_data/examples/file-manager/frontend/index.html +20 -0
- neutralino/_data/examples/file-manager/frontend/main.js +55 -0
- neutralino/_data/examples/file-manager/frontend/neutralino.js +1 -0
- neutralino/_data/examples/file-manager/frontend/python-bridge.d.ts +207 -0
- neutralino/_data/examples/file-manager/frontend/python-bridge.mjs +854 -0
- neutralino/_data/examples/file-manager/frontend/style.css +4 -0
- neutralino/_data/examples/hybrid/README.md +48 -0
- neutralino/_data/examples/hybrid/app.py +80 -0
- neutralino/_data/examples/hybrid/components/counter.mjs +37 -0
- neutralino/_data/examples/hybrid/components/widget.mjs +23 -0
- neutralino/_data/examples/hybrid/styles.css +21 -0
- neutralino/_data/examples/hybrid/widget/package.json +20 -0
- neutralino/_data/examples/hybrid/widget/src/Widget.jsx +25 -0
- neutralino/_data/examples/hybrid/widget/vite.config.mjs +19 -0
- neutralino/_data/examples/monitor/README.md +36 -0
- neutralino/_data/examples/monitor/app.py +375 -0
- neutralino/_data/examples/react/README.md +90 -0
- neutralino/_data/examples/react/app.py +68 -0
- neutralino/_data/examples/react/frontend/.gitignore +5 -0
- neutralino/_data/examples/react/frontend/index.html +17 -0
- neutralino/_data/examples/react/frontend/package-lock.json +1232 -0
- neutralino/_data/examples/react/frontend/package.json +25 -0
- neutralino/_data/examples/react/frontend/scripts/prepare-bridge.mjs +49 -0
- neutralino/_data/examples/react/frontend/src/App.tsx +157 -0
- neutralino/_data/examples/react/frontend/src/backend.ts +21 -0
- neutralino/_data/examples/react/frontend/src/calls.test.ts +206 -0
- neutralino/_data/examples/react/frontend/src/calls.ts +306 -0
- neutralino/_data/examples/react/frontend/src/globals.d.ts +14 -0
- neutralino/_data/examples/react/frontend/src/hooks.ts +45 -0
- neutralino/_data/examples/react/frontend/src/main.tsx +13 -0
- neutralino/_data/examples/react/frontend/src/styles.css +11 -0
- neutralino/_data/examples/react/frontend/tsconfig.json +18 -0
- neutralino/_data/examples/react/frontend/vite.config.ts +9 -0
- neutralino/_data/examples/settings/README.md +38 -0
- neutralino/_data/examples/settings/app.py +440 -0
- neutralino/_data/examples/updater/.gitignore +2 -0
- neutralino/_data/examples/updater/README.md +82 -0
- neutralino/_data/examples/updater/app.py +160 -0
- neutralino/_data/examples/updater/app.toml +21 -0
- neutralino/_data/examples/updater/demo.py +107 -0
- neutralino/_data/examples/updater/requirements.txt +2 -0
- neutralino/_data/examples/updater/sources/github-private.toml +21 -0
- neutralino/_data/examples/updater/sources/github-public.toml +21 -0
- neutralino/_data/examples/vanilla/README.md +35 -0
- neutralino/_data/examples/vanilla/app.py +46 -0
- neutralino/_data/examples/vanilla/frontend/index.html +17 -0
- neutralino/_data/examples/vanilla/frontend/main.js +29 -0
- neutralino/_data/examples/vanilla/frontend/neutralino.js +1 -0
- neutralino/_data/examples/vanilla/frontend/python-bridge.d.ts +207 -0
- neutralino/_data/examples/vanilla/frontend/python-bridge.mjs +854 -0
- neutralino/_data/examples/vanilla/frontend/style.css +4 -0
- neutralino/_data/explorer/app.py +1328 -0
- neutralino/_data/explorer/catalogue.json +48179 -0
- neutralino/_data/explorer/explorer_previews.py +247 -0
- neutralino/_data/explorer/sources/native/always_on_top.py +55 -0
- neutralino/_data/explorer/sources/native/binary.py +125 -0
- neutralino/_data/explorer/sources/native/borderless.py +99 -0
- neutralino/_data/explorer/sources/native/broadcast.py +90 -0
- neutralino/_data/explorer/sources/native/config.py +78 -0
- neutralino/_data/explorer/sources/native/controls.py +140 -0
- neutralino/_data/explorer/sources/native/directory.py +163 -0
- neutralino/_data/explorer/sources/native/displays.py +75 -0
- neutralino/_data/explorer/sources/native/env.py +98 -0
- neutralino/_data/explorer/sources/native/events.py +124 -0
- neutralino/_data/explorer/sources/native/exec_command.py +79 -0
- neutralino/_data/explorer/sources/native/folder.py +70 -0
- neutralino/_data/explorer/sources/native/icon_badge.py +101 -0
- neutralino/_data/explorer/sources/native/image.py +119 -0
- neutralino/_data/explorer/sources/native/lifecycle.py +99 -0
- neutralino/_data/explorer/sources/native/locale.py +70 -0
- neutralino/_data/explorer/sources/native/main_menu.py +103 -0
- neutralino/_data/explorer/sources/native/message_box.py +101 -0
- neutralino/_data/explorer/sources/native/mouse.py +70 -0
- neutralino/_data/explorer/sources/native/multi_window.py +134 -0
- neutralino/_data/explorer/sources/native/notification.py +74 -0
- neutralino/_data/explorer/sources/native/open_external.py +81 -0
- neutralino/_data/explorer/sources/native/open_file.py +102 -0
- neutralino/_data/explorer/sources/native/paths.py +77 -0
- neutralino/_data/explorer/sources/native/print_snapshot.py +84 -0
- neutralino/_data/explorer/sources/native/read_write.py +192 -0
- neutralino/_data/explorer/sources/native/resources.py +110 -0
- neutralino/_data/explorer/sources/native/save_file.py +101 -0
- neutralino/_data/explorer/sources/native/server_mount.py +106 -0
- neutralino/_data/explorer/sources/native/sound.py +84 -0
- neutralino/_data/explorer/sources/native/spawn_process.py +128 -0
- neutralino/_data/explorer/sources/native/states.py +122 -0
- neutralino/_data/explorer/sources/native/stats_permissions.py +147 -0
- neutralino/_data/explorer/sources/native/storage.py +108 -0
- neutralino/_data/explorer/sources/native/system_info.py +115 -0
- neutralino/_data/explorer/sources/native/text.py +133 -0
- neutralino/_data/explorer/sources/native/trash.py +98 -0
- neutralino/_data/explorer/sources/native/tray.py +109 -0
- neutralino/_data/explorer/sources/native/watcher.py +167 -0
- neutralino/_data/explorer/sources/patterns/content_blocks.py +119 -0
- neutralino/_data/explorer/sources/patterns/dynamic_dashboard.py +121 -0
- neutralino/_data/explorer/sources/patterns/dynamic_form.py +120 -0
- neutralino/_data/explorer/sources/patterns/dynamic_table.py +109 -0
- neutralino/_data/explorer/sources/patterns/error_reporting.mjs +24 -0
- neutralino/_data/explorer/sources/patterns/error_reporting.py +124 -0
- neutralino/_data/explorer/sources/patterns/errors_timeouts.py +108 -0
- neutralino/_data/explorer/sources/patterns/feature_flags.py +99 -0
- neutralino/_data/explorer/sources/patterns/file_drop.py +126 -0
- neutralino/_data/explorer/sources/patterns/http_from_python.py +152 -0
- neutralino/_data/explorer/sources/patterns/keyboard_shortcuts.py +153 -0
- neutralino/_data/explorer/sources/patterns/live_config_reload.py +160 -0
- neutralino/_data/explorer/sources/patterns/logging.py +184 -0
- neutralino/_data/explorer/sources/patterns/long_tasks.py +121 -0
- neutralino/_data/explorer/sources/patterns/multi_window_sync.py +68 -0
- neutralino/_data/explorer/sources/patterns/navigation_from_backend.py +109 -0
- neutralino/_data/explorer/sources/patterns/onboarding.py +123 -0
- neutralino/_data/explorer/sources/patterns/optimistic_updates.py +89 -0
- neutralino/_data/explorer/sources/patterns/persistence.py +114 -0
- neutralino/_data/explorer/sources/patterns/python_calls_page.mjs +10 -0
- neutralino/_data/explorer/sources/patterns/python_calls_page.py +64 -0
- neutralino/_data/explorer/sources/patterns/python_push.py +84 -0
- neutralino/_data/explorer/sources/patterns/recurring_events.py +114 -0
- neutralino/_data/explorer/sources/patterns/roles_permissions.py +104 -0
- neutralino/_data/explorer/sources/patterns/scheduled_jobs.py +194 -0
- neutralino/_data/explorer/sources/patterns/settings_page.py +165 -0
- neutralino/_data/explorer/sources/patterns/sqlite.py +181 -0
- neutralino/_data/explorer/sources/patterns/streaming.py +102 -0
- neutralino/_data/explorer/sources/patterns/texts_i18n.py +81 -0
- neutralino/_data/explorer/sources/patterns/theme_from_backend.py +86 -0
- neutralino/_data/explorer/sources/patterns/updater.py +232 -0
- neutralino/_data/explorer/sources/workspace/calendar/app.py +547 -0
- neutralino/_data/explorer/sources/workspace/customers/app.py +467 -0
- neutralino/_data/explorer/sources/workspace/dashboard/README.md +36 -0
- neutralino/_data/explorer/sources/workspace/dashboard/app.py +367 -0
- neutralino/_data/explorer/sources/workspace/documents/app.py +511 -0
- neutralino/_data/explorer/sources/workspace/inbox/app.py +439 -0
- neutralino/_data/explorer/sources/workspace/orders/app.py +491 -0
- neutralino/_data/explorer/sources/workspace/reports/app.py +386 -0
- neutralino/_data/explorer/sources/workspace/settings/README.md +38 -0
- neutralino/_data/explorer/sources/workspace/settings/app.py +440 -0
- neutralino/_data/explorer/sources/workspace/system/README.md +36 -0
- neutralino/_data/explorer/sources/workspace/system/app.py +375 -0
- neutralino/_data/explorer/sources/workspace/tasks/app.py +462 -0
- neutralino/_data/renderer/LICENSES/@babel__runtime@7.29.17/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/@codemirror__autocomplete@6.20.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__commands@6.11.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-css@6.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-html@6.4.12/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-javascript@6.2.5/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-json@6.0.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-markdown@6.5.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-python@6.2.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-sql@6.10.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__lang-yaml@6.1.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__language@6.13.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__search@6.7.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__state@6.7.6/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@codemirror__view@6.44.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__accessibility@3.1.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__core@6.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__sortable@10.0.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@dnd-kit__utilities@3.2.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@emoji-mart__data@1.2.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__core@1.8.0/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__dom@1.8.0/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__react-dom@2.1.9/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__react@0.27.20/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@floating-ui__utils@0.2.12/LICENSE +20 -0
- neutralino/_data/renderer/LICENSES/@lezer__common@1.5.7/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__css@1.3.9/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__highlight@1.2.5/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__html@1.3.13/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__javascript@1.5.7/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__json@1.0.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__lr@1.4.13/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__markdown@1.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__python@1.1.21/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@lezer__yaml@1.0.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__carousel@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__charts@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__code-highlight@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__core@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__dates@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__dropzone@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__emoji@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__hooks@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__lightbox@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__notifications@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__nprogress@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__schedule@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__spotlight@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__store@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@mantine__tiptap@9.8.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@marijn__find-cluster-break@1.0.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@reduxjs__toolkit@2.16.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tabler__icons-react@3.55.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tanstack__react-virtual@3.14.32/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tanstack__virtual-core@3.19.17/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__core@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-blockquote@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-bold@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-code-block@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-code@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-document@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-hard-break@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-heading@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-horizontal-rule@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-italic@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-link@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-list@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-paragraph@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-strike@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-text@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extension-underline@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__extensions@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__react@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/@tiptap__starter-kit@3.35.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/attr-accept@4.0.1/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/clsx@2.1.1/license +9 -0
- neutralino/_data/renderer/LICENSES/crelt@1.0.7/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/d3-array@3.2.5/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-color@3.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-format@3.1.3/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-interpolate@3.0.2/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-path@3.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-scale@4.0.3/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-shape@3.2.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-time-format@4.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/d3-time@3.1.1/LICENSE +13 -0
- neutralino/_data/renderer/LICENSES/dayjs@1.11.23/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/decimal.js-light@2.5.1/LICENCE.md +23 -0
- neutralino/_data/renderer/LICENSES/diff@9.0.0/LICENSE +29 -0
- neutralino/_data/renderer/LICENSES/dompurify@3.5.1/LICENSE +202 -0
- neutralino/_data/renderer/LICENSES/dompurify@3.5.1/LICENSE-MPL +373 -0
- neutralino/_data/renderer/LICENSES/embla-carousel-react@8.6.0/MIT-embla-carousel.txt +21 -0
- neutralino/_data/renderer/LICENSES/embla-carousel-reactive-utils@8.6.0/MIT-embla-carousel.txt +21 -0
- neutralino/_data/renderer/LICENSES/embla-carousel@8.6.0/MIT-embla-carousel.txt +21 -0
- neutralino/_data/renderer/LICENSES/es-toolkit@1.53.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/es-toolkit@1.53.2/NOTICE +39 -0
- neutralino/_data/renderer/LICENSES/eventemitter3@5.0.4/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/fast-equals@5.4.7/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/file-selector@5.0.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/get-nonce@1.0.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/immer@11.2.14/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/linkifyjs@4.4.0/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/marked@18.4.0/LICENSE +44 -0
- neutralino/_data/renderer/LICENSES/neutralino.js@6.11.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/orderedmap@2.1.1/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/packages.json +1838 -0
- neutralino/_data/renderer/LICENSES/prosemirror-commands@1.7.2/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-dropcursor@1.8.4/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-gapcursor@1.4.1/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-history@1.5.2/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-keymap@1.2.3/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-model@1.25.13/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-schema-list@1.6.1/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-state@1.4.4/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-transform@1.12.7/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/prosemirror-view@1.44.0/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/react-dom@19.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-dropzone@20.1.4/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/react-is@19.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-number-format@5.4.5/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-redux@9.3.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/react-remove-scroll-bar@2.3.8/MIT-react-remove-scroll-bar.txt +21 -0
- neutralino/_data/renderer/LICENSES/react-remove-scroll@2.7.2/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-style-singleton@2.2.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/react-transition-group@4.4.5/LICENSE +30 -0
- neutralino/_data/renderer/LICENSES/react@19.3.1/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/recharts@3.11.3/LICENSE +22 -0
- neutralino/_data/renderer/LICENSES/redux-thunk@3.1.0/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/redux@5.0.1/LICENSE.md +21 -0
- neutralino/_data/renderer/LICENSES/reselect@5.2.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/rolldown@1.3.4/LICENSE +25 -0
- neutralino/_data/renderer/LICENSES/rope-sequence@1.3.4/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/rrule@2.8.1/LICENCE +65 -0
- neutralino/_data/renderer/LICENSES/scheduler@0.28.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/style-mod@4.1.5/LICENSE +19 -0
- neutralino/_data/renderer/LICENSES/tiny-invariant@1.3.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/tslib@2.9.1/LICENSE.txt +12 -0
- neutralino/_data/renderer/LICENSES/use-callback-ref@1.3.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/use-sidecar@1.1.3/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/use-sync-external-store@1.7.0/LICENSE +21 -0
- neutralino/_data/renderer/LICENSES/victory-vendor@38.1.1/LICENSE.txt +150 -0
- neutralino/_data/renderer/LICENSES/vite@8.4.1/LICENSE.md +2320 -0
- neutralino/_data/renderer/LICENSES/w3c-keyname@2.2.8/LICENSE +19 -0
- neutralino/_data/renderer/assets/IconGripVertical-C2NUKJAE.js +1 -0
- neutralino/_data/renderer/assets/carousel-D1j1SkWR.css +1 -0
- neutralino/_data/renderer/assets/carousel-DHnOKa8c.js +1 -0
- neutralino/_data/renderer/assets/chunk-CCkLOSkX.css +1 -0
- neutralino/_data/renderer/assets/chunk-CLVygP7p.js +9 -0
- neutralino/_data/renderer/assets/codehighlight-CXJaU0yv.js +10 -0
- neutralino/_data/renderer/assets/codehighlight-THJMNDh8.css +1 -0
- neutralino/_data/renderer/assets/codemirror-DX0MbxKq.js +2 -0
- neutralino/_data/renderer/assets/css-BotC7byr.js +1 -0
- neutralino/_data/renderer/assets/dist-3kB5bJpS.js +23 -0
- neutralino/_data/renderer/assets/dist-6zrr4MrK.js +1 -0
- neutralino/_data/renderer/assets/dist-Beotrn8G.js +1 -0
- neutralino/_data/renderer/assets/dist-CCJHv8n0.js +11 -0
- neutralino/_data/renderer/assets/dist-CdYA9or5.js +1 -0
- neutralino/_data/renderer/assets/dist-D2p_6o_g.js +1 -0
- neutralino/_data/renderer/assets/dnd-DkNumIKC.js +5 -0
- neutralino/_data/renderer/assets/dropzone-aPCBPjDN.css +1 -0
- neutralino/_data/renderer/assets/dropzone-agrigkXv.js +1 -0
- neutralino/_data/renderer/assets/embla-carousel-react.esm-_ztrE73N.js +1 -0
- neutralino/_data/renderer/assets/emoji-Cj3VQHg8.js +1 -0
- neutralino/_data/renderer/assets/emoji-DV8OzU1E.css +1 -0
- neutralino/_data/renderer/assets/esm-DbOmMyz5.js +82 -0
- neutralino/_data/renderer/assets/highlight-Dlb5DJwL.css +1 -0
- neutralino/_data/renderer/assets/highlight-LH6Cyuz6.js +3 -0
- neutralino/_data/renderer/assets/html-CpATC083.js +1 -0
- neutralino/_data/renderer/assets/icon-chunk-C-4QDF6w.js +1 -0
- neutralino/_data/renderer/assets/index-CqHW60Dy.js +69 -0
- neutralino/_data/renderer/assets/index-TWpF4Lef.css +1 -0
- neutralino/_data/renderer/assets/javascript-D2QSKlDI.js +1 -0
- neutralino/_data/renderer/assets/json-D8zfYii3.js +1 -0
- neutralino/_data/renderer/assets/lightbox-BijRfmPy.js +1 -0
- neutralino/_data/renderer/assets/lightbox-BzKDpkAD.css +1 -0
- neutralino/_data/renderer/assets/markdown-Cpthnhzg.js +77 -0
- neutralino/_data/renderer/assets/markdown-CsS2tf5C.js +5 -0
- neutralino/_data/renderer/assets/python-B477ud9A.js +9 -0
- neutralino/_data/renderer/assets/richtext-BwtgvH7-.js +137 -0
- neutralino/_data/renderer/assets/richtext-DIAsHMuK.css +1 -0
- neutralino/_data/renderer/assets/spotlight-Ccstaz1-.css +1 -0
- neutralino/_data/renderer/assets/spotlight-Db1pwUWd.js +1 -0
- neutralino/_data/renderer/assets/sql-DbpHRl6F.js +2 -0
- neutralino/_data/renderer/assets/with-selector-CUfuSYau.js +1 -0
- neutralino/_data/renderer/assets/yaml-BPsr1O3S.js +1 -0
- neutralino/_data/renderer/index.html +22 -0
- neutralino/_data/renderer/manifest.json +202 -0
- neutralino/_data/renderer/neutralino.js +1 -0
- neutralino/_data/renderer/shared/mantine-core.mjs +5 -0
- neutralino/_data/renderer/shared/mantine-hooks.mjs +5 -0
- neutralino/_data/renderer/shared/react-dom-client.mjs +5 -0
- neutralino/_data/renderer/shared/react-dom.mjs +6 -0
- neutralino/_data/renderer/shared/react-jsx-runtime.mjs +5 -0
- neutralino/_data/renderer/shared/react.mjs +6 -0
- neutralino/_data/skills/README.md +6 -0
- neutralino/_data/skills/neutralino-app-patterns/SKILL.md +101 -0
- neutralino/_data/skills/neutralino-app-patterns/references/dashboards-and-background-work.md +55 -0
- neutralino/_data/skills/neutralino-app-patterns/references/storage-and-settings.md +57 -0
- neutralino/_data/skills/neutralino-app-patterns/references/tables-and-crud.md +81 -0
- neutralino/_data/skills/neutralino-frontend/SKILL.md +121 -0
- neutralino/_data/skills/neutralino-frontend/references/bridge.md +63 -0
- neutralino/_data/skills/neutralino-frontend/references/custom-components.md +84 -0
- neutralino/_data/skills/neutralino-frontend/references/frameworks.md +61 -0
- neutralino/_data/skills/neutralino-maintenance/SKILL.md +85 -0
- neutralino/_data/skills/neutralino-maintenance/references/platforms-and-gates.md +35 -0
- neutralino/_data/skills/neutralino-maintenance/references/records.md +38 -0
- neutralino/_data/skills/neutralino-maintenance/references/review-process.md +36 -0
- neutralino/_data/skills/neutralino-native/SKILL.md +107 -0
- neutralino/_data/skills/neutralino-native/references/api-conventions.md +72 -0
- neutralino/_data/skills/neutralino-native/references/desktop-helpers.md +53 -0
- neutralino/_data/skills/neutralino-native/references/permissions-windows.md +53 -0
- neutralino/_data/skills/neutralino-packaging/SKILL.md +99 -0
- neutralino/_data/skills/neutralino-packaging/references/build-layout.md +51 -0
- neutralino/_data/skills/neutralino-packaging/references/managed-install.md +59 -0
- neutralino/_data/skills/neutralino-packaging/references/templates-and-config.md +63 -0
- neutralino/_data/skills/neutralino-python/SKILL.md +109 -0
- neutralino/_data/skills/neutralino-python/references/architecture.md +53 -0
- neutralino/_data/skills/neutralino-python/references/cli.md +60 -0
- neutralino/_data/skills/neutralino-python/references/platforms-security.md +44 -0
- neutralino/_data/skills/neutralino-rpc/SKILL.md +114 -0
- neutralino/_data/skills/neutralino-rpc/references/errors-and-limits.md +44 -0
- neutralino/_data/skills/neutralino-rpc/references/expose-and-context.md +74 -0
- neutralino/_data/skills/neutralino-rpc/references/streams-and-cancellation.md +53 -0
- neutralino/_data/skills/neutralino-ui/SKILL.md +115 -0
- neutralino/_data/skills/neutralino-ui/references/components-and-tree.md +74 -0
- neutralino/_data/skills/neutralino-ui/references/state-forms-events.md +85 -0
- neutralino/_data/skills/neutralino-ui/references/themes-profiles-assets.md +105 -0
- neutralino/_data/skills/neutralino-updates/SKILL.md +94 -0
- neutralino/_data/skills/neutralino-updates/references/config-and-api.md +80 -0
- neutralino/_data/skills/neutralino-updates/references/releases-and-install.md +77 -0
- neutralino/_data/skills/neutralino-updates/references/security-rollback.md +48 -0
- neutralino/_data/ui/contracts.json +32927 -0
- neutralino/_data/ui/emoji.json +1 -0
- neutralino/_data/upstream-lock.json +97 -0
- neutralino/_managed.py +1099 -0
- neutralino/_paths.py +220 -0
- neutralino/_platform.py +150 -0
- neutralino/_scaffold.py +344 -0
- neutralino/api/_base.py +99 -0
- neutralino/api/_custom.py +1350 -0
- neutralino/api/_dec.py +21 -0
- neutralino/api/_enc.py +80 -0
- neutralino/api/app.py +119 -0
- neutralino/api/clipboard.py +101 -0
- neutralino/api/computer.py +261 -0
- neutralino/api/custom.py +36 -0
- neutralino/api/debug.py +41 -0
- neutralino/api/extensions.py +57 -0
- neutralino/api/filesystem.py +633 -0
- neutralino/api/net.py +22 -0
- neutralino/api/os.py +508 -0
- neutralino/api/resources.py +124 -0
- neutralino/api/server.py +66 -0
- neutralino/api/storage.py +98 -0
- neutralino/api/types.py +342 -0
- neutralino/api/updater.py +22 -0
- neutralino/api/window.py +397 -0
- neutralino/application.py +1261 -0
- neutralino/bundle.py +187 -0
- neutralino/cli.py +629 -0
- neutralino/client.py +496 -0
- neutralino/config.py +671 -0
- neutralino/devtools.py +1973 -0
- neutralino/errors.py +142 -0
- neutralino/events.py +579 -0
- neutralino/execution.py +293 -0
- neutralino/extension.py +134 -0
- neutralino/frontend/python-bridge.d.ts +207 -0
- neutralino/frontend/python-bridge.mjs +854 -0
- neutralino/protocol.py +456 -0
- neutralino/py.typed +0 -0
- neutralino/rpc.py +1625 -0
- neutralino/runtime.py +591 -0
- neutralino/supervisor.py +866 -0
- neutralino/sync_client.py +376 -0
- neutralino/templates/default/app.py +32 -0
- neutralino/templates/default/frontend/app.js +28 -0
- neutralino/templates/default/frontend/index.html +26 -0
- neutralino/templates/default/frontend/neutralino.js +1 -0
- neutralino/templates/default/frontend/styles.css +8 -0
- neutralino/templates/default/gitignore.txt +3 -0
- neutralino/templates/default/neutralino.config.json +25 -0
- neutralino/templates/hybrid/README.md +17 -0
- neutralino/templates/hybrid/app.py +49 -0
- neutralino/templates/hybrid/components/counter.mjs +37 -0
- neutralino/templates/hybrid/styles.css +21 -0
- neutralino/templates/python-ui/README.md +15 -0
- neutralino/templates/python-ui/app.py +44 -0
- neutralino/templates/python-ui/gitignore.txt +3 -0
- neutralino/templates/python-ui/requirements.txt +4 -0
- neutralino/templates/react/README.md +28 -0
- neutralino/templates/react/app.py +52 -0
- neutralino/templates/react/components/widget.mjs +23 -0
- neutralino/templates/react/widget/package.json +20 -0
- neutralino/templates/react/widget/src/Widget.jsx +25 -0
- neutralino/templates/react/widget/vite.config.mjs +19 -0
- neutralino/transport.py +661 -0
- neutralino/types.py +93 -0
- neutralino/ui/__init__.py +139 -0
- neutralino/ui/_app.py +1529 -0
- neutralino/ui/_assets.py +407 -0
- neutralino/ui/_bases.py +1210 -0
- neutralino/ui/_behaviours.py +1066 -0
- neutralino/ui/_charts.py +732 -0
- neutralino/ui/_component.py +882 -0
- neutralino/ui/_dates.py +168 -0
- neutralino/ui/_desktop.py +879 -0
- neutralino/ui/_events.py +192 -0
- neutralino/ui/_filters.py +427 -0
- neutralino/ui/_forms.py +282 -0
- neutralino/ui/_protocol.py +201 -0
- neutralino/ui/_schedule.py +543 -0
- neutralino/ui/_security.py +106 -0
- neutralino/ui/_session.py +969 -0
- neutralino/ui/_state.py +199 -0
- neutralino/ui/_tables.py +256 -0
- neutralino/ui/_theme.py +154 -0
- neutralino/ui/blocks/__init__.py +19 -0
- neutralino/ui/blocks/_data.py +2239 -0
- neutralino/ui/blocks/_interactive.py +622 -0
- neutralino/ui/blocks/_layout.py +2967 -0
- neutralino/ui/components/__init__.py +81 -0
- neutralino/ui/components/_dates.py +879 -0
- neutralino/ui/components/_editors.py +217 -0
- neutralino/ui/components/_extensions.py +790 -0
- neutralino/ui/components/_extras.py +303 -0
- neutralino/ui/components/_generated.py +30565 -0
- neutralino/ui/components/_types.py +17 -0
- neutralino/ui/schema.py +824 -0
- neutralino/ui/validators.py +362 -0
- neutralino/updates/__init__.py +96 -0
- neutralino/updates/_http.py +320 -0
- neutralino/updates/_layout.py +762 -0
- neutralino/updates/archive.py +216 -0
- neutralino/updates/config.py +256 -0
- neutralino/updates/errors.py +97 -0
- neutralino/updates/install.sh.in +201 -0
- neutralino/updates/launcher.py +18 -0
- neutralino/updates/manager.py +808 -0
- neutralino/updates/manifest.py +196 -0
- neutralino/updates/release.py +314 -0
- neutralino/updates/semver.py +84 -0
- neutralino/updates/sources.py +392 -0
- neutralino/windows.py +316 -0
- neutralino_python-0.1.0rc1.dist-info/METADATA +117 -0
- neutralino_python-0.1.0rc1.dist-info/RECORD +521 -0
- neutralino_python-0.1.0rc1.dist-info/WHEEL +4 -0
- neutralino_python-0.1.0rc1.dist-info/entry_points.txt +3 -0
- neutralino_python-0.1.0rc1.dist-info/licenses/LICENSE +21 -0
- neutralino_python-0.1.0rc1.dist-info/licenses/THIRD_PARTY_NOTICES.md +16 -0
- neutralino_python-0.1.0rc1.dist-info/licenses/src/neutralino/_data/renderer/LICENSES/packages.json +1838 -0
neutralino/ui/_events.py
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""Typed event objects passed to UI callbacks."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import datetime as _dt
|
|
6
|
+
from collections.abc import Awaitable, Callable, Mapping
|
|
7
|
+
from dataclasses import dataclass, field
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Generic, TypeAlias, TypeVar, cast
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ._behaviours import Environment
|
|
12
|
+
from ._component import Component
|
|
13
|
+
from ._schedule import ScheduleEvent
|
|
14
|
+
from ._session import WindowSession
|
|
15
|
+
from .components._extensions import DroppedFile, RejectedFile
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"ChangeEvent",
|
|
19
|
+
"DropEvent",
|
|
20
|
+
"EmojiEvent",
|
|
21
|
+
"EnvironmentEvent",
|
|
22
|
+
"Event",
|
|
23
|
+
"Handler",
|
|
24
|
+
"IdleEvent",
|
|
25
|
+
"ReorderEvent",
|
|
26
|
+
"RowActionEvent",
|
|
27
|
+
"ScheduleEventChange",
|
|
28
|
+
"ScheduleRangeEvent",
|
|
29
|
+
"ScheduleSlotEvent",
|
|
30
|
+
"SpotlightActionEvent",
|
|
31
|
+
"SubmitEvent",
|
|
32
|
+
"TableEvent",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
T = TypeVar("T")
|
|
36
|
+
E = TypeVar("E", bound="Event")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class Event:
|
|
41
|
+
"""A frontend event delivered to a Python callback.
|
|
42
|
+
|
|
43
|
+
``payload`` is the validated JSON payload; typed subclasses expose it as
|
|
44
|
+
attributes. ``window`` is the logical window the event came from.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
name: str
|
|
48
|
+
sender: Component
|
|
49
|
+
payload: dict[str, Any] = field(default_factory=dict[str, Any])
|
|
50
|
+
window: WindowSession | None = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass
|
|
54
|
+
class ChangeEvent(Event, Generic[T]):
|
|
55
|
+
"""A committed value change of an input (``value`` is already stored)."""
|
|
56
|
+
|
|
57
|
+
value: T | None = None
|
|
58
|
+
previous: T | None = None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass
|
|
62
|
+
class SubmitEvent(Event):
|
|
63
|
+
"""Form submission: ``values`` is the validated snapshot keyed by field name."""
|
|
64
|
+
|
|
65
|
+
values: dict[str, Any] = field(default_factory=dict[str, Any])
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass
|
|
69
|
+
class TableEvent(Event):
|
|
70
|
+
"""DataTable selection/sort/cell events: ``keys`` are row keys."""
|
|
71
|
+
|
|
72
|
+
keys: list[Any] = field(default_factory=list[Any])
|
|
73
|
+
column: str | None = None
|
|
74
|
+
value: Any = None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass
|
|
78
|
+
class EnvironmentEvent(Event):
|
|
79
|
+
"""The page reported its environment (``environment_change``).
|
|
80
|
+
|
|
81
|
+
``environment`` is the new snapshot (also ``Window.environment``);
|
|
82
|
+
``changed`` names the fields that differ from the previous report (all
|
|
83
|
+
fields on the first report of a page load).
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
environment: Environment | None = None
|
|
87
|
+
changed: frozenset[str] = frozenset()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@dataclass
|
|
91
|
+
class IdleEvent(Event):
|
|
92
|
+
"""``idle_change``: ``idle`` is True after the idle timeout without user
|
|
93
|
+
input, False on the next input (see ``Window.set_idle_timeout``)."""
|
|
94
|
+
|
|
95
|
+
idle: bool = False
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclass
|
|
99
|
+
class RowActionEvent(Event):
|
|
100
|
+
action: str = ""
|
|
101
|
+
key: Any = None
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass
|
|
105
|
+
class ScheduleRangeEvent(Event):
|
|
106
|
+
"""``range_change`` of a schedule view: the user navigated (date or view).
|
|
107
|
+
|
|
108
|
+
``start``..``end`` is the visible range (inclusive dates) computed in
|
|
109
|
+
Python from ``date``, ``view`` and the week settings; a provider set
|
|
110
|
+
with ``set_provider`` has already been asked for it.
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
date: _dt.date | None = None
|
|
114
|
+
view: str | None = None
|
|
115
|
+
start: _dt.date | None = None
|
|
116
|
+
end: _dt.date | None = None
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
@dataclass
|
|
120
|
+
class ScheduleEventChange(Event):
|
|
121
|
+
"""``event_click``/``event_drop``/``event_resize`` of a schedule view.
|
|
122
|
+
|
|
123
|
+
``event`` is the Python event it refers to (``None`` if Python no longer
|
|
124
|
+
has it); ``start``/``end``/``resource_id`` are the proposed placement
|
|
125
|
+
(the current one for clicks). Nothing changes until Python accepts:
|
|
126
|
+
call :meth:`accept` (or assign ``events``) to apply the move/resize.
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
event: ScheduleEvent | None = None
|
|
130
|
+
event_id: str | int | None = None
|
|
131
|
+
start: _dt.datetime | _dt.date | None = None
|
|
132
|
+
end: _dt.datetime | _dt.date | None = None
|
|
133
|
+
resource_id: str | int | None = None
|
|
134
|
+
|
|
135
|
+
def accept(self) -> ScheduleEvent | None:
|
|
136
|
+
"""Apply the proposed placement to the sender's events; returns the new event."""
|
|
137
|
+
apply = getattr(self.sender, "apply_change", None)
|
|
138
|
+
return cast("ScheduleEvent | None", apply(self)) if callable(apply) else None
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@dataclass
|
|
142
|
+
class ScheduleSlotEvent(Event):
|
|
143
|
+
"""``slot_click``/``slot_select``/``day_click`` of a schedule view: an
|
|
144
|
+
empty time range (or day, ``all_day=True``) the user picked."""
|
|
145
|
+
|
|
146
|
+
start: _dt.datetime | _dt.date | None = None
|
|
147
|
+
end: _dt.datetime | _dt.date | None = None
|
|
148
|
+
resource_id: str | int | None = None
|
|
149
|
+
all_day: bool = False
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@dataclass
|
|
153
|
+
class DropEvent(Event):
|
|
154
|
+
"""``drop`` of a Dropzone: validated ``files`` and all ``rejected`` ones."""
|
|
155
|
+
|
|
156
|
+
files: list[DroppedFile] = field(default_factory=list["DroppedFile"])
|
|
157
|
+
rejected: list[RejectedFile] = field(default_factory=list["RejectedFile"])
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@dataclass
|
|
161
|
+
class EmojiEvent(Event):
|
|
162
|
+
"""``select`` of an emoji picker: bundled emoji ``id``, the picked
|
|
163
|
+
character ``emoji`` (skin tone applied) and its ``emoji_name``."""
|
|
164
|
+
|
|
165
|
+
id: str = ""
|
|
166
|
+
emoji: str = ""
|
|
167
|
+
emoji_name: str = ""
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@dataclass
|
|
171
|
+
class SpotlightActionEvent(Event):
|
|
172
|
+
"""``action`` of a Spotlight: the triggered ``action`` id and its data."""
|
|
173
|
+
|
|
174
|
+
action: str = ""
|
|
175
|
+
item: dict[str, Any] = field(default_factory=dict[str, Any])
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@dataclass
|
|
179
|
+
class ReorderEvent(Event):
|
|
180
|
+
"""``reorder`` of a DragDropList: the new key ``order`` (already stored
|
|
181
|
+
in ``items``), the moved ``key`` and its ``from_index``/``to_index``."""
|
|
182
|
+
|
|
183
|
+
order: list[str] = field(default_factory=list[str])
|
|
184
|
+
previous: list[str] = field(default_factory=list[str])
|
|
185
|
+
key: str = ""
|
|
186
|
+
from_index: int = 0
|
|
187
|
+
to_index: int = 0
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
Handler: TypeAlias = Callable[[], Awaitable[Any] | Any] | Callable[[E], Awaitable[Any] | Any]
|
|
191
|
+
AnyHandler: TypeAlias = Callable[..., Any]
|
|
192
|
+
EventFactory: TypeAlias = Callable[[str, "Component", Mapping[str, Any]], Event]
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
"""``ui.FilterPanel``: one panel of typed filters that emits one snapshot.
|
|
2
|
+
|
|
3
|
+
The panel is composed of existing typed inputs (SearchInput, Select,
|
|
4
|
+
MultiSelect, ChipGroup/Chip, TextInput for ISO dates, Button, Collapse inside
|
|
5
|
+
a Paper); it adds no renderer adapter, page command or payload. Every value
|
|
6
|
+
still commits through the inputs' own validated ``change`` events; the panel
|
|
7
|
+
recomputes its snapshot in Python and dispatches ``change`` to its handlers
|
|
8
|
+
only when the snapshot differs. The page cannot send a ``change`` for the
|
|
9
|
+
panel itself.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import datetime as _dt
|
|
15
|
+
import re
|
|
16
|
+
from collections.abc import Iterable, Mapping, Sequence
|
|
17
|
+
from dataclasses import dataclass, field
|
|
18
|
+
from typing import Any, ClassVar, Literal, cast
|
|
19
|
+
|
|
20
|
+
from ..errors import ValidationError
|
|
21
|
+
from ..types import UNSET, Unset
|
|
22
|
+
from ._component import TREE_LOCK, EventSpec, _option # pyright: ignore[reportPrivateUsage]
|
|
23
|
+
from ._events import Event, Handler
|
|
24
|
+
from .components import (
|
|
25
|
+
Button,
|
|
26
|
+
Chip,
|
|
27
|
+
ChipGroup,
|
|
28
|
+
Collapse,
|
|
29
|
+
Group,
|
|
30
|
+
MultiSelect,
|
|
31
|
+
Paper,
|
|
32
|
+
SearchInput,
|
|
33
|
+
Select,
|
|
34
|
+
Stack,
|
|
35
|
+
TextInput,
|
|
36
|
+
)
|
|
37
|
+
from .components._types import Option
|
|
38
|
+
|
|
39
|
+
__all__ = ["DateRange", "Filter", "FilterEvent", "FilterKind", "FilterPanel"]
|
|
40
|
+
|
|
41
|
+
FilterKind = Literal["search", "select", "multiselect", "chips", "date_range"]
|
|
42
|
+
_KINDS: tuple[str, ...] = ("search", "select", "multiselect", "chips", "date_range")
|
|
43
|
+
_KEY_RE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]{0,63}$")
|
|
44
|
+
_MAX_FILTERS = 32
|
|
45
|
+
_MAX_OPTIONS = 500
|
|
46
|
+
_MAX_TEXT = 200
|
|
47
|
+
_MAX_SEARCH = 500
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(frozen=True)
|
|
51
|
+
class DateRange:
|
|
52
|
+
"""An inclusive date range; either end may be open (``None``)."""
|
|
53
|
+
|
|
54
|
+
start: _dt.date | None = None
|
|
55
|
+
end: _dt.date | None = None
|
|
56
|
+
|
|
57
|
+
def __contains__(self, day: object) -> bool:
|
|
58
|
+
d = _as_date(day)
|
|
59
|
+
if d is None:
|
|
60
|
+
return False
|
|
61
|
+
return (self.start is None or d >= self.start) and (self.end is None or d <= self.end)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class Filter:
|
|
66
|
+
"""One filter of a ``FilterPanel``.
|
|
67
|
+
|
|
68
|
+
``kind`` decides the input and the snapshot type: ``search`` -> ``str``,
|
|
69
|
+
``select`` -> ``str``, ``multiselect`` / ``chips`` -> ``list[str]``,
|
|
70
|
+
``date_range`` -> ``DateRange``. ``fields`` lists the row keys a search
|
|
71
|
+
looks in (all string values when empty); ``advanced`` filters sit in a
|
|
72
|
+
collapsible "More filters" section.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
key: str
|
|
76
|
+
label: str | None = None
|
|
77
|
+
kind: FilterKind = "search"
|
|
78
|
+
options: Sequence[str | Mapping[str, Any]] = ()
|
|
79
|
+
placeholder: str | None = None
|
|
80
|
+
advanced: bool = False
|
|
81
|
+
fields: Sequence[str] = ()
|
|
82
|
+
|
|
83
|
+
def __post_init__(self) -> None:
|
|
84
|
+
where = f"Filter({self.key!r})"
|
|
85
|
+
if not isinstance(self.key, str) or not _KEY_RE.fullmatch(self.key): # pyright: ignore[reportUnnecessaryIsInstance]
|
|
86
|
+
raise ValidationError(f"{where}: key must match {_KEY_RE.pattern}")
|
|
87
|
+
if self.kind not in _KINDS:
|
|
88
|
+
raise ValidationError(f"{where}: kind must be one of {list(_KINDS)}")
|
|
89
|
+
for name in ("label", "placeholder"):
|
|
90
|
+
v = getattr(self, name)
|
|
91
|
+
if v is not None and (not isinstance(v, str) or len(v) > _MAX_TEXT):
|
|
92
|
+
raise ValidationError(f"{where}: {name} must be a string <= {_MAX_TEXT} chars")
|
|
93
|
+
opts_in: Any = self.options
|
|
94
|
+
if isinstance(opts_in, (str, bytes)) or not isinstance(opts_in, Sequence):
|
|
95
|
+
raise ValidationError(f"{where}: options must be a list")
|
|
96
|
+
opts = [_option(o, f"{where}.options") for o in self.options]
|
|
97
|
+
if len(opts) > _MAX_OPTIONS:
|
|
98
|
+
raise ValidationError(f"{where}: at most {_MAX_OPTIONS} options")
|
|
99
|
+
if len({o["value"] for o in opts}) != len(opts):
|
|
100
|
+
raise ValidationError(f"{where}: duplicate option values")
|
|
101
|
+
needs = self.kind in ("select", "multiselect", "chips")
|
|
102
|
+
if needs and not opts:
|
|
103
|
+
raise ValidationError(f"{where}: a {self.kind} filter needs options")
|
|
104
|
+
if not needs and opts:
|
|
105
|
+
raise ValidationError(f"{where}: a {self.kind} filter takes no options")
|
|
106
|
+
object.__setattr__(self, "options", tuple(opts))
|
|
107
|
+
fields_in: Any = self.fields
|
|
108
|
+
if isinstance(fields_in, str) or not all(
|
|
109
|
+
isinstance(f, str) and _KEY_RE.fullmatch(f) for f in cast("Iterable[Any]", fields_in)
|
|
110
|
+
):
|
|
111
|
+
raise ValidationError(f"{where}: fields must be a list of row keys")
|
|
112
|
+
if self.fields and self.kind != "search":
|
|
113
|
+
raise ValidationError(f"{where}: fields applies to search filters only")
|
|
114
|
+
object.__setattr__(self, "fields", tuple(self.fields))
|
|
115
|
+
if not isinstance(self.advanced, bool): # pyright: ignore[reportUnnecessaryIsInstance]
|
|
116
|
+
raise ValidationError(f"{where}: advanced must be a boolean")
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def option_values(self) -> tuple[str, ...]:
|
|
120
|
+
return tuple(cast("Mapping[str, str]", o)["value"] for o in self.options)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass
|
|
124
|
+
class FilterEvent(Event):
|
|
125
|
+
"""The panel's typed snapshot changed (``values`` holds active filters only)."""
|
|
126
|
+
|
|
127
|
+
values: dict[str, Any] = field(default_factory=dict[str, Any])
|
|
128
|
+
previous: dict[str, Any] = field(default_factory=dict[str, Any])
|
|
129
|
+
changed: tuple[str, ...] = ()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _as_date(v: object) -> _dt.date | None:
|
|
133
|
+
if isinstance(v, _dt.datetime):
|
|
134
|
+
return v.date()
|
|
135
|
+
if isinstance(v, _dt.date):
|
|
136
|
+
return v
|
|
137
|
+
if isinstance(v, str) and v:
|
|
138
|
+
try:
|
|
139
|
+
return _dt.date.fromisoformat(v[:10])
|
|
140
|
+
except ValueError:
|
|
141
|
+
return None
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _parse_day(text: Any) -> tuple[_dt.date | None, str | None]:
|
|
146
|
+
"""(date, error) of one date box; empty is an open end."""
|
|
147
|
+
if text is None or text is UNSET or (isinstance(text, str) and not text.strip()):
|
|
148
|
+
return None, None
|
|
149
|
+
if isinstance(text, str):
|
|
150
|
+
try:
|
|
151
|
+
return _dt.date.fromisoformat(text.strip()), None
|
|
152
|
+
except ValueError:
|
|
153
|
+
pass
|
|
154
|
+
return None, "Use YYYY-MM-DD"
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class FilterPanel(Paper):
|
|
158
|
+
"""Reusable panel of search, select, chip and date-range filters.
|
|
159
|
+
|
|
160
|
+
Emits one typed snapshot through ``on_change`` (``FilterEvent.values``)
|
|
161
|
+
whenever any filter changes; ``values`` reads it, ``set_values`` and
|
|
162
|
+
``clear_filters`` change it from Python, and ``matches(row)`` applies it to a
|
|
163
|
+
mapping (handy for static tables)::
|
|
164
|
+
|
|
165
|
+
panel = ui.FilterPanel(
|
|
166
|
+
[
|
|
167
|
+
ui.Filter("q", "Search", fields=["name", "email"]),
|
|
168
|
+
ui.Filter("role", "Role", kind="select", options=["admin", "user"]),
|
|
169
|
+
ui.Filter("tags", "Tags", kind="chips", options=["new", "vip"]),
|
|
170
|
+
ui.Filter("joined", "Joined", kind="date_range", advanced=True),
|
|
171
|
+
],
|
|
172
|
+
on_change=lambda e: table.update(data=[r for r in rows if panel.matches(r)]),
|
|
173
|
+
)
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
EVENTS: ClassVar[Mapping[str, EventSpec]] = {"change": EventSpec("change", "FilterEvent")}
|
|
177
|
+
|
|
178
|
+
def __init__(
|
|
179
|
+
self,
|
|
180
|
+
filters: Iterable[Filter | Mapping[str, Any]],
|
|
181
|
+
*,
|
|
182
|
+
value: Mapping[str, Any] | None = None,
|
|
183
|
+
on_change: Handler[FilterEvent] | None = None,
|
|
184
|
+
clear_label: str = "Clear filters",
|
|
185
|
+
more_label: str = "More filters",
|
|
186
|
+
expanded: bool = False,
|
|
187
|
+
with_border: bool | Unset = True,
|
|
188
|
+
p: str | float | Unset = "sm",
|
|
189
|
+
radius: str | float | Unset = UNSET,
|
|
190
|
+
shadow: str | Unset = UNSET,
|
|
191
|
+
visible: bool | Unset = UNSET,
|
|
192
|
+
classes: str | Sequence[str] | Unset = UNSET,
|
|
193
|
+
styles: Mapping[str, str | int | float] | Unset = UNSET,
|
|
194
|
+
aria_label: str | Unset = "Filters",
|
|
195
|
+
) -> None:
|
|
196
|
+
specs = [f if isinstance(f, Filter) else Filter(**dict(f)) for f in filters]
|
|
197
|
+
if not specs:
|
|
198
|
+
raise ValidationError("FilterPanel: at least one filter")
|
|
199
|
+
if len(specs) > _MAX_FILTERS:
|
|
200
|
+
raise ValidationError(f"FilterPanel: at most {_MAX_FILTERS} filters")
|
|
201
|
+
if len({f.key for f in specs}) != len(specs):
|
|
202
|
+
raise ValidationError("FilterPanel: duplicate filter keys")
|
|
203
|
+
super().__init__(
|
|
204
|
+
with_border=with_border,
|
|
205
|
+
p=p,
|
|
206
|
+
radius=radius,
|
|
207
|
+
shadow=shadow,
|
|
208
|
+
component="section",
|
|
209
|
+
visible=visible,
|
|
210
|
+
classes=classes,
|
|
211
|
+
styles=styles,
|
|
212
|
+
aria_label=aria_label,
|
|
213
|
+
)
|
|
214
|
+
self.filters: tuple[Filter, ...] = tuple(specs)
|
|
215
|
+
self._inputs: dict[str, Any] = {}
|
|
216
|
+
self._last: dict[str, Any] = {}
|
|
217
|
+
self.collapse: Collapse | None = None
|
|
218
|
+
self.more_button: Button | None = None
|
|
219
|
+
basic = [f for f in specs if not f.advanced]
|
|
220
|
+
advanced = [f for f in specs if f.advanced]
|
|
221
|
+
with self, Stack(gap="xs"):
|
|
222
|
+
with Group(gap="sm", align="flex-end", wrap="wrap"):
|
|
223
|
+
for f in basic:
|
|
224
|
+
self._build(f)
|
|
225
|
+
if advanced:
|
|
226
|
+
col = Collapse(expanded=expanded)
|
|
227
|
+
with col, Group(gap="sm", align="flex-end"):
|
|
228
|
+
for f in advanced:
|
|
229
|
+
self._build(f)
|
|
230
|
+
self.collapse = col
|
|
231
|
+
with Group(gap="xs", justify="flex-end"):
|
|
232
|
+
if advanced:
|
|
233
|
+
self.more_button = Button(
|
|
234
|
+
more_label, variant="subtle", size="xs", on_click=self._toggle
|
|
235
|
+
)
|
|
236
|
+
self.clear_button = Button(
|
|
237
|
+
clear_label, variant="default", size="xs", on_click=self.clear_filters
|
|
238
|
+
)
|
|
239
|
+
if on_change is not None:
|
|
240
|
+
self.on("change", on_change)
|
|
241
|
+
if value:
|
|
242
|
+
self.set_values(value, notify=False)
|
|
243
|
+
self._last = self.values
|
|
244
|
+
|
|
245
|
+
# ------------------------------------------------------------ building
|
|
246
|
+
def _build(self, f: Filter) -> None:
|
|
247
|
+
label = f.label if f.label is not None else f.key
|
|
248
|
+
ph = f.placeholder if f.placeholder is not None else UNSET
|
|
249
|
+
if f.kind == "search":
|
|
250
|
+
self._inputs[f.key] = SearchInput(
|
|
251
|
+
label=label,
|
|
252
|
+
placeholder=ph,
|
|
253
|
+
clearable=True,
|
|
254
|
+
debounce=250,
|
|
255
|
+
on_change=self._changed,
|
|
256
|
+
)
|
|
257
|
+
elif f.kind == "select":
|
|
258
|
+
self._inputs[f.key] = Select(
|
|
259
|
+
label=label,
|
|
260
|
+
placeholder=ph,
|
|
261
|
+
data=cast("list[Option]", list(f.options)),
|
|
262
|
+
clearable=True,
|
|
263
|
+
on_change=self._changed,
|
|
264
|
+
)
|
|
265
|
+
elif f.kind == "multiselect":
|
|
266
|
+
self._inputs[f.key] = MultiSelect(
|
|
267
|
+
label=label,
|
|
268
|
+
placeholder=ph,
|
|
269
|
+
data=cast("list[Option]", list(f.options)),
|
|
270
|
+
clearable=True,
|
|
271
|
+
on_change=self._changed,
|
|
272
|
+
)
|
|
273
|
+
elif f.kind == "chips":
|
|
274
|
+
with Stack(gap=4, aria_label=label):
|
|
275
|
+
with ChipGroup(multiple=True, value=[], on_change=self._changed) as grp:
|
|
276
|
+
with Group(gap=4):
|
|
277
|
+
for o in f.options:
|
|
278
|
+
o = cast("Mapping[str, str]", o)
|
|
279
|
+
Chip(o["label"], value=o["value"], size="sm")
|
|
280
|
+
self._inputs[f.key] = grp
|
|
281
|
+
else:
|
|
282
|
+
start = TextInput(
|
|
283
|
+
label=f"{label} from", placeholder="YYYY-MM-DD", max_length=10,
|
|
284
|
+
on_change=self._changed,
|
|
285
|
+
) # fmt: skip
|
|
286
|
+
end = TextInput(
|
|
287
|
+
label=f"{label} to", placeholder="YYYY-MM-DD", max_length=10,
|
|
288
|
+
on_change=self._changed,
|
|
289
|
+
) # fmt: skip
|
|
290
|
+
self._inputs[f.key] = (start, end)
|
|
291
|
+
|
|
292
|
+
def input(self, key: str) -> Any:
|
|
293
|
+
"""The input component(s) of filter ``key`` (a pair for date ranges)."""
|
|
294
|
+
try:
|
|
295
|
+
return self._inputs[key]
|
|
296
|
+
except KeyError:
|
|
297
|
+
raise ValidationError(f"FilterPanel has no filter {key!r}") from None
|
|
298
|
+
|
|
299
|
+
# ------------------------------------------------------------ snapshot
|
|
300
|
+
@property
|
|
301
|
+
def values(self) -> dict[str, Any]:
|
|
302
|
+
"""Typed snapshot of the active filters (empty filters are left out)."""
|
|
303
|
+
out: dict[str, Any] = {}
|
|
304
|
+
with TREE_LOCK:
|
|
305
|
+
for f in self.filters:
|
|
306
|
+
comp = self._inputs[f.key]
|
|
307
|
+
if f.kind == "date_range":
|
|
308
|
+
a, b = comp
|
|
309
|
+
s, ea = _parse_day(a.value)
|
|
310
|
+
e, eb = _parse_day(b.value)
|
|
311
|
+
if ea is None and eb is None and s and e and s > e:
|
|
312
|
+
eb = "Must not be before the start"
|
|
313
|
+
a.update(error=ea or "")
|
|
314
|
+
b.update(error=eb or "")
|
|
315
|
+
if ea is None and eb is None and (s or e):
|
|
316
|
+
out[f.key] = DateRange(s, e)
|
|
317
|
+
continue
|
|
318
|
+
v = comp.value
|
|
319
|
+
if f.kind == "search":
|
|
320
|
+
if isinstance(v, str) and v.strip():
|
|
321
|
+
out[f.key] = v.strip()[:_MAX_SEARCH]
|
|
322
|
+
elif f.kind == "select":
|
|
323
|
+
if isinstance(v, str) and v in f.option_values:
|
|
324
|
+
out[f.key] = v
|
|
325
|
+
elif isinstance(v, list):
|
|
326
|
+
allowed = f.option_values
|
|
327
|
+
picked = [x for x in cast("list[Any]", v) if x in allowed]
|
|
328
|
+
if picked:
|
|
329
|
+
out[f.key] = picked
|
|
330
|
+
return out
|
|
331
|
+
|
|
332
|
+
def set_values(self, values: Mapping[str, Any], *, notify: bool = True) -> None:
|
|
333
|
+
"""Set filters from Python (unknown keys and bad values are rejected)."""
|
|
334
|
+
for key in values:
|
|
335
|
+
self.input(key)
|
|
336
|
+
specs = {f.key: f for f in self.filters}
|
|
337
|
+
with TREE_LOCK:
|
|
338
|
+
for key, v in values.items():
|
|
339
|
+
f, comp = specs[key], self._inputs[key]
|
|
340
|
+
where = f"FilterPanel.{key}"
|
|
341
|
+
if f.kind == "date_range":
|
|
342
|
+
rng = v if isinstance(v, DateRange) else DateRange(*(v or (None, None)))
|
|
343
|
+
for box, d in zip(comp, (rng.start, rng.end), strict=True):
|
|
344
|
+
if d is not None and _as_date(d) is None:
|
|
345
|
+
raise ValidationError(f"{where}: expected dates")
|
|
346
|
+
box.value = _as_date(d).isoformat() if d is not None else "" # pyright: ignore[reportOptionalMemberAccess]
|
|
347
|
+
elif f.kind == "search":
|
|
348
|
+
if v is not None and not isinstance(v, str):
|
|
349
|
+
raise ValidationError(f"{where}: expected a string")
|
|
350
|
+
comp.value = v or ""
|
|
351
|
+
elif f.kind == "select":
|
|
352
|
+
if v is not None and v not in f.option_values:
|
|
353
|
+
raise ValidationError(f"{where}: not one of the options")
|
|
354
|
+
comp.value = v
|
|
355
|
+
else:
|
|
356
|
+
seq = list(v or [])
|
|
357
|
+
if any(x not in f.option_values for x in seq):
|
|
358
|
+
raise ValidationError(f"{where}: not one of the options")
|
|
359
|
+
comp.value = seq
|
|
360
|
+
if notify:
|
|
361
|
+
self._refresh()
|
|
362
|
+
else:
|
|
363
|
+
self._last = self.values
|
|
364
|
+
|
|
365
|
+
def clear_filters(self) -> None:
|
|
366
|
+
"""Empty every filter (dispatches ``change`` if anything was set)."""
|
|
367
|
+
empty: dict[str, Any] = {}
|
|
368
|
+
for f in self.filters:
|
|
369
|
+
empty[f.key] = None if f.kind in ("search", "select", "date_range") else []
|
|
370
|
+
self.set_values(empty)
|
|
371
|
+
|
|
372
|
+
def matches(self, row: Mapping[str, Any], values: Mapping[str, Any] | None = None) -> bool:
|
|
373
|
+
"""Whether ``row`` passes the snapshot (``values`` defaults to the current one)."""
|
|
374
|
+
snap = self.values if values is None else values
|
|
375
|
+
specs = {f.key: f for f in self.filters}
|
|
376
|
+
for key, want in snap.items():
|
|
377
|
+
f = specs.get(key)
|
|
378
|
+
if f is None:
|
|
379
|
+
continue
|
|
380
|
+
if f.kind == "search":
|
|
381
|
+
keys = f.fields or tuple(row)
|
|
382
|
+
hay = " ".join(str(row.get(k, "")) for k in keys).casefold()
|
|
383
|
+
if str(want).casefold() not in hay:
|
|
384
|
+
return False
|
|
385
|
+
elif f.kind == "select":
|
|
386
|
+
if row.get(key) != want:
|
|
387
|
+
return False
|
|
388
|
+
elif f.kind in ("multiselect", "chips"):
|
|
389
|
+
got = row.get(key)
|
|
390
|
+
got_set = (
|
|
391
|
+
set(cast("Iterable[Any]", got))
|
|
392
|
+
if isinstance(got, (list, tuple, set))
|
|
393
|
+
else {got}
|
|
394
|
+
)
|
|
395
|
+
if not got_set & set(want):
|
|
396
|
+
return False
|
|
397
|
+
elif row.get(key) not in want:
|
|
398
|
+
return False
|
|
399
|
+
return True
|
|
400
|
+
|
|
401
|
+
# ------------------------------------------------------------- events
|
|
402
|
+
def _toggle(self) -> None:
|
|
403
|
+
if self.collapse is not None:
|
|
404
|
+
self.collapse.expanded = not self.collapse.expanded
|
|
405
|
+
|
|
406
|
+
async def _changed(self) -> None:
|
|
407
|
+
self._refresh()
|
|
408
|
+
|
|
409
|
+
def _refresh(self) -> None:
|
|
410
|
+
now = self.values
|
|
411
|
+
with TREE_LOCK:
|
|
412
|
+
prev, self._last = self._last, now
|
|
413
|
+
w = self._window
|
|
414
|
+
if now == prev:
|
|
415
|
+
return
|
|
416
|
+
keys = tuple(sorted(k for k in now.keys() | prev.keys() if now.get(k) != prev.get(k)))
|
|
417
|
+
ev = FilterEvent(
|
|
418
|
+
name="change", sender=self, values=now, previous=prev, changed=keys, window=w
|
|
419
|
+
)
|
|
420
|
+
if w is not None and w.live:
|
|
421
|
+
w.dispatch(self, ev)
|
|
422
|
+
|
|
423
|
+
def wire_events(self) -> list[str]:
|
|
424
|
+
return [] # ``change`` comes from Python, never from the page
|
|
425
|
+
|
|
426
|
+
def _on_client_event(self, name: str, payload: Mapping[str, Any]) -> Any:
|
|
427
|
+
raise ValidationError(f"FilterPanel.{name}: not a page event")
|