@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,871 @@
|
|
|
1
|
+
import { a as parseFieldPath, c as toODataClause, n as isPath, t as getFieldValue } from "./field-path-C92eGLg3.js";
|
|
2
|
+
import { i as joinFilters, r as compileFilterPredicate, t as andFilters } from "./filter-eval-DIfU2EAn.js";
|
|
3
|
+
//#region src/search/search-expr.ts
|
|
4
|
+
/**
|
|
5
|
+
* Search-expression entries: the fields a typed term is matched against.
|
|
6
|
+
*
|
|
7
|
+
* One grammar, shared by every component that searches data — `monoDataGrid`'s
|
|
8
|
+
* `searchExpr`, and the `search-value` prop on `mono-select`, `mono-tag-input`
|
|
9
|
+
* and `mono-dropdown-table`. An entry may be:
|
|
10
|
+
*
|
|
11
|
+
* - a plain column name (`'Nama'`)
|
|
12
|
+
* - a **path** (`'Company.Name'`, `'Transaction.[1].Name'`, `'Transaction.[*].Price'`)
|
|
13
|
+
* - a **`*` pattern** (`'*'`, `'Company.*'`, `'*.*'`, `'*.[*].*'`)
|
|
14
|
+
* - a **`{ field, custom }` clause builder**
|
|
15
|
+
*
|
|
16
|
+
* An entry is normally just a column name, and every column is searched the same
|
|
17
|
+
* way — `contains(<col>,'<term>')`. That is wrong for any column whose data isn't
|
|
18
|
+
* free text: a **boolean** can't take `contains` at all, and a **coded** column
|
|
19
|
+
* stores something the user never types (a `Month` of `0..11` can never match the
|
|
20
|
+
* string `"Jan"`).
|
|
21
|
+
*
|
|
22
|
+
* So an entry may instead be `{ field, custom }`, where `custom` receives the live
|
|
23
|
+
* term and returns the clause to use for that column:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const MONTHS = ['Jan', 'Feb', 'Mar', …]
|
|
27
|
+
*
|
|
28
|
+
* searchExpr: [
|
|
29
|
+
* 'Code',
|
|
30
|
+
* 'Nama',
|
|
31
|
+
* { field: 'Active', custom: ({ field, value }) => `${field} eq ${value}` },
|
|
32
|
+
* { field: 'Month', custom: ({ field, value }) => [field, '=', MONTHS.indexOf(value)] },
|
|
33
|
+
* ]
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* A custom column takes part in the plain search box like any other, so it runs on
|
|
37
|
+
* every term. **Return `null`/`undefined` to opt out** of one — which is what makes
|
|
38
|
+
* the `Month` example workable: `"Jan"` → `0`, `"zzz"` → `-1` → return `null` and
|
|
39
|
+
* the column simply drops out of that query instead of matching nothing.
|
|
40
|
+
*
|
|
41
|
+
* | `custom` returns | remote (devextreme store) | array / in-memory |
|
|
42
|
+
* | --- | --- | --- |
|
|
43
|
+
* | `[field, op, value]`, or a nested `and`/`or` array | used as-is | compiled to a predicate |
|
|
44
|
+
* | `(row) => boolean` | warn + skip | used as the predicate |
|
|
45
|
+
* | `"Active eq true"` (raw OData) | wrapped as `[raw]` | warn + skip |
|
|
46
|
+
* | `null` / `undefined` / `false` | skipped | skipped |
|
|
47
|
+
*
|
|
48
|
+
* Only the explicit `{ field, custom }` shape is accepted — a `{ Month: fn }` map
|
|
49
|
+
* is not, so there is exactly one form to read and to type.
|
|
50
|
+
*
|
|
51
|
+
* An entry may also be a **`*` pattern**, resolved against the loaded rows so a
|
|
52
|
+
* grid can search everything without listing columns:
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* searchExpr: ['*'] // every top-level field
|
|
56
|
+
* searchExpr: ['*', '*.[*].*'] // …plus every field of every array expand
|
|
57
|
+
* searchExpr: ['*', '*.*'] // …plus every field of every object expand
|
|
58
|
+
* searchExpr: ['*', { field: 'Month', custom }] // the explicit entry wins for Month
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* Patterns read literally, segment by segment — `'*.[*].*'` covers the expand ONLY.
|
|
62
|
+
* See {@link expandWildcard} for the type rule that keeps a remote `$filter` valid.
|
|
63
|
+
*
|
|
64
|
+
* This module is pure: types + stateless helpers, no controller state, mirroring
|
|
65
|
+
* `field-path.ts`.
|
|
66
|
+
*/
|
|
67
|
+
/** Entries already warned about, so a per-keystroke path can't flood the console. */
|
|
68
|
+
var warned = /* @__PURE__ */ new WeakSet();
|
|
69
|
+
function warnOnce(key, message) {
|
|
70
|
+
if (warned.has(key)) return;
|
|
71
|
+
warned.add(key);
|
|
72
|
+
console.warn(`[@mono-lit/helper] ${message}`);
|
|
73
|
+
}
|
|
74
|
+
/** Malformed entries are warned about once each, keyed by the object itself. */
|
|
75
|
+
function isCustomEntry(entry) {
|
|
76
|
+
if (typeof entry !== "object" || entry === null) return false;
|
|
77
|
+
const e = entry;
|
|
78
|
+
if (typeof e.field === "string" && e.field && typeof e.custom === "function") return true;
|
|
79
|
+
warnOnce(entry, `searchExpr: ignoring an entry that is neither a column name nor { field, custom } — ${JSON.stringify(Object.keys(entry))}. The { Field: fn } shorthand is not supported.`);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
/** Every usable entry, in the order written. Strings and customs, malformed dropped. */
|
|
83
|
+
function normalizeSearchExpr(expr) {
|
|
84
|
+
if (expr == null) return [];
|
|
85
|
+
const list = Array.isArray(expr) ? expr : [expr];
|
|
86
|
+
const out = [];
|
|
87
|
+
for (const entry of list) if (typeof entry === "string") {
|
|
88
|
+
if (entry) out.push(entry);
|
|
89
|
+
} else if (isCustomEntry(entry)) out.push(entry);
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The plain column names only — no `{ field, custom }` entries, no `*` patterns.
|
|
94
|
+
*
|
|
95
|
+
* This is what a SOURCE may be handed: `monoArraySource`, `storeGroupSource` and
|
|
96
|
+
* devextreme all type `searchExpr` as `string | string[]` and feed it straight to
|
|
97
|
+
* `toODataClause` — an object entry would serialize to garbage and a `'*'` would
|
|
98
|
+
* be searched as a column literally named `*`. Both are resolved by the controller
|
|
99
|
+
* instead.
|
|
100
|
+
*/
|
|
101
|
+
function plainSearchColumns(expr) {
|
|
102
|
+
return normalizeSearchExpr(expr).filter((e) => typeof e === "string" && !isWildcardPattern(e));
|
|
103
|
+
}
|
|
104
|
+
/** The field name an entry covers. */
|
|
105
|
+
function searchEntryField(entry) {
|
|
106
|
+
return typeof entry === "string" ? entry : entry.field;
|
|
107
|
+
}
|
|
108
|
+
/** The entry declaring `field`, if any — used to resolve a column-bound term. */
|
|
109
|
+
function searchEntryFor(expr, field) {
|
|
110
|
+
return normalizeSearchExpr(expr).find((e) => searchEntryField(e) === field);
|
|
111
|
+
}
|
|
112
|
+
/** Whether any entry brings its own builder (so folding must be bypassed). */
|
|
113
|
+
function hasCustomSearch(expr) {
|
|
114
|
+
return normalizeSearchExpr(expr).some((e) => typeof e !== "string");
|
|
115
|
+
}
|
|
116
|
+
/** Whether `field` is a `*` pattern rather than a concrete column/path. */
|
|
117
|
+
function isWildcardPattern(field) {
|
|
118
|
+
if (typeof field !== "string" || !field.includes("*")) return false;
|
|
119
|
+
return parseFieldPath(field).segments.some((s) => s.kind === "key" && s.name === "*");
|
|
120
|
+
}
|
|
121
|
+
/** A value that can be searched as-is (anything that isn't a container). */
|
|
122
|
+
function isLeaf(value) {
|
|
123
|
+
return value !== null && typeof value !== "object";
|
|
124
|
+
}
|
|
125
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
126
|
+
/** How many rows to sample when resolving a pattern (row 0 alone may be sparse). */
|
|
127
|
+
var SAMPLE_ROWS = 20;
|
|
128
|
+
/**
|
|
129
|
+
* Resolve a `*` pattern against real rows, returning the concrete field paths it
|
|
130
|
+
* covers — `'*.[*].*'` over `{ Detail: [{ Bulan, Ket }] }` gives
|
|
131
|
+
* `['Detail.[*].Bulan', 'Detail.[*].Ket']`, which the existing path machinery
|
|
132
|
+
* already knows how to match client-side and translate to an OData lambda.
|
|
133
|
+
*
|
|
134
|
+
* `textOnly` drops every leaf that isn't a string. A REMOTE source needs that:
|
|
135
|
+
* `contains(Price,'x')` is not valid OData and would reject the whole request, so
|
|
136
|
+
* a wildcard never emits a clause for a numeric/boolean/date column. Give such a
|
|
137
|
+
* column an explicit `{ field, custom }` entry instead. In-memory sources compare
|
|
138
|
+
* stringified values, so they keep every leaf.
|
|
139
|
+
*
|
|
140
|
+
* A field that is `null`/`undefined` in every sampled row is skipped — there is
|
|
141
|
+
* nothing to type it by.
|
|
142
|
+
*/
|
|
143
|
+
function expandWildcard(pattern, rows, textOnly) {
|
|
144
|
+
const { segments } = parseFieldPath(pattern);
|
|
145
|
+
const found = /* @__PURE__ */ new Set();
|
|
146
|
+
for (const row of rows.slice(0, SAMPLE_ROWS)) {
|
|
147
|
+
let candidates = [{
|
|
148
|
+
path: [],
|
|
149
|
+
value: row
|
|
150
|
+
}];
|
|
151
|
+
for (const seg of segments) {
|
|
152
|
+
const next = [];
|
|
153
|
+
for (const { path, value } of candidates) {
|
|
154
|
+
if (value == null) continue;
|
|
155
|
+
if (seg.kind === "wildcard") {
|
|
156
|
+
if (Array.isArray(value)) for (const el of value) next.push({
|
|
157
|
+
path: [...path, "[*]"],
|
|
158
|
+
value: el
|
|
159
|
+
});
|
|
160
|
+
} else if (seg.kind === "index") {
|
|
161
|
+
if (Array.isArray(value)) next.push({
|
|
162
|
+
path: [...path, `[${seg.index}]`],
|
|
163
|
+
value: value[seg.index]
|
|
164
|
+
});
|
|
165
|
+
} else if (seg.name === "*") {
|
|
166
|
+
if (isPlainObject(value)) for (const key of Object.keys(value)) next.push({
|
|
167
|
+
path: [...path, key],
|
|
168
|
+
value: value[key]
|
|
169
|
+
});
|
|
170
|
+
} else if (isPlainObject(value)) next.push({
|
|
171
|
+
path: [...path, seg.name],
|
|
172
|
+
value: value[seg.name]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
candidates = next;
|
|
176
|
+
if (!candidates.length) break;
|
|
177
|
+
}
|
|
178
|
+
for (const { path, value } of candidates) {
|
|
179
|
+
if (!path.length || !isLeaf(value)) continue;
|
|
180
|
+
if (textOnly && typeof value !== "string") continue;
|
|
181
|
+
found.add(path.join("."));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return [...found];
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The entries a search actually runs over: every `*` pattern replaced by the
|
|
188
|
+
* concrete fields it resolves to, in place.
|
|
189
|
+
*
|
|
190
|
+
* **An explicitly named field always wins.** A field named anywhere in the list —
|
|
191
|
+
* as a plain string or as `{ field, custom }` — is dropped from every pattern
|
|
192
|
+
* expansion regardless of order, so `['*', { field: 'Name', custom }]` and
|
|
193
|
+
* `[{ field: 'Name', custom }, '*']` both search `Name` with the custom, exactly
|
|
194
|
+
* once, at the position it was written.
|
|
195
|
+
*/
|
|
196
|
+
function resolveSearchEntries(expr, options = {}) {
|
|
197
|
+
const entries = normalizeSearchExpr(expr);
|
|
198
|
+
if (!entries.some((e) => typeof e === "string" && isWildcardPattern(e))) return entries;
|
|
199
|
+
const { rows = [], textOnly = false } = options;
|
|
200
|
+
const explicit = new Set(entries.filter((e) => typeof e !== "string" || !isWildcardPattern(e)).map((e) => searchEntryField(e)));
|
|
201
|
+
const out = [];
|
|
202
|
+
const seen = /* @__PURE__ */ new Set();
|
|
203
|
+
for (const entry of entries) {
|
|
204
|
+
if (typeof entry === "string" && isWildcardPattern(entry)) {
|
|
205
|
+
for (const field of expandWildcard(entry, rows, textOnly)) {
|
|
206
|
+
if (explicit.has(field) || seen.has(field)) continue;
|
|
207
|
+
seen.add(field);
|
|
208
|
+
out.push(field);
|
|
209
|
+
}
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
const field = searchEntryField(entry);
|
|
213
|
+
if (seen.has(field)) continue;
|
|
214
|
+
seen.add(field);
|
|
215
|
+
out.push(entry);
|
|
216
|
+
}
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
/** Whether any entry is a `*` pattern (so folding must be bypassed). */
|
|
220
|
+
function hasWildcardSearch(expr) {
|
|
221
|
+
return normalizeSearchExpr(expr).some((e) => typeof e === "string" && isWildcardPattern(e));
|
|
222
|
+
}
|
|
223
|
+
/** Run the builder, guarding against a throw in consumer code. */
|
|
224
|
+
function runCustom(entry, value, operation) {
|
|
225
|
+
try {
|
|
226
|
+
return entry.custom({
|
|
227
|
+
field: entry.field,
|
|
228
|
+
value,
|
|
229
|
+
operation
|
|
230
|
+
});
|
|
231
|
+
} catch (error) {
|
|
232
|
+
warnOnce(entry, `searchExpr custom for "${entry.field}" threw — column skipped. ${error}`);
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The devextreme filter clause for one custom entry + term, or `null` to skip it.
|
|
238
|
+
*
|
|
239
|
+
* A raw string is wrapped as `[raw]` — the single-member raw-passthrough clause
|
|
240
|
+
* devextreme honours inside a filter array, the same shape `toODataClause` emits
|
|
241
|
+
* for a wildcard lambda, so it slots into the OR/AND groups unchanged.
|
|
242
|
+
*/
|
|
243
|
+
function customRemoteClause(entry, value, operation) {
|
|
244
|
+
const result = runCustom(entry, value, operation);
|
|
245
|
+
if (result == null || result === false) return null;
|
|
246
|
+
if (typeof result === "string") return result ? [result] : null;
|
|
247
|
+
if (Array.isArray(result)) return result.length ? result : null;
|
|
248
|
+
if (typeof result === "function") warnOnce(entry, `searchExpr custom for "${entry.field}" returned a predicate function, which a remote source can't send — column skipped. Return a filter array or an OData string for remote sources.`);
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The client-side row predicate for one custom entry + term, or `null` to skip it.
|
|
253
|
+
*
|
|
254
|
+
* Filter arrays go through `compileFilterPredicate`, which already understands
|
|
255
|
+
* nested `and`/`or` groups, `['!', …]` negation and path fields — so the SAME
|
|
256
|
+
* `[field, op, value]` a remote source receives also narrows an array source.
|
|
257
|
+
*/
|
|
258
|
+
function customPredicate(entry, value, operation) {
|
|
259
|
+
const result = runCustom(entry, value, operation);
|
|
260
|
+
if (result == null || result === false) return null;
|
|
261
|
+
if (typeof result === "function") return result;
|
|
262
|
+
if (Array.isArray(result)) return result.length ? compileFilterPredicate(result) : null;
|
|
263
|
+
if (typeof result === "string") warnOnce(entry, `searchExpr custom for "${entry.field}" returned the raw OData string ${JSON.stringify(result)}, which only a remote source can use — column skipped for this in-memory source. Return a filter array to support both.`);
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/search/data-search.ts
|
|
268
|
+
/**
|
|
269
|
+
* The shared search engine — one implementation of "match a typed term against
|
|
270
|
+
* a set of fields", used by every component that searches data.
|
|
271
|
+
*
|
|
272
|
+
* `monoDataGrid` grew this pipeline first (paths, `*` patterns, `{ field, custom }`
|
|
273
|
+
* clause builders); this module lifts the reusable half out of the grid so
|
|
274
|
+
* `mono-select`, `mono-tag-input` and `mono-dropdown-table` share it verbatim
|
|
275
|
+
* rather than each re-deriving a weaker version.
|
|
276
|
+
*
|
|
277
|
+
* ## The `search-value` grammar
|
|
278
|
+
*
|
|
279
|
+
* A component's `search-value` prop accepts either form, interchangeably:
|
|
280
|
+
*
|
|
281
|
+
* ```ts
|
|
282
|
+
* // array — the full grammar, including custom clause builders
|
|
283
|
+
* :search-value.prop="['Company.Name', 'Transaction.[*].Price', '*.[*].*']"
|
|
284
|
+
*
|
|
285
|
+
* // comma-separated string — the same thing from plain HTML
|
|
286
|
+
* search-value="Company.Name,Transaction.[*].Price,*.[*].*"
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* Whitespace around a comma is trimmed, so `'a, b, c'` and `'a,b,c'` are equal.
|
|
290
|
+
* A comma is never part of a path or a pattern, so splitting on it is lossless —
|
|
291
|
+
* only `{ field, custom }` entries need the array form.
|
|
292
|
+
*
|
|
293
|
+
* ## The two output shapes
|
|
294
|
+
*
|
|
295
|
+
* A search has to be expressed twice, because the two source kinds evaluate it in
|
|
296
|
+
* different places:
|
|
297
|
+
*
|
|
298
|
+
* - **remote** (a devextreme store): a `$filter` expression → {@link searchRemoteFilter}
|
|
299
|
+
* - **array / in-memory**: a `(row) => boolean` → {@link searchRowPredicate}
|
|
300
|
+
*
|
|
301
|
+
* Both are built from the SAME resolved entry list, so the two paths can't drift.
|
|
302
|
+
*
|
|
303
|
+
* ## Why a source can't always do it itself
|
|
304
|
+
*
|
|
305
|
+
* devextreme folds `searchValue` + `searchExpr` into the request on its own, which
|
|
306
|
+
* is cheaper and is kept for the common case. But folding emits exactly
|
|
307
|
+
* `contains(<col>,'<term>')` per column, so it cannot express a nav path
|
|
308
|
+
* (`Job/Name`), a collection lambda (`Nav/any(...)`) or a custom clause.
|
|
309
|
+
* {@link isFoldableSearch} decides; {@link MonoSourceSearch} routes.
|
|
310
|
+
*/
|
|
311
|
+
/** The default devextreme search operation. */
|
|
312
|
+
var DEFAULT_SEARCH_OPERATION = "contains";
|
|
313
|
+
/**
|
|
314
|
+
* Split the string form of `search-value` on commas.
|
|
315
|
+
*
|
|
316
|
+
* Kept separate from {@link resolveSearchFields} so a component can show a user
|
|
317
|
+
* what its raw prop parsed to without also resolving `*` patterns against data.
|
|
318
|
+
*/
|
|
319
|
+
function parseSearchValue(value) {
|
|
320
|
+
if (value == null) return [];
|
|
321
|
+
if (Array.isArray(value)) return normalizeSearchExpr(value);
|
|
322
|
+
if (typeof value !== "string") return [];
|
|
323
|
+
return normalizeSearchExpr(value.split(",").map((s) => s.trim()).filter(Boolean));
|
|
324
|
+
}
|
|
325
|
+
/** The spellings, in the order a merge reads them. */
|
|
326
|
+
var SEARCH_FIELDS_KEYS = [
|
|
327
|
+
"searchExpr",
|
|
328
|
+
"search-expr",
|
|
329
|
+
"searchValue",
|
|
330
|
+
"search-value"
|
|
331
|
+
];
|
|
332
|
+
/**
|
|
333
|
+
* Merge every spelling present into one entry list, de-duplicated by field name.
|
|
334
|
+
*
|
|
335
|
+
* They all mean the same thing, so passing two of them means the union rather
|
|
336
|
+
* than one silently shadowing the other. Order only decides *position* among
|
|
337
|
+
* equal field names — first occurrence wins, so a `{ field, custom }` entry
|
|
338
|
+
* written under one spelling isn't displaced by a plain column under another.
|
|
339
|
+
*
|
|
340
|
+
* Returns **`undefined` when none of the keys is present**, which callers rely on
|
|
341
|
+
* to mean "not configured at all" — distinctly different from `[]` ("configured,
|
|
342
|
+
* but empty"). The grid uses that difference to decide whether to leave a data
|
|
343
|
+
* source's own `searchExpr` alone.
|
|
344
|
+
*/
|
|
345
|
+
function mergeSearchFields(src) {
|
|
346
|
+
if (!src) return void 0;
|
|
347
|
+
let present = false;
|
|
348
|
+
const out = [];
|
|
349
|
+
const seen = /* @__PURE__ */ new Set();
|
|
350
|
+
for (const key of SEARCH_FIELDS_KEYS) {
|
|
351
|
+
const raw = src[key];
|
|
352
|
+
if (raw === void 0) continue;
|
|
353
|
+
present = true;
|
|
354
|
+
for (const entry of parseSearchValue(raw)) {
|
|
355
|
+
const field = searchEntryField(entry);
|
|
356
|
+
if (seen.has(field)) continue;
|
|
357
|
+
seen.add(field);
|
|
358
|
+
out.push(entry);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return present ? out : void 0;
|
|
362
|
+
}
|
|
363
|
+
/** The default when nothing is configured: every top-level field. */
|
|
364
|
+
var DEFAULT_SEARCH_FIELDS = ["*"];
|
|
365
|
+
/**
|
|
366
|
+
* The entries a search actually runs over: the prop parsed, the fallbacks applied
|
|
367
|
+
* when it's empty, and every `*` pattern expanded against `rows`.
|
|
368
|
+
*
|
|
369
|
+
* Call this **once per query**, never per row — a pattern samples up to 20 rows,
|
|
370
|
+
* so resolving inside a row loop is O(rows × fields) on every keystroke.
|
|
371
|
+
*/
|
|
372
|
+
function resolveSearchFields(options = {}) {
|
|
373
|
+
const { searchValue, fallbackFields = [], rows = [], remote = false, defaultToWildcard = false } = options;
|
|
374
|
+
let entries = parseSearchValue(searchValue);
|
|
375
|
+
if (!entries.length) {
|
|
376
|
+
const fallbacks = fallbackFields.filter((f) => typeof f === "string" && !!f);
|
|
377
|
+
entries = defaultToWildcard ? [...DEFAULT_SEARCH_FIELDS, ...fallbacks] : fallbacks;
|
|
378
|
+
}
|
|
379
|
+
if (!entries.length) return [];
|
|
380
|
+
return resolveSearchEntries(entries, {
|
|
381
|
+
rows,
|
|
382
|
+
textOnly: remote
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Whether a source's own `searchValue`/`searchExpr` folding can express these
|
|
387
|
+
* entries — true only for plain top-level column names.
|
|
388
|
+
*
|
|
389
|
+
* A path needs a nav selector or an `any()` lambda and a custom brings its own
|
|
390
|
+
* clause; folding would silently search either with a flat `contains` instead.
|
|
391
|
+
*/
|
|
392
|
+
function isFoldableSearch(entries) {
|
|
393
|
+
return entries.every((e) => typeof e === "string" && !isPath(e) && !isWildcardPattern(e));
|
|
394
|
+
}
|
|
395
|
+
/** The plain column names among `entries` — what a source may safely be handed. */
|
|
396
|
+
function plainSearchFields(entries) {
|
|
397
|
+
return entries.filter((e) => typeof e === "string" && !isWildcardPattern(e));
|
|
398
|
+
}
|
|
399
|
+
/** Compare one resolved value against the needle using a devextreme operation. */
|
|
400
|
+
function matchesValue(value, needle, operation) {
|
|
401
|
+
const s = String(value ?? "").toLowerCase();
|
|
402
|
+
const n = needle.toLowerCase();
|
|
403
|
+
if (operation === "startswith") return s.startsWith(n);
|
|
404
|
+
if (operation === "endswith") return s.endsWith(n);
|
|
405
|
+
if (operation === "=" || operation === "equals") return s === n;
|
|
406
|
+
if (operation === "notcontains") return !s.includes(n);
|
|
407
|
+
return s.includes(n);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Read a field off a row, path-aware. A wildcard path resolves to an array of
|
|
411
|
+
* every match, so the caller matches if ANY element hits.
|
|
412
|
+
*/
|
|
413
|
+
function readSearchField(row, field) {
|
|
414
|
+
const raw = isPath(field) ? getFieldValue(row, field) : row?.[field];
|
|
415
|
+
return Array.isArray(raw) ? raw : [raw];
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* The client-side row test for one query, or `null` when there is nothing to
|
|
419
|
+
* match on.
|
|
420
|
+
*
|
|
421
|
+
* `null` means "no opinion" — the caller should keep every row rather than filter
|
|
422
|
+
* them all away, which is what a component with no configured fields wants.
|
|
423
|
+
*/
|
|
424
|
+
function searchRowPredicate(entries, query, operation = DEFAULT_SEARCH_OPERATION) {
|
|
425
|
+
const needle = String(query ?? "").trim();
|
|
426
|
+
if (!needle || !entries.length) return null;
|
|
427
|
+
return (row) => entries.some((entry) => {
|
|
428
|
+
if (typeof entry === "string") return readSearchField(row, entry).some((v) => matchesValue(v, needle, operation));
|
|
429
|
+
const pred = customPredicate(entry, needle, operation);
|
|
430
|
+
return pred ? pred(row) : false;
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* The devextreme `$filter` expression for one query — an OR across every entry —
|
|
435
|
+
* or `null` when there is nothing to send.
|
|
436
|
+
*/
|
|
437
|
+
function searchRemoteFilter(entries, query, operation = DEFAULT_SEARCH_OPERATION) {
|
|
438
|
+
const needle = String(query ?? "").trim();
|
|
439
|
+
if (!needle || !entries.length) return null;
|
|
440
|
+
return joinFilters(entries.map((entry) => typeof entry === "string" ? toODataClause(entry, operation, needle) : customRemoteClause(entry, needle, operation)).filter((c) => c != null), "or");
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Applies a search to a bound DataSource, choosing between the source's own
|
|
444
|
+
* folding and a controller-built `$filter`.
|
|
445
|
+
*
|
|
446
|
+
* The reason this needs to be an object rather than a function is the **base
|
|
447
|
+
* filter**: when the search can't be folded it has to live in `source.filter()`,
|
|
448
|
+
* which is also where the consumer's own filter lives. So the consumer's filter is
|
|
449
|
+
* captured and every search re-composes from that snapshot — otherwise each
|
|
450
|
+
* keystroke would AND another search clause onto the previous one and the filter
|
|
451
|
+
* would grow without bound.
|
|
452
|
+
*
|
|
453
|
+
* The snapshot is not taken once and kept. Before every apply (and every clear)
|
|
454
|
+
* the live `filter()` is compared against what this instance last WROTE: if it
|
|
455
|
+
* differs, the consumer changed the filter in the meantime — a watcher scoping
|
|
456
|
+
* the source — and that becomes the new base. Snapshotting only at `bind()` made
|
|
457
|
+
* the next keystroke overwrite such a filter with the stale one, and "restored"
|
|
458
|
+
* the stale one on clear.
|
|
459
|
+
*
|
|
460
|
+
* ```ts
|
|
461
|
+
* private _search = new MonoSourceSearch()
|
|
462
|
+
* // on `dataSource` change:
|
|
463
|
+
* this._search.bind(this.dataSource)
|
|
464
|
+
* // on a (debounced) query:
|
|
465
|
+
* await this._search.apply(this.dataSource, {
|
|
466
|
+
* query, searchValue: this.searchValue, fallbackFields: [...], rows, remote: true,
|
|
467
|
+
* })
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
var MonoSourceSearch = class {
|
|
471
|
+
constructor() {
|
|
472
|
+
this._source = null;
|
|
473
|
+
this._baseFilter = null;
|
|
474
|
+
this._wroteFilter = false;
|
|
475
|
+
this._lastWritten = null;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Snapshot a source's own filter. Safe to call repeatedly — the snapshot is
|
|
479
|
+
* only (re)taken when the source identity actually changes, so it can be driven
|
|
480
|
+
* straight from a `willUpdate` branch. A change on the SAME source is picked up
|
|
481
|
+
* by `_syncBase` at the next apply/clear instead.
|
|
482
|
+
*/
|
|
483
|
+
bind(source) {
|
|
484
|
+
if (source === this._source) return;
|
|
485
|
+
this._source = source ?? null;
|
|
486
|
+
this._baseFilter = source?.filter?.() ?? null;
|
|
487
|
+
this._lastWritten = this._baseFilter;
|
|
488
|
+
this._wroteFilter = false;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Adopt a filter the consumer set on the source since the last write —
|
|
492
|
+
* anything the source holds that is not what this instance last put there.
|
|
493
|
+
* `_writeFilter` records what the source HOLDS after a write (read back), so a
|
|
494
|
+
* source that ignores writes reads back as its own last write and is never
|
|
495
|
+
* re-adopted, and one that normalises compares against its normalised value.
|
|
496
|
+
*/
|
|
497
|
+
_syncBase(s) {
|
|
498
|
+
if (typeof s.filter !== "function") return;
|
|
499
|
+
const live = s.filter() ?? null;
|
|
500
|
+
if (live === this._lastWritten) return;
|
|
501
|
+
this._baseFilter = live;
|
|
502
|
+
this._wroteFilter = false;
|
|
503
|
+
}
|
|
504
|
+
/** Write `filter()` and remember what the source holds afterwards. */
|
|
505
|
+
_writeFilter(s, value) {
|
|
506
|
+
s.filter?.(value);
|
|
507
|
+
this._lastWritten = s.filter?.() ?? null;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Undo whatever this instance wrote onto the source, then forget it.
|
|
511
|
+
*
|
|
512
|
+
* `reset()` alone is not enough at teardown. With `defaultToWildcard`, a `'*'`
|
|
513
|
+
* entry is never foldable, so the search is AND-ed into `source.filter()` — the
|
|
514
|
+
* same slot the CONSUMER's own filter lives in. Only `apply()` ever restores the
|
|
515
|
+
* captured base (and only when the next apply happens to be foldable), so an
|
|
516
|
+
* element torn down mid-query used to leave its clause behind on a DataSource
|
|
517
|
+
* the app still owns and shares.
|
|
518
|
+
*
|
|
519
|
+
* Deliberately does NOT `load()`: teardown must not issue a request. The next
|
|
520
|
+
* consumer of the source reloads on its own terms.
|
|
521
|
+
*/
|
|
522
|
+
clear(source) {
|
|
523
|
+
const s = source ?? this._source;
|
|
524
|
+
if (s) {
|
|
525
|
+
this._syncBase(s);
|
|
526
|
+
s.searchValue?.(null);
|
|
527
|
+
if (this._wroteFilter) this._writeFilter(s, this._baseFilter ?? null);
|
|
528
|
+
}
|
|
529
|
+
this.reset();
|
|
530
|
+
}
|
|
531
|
+
/** Forget the captured state without touching the source. */
|
|
532
|
+
reset() {
|
|
533
|
+
this._source = null;
|
|
534
|
+
this._baseFilter = null;
|
|
535
|
+
this._lastWritten = null;
|
|
536
|
+
this._wroteFilter = false;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Push `query` onto `source` and reload it. Returns the resolved entries so a
|
|
540
|
+
* caller can reuse them for its own client-side rendering without re-resolving.
|
|
541
|
+
*/
|
|
542
|
+
async apply(source, options) {
|
|
543
|
+
const s = source;
|
|
544
|
+
if (!s) return [];
|
|
545
|
+
this.bind(source);
|
|
546
|
+
this._syncBase(s);
|
|
547
|
+
const operation = options.operation || "contains";
|
|
548
|
+
const entries = resolveSearchFields({
|
|
549
|
+
...options,
|
|
550
|
+
remote: options.remote ?? true
|
|
551
|
+
});
|
|
552
|
+
const query = String(options.query ?? "").trim();
|
|
553
|
+
if (isFoldableSearch(entries)) {
|
|
554
|
+
s.searchOperation?.(operation);
|
|
555
|
+
s.searchExpr?.(plainSearchFields(entries));
|
|
556
|
+
s.searchValue?.(query || null);
|
|
557
|
+
if (this._wroteFilter) {
|
|
558
|
+
this._writeFilter(s, this._baseFilter ?? null);
|
|
559
|
+
this._wroteFilter = false;
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
s.searchValue?.(null);
|
|
563
|
+
const expr = searchRemoteFilter(entries, query, operation);
|
|
564
|
+
this._writeFilter(s, andFilters(this._baseFilter ?? null, expr));
|
|
565
|
+
this._wroteFilter = expr != null;
|
|
566
|
+
}
|
|
567
|
+
s.pageIndex?.(0);
|
|
568
|
+
await Promise.resolve(s.load?.());
|
|
569
|
+
return entries;
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/utils/normalize-error.ts
|
|
574
|
+
/** Fields worth reading off an object that is not an `Error`. */
|
|
575
|
+
var MESSAGE_KEYS = [
|
|
576
|
+
"message",
|
|
577
|
+
"statusText",
|
|
578
|
+
"errorMessage",
|
|
579
|
+
"error",
|
|
580
|
+
"detail"
|
|
581
|
+
];
|
|
582
|
+
var text = (value) => typeof value === "string" && value.trim() ? value.trim() : "";
|
|
583
|
+
var isObject = (value) => value !== null && typeof value === "object";
|
|
584
|
+
/**
|
|
585
|
+
* A readable message for `raw`, or `fallback` when nothing legible can be found.
|
|
586
|
+
*
|
|
587
|
+
* Never throws, and never returns an empty string — a caller rendering this into
|
|
588
|
+
* an error bar has to have something to render, and a blank bar is worse than a
|
|
589
|
+
* generic one.
|
|
590
|
+
*/
|
|
591
|
+
function normalizeError(raw, fallback = "Request failed") {
|
|
592
|
+
if (raw == null) return fallback;
|
|
593
|
+
if (raw instanceof Error) {
|
|
594
|
+
const own = text(raw.message);
|
|
595
|
+
if (own) return own;
|
|
596
|
+
} else {
|
|
597
|
+
if (typeof raw === "string") return text(raw) || fallback;
|
|
598
|
+
if (typeof raw === "number" || typeof raw === "boolean") return String(raw);
|
|
599
|
+
}
|
|
600
|
+
if (isObject(raw)) {
|
|
601
|
+
const obj = raw;
|
|
602
|
+
for (const key of MESSAGE_KEYS) {
|
|
603
|
+
const hit = text(obj[key]);
|
|
604
|
+
if (hit) return hit;
|
|
605
|
+
}
|
|
606
|
+
const response = obj.response;
|
|
607
|
+
if (isObject(response)) {
|
|
608
|
+
const nested = text(response.statusText) || text(response.message);
|
|
609
|
+
if (nested) return nested;
|
|
610
|
+
}
|
|
611
|
+
const status = errorStatus(obj);
|
|
612
|
+
if (status !== void 0 && status > 0) return `HTTP ${status}`;
|
|
613
|
+
if (raw instanceof Error) return text(raw.name) || fallback;
|
|
614
|
+
return fallback;
|
|
615
|
+
}
|
|
616
|
+
return text(String(raw)) || fallback;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* What the bar says for a status. English; an app puts its own language in
|
|
620
|
+
* ONCE with `setErrorMessages()` rather than on every table.
|
|
621
|
+
*/
|
|
622
|
+
var DEFAULT_ERROR_MESSAGES = Object.freeze({
|
|
623
|
+
network: "Could not reach the server. Check your connection and try again.",
|
|
624
|
+
400: "The server rejected the request.",
|
|
625
|
+
401: "Your session has expired. Please sign in again.",
|
|
626
|
+
403: "You do not have permission to view this data.",
|
|
627
|
+
404: "The requested data could not be found.",
|
|
628
|
+
408: "The server took too long to respond. Please try again.",
|
|
629
|
+
409: "The request conflicts with the current state of the data.",
|
|
630
|
+
422: "The server could not process the request.",
|
|
631
|
+
429: "Too many requests. Please wait a moment and try again.",
|
|
632
|
+
500: "Something went wrong on the server. Please try again later.",
|
|
633
|
+
502: "The server is temporarily unavailable. Please try again later.",
|
|
634
|
+
503: "The server is temporarily unavailable. Please try again later.",
|
|
635
|
+
504: "The server took too long to respond. Please try again later.",
|
|
636
|
+
default: "Request failed"
|
|
637
|
+
});
|
|
638
|
+
var globalMessages = null;
|
|
639
|
+
/**
|
|
640
|
+
* App-wide wording, merged over the defaults; `null` restores them. A grid's own
|
|
641
|
+
* `errorMessages` merges over this in turn, so a single table can still differ.
|
|
642
|
+
*/
|
|
643
|
+
function setErrorMessages(messages) {
|
|
644
|
+
globalMessages = messages ? { ...messages } : null;
|
|
645
|
+
}
|
|
646
|
+
/** Defaults ← app-wide ← `local`, same shape as the filter builder's `resolveTexts`. */
|
|
647
|
+
function resolveErrorMessages(local) {
|
|
648
|
+
const merged = { ...DEFAULT_ERROR_MESSAGES };
|
|
649
|
+
for (const layer of [globalMessages, local]) {
|
|
650
|
+
if (!layer) continue;
|
|
651
|
+
for (const key of Object.keys(layer)) {
|
|
652
|
+
const value = layer[key];
|
|
653
|
+
if (typeof value === "string" && value.trim()) merged[key] = value;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
return merged;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* The standard reason phrases. Not shown to anyone — they are what `describeError`
|
|
660
|
+
* uses to recognise that an error's text is ONLY the phrase for its status
|
|
661
|
+
* (`Error('Forbidden')` + `httpStatus: 403`), which adds nothing to the preset and
|
|
662
|
+
* so is not a detail worth appending.
|
|
663
|
+
*/
|
|
664
|
+
var REASON_PHRASES = {
|
|
665
|
+
400: "Bad Request",
|
|
666
|
+
401: "Unauthorized",
|
|
667
|
+
402: "Payment Required",
|
|
668
|
+
403: "Forbidden",
|
|
669
|
+
404: "Not Found",
|
|
670
|
+
405: "Method Not Allowed",
|
|
671
|
+
408: "Request Timeout",
|
|
672
|
+
409: "Conflict",
|
|
673
|
+
410: "Gone",
|
|
674
|
+
412: "Precondition Failed",
|
|
675
|
+
413: "Payload Too Large",
|
|
676
|
+
415: "Unsupported Media Type",
|
|
677
|
+
422: "Unprocessable Entity",
|
|
678
|
+
429: "Too Many Requests",
|
|
679
|
+
500: "Internal Server Error",
|
|
680
|
+
501: "Not Implemented",
|
|
681
|
+
502: "Bad Gateway",
|
|
682
|
+
503: "Service Unavailable",
|
|
683
|
+
504: "Gateway Timeout"
|
|
684
|
+
};
|
|
685
|
+
/** Texts a transport mints for "no answer at all" — a status of 0 in words. */
|
|
686
|
+
var NETWORK_TEXTS = [
|
|
687
|
+
"failed to fetch",
|
|
688
|
+
"networkerror when attempting to fetch resource",
|
|
689
|
+
"load failed",
|
|
690
|
+
"network error",
|
|
691
|
+
"unspecified network error",
|
|
692
|
+
"network connection timeout",
|
|
693
|
+
"network request failed"
|
|
694
|
+
];
|
|
695
|
+
var toStatus = (value) => {
|
|
696
|
+
if (value === null || value === void 0 || value === "") return void 0;
|
|
697
|
+
const n = Number(value);
|
|
698
|
+
return Number.isInteger(n) && n >= 0 && n < 1e3 ? n : void 0;
|
|
699
|
+
};
|
|
700
|
+
/**
|
|
701
|
+
* The HTTP status an error carries, `0` for a network failure, `undefined` when
|
|
702
|
+
* it has none.
|
|
703
|
+
*
|
|
704
|
+
* Reads the fields the common transports use — devextreme's `httpStatus`, a
|
|
705
|
+
* fetch `Response` / axios error's `status` and `response.status`, ofetch's
|
|
706
|
+
* `statusCode`, an OData error body's numeric `code` — on an `Error` instance as
|
|
707
|
+
* readily as on a plain object, since devextreme `extend()`s them onto an
|
|
708
|
+
* `Error`.
|
|
709
|
+
*/
|
|
710
|
+
function errorStatus(raw) {
|
|
711
|
+
if (!isObject(raw)) return void 0;
|
|
712
|
+
const response = isObject(raw.response) ? raw.response : void 0;
|
|
713
|
+
const direct = toStatus(raw.httpStatus) ?? toStatus(raw.status) ?? toStatus(raw.statusCode) ?? toStatus(response?.status) ?? toStatus(response?.statusCode);
|
|
714
|
+
if (direct !== void 0) return direct;
|
|
715
|
+
const code = toStatus((isObject(raw.errorDetails) ? raw.errorDetails : void 0)?.code);
|
|
716
|
+
if (code !== void 0 && code >= 400) return code;
|
|
717
|
+
const own = (raw instanceof Error ? text(raw.message) : text(raw.message)).toLowerCase();
|
|
718
|
+
if (own && NETWORK_TEXTS.some((t) => own.includes(t))) return 0;
|
|
719
|
+
}
|
|
720
|
+
/** A JSON response body handed over as text (an XHR's `responseText`), parsed; else undefined. */
|
|
721
|
+
function parseBody(value) {
|
|
722
|
+
if (typeof value !== "string") return void 0;
|
|
723
|
+
const s = value.trim();
|
|
724
|
+
if (!s.startsWith("{") && !s.startsWith("[")) return void 0;
|
|
725
|
+
try {
|
|
726
|
+
return JSON.parse(s);
|
|
727
|
+
} catch {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
/** The "same message" key: case, spacing and trailing punctuation do not make two texts different. */
|
|
732
|
+
var messageKey = (value) => value.toLowerCase().replace(/\s+/g, " ").replace(/[\s.!:;,]+$/, "").trim();
|
|
733
|
+
/**
|
|
734
|
+
* Keep each message once. Two texts are the same message when they match after
|
|
735
|
+
* {@link messageKey}, and a text another kept one already CONTAINS adds nothing
|
|
736
|
+
* ("Not found" next to "Not found: Order 42") — the longer, more specific one wins
|
|
737
|
+
* and keeps its place in the order the messages were found.
|
|
738
|
+
*/
|
|
739
|
+
function uniqueMessages(found) {
|
|
740
|
+
const kept = [];
|
|
741
|
+
for (const t of found) {
|
|
742
|
+
const key = messageKey(t);
|
|
743
|
+
if (!key) continue;
|
|
744
|
+
if (kept.some((k) => k.key.includes(key))) continue;
|
|
745
|
+
const swallowed = kept.findIndex((k) => key.includes(k.key));
|
|
746
|
+
if (swallowed >= 0) {
|
|
747
|
+
kept[swallowed] = {
|
|
748
|
+
text: t,
|
|
749
|
+
key
|
|
750
|
+
};
|
|
751
|
+
for (let i = kept.length - 1; i > swallowed; i--) if (key.includes(kept[i].key)) kept.splice(i, 1);
|
|
752
|
+
continue;
|
|
753
|
+
}
|
|
754
|
+
kept.push({
|
|
755
|
+
text: t,
|
|
756
|
+
key
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
return kept.map((k) => k.text);
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Every message an error carries, combined the way `monoFetch`'s
|
|
763
|
+
* `extractErrorMessage` does it: each key whose name contains "message"
|
|
764
|
+
* (`message`, `errorMessage`, `Message`, …) holding text — or OData's
|
|
765
|
+
* `{ message: { value } }` — at any depth up to 3, plus a JSON body still in
|
|
766
|
+
* `responseText` / `responseJSON` / `response`, plus an `Error`'s own
|
|
767
|
+
* (non-enumerable) `message`. The usual body fields `detail` / `title` and a
|
|
768
|
+
* plain-text `response.data` count too.
|
|
769
|
+
*
|
|
770
|
+
* Deduplicated by {@link uniqueMessages}, transport boilerplate ("Bad Request",
|
|
771
|
+
* "Failed to fetch") dropped, in the order found.
|
|
772
|
+
*/
|
|
773
|
+
function collectErrorMessages(raw, status = errorStatus(raw)) {
|
|
774
|
+
const found = [];
|
|
775
|
+
const add = (value) => {
|
|
776
|
+
const t = text(value);
|
|
777
|
+
if (t) found.push(t);
|
|
778
|
+
};
|
|
779
|
+
const seen = /* @__PURE__ */ new Set();
|
|
780
|
+
const visit = (val, depth) => {
|
|
781
|
+
if (!isObject(val) || depth > 3 || seen.has(val)) return;
|
|
782
|
+
seen.add(val);
|
|
783
|
+
if (val instanceof Error) add(val.message);
|
|
784
|
+
for (const [k, v] of Object.entries(val)) {
|
|
785
|
+
if (/message/i.test(k)) {
|
|
786
|
+
if (typeof v === "string") add(v);
|
|
787
|
+
else if (isObject(v) && typeof v.value === "string") add(v.value);
|
|
788
|
+
} else if (k === "detail" || k === "title" || k === "errorDetail") add(v);
|
|
789
|
+
else if (k === "responseText" || k === "response" || k === "data" || k === "_data") {
|
|
790
|
+
if (typeof v === "string") {
|
|
791
|
+
const body = parseBody(v);
|
|
792
|
+
if (body !== void 0) visit(body, depth + 1);
|
|
793
|
+
else if (k !== "response") add(v);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
if (isObject(v)) visit(v, depth + 1);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
if (typeof raw === "string") add(raw);
|
|
800
|
+
else visit(raw, 0);
|
|
801
|
+
return uniqueMessages(found).filter((t) => !isBoilerplate(t, status));
|
|
802
|
+
}
|
|
803
|
+
/** Is `value` nothing more than the reason phrase / a generic label for `status`? */
|
|
804
|
+
function isBoilerplate(value, status) {
|
|
805
|
+
const v = value.toLowerCase();
|
|
806
|
+
if (!v || v === "error" || v === "unknown error" || v === "request failed") return true;
|
|
807
|
+
if (/^http\s*\d{3}$/.test(v)) return true;
|
|
808
|
+
if (NETWORK_TEXTS.some((t) => v.includes(t))) return true;
|
|
809
|
+
if (status !== void 0) {
|
|
810
|
+
const phrase = REASON_PHRASES[status]?.toLowerCase();
|
|
811
|
+
if (phrase && (v === phrase || v === `${status} ${phrase}` || v === `${status}`)) return true;
|
|
812
|
+
if (v === String(status)) return true;
|
|
813
|
+
}
|
|
814
|
+
return Object.values(REASON_PHRASES).some((p) => p.toLowerCase() === v);
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* The one line a field shows for `err`: what the server said, every distinct
|
|
818
|
+
* message combined (`monoFetch` style), or the headline when it said nothing.
|
|
819
|
+
*/
|
|
820
|
+
function errorText(err, separator = " · ") {
|
|
821
|
+
return err.messages.length ? err.messages.join(separator) : err.message;
|
|
822
|
+
}
|
|
823
|
+
/** The hover text: the headline, then everything the server said, each once. */
|
|
824
|
+
function errorTitle(err) {
|
|
825
|
+
return uniqueMessages([err.message, ...err.messages]).join("\n");
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* The line a person should read for `raw`.
|
|
829
|
+
*
|
|
830
|
+
* Order: a preset for the status (`'network'` for 0) → the error's own text →
|
|
831
|
+
* `messages.default`. When a preset is the headline, whatever the server said
|
|
832
|
+
* on top of the status becomes `detail`; without a preset, the raw text IS the
|
|
833
|
+
* headline and only a distinct server body is a detail. Never throws, never
|
|
834
|
+
* returns an empty `message`.
|
|
835
|
+
*/
|
|
836
|
+
function describeError(raw, messages) {
|
|
837
|
+
const texts = resolveErrorMessages(messages);
|
|
838
|
+
const status = errorStatus(raw);
|
|
839
|
+
const fallback = texts.default || DEFAULT_ERROR_MESSAGES.default;
|
|
840
|
+
const rawText = normalizeError(raw, fallback);
|
|
841
|
+
const preset = status === void 0 ? void 0 : status === 0 ? texts.network : texts[status];
|
|
842
|
+
const said = collectErrorMessages(raw, status).filter((m) => m !== preset);
|
|
843
|
+
if (preset) {
|
|
844
|
+
const out = {
|
|
845
|
+
message: preset,
|
|
846
|
+
status,
|
|
847
|
+
messages: said
|
|
848
|
+
};
|
|
849
|
+
if (said.length) out.detail = said.join("\n\n");
|
|
850
|
+
return out;
|
|
851
|
+
}
|
|
852
|
+
const message = rawText || fallback;
|
|
853
|
+
const rest = said.filter((m) => messageKey(m) !== messageKey(message));
|
|
854
|
+
const out = {
|
|
855
|
+
message,
|
|
856
|
+
messages: said
|
|
857
|
+
};
|
|
858
|
+
if (status !== void 0) out.status = status;
|
|
859
|
+
if (rest.length) out.detail = rest.join("\n\n");
|
|
860
|
+
return out;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* A load a newer load superseded (devextreme rejects it with `'canceled'`).
|
|
864
|
+
* Not a failure — nothing should be shown for it.
|
|
865
|
+
*/
|
|
866
|
+
function isCanceled(err) {
|
|
867
|
+
if (!err) return false;
|
|
868
|
+
return err === "canceled" || err.name === "canceled" || err.message === "canceled" || err.__id === "canceled";
|
|
869
|
+
}
|
|
870
|
+
//#endregion
|
|
871
|
+
export { resolveSearchEntries as A, customRemoteClause as C, isWildcardPattern as D, hasWildcardSearch as E, normalizeSearchExpr as O, customPredicate as S, hasCustomSearch as T, plainSearchFields as _, errorTitle as a, searchRemoteFilter as b, resolveErrorMessages as c, DEFAULT_SEARCH_OPERATION as d, MonoSourceSearch as f, parseSearchValue as g, mergeSearchFields as h, errorText as i, searchEntryFor as j, plainSearchColumns as k, setErrorMessages as l, isFoldableSearch as m, describeError as n, isCanceled as o, SEARCH_FIELDS_KEYS as p, errorStatus as r, normalizeError as s, DEFAULT_ERROR_MESSAGES as t, DEFAULT_SEARCH_FIELDS as u, readSearchField as v, expandWildcard as w, searchRowPredicate as x, resolveSearchFields as y };
|