q2-tecton-elements 1.23.0 → 1.25.0
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-sheet-4b366e9a.js +84 -0
- package/dist/cjs/{index-0648c2ec.js → index-dc92e71f.js} +32 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +218 -0
- package/dist/cjs/q2-badge_2.cjs.entry.js +46 -17
- package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-calendar.cjs.entry.js +2 -4
- package/dist/cjs/q2-card.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-area.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-bar.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-donut.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-icon.cjs.entry.js +1 -1
- package/dist/cjs/q2-loc.cjs.entry.js +1 -1
- package/dist/cjs/q2-message.cjs.entry.js +1 -1
- package/dist/cjs/q2-month-picker.cjs.entry.js +1 -1
- package/dist/cjs/q2-optgroup_2.cjs.entry.js +93 -0
- package/dist/cjs/q2-option-list_2.cjs.entry.js +226 -86
- package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
- package/dist/cjs/q2-pill.cjs.entry.js +57 -18
- package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio.cjs.entry.js +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +148 -409
- package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
- package/dist/cjs/q2-tab-container.cjs.entry.js +1 -1
- package/dist/cjs/q2-tag.cjs.entry.js +21 -7
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/q2-action-sheet/index.js +345 -0
- package/dist/collection/components/q2-action-sheet/styles.css +215 -0
- package/dist/collection/components/q2-calendar/index.js +2 -4
- package/dist/collection/components/q2-checkbox/index.js +2 -2
- package/dist/collection/components/q2-dropdown/index.js +1 -1
- package/dist/collection/components/q2-input/index.js +46 -17
- package/dist/collection/components/q2-loading/index.js +1 -1
- package/dist/collection/components/q2-optgroup/styles.css +2 -2
- package/dist/collection/components/q2-option/index.js +3 -58
- package/dist/collection/components/q2-option/styles.css +7 -0
- package/dist/collection/components/q2-option-list/index.js +290 -102
- package/dist/collection/components/q2-pill/index.js +79 -18
- package/dist/collection/components/q2-pill/styles.css +1 -2
- package/dist/collection/components/q2-popover/index.js +17 -3
- package/dist/collection/components/q2-popover/styles.css +10 -67
- package/dist/collection/components/q2-radio/index.js +2 -2
- package/dist/collection/components/q2-select/index.js +179 -427
- package/dist/collection/components/q2-select/styles.css +5 -11
- package/dist/collection/components/q2-tag/index.js +33 -19
- package/dist/collection/utils/action-sheet.js +79 -0
- package/dist/collection/utils/index.js +29 -5
- package/dist/components/action-sheet.js +81 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index10.js +1 -1
- package/dist/components/index11.js +42 -353
- package/dist/components/index12.js +44 -99
- package/dist/components/index13.js +495 -583
- package/dist/components/index14.js +137 -0
- package/dist/components/index15.js +629 -0
- package/dist/components/index5.js +1 -1
- package/dist/components/index6.js +1 -1
- package/dist/components/index7.js +1 -1
- package/dist/components/index8.js +46 -17
- package/dist/components/index9.js +2 -2
- package/dist/components/q2-action-sheet.d.ts +11 -0
- package/dist/components/q2-action-sheet.js +282 -0
- package/dist/components/q2-calendar.js +2 -4
- package/dist/components/q2-card.js +1 -1
- package/dist/components/q2-carousel-pane.js +1 -1
- package/dist/components/q2-carousel.js +1 -1
- package/dist/components/q2-chart-area.js +1 -1
- package/dist/components/q2-chart-bar.js +1 -1
- package/dist/components/q2-chart-donut.js +1 -1
- package/dist/components/q2-checkbox-group.js +1 -1
- package/dist/components/q2-checkbox.js +1 -1
- package/dist/components/q2-dropdown.js +2 -2
- package/dist/components/q2-editable-field.js +1 -1
- package/dist/components/q2-loc.js +1 -1
- package/dist/components/q2-month-picker.js +1 -1
- package/dist/components/q2-optgroup.js +1 -70
- package/dist/components/q2-option-list.js +1 -1
- package/dist/components/q2-option.js +1 -76
- package/dist/components/q2-pagination.js +1 -1
- package/dist/components/q2-pill.js +62 -21
- package/dist/components/q2-popover.js +1 -1
- package/dist/components/q2-radio-group.js +1 -1
- package/dist/components/q2-radio.js +3 -3
- package/dist/components/q2-section.js +1 -1
- package/dist/components/q2-select.js +179 -427
- package/dist/components/q2-stepper-pane.js +1 -1
- package/dist/components/q2-stepper-vertical.js +1 -1
- package/dist/components/q2-stepper.js +1 -1
- package/dist/components/q2-tab-container.js +1 -1
- package/dist/components/q2-tag.js +25 -11
- package/dist/components/q2-textarea.js +1 -1
- package/dist/docs.d.ts +148 -0
- package/dist/docs.json +8755 -0
- package/dist/esm/action-sheet-a9597b32.js +81 -0
- package/dist/esm/{index-501fd22e.js → index-d4a87058.js} +30 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +214 -0
- package/dist/esm/q2-badge_2.entry.js +46 -17
- package/dist/esm/q2-btn_2.entry.js +1 -1
- package/dist/esm/q2-calendar.entry.js +2 -4
- package/dist/esm/q2-card.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-area.entry.js +1 -1
- package/dist/esm/q2-chart-bar.entry.js +1 -1
- package/dist/esm/q2-chart-donut.entry.js +1 -1
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-icon.entry.js +1 -1
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-message.entry.js +1 -1
- package/dist/esm/q2-month-picker.entry.js +1 -1
- package/dist/esm/q2-optgroup_2.entry.js +88 -0
- package/dist/esm/q2-option-list_2.entry.js +226 -86
- package/dist/esm/q2-pagination.entry.js +1 -1
- package/dist/esm/q2-pill.entry.js +57 -18
- package/dist/esm/q2-radio-group.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-section.entry.js +1 -1
- package/dist/esm/q2-select.entry.js +148 -409
- package/dist/esm/q2-stepper-pane.entry.js +1 -1
- package/dist/esm/q2-stepper-vertical.entry.js +1 -1
- package/dist/esm/q2-stepper.entry.js +1 -1
- package/dist/esm/q2-tab-container.entry.js +1 -1
- package/dist/esm/q2-tag.entry.js +22 -8
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +1 -1
- package/dist/q2-tecton-elements/p-059065e4.js +1 -0
- package/dist/q2-tecton-elements/{p-9b101e22.entry.js → p-1a744921.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-3fd5d010.entry.js → p-1b95e43f.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-3603fcdc.entry.js → p-1ea4b8bd.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-53be87c8.entry.js → p-1f3eb04c.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-25839309.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-38a33baa.entry.js → p-274ec152.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-6be86940.entry.js → p-2ba9e1a2.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-ebd7efa5.entry.js → p-2c309c54.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-3e9a30c4.entry.js → p-2cc70f49.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-604b22a8.entry.js → p-2ceb41c4.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-2e938b20.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-5b1aba1a.entry.js → p-306a4bc7.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-32f44993.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-d7b27803.entry.js → p-3a9aac19.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-3c73ce3f.entry.js +1 -0
- package/dist/q2-tecton-elements/p-4a95f78e.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-6b7e1ebd.entry.js → p-4b48a49d.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-4b92e44e.entry.js +1 -0
- package/dist/q2-tecton-elements/p-5ecb9c27.entry.js +1 -0
- package/dist/q2-tecton-elements/p-6779270e.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-70b01387.entry.js → p-72fc58e7.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-7ac02ae5.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-78fac0fa.entry.js → p-7c168977.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-d27b2caa.entry.js → p-7c9bf80a.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-83d678c7.entry.js +1 -0
- package/dist/q2-tecton-elements/p-a1926e65.js +1 -0
- package/dist/q2-tecton-elements/{p-24f4571d.entry.js → p-a3a5b57b.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-a6296870.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-45d61789.entry.js → p-a64e7eb1.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-8dea9a0c.entry.js → p-ad83984e.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-bf41e71b.entry.js → p-bf0ed24a.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-a2add94e.entry.js → p-bff85959.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-7aa80653.entry.js → p-c4a9ab25.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-ea5383ba.entry.js +1 -0
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/test/helpers.js +3 -2
- package/dist/types/components/q2-action-sheet/index.d.ts +52 -0
- package/dist/types/components/q2-checkbox/index.d.ts +4 -1
- package/dist/types/components/q2-input/index.d.ts +5 -0
- package/dist/types/components/q2-option/index.d.ts +1 -4
- package/dist/types/components/q2-option-list/index.d.ts +16 -8
- package/dist/types/components/q2-pill/index.d.ts +10 -1
- package/dist/types/components/q2-popover/index.d.ts +2 -0
- package/dist/types/components/q2-select/index.d.ts +45 -47
- package/dist/types/components/q2-tag/index.d.ts +3 -3
- package/dist/types/components.d.ts +44 -17
- package/dist/types/global.d.ts +9 -2
- package/dist/types/utils/action-sheet.d.ts +12 -0
- package/dist/types/utils/index.d.ts +4 -1
- package/dist/types/workspace/workspace/Tecton_tecton-production_master/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +1 -1
- package/package.json +4 -2
- package/dist/cjs/q2-optgroup.cjs.entry.js +0 -56
- package/dist/cjs/q2-option.cjs.entry.js +0 -46
- package/dist/esm/q2-optgroup.entry.js +0 -52
- package/dist/esm/q2-option.entry.js +0 -42
- package/dist/q2-tecton-elements/p-18629cbf.entry.js +0 -1
- package/dist/q2-tecton-elements/p-2c20fc43.entry.js +0 -1
- package/dist/q2-tecton-elements/p-3813f51d.entry.js +0 -1
- package/dist/q2-tecton-elements/p-68ef0786.entry.js +0 -1
- package/dist/q2-tecton-elements/p-a510290a.js +0 -1
- package/dist/q2-tecton-elements/p-acc77332.entry.js +0 -1
- package/dist/q2-tecton-elements/p-ba73ee1f.entry.js +0 -1
- package/dist/q2-tecton-elements/p-ba76ecfd.entry.js +0 -1
- package/dist/q2-tecton-elements/p-bbdae095.entry.js +0 -1
- package/dist/q2-tecton-elements/p-d68b5eb3.entry.js +0 -1
- package/dist/q2-tecton-elements/p-d88e4383.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f1d06917.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f6e868c1.entry.js +0 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$
|
|
2
|
+
import { h as handleAriaLabel, o as overrideFocus, l as loc, d as isRelatedTargetWithinHost, a as isEventFromElement, e as isHostLosingFocus } from './index15.js';
|
|
3
|
+
import { s as shouldShowActionSheet, a as showActionSheetList } from './action-sheet.js';
|
|
4
|
+
import { d as defineCustomElement$9 } from './index2.js';
|
|
5
|
+
import { d as defineCustomElement$8 } from './index4.js';
|
|
6
|
+
import { d as defineCustomElement$7 } from './index5.js';
|
|
7
|
+
import { d as defineCustomElement$6 } from './index7.js';
|
|
8
|
+
import { d as defineCustomElement$5 } from './index8.js';
|
|
9
|
+
import { d as defineCustomElement$4 } from './index9.js';
|
|
10
|
+
import { d as defineCustomElement$3 } from './index13.js';
|
|
11
|
+
import { d as defineCustomElement$2 } from './index14.js';
|
|
9
12
|
|
|
10
|
-
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.q2-element-dropdown{display:none;position:absolute;background-color:var(--app-white, #ffffff);color:var(--t-text, #4d4d4d);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3));height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.q2-element-dropdown::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.q2-element-dropdown::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown.sizable{display:block;height:auto}.dropdown-open .q2-element-dropdown{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([alignment=right]) .q2-element-dropdown{left:auto;right:0}:host([block]) q2-btn,:host([block]){display:block}:host{display:block;margin-top:var(--tct-select-margin-top, var(--app-scale-4, 30px));margin-bottom:var(--tct-select-margin-bottom, var(--app-scale-4, 30px))}.q2-select-container{position:relative;display:block}.q2-select-input{margin:0;--tct-input-min-height:var(--tct-select-input-min-height, var(--t-select-input-min-height));--tct-input-max-height:var(--tct-select-input-max-height, var(--t-select-input-max-height,
|
|
13
|
+
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.q2-element-dropdown{display:none;position:absolute;background-color:var(--app-white, #ffffff);color:var(--t-text, #4d4d4d);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3));height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.q2-element-dropdown::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.q2-element-dropdown::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown.sizable{display:block;height:auto}.dropdown-open .q2-element-dropdown{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([alignment=right]) .q2-element-dropdown{left:auto;right:0}:host([block]) q2-btn,:host([block]){display:block}:host{display:block;margin-top:var(--tct-select-margin-top, var(--app-scale-4, 30px));margin-bottom:var(--tct-select-margin-bottom, var(--app-scale-4, 30px))}.q2-select-container{position:relative;display:block}.q2-select-input{margin:0;--tct-input-min-height:var(--tct-select-input-min-height, var(--t-select-input-min-height));--tct-input-max-height:var(--tct-select-input-max-height, var(--t-select-input-max-height, none))}::slotted([slot=_selected-display]){width:100%;min-height:var(--comp-selected-display-height, 44px)}.custom-display-content{position:absolute;bottom:0;left:calc(var(--tct-scale-2, var(--app-scale-2x, 10px)) + 1px);height:44px;width:calc(100% - 34px - var(--tct-scale-3, var(--app-scale-3x, 15px)));overflow:hidden;cursor:pointer;transition:left var(--tct-tween-2, var(--app-tween-1, 0.2s ease))}.custom-display-content:not([hidden]){display:flex;align-items:center}.is-searchable.is-focused .custom-display-content,.is-searchable .custom-display-content:active{left:calc(var(--tct-scale-3, var(--app-scale-3x, 15px)) + 1px)}.has-error .custom-display-content{width:calc(100% - 68px - var(--tct-scale-3, var(--app-scale-3x, 15px)))}.multi-select-header{padding:var(--tct-scale-1, var(--app-scale-1x, 5px)) var(--tct-scale-2, var(--app-scale-2x, 10px));position:sticky;top:0;z-index:5;background:var(--app-white);display:inline-grid;grid-template-columns:repeat(3, auto);gap:var(--app-scale-2x, 10px);align-items:center}.q2-element-dropdown.dropup{bottom:var(--comp-dropup-offset)}";
|
|
11
14
|
|
|
12
15
|
const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
13
16
|
constructor() {
|
|
@@ -16,12 +19,16 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
16
19
|
this.__attachShadow();
|
|
17
20
|
this.change = createEvent(this, "change", 7);
|
|
18
21
|
this.input = createEvent(this, "input", 7);
|
|
22
|
+
var _a;
|
|
19
23
|
this.scheduledAfterRender = [];
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
this.showSelectedOptions = (event) => {
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
this.showSelected = true;
|
|
27
|
+
};
|
|
28
|
+
this.showAllOptions = (event) => {
|
|
29
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
30
|
+
this.showSelected = false;
|
|
23
31
|
};
|
|
24
|
-
this.guid = createGuid();
|
|
25
32
|
this.onMutationObserved = () => {
|
|
26
33
|
const slotContainer = this.hostElement.querySelector('.custom-display-content');
|
|
27
34
|
const displaySlot = this.hostElement.shadowRoot.querySelector('slot[name="q2-select-display"]');
|
|
@@ -31,201 +38,62 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
31
38
|
if (this.hasCustomDisplay !== hasCustomDisplay) {
|
|
32
39
|
this.hasCustomDisplay = hasCustomDisplay;
|
|
33
40
|
}
|
|
34
|
-
if (this.multiple) {
|
|
35
|
-
this.updateMultipleOptionAttrs();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.updateSingleOptionAttrs();
|
|
39
|
-
const activeOption = this.optionElements[this.activeIndex];
|
|
40
|
-
if (!activeOption || activeOption.id !== this.activeOptionId) {
|
|
41
|
-
this.activeIndex = this.getDefaultActiveIndex();
|
|
42
|
-
this.setActiveOption();
|
|
43
|
-
}
|
|
44
41
|
};
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
const buildQueue = () => {
|
|
53
|
-
const now = new Date();
|
|
54
|
-
if (now.getTime() - this.keyStore.lastPressedAt.getTime() > 1000) {
|
|
55
|
-
// empty stored keys if delay > 1s
|
|
56
|
-
this.keyStore.queue = [];
|
|
57
|
-
}
|
|
58
|
-
if (this.keyStore.queue.length !== 1 || this.keyStore.queue[0] !== keyValue) {
|
|
59
|
-
this.keyStore.queue.push(keyValue);
|
|
60
|
-
}
|
|
61
|
-
this.keyStore.lastPressedAt = now;
|
|
62
|
-
};
|
|
63
|
-
const searchIndex = list => {
|
|
64
|
-
return list.find(v => {
|
|
65
|
-
return (!v.element.disabled &&
|
|
66
|
-
v.element.display &&
|
|
67
|
-
v.element.display.replace(/\s/g, '').match(new RegExp(`^${this.keyStore.queue.join('')}`, 'i')));
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
const setFocus = ({ element, index }) => {
|
|
71
|
-
if (this.dropdownOpen || this.multiple) {
|
|
72
|
-
// multiple: should open to make sure that which options are selected
|
|
73
|
-
this.openDropdownWithActiveElement(index);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
this.activeIndex = index;
|
|
77
|
-
this.change.emit({ value: element.value });
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
buildQueue();
|
|
81
|
-
const matched = searchIndex(reorder());
|
|
82
|
-
if (matched) {
|
|
83
|
-
setFocus(matched);
|
|
84
|
-
}
|
|
42
|
+
this.onOptionListChange = (event) => {
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
const { values } = event.detail;
|
|
45
|
+
if (values.length === 0)
|
|
46
|
+
this.showAllOptions();
|
|
47
|
+
this.handleSelectionChanges(event.detail);
|
|
85
48
|
};
|
|
86
49
|
/// Event handlers ///
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
const isInDropdown = this.dropdownContainer.contains(relatedTarget);
|
|
90
|
-
const isInLightDom = !isInDropdown && this.hostElement.contains(relatedTarget);
|
|
91
|
-
if (isInDropdown || isInLightDom)
|
|
50
|
+
this.popoverStateChanged = ({ detail: { open } }) => {
|
|
51
|
+
if (this.open === open)
|
|
92
52
|
return;
|
|
93
|
-
|
|
53
|
+
this.open = open;
|
|
54
|
+
if (open && !this.searchText)
|
|
94
55
|
return;
|
|
95
|
-
this.
|
|
56
|
+
this.optionList.setActiveElement(null);
|
|
57
|
+
this.inputField.focus();
|
|
96
58
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
event.stopPropagation();
|
|
100
|
-
const { activeIndex, searchable, optionElements, multiSelectHeader } = this;
|
|
101
|
-
const { key, shiftKey } = event;
|
|
102
|
-
if (this.readonly ||
|
|
103
|
-
(multiSelectHeader && multiSelectHeader.contains(event.target) && [' ', 'Enter'].includes(key)))
|
|
59
|
+
this.inputKeydownHandler = (event) => {
|
|
60
|
+
if (this.readonly || this.disabled)
|
|
104
61
|
return;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (isFirstOption)
|
|
118
|
-
break;
|
|
119
|
-
if (activeIndex !== undefined) {
|
|
120
|
-
const nextIndex = this.getNextVisibleIndex(-1);
|
|
121
|
-
if (nextIndex === -1)
|
|
122
|
-
break;
|
|
123
|
-
this.adjustActiveOptionAndScroll(nextIndex - activeIndex);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
this.setDefaultActiveElement();
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
case 'ArrowDown':
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
const isLastOption = activeIndex === optionElements.length - 1;
|
|
132
|
-
if (isLastOption)
|
|
133
|
-
break;
|
|
134
|
-
if (activeIndex !== undefined) {
|
|
135
|
-
const nextIndex = this.getNextVisibleIndex(1);
|
|
136
|
-
if (nextIndex === -1)
|
|
137
|
-
break;
|
|
138
|
-
this.adjustActiveOptionAndScroll(nextIndex - activeIndex);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
this.setDefaultActiveElement();
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
|
-
case 'Home':
|
|
145
|
-
event.preventDefault();
|
|
146
|
-
this.openDropdownWithActiveElement(0);
|
|
147
|
-
break;
|
|
148
|
-
case 'End':
|
|
149
|
-
event.preventDefault();
|
|
150
|
-
this.openDropdownWithActiveElement(optionElements.length - 1);
|
|
151
|
-
break;
|
|
152
|
-
case 'PageUp':
|
|
153
|
-
event.preventDefault();
|
|
154
|
-
this.openDropdownWithActiveElement(Math.max(activeIndex - 10, 0));
|
|
155
|
-
break;
|
|
156
|
-
case 'PageDown':
|
|
157
|
-
event.preventDefault();
|
|
158
|
-
this.openDropdownWithActiveElement(Math.min(activeIndex + 10, optionElements.length - 1));
|
|
159
|
-
break;
|
|
160
|
-
case 'Tab':
|
|
161
|
-
if (shiftKey)
|
|
162
|
-
break;
|
|
163
|
-
const myOption = this.hostElement.querySelector(`[option-id="${this.activeOptionId}"]`);
|
|
164
|
-
if (!myOption || myOption.disabled)
|
|
165
|
-
return;
|
|
166
|
-
if (myOption.selected)
|
|
167
|
-
return;
|
|
168
|
-
this.selectOption(myOption);
|
|
169
|
-
break;
|
|
170
|
-
case 'Esc':
|
|
171
|
-
case 'Escape':
|
|
172
|
-
this.closeDropdown();
|
|
173
|
-
this.focusInput();
|
|
174
|
-
break;
|
|
175
|
-
default:
|
|
176
|
-
if (searchable)
|
|
177
|
-
break;
|
|
178
|
-
if (!key.match(/^[A-Za-z0-9]$/))
|
|
179
|
-
break;
|
|
180
|
-
// search in non-searchable select: alpha-numeric only
|
|
181
|
-
this.searchAndFocus(key);
|
|
182
|
-
break;
|
|
62
|
+
const keysForOptionListToHandle = [
|
|
63
|
+
'ArrowDown',
|
|
64
|
+
'ArrowUp',
|
|
65
|
+
'PageDown',
|
|
66
|
+
'PageUp',
|
|
67
|
+
'Home',
|
|
68
|
+
'End',
|
|
69
|
+
'Escape',
|
|
70
|
+
'Tab',
|
|
71
|
+
];
|
|
72
|
+
if (shouldShowActionSheet(this, event)) {
|
|
73
|
+
return this.executeActionSheet(event);
|
|
183
74
|
}
|
|
75
|
+
if (this.searchable && !keysForOptionListToHandle.includes(event.key))
|
|
76
|
+
return;
|
|
77
|
+
if (this.shouldClearSearchText(event))
|
|
78
|
+
this.clearSearchText();
|
|
79
|
+
this.optionList.handleExternalKeydown(event);
|
|
184
80
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
break;
|
|
195
|
-
case 'ArrowUp':
|
|
196
|
-
event.preventDefault();
|
|
197
|
-
this.openDropdownWithActiveElement(this.getLastEnabledIndex());
|
|
198
|
-
this.setFocusedOption();
|
|
199
|
-
break;
|
|
200
|
-
case 'Home':
|
|
201
|
-
event.preventDefault();
|
|
202
|
-
this.openDropdownWithActiveElement(0);
|
|
203
|
-
break;
|
|
204
|
-
case 'End':
|
|
205
|
-
event.preventDefault();
|
|
206
|
-
this.openDropdownWithActiveElement(optionElements.length - 1);
|
|
207
|
-
break;
|
|
208
|
-
case 'Escape':
|
|
209
|
-
case 'Esc':
|
|
210
|
-
this.closeDropdown();
|
|
211
|
-
break;
|
|
212
|
-
case 'Tab':
|
|
213
|
-
this.closeDropdown();
|
|
214
|
-
break;
|
|
215
|
-
default:
|
|
216
|
-
if (!key.match(/^[A-Za-z0-9]$/))
|
|
217
|
-
break;
|
|
218
|
-
if (searchable) {
|
|
219
|
-
this.openDropdownWithoutActiveElement();
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
// search in non-searchable select: alpha-numeric only
|
|
223
|
-
this.searchAndFocus(key);
|
|
81
|
+
this.visibilityToggleKeyDown = (event) => {
|
|
82
|
+
const keysForOptionListToHandle = ['ArrowDown', 'ArrowUp'];
|
|
83
|
+
const keysThatTriggerClick = ['Enter', ' '];
|
|
84
|
+
const key = event.key;
|
|
85
|
+
if (keysForOptionListToHandle.includes(key)) {
|
|
86
|
+
this.optionList.handleExternalKeydown(event);
|
|
87
|
+
}
|
|
88
|
+
else if (keysThatTriggerClick.includes(key)) {
|
|
89
|
+
event.target.dispatchEvent(new MouseEvent('click'));
|
|
224
90
|
}
|
|
225
91
|
};
|
|
226
|
-
this.inputClickHandler = (event) => {
|
|
92
|
+
this.inputClickHandler = async (event) => {
|
|
227
93
|
event.stopPropagation();
|
|
228
|
-
|
|
94
|
+
if (shouldShowActionSheet(this)) {
|
|
95
|
+
return this.executeActionSheet(event);
|
|
96
|
+
}
|
|
229
97
|
this.toggleDropdown();
|
|
230
98
|
this.focusInput();
|
|
231
99
|
};
|
|
@@ -235,10 +103,9 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
235
103
|
const eventValue = event.detail.value;
|
|
236
104
|
const didChangeText = inputValue !== eventValue;
|
|
237
105
|
const shouldClearValue = !!this.value && didChangeText;
|
|
238
|
-
if (shouldClearValue)
|
|
239
|
-
this.
|
|
240
|
-
|
|
241
|
-
if (!this.dropdownOpen)
|
|
106
|
+
if (shouldClearValue)
|
|
107
|
+
this.clearValue();
|
|
108
|
+
if (!this.open)
|
|
242
109
|
this.openDropdownWithoutActiveElement();
|
|
243
110
|
this.prioritizeSearch = true;
|
|
244
111
|
this.searchText = eventValue;
|
|
@@ -255,32 +122,18 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
255
122
|
};
|
|
256
123
|
this.clickedElsewhere = (event) => {
|
|
257
124
|
const target = event.target;
|
|
258
|
-
if (target.localName
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
125
|
+
if (target.localName !== 'click-elsewhere')
|
|
126
|
+
return;
|
|
127
|
+
event.stopPropagation();
|
|
128
|
+
if (!this.open)
|
|
129
|
+
return;
|
|
130
|
+
this.closeDropdown();
|
|
264
131
|
};
|
|
265
132
|
this.onCustomDisplayClick = (event) => {
|
|
266
133
|
event.stopPropagation();
|
|
267
134
|
this.focusInput();
|
|
268
135
|
this.toggleDropdown();
|
|
269
136
|
};
|
|
270
|
-
this.showSelectedOptions = (event) => {
|
|
271
|
-
event.stopImmediatePropagation();
|
|
272
|
-
this.onlyShowingSelected = true;
|
|
273
|
-
this.optionElements.forEach(optionElement => {
|
|
274
|
-
optionElement._multiSelectHidden = !optionElement.selected;
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
this.showAllOptions = (event) => {
|
|
278
|
-
event.stopPropagation();
|
|
279
|
-
this.onlyShowingSelected = false;
|
|
280
|
-
this.optionElements.forEach(optionElement => {
|
|
281
|
-
optionElement._multiSelectHidden = false;
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
137
|
this.label = undefined;
|
|
285
138
|
this.hideLabel = undefined;
|
|
286
139
|
this.value = undefined;
|
|
@@ -297,18 +150,21 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
297
150
|
this.multilineOptions = false;
|
|
298
151
|
this.optional = false;
|
|
299
152
|
this.placeholder = undefined;
|
|
300
|
-
this.
|
|
301
|
-
this.
|
|
302
|
-
this.
|
|
153
|
+
this.hoist = !!((_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.useActionSheets);
|
|
154
|
+
this.open = false;
|
|
155
|
+
this.showSelected = false;
|
|
303
156
|
this.searchText = '';
|
|
304
157
|
this.hasCustomDisplay = false;
|
|
305
158
|
this.inputFocused = false;
|
|
306
159
|
this.statusMessage = undefined;
|
|
307
160
|
this.prioritizeSearch = false;
|
|
161
|
+
this.structuredSelectedOptions = [];
|
|
308
162
|
}
|
|
309
163
|
/// Lifecycle Hooks ///
|
|
310
164
|
componentWillLoad() {
|
|
311
165
|
handleAriaLabel(this);
|
|
166
|
+
this.buildStructuredSelectedOptions();
|
|
167
|
+
this.handleMultilineOptionsUpdate(this.multilineOptions, false);
|
|
312
168
|
}
|
|
313
169
|
componentDidLoad() {
|
|
314
170
|
const observer = new MutationObserver(this.onMutationObserved);
|
|
@@ -330,22 +186,17 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
330
186
|
this.mutationObserver = null;
|
|
331
187
|
}
|
|
332
188
|
/// Getters ///
|
|
333
|
-
get isComponentFocused() {
|
|
334
|
-
return document.activeElement === this.hostElement || !!this.hostElement.querySelector(':focus');
|
|
335
|
-
}
|
|
336
|
-
get isSearchMode() {
|
|
337
|
-
return (this.searchable && this.inputFocused) || this.searchText;
|
|
338
|
-
}
|
|
339
189
|
get badgeValue() {
|
|
190
|
+
var _a, _b;
|
|
340
191
|
if (!this.multiple)
|
|
341
|
-
return;
|
|
342
|
-
const optionsLength = this.selectedOptions.length;
|
|
343
|
-
if (this.
|
|
344
|
-
return optionsLength
|
|
192
|
+
return null;
|
|
193
|
+
const optionsLength = (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
194
|
+
if (this.open && this.searchable)
|
|
195
|
+
return optionsLength ? `${optionsLength}` : null;
|
|
345
196
|
else
|
|
346
197
|
return optionsLength > 1 ? `+${optionsLength - 1}` : null;
|
|
347
198
|
}
|
|
348
|
-
get
|
|
199
|
+
get popoverMinHeight() {
|
|
349
200
|
const { minRows } = this;
|
|
350
201
|
const firstOption = this.hostElement.querySelector('q2-option:not([hidden])');
|
|
351
202
|
const minHeight = firstOption ? window.getComputedStyle(firstOption).minHeight : '44px';
|
|
@@ -362,10 +213,8 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
362
213
|
return this.hostElement.querySelector('[slot="_selected-display"]');
|
|
363
214
|
}
|
|
364
215
|
get firstSelectedValue() {
|
|
365
|
-
var _a
|
|
366
|
-
|
|
367
|
-
return (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
|
|
368
|
-
return this.value;
|
|
216
|
+
var _a;
|
|
217
|
+
return this.multiple ? (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a[0] : this.value;
|
|
369
218
|
}
|
|
370
219
|
get firstSelectedOptionElement() {
|
|
371
220
|
const { firstSelectedValue } = this;
|
|
@@ -374,14 +223,9 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
374
223
|
get optionElements() {
|
|
375
224
|
return Array.from(this.hostElement.querySelectorAll('q2-option'));
|
|
376
225
|
}
|
|
377
|
-
get visibleOptionElements() {
|
|
378
|
-
return Array.from(this.hostElement.querySelectorAll('q2-option:not([_multiselecthidden])'));
|
|
379
|
-
}
|
|
380
226
|
get wrapperClasses() {
|
|
381
227
|
const { errors } = this;
|
|
382
228
|
const classes = ['q2-select-container'];
|
|
383
|
-
if (this.dropdownOpen)
|
|
384
|
-
classes.push('dropdown-open');
|
|
385
229
|
if (Array.isArray(errors) && errors.length > 0)
|
|
386
230
|
classes.push('has-error');
|
|
387
231
|
if (this.inputFocused)
|
|
@@ -391,33 +235,39 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
391
235
|
return classes.join(' ');
|
|
392
236
|
}
|
|
393
237
|
/// Watchers ///
|
|
238
|
+
buildStructuredSelectedOptions() {
|
|
239
|
+
const { multiple, selectedOptions, value } = this;
|
|
240
|
+
if (multiple) {
|
|
241
|
+
this.structuredSelectedOptions = !!(selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length)
|
|
242
|
+
? selectedOptions.map(option => (typeof option === 'string' ? { value: option } : option))
|
|
243
|
+
: [];
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this.structuredSelectedOptions = value ? [{ value }] : [];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
394
249
|
ariaLabelObserver() {
|
|
395
250
|
handleAriaLabel(this);
|
|
396
251
|
}
|
|
397
252
|
valueUpdated() {
|
|
398
253
|
if (this.multiple)
|
|
399
254
|
return;
|
|
400
|
-
this.
|
|
255
|
+
this.clearSearchText();
|
|
401
256
|
}
|
|
402
|
-
|
|
403
|
-
if (!this.multiple)
|
|
404
|
-
return;
|
|
405
|
-
this.updateMultipleOptionAttrs();
|
|
406
|
-
}
|
|
407
|
-
multilineOptionsChanged(newValue, oldValue) {
|
|
257
|
+
handleMultilineOptionsUpdate(newValue, oldValue) {
|
|
408
258
|
if (newValue === oldValue)
|
|
409
259
|
return;
|
|
410
260
|
this.optionElements.forEach(element => (element.multiline = newValue));
|
|
411
261
|
}
|
|
412
|
-
|
|
262
|
+
openChanged(isOpen) {
|
|
413
263
|
this.scheduledAfterRender.push(() => {
|
|
414
|
-
const { multiple, multiSelectHeader,
|
|
264
|
+
const { multiple, multiSelectHeader, popoverElement } = this;
|
|
415
265
|
const height = (isOpen && multiple && (multiSelectHeader === null || multiSelectHeader === void 0 ? void 0 : multiSelectHeader.offsetHeight)) || 0;
|
|
416
266
|
if (height) {
|
|
417
|
-
|
|
267
|
+
popoverElement.style.setProperty('--comp-multi-select-header-height', `${height}px`);
|
|
418
268
|
}
|
|
419
269
|
else {
|
|
420
|
-
|
|
270
|
+
popoverElement.style.removeProperty('--comp-multi-select-header-height');
|
|
421
271
|
}
|
|
422
272
|
});
|
|
423
273
|
}
|
|
@@ -426,15 +276,17 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
426
276
|
this.inputKeydownHandler(event);
|
|
427
277
|
}
|
|
428
278
|
onHostElementChange(event) {
|
|
429
|
-
if (this.readonly)
|
|
279
|
+
if (this.readonly || this.disabled)
|
|
430
280
|
return;
|
|
431
281
|
if (event.target !== this.hostElement || this.hostElement.onchange)
|
|
432
282
|
return;
|
|
433
283
|
if (this.multiple) {
|
|
284
|
+
this.value = null;
|
|
434
285
|
this.selectedOptions = event.detail.selectedOptions;
|
|
435
286
|
}
|
|
436
287
|
else {
|
|
437
288
|
this.value = event.detail.value;
|
|
289
|
+
this.selectedOptions = [];
|
|
438
290
|
}
|
|
439
291
|
}
|
|
440
292
|
onHostElementInput(event) {
|
|
@@ -476,54 +328,33 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
476
328
|
}
|
|
477
329
|
}
|
|
478
330
|
handleFocusout(event) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
if (!selectedOption ||
|
|
484
|
-
(selectedOption.hasAttribute('disabled') && selectedOption.getAttribute('disabled') !== 'false'))
|
|
485
|
-
return;
|
|
486
|
-
this.selectOption(selectedOption, true);
|
|
331
|
+
const isLeavingHost = isHostLosingFocus(event, this.hostElement);
|
|
332
|
+
if (isLeavingHost)
|
|
333
|
+
this.closeDropdown();
|
|
334
|
+
this.prioritizeSearch = !isLeavingHost && this.searchable;
|
|
487
335
|
}
|
|
488
336
|
/// Helpers ///
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
return acc;
|
|
504
|
-
}, []);
|
|
505
|
-
return enabledIndexes[enabledIndexes.length - 1];
|
|
506
|
-
}
|
|
507
|
-
setActiveOption() {
|
|
508
|
-
if (!this.dropdownOpen)
|
|
509
|
-
return;
|
|
510
|
-
const activeIndex = this.activeIndex;
|
|
511
|
-
this.optionElements.forEach((element, elementIndex) => {
|
|
512
|
-
if (activeIndex === elementIndex) {
|
|
513
|
-
element.active = true;
|
|
514
|
-
this.activeOptionId = element.optionId;
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
element.active = false;
|
|
518
|
-
}
|
|
337
|
+
async executeActionSheet(event) {
|
|
338
|
+
const result = await showActionSheetList(this, event);
|
|
339
|
+
this.handleSelectionChanges(result);
|
|
340
|
+
}
|
|
341
|
+
handleSelectionChanges(changeDetails) {
|
|
342
|
+
const { value = '', values = [] } = changeDetails;
|
|
343
|
+
const selectedOptionValues = values.map(value => value.value);
|
|
344
|
+
const { multiple } = this;
|
|
345
|
+
if (!this.hostElement.onchange) {
|
|
346
|
+
this.selectedOptions = selectedOptionValues;
|
|
347
|
+
}
|
|
348
|
+
this.change.emit({
|
|
349
|
+
value: multiple ? undefined : value,
|
|
350
|
+
selectedOptions: multiple ? selectedOptionValues : undefined,
|
|
519
351
|
});
|
|
520
352
|
}
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
option.focus();
|
|
353
|
+
clearValue() {
|
|
354
|
+
const { multiple } = this;
|
|
355
|
+
this.value = '';
|
|
356
|
+
this.selectedOptions = [];
|
|
357
|
+
this.change.emit({ value: multiple ? undefined : '', selectedOptions: multiple ? [] : undefined });
|
|
527
358
|
}
|
|
528
359
|
calculateMultiSelectSelectedDisplay() {
|
|
529
360
|
var _a;
|
|
@@ -542,130 +373,36 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
542
373
|
const { firstSelectedOptionElement } = this;
|
|
543
374
|
return ((firstSelectedOptionElement === null || firstSelectedOptionElement === void 0 ? void 0 : firstSelectedOptionElement.display) && loc(firstSelectedOptionElement.display)) || this.value || '';
|
|
544
375
|
}
|
|
545
|
-
updateSingleOptionAttrs() {
|
|
546
|
-
const { value, guid, multilineOptions } = this;
|
|
547
|
-
this.optionElements.forEach((element, index) => {
|
|
548
|
-
element.selected = element.value === value;
|
|
549
|
-
element.optionId = `q2-select-${guid}-option-${index}`;
|
|
550
|
-
element.multiline = multilineOptions;
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
updateMultipleOptionAttrs() {
|
|
554
|
-
if (this.selectedOptions.length === 0) {
|
|
555
|
-
this.onlyShowingSelected = false;
|
|
556
|
-
}
|
|
557
|
-
const { selectedOptions, onlyShowingSelected, guid, multilineOptions } = this;
|
|
558
|
-
this.optionElements.forEach((element, index) => {
|
|
559
|
-
element.selected = selectedOptions.includes(element.value);
|
|
560
|
-
element._multiSelectHidden = onlyShowingSelected ? !element.selected : false;
|
|
561
|
-
element.optionId = `q2-select-${guid}-option-${index}`;
|
|
562
|
-
element.multiline = multilineOptions;
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
focusSelectedSibling(option) {
|
|
566
|
-
if (!this.onlyShowingSelected)
|
|
567
|
-
return;
|
|
568
|
-
const { visibleOptionElements } = this;
|
|
569
|
-
if (visibleOptionElements.length < 2)
|
|
570
|
-
return;
|
|
571
|
-
const optionIndex = visibleOptionElements.indexOf(option);
|
|
572
|
-
const visibleFocusIndex = optionIndex ? optionIndex - 1 : optionIndex + 1;
|
|
573
|
-
const optionToFocus = visibleOptionElements[visibleFocusIndex];
|
|
574
|
-
const focusIndex = this.optionElements.indexOf(optionToFocus);
|
|
575
|
-
this.activeIndex = focusIndex;
|
|
576
|
-
this.setFocusedOption();
|
|
577
|
-
}
|
|
578
|
-
selectOption(option, focusInputOnClose = false) {
|
|
579
|
-
var _a;
|
|
580
|
-
const value = (_a = option === null || option === void 0 ? void 0 : option.value) !== null && _a !== void 0 ? _a : '';
|
|
581
|
-
if (this.multiple) {
|
|
582
|
-
const isSelected = this.selectedOptions.includes(value);
|
|
583
|
-
if (isSelected) {
|
|
584
|
-
this.focusSelectedSibling(option);
|
|
585
|
-
this.change.emit({
|
|
586
|
-
selectedOptions: this.selectedOptions.filter(selectedValue => selectedValue !== value),
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
else if (value) {
|
|
590
|
-
this.change.emit({ selectedOptions: [...this.selectedOptions, value] });
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
else {
|
|
594
|
-
this.change.emit({ value });
|
|
595
|
-
this.closeDropdown();
|
|
596
|
-
if (focusInputOnClose)
|
|
597
|
-
this.focusInput();
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
scrollToActiveOption() {
|
|
601
|
-
const activeOption = this.optionElements[this.activeIndex];
|
|
602
|
-
activeOption === null || activeOption === void 0 ? void 0 : activeOption.scrollIntoView({ block: 'nearest' });
|
|
603
|
-
}
|
|
604
376
|
openDropdownWithoutActiveElement() {
|
|
605
|
-
if (this.readonly)
|
|
377
|
+
if (this.readonly || this.disabled)
|
|
606
378
|
return;
|
|
607
|
-
this.
|
|
608
|
-
this.
|
|
609
|
-
this.dropdownOpen = true;
|
|
610
|
-
this.scheduledAfterRender.push(resizeIframe);
|
|
611
|
-
}
|
|
612
|
-
openDropdownWithActiveElement(activeIndex) {
|
|
613
|
-
if (this.readonly)
|
|
614
|
-
return;
|
|
615
|
-
this.activeIndex = activeIndex;
|
|
616
|
-
this.dropdownOpen = true;
|
|
617
|
-
this.setActiveOption();
|
|
618
|
-
this.scheduledAfterRender.push(() => {
|
|
619
|
-
this.setFocusedOption();
|
|
620
|
-
this.scrollToActiveOption();
|
|
621
|
-
resizeIframe();
|
|
622
|
-
});
|
|
379
|
+
this.optionList.setActiveElement(null);
|
|
380
|
+
this.open = true;
|
|
623
381
|
}
|
|
624
382
|
closeDropdown() {
|
|
625
|
-
this.
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
383
|
+
this.open = false;
|
|
384
|
+
this.clearSearchText();
|
|
385
|
+
}
|
|
386
|
+
clearSearchText() {
|
|
387
|
+
if (!this.searchText)
|
|
388
|
+
return;
|
|
389
|
+
this.searchText = '';
|
|
390
|
+
this.input.emit({ query: '' });
|
|
631
391
|
}
|
|
632
392
|
toggleDropdown() {
|
|
633
|
-
if (this.disabled)
|
|
393
|
+
if (this.readonly || this.disabled)
|
|
634
394
|
return;
|
|
635
|
-
if (this.
|
|
395
|
+
if (this.open && !this.searchText) {
|
|
636
396
|
this.closeDropdown();
|
|
637
397
|
}
|
|
638
398
|
else {
|
|
639
399
|
this.openDropdownWithoutActiveElement();
|
|
640
400
|
}
|
|
641
401
|
}
|
|
642
|
-
adjustActiveOptionAndScroll(numToAdd) {
|
|
643
|
-
this.activeIndex += numToAdd;
|
|
644
|
-
this.setActiveOption();
|
|
645
|
-
this.setFocusedOption();
|
|
646
|
-
this.scrollToActiveOption();
|
|
647
|
-
}
|
|
648
|
-
setDefaultActiveElement() {
|
|
649
|
-
this.activeIndex = this.getDefaultActiveIndex();
|
|
650
|
-
this.setActiveOption();
|
|
651
|
-
this.setFocusedOption();
|
|
652
|
-
}
|
|
653
402
|
focusInput() {
|
|
654
403
|
var _a;
|
|
655
404
|
(_a = this.inputField) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new FocusEvent('focus'));
|
|
656
405
|
}
|
|
657
|
-
getNextVisibleIndex(direction) {
|
|
658
|
-
let index = this.activeIndex + direction;
|
|
659
|
-
const { optionElements } = this;
|
|
660
|
-
while (index >= 0 && index <= optionElements.length - 1) {
|
|
661
|
-
const { display, visibility } = window.getComputedStyle(optionElements[index]);
|
|
662
|
-
if (display !== 'none' && visibility !== 'hidden') {
|
|
663
|
-
return index;
|
|
664
|
-
}
|
|
665
|
-
index = index + direction;
|
|
666
|
-
}
|
|
667
|
-
return -1;
|
|
668
|
-
}
|
|
669
406
|
setStatusMessage(message) {
|
|
670
407
|
clearTimeout(this.statusMessageTimer);
|
|
671
408
|
this.statusMessage = '';
|
|
@@ -680,7 +417,7 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
680
417
|
checkSelectedDisplay() {
|
|
681
418
|
let namedSlot = this.selectedDisplaySlot;
|
|
682
419
|
const { value, multiple, selectedOptions, multilineOptions, firstSelectedOptionElement, prioritizeSearch } = this;
|
|
683
|
-
const hasNoValue = !value && multiple && !selectedOptions.length;
|
|
420
|
+
const hasNoValue = !value && multiple && !(selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length);
|
|
684
421
|
if (prioritizeSearch || !multilineOptions || hasNoValue)
|
|
685
422
|
return this.clearSelectedDisplay();
|
|
686
423
|
if (!firstSelectedOptionElement || firstSelectedOptionElement.display)
|
|
@@ -709,6 +446,9 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
709
446
|
return;
|
|
710
447
|
selectedDisplaySlot.style.setProperty('--comp-selected-display-height', '44px');
|
|
711
448
|
}
|
|
449
|
+
shouldClearSearchText(event) {
|
|
450
|
+
return this.searchable && !!this.searchText && event.key === 'Escape';
|
|
451
|
+
}
|
|
712
452
|
/// DOM ///
|
|
713
453
|
renderCustomDisplay() {
|
|
714
454
|
const hasSelectedDisplay = this.checkSelectedDisplay();
|
|
@@ -723,23 +463,24 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
723
463
|
this.errors.length > 0 &&
|
|
724
464
|
this.errors.map(error => loc(error))) ||
|
|
725
465
|
(this.invalid && ['tecton.element.select.invalid']) ||
|
|
726
|
-
[], disabled: this.disabled, optional: this.optional, readonly: this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${!!this.
|
|
466
|
+
[], disabled: this.disabled, optional: this.optional, readonly: this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${!!this.open}`, ariaOwns: "option-list", ariaHaspopup: "listbox", role: this.searchable ? 'combobox' : null, pseudo: showAsPseudo, "test-id": "toggleDropdown", "hide-messages": true, iconRight: "chevron-down", onClick: this.inputClickHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeydownHandler, onFocus: this.inputFocusHandler, onBlur: this.inputBlurHandler, onChange: this.inputChangeHandler, badgeValue: this.badgeValue, badgeTheme: this.inputFocused ? 'primary' : undefined }, this.renderCustomDisplay()), h("div", { class: "custom-display-content", hidden: !this.hasCustomDisplay || !!this.searchText, onClick: this.onCustomDisplayClick }, h("slot", { name: "q2-select-display" })), this.optionsDropdown()));
|
|
727
467
|
}
|
|
728
468
|
optionsDropdown() {
|
|
729
|
-
|
|
730
|
-
return (h("div", { class: `q2-select-dropdown q2-element-dropdown ${dropDirection}`, ref: el => (this.dropdownContainer = el), onKeyDown: this.dropdownKeydownHandler, onFocusout: this.dropdownFocusoutHandler }, this.multiple ? this.visibilityToggle() : '', h("div", { class: "q2-select-options", id: "dropdown", role: "listbox" }, h("slot", null))));
|
|
469
|
+
return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.inputField, open: this.open, minHeight: this.popoverMinHeight, direction: this.popDirection, onPopoverStateChanged: this.popoverStateChanged, block: true }, this.multiple ? this.visibilityToggle() : '', h("q2-option-list", { ref: el => (this.optionList = el), id: "option-list", "show-selected": this.showSelected, multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, onChange: this.onOptionListChange }, h("slot", null))));
|
|
731
470
|
}
|
|
732
471
|
visibilityToggle() {
|
|
733
|
-
|
|
734
|
-
|
|
472
|
+
var _a, _b;
|
|
473
|
+
const selectedOptionsCount = (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
474
|
+
const { showSelected } = this;
|
|
475
|
+
return (h("div", { class: "multi-select-header", ref: el => (this.multiSelectHeader = el) }, h("span", null, loc('tecton.element.select.multiHeader.showing')), h("q2-btn", { class: showSelected ? '' : 'selected', badge: true, "aria-selected": !showSelected || undefined, "test-id": "allOptionsButton", onClick: this.showAllOptions, onKeyDown: this.visibilityToggleKeyDown, label: loc('tecton.element.select.multiHeader.allAriaLabel'), "hide-label": true }, loc('tecton.element.select.multiHeader.all')), h("q2-btn", { class: showSelected ? 'selected' : '', "aria-selected": showSelected || undefined, disabled: selectedOptionsCount === 0, badge: true, "test-id": "selectedOptionsButton", onClick: this.showSelectedOptions, onKeyDown: this.visibilityToggleKeyDown, label: loc('tecton.element.select.multiHeader.selectedAriaLabel', [selectedOptionsCount]), "hide-label": true }, loc('tecton.element.select.multiHeader.selected', [selectedOptionsCount]))));
|
|
735
476
|
}
|
|
736
477
|
get hostElement() { return this; }
|
|
737
478
|
static get watchers() { return {
|
|
479
|
+
"value": ["buildStructuredSelectedOptions", "valueUpdated"],
|
|
480
|
+
"selectedOptions": ["buildStructuredSelectedOptions"],
|
|
738
481
|
"ariaLabel": ["ariaLabelObserver"],
|
|
739
|
-
"
|
|
740
|
-
"
|
|
741
|
-
"multilineOptions": ["multilineOptionsChanged"],
|
|
742
|
-
"dropdownOpen": ["dropdownOpenChanged"]
|
|
482
|
+
"multilineOptions": ["handleMultilineOptionsUpdate"],
|
|
483
|
+
"open": ["openChanged"]
|
|
743
484
|
}; }
|
|
744
485
|
static get style() { return stylesCss; }
|
|
745
486
|
}, [1, "q2-select", {
|
|
@@ -747,7 +488,7 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
747
488
|
"hideLabel": [1540, "hide-label"],
|
|
748
489
|
"value": [1025],
|
|
749
490
|
"ariaLabel": [1537, "aria-label"],
|
|
750
|
-
"selectedOptions": [
|
|
491
|
+
"selectedOptions": [1040],
|
|
751
492
|
"disabled": [516],
|
|
752
493
|
"readonly": [516],
|
|
753
494
|
"invalid": [516],
|
|
@@ -759,20 +500,21 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
759
500
|
"multilineOptions": [516, "multiline-options"],
|
|
760
501
|
"optional": [516],
|
|
761
502
|
"placeholder": [513],
|
|
762
|
-
"
|
|
763
|
-
"
|
|
764
|
-
"
|
|
503
|
+
"hoist": [4],
|
|
504
|
+
"open": [32],
|
|
505
|
+
"showSelected": [32],
|
|
765
506
|
"searchText": [32],
|
|
766
507
|
"hasCustomDisplay": [32],
|
|
767
508
|
"inputFocused": [32],
|
|
768
509
|
"statusMessage": [32],
|
|
769
|
-
"prioritizeSearch": [32]
|
|
770
|
-
|
|
510
|
+
"prioritizeSearch": [32],
|
|
511
|
+
"structuredSelectedOptions": [32]
|
|
512
|
+
}, [[0, "keydown", "keydownHandler"], [0, "change", "onHostElementChange"], [0, "input", "onHostElementInput"], [0, "focus", "delegateFocus"], [0, "focusout", "handleFocusout"]]]);
|
|
771
513
|
function defineCustomElement$1() {
|
|
772
514
|
if (typeof customElements === "undefined") {
|
|
773
515
|
return;
|
|
774
516
|
}
|
|
775
|
-
const components = ["q2-select", "click-elsewhere", "q2-badge", "q2-btn", "q2-icon", "q2-input", "q2-loading"];
|
|
517
|
+
const components = ["q2-select", "click-elsewhere", "q2-badge", "q2-btn", "q2-icon", "q2-input", "q2-loading", "q2-option-list", "q2-popover"];
|
|
776
518
|
components.forEach(tagName => { switch (tagName) {
|
|
777
519
|
case "q2-select":
|
|
778
520
|
if (!customElements.get(tagName)) {
|
|
@@ -781,30 +523,40 @@ function defineCustomElement$1() {
|
|
|
781
523
|
break;
|
|
782
524
|
case "click-elsewhere":
|
|
783
525
|
if (!customElements.get(tagName)) {
|
|
784
|
-
defineCustomElement$
|
|
526
|
+
defineCustomElement$9();
|
|
785
527
|
}
|
|
786
528
|
break;
|
|
787
529
|
case "q2-badge":
|
|
788
530
|
if (!customElements.get(tagName)) {
|
|
789
|
-
defineCustomElement$
|
|
531
|
+
defineCustomElement$8();
|
|
790
532
|
}
|
|
791
533
|
break;
|
|
792
534
|
case "q2-btn":
|
|
793
535
|
if (!customElements.get(tagName)) {
|
|
794
|
-
defineCustomElement$
|
|
536
|
+
defineCustomElement$7();
|
|
795
537
|
}
|
|
796
538
|
break;
|
|
797
539
|
case "q2-icon":
|
|
798
540
|
if (!customElements.get(tagName)) {
|
|
799
|
-
defineCustomElement$
|
|
541
|
+
defineCustomElement$6();
|
|
800
542
|
}
|
|
801
543
|
break;
|
|
802
544
|
case "q2-input":
|
|
803
545
|
if (!customElements.get(tagName)) {
|
|
804
|
-
defineCustomElement$
|
|
546
|
+
defineCustomElement$5();
|
|
805
547
|
}
|
|
806
548
|
break;
|
|
807
549
|
case "q2-loading":
|
|
550
|
+
if (!customElements.get(tagName)) {
|
|
551
|
+
defineCustomElement$4();
|
|
552
|
+
}
|
|
553
|
+
break;
|
|
554
|
+
case "q2-option-list":
|
|
555
|
+
if (!customElements.get(tagName)) {
|
|
556
|
+
defineCustomElement$3();
|
|
557
|
+
}
|
|
558
|
+
break;
|
|
559
|
+
case "q2-popover":
|
|
808
560
|
if (!customElements.get(tagName)) {
|
|
809
561
|
defineCustomElement$2();
|
|
810
562
|
}
|