q2-tecton-elements 1.56.2 → 1.56.3
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/bundle-report.json +47 -35
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-badge_7.cjs.entry.js +8 -0
- package/dist/cjs/q2-badge_7.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +9 -11
- package/dist/cjs/q2-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +6 -7
- package/dist/cjs/q2-editable-field.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-option-list_2.cjs.entry.js +7 -3
- package/dist/cjs/q2-option-list_2.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +2 -1
- package/dist/cjs/q2-textarea.cjs.entry.js.map +1 -1
- package/dist/collection/components/q2-btn/q2-btn.js +4 -0
- package/dist/collection/components/q2-btn/q2-btn.js.map +1 -1
- package/dist/collection/components/q2-dropdown/q2-dropdown.js +9 -11
- package/dist/collection/components/q2-dropdown/q2-dropdown.js.map +1 -1
- package/dist/collection/components/q2-editable-field/q2-editable-field.js +12 -7
- package/dist/collection/components/q2-editable-field/q2-editable-field.js.map +1 -1
- package/dist/collection/components/q2-icon/q2-icon.js +4 -0
- package/dist/collection/components/q2-icon/q2-icon.js.map +1 -1
- package/dist/collection/components/q2-popover/q2-popover.js +7 -3
- package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
- package/dist/collection/components/q2-textarea/q2-textarea.js +2 -1
- package/dist/collection/components/q2-textarea/q2-textarea.js.map +1 -1
- package/dist/components/q2-btn2.js +4 -0
- package/dist/components/q2-btn2.js.map +1 -1
- package/dist/components/q2-dropdown.js +9 -11
- package/dist/components/q2-dropdown.js.map +1 -1
- package/dist/components/q2-editable-field.js +7 -8
- package/dist/components/q2-editable-field.js.map +1 -1
- package/dist/components/q2-icon2.js +4 -0
- package/dist/components/q2-icon2.js.map +1 -1
- package/dist/components/q2-popover2.js +7 -3
- package/dist/components/q2-popover2.js.map +1 -1
- package/dist/components/q2-textarea.js +2 -1
- package/dist/components/q2-textarea.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-badge_7.entry.js +8 -0
- package/dist/esm/q2-badge_7.entry.js.map +1 -1
- package/dist/esm/q2-dropdown.entry.js +9 -11
- package/dist/esm/q2-dropdown.entry.js.map +1 -1
- package/dist/esm/q2-editable-field.entry.js +6 -7
- package/dist/esm/q2-editable-field.entry.js.map +1 -1
- package/dist/esm/q2-option-list_2.entry.js +7 -3
- package/dist/esm/q2-option-list_2.entry.js.map +1 -1
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +2 -1
- package/dist/esm/q2-textarea.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-badge_7.entry.js +8 -0
- package/dist/q2-tecton-elements/q2-badge_7.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-dropdown.entry.js +13 -15
- package/dist/q2-tecton-elements/q2-dropdown.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-editable-field.entry.js +32 -23
- package/dist/q2-tecton-elements/q2-editable-field.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js +172 -166
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-textarea.entry.js +3 -2
- package/dist/q2-tecton-elements/q2-textarea.entry.js.map +1 -1
- package/dist/types/components/q2-btn/q2-btn.d.ts +1 -0
- package/dist/types/components/q2-dropdown/q2-dropdown.d.ts +1 -4
- package/dist/types/components/q2-editable-field/q2-editable-field.d.ts +2 -1
- package/dist/types/components/q2-icon/q2-icon.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as t, c as
|
|
1
|
+
import { r as t, c as i, h as e, H as s, g as o } from "./index-7a5365e2.js";
|
|
2
2
|
|
|
3
|
-
import { n, l as r, o as a, i as
|
|
3
|
+
import { n, l as r, o as a, i as h, w as c, v as l, h as p, x as d } from "./index-c215e8ef.js";
|
|
4
4
|
|
|
5
5
|
function sanitizeRegexString(t) {
|
|
6
6
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -11,20 +11,20 @@ const u = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;bo
|
|
|
11
11
|
const f = u;
|
|
12
12
|
|
|
13
13
|
const b = class {
|
|
14
|
-
constructor(
|
|
15
|
-
t(this,
|
|
16
|
-
this.change =
|
|
17
|
-
this.popoverState =
|
|
18
|
-
this.ready =
|
|
14
|
+
constructor(e) {
|
|
15
|
+
t(this, e);
|
|
16
|
+
this.change = i(this, "change", 7);
|
|
17
|
+
this.popoverState = i(this, "popoverState", 7);
|
|
18
|
+
this.ready = i(this, "ready", 3);
|
|
19
19
|
this.keyStore = {
|
|
20
20
|
queue: [],
|
|
21
21
|
lastPressedAt: new Date
|
|
22
22
|
};
|
|
23
23
|
this.scheduledAfterRender = [];
|
|
24
24
|
this.clickHandler = t => {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
this.selectOption(
|
|
25
|
+
const i = t.target;
|
|
26
|
+
const e = i.closest("q2-option:not([separator]):not([separator=true]), q2-dropdown-item:not([separator]):not([separator=true])");
|
|
27
|
+
this.selectOption(e);
|
|
28
28
|
if (this.multiple) return;
|
|
29
29
|
this.popoverState.emit({
|
|
30
30
|
open: false,
|
|
@@ -33,13 +33,13 @@ const b = class {
|
|
|
33
33
|
};
|
|
34
34
|
/* tslint:disable:cyclomatic-complexity */ this.externalKeydownHandler = t => {
|
|
35
35
|
t.stopPropagation();
|
|
36
|
-
const {activeIndex:
|
|
36
|
+
const {activeIndex: i, customSearch: e, allOptions: s} = this;
|
|
37
37
|
const {key: o} = t;
|
|
38
38
|
let r;
|
|
39
39
|
switch (o) {
|
|
40
40
|
case " ":
|
|
41
41
|
if (this.searchString) {
|
|
42
|
-
if (
|
|
42
|
+
if (e) break;
|
|
43
43
|
this.searchOptions(o, true);
|
|
44
44
|
break;
|
|
45
45
|
} else if (this.type === "menu") {
|
|
@@ -93,12 +93,12 @@ const b = class {
|
|
|
93
93
|
|
|
94
94
|
case "PageUp":
|
|
95
95
|
t.preventDefault();
|
|
96
|
-
this.openDropdownWithActiveElement(Math.max((
|
|
96
|
+
this.openDropdownWithActiveElement(Math.max((i || 0) - 10, 0));
|
|
97
97
|
break;
|
|
98
98
|
|
|
99
99
|
case "PageDown":
|
|
100
100
|
t.preventDefault();
|
|
101
|
-
this.openDropdownWithActiveElement(Math.min((
|
|
101
|
+
this.openDropdownWithActiveElement(Math.min((i || 0) + 10, s.length - 1));
|
|
102
102
|
break;
|
|
103
103
|
|
|
104
104
|
case "Tab":
|
|
@@ -118,35 +118,35 @@ const b = class {
|
|
|
118
118
|
break;
|
|
119
119
|
|
|
120
120
|
default:
|
|
121
|
-
if (
|
|
121
|
+
if (e) break;
|
|
122
122
|
if (!o.match(/^[\w]$/)) break;
|
|
123
123
|
this.searchOptions(o, true);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
/* tslint:enable:cyclomatic-complexity */ this.focusoutHandler = t => {
|
|
128
|
-
const {relatedTarget:
|
|
129
|
-
const
|
|
130
|
-
const s = !
|
|
131
|
-
if (
|
|
128
|
+
const {relatedTarget: i} = t;
|
|
129
|
+
const e = this.allOptions.includes(i);
|
|
130
|
+
const s = !e && this.hostElement.contains(i);
|
|
131
|
+
if (e || s) {
|
|
132
132
|
t.stopPropagation();
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
this.internalKeydownHandler = t => {
|
|
136
136
|
t.stopPropagation();
|
|
137
|
-
const {activeIndex:
|
|
137
|
+
const {activeIndex: i, customSearch: e, allOptions: s, allVisibleOptions: o, multiple: n} = this;
|
|
138
138
|
const {key: r, shiftKey: a} = t;
|
|
139
|
-
let
|
|
139
|
+
let h;
|
|
140
140
|
switch (r) {
|
|
141
141
|
case " ":
|
|
142
142
|
if (this.searchString && !this.multiple) {
|
|
143
|
-
if (
|
|
143
|
+
if (e) break;
|
|
144
144
|
this.searchOptions(r, false);
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
if (!
|
|
149
|
-
this.selectOption(
|
|
147
|
+
h = s.find((t => t.active));
|
|
148
|
+
if (!h || h.disabled) break;
|
|
149
|
+
this.selectOption(h);
|
|
150
150
|
if (n) break;
|
|
151
151
|
this.hostElement.addEventListener("tctClick", (() => {
|
|
152
152
|
this.popoverState.emit({
|
|
@@ -159,9 +159,9 @@ const b = class {
|
|
|
159
159
|
break;
|
|
160
160
|
|
|
161
161
|
case "Enter":
|
|
162
|
-
|
|
163
|
-
if (!
|
|
164
|
-
this.selectOption(
|
|
162
|
+
h = s.find((t => t.active));
|
|
163
|
+
if (!h || h.disabled) break;
|
|
164
|
+
this.selectOption(h);
|
|
165
165
|
if (n) break;
|
|
166
166
|
this.hostElement.addEventListener("tctClick", (() => {
|
|
167
167
|
this.popoverState.emit({
|
|
@@ -175,16 +175,16 @@ const b = class {
|
|
|
175
175
|
|
|
176
176
|
case "ArrowUp":
|
|
177
177
|
t.preventDefault();
|
|
178
|
-
const
|
|
179
|
-
const l =
|
|
178
|
+
const c = o[0];
|
|
179
|
+
const l = c.active;
|
|
180
180
|
if (l) break;
|
|
181
|
-
if (
|
|
181
|
+
if (i === undefined) {
|
|
182
182
|
this.setDefaultActiveElement();
|
|
183
183
|
break;
|
|
184
184
|
} else {
|
|
185
185
|
const t = this.getNextVisibleIndex(-1);
|
|
186
186
|
if (t === -1) break;
|
|
187
|
-
this.adjustActiveOptionAndScroll(t -
|
|
187
|
+
this.adjustActiveOptionAndScroll(t - i);
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -193,13 +193,13 @@ const b = class {
|
|
|
193
193
|
const p = o[o.length - 1];
|
|
194
194
|
const d = p.active;
|
|
195
195
|
if (d) break;
|
|
196
|
-
if (
|
|
196
|
+
if (i === undefined) {
|
|
197
197
|
this.setDefaultActiveElement();
|
|
198
198
|
break;
|
|
199
199
|
} else {
|
|
200
200
|
const t = this.getNextVisibleIndex(1);
|
|
201
201
|
if (t === -1) break;
|
|
202
|
-
this.adjustActiveOptionAndScroll(t -
|
|
202
|
+
this.adjustActiveOptionAndScroll(t - i);
|
|
203
203
|
break;
|
|
204
204
|
}
|
|
205
205
|
|
|
@@ -215,12 +215,12 @@ const b = class {
|
|
|
215
215
|
|
|
216
216
|
case "PageUp":
|
|
217
217
|
t.preventDefault();
|
|
218
|
-
this.openDropdownWithActiveElement(Math.max(
|
|
218
|
+
this.openDropdownWithActiveElement(Math.max(i - 10, 0));
|
|
219
219
|
break;
|
|
220
220
|
|
|
221
221
|
case "PageDown":
|
|
222
222
|
t.preventDefault();
|
|
223
|
-
this.openDropdownWithActiveElement(Math.min(
|
|
223
|
+
this.openDropdownWithActiveElement(Math.min(i + 10, s.length - 1));
|
|
224
224
|
break;
|
|
225
225
|
|
|
226
226
|
case "Tab":
|
|
@@ -233,9 +233,9 @@ const b = class {
|
|
|
233
233
|
});
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
|
-
|
|
237
|
-
if (!
|
|
238
|
-
this.selectOption(
|
|
236
|
+
h = s.find((t => t.active));
|
|
237
|
+
if (!h || h.disabled) return;
|
|
238
|
+
this.selectOption(h);
|
|
239
239
|
break;
|
|
240
240
|
|
|
241
241
|
case "Esc":
|
|
@@ -248,37 +248,37 @@ const b = class {
|
|
|
248
248
|
break;
|
|
249
249
|
|
|
250
250
|
default:
|
|
251
|
-
if (
|
|
251
|
+
if (e) break;
|
|
252
252
|
if (!r.match(/^[\w]$/)) break;
|
|
253
253
|
this.searchOptions(r, false);
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
this.searchAndFocus = (t,
|
|
257
|
+
this.searchAndFocus = (t, i) => {
|
|
258
258
|
// pseudo search in non-searchable select
|
|
259
259
|
const reorder = () => {
|
|
260
260
|
this.pivotIndex = this.pivotIndex === undefined ? 0 : (this.activeIndex || 0) + 1;
|
|
261
|
-
const t = this.allOptions.map(((t,
|
|
261
|
+
const t = this.allOptions.map(((t, i) => ({
|
|
262
262
|
element: t,
|
|
263
|
-
index:
|
|
263
|
+
index: i
|
|
264
264
|
})));
|
|
265
265
|
return [ ...t.slice(this.pivotIndex), ...t.slice(0, this.pivotIndex) ];
|
|
266
266
|
};
|
|
267
267
|
const buildQueue = () => {
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
268
|
+
const i = new Date;
|
|
269
|
+
if (i.getTime() - this.keyStore.lastPressedAt.getTime() > 1e3) {
|
|
270
270
|
// empty stored keys if delay > 1s
|
|
271
271
|
this.keyStore.queue.length = 0;
|
|
272
272
|
}
|
|
273
273
|
if (this.keyStore.queue.length !== 1 || this.keyStore.queue[0] !== t) {
|
|
274
274
|
this.keyStore.queue.push(t);
|
|
275
275
|
}
|
|
276
|
-
this.keyStore.lastPressedAt =
|
|
276
|
+
this.keyStore.lastPressedAt = i;
|
|
277
277
|
};
|
|
278
278
|
const searchIndex = t => {
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
return t.find((t => !t.element.disabled && t.element.display && (t.element.display.match(new RegExp(`^${
|
|
279
|
+
const i = this.keyStore.queue.join("");
|
|
280
|
+
const e = sanitizeRegexString(i);
|
|
281
|
+
return t.find((t => !t.element.disabled && t.element.display && (t.element.display.match(new RegExp(`^${e}`, "i")) || t.element.display.replace(/\s/g, "").match(new RegExp(`^${e}`, "i")))));
|
|
282
282
|
};
|
|
283
283
|
const setFocus = ({index: t}) => {
|
|
284
284
|
if (this.multiple) {
|
|
@@ -286,7 +286,7 @@ const b = class {
|
|
|
286
286
|
this.openDropdownWithActiveElement(t);
|
|
287
287
|
} else {
|
|
288
288
|
this.activeIndex = t;
|
|
289
|
-
if (
|
|
289
|
+
if (i) {
|
|
290
290
|
this.selectOption(this.allOptions[t]);
|
|
291
291
|
this.popoverState.emit({
|
|
292
292
|
open: false,
|
|
@@ -296,9 +296,9 @@ const b = class {
|
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
298
|
buildQueue();
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
301
|
-
setFocus(
|
|
299
|
+
const e = searchIndex(reorder());
|
|
300
|
+
if (e) {
|
|
301
|
+
setFocus(e);
|
|
302
302
|
}
|
|
303
303
|
};
|
|
304
304
|
this.hasOptions = undefined;
|
|
@@ -333,13 +333,13 @@ const b = class {
|
|
|
333
333
|
t.stopPropagation();
|
|
334
334
|
}
|
|
335
335
|
delegateFocus(t) {
|
|
336
|
-
if (!
|
|
336
|
+
if (!h(t, this.hostElement)) return;
|
|
337
337
|
this.popoverState.emit({
|
|
338
338
|
open: true,
|
|
339
339
|
action: "open"
|
|
340
340
|
});
|
|
341
|
-
const {activeIndex:
|
|
342
|
-
if (typeof
|
|
341
|
+
const {activeIndex: i} = this;
|
|
342
|
+
if (typeof i === "number" && i > -1) {
|
|
343
343
|
this.setActiveOption();
|
|
344
344
|
this.setFocusedOption();
|
|
345
345
|
} else {
|
|
@@ -381,25 +381,25 @@ const b = class {
|
|
|
381
381
|
this.showSelected = false;
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
this.allOptions.forEach((
|
|
385
|
-
if (!("_multiSelectHidden" in
|
|
386
|
-
|
|
384
|
+
this.allOptions.forEach((i => {
|
|
385
|
+
if (!("_multiSelectHidden" in i)) return;
|
|
386
|
+
i._multiSelectHidden = t ? !i.selected : false;
|
|
387
387
|
}));
|
|
388
388
|
}
|
|
389
389
|
// #endregion
|
|
390
390
|
// #region Local Methods
|
|
391
391
|
get allContents() {
|
|
392
392
|
const t = this.getRootSlot(this.hostElement);
|
|
393
|
-
const
|
|
394
|
-
return t.filter((t =>
|
|
393
|
+
const i = new Set([ "Q2-OPTGROUP", "Q2-OPTION", "Q2-DROPDOWN-ITEM" ]);
|
|
394
|
+
return t.filter((t => i.has(t.tagName)));
|
|
395
395
|
}
|
|
396
396
|
get allOptions() {
|
|
397
397
|
const t = this.allContents;
|
|
398
|
-
const extractOptions = t => t.reduce(((t,
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
401
|
-
} else if (
|
|
402
|
-
return [ ...t, ...extractOptions(Array.from(
|
|
398
|
+
const extractOptions = t => t.reduce(((t, i) => {
|
|
399
|
+
if (i.tagName === "Q2-OPTION" || i.tagName === "Q2-DROPDOWN-ITEM") {
|
|
400
|
+
return i.separator ? t : [ ...t, i ];
|
|
401
|
+
} else if (i.tagName === "Q2-OPTGROUP") {
|
|
402
|
+
return [ ...t, ...extractOptions(Array.from(i.children)) ];
|
|
403
403
|
} else {
|
|
404
404
|
return t;
|
|
405
405
|
}
|
|
@@ -418,22 +418,22 @@ const b = class {
|
|
|
418
418
|
checkOptions() {
|
|
419
419
|
const {type: t} = this;
|
|
420
420
|
if (!t) return;
|
|
421
|
-
const
|
|
421
|
+
const i = t === "menu" ? "menuitem" : "option";
|
|
422
422
|
this.allOptions.forEach((t => {
|
|
423
|
-
t.role =
|
|
423
|
+
t.role = i;
|
|
424
424
|
}));
|
|
425
425
|
}
|
|
426
426
|
focusSelectedSibling(t) {
|
|
427
|
-
const {allVisibleOptions:
|
|
428
|
-
const s =
|
|
427
|
+
const {allVisibleOptions: i, allOptions: e} = this;
|
|
428
|
+
const s = i.length < 2;
|
|
429
429
|
if (s) {
|
|
430
430
|
this.showSelected = false;
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
const o =
|
|
433
|
+
const o = i.indexOf(t);
|
|
434
434
|
const n = o ? o - 1 : o + 1;
|
|
435
|
-
const r =
|
|
436
|
-
const a =
|
|
435
|
+
const r = i[n];
|
|
436
|
+
const a = e.indexOf(r);
|
|
437
437
|
this.activeIndex = a;
|
|
438
438
|
this.setFocusedOption();
|
|
439
439
|
this.scheduledAfterRender.push((() => {
|
|
@@ -443,29 +443,29 @@ const b = class {
|
|
|
443
443
|
}
|
|
444
444
|
getDefaultActiveIndex() {
|
|
445
445
|
const {allOptions: t} = this;
|
|
446
|
-
const
|
|
447
|
-
if (e > -1) return e;
|
|
448
|
-
const i = t.findIndex((t => !t.hidden));
|
|
446
|
+
const i = t.findIndex((t => "selected" in t && t.selected));
|
|
449
447
|
if (i > -1) return i;
|
|
448
|
+
const e = t.findIndex((t => !t.hidden));
|
|
449
|
+
if (e > -1) return e;
|
|
450
450
|
return 0;
|
|
451
451
|
}
|
|
452
452
|
getNextVisibleIndex(t) {
|
|
453
|
-
const {allVisibleOptions:
|
|
454
|
-
const o =
|
|
455
|
-
const n =
|
|
453
|
+
const {allVisibleOptions: i, allOptions: e, activeIndex: s} = this;
|
|
454
|
+
const o = e[s];
|
|
455
|
+
const n = i.indexOf(o);
|
|
456
456
|
let r = n + t;
|
|
457
457
|
if (r < 0) {
|
|
458
|
-
r =
|
|
459
|
-
} else if (r >
|
|
458
|
+
r = i.length - 1;
|
|
459
|
+
} else if (r > i.length - 1) {
|
|
460
460
|
r = 0;
|
|
461
461
|
}
|
|
462
|
-
const a =
|
|
463
|
-
return
|
|
462
|
+
const a = i[r];
|
|
463
|
+
return e.indexOf(a);
|
|
464
464
|
}
|
|
465
465
|
getRootSlot(t) {
|
|
466
|
-
var
|
|
467
|
-
const
|
|
468
|
-
const s = (
|
|
466
|
+
var i;
|
|
467
|
+
const e = t.querySelector("slot");
|
|
468
|
+
const s = (i = e === null || e === void 0 ? void 0 : e.assignedElements()) !== null && i !== void 0 ? i : Array.from(t.children);
|
|
469
469
|
const o = !!s.length && s[0].tagName === "SLOT";
|
|
470
470
|
if (o) {
|
|
471
471
|
return this.getRootSlot(s[0]);
|
|
@@ -479,7 +479,7 @@ const b = class {
|
|
|
479
479
|
open: true,
|
|
480
480
|
action: "open"
|
|
481
481
|
});
|
|
482
|
-
await
|
|
482
|
+
await c();
|
|
483
483
|
this.activeIndex = t;
|
|
484
484
|
this.setActiveOption();
|
|
485
485
|
this.setFocusedOption();
|
|
@@ -499,12 +499,12 @@ const b = class {
|
|
|
499
499
|
block: "center"
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
|
-
searchOptions(t,
|
|
502
|
+
searchOptions(t, i) {
|
|
503
503
|
this.searchString = t;
|
|
504
|
-
this.searchAndFocus(t,
|
|
504
|
+
this.searchAndFocus(t, i);
|
|
505
505
|
}
|
|
506
506
|
selectOption(t) {
|
|
507
|
-
const {multiple:
|
|
507
|
+
const {multiple: i, noSelect: e, showSelected: s} = this;
|
|
508
508
|
if (!t || t.disabled || "disabledGroup" in t && t.disabledGroup) return;
|
|
509
509
|
const o = t.value;
|
|
510
510
|
const n = "display" in t && t.display ? t.display : t.innerText.trim();
|
|
@@ -513,19 +513,19 @@ const b = class {
|
|
|
513
513
|
display: n
|
|
514
514
|
};
|
|
515
515
|
let a = [];
|
|
516
|
-
if (
|
|
517
|
-
const {selectedOptions:
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
a =
|
|
516
|
+
if (i) {
|
|
517
|
+
const {selectedOptions: i} = this;
|
|
518
|
+
const e = i.find((t => t.value === o));
|
|
519
|
+
if (e) {
|
|
520
|
+
a = i.filter((({value: t}) => t !== o));
|
|
521
521
|
} else {
|
|
522
|
-
a = [ ...
|
|
522
|
+
a = [ ...i, r ];
|
|
523
523
|
}
|
|
524
524
|
if (s) this.focusSelectedSibling(t);
|
|
525
525
|
} else {
|
|
526
526
|
a = [ r ];
|
|
527
527
|
}
|
|
528
|
-
if (
|
|
528
|
+
if (e) this.setActiveElement(null); else this.selectedOptions = a;
|
|
529
529
|
this.change.emit({
|
|
530
530
|
value: o,
|
|
531
531
|
values: a
|
|
@@ -533,31 +533,31 @@ const b = class {
|
|
|
533
533
|
}
|
|
534
534
|
setActiveOption() {
|
|
535
535
|
const t = this.activeIndex;
|
|
536
|
-
this.allOptions.forEach(((
|
|
537
|
-
|
|
536
|
+
this.allOptions.forEach(((i, e) => {
|
|
537
|
+
i.active = t === e;
|
|
538
538
|
}));
|
|
539
539
|
}
|
|
540
540
|
setFocusedOption() {
|
|
541
541
|
const t = this.allOptions[this.activeIndex];
|
|
542
542
|
if (!t) return;
|
|
543
|
-
const
|
|
544
|
-
if (
|
|
543
|
+
const i = l(t);
|
|
544
|
+
if (i) t.focus(); else n((() => t.focus()));
|
|
545
545
|
}
|
|
546
546
|
updateMultipleOptionAttrs() {
|
|
547
|
-
const {allOptions: t, selectedOptions:
|
|
548
|
-
const
|
|
547
|
+
const {allOptions: t, selectedOptions: i} = this;
|
|
548
|
+
const e = i.map((({value: t}) => t));
|
|
549
549
|
if (this.noSelect) return;
|
|
550
550
|
t.forEach((t => {
|
|
551
551
|
if (!("selected" in t)) return;
|
|
552
|
-
t.selected =
|
|
552
|
+
t.selected = e.includes(t.value);
|
|
553
553
|
}));
|
|
554
554
|
}
|
|
555
555
|
updateSingleOptionAttrs() {
|
|
556
556
|
var t;
|
|
557
|
-
const {allOptions:
|
|
558
|
-
const s = ((t =
|
|
557
|
+
const {allOptions: i, selectedOptions: e} = this;
|
|
558
|
+
const s = ((t = e[0]) === null || t === void 0 ? void 0 : t.value) || undefined;
|
|
559
559
|
if (this.noSelect) return;
|
|
560
|
-
|
|
560
|
+
i.forEach((t => {
|
|
561
561
|
if (!("selected" in t)) return;
|
|
562
562
|
t.selected = t.value === s;
|
|
563
563
|
}));
|
|
@@ -565,14 +565,14 @@ const b = class {
|
|
|
565
565
|
// #endregion
|
|
566
566
|
// #region Render Methods
|
|
567
567
|
render() {
|
|
568
|
-
return
|
|
568
|
+
return e(s, {
|
|
569
569
|
key: "48bc63463e38e58f7f18e5b5b105e14689be640c"
|
|
570
|
-
},
|
|
570
|
+
}, e("div", {
|
|
571
571
|
key: "26d143ad186b387274837d2141f9e5cd7cee6fb0",
|
|
572
572
|
class: "content",
|
|
573
573
|
ref: t => this.contentElement = t,
|
|
574
574
|
onFocusout: this.focusoutHandler
|
|
575
|
-
},
|
|
575
|
+
}, e("div", {
|
|
576
576
|
key: "afecab7ca714392b609ccc57f4d920a4cc7f2c7e",
|
|
577
577
|
class: "options",
|
|
578
578
|
"aria-label": r("tecton.element.optionList.label", [ this.label ]),
|
|
@@ -580,7 +580,7 @@ const b = class {
|
|
|
580
580
|
role: this.type || "listbox",
|
|
581
581
|
onKeyDown: this.internalKeydownHandler,
|
|
582
582
|
onClick: this.clickHandler
|
|
583
|
-
},
|
|
583
|
+
}, e("slot", {
|
|
584
584
|
key: "7ca042464b34eeb59ddd8c62bf44b29b39f3ccfb"
|
|
585
585
|
}))));
|
|
586
586
|
}
|
|
@@ -602,9 +602,9 @@ const w = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;bo
|
|
|
602
602
|
const v = w;
|
|
603
603
|
|
|
604
604
|
const m = class {
|
|
605
|
-
constructor(
|
|
606
|
-
t(this,
|
|
607
|
-
this.popoverStateChanged =
|
|
605
|
+
constructor(e) {
|
|
606
|
+
t(this, e);
|
|
607
|
+
this.popoverStateChanged = i(this, "popoverStateChanged", 7);
|
|
608
608
|
/**
|
|
609
609
|
* The number of pixels to leave between the popover and the edge of the viewport
|
|
610
610
|
*/ this.displayBuffer = 10;
|
|
@@ -615,30 +615,30 @@ const m = class {
|
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
617
|
this.setAbsoluteCSSProperties = async () => {
|
|
618
|
-
const {controlElement: t, containerElement:
|
|
618
|
+
const {controlElement: t, containerElement: i, currentDirection: e, align: s} = this;
|
|
619
619
|
if (s === "right") {
|
|
620
|
-
|
|
621
|
-
|
|
620
|
+
i.style.setProperty("--comp-pop-right", "0");
|
|
621
|
+
i.style.setProperty("--comp-pop-left", "unset");
|
|
622
622
|
} else {
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
i.style.setProperty("--comp-pop-left", "0");
|
|
624
|
+
i.style.setProperty("--comp-pop-right", "unset");
|
|
625
625
|
}
|
|
626
626
|
if (this.block) {
|
|
627
|
-
|
|
627
|
+
i.style.setProperty("--comp-pop-width", "100%");
|
|
628
628
|
}
|
|
629
|
-
if (
|
|
630
|
-
const
|
|
631
|
-
const s = parseInt(
|
|
632
|
-
|
|
629
|
+
if (e === "up") {
|
|
630
|
+
const e = getComputedStyle(t);
|
|
631
|
+
const s = parseInt(e.height || "0") + parseInt(e.borderTopWidth || "0") + parseInt(e.borderBottomWidth || "0");
|
|
632
|
+
i.style.setProperty("--comp-pop-bottom", `${s}px`);
|
|
633
633
|
}
|
|
634
634
|
// Wait for one paint to prevent layout thrashing
|
|
635
|
-
await
|
|
636
|
-
|
|
635
|
+
await c();
|
|
636
|
+
i.style.setProperty("--comp-pop-opacity", "1");
|
|
637
637
|
};
|
|
638
638
|
this.setFixedCSSProperties = async () => {
|
|
639
|
-
var t,
|
|
639
|
+
var t, i, e, s;
|
|
640
640
|
const {controlElement: o, containerElement: n, currentDirection: r, rootElementRect: a} = this;
|
|
641
|
-
const {top:
|
|
641
|
+
const {top: h, bottom: l, left: p, right: u} = (i = (t = o === null || o === void 0 ? void 0 : o.getBoundingClientRect) === null || t === void 0 ? void 0 : t.call(o)) !== null && i !== void 0 ? i : {
|
|
642
642
|
top: 0,
|
|
643
643
|
bottom: 0,
|
|
644
644
|
left: 0,
|
|
@@ -650,9 +650,9 @@ const m = class {
|
|
|
650
650
|
n.style.setProperty("--comp-pop-right", `${a.width + a.left - u}px`);
|
|
651
651
|
if (r === "up") {
|
|
652
652
|
if (d()) {
|
|
653
|
-
n.style.setProperty("--comp-pop-bottom", `${window.innerHeight -
|
|
653
|
+
n.style.setProperty("--comp-pop-bottom", `${window.innerHeight - h}px`);
|
|
654
654
|
} else {
|
|
655
|
-
n.style.setProperty("--comp-pop-bottom", `${window.innerHeight -
|
|
655
|
+
n.style.setProperty("--comp-pop-bottom", `${window.innerHeight - h - ((e = window === null || window === void 0 ? void 0 : window.visualViewport.offsetTop) !== null && e !== void 0 ? e : 0)}px`);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
if (r === "down") {
|
|
@@ -663,7 +663,7 @@ const m = class {
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
// Wait for one paint to prevent layout thrashing
|
|
666
|
-
await
|
|
666
|
+
await c();
|
|
667
667
|
n.style.setProperty("--comp-pop-opacity", "1");
|
|
668
668
|
};
|
|
669
669
|
this.viewPortChanged = () => {
|
|
@@ -689,6 +689,10 @@ const m = class {
|
|
|
689
689
|
// #region Component Lifecycle Events
|
|
690
690
|
disconnectedCallback() {
|
|
691
691
|
this.removeViewportListeners();
|
|
692
|
+
this.containerElement = null;
|
|
693
|
+
this.contentElement = null;
|
|
694
|
+
this.controlElement = null;
|
|
695
|
+
this.rootElementRect = null;
|
|
692
696
|
}
|
|
693
697
|
componentDidLoad() {
|
|
694
698
|
this.handleMinHeight();
|
|
@@ -697,9 +701,9 @@ const m = class {
|
|
|
697
701
|
// #endregion
|
|
698
702
|
// #region Listeners
|
|
699
703
|
popoverStateHandler(t) {
|
|
700
|
-
const {detail: {open:
|
|
701
|
-
if (
|
|
702
|
-
this.open =
|
|
704
|
+
const {detail: {open: i}} = t;
|
|
705
|
+
if (i === this.open) return;
|
|
706
|
+
this.open = i;
|
|
703
707
|
t.stopPropagation();
|
|
704
708
|
}
|
|
705
709
|
// #endregion
|
|
@@ -727,17 +731,17 @@ const m = class {
|
|
|
727
731
|
this.removeViewportListeners();
|
|
728
732
|
this.currentDirection = undefined;
|
|
729
733
|
this.show = false;
|
|
730
|
-
await
|
|
734
|
+
await c();
|
|
731
735
|
this.clearCSSProperties();
|
|
732
736
|
}
|
|
733
737
|
}
|
|
734
738
|
// #endregion
|
|
735
739
|
// #region Local Methods
|
|
736
740
|
get isModule() {
|
|
737
|
-
var t,
|
|
738
|
-
const
|
|
739
|
-
const s = Object.keys((
|
|
740
|
-
return
|
|
741
|
+
var t, i;
|
|
742
|
+
const e = window !== window.top;
|
|
743
|
+
const s = Object.keys((i = (t = window.Tecton) === null || t === void 0 ? void 0 : t.platformDimensions) !== null && i !== void 0 ? i : {}).length > 0;
|
|
744
|
+
return e && s;
|
|
741
745
|
}
|
|
742
746
|
get providedDirection() {
|
|
743
747
|
const {direction: t} = this;
|
|
@@ -763,7 +767,7 @@ const m = class {
|
|
|
763
767
|
passive: true,
|
|
764
768
|
capture: true
|
|
765
769
|
});
|
|
766
|
-
(t = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || t === void 0 ? void 0 : t.addEventListener("
|
|
770
|
+
(t = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || t === void 0 ? void 0 : t.addEventListener("orientationchange", this.viewPortOrientationChanged);
|
|
767
771
|
window.addEventListener("orientationchange", this.viewPortOrientationChanged);
|
|
768
772
|
// #endregion
|
|
769
773
|
}
|
|
@@ -777,12 +781,12 @@ const m = class {
|
|
|
777
781
|
this.containerElement.style.removeProperty("--comp-pop-opacity");
|
|
778
782
|
}
|
|
779
783
|
async determinePopDirection() {
|
|
780
|
-
var t,
|
|
784
|
+
var t, i, e;
|
|
781
785
|
const {containerElement: s, controlElement: o, providedDirection: n, displayBuffer: r} = this;
|
|
782
786
|
if (s) s.style.maxHeight = null;
|
|
783
|
-
await
|
|
787
|
+
await c();
|
|
784
788
|
const {isModule: a} = this;
|
|
785
|
-
const {top:
|
|
789
|
+
const {top: h, bottom: l} = (i = (t = o === null || o === void 0 ? void 0 : o.getBoundingClientRect) === null || t === void 0 ? void 0 : t.call(o)) !== null && i !== void 0 ? i : {
|
|
786
790
|
top: 0,
|
|
787
791
|
bottom: 0
|
|
788
792
|
};
|
|
@@ -790,18 +794,18 @@ const m = class {
|
|
|
790
794
|
let d;
|
|
791
795
|
let u;
|
|
792
796
|
if (a) {
|
|
793
|
-
const {outletOffset: t = 0, innerHeight:
|
|
797
|
+
const {outletOffset: t = 0, innerHeight: i = window.innerHeight} = ((e = window.Tecton) === null || e === void 0 ? void 0 : e.platformDimensions) || {};
|
|
794
798
|
const s = window.visualViewport.height - l;
|
|
795
|
-
const o =
|
|
799
|
+
const o = i - (t + l);
|
|
796
800
|
const n = s < o;
|
|
797
|
-
p =
|
|
801
|
+
p = i;
|
|
798
802
|
// If the top of the module is below the top of the window we just use the controlTop
|
|
799
803
|
// Otherwise we need to add the outletOffset to the controlTop
|
|
800
|
-
d = (t > 0 ?
|
|
804
|
+
d = (t > 0 ? h : h + t) - r;
|
|
801
805
|
u = n ? s - r : o - r;
|
|
802
806
|
} else {
|
|
803
807
|
p = window.visualViewport.height;
|
|
804
|
-
d =
|
|
808
|
+
d = h - r;
|
|
805
809
|
u = p - l - r;
|
|
806
810
|
}
|
|
807
811
|
const f = d > u ? "up" : "down";
|
|
@@ -814,8 +818,8 @@ const m = class {
|
|
|
814
818
|
case "up":
|
|
815
819
|
if (b) {
|
|
816
820
|
const t = this.validatedMaxHeight || d;
|
|
817
|
-
const
|
|
818
|
-
s.style.setProperty("--comp-pop-max-height", `${
|
|
821
|
+
const i = Math.min(d, t);
|
|
822
|
+
s.style.setProperty("--comp-pop-max-height", `${i}px`);
|
|
819
823
|
}
|
|
820
824
|
this.setDirectionAndShow("up");
|
|
821
825
|
break;
|
|
@@ -823,8 +827,8 @@ const m = class {
|
|
|
823
827
|
case "down":
|
|
824
828
|
if (b) {
|
|
825
829
|
const t = this.validatedMaxHeight || u;
|
|
826
|
-
const
|
|
827
|
-
s.style.setProperty("--comp-pop-max-height", `${
|
|
830
|
+
const i = Math.min(u, t);
|
|
831
|
+
s.style.setProperty("--comp-pop-max-height", `${i}px`);
|
|
828
832
|
}
|
|
829
833
|
this.setDirectionAndShow("down");
|
|
830
834
|
break;
|
|
@@ -835,7 +839,9 @@ const m = class {
|
|
|
835
839
|
window.removeEventListener("resize", this.viewPortOrientationChanged);
|
|
836
840
|
visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.removeEventListener("resize", this.viewPortChanged);
|
|
837
841
|
// #region remove when Popover API is supported in iOS
|
|
838
|
-
window.removeEventListener("scroll", this.viewPortChanged
|
|
842
|
+
window.removeEventListener("scroll", this.viewPortChanged, {
|
|
843
|
+
capture: true
|
|
844
|
+
});
|
|
839
845
|
(t = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || t === void 0 ? void 0 : t.removeEventListener("orientationchange", this.viewPortOrientationChanged);
|
|
840
846
|
window.removeEventListener("orientationchange", this.viewPortOrientationChanged);
|
|
841
847
|
// #endregion
|
|
@@ -844,8 +850,8 @@ const m = class {
|
|
|
844
850
|
this.setRootElement();
|
|
845
851
|
// Due to some runtime inconsistency across devices/browsers we need to add one more check here because the
|
|
846
852
|
// popover can be closed between the time the popover is opened and the time the direction is determined
|
|
847
|
-
const
|
|
848
|
-
if (!
|
|
853
|
+
const i = this.open;
|
|
854
|
+
if (!i) return;
|
|
849
855
|
this.currentDirection = t;
|
|
850
856
|
this.show = true;
|
|
851
857
|
if (this.mode === "legacy") {
|
|
@@ -857,16 +863,16 @@ const m = class {
|
|
|
857
863
|
setRootElement() {
|
|
858
864
|
let t = this.hostElement;
|
|
859
865
|
while (t && t !== document.documentElement) {
|
|
860
|
-
const
|
|
866
|
+
const i = window.getComputedStyle(t);
|
|
861
867
|
// Check if the element has any styles applied that create a new containg block
|
|
862
|
-
if (
|
|
868
|
+
if (i.transform !== "none" || i.filter !== "none" || i.perspective !== "none" || i.containerType !== "normal" || [ "transform", "perspective", "filter" ].includes(i.willChange) || [ "layout", "paint", "strict", "content" ].includes(i.contain)) {
|
|
863
869
|
this.rootElementRect = t.getBoundingClientRect();
|
|
864
870
|
return;
|
|
865
871
|
}
|
|
866
|
-
const
|
|
867
|
-
const s = typeof ShadowRoot !== "undefined" &&
|
|
872
|
+
const e = t.getRootNode();
|
|
873
|
+
const s = typeof ShadowRoot !== "undefined" && e instanceof ShadowRoot && e.host instanceof HTMLElement;
|
|
868
874
|
if (s) {
|
|
869
|
-
t =
|
|
875
|
+
t = e.host;
|
|
870
876
|
} else {
|
|
871
877
|
t = t.parentElement;
|
|
872
878
|
}
|
|
@@ -887,18 +893,18 @@ const m = class {
|
|
|
887
893
|
const t = [ "container", this.currentDirection ];
|
|
888
894
|
if (this.show) t.push("show");
|
|
889
895
|
if (this.mode === "legacy") t.push("legacy");
|
|
890
|
-
return
|
|
891
|
-
key: "
|
|
896
|
+
return e("div", {
|
|
897
|
+
key: "c6811c849c6782e77a762a227192dd169b5b8a44",
|
|
892
898
|
ref: t => this.containerElement = t,
|
|
893
899
|
class: t.join(" "),
|
|
894
900
|
"test-id": "outerContainer",
|
|
895
901
|
tabIndex: -1
|
|
896
|
-
},
|
|
897
|
-
key: "
|
|
902
|
+
}, e("div", {
|
|
903
|
+
key: "21cd6d307e22fec14249c02b2976b2f542a11aa8",
|
|
898
904
|
ref: t => this.contentElement = t,
|
|
899
905
|
class: "content"
|
|
900
|
-
},
|
|
901
|
-
key: "
|
|
906
|
+
}, e("slot", {
|
|
907
|
+
key: "20747824b57f94c6edee7bde429135f9a03b1bc5"
|
|
902
908
|
})));
|
|
903
909
|
}
|
|
904
910
|
get hostElement() {
|