@mono-lit/helper 0.0.0-stage → 0.0.2
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.
- package/LICENSE.md +55 -0
- package/README.md +35 -3
- package/dist/breakpoints-CAbhDUht.js +84 -0
- package/dist/checkbox-Cqpie9Ap.js +4 -0
- package/dist/chip-DBUUa2eB.js +4 -0
- package/dist/chip-limits-BMoO31JM.js +213 -0
- package/dist/chip-strip-Cw3gyz0q.js +213 -0
- package/dist/color-DHYrfXsX.js +253 -0
- package/dist/css-class-BRKRzHx-.js +60 -0
- package/dist/css-size-DhHSVZJK.js +37 -0
- package/dist/data/theme/presets.json.d.ts +140 -0
- package/dist/data-source-controller-B_rgHCjw.js +241 -0
- package/dist/data-source-controller-Dbb4fd8I.js +241 -0
- package/dist/data-source-options-CP-X62Pa.js +535 -0
- package/dist/data-source-options-Jqj7LU3Z.js +537 -0
- package/dist/data-source-read-B4DGp6UQ.js +216 -0
- package/dist/data-source-read-DL88aH8t.js +217 -0
- package/dist/decorate-DEXtNagw.js +141 -0
- package/dist/element-props-CLB6yvbm.js +114 -0
- package/dist/esm-Ptok4SQZ.js +2026 -0
- package/dist/excel-CY6zGkcx.js +608 -0
- package/dist/excel-DopRbEMK.js +608 -0
- package/dist/export-BiGVyxt6.js +2302 -0
- package/dist/export.d.ts +1 -0
- package/dist/export.js +2302 -0
- package/dist/field-icons-DELrSdqJ.js +86 -0
- package/dist/field-path-C92eGLg3.js +251 -0
- package/dist/filter-builder-Bke3qOgJ.js +205 -0
- package/dist/filter-builder-CE4zE0V5.js +205 -0
- package/dist/filter-eval-DIfU2EAn.js +173 -0
- package/dist/filter-odata-C1vSGZaY.js +591 -0
- package/dist/form-control-core-B8d7k6vk.js +223 -0
- package/dist/form-control-core-eeRr0zLU.js +223 -0
- package/dist/hydration-flush-RB5Tz5nl.js +1001 -0
- package/dist/icon-CJkTlmTb.js +55 -0
- package/dist/icon-dVhYJUIH.js +17 -0
- package/dist/import-BgJdkwBI.js +606 -0
- package/dist/import.d.ts +1 -0
- package/dist/import.js +606 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -0
- package/dist/index.node-BIqEGehH.js +396 -0
- package/dist/index.node.d.ts +1 -0
- package/dist/index.node.js +16 -0
- package/dist/input-zGOULADt.js +4 -0
- package/dist/layout-var-CZnzMC0s.js +73 -0
- package/dist/light-slots-BVJwyg_2.js +244 -0
- package/dist/light-slots-DW1WgfgT.js +254 -0
- package/dist/markdown-DfqrfOJN.js +20146 -0
- package/dist/mono-button-simcTQdW.js +873 -0
- package/dist/mono-button.shadow-B_rKOY9N.js +784 -0
- package/dist/mono-data-chart-CEv29_NS.js +779 -0
- package/dist/mono-data-dropdown-Wnoke6zO.js +357 -0
- package/dist/mono-data-grid-CjkEqxgE.js +3913 -0
- package/dist/mono-data-grid-YjR3n9Ar.js +3915 -0
- package/dist/mono-element-B0kP_96P.js +232 -0
- package/dist/mono-event-Bi1qP9uN.js +129 -0
- package/dist/mono-form-controller-5PfsU4qa.js +409 -0
- package/dist/mono-modal-controller-BMO3n3rP.js +223 -0
- package/dist/mono-ui-CPV7rrdo.js +358 -0
- package/dist/normalize-error-Gcgmgh5i.js +871 -0
- package/dist/notifier-CE4yxMUQ.js +88 -0
- package/dist/nuxt.d.ts +1 -0
- package/dist/nuxt.js +130 -0
- package/dist/popup-portal-BziRX1yG.js +465 -0
- package/dist/popup-stack-CEEMib__.js +189 -0
- package/dist/rate-limit-BBa2PO79.js +521 -0
- package/dist/reactive-D3EERqgO.js +47 -0
- package/dist/reactive-Di3mTMnV.js +1087 -0
- package/dist/search.d.ts +1 -0
- package/dist/search.js +97 -0
- package/dist/src/components/accordion/accordion-core.d.ts +62 -0
- package/dist/src/components/accordion/accordion-types.d.ts +62 -0
- package/dist/src/components/accordion/index.d.ts +3 -0
- package/dist/src/components/accordion/index.shadow.d.ts +5 -0
- package/dist/src/components/accordion/mono-accordion.d.ts +55 -0
- package/dist/src/components/accordion/mono-accordion.shadow.d.ts +56 -0
- package/dist/src/components/alert/alert-core.d.ts +46 -0
- package/dist/src/components/alert/alert-types.d.ts +44 -0
- package/dist/src/components/alert/index.d.ts +3 -0
- package/dist/src/components/alert/index.shadow.d.ts +5 -0
- package/dist/src/components/alert/mono-alert.d.ts +44 -0
- package/dist/src/components/alert/mono-alert.shadow.d.ts +34 -0
- package/dist/src/components/breadcrumb/breadcrumb-core.d.ts +61 -0
- package/dist/src/components/breadcrumb/breadcrumb-list-core.d.ts +49 -0
- package/dist/src/components/breadcrumb/breadcrumb-render.d.ts +31 -0
- package/dist/src/components/breadcrumb/breadcrumb-types.d.ts +117 -0
- package/dist/src/components/breadcrumb/breadcrumb-utils.d.ts +43 -0
- package/dist/src/components/breadcrumb/index.d.ts +6 -0
- package/dist/src/components/breadcrumb/index.shadow.d.ts +8 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb-list.d.ts +29 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb-list.shadow.d.ts +48 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb.d.ts +38 -0
- package/dist/src/components/breadcrumb/mono-breadcrumb.shadow.d.ts +73 -0
- package/dist/src/components/button/button-core.d.ts +90 -0
- package/dist/src/components/button/button-dropdown-core.d.ts +57 -0
- package/dist/src/components/button/button-dropdown-types.d.ts +129 -0
- package/dist/src/components/button/button-types.d.ts +219 -0
- package/dist/src/components/button/button-utils.d.ts +18 -0
- package/dist/src/components/button/index.button-dropdown.d.ts +4 -0
- package/dist/src/components/button/index.button-dropdown.shadow.d.ts +4 -0
- package/dist/src/components/button/index.d.ts +8 -0
- package/dist/src/components/button/index.shadow.d.ts +5 -0
- package/dist/src/components/button/mono-button-dropdown.d.ts +35 -0
- package/dist/src/components/button/mono-button-dropdown.shadow.d.ts +45 -0
- package/dist/src/components/button/mono-button.d.ts +123 -0
- package/dist/src/components/button/mono-button.shadow.d.ts +56 -0
- package/dist/src/components/card/card-core.d.ts +75 -0
- package/dist/src/components/card/card-types.d.ts +137 -0
- package/dist/src/components/card/card-utils.d.ts +23 -0
- package/dist/src/components/card/index.d.ts +4 -0
- package/dist/src/components/card/index.shadow.d.ts +6 -0
- package/dist/src/components/card/mono-card.d.ts +56 -0
- package/dist/src/components/card/mono-card.shadow.d.ts +52 -0
- package/dist/src/components/chart/chart-core.d.ts +43 -0
- package/dist/src/components/chart/chart-odata.d.ts +52 -0
- package/dist/src/components/chart/chart-types.d.ts +356 -0
- package/dist/src/components/chart/index.d.ts +8 -0
- package/dist/src/components/chart/index.shadow.d.ts +7 -0
- package/dist/src/components/chart/mono-chart-presets.d.ts +43 -0
- package/dist/src/components/chart/mono-chart-presets.shadow.d.ts +43 -0
- package/dist/src/components/chart/mono-chart.d.ts +30 -0
- package/dist/src/components/chart/mono-chart.shadow.d.ts +22 -0
- package/dist/src/components/chart/mono-data-chart.d.ts +27 -0
- package/dist/src/components/checkbox/checkbox-core.d.ts +53 -0
- package/dist/src/components/checkbox/checkbox-types.d.ts +69 -0
- package/dist/src/components/checkbox/checkbox-utils.d.ts +35 -0
- package/dist/src/components/checkbox/index.d.ts +4 -0
- package/dist/src/components/checkbox/index.shadow.d.ts +5 -0
- package/dist/src/components/checkbox/mono-checkbox.d.ts +34 -0
- package/dist/src/components/checkbox/mono-checkbox.shadow.d.ts +45 -0
- package/dist/src/components/chip/chip-core.d.ts +58 -0
- package/dist/src/components/chip/chip-types.d.ts +142 -0
- package/dist/src/components/chip/chip-utils.d.ts +24 -0
- package/dist/src/components/chip/index.d.ts +8 -0
- package/dist/src/components/chip/index.shadow.d.ts +6 -0
- package/dist/src/components/chip/mono-chip.d.ts +48 -0
- package/dist/src/components/chip/mono-chip.shadow.d.ts +33 -0
- package/dist/src/components/chip/mono-status-dot.d.ts +34 -0
- package/dist/src/components/date/date-core.d.ts +80 -0
- package/dist/src/components/date/date-types.d.ts +163 -0
- package/dist/src/components/date/index.d.ts +3 -0
- package/dist/src/components/date/index.shadow.d.ts +4 -0
- package/dist/src/components/date/mono-date.d.ts +22 -0
- package/dist/src/components/date/mono-date.shadow.d.ts +31 -0
- package/dist/src/components/drawer/drawer-core.d.ts +99 -0
- package/dist/src/components/drawer/drawer-types.d.ts +153 -0
- package/dist/src/components/drawer/index.d.ts +3 -0
- package/dist/src/components/drawer/index.shadow.d.ts +4 -0
- package/dist/src/components/drawer/mono-drawer.d.ts +45 -0
- package/dist/src/components/drawer/mono-drawer.shadow.d.ts +46 -0
- package/dist/src/components/dropdown/dropdown-core.d.ts +33 -0
- package/dist/src/components/dropdown/dropdown-types.d.ts +88 -0
- package/dist/src/components/dropdown/index.d.ts +3 -0
- package/dist/src/components/dropdown/index.shadow.d.ts +4 -0
- package/dist/src/components/dropdown/mono-dropdown.d.ts +34 -0
- package/dist/src/components/dropdown/mono-dropdown.shadow.d.ts +28 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +65 -0
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +278 -0
- package/dist/src/components/dropdown-table/index.d.ts +5 -0
- package/dist/src/components/dropdown-table/index.shadow.d.ts +6 -0
- package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +152 -0
- package/dist/src/components/dropdown-table/mono-dropdown-table.d.ts +46 -0
- package/dist/src/components/dropdown-table/mono-dropdown-table.shadow.d.ts +22 -0
- package/dist/src/components/file-upload/file-upload-core.d.ts +60 -0
- package/dist/src/components/file-upload/file-upload-types.d.ts +145 -0
- package/dist/src/components/file-upload/file-upload-utils.d.ts +16 -0
- package/dist/src/components/file-upload/index.d.ts +4 -0
- package/dist/src/components/file-upload/index.shadow.d.ts +5 -0
- package/dist/src/components/file-upload/mono-file-upload.d.ts +33 -0
- package/dist/src/components/file-upload/mono-file-upload.shadow.d.ts +50 -0
- package/dist/src/components/filter/filter-builder-core.d.ts +36 -0
- package/dist/src/components/filter/filter-builder.d.ts +23 -0
- package/dist/src/components/filter/filter-odata.d.ts +27 -0
- package/dist/src/components/filter/filter-operators.d.ts +13 -0
- package/dist/src/components/filter/filter-types.d.ts +253 -0
- package/dist/src/components/filter/index.d.ts +6 -0
- package/dist/src/components/filter/index.shadow.d.ts +7 -0
- package/dist/src/components/filter/mono-filter-builder.d.ts +21 -0
- package/dist/src/components/filter/mono-filter-builder.shadow.d.ts +17 -0
- package/dist/src/components/form/form-control-core.d.ts +37 -0
- package/dist/src/components/form/form-rules.d.ts +25 -0
- package/dist/src/components/form/form-types.d.ts +307 -0
- package/dist/src/components/form/index.d.ts +6 -0
- package/dist/src/components/form/mono-form-controller.d.ts +16 -0
- package/dist/src/components/input/index.d.ts +6 -0
- package/dist/src/components/input/index.shadow.d.ts +8 -0
- package/dist/src/components/input/input-core.d.ts +91 -0
- package/dist/src/components/input/input-format.d.ts +118 -0
- package/dist/src/components/input/input-types.d.ts +179 -0
- package/dist/src/components/input/input-utils.d.ts +10 -0
- package/dist/src/components/input/mono-input.d.ts +46 -0
- package/dist/src/components/input/mono-input.shadow.d.ts +34 -0
- package/dist/src/components/menu/index.d.ts +6 -0
- package/dist/src/components/menu/index.shadow.d.ts +7 -0
- package/dist/src/components/menu/menu-core.d.ts +65 -0
- package/dist/src/components/menu/menu-render.d.ts +55 -0
- package/dist/src/components/menu/menu-types.d.ts +195 -0
- package/dist/src/components/menu/menu-utils.d.ts +53 -0
- package/dist/src/components/menu/mono-menu-list.d.ts +118 -0
- package/dist/src/components/menu/mono-menu.d.ts +39 -0
- package/dist/src/components/menu/mono-menu.shadow.d.ts +40 -0
- package/dist/src/components/modal/index.d.ts +4 -0
- package/dist/src/components/modal/index.shadow.d.ts +5 -0
- package/dist/src/components/modal/modal-core.d.ts +110 -0
- package/dist/src/components/modal/modal-types.d.ts +304 -0
- package/dist/src/components/modal/mono-modal-controller.d.ts +4 -0
- package/dist/src/components/modal/mono-modal.d.ts +45 -0
- package/dist/src/components/modal/mono-modal.shadow.d.ts +50 -0
- package/dist/src/components/nav/index.d.ts +4 -0
- package/dist/src/components/nav/index.shadow.d.ts +6 -0
- package/dist/src/components/nav/mono-nav.d.ts +41 -0
- package/dist/src/components/nav/mono-nav.shadow.d.ts +21 -0
- package/dist/src/components/nav/nav-core.d.ts +34 -0
- package/dist/src/components/nav/nav-types.d.ts +48 -0
- package/dist/src/components/nav/nav-utils.d.ts +12 -0
- package/dist/src/components/radio/index.d.ts +4 -0
- package/dist/src/components/radio/index.shadow.d.ts +5 -0
- package/dist/src/components/radio/mono-radio.d.ts +31 -0
- package/dist/src/components/radio/mono-radio.shadow.d.ts +35 -0
- package/dist/src/components/radio/radio-core.d.ts +45 -0
- package/dist/src/components/radio/radio-types.d.ts +58 -0
- package/dist/src/components/radio/radio-utils.d.ts +12 -0
- package/dist/src/components/rich-text-editor/index.d.ts +5 -0
- package/dist/src/components/rich-text-editor/index.shadow.d.ts +6 -0
- package/dist/src/components/rich-text-editor/mono-rich-text-editor.d.ts +31 -0
- package/dist/src/components/rich-text-editor/mono-rich-text-editor.shadow.d.ts +34 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-core.d.ts +100 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-loader.d.ts +17 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-toolbar.d.ts +65 -0
- package/dist/src/components/rich-text-editor/rich-text-editor-types.d.ts +231 -0
- package/dist/src/components/select/index.d.ts +4 -0
- package/dist/src/components/select/index.shadow.d.ts +5 -0
- package/dist/src/components/select/mono-select.d.ts +69 -0
- package/dist/src/components/select/mono-select.shadow.d.ts +48 -0
- package/dist/src/components/select/select-core.d.ts +98 -0
- package/dist/src/components/select/select-types.d.ts +284 -0
- package/dist/src/components/select/select-utils.d.ts +7 -0
- package/dist/src/components/sidebar/index.d.ts +4 -0
- package/dist/src/components/sidebar/index.shadow.d.ts +6 -0
- package/dist/src/components/sidebar/mono-sidebar.d.ts +34 -0
- package/dist/src/components/sidebar/mono-sidebar.shadow.d.ts +27 -0
- package/dist/src/components/sidebar/sidebar-core.d.ts +51 -0
- package/dist/src/components/sidebar/sidebar-types.d.ts +119 -0
- package/dist/src/components/sidebar/sidebar-utils.d.ts +55 -0
- package/dist/src/components/switch/index.d.ts +4 -0
- package/dist/src/components/switch/index.shadow.d.ts +5 -0
- package/dist/src/components/switch/mono-switch.d.ts +31 -0
- package/dist/src/components/switch/mono-switch.shadow.d.ts +36 -0
- package/dist/src/components/switch/switch-core.d.ts +49 -0
- package/dist/src/components/switch/switch-types.d.ts +64 -0
- package/dist/src/components/switch/switch-utils.d.ts +12 -0
- package/dist/src/components/table/array-source.d.ts +44 -0
- package/dist/src/components/table/date-filter-tree.d.ts +93 -0
- package/dist/src/components/table/grouping.d.ts +55 -0
- package/dist/src/components/table/index.d.ts +33 -0
- package/dist/src/components/table/index.shadow.d.ts +47 -0
- package/dist/src/components/table/mono-data-grid.d.ts +1756 -0
- package/dist/src/components/table/mono-table-checkbox-core.d.ts +76 -0
- package/dist/src/components/table/mono-table-checkbox.d.ts +34 -0
- package/dist/src/components/table/mono-table-checkbox.shadow.d.ts +26 -0
- package/dist/src/components/table/mono-table-detail-core.d.ts +87 -0
- package/dist/src/components/table/mono-table-detail.d.ts +32 -0
- package/dist/src/components/table/mono-table-detail.shadow.d.ts +31 -0
- package/dist/src/components/table/mono-table-empty-core.d.ts +60 -0
- package/dist/src/components/table/mono-table-empty.d.ts +35 -0
- package/dist/src/components/table/mono-table-empty.shadow.d.ts +40 -0
- package/dist/src/components/table/mono-table-error-core.d.ts +84 -0
- package/dist/src/components/table/mono-table-error.d.ts +28 -0
- package/dist/src/components/table/mono-table-error.shadow.d.ts +21 -0
- package/dist/src/components/table/mono-table-info-core.d.ts +13 -0
- package/dist/src/components/table/mono-table-info.d.ts +19 -0
- package/dist/src/components/table/mono-table-info.shadow.d.ts +14 -0
- package/dist/src/components/table/mono-table-loading-core.d.ts +41 -0
- package/dist/src/components/table/mono-table-loading.d.ts +50 -0
- package/dist/src/components/table/mono-table-loading.shadow.d.ts +14 -0
- package/dist/src/components/table/mono-table-page-size-core.d.ts +14 -0
- package/dist/src/components/table/mono-table-page-size.d.ts +16 -0
- package/dist/src/components/table/mono-table-page-size.shadow.d.ts +11 -0
- package/dist/src/components/table/mono-table-paging-core.d.ts +22 -0
- package/dist/src/components/table/mono-table-paging-group-core.d.ts +18 -0
- package/dist/src/components/table/mono-table-paging-group.d.ts +20 -0
- package/dist/src/components/table/mono-table-paging-group.shadow.d.ts +13 -0
- package/dist/src/components/table/mono-table-paging.d.ts +16 -0
- package/dist/src/components/table/mono-table-paging.shadow.d.ts +11 -0
- package/dist/src/components/table/mono-table-search-core.d.ts +74 -0
- package/dist/src/components/table/mono-table-search.d.ts +34 -0
- package/dist/src/components/table/mono-table-search.shadow.d.ts +21 -0
- package/dist/src/components/table/mono-table-sort-core.d.ts +35 -0
- package/dist/src/components/table/mono-table-sort.d.ts +38 -0
- package/dist/src/components/table/mono-table-sort.shadow.d.ts +20 -0
- package/dist/src/components/table/mono-table-summary-core.d.ts +26 -0
- package/dist/src/components/table/mono-table-summary.d.ts +24 -0
- package/dist/src/components/table/mono-table-summary.shadow.d.ts +14 -0
- package/dist/src/components/table/mono-table-th-core.d.ts +56 -0
- package/dist/src/components/table/mono-table-th.d.ts +41 -0
- package/dist/src/components/table/mono-table-th.shadow.d.ts +19 -0
- package/dist/src/components/table/store-group-source.d.ts +24 -0
- package/dist/src/components/table/table-controller-core.d.ts +40 -0
- package/dist/src/components/table/table-filter-icons.d.ts +3 -0
- package/dist/src/components/table/table-menu-core.d.ts +65 -0
- package/dist/src/components/table/table-overlay.d.ts +165 -0
- package/dist/src/components/table/table-sort-icons.d.ts +4 -0
- package/dist/src/components/table/table-sort-utils.d.ts +20 -0
- package/dist/src/components/table/table-types.d.ts +475 -0
- package/dist/src/components/tabs/index.d.ts +3 -0
- package/dist/src/components/tabs/index.shadow.d.ts +4 -0
- package/dist/src/components/tabs/mono-tabs.d.ts +33 -0
- package/dist/src/components/tabs/mono-tabs.shadow.d.ts +37 -0
- package/dist/src/components/tabs/tabs-core.d.ts +57 -0
- package/dist/src/components/tabs/tabs-types.d.ts +65 -0
- package/dist/src/components/tag-input/index.d.ts +4 -0
- package/dist/src/components/tag-input/index.shadow.d.ts +5 -0
- package/dist/src/components/tag-input/mono-tag-input.d.ts +66 -0
- package/dist/src/components/tag-input/mono-tag-input.shadow.d.ts +40 -0
- package/dist/src/components/tag-input/tag-input-core.d.ts +108 -0
- package/dist/src/components/tag-input/tag-input-types.d.ts +420 -0
- package/dist/src/components/tag-input/tag-input-utils.d.ts +8 -0
- package/dist/src/components/textarea/index.d.ts +4 -0
- package/dist/src/components/textarea/index.shadow.d.ts +5 -0
- package/dist/src/components/textarea/mono-textarea.d.ts +29 -0
- package/dist/src/components/textarea/mono-textarea.shadow.d.ts +31 -0
- package/dist/src/components/textarea/textarea-core.d.ts +60 -0
- package/dist/src/components/textarea/textarea-types.d.ts +131 -0
- package/dist/src/components/textarea/textarea-utils.d.ts +7 -0
- package/dist/src/components/tooltip/control-tooltip.d.ts +36 -0
- package/dist/src/components/tooltip/index.d.ts +6 -0
- package/dist/src/components/tooltip/tooltip-config.d.ts +27 -0
- package/dist/src/components/tooltip/tooltip-declarative.d.ts +41 -0
- package/dist/src/components/tooltip/tooltip-loader.d.ts +1 -0
- package/dist/src/components/tooltip/tooltip-types.d.ts +110 -0
- package/dist/src/composables/breakpoints.d.ts +59 -0
- package/dist/src/composables/chip-limits.d.ts +48 -0
- package/dist/src/composables/chip-strip.d.ts +93 -0
- package/dist/src/composables/color.d.ts +103 -0
- package/dist/src/composables/css-class.d.ts +27 -0
- package/dist/src/composables/css-size.d.ts +40 -0
- package/dist/src/composables/data-source-controller.d.ts +113 -0
- package/dist/src/composables/element-props.d.ts +46 -0
- package/dist/src/composables/field-icons.d.ts +15 -0
- package/dist/src/composables/hybird-prop.d.ts +79 -0
- package/dist/src/composables/hydration-flush.d.ts +34 -0
- package/dist/src/composables/icon.d.ts +17 -0
- package/dist/src/composables/layout-var.d.ts +34 -0
- package/dist/src/composables/light-slots.d.ts +133 -0
- package/dist/src/composables/mdi-glyphs.d.ts +4 -0
- package/dist/src/composables/mono-element.d.ts +9 -0
- package/dist/src/composables/mono-event.d.ts +55 -0
- package/dist/src/composables/mono-pending.d.ts +8 -0
- package/dist/src/composables/mono-skeleton.d.ts +193 -0
- package/dist/src/composables/mono-ui.d.ts +58 -0
- package/dist/src/composables/notifier.d.ts +46 -0
- package/dist/src/composables/popup-portal.d.ts +226 -0
- package/dist/src/composables/popup-stack.d.ts +70 -0
- package/dist/src/composables/rate-limit.d.ts +108 -0
- package/dist/src/composables/reactive.d.ts +53 -0
- package/dist/src/composables/shadow-css.d.ts +42 -0
- package/dist/src/composables/visibility.d.ts +36 -0
- package/dist/src/data/theme/index.d.ts +30 -0
- package/dist/src/data/theme/presets.d.ts +94 -0
- package/dist/src/entries/index.d.ts +2 -0
- package/dist/src/entries/index.node.d.ts +42 -0
- package/dist/src/entries/search.d.ts +3 -0
- package/dist/src/export/detail.d.ts +29 -0
- package/dist/src/export/download.d.ts +9 -0
- package/dist/src/export/excel/index.d.ts +27 -0
- package/dist/src/export/excel/nodes.d.ts +123 -0
- package/dist/src/export/expression.d.ts +36 -0
- package/dist/src/export/helpers.d.ts +6 -0
- package/dist/src/export/index.d.ts +13 -0
- package/dist/src/export/markdown.d.ts +52 -0
- package/dist/src/export/resolve-data.d.ts +31 -0
- package/dist/src/export/sentinel.d.ts +97 -0
- package/dist/src/export/sheet-name.d.ts +45 -0
- package/dist/src/export/styles.d.ts +33 -0
- package/dist/src/export/template.d.ts +10 -0
- package/dist/src/export/types.d.ts +259 -0
- package/dist/src/import/coerce.d.ts +38 -0
- package/dist/src/import/index.d.ts +16 -0
- package/dist/src/import/match.d.ts +54 -0
- package/dist/src/import/parse.d.ts +15 -0
- package/dist/src/import/types.d.ts +153 -0
- package/dist/src/nuxt/index.d.ts +94 -0
- package/dist/src/search/data-search.d.ts +207 -0
- package/dist/src/search/field-path.d.ts +107 -0
- package/dist/src/search/filter-eval.d.ts +30 -0
- package/dist/src/search/index.d.ts +22 -0
- package/dist/src/search/odata-search.d.ts +18 -0
- package/dist/src/search/search-expr.d.ts +160 -0
- package/dist/src/utils/data-source-apply.d.ts +97 -0
- package/dist/src/utils/data-source-options.d.ts +116 -0
- package/dist/src/utils/data-source-read.d.ts +85 -0
- package/dist/src/utils/data-source-summary.d.ts +55 -0
- package/dist/src/utils/normalize-error.d.ts +90 -0
- package/dist/src/vite/index.d.ts +48 -0
- package/dist/src/vite/mono-client-only.d.ts +35 -0
- package/dist/src/vite/mono-ssr-stub.d.ts +20 -0
- package/dist/src/vite/shadow-manifest.d.ts +8 -0
- package/dist/styles-BIJ31TM4.js +20146 -0
- package/dist/tooltip-DQqNpqk2.js +795 -0
- package/dist/tooltip.d.ts +1 -0
- package/dist/tooltip.js +2 -0
- package/dist/ui/accordion.d.ts +1 -0
- package/dist/ui/accordion.js +466 -0
- package/dist/ui/alert.d.ts +1 -0
- package/dist/ui/alert.js +221 -0
- package/dist/ui/breadcrumb.d.ts +1 -0
- package/dist/ui/breadcrumb.js +902 -0
- package/dist/ui/button-dropdown.d.ts +1 -0
- package/dist/ui/button-dropdown.js +679 -0
- package/dist/ui/button.d.ts +1 -0
- package/dist/ui/button.js +63 -0
- package/dist/ui/card.d.ts +1 -0
- package/dist/ui/card.js +524 -0
- package/dist/ui/chart.d.ts +1 -0
- package/dist/ui/chart.js +885 -0
- package/dist/ui/checkbox.d.ts +1 -0
- package/dist/ui/checkbox.js +413 -0
- package/dist/ui/chip.d.ts +1 -0
- package/dist/ui/chip.js +558 -0
- package/dist/ui/date.d.ts +1 -0
- package/dist/ui/date.js +686 -0
- package/dist/ui/drawer.d.ts +1 -0
- package/dist/ui/drawer.js +901 -0
- package/dist/ui/dropdown-table.d.ts +1 -0
- package/dist/ui/dropdown-table.js +1291 -0
- package/dist/ui/dropdown.d.ts +1 -0
- package/dist/ui/dropdown.js +586 -0
- package/dist/ui/file-upload.d.ts +1 -0
- package/dist/ui/file-upload.js +688 -0
- package/dist/ui/filter.d.ts +1 -0
- package/dist/ui/filter.js +400 -0
- package/dist/ui/font/files/geist-47c091c9.woff2 +0 -0
- package/dist/ui/font/files/geist-8dd77544.woff2 +0 -0
- package/dist/ui/font/files/geist-b9248b1e.woff2 +0 -0
- package/dist/ui/font/files/geist-d40d74b4.woff2 +0 -0
- package/dist/ui/font/files/geist-f493429a.woff2 +0 -0
- package/dist/ui/font/files/geistmono-03737868.woff2 +0 -0
- package/dist/ui/font/files/geistmono-421a7e38.woff2 +0 -0
- package/dist/ui/font/files/geistmono-48ef518d.woff2 +0 -0
- package/dist/ui/font/files/geistmono-5df35d39.woff2 +0 -0
- package/dist/ui/font/files/geistmono-7de289a4.woff2 +0 -0
- package/dist/ui/font/files/geistmono-e976128f.woff2 +0 -0
- package/dist/ui/font/files/inter-05cf802c.woff2 +0 -0
- package/dist/ui/font/files/inter-2b2f25a4.woff2 +0 -0
- package/dist/ui/font/files/inter-467acc7a.woff2 +0 -0
- package/dist/ui/font/files/inter-6e85163c.woff2 +0 -0
- package/dist/ui/font/files/inter-7048add3.woff2 +0 -0
- package/dist/ui/font/files/inter-9be0371e.woff2 +0 -0
- package/dist/ui/font/files/inter-a28b7e31.woff2 +0 -0
- package/dist/ui/font/files/poppins-054df55a.woff2 +0 -0
- package/dist/ui/font/files/poppins-0ee5dc9a.woff2 +0 -0
- package/dist/ui/font/files/poppins-0f44cb18.woff2 +0 -0
- package/dist/ui/font/files/poppins-0ff0d30c.woff2 +0 -0
- package/dist/ui/font/files/poppins-13045147.woff2 +0 -0
- package/dist/ui/font/files/poppins-1db57cd9.woff2 +0 -0
- package/dist/ui/font/files/poppins-2cf2a902.woff2 +0 -0
- package/dist/ui/font/files/poppins-39e7f079.woff2 +0 -0
- package/dist/ui/font/files/poppins-9607042d.woff2 +0 -0
- package/dist/ui/font/files/poppins-9a88fc1f.woff2 +0 -0
- package/dist/ui/font/files/poppins-b8f4f752.woff2 +0 -0
- package/dist/ui/font/files/poppins-f5e57db4.woff2 +0 -0
- package/dist/ui/font/geist-mono.css +104 -0
- package/dist/ui/font/geist.css +168 -0
- package/dist/ui/font/inter.css +232 -0
- package/dist/ui/font/poppins.css +104 -0
- package/dist/ui/form.d.ts +1 -0
- package/dist/ui/form.js +3 -0
- package/dist/ui/index.css +21989 -0
- package/dist/ui/input.d.ts +1 -0
- package/dist/ui/input.js +1176 -0
- package/dist/ui/menu.d.ts +1 -0
- package/dist/ui/menu.js +1289 -0
- package/dist/ui/modal.d.ts +1 -0
- package/dist/ui/modal.js +996 -0
- package/dist/ui/nav.d.ts +1 -0
- package/dist/ui/nav.js +295 -0
- package/dist/ui/radio.d.ts +1 -0
- package/dist/ui/radio.js +379 -0
- package/dist/ui/rich-text-editor.d.ts +1 -0
- package/dist/ui/rich-text-editor.js +1338 -0
- package/dist/ui/select.d.ts +1 -0
- package/dist/ui/select.js +2200 -0
- package/dist/ui/shadow/accordion.js +442 -0
- package/dist/ui/shadow/alert.js +218 -0
- package/dist/ui/shadow/breadcrumb.js +919 -0
- package/dist/ui/shadow/button-dropdown.js +696 -0
- package/dist/ui/shadow/button.js +63 -0
- package/dist/ui/shadow/card.js +538 -0
- package/dist/ui/shadow/chart.js +1685 -0
- package/dist/ui/shadow/checkbox.js +457 -0
- package/dist/ui/shadow/chip.js +559 -0
- package/dist/ui/shadow/date.js +712 -0
- package/dist/ui/shadow/drawer.js +869 -0
- package/dist/ui/shadow/dropdown-table.js +1620 -0
- package/dist/ui/shadow/dropdown.js +547 -0
- package/dist/ui/shadow/file-upload.js +731 -0
- package/dist/ui/shadow/filter.js +402 -0
- package/dist/ui/shadow/input.js +1150 -0
- package/dist/ui/shadow/menu.js +899 -0
- package/dist/ui/shadow/modal.js +1194 -0
- package/dist/ui/shadow/nav.js +240 -0
- package/dist/ui/shadow/radio.js +408 -0
- package/dist/ui/shadow/rich-text-editor.js +1344 -0
- package/dist/ui/shadow/select.js +2167 -0
- package/dist/ui/shadow/sidebar.js +606 -0
- package/dist/ui/shadow/switch.js +428 -0
- package/dist/ui/shadow/table.js +4755 -0
- package/dist/ui/shadow/tabs.js +372 -0
- package/dist/ui/shadow/tag-input.js +2974 -0
- package/dist/ui/shadow/textarea.js +816 -0
- package/dist/ui/sidebar.d.ts +1 -0
- package/dist/ui/sidebar.js +659 -0
- package/dist/ui/switch.d.ts +1 -0
- package/dist/ui/switch.js +398 -0
- package/dist/ui/table.d.ts +1 -0
- package/dist/ui/table.js +4654 -0
- package/dist/ui/tabs.d.ts +1 -0
- package/dist/ui/tabs.js +379 -0
- package/dist/ui/tag-input.d.ts +1 -0
- package/dist/ui/tag-input.js +2947 -0
- package/dist/ui/textarea.d.ts +1 -0
- package/dist/ui/textarea.js +819 -0
- package/dist/ui/theme/legacy.css +293 -0
- package/dist/ui/theme/luma.css +743 -0
- package/dist/ui/theme/lyra.css +754 -0
- package/dist/ui/theme/maia.css +673 -0
- package/dist/ui/theme/mira.css +802 -0
- package/dist/ui/theme/nova.css +662 -0
- package/dist/ui/theme/one.css +699 -0
- package/dist/ui/theme/rhea.css +742 -0
- package/dist/ui/theme/sera.css +845 -0
- package/dist/ui/theme/tokens.css +261 -0
- package/dist/ui/theme/vega.css +467 -0
- package/dist/vite-C5iUK7so.js +329 -0
- package/dist/vite.d.ts +1 -0
- package/dist/vite.js +2 -0
- package/dist/vue.d.ts +282 -0
- package/package.json +411 -3
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
import { n as isPath, t as getFieldValue } from "./field-path-C92eGLg3.js";
|
|
2
|
+
import { r as readAllRows } from "./data-source-read-DL88aH8t.js";
|
|
3
|
+
import { n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-DIfU2EAn.js";
|
|
4
|
+
import { n as describeError, o as isCanceled } from "./normalize-error-Gcgmgh5i.js";
|
|
5
|
+
import { a as resolveDataSourceOptions, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, n as extraLoadOptions, o as toList, p as loadApply, r as mergeDataSourceOptions, u as summaryFilterOf } from "./data-source-options-Jqj7LU3Z.js";
|
|
6
|
+
import { t as arrayToODataString } from "./filter-odata-C1vSGZaY.js";
|
|
7
|
+
import { t as createNotifier } from "./notifier-CE4yxMUQ.js";
|
|
8
|
+
//#region src/components/chart/chart-odata.ts
|
|
9
|
+
/**
|
|
10
|
+
* `MonoChartAgg` → the OData aggregate keyword. Every value the chart supports has
|
|
11
|
+
* an exact equivalent, so the server path never has to fall back to draining.
|
|
12
|
+
*/
|
|
13
|
+
var ODATA_AGG = {
|
|
14
|
+
sum: "sum",
|
|
15
|
+
avg: "average",
|
|
16
|
+
min: "min",
|
|
17
|
+
max: "max",
|
|
18
|
+
count: "$count"
|
|
19
|
+
};
|
|
20
|
+
/** A dotted path (`Job.Budget`) addresses a nav property as `Job/Budget` in OData. */
|
|
21
|
+
var toODataPath = (field) => field.replaceAll(".", "/");
|
|
22
|
+
/**
|
|
23
|
+
* Build `groupby((<groupBy>),aggregate(<field> with <agg> as <field>, …))`.
|
|
24
|
+
*
|
|
25
|
+
* Each aggregate is aliased back to **its own series field**, which is what lets
|
|
26
|
+
* the result flow through the chart's existing projection untouched: one row per
|
|
27
|
+
* bucket, and re-aggregating a single value is the identity. No special-casing
|
|
28
|
+
* downstream, and a client-side roll-up and a server-side one render identically.
|
|
29
|
+
*
|
|
30
|
+
* `count` has no operand, so it emits `$count as <field>`.
|
|
31
|
+
*/
|
|
32
|
+
function buildChartApply(groupBy, series = []) {
|
|
33
|
+
const key = toODataPath(groupBy);
|
|
34
|
+
const aggregates = series.filter((s) => s?.field).map((s) => {
|
|
35
|
+
const agg = ODATA_AGG[s.agg ?? "sum"] ?? "sum";
|
|
36
|
+
return agg === "$count" ? `$count as ${s.field}` : `${toODataPath(s.field)} with ${agg} as ${s.field}`;
|
|
37
|
+
});
|
|
38
|
+
return aggregates.length ? `groupby((${key}),aggregate(${aggregates.join(",")}))` : `groupby((${key}))`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Compose a filter with a groupby: `filter(<expr>)/groupby(…)`.
|
|
42
|
+
*
|
|
43
|
+
* Filtering INSIDE `$apply` (rather than as a sibling `$filter`) is what keeps the
|
|
44
|
+
* two composable — the filter runs first and the aggregation sees only matching
|
|
45
|
+
* rows, which is the whole point of doing this server-side.
|
|
46
|
+
*/
|
|
47
|
+
function composeApply(apply, filter) {
|
|
48
|
+
const expr = arrayToODataString(filter);
|
|
49
|
+
return expr ? `filter(${expr})/${apply}` : apply;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Compose the request an `odata` chart sends — pure, so the merge of
|
|
53
|
+
* `odata.options` with the controller's base (`dataSourceOptions` /
|
|
54
|
+
* `odataOptions`) and the `$apply` folding can be asserted without a network.
|
|
55
|
+
*
|
|
56
|
+
* The base's `filter` is AND-ed under `odata.options.filter`; its `select` /
|
|
57
|
+
* `expand` / `sort` / `paginate` become load options; its `customQueryParams`
|
|
58
|
+
* become raw params beside `$apply`. On the `$apply` path the composed filter
|
|
59
|
+
* travels INSIDE the clause (that is what keeps it composable with the grouping)
|
|
60
|
+
* and is removed from the load options so it is not also sent as a sibling
|
|
61
|
+
* `$filter`; `paginate` is forced off so every bucket comes back.
|
|
62
|
+
*/
|
|
63
|
+
function buildChartOdataRequest(input) {
|
|
64
|
+
const base = input.base ?? {};
|
|
65
|
+
const { customQueryParams, ...rest } = mergeDataSourceOptions(input.options ?? {}, base);
|
|
66
|
+
const options = { ...rest };
|
|
67
|
+
const params = { ...customQueryParams ?? {} };
|
|
68
|
+
if (typeof input.aggregate === "function") {
|
|
69
|
+
const groupBy = input.groupBy;
|
|
70
|
+
if (!groupBy) throw new Error("[mono-chart] `odata.aggregate` needs a `groupBy` — there is nothing to group by.");
|
|
71
|
+
const apply = buildChartApply(groupBy, input.series);
|
|
72
|
+
const filter = options.filter;
|
|
73
|
+
params.$apply = input.aggregate({
|
|
74
|
+
apply,
|
|
75
|
+
filter,
|
|
76
|
+
odataFilter: arrayToODataString,
|
|
77
|
+
withFilter: (a, f) => composeApply(a, f === void 0 ? filter : f),
|
|
78
|
+
groupBy,
|
|
79
|
+
series: [...input.series]
|
|
80
|
+
});
|
|
81
|
+
delete options.filter;
|
|
82
|
+
options.paginate = false;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
options,
|
|
86
|
+
params,
|
|
87
|
+
aggregated: params.$apply !== void 0
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/components/chart/mono-data-chart.ts
|
|
92
|
+
/**
|
|
93
|
+
* Default palette, expressed as mono color NAMES rather than literals so a chart
|
|
94
|
+
* follows the active theme out of the box — exactly like every other component.
|
|
95
|
+
* These are Basecoat's own chart colours: the element resolves each name through
|
|
96
|
+
* `--_mono-chart-<name>` → `--mono-chart-*` → `--chart-1` … `--chart-5` at paint
|
|
97
|
+
* time, so a colour preset, a flavour or dark mode recolours charts too. Past
|
|
98
|
+
* five series the roles follow, so a sixth dataset is still its own colour.
|
|
99
|
+
*/
|
|
100
|
+
var DEFAULT_COLORS = [
|
|
101
|
+
"chart-1",
|
|
102
|
+
"chart-2",
|
|
103
|
+
"chart-3",
|
|
104
|
+
"chart-4",
|
|
105
|
+
"chart-5",
|
|
106
|
+
"success",
|
|
107
|
+
"warning",
|
|
108
|
+
"danger"
|
|
109
|
+
];
|
|
110
|
+
/**
|
|
111
|
+
* Values used when nobody has resolved a name yet — a controller used headlessly
|
|
112
|
+
* (reading `data()` in Node), or before an element mounts. ONE's light tokens,
|
|
113
|
+
* so the shape is right even without a DOM.
|
|
114
|
+
*/
|
|
115
|
+
var NAME_FALLBACK = {
|
|
116
|
+
"chart-1": "oklch(0.859 0.069 267.7)",
|
|
117
|
+
"chart-2": "oklch(0.735 0.12 268.04)",
|
|
118
|
+
"chart-3": "oklch(0.61 0.12 267.95)",
|
|
119
|
+
"chart-4": "oklch(0.485 0.119 267.92)",
|
|
120
|
+
"chart-5": "oklch(0.36 0.12 268.21)",
|
|
121
|
+
primary: "oklch(0.299 0.119 267.96)",
|
|
122
|
+
secondary: "oklch(0.554 0.041 257.42)",
|
|
123
|
+
accent: "oklch(0.735 0.12 268.04)",
|
|
124
|
+
success: "oklch(0.5239 0.0917 180.004)",
|
|
125
|
+
warning: "oklch(0.5423 0.1066 70.504)",
|
|
126
|
+
danger: "oklch(0.561 0.202 26.71)",
|
|
127
|
+
info: "oklch(0.431 0.163 267.72)",
|
|
128
|
+
surface: "oklch(0.973 0.007 268.55)"
|
|
129
|
+
};
|
|
130
|
+
/** Read a row field, honouring path expressions (`Job.Name`, `Items.[*].Total`). */
|
|
131
|
+
function fieldValue(row, field) {
|
|
132
|
+
if (row == null) return void 0;
|
|
133
|
+
if (!isPath(field)) return row[field];
|
|
134
|
+
const v = getFieldValue(row, field);
|
|
135
|
+
return Array.isArray(v) ? v[0] : v;
|
|
136
|
+
}
|
|
137
|
+
/** Coerce to a finite number, or null when the value isn't numeric. */
|
|
138
|
+
function num(value) {
|
|
139
|
+
if (value == null || value === "") return null;
|
|
140
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
141
|
+
return Number.isFinite(n) ? n : null;
|
|
142
|
+
}
|
|
143
|
+
/** Apply an aggregate to a bucket of raw values. */
|
|
144
|
+
function aggregate(values, agg) {
|
|
145
|
+
if (agg === "count") return values.length;
|
|
146
|
+
const nums = values.map(num).filter((n) => n != null);
|
|
147
|
+
if (!nums.length) return agg === "sum" ? 0 : null;
|
|
148
|
+
switch (agg) {
|
|
149
|
+
case "sum": return nums.reduce((a, b) => a + b, 0);
|
|
150
|
+
case "avg": return nums.reduce((a, b) => a + b, 0) / nums.length;
|
|
151
|
+
case "min": return Math.min(...nums);
|
|
152
|
+
case "max": return Math.max(...nums);
|
|
153
|
+
default: return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/** Parse `#rgb` / `#rrggbb` / `rgb(r,g,b)` to channels; null if unrecognised. */
|
|
157
|
+
function toRgb(color) {
|
|
158
|
+
const s = color.trim();
|
|
159
|
+
const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(s);
|
|
160
|
+
if (hex) {
|
|
161
|
+
const h = hex[1].length === 3 ? hex[1].replace(/./g, (c) => c + c) : hex[1];
|
|
162
|
+
const n = parseInt(h, 16);
|
|
163
|
+
return [
|
|
164
|
+
n >> 16 & 255,
|
|
165
|
+
n >> 8 & 255,
|
|
166
|
+
n & 255
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(s);
|
|
170
|
+
if (rgb) return [
|
|
171
|
+
Number(rgb[1]),
|
|
172
|
+
Number(rgb[2]),
|
|
173
|
+
Number(rgb[3])
|
|
174
|
+
];
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
/** Shift a color's lightness by `delta` (-1…1), preserving hue and saturation. */
|
|
178
|
+
function shiftLightness(color, delta) {
|
|
179
|
+
const rgb = toRgb(color);
|
|
180
|
+
if (!rgb) return color;
|
|
181
|
+
const [r, g, b] = rgb.map((v) => v / 255);
|
|
182
|
+
const max = Math.max(r, g, b);
|
|
183
|
+
const min = Math.min(r, g, b);
|
|
184
|
+
const l = (max + min) / 2;
|
|
185
|
+
const d = max - min;
|
|
186
|
+
const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
|
|
187
|
+
let h = 0;
|
|
188
|
+
if (d !== 0) {
|
|
189
|
+
if (max === r) h = (g - b) / d % 6;
|
|
190
|
+
else if (max === g) h = (b - r) / d + 2;
|
|
191
|
+
else h = (r - g) / d + 4;
|
|
192
|
+
h *= 60;
|
|
193
|
+
if (h < 0) h += 360;
|
|
194
|
+
}
|
|
195
|
+
const nl = Math.min(.92, Math.max(.08, l + delta));
|
|
196
|
+
const c = (1 - Math.abs(2 * nl - 1)) * s;
|
|
197
|
+
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
198
|
+
const m = nl - c / 2;
|
|
199
|
+
const [r1, g1, b1] = h < 60 ? [
|
|
200
|
+
c,
|
|
201
|
+
x,
|
|
202
|
+
0
|
|
203
|
+
] : h < 120 ? [
|
|
204
|
+
x,
|
|
205
|
+
c,
|
|
206
|
+
0
|
|
207
|
+
] : h < 180 ? [
|
|
208
|
+
0,
|
|
209
|
+
c,
|
|
210
|
+
x
|
|
211
|
+
] : h < 240 ? [
|
|
212
|
+
0,
|
|
213
|
+
x,
|
|
214
|
+
c
|
|
215
|
+
] : h < 300 ? [
|
|
216
|
+
x,
|
|
217
|
+
0,
|
|
218
|
+
c
|
|
219
|
+
] : [
|
|
220
|
+
c,
|
|
221
|
+
0,
|
|
222
|
+
x
|
|
223
|
+
];
|
|
224
|
+
const out = [
|
|
225
|
+
r1,
|
|
226
|
+
g1,
|
|
227
|
+
b1
|
|
228
|
+
].map((v) => Math.round((v + m) * 255));
|
|
229
|
+
return `rgb(${out[0]}, ${out[1]}, ${out[2]})`;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Make every entry visually distinct.
|
|
233
|
+
*
|
|
234
|
+
* A token set may ALIAS roles — in ONE, `--success` and `--teal` are the same
|
|
235
|
+
* colour, and a consumer's own preset can fold two more. That's fine for UI (a chip is either "info" or
|
|
236
|
+
* "secondary"), but a chart drawing two series in the same colour is unreadable.
|
|
237
|
+
* On a collision, step the lightness until the colour is unused.
|
|
238
|
+
*
|
|
239
|
+
* Only applied to the DEFAULT palette — an explicit `colors` list is honoured
|
|
240
|
+
* exactly as written, duplicates included.
|
|
241
|
+
*/
|
|
242
|
+
function distinctColors(list) {
|
|
243
|
+
const seen = /* @__PURE__ */ new Set();
|
|
244
|
+
return list.map((color) => {
|
|
245
|
+
let candidate = color;
|
|
246
|
+
for (let i = 1; seen.has(candidate.toLowerCase()) && i <= 6; i++) candidate = shiftLightness(color, (i % 2 ? 1 : -1) * .14 * Math.ceil(i / 2));
|
|
247
|
+
seen.add(candidate.toLowerCase());
|
|
248
|
+
return candidate;
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/** True for a raw chart.js `data` object (as opposed to a row array / DataSource). */
|
|
252
|
+
function isRawData(value) {
|
|
253
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.datasets);
|
|
254
|
+
}
|
|
255
|
+
/** Types that colour each POINT rather than each dataset. */
|
|
256
|
+
function isPerPointType(type) {
|
|
257
|
+
return type === "pie" || type === "doughnut" || type === "polarArea";
|
|
258
|
+
}
|
|
259
|
+
function monoChart(source = null, opts = {}) {
|
|
260
|
+
let bound = null;
|
|
261
|
+
let raw = null;
|
|
262
|
+
let rows = [];
|
|
263
|
+
/** Rows per label index, so a click can report what produced the point. */
|
|
264
|
+
let buckets = [];
|
|
265
|
+
let projected = {
|
|
266
|
+
labels: [],
|
|
267
|
+
datasets: []
|
|
268
|
+
};
|
|
269
|
+
let instance = null;
|
|
270
|
+
/**
|
|
271
|
+
* How many drains are in flight. A COUNTER, not a flag: `bind()` starts one
|
|
272
|
+
* sync and a following `reload()` starts another, so two drains overlap — with
|
|
273
|
+
* a boolean the first one to finish cleared it and the chart reported "done"
|
|
274
|
+
* while the second was still fetching chunks.
|
|
275
|
+
*
|
|
276
|
+
* Also guards the re-entrant `changed` echo while a drain is running.
|
|
277
|
+
*/
|
|
278
|
+
let drainDepth = 0;
|
|
279
|
+
/**
|
|
280
|
+
* Whether `rows` came back already rolled up by the server (`odata.aggregate`).
|
|
281
|
+
* Read by `project()`, which must not re-apply each series' `agg` to a bucket
|
|
282
|
+
* that is already a single aggregated row.
|
|
283
|
+
*/
|
|
284
|
+
let preAggregated = false;
|
|
285
|
+
/**
|
|
286
|
+
* The `$apply`-through-the-store switch for a bound source: off by option
|
|
287
|
+
* (`serverApply: false`), or off for good once the backend rejected one.
|
|
288
|
+
*/
|
|
289
|
+
const applyGate = createApplyGate(opts.serverApply !== false);
|
|
290
|
+
let series = opts.series ? [...opts.series] : [];
|
|
291
|
+
let colors = opts.colors?.length ? [...opts.colors] : [...DEFAULT_COLORS];
|
|
292
|
+
/** Only the DEFAULT palette gets de-duplicated; an explicit list is honoured as written. */
|
|
293
|
+
let paletteIsDefault = !opts.colors?.length;
|
|
294
|
+
/**
|
|
295
|
+
* Turns a mono color NAME into a real value. Falls back to the static token
|
|
296
|
+
* values until an element installs the DOM-aware version — the controller has
|
|
297
|
+
* no DOM, and only the element can read the `--_mono-chart-*` tokens (which is
|
|
298
|
+
* also what makes the palette follow a live theme change).
|
|
299
|
+
*/
|
|
300
|
+
let resolveColor = (c) => NAME_FALLBACK[c] ?? c;
|
|
301
|
+
const notifier = createNotifier();
|
|
302
|
+
const notify = notifier.notify;
|
|
303
|
+
const elementProps = { ...opts.props ?? {} };
|
|
304
|
+
/** Build `{ labels, datasets }` from the current rows + series config. */
|
|
305
|
+
function project() {
|
|
306
|
+
if (raw) {
|
|
307
|
+
projected = raw;
|
|
308
|
+
buckets = [];
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const groupBy = opts.groupBy;
|
|
312
|
+
const labelField = opts.labelField ?? groupBy;
|
|
313
|
+
const specs = series.length ? series : inferSeries();
|
|
314
|
+
let labels;
|
|
315
|
+
let groups;
|
|
316
|
+
if (groupBy) {
|
|
317
|
+
const order = [];
|
|
318
|
+
const map = /* @__PURE__ */ new Map();
|
|
319
|
+
for (const row of rows) {
|
|
320
|
+
const value = fieldValue(row, groupBy);
|
|
321
|
+
const key = String(value);
|
|
322
|
+
let entry = map.get(key);
|
|
323
|
+
if (!entry) {
|
|
324
|
+
entry = {
|
|
325
|
+
label: value,
|
|
326
|
+
rows: []
|
|
327
|
+
};
|
|
328
|
+
map.set(key, entry);
|
|
329
|
+
order.push(key);
|
|
330
|
+
}
|
|
331
|
+
entry.rows.push(row);
|
|
332
|
+
}
|
|
333
|
+
labels = order.map((k) => map.get(String(k)).label);
|
|
334
|
+
groups = order.map((k) => map.get(String(k)).rows);
|
|
335
|
+
} else {
|
|
336
|
+
labels = labelField ? rows.map((r) => fieldValue(r, labelField)) : rows.map((_, i) => i + 1);
|
|
337
|
+
groups = rows.map((r) => [r]);
|
|
338
|
+
}
|
|
339
|
+
const perPoint = isPerPointType(ctrl.type);
|
|
340
|
+
const resolved = colors.map(resolveColor);
|
|
341
|
+
const palette = paletteIsDefault ? distinctColors(resolved) : resolved;
|
|
342
|
+
const datasets = specs.map((spec, i) => {
|
|
343
|
+
/**
|
|
344
|
+
* Rows that arrived pre-aggregated (`odata.aggregate`) are already one per
|
|
345
|
+
* bucket, so the series' own `agg` must NOT run again — it would re-reduce a
|
|
346
|
+
* single value. `sum` is the identity there for `sum`/`min`/`max`/`avg`, but
|
|
347
|
+
* `count` is not: counting one rolled-up row yields 1 and throws away the
|
|
348
|
+
* server's `$count`. Reading the value covers every agg uniformly.
|
|
349
|
+
*/
|
|
350
|
+
const agg = preAggregated ? "sum" : spec.agg ?? "sum";
|
|
351
|
+
const data = groups.map((bucket) => {
|
|
352
|
+
const values = bucket.map((row) => fieldValue(row, spec.field));
|
|
353
|
+
if ((preAggregated || !groupBy) && bucket.length === 1 && agg === "sum") return num(values[0]);
|
|
354
|
+
return aggregate(values, agg);
|
|
355
|
+
});
|
|
356
|
+
const color = spec.color ? resolveColor(spec.color) : palette[i % palette.length];
|
|
357
|
+
const base = {
|
|
358
|
+
label: spec.label ?? spec.field,
|
|
359
|
+
data,
|
|
360
|
+
backgroundColor: perPoint ? labels.map((_, j) => palette[j % palette.length]) : color,
|
|
361
|
+
borderColor: perPoint ? resolveColor("surface") : color
|
|
362
|
+
};
|
|
363
|
+
if (spec.type) base.type = spec.type;
|
|
364
|
+
return spec.dataset ? {
|
|
365
|
+
...base,
|
|
366
|
+
...spec.dataset
|
|
367
|
+
} : base;
|
|
368
|
+
});
|
|
369
|
+
projected = {
|
|
370
|
+
labels,
|
|
371
|
+
datasets
|
|
372
|
+
};
|
|
373
|
+
buckets = groups;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* With no `series`, chart every numeric field on the first row except the
|
|
377
|
+
* label/group field — so `monoChart(rows, { labelField: 'month' })` just works.
|
|
378
|
+
*/
|
|
379
|
+
function inferSeries() {
|
|
380
|
+
const first = rows[0];
|
|
381
|
+
if (!first) return [];
|
|
382
|
+
const skip = new Set([opts.labelField, opts.groupBy].filter(Boolean));
|
|
383
|
+
return Object.keys(first).filter((k) => !skip.has(k) && num(first[k]) != null).map((field) => ({ field }));
|
|
384
|
+
}
|
|
385
|
+
const onChanged = () => {
|
|
386
|
+
if (drainDepth > 0) return;
|
|
387
|
+
if (opts.loadAll === false) succeed();
|
|
388
|
+
sync().catch(() => {});
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Publish the loading state, notifying only on a real change.
|
|
392
|
+
*
|
|
393
|
+
* The DataSource's own `isLoading()` is NOT enough: a draining chart reads the
|
|
394
|
+
* STORE directly (`readAllRows`), which never goes through the DataSource and so
|
|
395
|
+
* never flips its loading flag. Reporting only `isLoading()` made the chart look
|
|
396
|
+
* finished while chunk after chunk was still in flight — `draining` is the half
|
|
397
|
+
* that covers it.
|
|
398
|
+
*/
|
|
399
|
+
function setLoading(next) {
|
|
400
|
+
if (ctrl.loading === next) return;
|
|
401
|
+
ctrl.loading = next;
|
|
402
|
+
notify();
|
|
403
|
+
}
|
|
404
|
+
const syncLoading = () => {
|
|
405
|
+
setLoading(drainDepth > 0 || (bound?.isLoading?.() ?? false));
|
|
406
|
+
};
|
|
407
|
+
const onLoadingChanged = () => {
|
|
408
|
+
syncLoading();
|
|
409
|
+
notify();
|
|
410
|
+
};
|
|
411
|
+
/** Record a load failure for the element to paint. Cancelled loads are not failures. */
|
|
412
|
+
function fail(err) {
|
|
413
|
+
if (isCanceled(err)) return;
|
|
414
|
+
ctrl.error = describeError(err);
|
|
415
|
+
notify();
|
|
416
|
+
}
|
|
417
|
+
/** A load answered: the chart has data and any earlier failure is over. */
|
|
418
|
+
function succeed() {
|
|
419
|
+
ctrl.hasLoaded = true;
|
|
420
|
+
ctrl.error = null;
|
|
421
|
+
}
|
|
422
|
+
const onLoadError = (err) => {
|
|
423
|
+
syncLoading();
|
|
424
|
+
fail(err ?? /* @__PURE__ */ new Error("Request failed"));
|
|
425
|
+
};
|
|
426
|
+
function detach() {
|
|
427
|
+
if (!bound) return;
|
|
428
|
+
bound.off("changed", onChanged);
|
|
429
|
+
bound.off("loadingChanged", onLoadingChanged);
|
|
430
|
+
bound.off("loadError", onLoadError);
|
|
431
|
+
bound = null;
|
|
432
|
+
}
|
|
433
|
+
let dsOptionsSource = opts.dataSourceOptions;
|
|
434
|
+
let odataOptionsSource = opts.odataOptions;
|
|
435
|
+
let resolvedOpts = {};
|
|
436
|
+
/** The consumer's own `ds.filter(...)`, adopted (page path only). */
|
|
437
|
+
let externalBase = null;
|
|
438
|
+
/** What the source HELD after this controller's last `filter()` write (read back). */
|
|
439
|
+
let lastWrittenFilter = null;
|
|
440
|
+
let lastComposed = void 0;
|
|
441
|
+
let composeMemo = null;
|
|
442
|
+
function resolveBase() {
|
|
443
|
+
resolvedOpts = resolveDataSourceOptions(dsOptionsSource, odataOptionsSource);
|
|
444
|
+
return resolvedOpts;
|
|
445
|
+
}
|
|
446
|
+
/** A base `filter` for the source at hand: arrays and predicates as-is, a raw OData string dropped for an array source. */
|
|
447
|
+
function baseFilterFor(s) {
|
|
448
|
+
const f = resolvedOpts.filter;
|
|
449
|
+
if (f == null) return null;
|
|
450
|
+
if (typeof s?.store === "function" && !!s.store()) return f;
|
|
451
|
+
if (typeof f === "function") return f;
|
|
452
|
+
if (Array.isArray(f) && f.length === 1 && typeof f[0] === "string") return null;
|
|
453
|
+
return compileFilterPredicate(f);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* `loadAll: false` — the source's own page is what renders, so the base goes
|
|
457
|
+
* onto the source. Adoption rule as in the grid: what the source holds that is
|
|
458
|
+
* not this controller's last write is the consumer's, and becomes the base.
|
|
459
|
+
*/
|
|
460
|
+
function applyBaseToSource(s) {
|
|
461
|
+
if (typeof s.filter === "function") {
|
|
462
|
+
const live = s.filter() ?? null;
|
|
463
|
+
if (live !== lastWrittenFilter) externalBase = live;
|
|
464
|
+
const own = baseFilterFor(s);
|
|
465
|
+
const remote = typeof s.store === "function" && !!s.store();
|
|
466
|
+
let next;
|
|
467
|
+
if (composeMemo && composeMemo.own === own && composeMemo.ext === externalBase) next = composeMemo.out;
|
|
468
|
+
else {
|
|
469
|
+
next = remote ? andFilters(own, externalBase) : andPredicates(own, externalBase);
|
|
470
|
+
composeMemo = {
|
|
471
|
+
own,
|
|
472
|
+
ext: externalBase,
|
|
473
|
+
out: next
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
if (next !== lastComposed || (s.filter() ?? null) !== lastWrittenFilter) {
|
|
477
|
+
s.filter(next);
|
|
478
|
+
lastComposed = next;
|
|
479
|
+
lastWrittenFilter = s.filter() ?? null;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (resolvedOpts.select !== void 0 && typeof s.select === "function") s.select(toList(resolvedOpts.select) ?? null);
|
|
483
|
+
if (resolvedOpts.sort !== void 0 && typeof s.sort === "function") s.sort(normalizeSortList(resolvedOpts.sort));
|
|
484
|
+
const lo = typeof s.loadOptions === "function" ? s.loadOptions() : null;
|
|
485
|
+
if (lo && typeof lo === "object") Object.assign(lo, extraLoadOptions(resolvedOpts));
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* The bound source rolled up by the SERVER: ONE
|
|
489
|
+
* `$apply=filter(…)/groupby((groupBy),aggregate(…))` through the source's own
|
|
490
|
+
* store, one row per bucket, instead of draining every row to bucket them
|
|
491
|
+
* here. Same clause `odata.aggregate` builds, same transport the grid's header
|
|
492
|
+
* filter and summary use (`utils/data-source-apply`).
|
|
493
|
+
*
|
|
494
|
+
* `null` is the decline, and the drain is still the definition of the result:
|
|
495
|
+
* the path switched off (`serverApply: false`, or a backend that already
|
|
496
|
+
* rejected an `$apply` — the gate remembers), no `groupBy`, no explicit
|
|
497
|
+
* `series` (the clause needs the fields; `inferSeries` reads them off rows
|
|
498
|
+
* that are not there yet), a store that cannot carry an `$apply` (a
|
|
499
|
+
* CustomStore), a failed request, or rows that are not buckets (a server that
|
|
500
|
+
* ignored the clause hands back entities — `isRolledUp`).
|
|
501
|
+
*
|
|
502
|
+
* The filter is what the drain would see: the base ∧ the source's live
|
|
503
|
+
* `filter()` ∧ its search, folded INSIDE the clause.
|
|
504
|
+
*/
|
|
505
|
+
async function rollUpViaStore(s) {
|
|
506
|
+
if (applyGate.skip || !opts.groupBy) return null;
|
|
507
|
+
const specs = series.filter((sp) => sp?.field);
|
|
508
|
+
if (!specs.length) return null;
|
|
509
|
+
const store = typeof s.store === "function" ? s.store() : null;
|
|
510
|
+
if (!store) return null;
|
|
511
|
+
const apply = buildChartApply(opts.groupBy, specs);
|
|
512
|
+
const filter = andFilters(baseFilterFor(s), summaryFilterOf(s));
|
|
513
|
+
let rolled;
|
|
514
|
+
try {
|
|
515
|
+
rolled = await loadApply(store, composeApply(apply, filter));
|
|
516
|
+
} catch (err) {
|
|
517
|
+
applyGate.reject(err);
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
if (!rolled) return null;
|
|
521
|
+
return isRolledUp(rolled, [opts.groupBy, ...specs.map((sp) => sp.field)]) ? rolled : null;
|
|
522
|
+
}
|
|
523
|
+
/** Mirror the source's rows onto `ctrl`, re-project, then notify. */
|
|
524
|
+
async function sync() {
|
|
525
|
+
preAggregated = false;
|
|
526
|
+
resolveBase();
|
|
527
|
+
if (!bound) rows = [];
|
|
528
|
+
else if (opts.loadAll === false) {
|
|
529
|
+
rows = [...bound.items?.() ?? []];
|
|
530
|
+
if (rows.length) succeed();
|
|
531
|
+
} else {
|
|
532
|
+
drainDepth++;
|
|
533
|
+
syncLoading();
|
|
534
|
+
try {
|
|
535
|
+
const rolled = await rollUpViaStore(bound);
|
|
536
|
+
if (rolled) {
|
|
537
|
+
rows = rolled;
|
|
538
|
+
preAggregated = true;
|
|
539
|
+
} else {
|
|
540
|
+
const base = resolvedOpts;
|
|
541
|
+
const filter = baseFilterFor(bound);
|
|
542
|
+
const loadOptions = extraLoadOptions(base);
|
|
543
|
+
const isArray = !(typeof bound.store === "function" && bound.store());
|
|
544
|
+
const drained = await readAllRows(bound, {
|
|
545
|
+
chunkSize: opts.chunkSize ?? 100,
|
|
546
|
+
...filter != null && !isArray ? { filter } : {},
|
|
547
|
+
...base.select !== void 0 ? { select: toList(base.select) } : {},
|
|
548
|
+
...base.sort !== void 0 ? { sort: normalizeSortList(base.sort) } : {},
|
|
549
|
+
...Object.keys(loadOptions).length ? { loadOptions } : {}
|
|
550
|
+
});
|
|
551
|
+
rows = isArray && typeof filter === "function" ? drained.filter(filter) : drained;
|
|
552
|
+
}
|
|
553
|
+
succeed();
|
|
554
|
+
} catch (err) {
|
|
555
|
+
fail(err);
|
|
556
|
+
throw err;
|
|
557
|
+
} finally {
|
|
558
|
+
drainDepth--;
|
|
559
|
+
syncLoading();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
ctrl.items = rows;
|
|
563
|
+
project();
|
|
564
|
+
notify();
|
|
565
|
+
}
|
|
566
|
+
function bind(next) {
|
|
567
|
+
if (isRawData(next)) {
|
|
568
|
+
detach();
|
|
569
|
+
raw = next;
|
|
570
|
+
rows = [];
|
|
571
|
+
succeed();
|
|
572
|
+
ctrl.items = rows;
|
|
573
|
+
ctrl.dataSource = null;
|
|
574
|
+
project();
|
|
575
|
+
notify();
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
raw = null;
|
|
579
|
+
const src = Array.isArray(next) ? monoArraySource(next, { pageSize: 0 }) : next;
|
|
580
|
+
if (bound === src) return;
|
|
581
|
+
detach();
|
|
582
|
+
bound = src;
|
|
583
|
+
ctrl.dataSource = src;
|
|
584
|
+
ctrl.hasLoaded = false;
|
|
585
|
+
ctrl.error = null;
|
|
586
|
+
if (!src) {
|
|
587
|
+
sync().catch(() => {});
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
src.on("changed", onChanged);
|
|
591
|
+
src.on("loadingChanged", onLoadingChanged);
|
|
592
|
+
src.on("loadError", onLoadError);
|
|
593
|
+
sync().catch(() => {});
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Load through `monoOdataFetch`.
|
|
597
|
+
*
|
|
598
|
+
* With `odata.aggregate` this is ONE request: the server rolls the data up with
|
|
599
|
+
* `$apply` and returns a row per bucket, instead of the chart draining every row
|
|
600
|
+
* to sum them locally. Without it, rows are fetched normally and `options`
|
|
601
|
+
* (`select` / `filter` / `take`) is what keeps the payload small.
|
|
602
|
+
*
|
|
603
|
+
* `@mono-lit/utility` is imported on demand — it is an OPTIONAL peer, so a consumer that
|
|
604
|
+
* never sets `odata` neither installs nor loads it (same arrangement as
|
|
605
|
+
* `chart.js` itself).
|
|
606
|
+
*/
|
|
607
|
+
async function loadOdata() {
|
|
608
|
+
const od = opts.odata;
|
|
609
|
+
if (!od?.url) return;
|
|
610
|
+
let fetching;
|
|
611
|
+
try {
|
|
612
|
+
fetching = await import("@mono-lit/utility/fetching");
|
|
613
|
+
} catch (err) {
|
|
614
|
+
throw new Error("[mono-chart] `odata` needs the optional peer dependency \"@mono-lit/utility\". Install it in your app: pnpm add @mono-lit/utility" + (err?.message ? ` (original error: ${err.message})` : ""));
|
|
615
|
+
}
|
|
616
|
+
const request = buildChartOdataRequest({
|
|
617
|
+
options: od.options,
|
|
618
|
+
base: resolveBase(),
|
|
619
|
+
aggregate: od.aggregate,
|
|
620
|
+
groupBy: opts.groupBy,
|
|
621
|
+
series
|
|
622
|
+
});
|
|
623
|
+
setLoading(true);
|
|
624
|
+
try {
|
|
625
|
+
const res = await fetching.monoOdataFetch({
|
|
626
|
+
baseUrl: od.baseUrl,
|
|
627
|
+
configBaseUrl: od.configBaseUrl,
|
|
628
|
+
url: od.url,
|
|
629
|
+
method: od.method,
|
|
630
|
+
type: "data",
|
|
631
|
+
notif: false,
|
|
632
|
+
options: request.options,
|
|
633
|
+
...Object.keys(request.params).length ? { params: request.params } : {}
|
|
634
|
+
});
|
|
635
|
+
if (res?.error) throw new Error(res.error.message ?? "odata request failed");
|
|
636
|
+
rows = res?.data ?? [];
|
|
637
|
+
preAggregated = request.aggregated;
|
|
638
|
+
succeed();
|
|
639
|
+
} catch (err) {
|
|
640
|
+
fail(err);
|
|
641
|
+
throw err;
|
|
642
|
+
} finally {
|
|
643
|
+
setLoading(false);
|
|
644
|
+
}
|
|
645
|
+
ctrl.items = rows;
|
|
646
|
+
project();
|
|
647
|
+
notify();
|
|
648
|
+
}
|
|
649
|
+
async function reload() {
|
|
650
|
+
if (opts.odata?.url) {
|
|
651
|
+
await loadOdata();
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
drainDepth++;
|
|
655
|
+
syncLoading();
|
|
656
|
+
try {
|
|
657
|
+
if (opts.loadAll === false && bound?.load) {
|
|
658
|
+
resolveBase();
|
|
659
|
+
applyBaseToSource(bound);
|
|
660
|
+
try {
|
|
661
|
+
await bound.load();
|
|
662
|
+
succeed();
|
|
663
|
+
} catch (err) {
|
|
664
|
+
fail(err);
|
|
665
|
+
throw err;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
await sync();
|
|
669
|
+
} finally {
|
|
670
|
+
drainDepth--;
|
|
671
|
+
syncLoading();
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
async function setDataSourceOptions(next) {
|
|
675
|
+
dsOptionsSource = next;
|
|
676
|
+
await reload();
|
|
677
|
+
}
|
|
678
|
+
async function setOdataOptions(next) {
|
|
679
|
+
odataOptionsSource = next;
|
|
680
|
+
await reload();
|
|
681
|
+
}
|
|
682
|
+
function resolvedDataSourceOptions() {
|
|
683
|
+
return resolvedOpts;
|
|
684
|
+
}
|
|
685
|
+
function setType(next) {
|
|
686
|
+
if (ctrl.type === next) return;
|
|
687
|
+
ctrl.type = next;
|
|
688
|
+
project();
|
|
689
|
+
notify();
|
|
690
|
+
}
|
|
691
|
+
function setSeries(next) {
|
|
692
|
+
series = [...next];
|
|
693
|
+
project();
|
|
694
|
+
notify();
|
|
695
|
+
}
|
|
696
|
+
function setColors(next) {
|
|
697
|
+
colors = next.length ? [...next] : [...DEFAULT_COLORS];
|
|
698
|
+
paletteIsDefault = !next.length;
|
|
699
|
+
project();
|
|
700
|
+
notify();
|
|
701
|
+
}
|
|
702
|
+
function setData(next) {
|
|
703
|
+
preAggregated = false;
|
|
704
|
+
bind(next);
|
|
705
|
+
}
|
|
706
|
+
/** Resolve a clicked point back to the rows that produced it. */
|
|
707
|
+
function pointEvent(datasetIndex, index) {
|
|
708
|
+
return {
|
|
709
|
+
index,
|
|
710
|
+
datasetIndex,
|
|
711
|
+
label: projected.labels?.[index],
|
|
712
|
+
value: projected.datasets[datasetIndex]?.data?.[index],
|
|
713
|
+
rows: buckets[index] ?? []
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
const ctrl = {
|
|
717
|
+
items: rows,
|
|
718
|
+
loading: false,
|
|
719
|
+
error: null,
|
|
720
|
+
hasLoaded: false,
|
|
721
|
+
type: opts.type ?? "bar",
|
|
722
|
+
dataSource: null,
|
|
723
|
+
get instance() {
|
|
724
|
+
return instance;
|
|
725
|
+
},
|
|
726
|
+
data: () => projected,
|
|
727
|
+
options: () => opts.options ?? {},
|
|
728
|
+
props: () => elementProps,
|
|
729
|
+
/**
|
|
730
|
+
* Merge, not replace — a partial patch leaves everything else alone.
|
|
731
|
+
* `undefined` values pass straight through: `applyProps` skips them on the
|
|
732
|
+
* write side, so "not declared" can never clobber a value the template set.
|
|
733
|
+
*/
|
|
734
|
+
setProps(patch) {
|
|
735
|
+
if (!patch) return;
|
|
736
|
+
Object.assign(elementProps, patch);
|
|
737
|
+
notify();
|
|
738
|
+
},
|
|
739
|
+
setType,
|
|
740
|
+
setSeries,
|
|
741
|
+
setColors,
|
|
742
|
+
setData,
|
|
743
|
+
bind,
|
|
744
|
+
reload,
|
|
745
|
+
refresh: reload,
|
|
746
|
+
async retry() {
|
|
747
|
+
ctrl.error = null;
|
|
748
|
+
notify();
|
|
749
|
+
await reload().catch(() => {});
|
|
750
|
+
},
|
|
751
|
+
setDataSourceOptions,
|
|
752
|
+
setOdataOptions,
|
|
753
|
+
resolvedDataSourceOptions,
|
|
754
|
+
onPointClick: null,
|
|
755
|
+
subscribe: notifier.subscribe,
|
|
756
|
+
dispose() {
|
|
757
|
+
detach();
|
|
758
|
+
notifier.clear();
|
|
759
|
+
instance = null;
|
|
760
|
+
},
|
|
761
|
+
_attachInstance(next) {
|
|
762
|
+
instance = next;
|
|
763
|
+
},
|
|
764
|
+
_setColorResolver(fn) {
|
|
765
|
+
resolveColor = fn ?? ((c) => NAME_FALLBACK[c] ?? c);
|
|
766
|
+
project();
|
|
767
|
+
notify();
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
ctrl._emitPoint = (d, i) => {
|
|
771
|
+
ctrl.onPointClick?.(pointEvent(d, i));
|
|
772
|
+
};
|
|
773
|
+
if (source) bind(source);
|
|
774
|
+
else project();
|
|
775
|
+
if (!source && opts.odata?.url) loadOdata().catch(() => {});
|
|
776
|
+
return ctrl;
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
export { composeApply as i, buildChartApply as n, buildChartOdataRequest as r, monoChart as t };
|