@webquark/browser 1.1.0-dev.9 → 1.1.1-dev.1
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/dist/cjs/{action.props-N0urQtdP.js → action.props-CNe2JXR5.js} +1 -1
- package/dist/cjs/{dom-Dk77oFF6.js → dom-BYrqRYna.js} +1 -1
- package/dist/cjs/{field-CsrQGhG-.js → field-BRAR56Ex.js} +1 -1
- package/dist/cjs/{form-control-validity-D1ukC0_e.js → form-control-validity-BkilGb3E.js} +3 -3
- package/dist/cjs/{index-DWXhKHCB.js → index-BN-WdOQM.js} +17 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/q-accordion.cjs.entry.js +2 -2
- package/dist/cjs/q-alert.cjs.entry.js +2 -2
- package/dist/cjs/q-avatar.cjs.entry.js +2 -2
- package/dist/cjs/q-banner.cjs.entry.js +1 -1
- package/dist/cjs/q-button_3.cjs.entry.js +907 -0
- package/dist/cjs/q-card.cjs.entry.js +3 -3
- package/dist/cjs/q-carousel.cjs.entry.js +120 -18
- package/dist/cjs/q-chip.cjs.entry.js +2 -2
- package/dist/cjs/q-control-group.cjs.entry.js +64 -0
- package/dist/cjs/q-conversation-bubble.cjs.entry.js +1 -1
- package/dist/cjs/q-data-table.cjs.entry.js +4 -4
- package/dist/cjs/q-dialog.cjs.entry.js +4 -4
- package/dist/cjs/q-divider.cjs.entry.js +26 -0
- package/dist/cjs/q-dropdown.cjs.entry.js +320 -104
- package/dist/cjs/q-form.cjs.entry.js +17 -7
- package/dist/cjs/q-grid.cjs.entry.js +3 -3
- package/dist/cjs/q-icon.cjs.entry.js +1 -1
- package/dist/cjs/q-image-comparison.cjs.entry.js +2 -2
- package/dist/cjs/q-inline.cjs.entry.js +3 -3
- package/dist/cjs/q-input_2.cjs.entry.js +10 -8
- package/dist/cjs/q-link.cjs.entry.js +2 -2
- package/dist/cjs/q-map.cjs.entry.js +2 -2
- package/dist/cjs/q-media.cjs.entry.js +2 -2
- package/dist/cjs/q-navbar.cjs.entry.js +3 -3
- package/dist/cjs/q-pagination.cjs.entry.js +2 -2
- package/dist/cjs/q-panel.cjs.entry.js +7 -7
- package/dist/cjs/q-quantity-selector.cjs.entry.js +6 -6
- package/dist/cjs/q-radio-group.cjs.entry.js +4 -4
- package/dist/cjs/q-reel.cjs.entry.js +24 -24
- package/dist/cjs/q-section.cjs.entry.js +2 -2
- package/dist/cjs/q-sidepanel.cjs.entry.js +5 -4
- package/dist/cjs/q-slider.cjs.entry.js +122 -0
- package/dist/cjs/q-stack.cjs.entry.js +3 -3
- package/dist/cjs/q-step-diagram-item.cjs.entry.js +2 -2
- package/dist/cjs/q-step-diagram.cjs.entry.js +4 -4
- package/dist/cjs/q-syntax-box.cjs.entry.js +180 -719
- package/dist/cjs/q-syntax-view.cjs.entry.js +65 -0
- package/dist/cjs/q-tabs.cjs.entry.js +2 -2
- package/dist/cjs/q-textarea.cjs.entry.js +8 -6
- package/dist/cjs/q-thumbnail.cjs.entry.js +3 -3
- package/dist/cjs/q-toast.cjs.entry.js +1 -1
- package/dist/cjs/q-toggle.cjs.entry.js +7 -7
- package/dist/cjs/q-toolbar.cjs.entry.js +4 -4
- package/dist/cjs/syntax-content-BmSExDiW.js +910 -0
- package/dist/cjs/{tokens-RMRaIOqv.js → tokens-BMrfol_M.js} +4 -1
- package/dist/cjs/webquark.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +6 -1
- package/dist/collection/components/actions/button/button.css +49 -9
- package/dist/collection/components/actions/button/{button.utils.unit.test.js → test/button.utils.unit.test.js} +1 -1
- package/dist/collection/components/communication/alert/alert.css +4 -1
- package/dist/collection/components/content/carousel/carousel.css +7 -0
- package/dist/collection/components/content/carousel/carousel.js +256 -10
- package/dist/collection/components/content/carousel/internals/autoplay.js +31 -6
- package/dist/collection/components/content/carousel/test/transitions.cmp.test.js +122 -0
- package/dist/collection/components/data-display/accordion/accordion.js +1 -1
- package/dist/collection/components/data-display/data-table/data-table.js +3 -3
- package/dist/collection/components/data-display/map/map.js +1 -1
- package/dist/collection/components/data-display/map/test/map.cmp.test.js +1 -1
- package/dist/collection/components/data-display/pagination/pagination.js +1 -1
- package/dist/collection/components/data-display/syntax-box/internals/formatters/css.js +4 -0
- package/dist/collection/components/data-display/syntax-box/internals/formatters/formatter.js +20 -0
- package/dist/collection/{utils → components/data-display/syntax-box/internals/formatters}/formatter.unit.test.js +38 -11
- package/dist/collection/components/data-display/syntax-box/internals/formatters/html.js +4 -0
- package/dist/collection/components/data-display/syntax-box/internals/formatters/javascript.js +4 -0
- package/dist/collection/{utils/formatter.js → components/data-display/syntax-box/internals/formatters/json.js} +2 -20
- package/dist/collection/components/data-display/syntax-box/internals/formatters/languages.js +15 -0
- package/dist/collection/components/data-display/syntax-box/internals/formatters/util/prettier.js +17 -0
- package/dist/collection/{utils → components/data-display/syntax-box/internals}/syntax.unit.test.js +1 -1
- package/dist/collection/components/data-display/syntax-box/internals/views.js +29 -0
- package/dist/collection/components/data-display/syntax-box/internals/views.unit.test.js +19 -0
- package/dist/collection/components/data-display/syntax-box/syntax-box.css +107 -36
- package/dist/collection/components/data-display/syntax-box/syntax-box.js +179 -637
- package/dist/collection/components/data-display/syntax-box/syntax-content.js +748 -0
- package/dist/collection/components/data-display/syntax-box/syntax-ui.js +8 -0
- package/dist/collection/components/data-display/syntax-box/test/format-fixtures.js +2 -2
- package/dist/collection/components/data-display/syntax-box/test/syntax-box.cmp.test.js +1 -1
- package/dist/collection/components/data-display/syntax-box/test/syntax-format.cmp.test.js +20 -20
- package/dist/collection/components/data-display/syntax-box/test/syntax-views.cmp.test.js +228 -0
- package/dist/collection/components/data-display/syntax-view/syntax-view.js +64 -0
- package/dist/collection/components/indicators/step-diagram/step-diagram.js +2 -2
- package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +1 -1
- package/dist/collection/components/inputs/dropdown/dropdown.css +148 -0
- package/dist/collection/components/inputs/dropdown/dropdown.js +422 -104
- package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +28 -0
- package/dist/collection/components/inputs/dropdown/test/fit-options.cmp.test.js +120 -0
- package/dist/collection/components/inputs/dropdown/test/multiple.cmp.test.js +124 -0
- package/dist/collection/components/inputs/dropdown/test/search-mode.cmp.test.js +186 -0
- package/dist/collection/components/inputs/form/form.js +2 -2
- package/dist/collection/components/inputs/form/internals/controls.js +2 -2
- package/dist/collection/components/inputs/form/internals/field-state.js +6 -1
- package/dist/collection/components/inputs/form/internals/values.js +5 -0
- package/dist/collection/components/inputs/form/test/form-submit.cmp.test.js +14 -8
- package/dist/collection/components/inputs/input/input.css +42 -0
- package/dist/collection/components/inputs/input/input.js +31 -3
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.css +22 -0
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +4 -4
- package/dist/collection/components/inputs/radio-group/radio-group.js +2 -2
- package/dist/collection/components/inputs/slider/slider.css +44 -0
- package/dist/collection/components/inputs/slider/slider.js +383 -0
- package/dist/collection/components/inputs/slider/test/slider.cmp.test.js +45 -0
- package/dist/collection/components/inputs/textarea/textarea.css +20 -0
- package/dist/collection/components/inputs/textarea/textarea.js +30 -2
- package/dist/collection/components/inputs/toggle/test/toggle-layout.cmp.test.js +69 -0
- package/dist/collection/components/inputs/toggle/toggle.css +27 -0
- package/dist/collection/components/inputs/toggle/toggle.js +3 -3
- package/dist/collection/components/layout/control-group/control-group.css +108 -0
- package/dist/collection/components/layout/control-group/control-group.js +142 -0
- package/dist/collection/components/layout/control-group/test/control-group.cmp.test.js +163 -0
- package/dist/collection/components/layout/divider/divider.css +40 -0
- package/dist/collection/components/layout/divider/divider.js +121 -0
- package/dist/collection/components/layout/divider/test/divider.cmp.test.js +105 -0
- package/dist/collection/components/layout/grid/grid.js +1 -1
- package/dist/collection/components/layout/inline/inline.js +1 -1
- package/dist/collection/components/layout/navbar/navbar.js +2 -2
- package/dist/collection/components/layout/panel/panel.js +4 -4
- package/dist/collection/components/layout/scrollable/scrollable.js +3 -3
- package/dist/collection/components/layout/section/section.js +1 -1
- package/dist/collection/components/layout/sidepanel/internals/nav-items.js +2 -2
- package/dist/collection/components/layout/sidepanel/sidepanel.js +3 -0
- package/dist/collection/components/layout/stack/stack.js +1 -1
- package/dist/collection/components/layout/tabs/tabs.js +1 -1
- package/dist/collection/components/layout/toolbar/toolbar.js +2 -2
- package/dist/collection/components/media/avatar/avatar.js +1 -1
- package/dist/collection/components/media/image-comparison/image-comparison.js +1 -1
- package/dist/collection/components/media/media/media.js +1 -1
- package/dist/collection/components/media/reel/reel.js +23 -23
- package/dist/collection/components/media/reel/test/focus.cmp.test.js +33 -0
- package/dist/collection/components/media/thumbnail/thumbnail.js +2 -2
- package/dist/collection/components/overlays/dialog/dialog.js +2 -2
- package/dist/collection/components/overlays/tooltip/tooltip.js +2 -2
- package/dist/collection/theme/test/input-width.cmp.test.js +117 -0
- package/dist/collection/theme/test/presets.unit.test.js +58 -0
- package/dist/collection/theme/tokens.js +4 -1
- package/dist/collection/utils/dom.js +1 -1
- package/dist/collection/utils/form-control-validity.js +3 -3
- package/dist/components/index.js +1 -1
- package/dist/components/p-B610wOGe.js +1 -0
- package/dist/components/p-BGlbV43y.js +13 -0
- package/dist/components/{p-Dfp_If-_.js → p-BKWL9zOn.js} +1 -1
- package/dist/components/p-BxxU73QQ.js +1 -0
- package/dist/components/{p-Cg0Mv7Vb.js → p-CVEQfA-v.js} +1 -1
- package/dist/components/p-CpbWWDiY.js +1 -0
- package/dist/{webquark/p-Dhsn99q4.js → components/p-D2fczi8m.js} +1 -1
- package/dist/components/{p-6PPZ2sIO.js → p-D5vpGqZ9.js} +1 -1
- package/dist/components/p-DQIYo8zC.js +1 -0
- package/dist/components/p-DX6PCIPS.js +1 -0
- package/dist/components/p-DY9D4z7Z.js +1 -0
- package/dist/components/p-DbzjRzhu.js +1 -0
- package/dist/components/{p-DQhiqYeq.js → p-DkanItP3.js} +1 -1
- package/dist/components/{p-CKuPOxKN.js → p-RX4DjgmV.js} +1 -1
- package/dist/components/{p-DlIn_ZWk.js → p-Ts5oOvg8.js} +1 -1
- package/dist/components/p-u1Qz6OcP.js +1 -0
- package/dist/components/q-accordion.js +1 -1
- package/dist/components/q-alert.js +1 -1
- package/dist/components/q-avatar.js +1 -1
- package/dist/components/q-banner.js +1 -1
- package/dist/components/q-button.js +1 -1
- package/dist/components/q-card.js +1 -1
- package/dist/components/q-carousel.js +1 -1
- package/dist/components/q-chip.js +1 -1
- package/dist/components/q-control-group.d.ts +11 -0
- package/dist/components/q-control-group.js +1 -0
- package/dist/components/q-conversation-bubble.js +1 -1
- package/dist/components/q-data-table.js +1 -1
- package/dist/components/q-dialog.js +1 -1
- package/dist/components/q-divider.d.ts +11 -0
- package/dist/components/q-divider.js +1 -0
- package/dist/components/q-dropdown.js +1 -1
- package/dist/components/q-form.js +1 -1
- package/dist/components/q-grid.js +1 -1
- package/dist/components/q-icon.js +1 -1
- package/dist/components/q-image-comparison.js +1 -1
- package/dist/components/q-inline.js +1 -1
- package/dist/components/q-input.js +1 -1
- package/dist/components/q-link.js +1 -1
- package/dist/components/q-map.js +1 -1
- package/dist/components/q-media.js +1 -1
- package/dist/components/q-navbar.js +1 -1
- package/dist/components/q-pagination.js +1 -1
- package/dist/components/q-panel.js +1 -1
- package/dist/components/q-progress.js +1 -1
- package/dist/components/q-quantity-selector.js +1 -1
- package/dist/components/q-radio-group.js +1 -1
- package/dist/components/q-reel.js +1 -1
- package/dist/components/q-scrollable.js +1 -1
- package/dist/components/q-section.js +1 -1
- package/dist/components/q-sidepanel.js +2 -2
- package/dist/components/q-slider.d.ts +11 -0
- package/dist/components/q-slider.js +1 -0
- package/dist/components/q-stack.js +1 -1
- package/dist/components/q-step-diagram-item.js +1 -1
- package/dist/components/q-step-diagram.js +1 -1
- package/dist/components/q-syntax-box.js +1 -13
- package/dist/components/q-syntax-view.d.ts +11 -0
- package/dist/components/q-syntax-view.js +1 -0
- package/dist/components/q-tabs.js +1 -1
- package/dist/components/q-textarea.js +1 -1
- package/dist/components/q-thumbnail.js +1 -1
- package/dist/components/q-toast.js +1 -1
- package/dist/components/q-toggle.js +1 -1
- package/dist/components/q-toolbar.js +1 -1
- package/dist/components/q-tooltip.js +1 -1
- package/dist/esm/{action.props-CpnGza8z.js → action.props-CbSH7c-q.js} +1 -1
- package/dist/esm/{dom-ByfrUWx1.js → dom-B610wOGe.js} +2 -2
- package/dist/esm/{field-zfD6OQ02.js → field-D5xUxo11.js} +1 -1
- package/dist/esm/{form-control-validity-Bj2RJb2E.js → form-control-validity-BxxU73QQ.js} +3 -3
- package/dist/esm/{form-submit-action-CoEIvDqE.js → form-submit-action-BjjfVWyu.js} +1 -1
- package/dist/esm/{index-B5ElFlHv.js → index-CIMzZPQO.js} +16 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/q-accordion.entry.js +2 -2
- package/dist/esm/q-alert.entry.js +2 -2
- package/dist/esm/q-avatar.entry.js +2 -2
- package/dist/esm/q-banner.entry.js +1 -1
- package/dist/esm/q-button_3.entry.js +903 -0
- package/dist/esm/q-card.entry.js +3 -3
- package/dist/esm/q-carousel.entry.js +120 -18
- package/dist/esm/q-chip.entry.js +2 -2
- package/dist/esm/q-control-group.entry.js +62 -0
- package/dist/esm/q-conversation-bubble.entry.js +1 -1
- package/dist/esm/q-data-table.entry.js +4 -4
- package/dist/esm/q-dialog.entry.js +4 -4
- package/dist/esm/q-divider.entry.js +24 -0
- package/dist/esm/q-dropdown.entry.js +320 -104
- package/dist/esm/q-form.entry.js +18 -8
- package/dist/esm/q-grid.entry.js +3 -3
- package/dist/esm/q-icon.entry.js +1 -1
- package/dist/esm/q-image-comparison.entry.js +2 -2
- package/dist/esm/q-inline.entry.js +3 -3
- package/dist/esm/q-input_2.entry.js +10 -8
- package/dist/esm/q-link.entry.js +2 -2
- package/dist/esm/q-map.entry.js +2 -2
- package/dist/esm/q-media.entry.js +2 -2
- package/dist/esm/q-navbar.entry.js +3 -3
- package/dist/esm/q-pagination.entry.js +2 -2
- package/dist/esm/q-panel.entry.js +7 -7
- package/dist/esm/q-quantity-selector.entry.js +6 -6
- package/dist/esm/q-radio-group.entry.js +4 -4
- package/dist/esm/q-reel.entry.js +24 -24
- package/dist/esm/q-section.entry.js +2 -2
- package/dist/esm/q-sidepanel.entry.js +5 -4
- package/dist/esm/q-slider.entry.js +120 -0
- package/dist/esm/q-stack.entry.js +3 -3
- package/dist/esm/q-step-diagram-item.entry.js +2 -2
- package/dist/esm/q-step-diagram.entry.js +4 -4
- package/dist/esm/q-syntax-box.entry.js +180 -719
- package/dist/esm/q-syntax-view.entry.js +63 -0
- package/dist/esm/q-tabs.entry.js +2 -2
- package/dist/esm/q-textarea.entry.js +8 -6
- package/dist/esm/q-thumbnail.entry.js +3 -3
- package/dist/esm/q-toast.entry.js +1 -1
- package/dist/esm/q-toggle.entry.js +7 -7
- package/dist/esm/q-toolbar.entry.js +4 -4
- package/dist/esm/syntax-content-Cr9kSbmA.js +903 -0
- package/dist/esm/{tokens-B4Mg1xEw.js → tokens-DbzjRzhu.js} +4 -1
- package/dist/esm/webquark.js +3 -3
- package/dist/formatters/prettier/LICENSE +7 -0
- package/dist/formatters/prettier/THIRD-PARTY-NOTICES.md +7941 -0
- package/dist/formatters/prettier/html-fragment.mjs +1 -0
- package/dist/formatters/prettier/html-fragment.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/angular.mjs +1 -0
- package/dist/formatters/prettier/languages/angular.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/css.mjs +1 -0
- package/dist/formatters/prettier/languages/css.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/flow.mjs +1 -0
- package/dist/formatters/prettier/languages/flow.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/graphql.mjs +1 -0
- package/dist/formatters/prettier/languages/graphql.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/handlebars.mjs +1 -0
- package/dist/formatters/prettier/languages/handlebars.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/html.mjs +1 -0
- package/dist/formatters/prettier/languages/html.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/javascript.mjs +1 -0
- package/dist/formatters/prettier/languages/javascript.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/json-stringify.mjs +1 -0
- package/dist/formatters/prettier/languages/json-stringify.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/json.mjs +1 -0
- package/dist/formatters/prettier/languages/json.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/json5.mjs +1 -0
- package/dist/formatters/prettier/languages/json5.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/jsonc.mjs +1 -0
- package/dist/formatters/prettier/languages/jsonc.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/jsx.mjs +1 -0
- package/dist/formatters/prettier/languages/jsx.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/less.mjs +1 -0
- package/dist/formatters/prettier/languages/less.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/lwc.mjs +1 -0
- package/dist/formatters/prettier/languages/lwc.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/markdown.mjs +1 -0
- package/dist/formatters/prettier/languages/markdown.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/mdx.mjs +1 -0
- package/dist/formatters/prettier/languages/mdx.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/mjml.mjs +1 -0
- package/dist/formatters/prettier/languages/mjml.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/postcss.mjs +1 -0
- package/dist/formatters/prettier/languages/postcss.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/scss.mjs +1 -0
- package/dist/formatters/prettier/languages/scss.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/tsx.mjs +1 -0
- package/dist/formatters/prettier/languages/tsx.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/typescript.mjs +1 -0
- package/dist/formatters/prettier/languages/typescript.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/vue.mjs +1 -0
- package/dist/formatters/prettier/languages/vue.mjs.gz +0 -0
- package/dist/formatters/prettier/languages/yaml.mjs +1 -0
- package/dist/formatters/prettier/languages/yaml.mjs.gz +0 -0
- package/dist/formatters/prettier/manifest.json +87 -0
- package/dist/formatters/prettier/plugins/acorn.mjs +17 -0
- package/dist/formatters/prettier/plugins/acorn.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/angular.mjs +7 -0
- package/dist/formatters/prettier/plugins/angular.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/babel.mjs +16 -0
- package/dist/formatters/prettier/plugins/babel.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/estree.mjs +44 -0
- package/dist/formatters/prettier/plugins/estree.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/flow.mjs +7 -0
- package/dist/formatters/prettier/plugins/flow.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/glimmer.mjs +37 -0
- package/dist/formatters/prettier/plugins/glimmer.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/graphql.mjs +17 -0
- package/dist/formatters/prettier/plugins/graphql.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/html.mjs +25 -0
- package/dist/formatters/prettier/plugins/html.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/markdown.mjs +70 -0
- package/dist/formatters/prettier/plugins/markdown.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/meriyah.mjs +9 -0
- package/dist/formatters/prettier/plugins/meriyah.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/postcss.mjs +62 -0
- package/dist/formatters/prettier/plugins/postcss.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/typescript.mjs +22 -0
- package/dist/formatters/prettier/plugins/typescript.mjs.gz +0 -0
- package/dist/formatters/prettier/plugins/yaml.mjs +150 -0
- package/dist/formatters/prettier/plugins/yaml.mjs.gz +0 -0
- package/dist/formatters/prettier/runtime.d.mts +2 -0
- package/dist/formatters/prettier/runtime.mjs +1 -0
- package/dist/formatters/prettier/runtime.mjs.gz +0 -0
- package/dist/formatters/prettier/standalone.mjs +29 -0
- package/dist/formatters/prettier/standalone.mjs.gz +0 -0
- package/dist/playground/components/theme-designer/dimension-tokens.js +9 -0
- package/dist/playground/components/theme-designer/token-row.js +60 -0
- package/dist/playground/dom-factory.js +76 -0
- package/dist/playground/utils/color.js +15 -0
- package/dist/playground/utils/dom.js +38 -0
- package/dist/playground/utils/index.js +2 -0
- package/dist/types/components/content/carousel/carousel.d.ts +23 -2
- package/dist/types/components/content/carousel/carousel.types.d.ts +6 -0
- package/dist/types/components/content/carousel/internals/autoplay.d.ts +5 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/css.d.ts +1 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.d.ts +10 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/formatter.types.d.ts +4 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/html.d.ts +1 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/javascript.d.ts +1 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/json.d.ts +6 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/languages.d.ts +27 -0
- package/dist/types/components/data-display/syntax-box/internals/formatters/util/prettier.d.ts +3 -0
- package/dist/types/{utils → components/data-display/syntax-box/internals}/syntax.d.ts +1 -1
- package/dist/types/components/data-display/syntax-box/internals/syntax.unit.test.d.ts +1 -0
- package/dist/types/components/data-display/syntax-box/internals/views.d.ts +11 -0
- package/dist/types/components/data-display/syntax-box/internals/views.unit.test.d.ts +1 -0
- package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +66 -63
- package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +1 -1
- package/dist/types/components/data-display/syntax-box/syntax-content.d.ts +41 -0
- package/dist/types/components/data-display/syntax-box/syntax-ui.d.ts +15 -0
- package/dist/types/components/data-display/syntax-box/test/format-fixtures.d.ts +1 -1
- package/dist/types/components/data-display/syntax-box/test/syntax-views.cmp.test.d.ts +1 -0
- package/dist/types/components/data-display/syntax-view/syntax-view.d.ts +48 -0
- package/dist/types/components/inputs/dropdown/dropdown.d.ts +45 -1
- package/dist/types/components/inputs/dropdown/test/fit-options.cmp.test.d.ts +3 -0
- package/dist/types/components/inputs/dropdown/test/multiple.cmp.test.d.ts +1 -0
- package/dist/types/components/inputs/dropdown/test/search-mode.cmp.test.d.ts +1 -0
- package/dist/types/components/inputs/form/internals/field-state.d.ts +1 -1
- package/dist/types/components/inputs/input/input.d.ts +3 -0
- package/dist/types/components/inputs/slider/slider.d.ts +45 -0
- package/dist/types/components/inputs/slider/test/slider.cmp.test.d.ts +1 -0
- package/dist/types/components/inputs/textarea/textarea.d.ts +3 -1
- package/dist/types/components/inputs/toggle/test/toggle-layout.cmp.test.d.ts +1 -0
- package/dist/types/components/layout/control-group/control-group.d.ts +20 -0
- package/dist/types/components/layout/control-group/test/control-group.cmp.test.d.ts +7 -0
- package/dist/types/components/layout/divider/divider.d.ts +15 -0
- package/dist/types/components/layout/divider/test/divider.cmp.test.d.ts +1 -0
- package/dist/types/components/layout/sidepanel/sidepanel.d.ts +2 -0
- package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +1 -0
- package/dist/types/components/media/reel/reel.d.ts +3 -3
- package/dist/types/components/media/reel/test/focus.cmp.test.d.ts +1 -0
- package/dist/types/components.d.ts +591 -13
- package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/dimension-tokens.d.ts +3 -0
- package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/components/theme-designer/token-row.d.ts +14 -0
- package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/dom-factory.d.ts +13 -0
- package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/color.d.ts +2 -0
- package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/dom.d.ts +15 -0
- package/dist/types/home/runner/work/WebQuark/WebQuark/.stencil/src/playground/utils/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/theme/test/input-width.cmp.test.d.ts +3 -0
- package/dist/types/theme/test/presets.unit.test.d.ts +1 -0
- package/dist/types/theme/tokens.d.ts +9 -0
- package/dist/types/utils/form-control-validity.d.ts +2 -1
- package/dist/types/utils/form-field-adapter.d.ts +3 -3
- package/dist/webquark/p-014c2f4a.entry.js +1 -0
- package/dist/webquark/p-0389577c.entry.js +1 -0
- package/dist/webquark/p-041e17c1.entry.js +1 -0
- package/dist/webquark/p-0479c571.entry.js +1 -0
- package/dist/webquark/p-0ebca9be.entry.js +1 -0
- package/dist/webquark/{p-fe8c634a.entry.js → p-1bf375f7.entry.js} +2 -2
- package/dist/webquark/{p-6bfffa79.entry.js → p-20dc3ab5.entry.js} +1 -1
- package/dist/webquark/p-28d3348f.entry.js +1 -0
- package/dist/webquark/p-35c177d3.entry.js +1 -0
- package/dist/webquark/{p-99d785ca.entry.js → p-3a60086d.entry.js} +1 -1
- package/dist/webquark/{p-3bc4629c.entry.js → p-3ab798aa.entry.js} +1 -1
- package/dist/webquark/{p-9e78b796.entry.js → p-3b580baf.entry.js} +1 -1
- package/dist/webquark/{p-888e46a8.entry.js → p-3b65f787.entry.js} +1 -1
- package/dist/webquark/p-4bf610f8.entry.js +1 -0
- package/dist/webquark/{p-4d61b70d.entry.js → p-4d30227e.entry.js} +1 -1
- package/dist/webquark/{p-70d9ffde.entry.js → p-4de536ae.entry.js} +1 -1
- package/dist/webquark/{p-90b0858c.entry.js → p-4e4d70c9.entry.js} +1 -1
- package/dist/webquark/p-4efeb7c9.entry.js +1 -0
- package/dist/webquark/{p-dd115868.entry.js → p-51b3d71b.entry.js} +1 -1
- package/dist/webquark/p-778b6bbb.entry.js +1 -0
- package/dist/webquark/{p-f63b7214.entry.js → p-7da78b2f.entry.js} +1 -1
- package/dist/webquark/{p-9ff7e5a4.entry.js → p-7f8f986b.entry.js} +1 -1
- package/dist/webquark/p-8253c742.entry.js +1 -0
- package/dist/webquark/{p-059daa8a.entry.js → p-9a1ddeb7.entry.js} +1 -1
- package/dist/webquark/p-B610wOGe.js +1 -0
- package/dist/webquark/p-BxxU73QQ.js +1 -0
- package/dist/webquark/p-CIMzZPQO.js +3 -0
- package/dist/webquark/p-CfR85WgM.js +13 -0
- package/dist/{components/p-BofcK-7Z.js → webquark/p-D8p28N9s.js} +1 -1
- package/dist/webquark/p-DbzjRzhu.js +1 -0
- package/dist/webquark/{p-BOdNg0jc.js → p-DeOEN0si.js} +1 -1
- package/dist/webquark/{p-d0fbd2b1.entry.js → p-a2b1de23.entry.js} +1 -1
- package/dist/webquark/{p-48fb5228.entry.js → p-a55edc17.entry.js} +1 -1
- package/dist/webquark/p-a8808020.entry.js +1 -0
- package/dist/webquark/{p-f4f97e74.entry.js → p-b1084b3c.entry.js} +1 -1
- package/dist/webquark/{p-36118d90.entry.js → p-b6c4dff4.entry.js} +1 -1
- package/dist/webquark/p-b962e950.entry.js +1 -0
- package/dist/webquark/{p-023f8437.entry.js → p-bc369cd6.entry.js} +1 -1
- package/dist/webquark/p-c119a8ea.entry.js +1 -0
- package/dist/webquark/p-c6b77e9a.entry.js +1 -0
- package/dist/webquark/{p-030ecde3.entry.js → p-ca1c03b4.entry.js} +1 -1
- package/dist/webquark/{p-8ece2c62.entry.js → p-ce436162.entry.js} +1 -1
- package/dist/webquark/{p-0aa74ad6.entry.js → p-d0a47a7c.entry.js} +1 -1
- package/dist/webquark/{p-fec6fe0a.entry.js → p-e1fbc8fc.entry.js} +1 -1
- package/dist/webquark/{p-09cca7b9.entry.js → p-e32833ce.entry.js} +1 -1
- package/dist/webquark/p-e369a4aa.entry.js +1 -0
- package/dist/webquark/p-e4430c61.entry.js +1 -0
- package/dist/webquark/{p-f9ad63ff.entry.js → p-e9c0052b.entry.js} +1 -1
- package/dist/webquark/{p-f1bac94c.entry.js → p-f5c4ca18.entry.js} +1 -1
- package/dist/webquark/{p-64096386.entry.js → p-f6683126.entry.js} +1 -1
- package/dist/webquark/{p-DWO-pleQ.js → p-ojSDiptZ.js} +1 -1
- package/dist/webquark/webquark.css +1 -1
- package/dist/webquark/webquark.esm.js +1 -1
- package/package.json +6 -2
- package/dist/cjs/q-button_2.cjs.entry.js +0 -462
- package/dist/cjs/q-scrollable.cjs.entry.js +0 -449
- package/dist/components/p-B4Mg1xEw.js +0 -1
- package/dist/components/p-BH4gQWub.js +0 -1
- package/dist/components/p-Bj2RJb2E.js +0 -1
- package/dist/components/p-ByfrUWx1.js +0 -1
- package/dist/components/p-CN1ut2Lb.js +0 -1
- package/dist/components/p-ye27qtRo.js +0 -1
- package/dist/esm/q-button_2.entry.js +0 -459
- package/dist/esm/q-scrollable.entry.js +0 -447
- package/dist/types/utils/formatter.d.ts +0 -15
- package/dist/webquark/p-04c8cb9e.entry.js +0 -1
- package/dist/webquark/p-0ae43d6c.entry.js +0 -1
- package/dist/webquark/p-0c3aac3f.entry.js +0 -1
- package/dist/webquark/p-144ef339.entry.js +0 -1
- package/dist/webquark/p-296fbdb1.entry.js +0 -1
- package/dist/webquark/p-5f232b44.entry.js +0 -13
- package/dist/webquark/p-6e28cfe2.entry.js +0 -1
- package/dist/webquark/p-91fff6b6.entry.js +0 -1
- package/dist/webquark/p-923dac41.entry.js +0 -1
- package/dist/webquark/p-97a89cae.entry.js +0 -1
- package/dist/webquark/p-B4Mg1xEw.js +0 -1
- package/dist/webquark/p-B5ElFlHv.js +0 -3
- package/dist/webquark/p-Bj2RJb2E.js +0 -1
- package/dist/webquark/p-ByfrUWx1.js +0 -1
- package/dist/webquark/p-c523ec6f.entry.js +0 -1
- package/dist/webquark/p-d0253d64.entry.js +0 -1
- package/dist/webquark/p-f98f9439.entry.js +0 -1
- package/dist/webquark/p-fe200f68.entry.js +0 -1
- /package/dist/{types/components/actions/button/button.utils.unit.test.d.ts → collection/components/data-display/syntax-box/internals/formatters/formatter.types.js} +0 -0
- /package/dist/collection/{utils → components/data-display/syntax-box/internals}/syntax.js +0 -0
- /package/dist/types/{utils/formatter.unit.test.d.ts → components/actions/button/test/button.utils.unit.test.d.ts} +0 -0
- /package/dist/types/{utils/syntax.unit.test.d.ts → components/data-display/syntax-box/internals/formatters/formatter.unit.test.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFieldDisabled, syncFieldHost } from "../../../utils/form-field-state";
|
|
2
2
|
import { registerFormField } from "../../../utils/form-field-adapter";
|
|
3
3
|
import { fieldFeedback, feedbackStyle } from "../../shared/field";
|
|
4
|
-
import { h } from "@stencil/core";
|
|
4
|
+
import { Fragment, h } from "@stencil/core";
|
|
5
5
|
import { identifyItems } from "../../../utils/collection-identity";
|
|
6
6
|
import { getDropdownOptions, getFilteredOptions, getOptionLabel, getSelectedOption, getVisibleOptions } from "./internals/options";
|
|
7
7
|
import { computeDropdownPosition } from "./internals/position";
|
|
@@ -11,7 +11,7 @@ const MENU_OFFSET = 4;
|
|
|
11
11
|
* and externally loaded option pages.
|
|
12
12
|
* @slot icon-left - Optional leading content rendered inside the trigger.
|
|
13
13
|
* @part label - Optional field label.
|
|
14
|
-
* @part trigger -
|
|
14
|
+
* @part trigger - Active input or button that opens the option menu.
|
|
15
15
|
* @part menu - Floating option menu.
|
|
16
16
|
*/
|
|
17
17
|
export class QDropdown {
|
|
@@ -25,12 +25,20 @@ export class QDropdown {
|
|
|
25
25
|
/** Options to render; strings use the same text for label and value, while objects allow separate values. */
|
|
26
26
|
options = [];
|
|
27
27
|
value = '';
|
|
28
|
+
/** Select several options. Uses values/qValuesChange instead of value/qChange. */
|
|
29
|
+
multiple = false;
|
|
30
|
+
/** Selected identities in multiple mode. Replace the array to update selections. */
|
|
31
|
+
values = [];
|
|
28
32
|
/** Keep the label accessible without displaying it. */
|
|
29
33
|
labelHidden = false;
|
|
30
34
|
/** Omitted inherits the enclosing form; false cancels reservation. */
|
|
31
35
|
reserveFeedback;
|
|
32
36
|
size = 'inherit';
|
|
37
|
+
/** Opt-in horizontal width; fit-options sizes to loaded option labels. Omitted keeps the full-width layout. */
|
|
38
|
+
width;
|
|
33
39
|
searchable = false;
|
|
40
|
+
/** Search in the main editable control (default) or a separate menu field. Applies only when searchable. */
|
|
41
|
+
searchMode = 'default';
|
|
34
42
|
/** Delegates filtering and pagination to the consumer. */
|
|
35
43
|
externalSearch = false;
|
|
36
44
|
/** Indicates another externally loaded option page is available. */
|
|
@@ -54,6 +62,8 @@ export class QDropdown {
|
|
|
54
62
|
internals;
|
|
55
63
|
/** Emitted with the selected option value when selection changes. */
|
|
56
64
|
qChange;
|
|
65
|
+
/** Complete selected identities after an add or removal in multiple mode. */
|
|
66
|
+
qValuesChange;
|
|
57
67
|
/** Emitted with the selected option object when selection changes. */
|
|
58
68
|
qSelect;
|
|
59
69
|
/** Emitted with the current search term when a searchable dropdown uses external search. */
|
|
@@ -78,21 +88,78 @@ export class QDropdown {
|
|
|
78
88
|
positionFrame = null;
|
|
79
89
|
floatingCleanup;
|
|
80
90
|
floatingResizeObserver;
|
|
91
|
+
fitOptionsMeasure;
|
|
92
|
+
fitOptionsObserver;
|
|
93
|
+
draftEdited = false;
|
|
94
|
+
selectedLabelCache;
|
|
95
|
+
composing = false;
|
|
96
|
+
lastSearchValue;
|
|
97
|
+
initialValues = [];
|
|
98
|
+
multipleLabels = new Map();
|
|
99
|
+
multipleFrame;
|
|
100
|
+
chipMeasure;
|
|
101
|
+
multipleObserver;
|
|
102
|
+
visibleChips = 0;
|
|
103
|
+
selectedPanel = false;
|
|
104
|
+
get editableSearch() { return this.multiple || this.searchable && this.searchMode !== 'menu'; }
|
|
105
|
+
get selectedValues() {
|
|
106
|
+
return Array.isArray(this.values) ? [...new Set(this.values.filter(value => typeof value === 'string'))] : [];
|
|
107
|
+
}
|
|
108
|
+
reconcileSelectedLabel() {
|
|
109
|
+
const selected = this.getSelectedOption();
|
|
110
|
+
if (selected)
|
|
111
|
+
this.selectedLabelCache = { value: this.value, label: this.getOptionLabel(selected) };
|
|
112
|
+
else if (!this.value || !this.externalSearch || this.selectedLabelCache?.value !== this.value)
|
|
113
|
+
this.selectedLabelCache = undefined;
|
|
114
|
+
}
|
|
115
|
+
closeMenu() {
|
|
116
|
+
this.isOpen = false;
|
|
117
|
+
this.selectedPanel = false;
|
|
118
|
+
this.focusedIndex = -1;
|
|
119
|
+
this.searchTerm = '';
|
|
120
|
+
this.lastSearchValue = undefined;
|
|
121
|
+
this.draftEdited = false;
|
|
122
|
+
this.composing = false;
|
|
123
|
+
this.visibleCount = 20;
|
|
124
|
+
this.clearScrollLoading();
|
|
125
|
+
if (this.triggerEl?.tagName === 'INPUT') {
|
|
126
|
+
const selected = this.getSelectedOption();
|
|
127
|
+
this.triggerEl.value = this.multiple ? '' : this.getOptionLabel(selected) || (this.externalSearch && this.selectedLabelCache?.value === this.value ? this.selectedLabelCache.label : '');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
watchSearchMode() {
|
|
131
|
+
const hadFocus = Boolean(this.el.shadowRoot?.activeElement);
|
|
132
|
+
this.closeMenu();
|
|
133
|
+
this.searchInputEl = undefined;
|
|
134
|
+
if (hadFocus)
|
|
135
|
+
requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
|
|
136
|
+
}
|
|
81
137
|
// ========================= [3] LIFECYCLE & WATCHERS ==========================
|
|
138
|
+
connectedCallback() {
|
|
139
|
+
this.observeFitOptions();
|
|
140
|
+
}
|
|
82
141
|
disconnectedCallback() {
|
|
83
142
|
this.clearScrollLoading();
|
|
84
143
|
this.stopFloatingUpdates();
|
|
144
|
+
this.fitOptionsObserver?.disconnect();
|
|
145
|
+
this.multipleObserver?.disconnect();
|
|
85
146
|
}
|
|
86
147
|
formDisabledCallback() {
|
|
87
148
|
this.syncValidity();
|
|
88
149
|
}
|
|
89
150
|
componentDidLoad() {
|
|
151
|
+
const dropdown = this;
|
|
90
152
|
registerFormField(this.el, {
|
|
91
|
-
kind: 'selection',
|
|
153
|
+
get kind() { return dropdown.multiple ? 'multiselect' : 'selection'; },
|
|
92
154
|
owner: () => this.internals?.form ?? null,
|
|
93
155
|
active: () => true,
|
|
94
|
-
value: () => this.getFormSelection(),
|
|
95
|
-
assign: value => {
|
|
156
|
+
value: () => this.multiple ? this.getMultipleFormSelection() : this.getFormSelection(),
|
|
157
|
+
assign: value => {
|
|
158
|
+
if (this.multiple)
|
|
159
|
+
this.values = Array.isArray(value) ? [...value] : [];
|
|
160
|
+
else
|
|
161
|
+
this.value = value;
|
|
162
|
+
},
|
|
96
163
|
reconcile: () => {
|
|
97
164
|
this.syncValidity();
|
|
98
165
|
},
|
|
@@ -102,18 +169,66 @@ export class QDropdown {
|
|
|
102
169
|
}
|
|
103
170
|
componentDidRender() {
|
|
104
171
|
this.syncValidity();
|
|
172
|
+
this.observeFitOptions();
|
|
173
|
+
this.observeMultipleLayout();
|
|
105
174
|
if (this.isOpen) {
|
|
106
175
|
this.openFloatingMenu();
|
|
107
176
|
return;
|
|
108
177
|
}
|
|
109
178
|
this.stopFloatingUpdates();
|
|
110
179
|
}
|
|
180
|
+
observeFitOptions = () => {
|
|
181
|
+
this.fitOptionsObserver?.disconnect();
|
|
182
|
+
if (this.width !== 'fit-options' || !this.fitOptionsMeasure) {
|
|
183
|
+
this.el.style.removeProperty('--_q-dropdown-options-width');
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.fitOptionsObserver ??= new ResizeObserver(this.updateFitOptionsWidth);
|
|
187
|
+
this.fitOptionsObserver.observe(this.fitOptionsMeasure, { box: 'border-box' });
|
|
188
|
+
for (const icon of Array.from(this.el.querySelectorAll('[slot="icon-left"]'))) {
|
|
189
|
+
this.fitOptionsObserver.observe(icon);
|
|
190
|
+
}
|
|
191
|
+
this.updateFitOptionsWidth();
|
|
192
|
+
};
|
|
193
|
+
updateFitOptionsWidth = () => {
|
|
194
|
+
if (this.width !== 'fit-options' || !this.fitOptionsMeasure || !this.triggerEl)
|
|
195
|
+
return;
|
|
196
|
+
const icons = Array.from(this.el.querySelectorAll('[slot="icon-left"]'));
|
|
197
|
+
const triggerStyle = getComputedStyle(this.triggerEl);
|
|
198
|
+
const gap = parseFloat(triggerStyle.columnGap) || 0;
|
|
199
|
+
const leadingWidth = icons.reduce((total, icon) => {
|
|
200
|
+
const style = getComputedStyle(icon);
|
|
201
|
+
return total + icon.getBoundingClientRect().width + (parseFloat(style.marginInlineStart) || 0) + (parseFloat(style.marginInlineEnd) || 0);
|
|
202
|
+
}, 0);
|
|
203
|
+
const labelWidth = this.fitOptionsMeasure.querySelector('.fit-options-labels').getBoundingClientRect().width;
|
|
204
|
+
const arrowWidth = this.fitOptionsMeasure.querySelector('.chevron-icon').getBoundingClientRect().width;
|
|
205
|
+
const frameWidth = ['paddingInlineStart', 'paddingInlineEnd', 'borderInlineStartWidth', 'borderInlineEndWidth']
|
|
206
|
+
.reduce((total, property) => total + (parseFloat(triggerStyle[property]) || 0), 0);
|
|
207
|
+
const adornmentWidth = this.editableSearch ? 0 : arrowWidth + gap + leadingWidth + (leadingWidth ? gap : 0);
|
|
208
|
+
const width = `${Math.ceil(labelWidth + frameWidth + adornmentWidth)}px`;
|
|
209
|
+
if (this.el.style.getPropertyValue('--_q-dropdown-options-width') !== width) {
|
|
210
|
+
this.el.style.setProperty('--_q-dropdown-options-width', width);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
111
213
|
watchValue(newValue) {
|
|
214
|
+
if (this.multiple)
|
|
215
|
+
return;
|
|
216
|
+
this.reconcileSelectedLabel();
|
|
217
|
+
this.closeMenu();
|
|
112
218
|
if (this.internals && typeof this.internals.setFormValue === 'function') {
|
|
113
219
|
this.internals.setFormValue(newValue);
|
|
114
220
|
}
|
|
115
221
|
this.syncValidity();
|
|
116
222
|
}
|
|
223
|
+
watchValues() {
|
|
224
|
+
this.reconcileMultipleLabels();
|
|
225
|
+
this.focusedIndex = -1;
|
|
226
|
+
this.syncValidity();
|
|
227
|
+
}
|
|
228
|
+
watchMultiple() {
|
|
229
|
+
this.closeMenu();
|
|
230
|
+
this.syncValidity();
|
|
231
|
+
}
|
|
117
232
|
syncValidity() {
|
|
118
233
|
const disabled = syncFieldHost(this.el, this.disabled, this.name, this.required);
|
|
119
234
|
if (this.disabledState !== disabled)
|
|
@@ -123,19 +238,26 @@ export class QDropdown {
|
|
|
123
238
|
if (this.searchInputEl)
|
|
124
239
|
this.searchInputEl.disabled = disabled;
|
|
125
240
|
if (disabled && this.isOpen) {
|
|
126
|
-
this.
|
|
241
|
+
this.closeMenu();
|
|
127
242
|
this.stopFloatingUpdates();
|
|
128
243
|
}
|
|
129
244
|
const selected = this.getFormSelection();
|
|
130
|
-
this.
|
|
245
|
+
const selectedValues = this.getMultipleFormSelection();
|
|
246
|
+
const data = new FormData();
|
|
247
|
+
if (this.name)
|
|
248
|
+
for (const value of selectedValues)
|
|
249
|
+
data.append(this.name, value);
|
|
250
|
+
this.internals?.setFormValue?.(disabled ? null : this.multiple ? data : selected);
|
|
131
251
|
if (typeof this.internals?.setValidity !== 'function')
|
|
132
252
|
return;
|
|
133
|
-
const
|
|
253
|
+
const missing = this.multiple ? !selectedValues.length : !this.value || selected === null;
|
|
254
|
+
const message = this.isDisabled ? '' : this.error?.trim() || (this.required && missing ? 'Please select an option.' : '');
|
|
134
255
|
this.internals.setValidity(message ? this.error?.trim() ? { customError: true } : { valueMissing: true } : {}, message, this.triggerEl);
|
|
135
256
|
}
|
|
136
257
|
async checkValidity() {
|
|
137
258
|
this.syncValidity();
|
|
138
|
-
|
|
259
|
+
const missing = this.multiple ? !this.getMultipleFormSelection().length : !this.value || this.getFormSelection() === null;
|
|
260
|
+
return this.isDisabled || !(this.error?.trim() || (this.required && missing));
|
|
139
261
|
}
|
|
140
262
|
async reportValidity() {
|
|
141
263
|
const valid = await this.checkValidity();
|
|
@@ -149,6 +271,9 @@ export class QDropdown {
|
|
|
149
271
|
this.triggerEl?.focus();
|
|
150
272
|
}
|
|
151
273
|
watchOptions() {
|
|
274
|
+
this.reconcileSelectedLabel();
|
|
275
|
+
this.reconcileMultipleLabels();
|
|
276
|
+
this.focusedIndex = -1;
|
|
152
277
|
this.syncValidity();
|
|
153
278
|
if (this.externalSearch) {
|
|
154
279
|
this.isScrollingLoading = false;
|
|
@@ -160,7 +285,10 @@ export class QDropdown {
|
|
|
160
285
|
}
|
|
161
286
|
}
|
|
162
287
|
componentWillLoad() {
|
|
288
|
+
this.reconcileSelectedLabel();
|
|
289
|
+
this.reconcileMultipleLabels();
|
|
163
290
|
this.initialValue = this.value || '';
|
|
291
|
+
this.initialValues = [...this.selectedValues];
|
|
164
292
|
if (this.internals && typeof this.internals.setFormValue === 'function') {
|
|
165
293
|
this.internals.setFormValue(this.value);
|
|
166
294
|
}
|
|
@@ -170,7 +298,9 @@ export class QDropdown {
|
|
|
170
298
|
this.syncValidity();
|
|
171
299
|
}
|
|
172
300
|
formResetCallback() {
|
|
301
|
+
this.closeMenu();
|
|
173
302
|
this.value = this.initialValue;
|
|
303
|
+
this.values = [...this.initialValues];
|
|
174
304
|
if (this.internals && typeof this.internals.setFormValue === 'function') {
|
|
175
305
|
this.internals.setFormValue(this.value);
|
|
176
306
|
}
|
|
@@ -183,6 +313,77 @@ export class QDropdown {
|
|
|
183
313
|
return selected.value;
|
|
184
314
|
return this.externalSearch && !selected && this.value ? this.value : null;
|
|
185
315
|
}
|
|
316
|
+
getMultipleFormSelection() {
|
|
317
|
+
const options = this.getAllOptions();
|
|
318
|
+
return this.selectedValues.filter(value => {
|
|
319
|
+
const option = getSelectedOption(options, value);
|
|
320
|
+
return option ? option.disabled !== true : this.externalSearch;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
reconcileMultipleLabels() {
|
|
324
|
+
const next = new Map();
|
|
325
|
+
for (const value of this.selectedValues) {
|
|
326
|
+
const option = getSelectedOption(this.getAllOptions(), value);
|
|
327
|
+
next.set(value, option ? this.getOptionLabel(option) : this.multipleLabels.get(value) ?? value);
|
|
328
|
+
}
|
|
329
|
+
this.multipleLabels = next;
|
|
330
|
+
}
|
|
331
|
+
removeValue = (value, event) => {
|
|
332
|
+
event?.stopPropagation();
|
|
333
|
+
if (this.isDisabled)
|
|
334
|
+
return;
|
|
335
|
+
this.values = this.selectedValues.filter(selected => selected !== value);
|
|
336
|
+
this.qValuesChange.emit([...this.values]);
|
|
337
|
+
if (!this.values.length)
|
|
338
|
+
this.closeMenu();
|
|
339
|
+
requestAnimationFrame(() => focusWithoutScroll(this.selectedPanel
|
|
340
|
+
? this.menuEl?.querySelector('q-chip')?.shadowRoot?.querySelector('button') ?? this.triggerEl
|
|
341
|
+
: this.triggerEl));
|
|
342
|
+
};
|
|
343
|
+
observeMultipleLayout() {
|
|
344
|
+
this.multipleObserver?.disconnect();
|
|
345
|
+
if (!this.multiple || !this.multipleFrame || !this.chipMeasure)
|
|
346
|
+
return;
|
|
347
|
+
this.multipleObserver ??= new ResizeObserver(this.measureMultipleLayout);
|
|
348
|
+
this.multipleObserver.observe(this.multipleFrame);
|
|
349
|
+
this.multipleObserver.observe(this.chipMeasure);
|
|
350
|
+
this.measureMultipleLayout();
|
|
351
|
+
}
|
|
352
|
+
measureMultipleLayout = () => {
|
|
353
|
+
if (!this.multipleFrame || !this.chipMeasure)
|
|
354
|
+
return;
|
|
355
|
+
const style = getComputedStyle(this.multipleFrame);
|
|
356
|
+
const gap = parseFloat(style.columnGap) || 0;
|
|
357
|
+
const frame = ['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth']
|
|
358
|
+
.reduce((sum, key) => sum + (parseFloat(style.getPropertyValue(key.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()))) || 0), 0);
|
|
359
|
+
const searchWidth = parseFloat(getComputedStyle(this.triggerEl).minWidth) || 64;
|
|
360
|
+
const iconWidth = this.multipleFrame.querySelector('.chevron-icon')?.getBoundingClientRect().width ?? 16;
|
|
361
|
+
const leadingWidth = Array.from(this.el.querySelectorAll('[slot="icon-left"]')).reduce((sum, node) => sum + node.getBoundingClientRect().width + gap, 0);
|
|
362
|
+
const available = this.multipleFrame.getBoundingClientRect().width - frame - searchWidth - iconWidth - leadingWidth - gap * 2;
|
|
363
|
+
const chips = Array.from(this.chipMeasure.querySelectorAll('q-chip'));
|
|
364
|
+
const widths = chips.map(chip => chip.getBoundingClientRect().width + gap);
|
|
365
|
+
const overflowWidth = this.chipMeasure.querySelector('.multiple-more').getBoundingClientRect().width + gap;
|
|
366
|
+
const allFit = widths.reduce((sum, width) => sum + width, 0) <= available;
|
|
367
|
+
let remaining = available - (allFit ? 0 : overflowWidth);
|
|
368
|
+
let count = 0;
|
|
369
|
+
for (const width of widths) {
|
|
370
|
+
if (width > remaining)
|
|
371
|
+
break;
|
|
372
|
+
count++;
|
|
373
|
+
remaining -= width;
|
|
374
|
+
}
|
|
375
|
+
if (count !== this.visibleChips)
|
|
376
|
+
this.visibleChips = count;
|
|
377
|
+
};
|
|
378
|
+
openSelectedPanel = (event) => {
|
|
379
|
+
event.stopPropagation();
|
|
380
|
+
if (this.isDisabled)
|
|
381
|
+
return;
|
|
382
|
+
this.closeMenu();
|
|
383
|
+
this.selectedPanel = true;
|
|
384
|
+
this.isOpen = true;
|
|
385
|
+
requestAnimationFrame(() => focusWithoutScroll(this.menuEl?.querySelector('q-chip')?.shadowRoot?.querySelector('button')));
|
|
386
|
+
};
|
|
186
387
|
clearScrollLoading() {
|
|
187
388
|
this.isScrollingLoading = false;
|
|
188
389
|
if (this.scrollTimeout !== null) {
|
|
@@ -200,10 +401,11 @@ export class QDropdown {
|
|
|
200
401
|
return getSelectedOption(options, this.value);
|
|
201
402
|
}
|
|
202
403
|
getFilteredOptions() {
|
|
404
|
+
const available = this.multiple ? this.getAllOptions().filter(option => !this.selectedValues.includes(option.value)) : this.getAllOptions();
|
|
203
405
|
if (this.externalSearch) {
|
|
204
|
-
return
|
|
406
|
+
return available;
|
|
205
407
|
}
|
|
206
|
-
return getFilteredOptions(
|
|
408
|
+
return getFilteredOptions(available, this.searchTerm, this.multiple || this.searchable);
|
|
207
409
|
}
|
|
208
410
|
get parsedOptions() {
|
|
209
411
|
if (this.externalSearch) {
|
|
@@ -219,9 +421,9 @@ export class QDropdown {
|
|
|
219
421
|
if (this.isOpen) {
|
|
220
422
|
this.searchTerm = '';
|
|
221
423
|
this.visibleCount = 20;
|
|
222
|
-
if (this.searchable) {
|
|
424
|
+
if (this.multiple || this.searchable) {
|
|
223
425
|
this.focusedIndex = -1;
|
|
224
|
-
requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
|
|
426
|
+
requestAnimationFrame(() => focusWithoutScroll(this.editableSearch ? this.triggerEl : this.searchInputEl));
|
|
225
427
|
}
|
|
226
428
|
else {
|
|
227
429
|
const activeIdx = this.parsedOptions.findIndex(opt => opt.value === this.value);
|
|
@@ -230,20 +432,35 @@ export class QDropdown {
|
|
|
230
432
|
}
|
|
231
433
|
}
|
|
232
434
|
else {
|
|
233
|
-
this.
|
|
234
|
-
this.searchTerm = '';
|
|
235
|
-
this.visibleCount = 20;
|
|
435
|
+
this.closeMenu();
|
|
236
436
|
requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
|
|
237
437
|
}
|
|
238
438
|
};
|
|
239
439
|
handleSelect = (option) => {
|
|
240
440
|
if (this.isDisabled)
|
|
241
441
|
return;
|
|
442
|
+
if (this.multiple) {
|
|
443
|
+
if (this.selectedValues.includes(option.value))
|
|
444
|
+
return;
|
|
445
|
+
this.values = [...this.selectedValues, option.value];
|
|
446
|
+
this.multipleLabels.set(option.value, this.getOptionLabel(option));
|
|
447
|
+
this.searchTerm = '';
|
|
448
|
+
if (this.triggerEl instanceof HTMLInputElement) {
|
|
449
|
+
this.triggerEl.value = '';
|
|
450
|
+
}
|
|
451
|
+
this.draftEdited = false;
|
|
452
|
+
this.focusedIndex = -1;
|
|
453
|
+
this.qValuesChange.emit([...this.values]);
|
|
454
|
+
this.qSelect.emit(option);
|
|
455
|
+
if (this.externalSearch && this.lastSearchValue)
|
|
456
|
+
this.qSearch.emit('');
|
|
457
|
+
this.lastSearchValue = '';
|
|
458
|
+
requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
242
461
|
this.value = option.value;
|
|
243
|
-
this.
|
|
244
|
-
this.
|
|
245
|
-
this.searchTerm = '';
|
|
246
|
-
this.clearScrollLoading();
|
|
462
|
+
this.selectedLabelCache = { value: option.value, label: this.getOptionLabel(option) };
|
|
463
|
+
this.closeMenu();
|
|
247
464
|
this.qChange.emit(option.value);
|
|
248
465
|
this.qSelect.emit(option);
|
|
249
466
|
requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
|
|
@@ -254,6 +471,25 @@ export class QDropdown {
|
|
|
254
471
|
handleBlur = (ev) => {
|
|
255
472
|
this.qBlur.emit(ev);
|
|
256
473
|
};
|
|
474
|
+
handleFocusOut = (ev) => {
|
|
475
|
+
const next = ev.relatedTarget;
|
|
476
|
+
if (!next || (!this.el.contains(next) && !this.el.shadowRoot?.contains(next)))
|
|
477
|
+
this.closeMenu();
|
|
478
|
+
};
|
|
479
|
+
handleEditableClick = (ev) => {
|
|
480
|
+
if (this.isDisabled)
|
|
481
|
+
return;
|
|
482
|
+
this.qClick.emit(ev);
|
|
483
|
+
if (this.selectedPanel)
|
|
484
|
+
this.closeMenu();
|
|
485
|
+
if (!this.isOpen)
|
|
486
|
+
this.toggleMenu();
|
|
487
|
+
};
|
|
488
|
+
handleCompositionStart = () => { this.composing = true; };
|
|
489
|
+
handleCompositionEnd = (ev) => {
|
|
490
|
+
this.composing = false;
|
|
491
|
+
this.handleSearchInput(ev);
|
|
492
|
+
};
|
|
257
493
|
handleTriggerClick = (ev) => {
|
|
258
494
|
if (this.isDisabled)
|
|
259
495
|
return;
|
|
@@ -264,11 +500,17 @@ export class QDropdown {
|
|
|
264
500
|
if (this.isDisabled)
|
|
265
501
|
return;
|
|
266
502
|
const target = ev.target;
|
|
503
|
+
if (this.composing || ev.isComposing)
|
|
504
|
+
return;
|
|
505
|
+
this.draftEdited = true;
|
|
506
|
+
this.selectedPanel = false;
|
|
267
507
|
this.searchTerm = target.value || '';
|
|
508
|
+
this.isOpen = true;
|
|
268
509
|
this.focusedIndex = -1;
|
|
269
510
|
this.visibleCount = 20;
|
|
270
511
|
this.clearScrollLoading();
|
|
271
|
-
if (this.externalSearch) {
|
|
512
|
+
if (this.externalSearch && this.searchTerm !== this.lastSearchValue) {
|
|
513
|
+
this.lastSearchValue = this.searchTerm;
|
|
272
514
|
this.qSearch.emit(this.searchTerm);
|
|
273
515
|
}
|
|
274
516
|
};
|
|
@@ -341,7 +583,7 @@ export class QDropdown {
|
|
|
341
583
|
window.addEventListener('scroll', update, true);
|
|
342
584
|
if (typeof ResizeObserver !== 'undefined') {
|
|
343
585
|
this.floatingResizeObserver = new ResizeObserver(update);
|
|
344
|
-
this.floatingResizeObserver.observe(this.triggerEl);
|
|
586
|
+
this.floatingResizeObserver.observe(this.multiple ? this.multipleFrame : this.triggerEl);
|
|
345
587
|
this.floatingResizeObserver.observe(this.menuEl);
|
|
346
588
|
}
|
|
347
589
|
this.floatingCleanup = () => {
|
|
@@ -374,7 +616,7 @@ export class QDropdown {
|
|
|
374
616
|
});
|
|
375
617
|
}
|
|
376
618
|
positionFloatingMenu() {
|
|
377
|
-
const trigger = this.triggerEl;
|
|
619
|
+
const trigger = this.multiple ? this.multipleFrame : this.triggerEl;
|
|
378
620
|
const menu = this.menuEl;
|
|
379
621
|
if (!this.isOpen || !trigger || !menu) {
|
|
380
622
|
return;
|
|
@@ -404,114 +646,79 @@ export class QDropdown {
|
|
|
404
646
|
menu.style.visibility = 'visible';
|
|
405
647
|
}
|
|
406
648
|
handleKeyDown = (ev) => {
|
|
407
|
-
if (this.isDisabled)
|
|
649
|
+
if (this.isDisabled || this.composing || ev.isComposing || ev.keyCode === 229)
|
|
408
650
|
return;
|
|
409
|
-
const
|
|
410
|
-
|
|
651
|
+
const source = ev.composedPath()[0];
|
|
652
|
+
if (this.multiple && source !== this.triggerEl && ev.key !== 'Escape')
|
|
653
|
+
return;
|
|
654
|
+
if (this.multiple && ev.key === 'Backspace' && !this.searchTerm && this.selectedValues.length && source === this.triggerEl) {
|
|
655
|
+
ev.preventDefault();
|
|
656
|
+
this.removeValue(this.selectedValues[this.selectedValues.length - 1]);
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
const isInput = ev.target?.tagName?.toLowerCase() === 'input';
|
|
411
660
|
const maxIndex = this.parsedOptions.length - 1;
|
|
412
661
|
switch (ev.key) {
|
|
413
662
|
case 'ArrowDown':
|
|
663
|
+
case 'ArrowUp': {
|
|
414
664
|
ev.preventDefault();
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
else {
|
|
422
|
-
const activeIdx = this.parsedOptions.findIndex(opt => opt.value === this.value);
|
|
423
|
-
const nextIdx = activeIdx >= 0 ? activeIdx : 0;
|
|
424
|
-
this.updateFocusedIndex(nextIdx);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
if (isInput) {
|
|
429
|
-
if (maxIndex >= 0) {
|
|
430
|
-
this.updateFocusedIndex(0);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
const nextIdx = Math.min(this.focusedIndex + 1, maxIndex);
|
|
435
|
-
this.updateFocusedIndex(nextIdx);
|
|
436
|
-
}
|
|
665
|
+
this.selectedPanel = false;
|
|
666
|
+
const opening = !this.isOpen;
|
|
667
|
+
this.isOpen = true;
|
|
668
|
+
if (opening && this.searchable && !this.editableSearch) {
|
|
669
|
+
this.focusedIndex = -1;
|
|
670
|
+
requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
|
|
437
671
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (!this.isOpen) {
|
|
442
|
-
this.isOpen = true;
|
|
443
|
-
const activeIdx = this.parsedOptions.findIndex(opt => opt.value === this.value);
|
|
444
|
-
const nextIdx = activeIdx >= 0 ? activeIdx : maxIndex;
|
|
445
|
-
this.updateFocusedIndex(nextIdx);
|
|
672
|
+
else if (ev.key === 'ArrowDown') {
|
|
673
|
+
const selected = opening && !isInput ? this.parsedOptions.findIndex(option => option.value === this.value) : -1;
|
|
674
|
+
this.updateFocusedIndex(selected >= 0 ? selected : Math.min(this.focusedIndex + 1, maxIndex));
|
|
446
675
|
}
|
|
447
676
|
else {
|
|
448
|
-
|
|
449
|
-
this.focusedIndex = -1;
|
|
450
|
-
requestAnimationFrame(() => focusWithoutScroll(this.searchInputEl));
|
|
451
|
-
}
|
|
452
|
-
else if (this.focusedIndex > 0) {
|
|
453
|
-
const nextIdx = this.focusedIndex - 1;
|
|
454
|
-
this.updateFocusedIndex(nextIdx);
|
|
455
|
-
}
|
|
677
|
+
this.updateFocusedIndex(this.focusedIndex < 0 ? maxIndex : Math.max(-1, this.focusedIndex - 1));
|
|
456
678
|
}
|
|
457
679
|
break;
|
|
680
|
+
}
|
|
458
681
|
case 'Home':
|
|
459
|
-
if (this.isOpen && !isInput) {
|
|
460
|
-
ev.preventDefault();
|
|
461
|
-
this.updateFocusedIndex(0);
|
|
462
|
-
}
|
|
463
|
-
break;
|
|
464
682
|
case 'End':
|
|
465
683
|
if (this.isOpen && !isInput) {
|
|
466
684
|
ev.preventDefault();
|
|
467
|
-
this.updateFocusedIndex(maxIndex);
|
|
685
|
+
this.updateFocusedIndex(ev.key === 'Home' ? 0 : maxIndex);
|
|
468
686
|
}
|
|
469
687
|
break;
|
|
470
688
|
case 'Enter':
|
|
471
689
|
if (isInput) {
|
|
472
|
-
if (this.
|
|
690
|
+
if (this.isOpen) {
|
|
473
691
|
ev.preventDefault();
|
|
474
|
-
this.
|
|
692
|
+
if (this.focusedIndex >= 0 && this.focusedIndex <= maxIndex)
|
|
693
|
+
this.handleSelect(this.parsedOptions[this.focusedIndex]);
|
|
475
694
|
}
|
|
476
695
|
}
|
|
477
696
|
else {
|
|
478
697
|
ev.preventDefault();
|
|
479
|
-
if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex
|
|
698
|
+
if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex <= maxIndex)
|
|
480
699
|
this.handleSelect(this.parsedOptions[this.focusedIndex]);
|
|
481
|
-
|
|
482
|
-
else {
|
|
700
|
+
else
|
|
483
701
|
this.toggleMenu();
|
|
484
|
-
}
|
|
485
702
|
}
|
|
486
703
|
break;
|
|
487
704
|
case ' ':
|
|
488
705
|
if (!isInput) {
|
|
489
706
|
ev.preventDefault();
|
|
490
|
-
if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex
|
|
707
|
+
if (this.isOpen && this.focusedIndex >= 0 && this.focusedIndex <= maxIndex)
|
|
491
708
|
this.handleSelect(this.parsedOptions[this.focusedIndex]);
|
|
492
|
-
|
|
493
|
-
else {
|
|
709
|
+
else
|
|
494
710
|
this.toggleMenu();
|
|
495
|
-
}
|
|
496
711
|
}
|
|
497
712
|
break;
|
|
498
713
|
case 'Escape':
|
|
499
|
-
if (this.isOpen) {
|
|
714
|
+
if (this.isOpen || this.draftEdited) {
|
|
500
715
|
ev.preventDefault();
|
|
501
|
-
this.
|
|
502
|
-
this.focusedIndex = -1;
|
|
503
|
-
this.searchTerm = '';
|
|
504
|
-
this.clearScrollLoading();
|
|
716
|
+
this.closeMenu();
|
|
505
717
|
requestAnimationFrame(() => focusWithoutScroll(this.triggerEl));
|
|
506
718
|
}
|
|
507
719
|
break;
|
|
508
720
|
case 'Tab':
|
|
509
|
-
|
|
510
|
-
this.isOpen = false;
|
|
511
|
-
this.focusedIndex = -1;
|
|
512
|
-
this.searchTerm = '';
|
|
513
|
-
this.clearScrollLoading();
|
|
514
|
-
}
|
|
721
|
+
this.closeMenu();
|
|
515
722
|
break;
|
|
516
723
|
}
|
|
517
724
|
};
|
|
@@ -519,11 +726,7 @@ export class QDropdown {
|
|
|
519
726
|
handleClickOutside(ev) {
|
|
520
727
|
const path = ev.composedPath();
|
|
521
728
|
if (this.el && !path.includes(this.el)) {
|
|
522
|
-
this.
|
|
523
|
-
this.focusedIndex = -1;
|
|
524
|
-
this.searchTerm = '';
|
|
525
|
-
this.visibleCount = 20;
|
|
526
|
-
this.clearScrollLoading();
|
|
729
|
+
this.closeMenu();
|
|
527
730
|
}
|
|
528
731
|
}
|
|
529
732
|
// ===================== [6] RENDER (Visual Template Only) =====================
|
|
@@ -534,20 +737,20 @@ export class QDropdown {
|
|
|
534
737
|
warningContext: 'q-dropdown options',
|
|
535
738
|
});
|
|
536
739
|
const selectedOption = this.getSelectedOption(allOptions);
|
|
537
|
-
const selectedLabel = this.getOptionLabel(selectedOption);
|
|
538
|
-
const displayLabel =
|
|
539
|
-
const hasSelection = selectedOption !== undefined;
|
|
740
|
+
const selectedLabel = this.getOptionLabel(selectedOption) || (this.externalSearch && this.selectedLabelCache?.value === this.value ? this.selectedLabelCache.label : '');
|
|
741
|
+
const displayLabel = selectedLabel || this.placeholder;
|
|
742
|
+
const hasSelection = selectedOption !== undefined || Boolean(this.externalSearch && this.selectedLabelCache?.value === this.value);
|
|
540
743
|
const ariaLabel = this.ariaLabel?.trim() || undefined;
|
|
541
|
-
return (h("div", { key: '
|
|
744
|
+
return (h("div", { key: 'e370fa24a234615e5ef77cb172709bfeb9d5e90d', style: feedbackStyle(this.reserveFeedback), class: {
|
|
542
745
|
'dropdown-wrapper': true,
|
|
543
746
|
'is-open': this.isOpen,
|
|
544
747
|
'is-disabled': this.isDisabled,
|
|
545
748
|
[`size-${this.size}`]: true
|
|
546
|
-
}, onKeyDown: this.handleKeyDown }, this.label && (h("label", { key: '
|
|
749
|
+
}, onKeyDown: this.handleKeyDown, onFocusout: this.handleFocusOut }, this.label && (h("label", { key: '4ada73143b430d0d9a2f854cd9c3c8e784753ff8', class: { 'dropdown-label': true, 'q-label-hidden': this.labelHidden }, htmlFor: "q-field", part: "label" }, this.label)), this.width === 'fit-options' && (h("span", { key: 'a409eeaa7ee55ea5ec01a138d9084f52930fc2fe', class: "fit-options-clip", "aria-hidden": "true" }, h("span", { key: '9e46b189537a80386e4bdf8dbf139239d364d859', class: "dropdown-trigger fit-options-measure", ref: el => (this.fitOptionsMeasure = el) }, h("span", { key: '48a1dea8e9a01b83faa0c90e8189e130f63080a5', class: "fit-options-labels" }, (allOptions.length ? allOptions.map(option => this.getOptionLabel(option)) : [selectedLabel || this.placeholder]).map(text => h("span", null, text))), h("span", { key: 'ed06556458c71d1669ad6d9c9ff2c5cbffdddb34', class: "chevron-icon" })))), this.multiple ? h("div", { class: "dropdown-trigger multiple-trigger", part: "trigger", ref: el => this.multipleFrame = el }, h("slot", { name: "icon-left", onSlotchange: this.measureMultipleLayout }), this.selectedValues.slice(0, this.visibleChips).map(value => h("q-chip", { key: value, size: "sm", removable: true, label: this.multipleLabels.get(value) ?? value, value: value, disabled: this.isDisabled, onQRemove: event => this.removeValue(value, event) })), this.visibleChips < this.selectedValues.length && h("button", { type: "button", class: "multiple-more", disabled: this.isDisabled, "aria-haspopup": "dialog", "aria-expanded": this.selectedPanel && this.isOpen ? 'true' : 'false', "aria-controls": this.selectedPanel && this.isOpen ? 'q-field-menu' : undefined, "aria-label": `${this.selectedValues.length - this.visibleChips} more selected options`, onClick: this.openSelectedPanel }, "+", this.selectedValues.length - this.visibleChips, " more"), h("input", { ref: el => this.triggerEl = el, id: "q-field", class: "multiple-input", type: "text", role: "combobox", autocomplete: "off", disabled: this.isDisabled, value: this.searchTerm, placeholder: this.selectedValues.length ? 'Search…' : this.placeholder, onClick: this.handleEditableClick, onInput: this.handleSearchInput, onFocus: this.handleFocus, onBlur: this.handleBlur, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, "aria-label": ariaLabel, "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error || this.required && !this.getMultipleFormSelection().length ? 'true' : 'false', "aria-describedby": this.error || this.description ? 'q-field-error' : undefined, "aria-expanded": this.isOpen && !this.selectedPanel ? 'true' : 'false', "aria-controls": this.isOpen && !this.selectedPanel ? 'q-field-menu' : undefined, "aria-activedescendant": this.isOpen && !this.selectedPanel && this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }), h("svg", { class: "chevron-icon", "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "6 9 12 15 18 9" })), h("span", { class: "multiple-measure", "aria-hidden": "true", inert: true, ref: el => this.chipMeasure = el }, this.selectedValues.map(value => h("q-chip", { key: value, size: "sm", removable: true, label: this.multipleLabels.get(value) ?? value })), h("button", { type: "button", class: "multiple-more", tabindex: -1 }, "+", this.selectedValues.length, " more"))) : this.editableSearch ? h("div", { class: { 'editable-trigger': true, 'has-leading-icon': Boolean(this.el.querySelector('[slot="icon-left"]')) } }, h("span", { class: "editable-leading" }, h("slot", { name: "icon-left", onSlotchange: this.observeFitOptions })), h("input", { ref: el => (this.triggerEl = el), id: "q-field", class: "dropdown-trigger dropdown-main-input", part: "trigger", type: "text", role: "combobox", autocomplete: "off", disabled: this.isDisabled, value: this.composing ? this.triggerEl?.value ?? selectedLabel : this.draftEdited ? this.searchTerm : selectedLabel, placeholder: this.placeholder, onClick: this.handleEditableClick, onFocus: this.handleFocus, onBlur: this.handleBlur, onInput: this.handleSearchInput, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, "aria-autocomplete": "list", "aria-haspopup": "listbox", "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error || (this.required && !this.value) ? 'true' : 'false', "aria-describedby": this.error || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": this.isOpen ? 'q-field-menu' : undefined, "aria-activedescendant": this.isOpen && this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }), h("svg", { class: "chevron-icon", "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "6 9 12 15 18 9" }))) : h("button", { ref: (el) => (this.triggerEl = el), id: "q-field", class: "dropdown-trigger", part: "trigger", type: "button", disabled: this.isDisabled, onClick: this.handleTriggerClick, onFocus: this.handleFocus, onBlur: this.handleBlur, "aria-haspopup": "listbox", "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error || (this.required && !this.value) ? 'true' : 'false', "aria-describedby": this.error || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-controls": this.isOpen ? 'q-field-menu' : undefined, "aria-activedescendant": this.isOpen && this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }, h("span", { class: "trigger-content" }, h("slot", { name: "icon-left", onSlotchange: this.observeFitOptions }), h("span", { class: { 'trigger-text': true, 'is-placeholder': !hasSelection } }, displayLabel)), h("svg", { class: "chevron-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "6 9 12 15 18 9" }))), fieldFeedback('q-field-error', this.error, this.description), this.isOpen && (h("div", { key: '857a01352aa02d4699d344e22d1257f1759b3d8f', ref: (el) => (this.menuEl = el), id: "q-field-menu", class: "dropdown-menu", part: "menu", role: this.selectedPanel ? 'dialog' : 'listbox', popover: "manual", "aria-label": this.selectedPanel ? 'Selected options' : ariaLabel || this.label || 'Options', "aria-multiselectable": this.multiple && !this.selectedPanel ? 'true' : undefined }, this.selectedPanel ? h("div", { class: "selected-options" }, h("strong", null, "Selected options"), this.selectedValues.map(value => h("q-chip", { key: value, size: "sm", removable: true, label: this.multipleLabels.get(value) ?? value, value: value, disabled: this.isDisabled, onQRemove: event => this.removeValue(value, event) })), h("button", { type: "button", class: "multiple-more", onClick: () => { this.closeMenu(); focusWithoutScroll(this.triggerEl); } }, "Done")) : h(Fragment, null, this.searchable && !this.editableSearch && (h("div", { class: "dropdown-search-container" }, h("input", { ref: (el) => (this.searchInputEl = el), type: "text", class: "dropdown-search-input", placeholder: "Search...", value: this.searchTerm, onInput: this.handleSearchInput, onCompositionstart: this.handleCompositionStart, onCompositionend: this.handleCompositionEnd, "aria-label": ariaLabel || this.label || 'Search options', role: "combobox", "aria-autocomplete": "list", "aria-controls": "q-field-menu", "aria-expanded": this.isOpen ? 'true' : 'false', "aria-activedescendant": this.focusedIndex >= 0 ? `q-field-item-${this.focusedIndex}` : undefined }))), h("ul", { ref: (el) => (this.itemsListEl = el), class: "dropdown-items-list", onScroll: this.handleScroll }, opts.length === 0 && !this.loading ? (h("li", { class: "menu-item is-empty" }, "No matches found")) : (identifiedOptions.map(({ item: option, index, key }) => (h("li", { key: key, id: `q-field-item-${index}`, class: {
|
|
547
750
|
'menu-item': true,
|
|
548
|
-
'is-selected': option.value === this.value,
|
|
751
|
+
'is-selected': !this.multiple && option.value === this.value,
|
|
549
752
|
'is-focused': index === this.focusedIndex
|
|
550
|
-
}, tabindex: -1, part: `item ${option.value === this.value ? 'selected-item' : ''} ${index === this.focusedIndex ? 'focused-item' : ''}`, role: "option", "aria-selected": option.value === this.value ? 'true' : 'false', onClick: () => this.handleSelect(option) }, this.getOptionLabel(option))))), (this.loading || this.isScrollingLoading) && (h("li", {
|
|
753
|
+
}, tabindex: -1, part: `item ${!this.multiple && option.value === this.value ? 'selected-item' : ''} ${index === this.focusedIndex ? 'focused-item' : ''}`, role: "option", "aria-selected": !this.multiple && option.value === this.value ? 'true' : 'false', onClick: () => this.handleSelect(option), onMouseDown: ev => ev.preventDefault() }, this.getOptionLabel(option))))), (this.loading || this.isScrollingLoading) && (h("li", { class: "menu-item is-loading-more" }, h("span", { class: "spinner-circle" }), h("span", null, "Loading...")))))))));
|
|
551
754
|
}
|
|
552
755
|
static get is() { return "q-dropdown"; }
|
|
553
756
|
static get encapsulation() { return "shadow"; }
|
|
@@ -690,6 +893,44 @@ export class QDropdown {
|
|
|
690
893
|
"attribute": "value",
|
|
691
894
|
"defaultValue": "''"
|
|
692
895
|
},
|
|
896
|
+
"multiple": {
|
|
897
|
+
"type": "boolean",
|
|
898
|
+
"mutable": false,
|
|
899
|
+
"complexType": {
|
|
900
|
+
"original": "boolean",
|
|
901
|
+
"resolved": "boolean",
|
|
902
|
+
"references": {}
|
|
903
|
+
},
|
|
904
|
+
"required": false,
|
|
905
|
+
"optional": false,
|
|
906
|
+
"docs": {
|
|
907
|
+
"tags": [],
|
|
908
|
+
"text": "Select several options. Uses values/qValuesChange instead of value/qChange."
|
|
909
|
+
},
|
|
910
|
+
"getter": false,
|
|
911
|
+
"setter": false,
|
|
912
|
+
"reflect": true,
|
|
913
|
+
"attribute": "multiple",
|
|
914
|
+
"defaultValue": "false"
|
|
915
|
+
},
|
|
916
|
+
"values": {
|
|
917
|
+
"type": "unknown",
|
|
918
|
+
"mutable": true,
|
|
919
|
+
"complexType": {
|
|
920
|
+
"original": "string[]",
|
|
921
|
+
"resolved": "string[]",
|
|
922
|
+
"references": {}
|
|
923
|
+
},
|
|
924
|
+
"required": false,
|
|
925
|
+
"optional": false,
|
|
926
|
+
"docs": {
|
|
927
|
+
"tags": [],
|
|
928
|
+
"text": "Selected identities in multiple mode. Replace the array to update selections."
|
|
929
|
+
},
|
|
930
|
+
"getter": false,
|
|
931
|
+
"setter": false,
|
|
932
|
+
"defaultValue": "[]"
|
|
933
|
+
},
|
|
693
934
|
"labelHidden": {
|
|
694
935
|
"type": "boolean",
|
|
695
936
|
"mutable": false,
|
|
@@ -756,6 +997,32 @@ export class QDropdown {
|
|
|
756
997
|
"attribute": "size",
|
|
757
998
|
"defaultValue": "'inherit'"
|
|
758
999
|
},
|
|
1000
|
+
"width": {
|
|
1001
|
+
"type": "string",
|
|
1002
|
+
"mutable": false,
|
|
1003
|
+
"complexType": {
|
|
1004
|
+
"original": "QInputWidth | 'fit-options'",
|
|
1005
|
+
"resolved": "\"fit-options\" | \"full\" | \"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"",
|
|
1006
|
+
"references": {
|
|
1007
|
+
"QInputWidth": {
|
|
1008
|
+
"location": "import",
|
|
1009
|
+
"path": "../../../theme/tokens",
|
|
1010
|
+
"id": "../../../src/browser/theme/tokens.ts::QInputWidth",
|
|
1011
|
+
"referenceLocation": "QInputWidth"
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
"required": false,
|
|
1016
|
+
"optional": true,
|
|
1017
|
+
"docs": {
|
|
1018
|
+
"tags": [],
|
|
1019
|
+
"text": "Opt-in horizontal width; fit-options sizes to loaded option labels. Omitted keeps the full-width layout."
|
|
1020
|
+
},
|
|
1021
|
+
"getter": false,
|
|
1022
|
+
"setter": false,
|
|
1023
|
+
"reflect": true,
|
|
1024
|
+
"attribute": "width"
|
|
1025
|
+
},
|
|
759
1026
|
"searchable": {
|
|
760
1027
|
"type": "boolean",
|
|
761
1028
|
"mutable": false,
|
|
@@ -776,6 +1043,26 @@ export class QDropdown {
|
|
|
776
1043
|
"attribute": "searchable",
|
|
777
1044
|
"defaultValue": "false"
|
|
778
1045
|
},
|
|
1046
|
+
"searchMode": {
|
|
1047
|
+
"type": "string",
|
|
1048
|
+
"mutable": false,
|
|
1049
|
+
"complexType": {
|
|
1050
|
+
"original": "'default' | 'menu'",
|
|
1051
|
+
"resolved": "\"default\" | \"menu\"",
|
|
1052
|
+
"references": {}
|
|
1053
|
+
},
|
|
1054
|
+
"required": false,
|
|
1055
|
+
"optional": false,
|
|
1056
|
+
"docs": {
|
|
1057
|
+
"tags": [],
|
|
1058
|
+
"text": "Search in the main editable control (default) or a separate menu field. Applies only when searchable."
|
|
1059
|
+
},
|
|
1060
|
+
"getter": false,
|
|
1061
|
+
"setter": false,
|
|
1062
|
+
"reflect": false,
|
|
1063
|
+
"attribute": "search-mode",
|
|
1064
|
+
"defaultValue": "'default'"
|
|
1065
|
+
},
|
|
779
1066
|
"externalSearch": {
|
|
780
1067
|
"type": "boolean",
|
|
781
1068
|
"mutable": false,
|
|
@@ -970,7 +1257,11 @@ export class QDropdown {
|
|
|
970
1257
|
"searchTerm": {},
|
|
971
1258
|
"visibleCount": {},
|
|
972
1259
|
"isScrollingLoading": {},
|
|
973
|
-
"disabledState": {}
|
|
1260
|
+
"disabledState": {},
|
|
1261
|
+
"draftEdited": {},
|
|
1262
|
+
"selectedLabelCache": {},
|
|
1263
|
+
"visibleChips": {},
|
|
1264
|
+
"selectedPanel": {}
|
|
974
1265
|
};
|
|
975
1266
|
}
|
|
976
1267
|
static get events() {
|
|
@@ -989,6 +1280,21 @@ export class QDropdown {
|
|
|
989
1280
|
"resolved": "string",
|
|
990
1281
|
"references": {}
|
|
991
1282
|
}
|
|
1283
|
+
}, {
|
|
1284
|
+
"method": "qValuesChange",
|
|
1285
|
+
"name": "qValuesChange",
|
|
1286
|
+
"bubbles": true,
|
|
1287
|
+
"cancelable": true,
|
|
1288
|
+
"composed": true,
|
|
1289
|
+
"docs": {
|
|
1290
|
+
"tags": [],
|
|
1291
|
+
"text": "Complete selected identities after an add or removal in multiple mode."
|
|
1292
|
+
},
|
|
1293
|
+
"complexType": {
|
|
1294
|
+
"original": "string[]",
|
|
1295
|
+
"resolved": "string[]",
|
|
1296
|
+
"references": {}
|
|
1297
|
+
}
|
|
992
1298
|
}, {
|
|
993
1299
|
"method": "qSelect",
|
|
994
1300
|
"name": "qSelect",
|
|
@@ -1161,8 +1467,20 @@ export class QDropdown {
|
|
|
1161
1467
|
static get elementRef() { return "el"; }
|
|
1162
1468
|
static get watchers() {
|
|
1163
1469
|
return [{
|
|
1470
|
+
"propName": "searchMode",
|
|
1471
|
+
"methodName": "watchSearchMode"
|
|
1472
|
+
}, {
|
|
1473
|
+
"propName": "searchable",
|
|
1474
|
+
"methodName": "watchSearchMode"
|
|
1475
|
+
}, {
|
|
1164
1476
|
"propName": "value",
|
|
1165
1477
|
"methodName": "watchValue"
|
|
1478
|
+
}, {
|
|
1479
|
+
"propName": "values",
|
|
1480
|
+
"methodName": "watchValues"
|
|
1481
|
+
}, {
|
|
1482
|
+
"propName": "multiple",
|
|
1483
|
+
"methodName": "watchMultiple"
|
|
1166
1484
|
}, {
|
|
1167
1485
|
"propName": "name",
|
|
1168
1486
|
"methodName": "syncValidity"
|