@baloise/ds-core 16.5.1 → 16.5.2-nightly.20240930
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/components/all.d.ts +2 -0
- package/components/all.js +3 -0
- package/components/bal-app.js +1 -85
- package/components/bal-app2.js +87 -0
- package/components/bal-doc-app.d.ts +11 -0
- package/components/bal-doc-app.js +260 -0
- package/components/bal-dropdown.js +1 -709
- package/components/bal-dropdown2.js +711 -0
- package/components/bal-field.js +1 -1
- package/components/bal-footer.js +19 -36
- package/components/bal-input-stepper.js +1 -1
- package/components/bal-number-input.js +1 -1
- package/components/bal-option.js +1 -166
- package/components/bal-option2.js +168 -0
- package/components/bal-segment-item.js +1 -3
- package/components/bal-segment.js +1 -1
- package/components/bal-select2.js +1 -1
- package/components/index.esm.js +1 -1
- package/components/index.js +5 -289
- package/components/initialize.js +288 -0
- package/components/tokens.esm.js +1 -1
- package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
- package/dist/baloise-design-system/baloise-design-system.js +1 -1
- package/dist/baloise-design-system/index.esm.js +1 -1
- package/dist/baloise-design-system/{p-d9f2d48be1.entry.js → p-05df4589a6.entry.js} +1 -1
- package/dist/baloise-design-system/p-0f611b4158.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-342b27632b.entry.js → p-0f6c55dd97.entry.js} +1 -1
- package/dist/baloise-design-system/p-1509eaa7.system.js +1 -1
- package/dist/baloise-design-system/{p-dd162dc12e.system.entry.js → p-16e0c612c1.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-80e59744a7.entry.js → p-1bd2e43ed9.entry.js} +1 -1
- package/dist/baloise-design-system/p-225ea08656.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-cfa901cb.js → p-32531da1.js} +1 -1
- package/dist/baloise-design-system/{p-52a4a89073.system.entry.js → p-34493aa437.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-360068a4.system.js +1 -0
- package/dist/baloise-design-system/p-38f543aaa8.entry.js +1 -0
- package/dist/baloise-design-system/{p-910b2f3d.system.js → p-3b3e9fa8.system.js} +1 -1
- package/dist/baloise-design-system/{p-27bc71c322.entry.js → p-3d3ac15c5b.entry.js} +1 -1
- package/dist/baloise-design-system/{p-784c10d48f.entry.js → p-44e40d000f.entry.js} +1 -1
- package/dist/baloise-design-system/{p-d94b2cb869.system.entry.js → p-4f639ef662.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-4f91de6871.entry.js +1 -0
- package/dist/baloise-design-system/p-4ff656dd48.entry.js +1 -0
- package/dist/baloise-design-system/{p-e227dcfaa1.system.entry.js → p-505dc90f68.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-449ffc7a7e.entry.js → p-50b18f1f90.entry.js} +1 -1
- package/dist/baloise-design-system/p-54f81c32.js +1 -1
- package/dist/baloise-design-system/{p-5de0bd8a.system.js → p-5990a992.system.js} +1 -1
- package/dist/baloise-design-system/{p-e829652c7a.entry.js → p-6afb90223a.entry.js} +1 -1
- package/dist/baloise-design-system/p-6d1b6215.js +1 -0
- package/dist/baloise-design-system/p-7291766c.system.js +1 -0
- package/dist/baloise-design-system/{p-3180888825.entry.js → p-72e4f20eb4.entry.js} +1 -1
- package/dist/baloise-design-system/{p-a7de2305e0.system.entry.js → p-7766f3e780.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c716d30de1.entry.js → p-776e4004f9.entry.js} +1 -1
- package/dist/baloise-design-system/p-7cc52e4a3b.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-fcfee1c692.entry.js → p-7e6e159fbb.entry.js} +1 -1
- package/dist/baloise-design-system/{p-16b50b08e4.entry.js → p-8152631cd8.entry.js} +1 -1
- package/dist/baloise-design-system/p-8da6d9dae1.entry.js +1 -0
- package/dist/baloise-design-system/{p-2e8508812d.system.entry.js → p-950dd794aa.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-b4941441f4.system.entry.js → p-98d3d67ed8.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-60a6af04.system.js → p-9f8b1248.system.js} +1 -1
- package/dist/baloise-design-system/{p-e2316d2aea.system.entry.js → p-aac27c3f5c.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-d8a71bc5b4.system.entry.js → p-b15e29ca82.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-590da25b.system.js → p-b340ac70.system.js} +1 -1
- package/dist/baloise-design-system/{p-f3bb565972.system.entry.js → p-cbcca7bc3e.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-34671b9410.entry.js → p-d566c1add8.entry.js} +1 -1
- package/dist/baloise-design-system/{p-e45eb6121d.system.entry.js → p-e088800e47.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-15a85377.js → p-e1d10947.js} +1 -1
- package/dist/baloise-design-system/{p-e8cab53413.entry.js → p-e6f7cb12b7.entry.js} +1 -1
- package/dist/baloise-design-system/p-e8790128.js +1 -0
- package/dist/baloise-design-system/p-e8ffddeb.js +1 -0
- package/dist/baloise-design-system/{p-aed4d3ac0f.system.entry.js → p-ea17bcb3a8.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-013b4c72.system.js → p-f959646a.system.js} +1 -1
- package/dist/baloise-design-system/{p-8613444e15.system.entry.js → p-f9bc485442.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-efe5a8806d.system.entry.js → p-ffc744527c.system.entry.js} +1 -1
- package/dist/cjs/app-globals-5fd73c0c.js +7 -0
- package/dist/cjs/bal-carousel_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-datepicker.cjs.entry.js +3 -3
- package/dist/cjs/bal-doc-app.cjs.entry.js +231 -0
- package/dist/cjs/bal-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/bal-field_5.cjs.entry.js +1 -1
- package/dist/cjs/bal-footer.cjs.entry.js +5 -4
- package/dist/cjs/bal-hint_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-list_8.cjs.entry.js +3 -3
- package/dist/cjs/bal-logo.cjs.entry.js +3 -3
- package/dist/cjs/bal-nav_8.cjs.entry.js +3 -3
- package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-pagination.cjs.entry.js +3 -3
- package/dist/cjs/bal-progress-bar.cjs.entry.js +4 -4
- package/dist/cjs/bal-segment_2.cjs.entry.js +6 -8
- package/dist/cjs/bal-shape.cjs.entry.js +1 -1
- package/dist/cjs/bal-steps.cjs.entry.js +3 -3
- package/dist/cjs/bal-tab-item_2.cjs.entry.js +3 -3
- package/dist/cjs/baloise-design-system.cjs.js +3 -2
- package/dist/cjs/{breakpoints.decorator-f4da1834.js → breakpoints.decorator-cee101fb.js} +1 -1
- package/dist/cjs/{breakpoints.subject-6fc372a8.js → breakpoints.subject-4f2efa09.js} +1 -1
- package/dist/cjs/{app-globals-ae3a8623.js → global-2562a984.js} +2 -4
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/initialize-2a19d091.js +1 -1
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/{tokens.esm-cd3fab6c.js → tokens.esm-2502ec3b.js} +1 -1
- package/dist/cjs/{window-resize.decorator-67e1f4de.js → window-resize.decorator-9991dc3b.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/bal-dropdown/bal-dropdown.css +1 -1
- package/dist/collection/components/bal-field/bal-field.js +1 -1
- package/dist/collection/components/bal-footer/bal-footer.css +1 -1
- package/dist/collection/components/bal-footer/bal-footer.js +3 -2
- package/dist/collection/components/bal-segment/bal-segment-item/bal-segment-item.js +1 -3
- package/dist/collection/components/bal-segment/bal-segment.js +4 -4
- package/dist/collection/components/docs/bal-doc-app/bal-doc-app.css +1 -0
- package/dist/collection/components/docs/bal-doc-app/bal-doc-app.js +229 -0
- package/dist/collection/utils/constants/version.constant.js +1 -1
- package/dist/esm/app-globals-970bab17.js +5 -0
- package/dist/esm/bal-carousel_2.entry.js +3 -3
- package/dist/esm/bal-datepicker.entry.js +3 -3
- package/dist/esm/bal-doc-app.entry.js +227 -0
- package/dist/esm/bal-dropdown.entry.js +1 -1
- package/dist/esm/bal-field_5.entry.js +1 -1
- package/dist/esm/bal-footer.entry.js +5 -4
- package/dist/esm/bal-hint_5.entry.js +3 -3
- package/dist/esm/bal-list_8.entry.js +3 -3
- package/dist/esm/bal-logo.entry.js +3 -3
- package/dist/esm/bal-nav_8.entry.js +3 -3
- package/dist/esm/bal-navbar_5.entry.js +3 -3
- package/dist/esm/bal-pagination.entry.js +3 -3
- package/dist/esm/bal-progress-bar.entry.js +4 -4
- package/dist/esm/bal-segment_2.entry.js +6 -8
- package/dist/esm/bal-shape.entry.js +1 -1
- package/dist/esm/bal-steps.entry.js +3 -3
- package/dist/esm/bal-tab-item_2.entry.js +3 -3
- package/dist/esm/baloise-design-system.js +3 -2
- package/dist/esm/{breakpoints.decorator-8a50482f.js → breakpoints.decorator-ab0e21e6.js} +1 -1
- package/dist/esm/{breakpoints.subject-e3538fe7.js → breakpoints.subject-0b9fb9a8.js} +1 -1
- package/dist/esm/{app-globals-b0dd0fc4.js → global-63f4bcec.js} +2 -4
- package/dist/esm/index.js +3 -3
- package/dist/esm/initialize-e216cfe4.js +1 -1
- package/dist/esm/loader.js +3 -2
- package/dist/esm/{tokens.esm-7cf87670.js → tokens.esm-acb6614c.js} +1 -1
- package/dist/esm/{window-resize.decorator-9c08027e.js → window-resize.decorator-6e97dd50.js} +1 -1
- package/dist/esm-es5/app-globals-970bab17.js +1 -0
- package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
- package/dist/esm-es5/bal-datepicker.entry.js +1 -1
- package/dist/esm-es5/bal-doc-app.entry.js +1 -0
- package/dist/esm-es5/bal-dropdown.entry.js +1 -1
- package/dist/esm-es5/bal-field_5.entry.js +1 -1
- package/dist/esm-es5/bal-footer.entry.js +1 -1
- package/dist/esm-es5/bal-hint_5.entry.js +1 -1
- package/dist/esm-es5/bal-list_8.entry.js +1 -1
- package/dist/esm-es5/bal-logo.entry.js +1 -1
- package/dist/esm-es5/bal-nav_8.entry.js +1 -1
- package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
- package/dist/esm-es5/bal-pagination.entry.js +1 -1
- package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
- package/dist/esm-es5/bal-segment_2.entry.js +1 -1
- package/dist/esm-es5/bal-shape.entry.js +1 -1
- package/dist/esm-es5/bal-steps.entry.js +1 -1
- package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
- package/dist/esm-es5/baloise-design-system.js +1 -1
- package/dist/esm-es5/breakpoints.decorator-ab0e21e6.js +1 -0
- package/dist/esm-es5/{breakpoints.subject-e3538fe7.js → breakpoints.subject-0b9fb9a8.js} +1 -1
- package/dist/esm-es5/global-63f4bcec.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/initialize-e216cfe4.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{window-resize.decorator-9c08027e.js → window-resize.decorator-6e97dd50.js} +1 -1
- package/dist/types/components/bal-segment/bal-segment.interfaces.d.ts +1 -1
- package/dist/types/components/docs/bal-doc-app/bal-doc-app.d.ts +21 -0
- package/dist/types/components.d.ts +37 -0
- package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/icons/src/index.d.ts +81 -0
- package/package.json +7 -7
- package/dist/baloise-design-system/p-08b0e345a2.entry.js +0 -1
- package/dist/baloise-design-system/p-0db6b19e.js +0 -1
- package/dist/baloise-design-system/p-2e498736fc.system.entry.js +0 -1
- package/dist/baloise-design-system/p-b60576a064.entry.js +0 -1
- package/dist/baloise-design-system/p-bcca1ed3.system.js +0 -1
- package/dist/baloise-design-system/p-c00e0f64c8.entry.js +0 -1
- package/dist/baloise-design-system/p-e78a6409.js +0 -1
- package/dist/baloise-design-system/p-ec044ce124.system.entry.js +0 -1
- package/dist/esm-es5/app-globals-b0dd0fc4.js +0 -1
- package/dist/esm-es5/breakpoints.decorator-8a50482f.js +0 -1
- /package/dist/baloise-design-system/{p-9ffefe27.system.js → p-7efaa892.system.js} +0 -0
- /package/dist/baloise-design-system/{p-46bed129.js → p-fa011150.js} +0 -0
- /package/dist/esm-es5/{tokens.esm-7cf87670.js → tokens.esm-acb6614c.js} +0 -0
|
@@ -1,712 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as __decorate, a as __metadata } from './tslib.es6.js';
|
|
3
|
-
import { b as areArraysEqual, o as isArrowDownKey, q as isArrowUpKey, i as isEnterKey, s as isEscapeKey, a as isSpaceKey } from './index.esm.js';
|
|
4
|
-
import { B as BEM } from './bem.js';
|
|
5
|
-
import { L as Logger } from './log.js';
|
|
6
|
-
import { s as stopEventBubbling } from './form-input.js';
|
|
7
|
-
import { i as inheritAttributes } from './attributes.js';
|
|
8
|
-
import { d as defaultBalAriaForm } from './form.js';
|
|
9
|
-
import { k as rIC, b as waitAfterFramePaint, d as waitAfterIdleCallback } from './helpers.js';
|
|
10
|
-
import { l as lodash_isnil } from './index2.js';
|
|
11
|
-
import { c as computePosition, a as autoUpdate, f as flip, s as shift } from './floating-ui.dom.esm.js';
|
|
12
|
-
import { D as DropdownOptionUtil } from './option.js';
|
|
13
|
-
import { a as ariaBooleanToString } from './aria.js';
|
|
14
|
-
import { d as defaultConfig } from './config.default.js';
|
|
15
|
-
import { L as ListenToConfig } from './config.decorator.js';
|
|
16
|
-
|
|
17
|
-
class DropdownAutoFillUtil {
|
|
18
|
-
constructor() {
|
|
19
|
-
this.handleAutoFill = async (ev) => {
|
|
20
|
-
stopEventBubbling(ev);
|
|
21
|
-
if (this.isAutoFillAllowed()) {
|
|
22
|
-
this.component.isAutoFilled = true;
|
|
23
|
-
const autoFillValue = this.component.nativeEl.value;
|
|
24
|
-
const newValue = await this.parseAutoFillValueWithOptions(autoFillValue);
|
|
25
|
-
if (newValue === undefined) {
|
|
26
|
-
this.component.isAutoFilled = false;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!areArraysEqual(newValue, this.component.rawValue)) {
|
|
30
|
-
this.component.valueUtil.updateRawValueBySelection(newValue, true);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
connectedCallback(component) {
|
|
36
|
-
this.component = component;
|
|
37
|
-
}
|
|
38
|
-
isAutoFillAllowed() {
|
|
39
|
-
return !this.component.multiple;
|
|
40
|
-
}
|
|
41
|
-
async parseAutoFillValueWithOptions(autoFillValue) {
|
|
42
|
-
const options = await this.component.listEl.getOptions();
|
|
43
|
-
const value = undefined;
|
|
44
|
-
for (let index = 0; index < options.length; index++) {
|
|
45
|
-
const option = options[index];
|
|
46
|
-
if (option.value === autoFillValue || option.label === autoFillValue) {
|
|
47
|
-
return [option.value];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const i18nBalDropdown = {
|
|
55
|
-
de: {
|
|
56
|
-
clearable: 'Löschen',
|
|
57
|
-
open: 'Öffnen',
|
|
58
|
-
close: 'Schließen',
|
|
59
|
-
},
|
|
60
|
-
en: {
|
|
61
|
-
clearable: 'clear',
|
|
62
|
-
open: 'Open',
|
|
63
|
-
close: 'Close',
|
|
64
|
-
},
|
|
65
|
-
fr: {
|
|
66
|
-
clearable: 'Effacer',
|
|
67
|
-
open: 'Ouvrir',
|
|
68
|
-
close: 'Fermer',
|
|
69
|
-
},
|
|
70
|
-
it: {
|
|
71
|
-
clearable: 'Cancellare',
|
|
72
|
-
open: 'Apri',
|
|
73
|
-
close: 'Chiudi',
|
|
74
|
-
},
|
|
75
|
-
nl: {
|
|
76
|
-
clearable: 'Wissen',
|
|
77
|
-
open: 'Open',
|
|
78
|
-
close: 'Sluiten',
|
|
79
|
-
},
|
|
80
|
-
es: {
|
|
81
|
-
clearable: 'Limpiar',
|
|
82
|
-
open: 'Abrir',
|
|
83
|
-
close: 'Cerrar',
|
|
84
|
-
},
|
|
85
|
-
pl: {
|
|
86
|
-
clearable: 'Wyczyść',
|
|
87
|
-
open: 'Otwórz',
|
|
88
|
-
close: 'Zamknij',
|
|
89
|
-
},
|
|
90
|
-
pt: {
|
|
91
|
-
clearable: 'Limpar',
|
|
92
|
-
open: 'Abrir',
|
|
93
|
-
close: 'Fechar',
|
|
94
|
-
},
|
|
95
|
-
sv: {
|
|
96
|
-
clearable: 'Rensa',
|
|
97
|
-
open: 'Öppna',
|
|
98
|
-
close: 'Stäng',
|
|
99
|
-
},
|
|
100
|
-
fi: {
|
|
101
|
-
clearable: 'Tyhjennä',
|
|
102
|
-
open: 'Avaa',
|
|
103
|
-
close: 'Sulje',
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
class DropdownEventsUtil {
|
|
108
|
-
connectedCallback(component) {
|
|
109
|
-
this.component = component;
|
|
110
|
-
}
|
|
111
|
-
handleFocus(ev) {
|
|
112
|
-
this.component.hasFocus = true;
|
|
113
|
-
this.component.balFocus.emit(ev);
|
|
114
|
-
}
|
|
115
|
-
handleBlur(ev) {
|
|
116
|
-
if (!this.component.isExpanded) {
|
|
117
|
-
this.component.hasFocus = false;
|
|
118
|
-
rIC(() => this.component.balBlur.emit(ev));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
handleClick(ev) {
|
|
122
|
-
if (!this.component.valueUtil.isDisabled()) {
|
|
123
|
-
if (this.component.chips) {
|
|
124
|
-
const targetEl = ev.target;
|
|
125
|
-
const closeEl = targetEl.closest('bal-close');
|
|
126
|
-
if (closeEl) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (this.component.clearable) {
|
|
131
|
-
const targetEl = ev.target;
|
|
132
|
-
const clearEl = targetEl.closest('.bal-dropdown__clear');
|
|
133
|
-
if (clearEl) {
|
|
134
|
-
this.component.valueUtil.updateRawValueBySelection([]);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
this.component.popupUtil.toggleList();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// @Listen('click', { target: 'document' })
|
|
142
|
-
handleOutsideClick(ev) {
|
|
143
|
-
var _a;
|
|
144
|
-
if (this.component.isExpanded) {
|
|
145
|
-
if (!this.component.el.contains(ev.target)) {
|
|
146
|
-
this.component.isExpanded = false;
|
|
147
|
-
(_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.resetFocus();
|
|
148
|
-
this.component.hasFocus = false;
|
|
149
|
-
rIC(() => this.component.balBlur.emit(ev));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
class DropdownFocusUtil {
|
|
156
|
-
connectedCallback(component) {
|
|
157
|
-
this.component = component;
|
|
158
|
-
}
|
|
159
|
-
focusOptionByLabel(key, options = {}) {
|
|
160
|
-
this.component.labelToFocus = (this.component.labelToFocus + key).trim();
|
|
161
|
-
if (this.component.labelToFocus.length > 0) {
|
|
162
|
-
clearTimeout(this.keyHitTimeout);
|
|
163
|
-
this.keyHitTimeout = setTimeout(() => {
|
|
164
|
-
var _a;
|
|
165
|
-
(_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.focusByLabel(this.component.labelToFocus, options);
|
|
166
|
-
}, 100);
|
|
167
|
-
clearTimeout(this.timeout);
|
|
168
|
-
this.timeout = setTimeout(async () => {
|
|
169
|
-
this.component.labelToFocus = '';
|
|
170
|
-
}, 1000);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
class DropdownFormSubmitUtil {
|
|
176
|
-
connectedCallback(component) {
|
|
177
|
-
this.component = component;
|
|
178
|
-
this.component.initialValue = this.component.value;
|
|
179
|
-
}
|
|
180
|
-
componentDidRender() {
|
|
181
|
-
if (this.component.selectEl) {
|
|
182
|
-
const options = this.component.selectEl.querySelectorAll('option');
|
|
183
|
-
options.forEach(option => {
|
|
184
|
-
if (this.component.rawValue.includes(option.value)) {
|
|
185
|
-
option.selected = true;
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
// @Listen('reset', { capture: true, target: 'document' })
|
|
191
|
-
handle(ev) {
|
|
192
|
-
const formElement = ev.target;
|
|
193
|
-
if (formElement === null || formElement === void 0 ? void 0 : formElement.contains(this.component.el)) {
|
|
194
|
-
if (this.resetHandlerTimer) {
|
|
195
|
-
clearTimeout(this.resetHandlerTimer);
|
|
196
|
-
}
|
|
197
|
-
this.resetHandlerTimer = setTimeout(() => {
|
|
198
|
-
const newRawValue = this.component.valueUtil.parseValueString(this.component.initialValue);
|
|
199
|
-
this.component.valueUtil.updateRawValueBySelection(newRawValue);
|
|
200
|
-
}, 0);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
const DropdownNativeSelect = ({ name, httpFormSubmit, multiple, required, disabled, rawValue, refSelectEl, }) => {
|
|
205
|
-
const block = BEM.block('dropdown');
|
|
206
|
-
return httpFormSubmit ? (h("select", { class: Object.assign({}, block.element('root').element('select').class()), "aria-hidden": "true", name: name, multiple: multiple, required: required, disabled: disabled, tabindex: -1, ref: refSelectEl }, rawValue.map((value) => (h("option", { key: value, value: value, selected: true }, value))))) : ('');
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const DropdownIcon = ({ icon, language, loading, clearable, invalid, filled, expanded, disabled, }) => {
|
|
210
|
-
const block = BEM.block('dropdown');
|
|
211
|
-
if (loading) {
|
|
212
|
-
return h("bal-spinner", { class: Object.assign({}, block.element('rear').class()), small: true, variation: "circle" });
|
|
213
|
-
}
|
|
214
|
-
else if (clearable && filled && !disabled) {
|
|
215
|
-
return (h("button", { title: i18nBalDropdown[language].clearable, class: Object.assign(Object.assign(Object.assign({}, block.element('rear').class()), block.element('clear').class()), block.element('clear').modifier('invalid').class(invalid)) },
|
|
216
|
-
h("bal-icon", { class: Object.assign({}, block.element('rear').class()), name: 'close-circle', size: "", color: 'grey' })));
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
return (h("bal-icon", { class: Object.assign({}, block.element('rear').class()), name: icon, turn: expanded, color: disabled ? 'grey' : invalid ? 'danger' : 'primary' }));
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const DropdownOptionList = ({ inputId, isExpanded, rawOptions, isDisabled, hasPropOptions, required, filter, multiple, contentHeight, refPanelEl, refListEl, }) => {
|
|
224
|
-
const block = BEM.block('dropdown');
|
|
225
|
-
return (h("div", { id: `${inputId}-menu`, class: Object.assign(Object.assign({}, block.element('list').class()), block.element('list').modifier('expanded').class(isExpanded)), ref: refPanelEl },
|
|
226
|
-
h("bal-option-list", { multiple: multiple, disabled: isDisabled, filter: filter, required: required, contentHeight: contentHeight, ref: refListEl },
|
|
227
|
-
h("slot", null),
|
|
228
|
-
hasPropOptions
|
|
229
|
-
? rawOptions.map(option => (h("bal-option", { key: option.value, value: option.value, label: option.label, disabled: option.disabled, multiline: option.multiline, invalid: option.invalid, hidden: option.hidden, selected: option.selected, focused: option.focused }, option.label)))
|
|
230
|
-
: '')));
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
class DropdownPopupUtil {
|
|
234
|
-
constructor() {
|
|
235
|
-
this.updatePanelPosition = (referenceEl, floatingEl) => () => {
|
|
236
|
-
computePosition(referenceEl, floatingEl, {
|
|
237
|
-
placement: 'bottom-start',
|
|
238
|
-
middleware: [flip(), shift()],
|
|
239
|
-
}).then(({ x, y }) => {
|
|
240
|
-
Object.assign(floatingEl.style, {
|
|
241
|
-
left: `${x}px`,
|
|
242
|
-
top: `${y}px`,
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
connectedCallback(component) {
|
|
248
|
-
this.component = component;
|
|
249
|
-
}
|
|
250
|
-
toggleList() {
|
|
251
|
-
if (!this.component.valueUtil.isDisabled()) {
|
|
252
|
-
if (this.component.isExpanded) {
|
|
253
|
-
this.collapseList();
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
this.expandList();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
async expandList() {
|
|
261
|
-
var _a;
|
|
262
|
-
if (this.component.panelEl) {
|
|
263
|
-
this.component.panelCleanup = autoUpdate(this.component.el, this.component.panelEl, this.updatePanelPosition(this.component.el, this.component.panelEl));
|
|
264
|
-
}
|
|
265
|
-
this.component.isExpanded = true;
|
|
266
|
-
await ((_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.focusSelected());
|
|
267
|
-
}
|
|
268
|
-
collapseList() {
|
|
269
|
-
var _a;
|
|
270
|
-
this.component.isExpanded = false;
|
|
271
|
-
(_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.resetFocus();
|
|
272
|
-
if (this.component.panelCleanup) {
|
|
273
|
-
this.component.panelCleanup();
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
class DropdownValueUtil {
|
|
279
|
-
connectedCallback(component) {
|
|
280
|
-
this.component = component;
|
|
281
|
-
}
|
|
282
|
-
componentDidLoad() {
|
|
283
|
-
setTimeout(() => this.valueChanged(this.component.value, undefined), 0);
|
|
284
|
-
}
|
|
285
|
-
isDisabled() {
|
|
286
|
-
return this.component.disabled || this.component.readonly;
|
|
287
|
-
}
|
|
288
|
-
isFilled() {
|
|
289
|
-
return this.component.rawValue && this.component.rawValue.length > 0;
|
|
290
|
-
}
|
|
291
|
-
valueChanged(newValue, oldValue) {
|
|
292
|
-
const newValueType = typeof newValue;
|
|
293
|
-
const oldValueType = typeof oldValue;
|
|
294
|
-
if (newValueType !== oldValueType) {
|
|
295
|
-
this.updateRawValueByValueProp(newValue);
|
|
296
|
-
}
|
|
297
|
-
if (newValueType === 'string' && newValue !== oldValue) {
|
|
298
|
-
this.updateRawValueByValueProp(newValue);
|
|
299
|
-
}
|
|
300
|
-
if (Array.isArray(newValue) && Array.isArray(oldValue) && !areArraysEqual(newValue, oldValue)) {
|
|
301
|
-
this.updateRawValueByValueProp(newValue);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
updateRawValueBySelection(newRawValue = [], isAutoFilled = false) {
|
|
305
|
-
this.component.isAutoFilled = isAutoFilled;
|
|
306
|
-
this.updateRawValue(newRawValue);
|
|
307
|
-
if (this.component.multiple) {
|
|
308
|
-
this.component.balChange.emit(this.component.rawValue);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
this.component.balChange.emit(this.component.rawValue[0]);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
parseValueString(newValue = []) {
|
|
315
|
-
let newRawValue = [];
|
|
316
|
-
if (!lodash_isnil(newValue) && newValue !== '') {
|
|
317
|
-
if (Array.isArray(newValue)) {
|
|
318
|
-
newRawValue = [...newValue.filter(v => !lodash_isnil(v))];
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
if (newValue.split('').includes(',')) {
|
|
322
|
-
newRawValue = [
|
|
323
|
-
...newValue
|
|
324
|
-
.split(',')
|
|
325
|
-
.filter(v => v)
|
|
326
|
-
.map(v => v.trim()),
|
|
327
|
-
];
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
newRawValue = [newValue];
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return newRawValue;
|
|
335
|
-
}
|
|
336
|
-
updateRawValueByValueProp(newValue = []) {
|
|
337
|
-
const newRawValue = this.parseValueString(newValue);
|
|
338
|
-
this.updateRawValue(newRawValue);
|
|
339
|
-
}
|
|
340
|
-
async updateRawValue(newRawValue = []) {
|
|
341
|
-
this.component.rawValue = newRawValue;
|
|
342
|
-
if (this.component.listEl) {
|
|
343
|
-
await this.component.listEl.updateSelected(this.component.rawValue);
|
|
344
|
-
}
|
|
345
|
-
await this.updateInputContent();
|
|
346
|
-
}
|
|
347
|
-
removeOption(option) {
|
|
348
|
-
const newRawValue = this.component.rawValue.filter(value => value !== option.value);
|
|
349
|
-
this.updateRawValueBySelection(newRawValue);
|
|
350
|
-
}
|
|
351
|
-
async updateInputContent() {
|
|
352
|
-
await waitAfterFramePaint();
|
|
353
|
-
if (this.component.listEl) {
|
|
354
|
-
this.component.choices = await this.component.listEl.getSelectedOptions(this.component.rawValue);
|
|
355
|
-
this.component.inputLabel = this.component.choices
|
|
356
|
-
.map(option => option.label.trim())
|
|
357
|
-
.sort()
|
|
358
|
-
.join(',');
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
const DropdownValue = ({ filled, chips, placeholder, choices, invalid, disabled, readonly, onRemoveChip, }) => {
|
|
363
|
-
const block = BEM.block('dropdown');
|
|
364
|
-
if (filled) {
|
|
365
|
-
if (chips) {
|
|
366
|
-
return (h("div", { class: Object.assign({}, block.element('root').element('content').element('chips').class()) }, choices.map(option => (h("bal-tag", { key: option.value, "data-test": "bal-dropdown-chip", size: "small", invalid: invalid, disabled: disabled || readonly, closable: !(disabled || readonly), onBalCloseClick: () => onRemoveChip(option) }, option.label)))));
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
return choices.map(option => option.label).join(', ');
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
return placeholder;
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
const DropdownInput = ({ name, inputId, httpFormSubmit, ariaForm, rawValue, autocomplete, required, disabled, readonly, placeholder, expanded, invalid, language, inputLabel, inheritedAttributes, refInputEl, onChange, onFocus, onBlur, onKeyDown, }) => {
|
|
378
|
-
const block = BEM.block('dropdown');
|
|
379
|
-
const Input = () => (h("input", Object.assign({ id: ariaForm.controlId || `${inputId}-ctrl`, class: Object.assign({}, block.element('root').element('input').class()), type: "text", size: 1, inputmode: "none", tabindex: "0", name: name, autoComplete: autocomplete, value: rawValue.join(','), required: required, disabled: disabled, readonly: readonly, placeholder: placeholder, title: expanded ? i18nBalDropdown[language].close : i18nBalDropdown[language].open, "aria-label": expanded ? i18nBalDropdown[language].close : i18nBalDropdown[language].open, "aria-owns": `${inputId}-menu`, "aria-invalid": ariaBooleanToString(invalid), "aria-disabled": ariaBooleanToString(disabled || readonly), "aria-labelledby": ariaForm.labelId, "aria-describedby": ariaForm.messageId, "aria-haspopup": 'listbox', "data-native": true, "data-label": inputLabel, "data-value": rawValue.join(','), ref: el => refInputEl(el), onChange: ev => onChange(ev), onFocus: ev => onFocus(ev), onBlur: ev => onBlur(ev), onKeyDown: ev => onKeyDown(ev) }, inheritedAttributes)));
|
|
380
|
-
if (httpFormSubmit) {
|
|
381
|
-
return h(Input, null);
|
|
382
|
-
}
|
|
383
|
-
return (h("form", { novalidate: true },
|
|
384
|
-
h(Input, null)));
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
const balDropdownCss = ":root{--bal-dropdown-control-background:var(--bal-color-white);--bal-dropdown-control-background-hover:var(--bal-form-field-control-background-hover);--bal-dropdown-control-background-invalid:var(--bal-form-field-control-danger-background);--bal-dropdown-control-background-disabled:var(--bal-form-field-control-disabled-background);--bal-dropdown-control-input-background:var(--bal-color-grey-1);--bal-dropdown-control-native-input-background:transparent;--bal-dropdown-control-native-input-background-hover:transparent;--bal-dropdown-control-input-inverted-footer-background:transparent;--bal-dropdown-control-input-inverted-footer-background-hover:transparent;--bal-dropdown-control-input-multiple-background:transparent;--bal-dropdown-control-input-multiple-background-read-only-selection:transparent;--bal-dropdown-control-input-option-background:transparent;--bal-dropdown-control-input-option-background-selected:var(--bal-color-primary-1);--bal-dropdown-control-input-option-background-focused:var(--bal-color-grey-2);--bal-dropdown-control-input-option-background-hover:var(--bal-color-grey-2);--bal-dropdown-control-border-radius:var(--bal-form-field-control-radius);--bal-dropdown-popover-border-color:var(--bal-color-grey-2);--bal-dropdown-control-border-color:var(--bal-form-field-control-border-color);--bal-dropdown-control-border-color-focused:var(--bal-color-primary);--bal-dropdown-control-border-color-hover:var(--bal-form-field-control-border-color-hover);--bal-dropdown-control-border-color-invalid:var(--bal-form-field-control-danger-border-color);--bal-dropdown-control-border-color-disabled:var(--bal-form-field-control-disabled-border-color);--bal-dropdown-control-border-color-focus-within:var(--bal-color-primary);--bal-dropdown-option-border-top-color:var(--bal-color-grey-2);--bal-dropdown-popover-empty-text-color:var(--bal-form-field-control-color);--bal-dropdown-control-text-color:var(--bal-form-field-control-color);--bal-dropdown-control-text-color-focused:var(--bal-color-primary);--bal-dropdown-input-text-color-disabled:var(--bal-form-field-label-disabled-color);--bal-dropdown-control-inverted-footer-native-input-text-color:var(--bal-color-text-white);--bal-dropdown-option-content-label-text-color:var(--bal-form-field-control-color)}.bal-dropdown{display:block;position:relative;-ms-flex:1;flex:1}.bal-dropdown__root{border-width:.125rem;border-style:solid;border-color:var(--bal-dropdown-control-border-color);border-radius:var(--bal-dropdown-control-border-radius);background:var(--bal-dropdown-control-background);font-size:var(--bal-weight-regular);font-family:var(--bal-font-family-text);color:var(--bal-dropdown-control-text-color);outline:none;-webkit-box-shadow:var(--bal-shadow-none);box-shadow:var(--bal-shadow-none);padding-right:1rem;height:auto;min-height:3rem;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:-ms-flexbox;display:flex;width:100%;text-align:left;gap:.5rem;padding-left:calc(.75em - var(--bal-border-width-normal));padding-right:calc(.75em - var(--bal-border-width-normal));-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.bal-dropdown__root--autofill{background:#faffbd !important;background:light-dark(rgb(232, 240, 254), rgba(70, 90, 126, 0.4)) !important}.bal-dropdown__root>span{-ms-flex:1;flex:1;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bal-dropdown__root--focused{border-color:var(--bal-dropdown-control-border-color-focused)}.bal-dropdown__root--invalid{border-color:var(--bal-dropdown-control-border-color-invalid);background:var(--bal-dropdown-control-background-invalid)}.bal-dropdown__root--disabled{border-color:var(--bal-dropdown-control-border-color-disabled);background:var(--bal-dropdown-control-background-disabled)}.bal-dropdown__root__content--placeholder{color:var(--bal-form-field-control-placeholder-color)}.bal-dropdown__root__content--disabled{color:var(--bal-dropdown-input-text-color-disabled)}.bal-dropdown__root__content__chips{--bal-tag-size-small-font-size:var(--bal-text-size-normal);display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--bal-space-xx-small);padding-top:var(--bal-space-x-small);padding-bottom:var(--bal-space-x-small)}.bal-dropdown__root__content__chips>bal-tag{z-index:1}.bal-dropdown__root__input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:rgba(0,0,0,0);position:absolute;right:var(--bal-border-width-normal);left:var(--bal-border-width-normal);top:var(--bal-border-width-normal);bottom:var(--bal-border-width-normal);opacity:0;padding-left:calc(.75em - var(--bal-border-width-normal));padding-right:calc(.75em - var(--bal-border-width-normal));cursor:pointer}.bal-dropdown__root__input:disabled{cursor:default}.bal-dropdown__root__input:-webkit-autofill{opacity:1}.bal-dropdown__root__input:autofill{opacity:1}.bal-dropdown__root__input:-internal-autofill-selected{opacity:0}.bal-dropdown__root__select{position:absolute !important;left:0;top:0;margin:0;padding:0;opacity:0;outline:0;border:none;width:1px;height:1px;clip:rect(1px, 1px, 1px, 1px);overflow:hidden}.bal-dropdown__root--autofill .bal-dropdown__root__input{opacity:0}.bal-dropdown__list{display:block;visibility:hidden;opacity:0;min-width:100%;width:100%;position:absolute;top:0;left:0;will-change:left,top,opacity;background:var(--bal-color-white);border-radius:var(--bal-radius-normal);-webkit-box-shadow:var(--bal-shadow-normal);box-shadow:var(--bal-shadow-normal);z-index:var(--bal-z-index-popup)}.bal-dropdown__list--expanded{visibility:visible;opacity:1}.bal-dropdown__native{bottom:0;left:0;position:absolute;opacity:0;pointer-events:none;width:100%}.bal-dropdown__clear{background:rgba(0,0,0,0);border:none;padding:0;margin:0;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer}.bal-dropdown__rear{z-index:1}";
|
|
388
|
-
const BalDropdownStyle0 = balDropdownCss;
|
|
389
|
-
|
|
390
|
-
const Dropdown = /*@__PURE__*/ proxyCustomElement(class Dropdown extends HTMLElement {
|
|
391
|
-
constructor() {
|
|
392
|
-
super();
|
|
393
|
-
this.__registerHost();
|
|
394
|
-
this.balChange = createEvent(this, "balChange", 7);
|
|
395
|
-
this.balFocus = createEvent(this, "balFocus", 7);
|
|
396
|
-
this.balBlur = createEvent(this, "balBlur", 7);
|
|
397
|
-
this.inputId = `bal-dropdown-${balDropdownIds++}`;
|
|
398
|
-
this.inheritedAttributes = {};
|
|
399
|
-
this.initialValue = [];
|
|
400
|
-
this.nativeOptions = [];
|
|
401
|
-
this.valueUtil = new DropdownValueUtil();
|
|
402
|
-
this.eventsUtil = new DropdownEventsUtil();
|
|
403
|
-
this.popupUtil = new DropdownPopupUtil();
|
|
404
|
-
this.optionUtil = new DropdownOptionUtil();
|
|
405
|
-
this.formSubmitUtil = new DropdownFormSubmitUtil();
|
|
406
|
-
this.focusUtil = new DropdownFocusUtil();
|
|
407
|
-
this.autoFillUtil = new DropdownAutoFillUtil();
|
|
408
|
-
/**
|
|
409
|
-
* EVENT BINDING
|
|
410
|
-
* ------------------------------------------------------
|
|
411
|
-
*/
|
|
412
|
-
this.handleAutoFill = async (ev) => {
|
|
413
|
-
this.log('(handleAutoFill)', ev, this.nativeEl.value);
|
|
414
|
-
this.autoFillUtil.handleAutoFill(ev);
|
|
415
|
-
};
|
|
416
|
-
this.handleKeyDown = (ev) => {
|
|
417
|
-
var _a, _b, _c, _d, _e;
|
|
418
|
-
if (ev && ev.key) {
|
|
419
|
-
if (this.isExpanded) {
|
|
420
|
-
/**
|
|
421
|
-
* ⬇️ Arrow up key
|
|
422
|
-
*/
|
|
423
|
-
if (isArrowDownKey(ev)) {
|
|
424
|
-
stopEventBubbling(ev);
|
|
425
|
-
(_a = this.listEl) === null || _a === void 0 ? void 0 : _a.focusNext();
|
|
426
|
-
/**
|
|
427
|
-
* ⬆️ Arrow up key
|
|
428
|
-
*/
|
|
429
|
-
}
|
|
430
|
-
else if (isArrowUpKey(ev)) {
|
|
431
|
-
stopEventBubbling(ev);
|
|
432
|
-
(_b = this.listEl) === null || _b === void 0 ? void 0 : _b.focusPrevious();
|
|
433
|
-
/**
|
|
434
|
-
* Go to top of the list
|
|
435
|
-
*/
|
|
436
|
-
}
|
|
437
|
-
else if (ev.key === 'Home' || ev.key === 'PageUp') {
|
|
438
|
-
stopEventBubbling(ev);
|
|
439
|
-
(_c = this.listEl) === null || _c === void 0 ? void 0 : _c.focusFirst();
|
|
440
|
-
/**
|
|
441
|
-
* Go to bottom of the list
|
|
442
|
-
*/
|
|
443
|
-
}
|
|
444
|
-
else if (ev.key === 'End' || ev.key === 'PageDown') {
|
|
445
|
-
stopEventBubbling(ev);
|
|
446
|
-
(_d = this.listEl) === null || _d === void 0 ? void 0 : _d.focusLast();
|
|
447
|
-
/**
|
|
448
|
-
* Select focused option
|
|
449
|
-
*/
|
|
450
|
-
}
|
|
451
|
-
else if (isEnterKey(ev)) {
|
|
452
|
-
stopEventBubbling(ev);
|
|
453
|
-
(_e = this.listEl) === null || _e === void 0 ? void 0 : _e.selectByFocus();
|
|
454
|
-
/**
|
|
455
|
-
* Close list
|
|
456
|
-
*/
|
|
457
|
-
}
|
|
458
|
-
else if (ev.key === 'Tab' || isEscapeKey(ev)) {
|
|
459
|
-
this.popupUtil.collapseList();
|
|
460
|
-
/**
|
|
461
|
-
* Focus on label
|
|
462
|
-
*/
|
|
463
|
-
}
|
|
464
|
-
else if (ev.key.length === 1) {
|
|
465
|
-
this.focusUtil.focusOptionByLabel(ev.key);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
/**
|
|
470
|
-
* Open list
|
|
471
|
-
*/
|
|
472
|
-
if (isEnterKey(ev) || isSpaceKey(ev)) {
|
|
473
|
-
stopEventBubbling(ev);
|
|
474
|
-
this.popupUtil.expandList();
|
|
475
|
-
/**
|
|
476
|
-
* Focus on label
|
|
477
|
-
*/
|
|
478
|
-
}
|
|
479
|
-
else if (ev.key.length === 1) {
|
|
480
|
-
this.focusUtil.focusOptionByLabel(ev.key, { select: true });
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
// Close the popup on autofill
|
|
486
|
-
if (this.isExpanded) {
|
|
487
|
-
this.popupUtil.collapseList();
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
this.rawOptions = [];
|
|
492
|
-
this.choices = [];
|
|
493
|
-
this.rawValue = [];
|
|
494
|
-
this.hasFocus = false;
|
|
495
|
-
this.isExpanded = false;
|
|
496
|
-
this.isAutoFilled = false;
|
|
497
|
-
this.inputLabel = '';
|
|
498
|
-
this.ariaForm = defaultBalAriaForm;
|
|
499
|
-
this.language = defaultConfig.language;
|
|
500
|
-
this.region = defaultConfig.region;
|
|
501
|
-
this.httpFormSubmit = defaultConfig.httpFormSubmit;
|
|
502
|
-
this.labelToFocus = '';
|
|
503
|
-
this.autocomplete = 'off';
|
|
504
|
-
this.name = this.inputId;
|
|
505
|
-
this.placeholder = '';
|
|
506
|
-
this.icon = 'caret-down';
|
|
507
|
-
this.disabled = false;
|
|
508
|
-
this.readonly = false;
|
|
509
|
-
this.multiple = false;
|
|
510
|
-
this.chips = false;
|
|
511
|
-
this.clearable = false;
|
|
512
|
-
this.invalid = false;
|
|
513
|
-
this.required = false;
|
|
514
|
-
this.loading = false;
|
|
515
|
-
this.filter = 'includes';
|
|
516
|
-
this.contentHeight = 262;
|
|
517
|
-
this.inverted = false;
|
|
518
|
-
this.options = [];
|
|
519
|
-
this.value = [];
|
|
520
|
-
}
|
|
521
|
-
createLogger(log) {
|
|
522
|
-
this.log = log;
|
|
523
|
-
}
|
|
524
|
-
async optionChanged() {
|
|
525
|
-
this.optionUtil.optionChanged();
|
|
526
|
-
}
|
|
527
|
-
valueChanged(newValue, oldValue) {
|
|
528
|
-
this.valueUtil.valueChanged(newValue, oldValue);
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* LIFECYCLE
|
|
532
|
-
* ------------------------------------------------------
|
|
533
|
-
*/
|
|
534
|
-
connectedCallback() {
|
|
535
|
-
this.eventsUtil.connectedCallback(this);
|
|
536
|
-
this.valueUtil.connectedCallback(this);
|
|
537
|
-
this.popupUtil.connectedCallback(this);
|
|
538
|
-
this.optionUtil.connectedCallback(this);
|
|
539
|
-
this.formSubmitUtil.connectedCallback(this);
|
|
540
|
-
this.focusUtil.connectedCallback(this);
|
|
541
|
-
this.autoFillUtil.connectedCallback(this);
|
|
542
|
-
}
|
|
543
|
-
async componentWillRender() {
|
|
544
|
-
this.inheritedAttributes = inheritAttributes(this.el, ['tabindex']);
|
|
545
|
-
await this.optionUtil.componentWillRender();
|
|
546
|
-
}
|
|
547
|
-
componentDidRender() {
|
|
548
|
-
this.formSubmitUtil.componentDidRender();
|
|
549
|
-
}
|
|
550
|
-
componentDidLoad() {
|
|
551
|
-
this.valueUtil.componentDidLoad();
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* LISTENERS
|
|
555
|
-
* ------------------------------------------------------
|
|
556
|
-
*/
|
|
557
|
-
/**
|
|
558
|
-
* @internal define config for the component
|
|
559
|
-
*/
|
|
560
|
-
async configChanged(state) {
|
|
561
|
-
this.language = state.language;
|
|
562
|
-
this.region = state.region;
|
|
563
|
-
this.httpFormSubmit = state.httpFormSubmit;
|
|
564
|
-
}
|
|
565
|
-
async listenToOptionChange(ev) {
|
|
566
|
-
this.optionUtil.listenToOptionChange(ev);
|
|
567
|
-
}
|
|
568
|
-
listenOnClickOutside(ev) {
|
|
569
|
-
this.eventsUtil.handleOutsideClick(ev);
|
|
570
|
-
}
|
|
571
|
-
resetHandler(ev) {
|
|
572
|
-
this.formSubmitUtil.handle(ev);
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* PUBLIC METHODS
|
|
576
|
-
* ------------------------------------------------------
|
|
577
|
-
*/
|
|
578
|
-
/**
|
|
579
|
-
* Sets the focus on the input element
|
|
580
|
-
*/
|
|
581
|
-
async setFocus() {
|
|
582
|
-
if (this.nativeEl && !this.valueUtil.isDisabled()) {
|
|
583
|
-
await waitAfterIdleCallback();
|
|
584
|
-
this.nativeEl.focus();
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* Returns the value of the component
|
|
589
|
-
*/
|
|
590
|
-
async getValue() {
|
|
591
|
-
return this.rawValue;
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Sets the value to `[]`, the input value to ´''´ and the focus index to ´0´.
|
|
595
|
-
*/
|
|
596
|
-
async clear() {
|
|
597
|
-
this.valueUtil.updateRawValueBySelection([]);
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Opens the popup with option list
|
|
601
|
-
*/
|
|
602
|
-
async open() {
|
|
603
|
-
if (!this.valueUtil.isDisabled() && this.panelEl) {
|
|
604
|
-
await this.popupUtil.expandList();
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Closes the popup with option list
|
|
609
|
-
*/
|
|
610
|
-
async close() {
|
|
611
|
-
if (!this.valueUtil.isDisabled() && this.panelEl) {
|
|
612
|
-
await this.popupUtil.collapseList();
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Select option by passed value
|
|
617
|
-
*/
|
|
618
|
-
async select(newValue) {
|
|
619
|
-
const parsedNewValue = this.valueUtil.parseValueString(newValue);
|
|
620
|
-
this.valueUtil.updateRawValueBySelection(parsedNewValue);
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
* @internal
|
|
624
|
-
*/
|
|
625
|
-
async setAriaForm(ariaForm) {
|
|
626
|
-
this.ariaForm = Object.assign({}, ariaForm);
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* RENDER
|
|
630
|
-
* ------------------------------------------------------
|
|
631
|
-
*/
|
|
632
|
-
render() {
|
|
633
|
-
const block = BEM.block('dropdown');
|
|
634
|
-
return (h(Host, { class: Object.assign({}, block.class()), tabindex: "-1", id: `${this.inputId}` }, h("div", { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.element('root').class()), block.element('root').modifier('focused').class(this.hasFocus)), block.element('root').modifier('invalid').class(this.invalid)), block.element('root').modifier('disabled').class(this.valueUtil.isDisabled())), block.element('root').modifier('autofill').class(this.isAutoFilled)), "data-test": "bal-dropdown-trigger", onClick: ev => this.eventsUtil.handleClick(ev) }, h("span", { class: Object.assign(Object.assign(Object.assign({}, block.element('root').element('content').class()), block.element('root').element('content').modifier('disabled').class(this.valueUtil.isDisabled())), block.element('root').element('content').modifier('placeholder').class(!this.valueUtil.isFilled())) }, h(DropdownValue, { filled: this.valueUtil.isFilled(), chips: this.chips, placeholder: this.placeholder, choices: this.choices, invalid: this.invalid, disabled: this.disabled, readonly: this.readonly, onRemoveChip: option => this.valueUtil.removeOption(option) })), h(DropdownInput, { name: this.name, inputId: this.inputId, httpFormSubmit: this.httpFormSubmit, ariaForm: this.ariaForm, rawValue: this.rawValue, autocomplete: this.autocomplete, required: this.required, disabled: this.disabled, readonly: this.readonly, placeholder: this.placeholder, expanded: this.isExpanded, invalid: this.invalid, language: this.language, inputLabel: this.inputLabel, inheritedAttributes: this.inheritedAttributes, refInputEl: el => (this.nativeEl = el), onChange: ev => this.handleAutoFill(ev), onFocus: ev => this.eventsUtil.handleFocus(ev), onBlur: ev => this.eventsUtil.handleBlur(ev), onKeyDown: ev => this.handleKeyDown(ev) }), h(DropdownNativeSelect, { name: this.name, httpFormSubmit: this.httpFormSubmit, multiple: this.multiple, required: this.required, disabled: this.valueUtil.isDisabled(), rawValue: this.rawValue, refSelectEl: el => (this.selectEl = el) }), h(DropdownIcon, { icon: this.icon, language: this.language, loading: this.loading, clearable: this.clearable, invalid: this.invalid, expanded: this.isExpanded, filled: this.valueUtil.isFilled(), disabled: this.valueUtil.isDisabled() })), h(DropdownOptionList, { inputId: this.inputId, block: this.inputId, filter: this.filter, required: this.required, isExpanded: this.isExpanded, isDisabled: this.valueUtil.isDisabled(), hasPropOptions: this.optionUtil.hasPropOptions(), multiple: this.multiple, contentHeight: this.contentHeight, rawOptions: this.rawOptions, refPanelEl: el => (this.panelEl = el), refListEl: el => (this.listEl = el) }, h("slot", null))));
|
|
635
|
-
}
|
|
636
|
-
get el() { return this; }
|
|
637
|
-
static get watchers() { return {
|
|
638
|
-
"options": ["optionChanged"],
|
|
639
|
-
"value": ["valueChanged"]
|
|
640
|
-
}; }
|
|
641
|
-
static get style() { return BalDropdownStyle0; }
|
|
642
|
-
}, [4, "bal-dropdown", {
|
|
643
|
-
"autocomplete": [1],
|
|
644
|
-
"name": [1],
|
|
645
|
-
"placeholder": [1],
|
|
646
|
-
"icon": [1],
|
|
647
|
-
"disabled": [4],
|
|
648
|
-
"readonly": [4],
|
|
649
|
-
"multiple": [4],
|
|
650
|
-
"chips": [4],
|
|
651
|
-
"clearable": [4],
|
|
652
|
-
"invalid": [4],
|
|
653
|
-
"required": [4],
|
|
654
|
-
"loading": [4],
|
|
655
|
-
"filter": [1],
|
|
656
|
-
"contentHeight": [2, "content-height"],
|
|
657
|
-
"inverted": [4],
|
|
658
|
-
"options": [16],
|
|
659
|
-
"value": [1],
|
|
660
|
-
"rawOptions": [32],
|
|
661
|
-
"choices": [32],
|
|
662
|
-
"rawValue": [32],
|
|
663
|
-
"hasFocus": [32],
|
|
664
|
-
"isExpanded": [32],
|
|
665
|
-
"isAutoFilled": [32],
|
|
666
|
-
"inputLabel": [32],
|
|
667
|
-
"ariaForm": [32],
|
|
668
|
-
"language": [32],
|
|
669
|
-
"region": [32],
|
|
670
|
-
"httpFormSubmit": [32],
|
|
671
|
-
"labelToFocus": [32],
|
|
672
|
-
"configChanged": [64],
|
|
673
|
-
"setFocus": [64],
|
|
674
|
-
"getValue": [64],
|
|
675
|
-
"clear": [64],
|
|
676
|
-
"open": [64],
|
|
677
|
-
"close": [64],
|
|
678
|
-
"select": [64],
|
|
679
|
-
"setAriaForm": [64]
|
|
680
|
-
}, [[0, "balOptionChange", "listenToOptionChange"], [4, "click", "listenOnClickOutside"], [6, "reset", "resetHandler"]], {
|
|
681
|
-
"options": ["optionChanged"],
|
|
682
|
-
"value": ["valueChanged"]
|
|
683
|
-
}]);
|
|
684
|
-
__decorate([
|
|
685
|
-
Logger('bal-dropdown'),
|
|
686
|
-
__metadata("design:type", Function),
|
|
687
|
-
__metadata("design:paramtypes", [Function]),
|
|
688
|
-
__metadata("design:returntype", void 0)
|
|
689
|
-
], Dropdown.prototype, "createLogger", null);
|
|
690
|
-
__decorate([
|
|
691
|
-
ListenToConfig(),
|
|
692
|
-
__metadata("design:type", Function),
|
|
693
|
-
__metadata("design:paramtypes", [Object]),
|
|
694
|
-
__metadata("design:returntype", Promise)
|
|
695
|
-
], Dropdown.prototype, "configChanged", null);
|
|
696
|
-
let balDropdownIds = 0;
|
|
697
|
-
function defineCustomElement$1() {
|
|
698
|
-
if (typeof customElements === "undefined") {
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
const components = ["bal-dropdown"];
|
|
702
|
-
components.forEach(tagName => { switch (tagName) {
|
|
703
|
-
case "bal-dropdown":
|
|
704
|
-
if (!customElements.get(tagName)) {
|
|
705
|
-
customElements.define(tagName, Dropdown);
|
|
706
|
-
}
|
|
707
|
-
break;
|
|
708
|
-
} });
|
|
709
|
-
}
|
|
1
|
+
import { D as Dropdown, d as defineCustomElement$1 } from './bal-dropdown2.js';
|
|
710
2
|
|
|
711
3
|
const BalDropdown = Dropdown;
|
|
712
4
|
const defineCustomElement = defineCustomElement$1;
|