@db-ux/wc-core-components 4.0.4 → 4.2.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/CHANGELOG.md +26 -0
- package/dist/cjs/db-checkbox.cjs.entry.js +30 -4
- package/dist/cjs/db-checkbox.entry.cjs.js.map +1 -1
- package/dist/cjs/db-custom-select-dropdown.db-custom-select-list.db-custom-select-list-item.db-input.db-tag.entry.cjs.js.map +1 -1
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +32 -5
- package/dist/cjs/db-custom-select.cjs.entry.js +76 -47
- package/dist/cjs/db-custom-select.entry.cjs.js.map +1 -1
- package/dist/cjs/db-header.cjs.entry.js +2 -2
- package/dist/cjs/db-header.entry.cjs.js.map +1 -1
- package/dist/cjs/db-notification.cjs.entry.js +2 -2
- package/dist/cjs/db-notification.entry.cjs.js.map +1 -1
- package/dist/cjs/db-radio.cjs.entry.js +39 -4
- package/dist/cjs/db-radio.entry.cjs.js.map +1 -1
- package/dist/cjs/db-select.cjs.entry.js +32 -5
- package/dist/cjs/db-select.entry.cjs.js.map +1 -1
- package/dist/cjs/db-switch.cjs.entry.js +31 -4
- package/dist/cjs/db-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/db-textarea.cjs.entry.js +32 -5
- package/dist/cjs/db-textarea.entry.cjs.js.map +1 -1
- package/dist/cjs/db-ux.cjs.js +1 -1
- package/dist/cjs/form-components-CPqbzZwG.js +41 -0
- package/dist/cjs/form-components-CPqbzZwG.js.map +1 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +34 -4
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/custom-select/custom-select.js +108 -50
- package/dist/collection/components/custom-select/custom-select.js.map +1 -1
- package/dist/collection/components/custom-select/model.js.map +1 -1
- package/dist/collection/components/header/header.js +52 -2
- package/dist/collection/components/header/header.js.map +1 -1
- package/dist/collection/components/header/model.js.map +1 -1
- package/dist/collection/components/input/input.js +36 -5
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/notification/notification.js +12 -12
- package/dist/collection/components/notification/notification.js.map +1 -1
- package/dist/collection/components/radio/model.js.map +1 -1
- package/dist/collection/components/radio/radio.js +61 -5
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/select/select.js +36 -5
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/switch/switch.js +34 -4
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/textarea/textarea.js +36 -5
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/shared/model.js.map +1 -1
- package/dist/collection/utils/form-components.js +31 -0
- package/dist/collection/utils/form-components.js.map +1 -1
- package/dist/custom-elements.json +291 -28
- package/dist/db-ux/db-checkbox.entry.esm.js.map +1 -1
- package/dist/db-ux/db-custom-select-dropdown.db-custom-select-list.db-custom-select-list-item.db-input.db-tag.entry.esm.js.map +1 -1
- package/dist/db-ux/db-custom-select.entry.esm.js.map +1 -1
- package/dist/db-ux/db-header.entry.esm.js.map +1 -1
- package/dist/db-ux/db-notification.entry.esm.js.map +1 -1
- package/dist/db-ux/db-radio.entry.esm.js.map +1 -1
- package/dist/db-ux/db-select.entry.esm.js.map +1 -1
- package/dist/db-ux/db-switch.entry.esm.js.map +1 -1
- package/dist/db-ux/db-textarea.entry.esm.js.map +1 -1
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/index.esm.js.map +1 -1
- package/dist/db-ux/p-59f30e71.entry.js +2 -0
- package/dist/db-ux/p-59f30e71.entry.js.map +1 -0
- package/dist/db-ux/p-5cbbd49b.entry.js +2 -0
- package/dist/db-ux/p-5cbbd49b.entry.js.map +1 -0
- package/dist/db-ux/p-68b70ec5.entry.js +2 -0
- package/dist/db-ux/p-68b70ec5.entry.js.map +1 -0
- package/dist/db-ux/p-693724ef.entry.js +2 -0
- package/dist/db-ux/p-693724ef.entry.js.map +1 -0
- package/dist/db-ux/p-751434fa.entry.js +2 -0
- package/dist/db-ux/p-751434fa.entry.js.map +1 -0
- package/dist/db-ux/p-7f3a0030.entry.js +2 -0
- package/dist/db-ux/p-7f3a0030.entry.js.map +1 -0
- package/dist/db-ux/p-8f698fc9.entry.js +2 -0
- package/dist/db-ux/p-8f698fc9.entry.js.map +1 -0
- package/dist/db-ux/p-952cd568.entry.js +2 -0
- package/dist/db-ux/p-952cd568.entry.js.map +1 -0
- package/dist/db-ux/p-CdVqfu2Z.js +2 -0
- package/dist/db-ux/p-CdVqfu2Z.js.map +1 -0
- package/dist/db-ux/p-bc2e8a30.entry.js +2 -0
- package/dist/db-ux/p-bc2e8a30.entry.js.map +1 -0
- package/dist/esm/db-checkbox.entry.js +30 -4
- package/dist/esm/db-checkbox.entry.js.map +1 -1
- package/dist/esm/db-custom-select-dropdown.db-custom-select-list.db-custom-select-list-item.db-input.db-tag.entry.js.map +1 -1
- package/dist/esm/db-custom-select-dropdown_5.entry.js +32 -5
- package/dist/esm/db-custom-select.entry.js +76 -47
- package/dist/esm/db-custom-select.entry.js.map +1 -1
- package/dist/esm/db-header.entry.js +2 -2
- package/dist/esm/db-header.entry.js.map +1 -1
- package/dist/esm/db-notification.entry.js +2 -2
- package/dist/esm/db-notification.entry.js.map +1 -1
- package/dist/esm/db-radio.entry.js +40 -5
- package/dist/esm/db-radio.entry.js.map +1 -1
- package/dist/esm/db-select.entry.js +32 -5
- package/dist/esm/db-select.entry.js.map +1 -1
- package/dist/esm/db-switch.entry.js +31 -4
- package/dist/esm/db-switch.entry.js.map +1 -1
- package/dist/esm/db-textarea.entry.js +32 -5
- package/dist/esm/db-textarea.entry.js.map +1 -1
- package/dist/esm/db-ux.js +1 -1
- package/dist/esm/form-components-DmI6JmyJ.js +37 -0
- package/dist/esm/form-components-DmI6JmyJ.js.map +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +5 -1
- package/dist/types/components/custom-select/custom-select.d.ts +5 -0
- package/dist/types/components/custom-select/model.d.ts +5 -0
- package/dist/types/components/header/header.d.ts +2 -0
- package/dist/types/components/header/model.d.ts +2 -2
- package/dist/types/components/input/input.d.ts +6 -2
- package/dist/types/components/notification/notification.d.ts +1 -1
- package/dist/types/components/radio/model.d.ts +3 -3
- package/dist/types/components/radio/radio.d.ts +7 -1
- package/dist/types/components/select/select.d.ts +6 -2
- package/dist/types/components/switch/switch.d.ts +5 -1
- package/dist/types/components/textarea/textarea.d.ts +6 -2
- package/dist/types/components.d.ts +8 -0
- package/dist/types/shared/model.d.ts +6 -2
- package/dist/types/utils/form-components.d.ts +9 -0
- package/dist/vscode.html-custom-data.json +21 -6
- package/dist/web-types.json +63 -18
- package/package.json +3 -3
- package/dist/db-ux/p-1761357c.entry.js +0 -2
- package/dist/db-ux/p-1761357c.entry.js.map +0 -1
- package/dist/db-ux/p-233758c5.entry.js +0 -2
- package/dist/db-ux/p-233758c5.entry.js.map +0 -1
- package/dist/db-ux/p-60f913fa.entry.js +0 -2
- package/dist/db-ux/p-60f913fa.entry.js.map +0 -1
- package/dist/db-ux/p-76dd2831.entry.js +0 -2
- package/dist/db-ux/p-76dd2831.entry.js.map +0 -1
- package/dist/db-ux/p-93620721.entry.js +0 -2
- package/dist/db-ux/p-93620721.entry.js.map +0 -1
- package/dist/db-ux/p-c423e7ba.entry.js +0 -2
- package/dist/db-ux/p-c423e7ba.entry.js.map +0 -1
- package/dist/db-ux/p-c7815d81.entry.js +0 -2
- package/dist/db-ux/p-c7815d81.entry.js.map +0 -1
- package/dist/db-ux/p-decb47b4.entry.js +0 -2
- package/dist/db-ux/p-decb47b4.entry.js.map +0 -1
- package/dist/db-ux/p-ecab99ff.entry.js +0 -2
- package/dist/db-ux/p-ecab99ff.entry.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_DATALIST_ID_SUFFIX, DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_LABEL, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_PLACEHOLDER, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
|
|
2
2
|
import { cls, delay, getBoolean, getBooleanAsString, getHideProp, getInputValue, getNumber, hasVoiceOver, isArrayOfStrings, isIOSSafari, stringPropVisible, uuid, } from "../../utils";
|
|
3
|
+
import { addValueResetEventListener, } from "../../utils/form-components";
|
|
3
4
|
import { h, } from "@stencil/core";
|
|
4
5
|
/**
|
|
5
6
|
* @slot children - This is a default/unnamed slot
|
|
@@ -16,6 +17,7 @@ export class DBInput {
|
|
|
16
17
|
this._descByIds = undefined;
|
|
17
18
|
this._value = undefined;
|
|
18
19
|
this._voiceOverFallback = "";
|
|
20
|
+
this.abortController = undefined;
|
|
19
21
|
}
|
|
20
22
|
hasValidState() {
|
|
21
23
|
var _a;
|
|
@@ -51,13 +53,13 @@ export class DBInput {
|
|
|
51
53
|
this._descByIds = undefined;
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
handleInput(event) {
|
|
56
|
+
handleInput(event, reset) {
|
|
55
57
|
if (this.input) {
|
|
56
58
|
this.input.emit(event);
|
|
57
59
|
}
|
|
58
60
|
this.handleValidation();
|
|
59
61
|
}
|
|
60
|
-
handleChange(event) {
|
|
62
|
+
handleChange(event, reset) {
|
|
61
63
|
if (this.change) {
|
|
62
64
|
this.change.emit(event);
|
|
63
65
|
}
|
|
@@ -148,6 +150,26 @@ export class DBInput {
|
|
|
148
150
|
watch2() {
|
|
149
151
|
this.watch2Fn();
|
|
150
152
|
}
|
|
153
|
+
watch3Fn() {
|
|
154
|
+
if (this._ref) {
|
|
155
|
+
const defaultValue = undefined;
|
|
156
|
+
let controller = this.abortController;
|
|
157
|
+
if (!controller) {
|
|
158
|
+
controller = new AbortController();
|
|
159
|
+
this.abortController = controller;
|
|
160
|
+
}
|
|
161
|
+
addValueResetEventListener(this._ref, {
|
|
162
|
+
value: this.value,
|
|
163
|
+
defaultValue,
|
|
164
|
+
}, (event) => {
|
|
165
|
+
this.handleChange(event, true);
|
|
166
|
+
this.handleInput(event, true);
|
|
167
|
+
}, controller.signal);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
watch3() {
|
|
171
|
+
this.watch3Fn();
|
|
172
|
+
}
|
|
151
173
|
componentDidLoad() {
|
|
152
174
|
var _a;
|
|
153
175
|
this.enableAttributePassing(this._ref, "db-input");
|
|
@@ -161,10 +183,15 @@ export class DBInput {
|
|
|
161
183
|
this.watch0Fn();
|
|
162
184
|
this.watch1Fn();
|
|
163
185
|
this.watch2Fn();
|
|
186
|
+
this.watch3Fn();
|
|
187
|
+
}
|
|
188
|
+
disconnectedCallback() {
|
|
189
|
+
var _a;
|
|
190
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
164
191
|
}
|
|
165
192
|
render() {
|
|
166
193
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
167
|
-
return (h("div", { key: '
|
|
194
|
+
return (h("div", { key: 'b3e0deb3a86964b8de452dece18f95f027151832', class: cls("db-input", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-show-icon": getBooleanAsString((_a = this.showIconLeading) !== null && _a !== void 0 ? _a : this.showIcon), "data-icon": (_b = this.iconLeading) !== null && _b !== void 0 ? _b : this.icon, "data-icon-trailing": this.iconTrailing, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing) }, h("label", { key: 'c6b0cf9b7526b0c77fcd7a0bdd373d391fa18ea6', htmlFor: this._id }, (_c = this.label) !== null && _c !== void 0 ? _c : DEFAULT_LABEL), h("input", { key: 'c12dd974640a41ff64c8b0bf6aabb8ed9a654bfb', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
|
|
168
195
|
this._ref = el;
|
|
169
196
|
}, id: this._id, name: this.name, type: this.type || "text", multiple: getBoolean(this.multiple, "multiple"), placeholder: (_d = this.placeholder) !== null && _d !== void 0 ? _d : DEFAULT_PLACEHOLDER, disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), step: getNumber(this.step), value: (_e = this.value) !== null && _e !== void 0 ? _e : this._value, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), max: getInputValue(this.max, this.type), min: getInputValue(this.min, this.type), readOnly: getBoolean(this.readOnly, "readOnly") ||
|
|
170
197
|
getBoolean(this.readonly, "readonly"), form: this.form, pattern: this.pattern, size: this.size, autoComplete: this.autocomplete, autoFocus: getBoolean(this.autofocus, "autofocus"), enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), list: this.dataList && this._dataListId, "aria-describedby": (_f = this.ariaDescribedBy) !== null && _f !== void 0 ? _f : this._descByIds, role: [
|
|
@@ -176,7 +203,7 @@ export class DBInput {
|
|
|
176
203
|
"color",
|
|
177
204
|
].includes((_g = this.type) !== null && _g !== void 0 ? _g : "") && isIOSSafari()
|
|
178
205
|
? "textbox"
|
|
179
|
-
: undefined }), this.dataList ? (h("datalist", { id: this._dataListId }, (_h = this.getDataList()) === null || _h === void 0 ? void 0 : _h.map((option) => (h("option", { key: this._dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null, h("slot", { key: '
|
|
206
|
+
: undefined }), this.dataList ? (h("datalist", { id: this._dataListId }, (_h = this.getDataList()) === null || _h === void 0 ? void 0 : _h.map((option) => (h("option", { key: this._dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null, h("slot", { key: '231c238218940050bb92948c798d9cc4bcd4b1f8' }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: this.messageSize || "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { semantic: "successful", id: this._validMessageId, size: this.validMessageSize || "small" }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '101dc9398ba3394dc0d2f3b9dbd9f9414a96f59a', semantic: "critical", id: this._invalidMessageId, size: this.invalidMessageSize || "small" }, this._invalidMessage), h("span", { key: '4b2b099a5ee1f0e3d57f591fa8af8ea8633d4d21', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
180
207
|
}
|
|
181
208
|
static get is() { return "db-input"; }
|
|
182
209
|
static get properties() {
|
|
@@ -1391,7 +1418,8 @@ export class DBInput {
|
|
|
1391
1418
|
"_dataListId": {},
|
|
1392
1419
|
"_descByIds": {},
|
|
1393
1420
|
"_value": {},
|
|
1394
|
-
"_voiceOverFallback": {}
|
|
1421
|
+
"_voiceOverFallback": {},
|
|
1422
|
+
"abortController": {}
|
|
1395
1423
|
};
|
|
1396
1424
|
}
|
|
1397
1425
|
static get events() {
|
|
@@ -1470,6 +1498,9 @@ export class DBInput {
|
|
|
1470
1498
|
}, {
|
|
1471
1499
|
"propName": "value",
|
|
1472
1500
|
"methodName": "watch2"
|
|
1501
|
+
}, {
|
|
1502
|
+
"propName": "_ref",
|
|
1503
|
+
"methodName": "watch3"
|
|
1473
1504
|
}];
|
|
1474
1505
|
}
|
|
1475
1506
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,iCAAiC,EACjC,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACZ,gBAAgB,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n DEFAULT_DATALIST_ID_SUFFIX,\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_LABEL,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_PLACEHOLDER,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport {\n ChangeEvent,\n InputEvent,\n InteractionEvent,\n ValueLabelType,\n} from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getBooleanAsString,\n getHideProp,\n getInputValue,\n getNumber,\n hasVoiceOver,\n isArrayOfStrings,\n isIOSSafari,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport { DBInputProps, DBInputState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-input\",\n})\nexport class DBInput {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBInputProps[\"id\"];\n @Prop() invalidMessage: DBInputProps[\"invalidMessage\"];\n @Prop() dataListId: DBInputProps[\"dataListId\"];\n @Prop() message: DBInputProps[\"message\"];\n @Prop() showMessage: DBInputProps[\"showMessage\"];\n @Prop() value: DBInputProps[\"value\"];\n @Prop() validMessage: DBInputProps[\"validMessage\"];\n @Prop() validation: DBInputProps[\"validation\"];\n @Prop() required: DBInputProps[\"required\"];\n @Prop() minLength: DBInputProps[\"minLength\"];\n @Prop() maxLength: DBInputProps[\"maxLength\"];\n @Prop() pattern: DBInputProps[\"pattern\"];\n @Event() input: EventEmitter<\n Parameters<Required<DBInputProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBInputProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBInputProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBInputProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() dataList: DBInputProps[\"dataList\"];\n @Prop({attribute: \"classname\"}) className: DBInputProps[\"className\"];\n @Prop() variant: DBInputProps[\"variant\"];\n @Prop() showLabel: DBInputProps[\"showLabel\"];\n @Prop() showIconLeading: DBInputProps[\"showIconLeading\"];\n @Prop() showIcon: DBInputProps[\"showIcon\"];\n @Prop() iconLeading: DBInputProps[\"iconLeading\"];\n @Prop() icon: DBInputProps[\"icon\"];\n @Prop() iconTrailing: DBInputProps[\"iconTrailing\"];\n @Prop() showRequiredAsterisk: DBInputProps[\"showRequiredAsterisk\"];\n @Prop() showIconTrailing: DBInputProps[\"showIconTrailing\"];\n @Prop() label: DBInputProps[\"label\"];\n @Prop() fieldSizing: DBInputProps[\"fieldSizing\"];\n @Prop() name: DBInputProps[\"name\"];\n @Prop() type: DBInputProps[\"type\"];\n @Prop() multiple: DBInputProps[\"multiple\"];\n @Prop() placeholder: DBInputProps[\"placeholder\"];\n @Prop() disabled: DBInputProps[\"disabled\"];\n @Prop() step: DBInputProps[\"step\"];\n @Prop() maxlength: DBInputProps[\"maxlength\"];\n @Prop() minlength: DBInputProps[\"minlength\"];\n @Prop() max: DBInputProps[\"max\"];\n @Prop() min: DBInputProps[\"min\"];\n @Prop() readOnly: DBInputProps[\"readOnly\"];\n @Prop() readonly: DBInputProps[\"readonly\"];\n @Prop() form: DBInputProps[\"form\"];\n @Prop() size: DBInputProps[\"size\"];\n @Prop() autocomplete: DBInputProps[\"autocomplete\"];\n @Prop() autofocus: DBInputProps[\"autofocus\"];\n @Prop() enterkeyhint: DBInputProps[\"enterkeyhint\"];\n @Prop() inputmode: DBInputProps[\"inputmode\"];\n @Prop() ariaDescribedBy: DBInputProps[\"ariaDescribedBy\"];\n @Prop() messageSize: DBInputProps[\"messageSize\"];\n @Prop() messageIcon: DBInputProps[\"messageIcon\"];\n @Prop() validMessageSize: DBInputProps[\"validMessageSize\"];\n @Prop() invalidMessageSize: DBInputProps[\"invalidMessageSize\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _dataListId = undefined;\n @State() _descByIds = undefined;\n @State() _value = undefined;\n @State() _voiceOverFallback = \"\";\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\n /* For a11y reasons we need to map the correct message with the input */\n if (!this._ref?.validity.valid || this.validation === \"invalid\") {\n this._descByIds = this._invalidMessageId;\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this._invalidMessage;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (\n this.hasValidState() &&\n this._ref?.validity.valid &&\n (this.required || this.minLength || this.maxLength || this.pattern)\n ) {\n this._descByIds = this._validMessageId;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId;\n } else {\n this._descByIds = undefined;\n }\n }\n handleInput(event: InputEvent<HTMLInputElement>) {\n if (this.input) {\n this.input.emit(event);\n }\n this.handleValidation();\n }\n handleChange(event: ChangeEvent<HTMLInputElement>) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n getDataList() {\n const _list = this.dataList;\n return Array.from(\n (isArrayOfStrings(_list)\n ? _list?.map((val: string) => ({\n value: val,\n label: undefined,\n }))\n : _list) || []\n );\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n }\n\n @Watch(\"_ref\")\n @Watch(\"invalidMessage\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._id) {\n const messageId = this._id + DEFAULT_MESSAGE_ID_SUFFIX;\n this._messageId = messageId;\n this._validMessageId = this._id + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = this._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n this._dataListId =\n this.dataListId ?? this._id + DEFAULT_DATALIST_ID_SUFFIX;\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = messageId;\n }\n this.handleValidation();\n }\n }\n\n @Watch(\"_id\")\n watch1() {\n this.watch1Fn();\n }\n\n watch2Fn() {\n this._value = this.value;\n }\n\n @Watch(\"value\")\n watch2() {\n this.watch2Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-input\");\n const mId = this.id ?? `input-${uuid()}`;\n this._id = mId;\n this._messageId = mId + DEFAULT_MESSAGE_ID_SUFFIX;\n this._validMessageId = mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n this._dataListId = mId + DEFAULT_DATALIST_ID_SUFFIX;\n this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;\n this.watch0Fn();\n this.watch1Fn();\n this.watch2Fn();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-input\", this.className)}\n data-variant={this.variant}\n data-hide-label={getHideProp(this.showLabel)}\n data-show-icon={getBooleanAsString(\n this.showIconLeading ?? this.showIcon\n )}\n data-icon={this.iconLeading ?? this.icon}\n data-icon-trailing={this.iconTrailing}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-show-icon-trailing={getBooleanAsString(this.showIconTrailing)}\n >\n <label htmlFor={this._id}>{this.label ?? DEFAULT_LABEL}</label>\n <input\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n data-field-sizing={this.fieldSizing}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n name={this.name}\n type={this.type || \"text\"}\n multiple={getBoolean(this.multiple, \"multiple\")}\n placeholder={this.placeholder ?? DEFAULT_PLACEHOLDER}\n disabled={getBoolean(this.disabled, \"disabled\")}\n required={getBoolean(this.required, \"required\")}\n step={getNumber(this.step)}\n value={this.value ?? this._value}\n maxLength={getNumber(this.maxLength, this.maxlength)}\n minLength={getNumber(this.minLength, this.minlength)}\n max={getInputValue(this.max, this.type)}\n min={getInputValue(this.min, this.type)}\n readOnly={\n getBoolean(this.readOnly, \"readOnly\") ||\n getBoolean(this.readonly, \"readonly\")\n }\n form={this.form}\n pattern={this.pattern}\n size={this.size}\n autoComplete={this.autocomplete}\n autoFocus={getBoolean(this.autofocus, \"autofocus\")}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n onInput={(event) => this.handleInput(event)}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n list={this.dataList && this._dataListId}\n aria-describedby={this.ariaDescribedBy ?? this._descByIds}\n role={\n [\n \"datetime-local\",\n \"date\",\n \"time\",\n \"week\",\n \"month\",\n \"color\",\n ].includes(this.type ?? \"\") && isIOSSafari()\n ? \"textbox\"\n : undefined\n }\n />\n {this.dataList ? (\n <datalist id={this._dataListId}>\n {this.getDataList()?.map((option) => (\n <option\n key={this._dataListId + \"-option-\" + option.value}\n value={option.value}\n >\n {option.label}\n </option>\n ))}\n </datalist>\n ) : null}\n <slot></slot>\n {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size={this.messageSize || \"small\"}\n icon={this.messageIcon}\n id={this._messageId}\n >\n {this.message}\n </db-infotext>\n ) : null}\n {this.hasValidState() ? (\n <db-infotext\n semantic=\"successful\"\n id={this._validMessageId}\n size={this.validMessageSize || \"small\"}\n >\n {this.validMessage || DEFAULT_VALID_MESSAGE}\n </db-infotext>\n ) : null}\n <db-infotext\n semantic=\"critical\"\n id={this._invalidMessageId}\n size={this.invalidMessageSize || \"small\"}\n >\n {this._invalidMessage}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,iCAAiC,EACjC,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,IAAI,GACL,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,GAG3B,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,OAAO;IAHnB;QAiEU,QAAG,GAAG,SAAS,CAAC;QAChB,eAAU,GAAG,SAAS,CAAC;QACvB,oBAAe,GAAG,SAAS,CAAC;QAC5B,sBAAiB,GAAG,SAAS,CAAC;QAC9B,oBAAe,GAAG,SAAS,CAAC;QAC5B,gBAAW,GAAG,SAAS,CAAC;QACxB,eAAU,GAAG,SAAS,CAAC;QACvB,WAAM,GAAG,SAAS,CAAC;QACnB,uBAAkB,GAAG,EAAE,CAAC;QACxB,oBAAe,GAAG,SAAS,CAAC;KAgTtC;IA9SC,aAAa;;QACX,OAAO,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,YAAY,mCAAI,IAAI,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC;IAC9D,CAAC;IACD,gBAAgB;;QACd,wEAAwE;QACxE,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAC,KAAK,CAAA,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n DEFAULT_DATALIST_ID_SUFFIX,\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_LABEL,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_PLACEHOLDER,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport {\n ChangeEvent,\n InputEvent,\n InteractionEvent,\n ValueLabelType,\n} from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getBooleanAsString,\n getHideProp,\n getInputValue,\n getNumber,\n hasVoiceOver,\n isArrayOfStrings,\n isIOSSafari,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\nimport {\n addValueResetEventListener,\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport { DBInputProps, DBInputState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-input\",\n})\nexport class DBInput {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBInputProps[\"id\"];\n @Prop() invalidMessage: DBInputProps[\"invalidMessage\"];\n @Prop() dataListId: DBInputProps[\"dataListId\"];\n @Prop() message: DBInputProps[\"message\"];\n @Prop() showMessage: DBInputProps[\"showMessage\"];\n @Prop() value: DBInputProps[\"value\"];\n @Prop() validMessage: DBInputProps[\"validMessage\"];\n @Prop() validation: DBInputProps[\"validation\"];\n @Prop() required: DBInputProps[\"required\"];\n @Prop() minLength: DBInputProps[\"minLength\"];\n @Prop() maxLength: DBInputProps[\"maxLength\"];\n @Prop() pattern: DBInputProps[\"pattern\"];\n @Event() input: EventEmitter<\n Parameters<Required<DBInputProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBInputProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBInputProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBInputProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() dataList: DBInputProps[\"dataList\"];\n @Prop({attribute: \"classname\"}) className: DBInputProps[\"className\"];\n @Prop() variant: DBInputProps[\"variant\"];\n @Prop() showLabel: DBInputProps[\"showLabel\"];\n @Prop() showIconLeading: DBInputProps[\"showIconLeading\"];\n @Prop() showIcon: DBInputProps[\"showIcon\"];\n @Prop() iconLeading: DBInputProps[\"iconLeading\"];\n @Prop() icon: DBInputProps[\"icon\"];\n @Prop() iconTrailing: DBInputProps[\"iconTrailing\"];\n @Prop() showRequiredAsterisk: DBInputProps[\"showRequiredAsterisk\"];\n @Prop() showIconTrailing: DBInputProps[\"showIconTrailing\"];\n @Prop() label: DBInputProps[\"label\"];\n @Prop() fieldSizing: DBInputProps[\"fieldSizing\"];\n @Prop() name: DBInputProps[\"name\"];\n @Prop() type: DBInputProps[\"type\"];\n @Prop() multiple: DBInputProps[\"multiple\"];\n @Prop() placeholder: DBInputProps[\"placeholder\"];\n @Prop() disabled: DBInputProps[\"disabled\"];\n @Prop() step: DBInputProps[\"step\"];\n @Prop() maxlength: DBInputProps[\"maxlength\"];\n @Prop() minlength: DBInputProps[\"minlength\"];\n @Prop() max: DBInputProps[\"max\"];\n @Prop() min: DBInputProps[\"min\"];\n @Prop() readOnly: DBInputProps[\"readOnly\"];\n @Prop() readonly: DBInputProps[\"readonly\"];\n @Prop() form: DBInputProps[\"form\"];\n @Prop() size: DBInputProps[\"size\"];\n @Prop() autocomplete: DBInputProps[\"autocomplete\"];\n @Prop() autofocus: DBInputProps[\"autofocus\"];\n @Prop() enterkeyhint: DBInputProps[\"enterkeyhint\"];\n @Prop() inputmode: DBInputProps[\"inputmode\"];\n @Prop() ariaDescribedBy: DBInputProps[\"ariaDescribedBy\"];\n @Prop() messageSize: DBInputProps[\"messageSize\"];\n @Prop() messageIcon: DBInputProps[\"messageIcon\"];\n @Prop() validMessageSize: DBInputProps[\"validMessageSize\"];\n @Prop() invalidMessageSize: DBInputProps[\"invalidMessageSize\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _dataListId = undefined;\n @State() _descByIds = undefined;\n @State() _value = undefined;\n @State() _voiceOverFallback = \"\";\n @State() abortController = undefined;\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\n /* For a11y reasons we need to map the correct message with the input */\n if (!this._ref?.validity.valid || this.validation === \"invalid\") {\n this._descByIds = this._invalidMessageId;\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this._invalidMessage;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (\n this.hasValidState() &&\n this._ref?.validity.valid &&\n (this.required || this.minLength || this.maxLength || this.pattern)\n ) {\n this._descByIds = this._validMessageId;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId;\n } else {\n this._descByIds = undefined;\n }\n }\n handleInput(event: InputEvent<HTMLInputElement>, reset?: boolean) {\n if (this.input) {\n this.input.emit(event);\n }\n this.handleValidation();\n }\n handleChange(event: ChangeEvent<HTMLInputElement>, reset?: boolean) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n getDataList() {\n const _list = this.dataList;\n return Array.from(\n (isArrayOfStrings(_list)\n ? _list?.map((val: string) => ({\n value: val,\n label: undefined,\n }))\n : _list) || []\n );\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n }\n\n @Watch(\"_ref\")\n @Watch(\"invalidMessage\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._id) {\n const messageId = this._id + DEFAULT_MESSAGE_ID_SUFFIX;\n this._messageId = messageId;\n this._validMessageId = this._id + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = this._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n this._dataListId =\n this.dataListId ?? this._id + DEFAULT_DATALIST_ID_SUFFIX;\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = messageId;\n }\n this.handleValidation();\n }\n }\n\n @Watch(\"_id\")\n watch1() {\n this.watch1Fn();\n }\n\n watch2Fn() {\n this._value = this.value;\n }\n\n @Watch(\"value\")\n watch2() {\n this.watch2Fn();\n }\n\n watch3Fn() {\n if (this._ref) {\n const defaultValue = undefined;\n let controller = this.abortController;\n if (!controller) {\n controller = new AbortController();\n this.abortController = controller;\n }\n addValueResetEventListener(\n this._ref,\n {\n value: this.value,\n defaultValue,\n },\n (event) => {\n this.handleChange(event, true);\n this.handleInput(event, true);\n },\n controller.signal\n );\n }\n }\n\n @Watch(\"_ref\")\n watch3() {\n this.watch3Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-input\");\n const mId = this.id ?? `input-${uuid()}`;\n this._id = mId;\n this._messageId = mId + DEFAULT_MESSAGE_ID_SUFFIX;\n this._validMessageId = mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n this._dataListId = mId + DEFAULT_DATALIST_ID_SUFFIX;\n this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;\n this.watch0Fn();\n this.watch1Fn();\n this.watch2Fn();\n this.watch3Fn();\n }\n disconnectedCallback() {\n this.abortController?.abort();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-input\", this.className)}\n data-variant={this.variant}\n data-hide-label={getHideProp(this.showLabel)}\n data-show-icon={getBooleanAsString(\n this.showIconLeading ?? this.showIcon\n )}\n data-icon={this.iconLeading ?? this.icon}\n data-icon-trailing={this.iconTrailing}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-show-icon-trailing={getBooleanAsString(this.showIconTrailing)}\n >\n <label htmlFor={this._id}>{this.label ?? DEFAULT_LABEL}</label>\n <input\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n data-field-sizing={this.fieldSizing}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n name={this.name}\n type={this.type || \"text\"}\n multiple={getBoolean(this.multiple, \"multiple\")}\n placeholder={this.placeholder ?? DEFAULT_PLACEHOLDER}\n disabled={getBoolean(this.disabled, \"disabled\")}\n required={getBoolean(this.required, \"required\")}\n step={getNumber(this.step)}\n value={this.value ?? this._value}\n maxLength={getNumber(this.maxLength, this.maxlength)}\n minLength={getNumber(this.minLength, this.minlength)}\n max={getInputValue(this.max, this.type)}\n min={getInputValue(this.min, this.type)}\n readOnly={\n getBoolean(this.readOnly, \"readOnly\") ||\n getBoolean(this.readonly, \"readonly\")\n }\n form={this.form}\n pattern={this.pattern}\n size={this.size}\n autoComplete={this.autocomplete}\n autoFocus={getBoolean(this.autofocus, \"autofocus\")}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n onInput={(event) => this.handleInput(event)}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n list={this.dataList && this._dataListId}\n aria-describedby={this.ariaDescribedBy ?? this._descByIds}\n role={\n [\n \"datetime-local\",\n \"date\",\n \"time\",\n \"week\",\n \"month\",\n \"color\",\n ].includes(this.type ?? \"\") && isIOSSafari()\n ? \"textbox\"\n : undefined\n }\n />\n {this.dataList ? (\n <datalist id={this._dataListId}>\n {this.getDataList()?.map((option) => (\n <option\n key={this._dataListId + \"-option-\" + option.value}\n value={option.value}\n >\n {option.label}\n </option>\n ))}\n </datalist>\n ) : null}\n <slot></slot>\n {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size={this.messageSize || \"small\"}\n icon={this.messageIcon}\n id={this._messageId}\n >\n {this.message}\n </db-infotext>\n ) : null}\n {this.hasValidState() ? (\n <db-infotext\n semantic=\"successful\"\n id={this._validMessageId}\n size={this.validMessageSize || \"small\"}\n >\n {this.validMessage || DEFAULT_VALID_MESSAGE}\n </db-infotext>\n ) : null}\n <db-infotext\n semantic=\"critical\"\n id={this._invalidMessageId}\n size={this.invalidMessageSize || \"small\"}\n >\n {this._invalidMessage}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"]}
|
|
@@ -52,9 +52,9 @@ export class DBNotification {
|
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
54
|
var _a;
|
|
55
|
-
return (h("article", { key: '
|
|
55
|
+
return (h("article", { key: '3c3f2ddd7dfcd2e1c0fee57f9c5e7da2715b14f9', class: cls("db-notification", this.className), ref: (el) => {
|
|
56
56
|
this._ref = el;
|
|
57
|
-
}, id: this.id, "aria-live": this.ariaLive, "data-semantic": this.semantic, "data-variant": this.variant, "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon), "data-link-variant": this.linkVariant }, h("slot", { key: '
|
|
57
|
+
}, id: this.id, "aria-live": this.ariaLive, "data-semantic": this.semantic, "data-variant": this.variant, "data-icon": getBoolean(this.showIcon) !== false ? this.icon : undefined, "data-show-icon": getBooleanAsString(this.showIcon), "data-link-variant": this.linkVariant }, h("slot", { key: 'abf2bee58f568e7f8fd1b4bc3b4f5784075195c0', name: "image" }), stringPropVisible(this.headline, this.showHeadline) ? (h("header", null, this.headline)) : null, h("p", { key: 'f845249859543bfdc2ac08dd06fea46d5c6fb33d' }, this.text ? this.text : h("slot", null)), stringPropVisible(this.timestamp, this.showTimestamp) ? (h("span", null, this.timestamp)) : null, h("slot", { key: '097d69d4b69789d1bc2ff1c1eea143578cdd3f83', name: "link" }), getBoolean(this.closeable, "closeable") ? (h("db-button", { icon: "cross", variant: "ghost", size: "small", id: this.closeButtonId, noText: true, onClick: (event) => this.handleClose(event) }, (_a = this.closeButtonText) !== null && _a !== void 0 ? _a : DEFAULT_CLOSE_BUTTON)) : null));
|
|
58
58
|
}
|
|
59
59
|
static get is() { return "db-notification"; }
|
|
60
60
|
static get properties() {
|
|
@@ -184,12 +184,12 @@ export class DBNotification {
|
|
|
184
184
|
"reflect": false,
|
|
185
185
|
"attribute": "variant"
|
|
186
186
|
},
|
|
187
|
-
"
|
|
188
|
-
"type": "
|
|
187
|
+
"showIcon": {
|
|
188
|
+
"type": "any",
|
|
189
189
|
"mutable": false,
|
|
190
190
|
"complexType": {
|
|
191
|
-
"original": "DBNotificationProps[\"
|
|
192
|
-
"resolved": "
|
|
191
|
+
"original": "DBNotificationProps[\"showIcon\"]",
|
|
192
|
+
"resolved": "boolean | string",
|
|
193
193
|
"references": {
|
|
194
194
|
"DBNotificationProps": {
|
|
195
195
|
"location": "import",
|
|
@@ -207,14 +207,14 @@ export class DBNotification {
|
|
|
207
207
|
"getter": false,
|
|
208
208
|
"setter": false,
|
|
209
209
|
"reflect": false,
|
|
210
|
-
"attribute": "icon"
|
|
210
|
+
"attribute": "show-icon"
|
|
211
211
|
},
|
|
212
|
-
"
|
|
213
|
-
"type": "
|
|
212
|
+
"icon": {
|
|
213
|
+
"type": "string",
|
|
214
214
|
"mutable": false,
|
|
215
215
|
"complexType": {
|
|
216
|
-
"original": "DBNotificationProps[\"
|
|
217
|
-
"resolved": "
|
|
216
|
+
"original": "DBNotificationProps[\"icon\"]",
|
|
217
|
+
"resolved": "BaseIconTypes | LooseAutocomplete",
|
|
218
218
|
"references": {
|
|
219
219
|
"DBNotificationProps": {
|
|
220
220
|
"location": "import",
|
|
@@ -232,7 +232,7 @@ export class DBNotification {
|
|
|
232
232
|
"getter": false,
|
|
233
233
|
"setter": false,
|
|
234
234
|
"reflect": false,
|
|
235
|
-
"attribute": "
|
|
235
|
+
"attribute": "icon"
|
|
236
236
|
},
|
|
237
237
|
"linkVariant": {
|
|
238
238
|
"type": "string",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/components/notification/notification.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EACL,GAAG,EACH,UAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAIrB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EAEL,IAAI,GACL,MAAM,eAAe,CAAC;AAGvB;;;;GAIG;AAIH,MAAM,OAAO,cAAc;IAsBzB,WAAW,CAAC,KAA4C;QACtD,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,sBAAsB,CAC5B,OAA2B,EAC3B,qBAA6B;QAE7B,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACvD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAChC,IACE,IAAI;oBACJ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAChE,CAAC;oBACD,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI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,IAAI,CAAC,OAAO,eACf,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/components/notification/notification.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EACL,GAAG,EACH,UAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAIrB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EAEL,IAAI,GACL,MAAM,eAAe,CAAC;AAGvB;;;;GAIG;AAIH,MAAM,OAAO,cAAc;IAsBzB,WAAW,CAAC,KAA4C;QACtD,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,sBAAsB,CAC5B,OAA2B,EAC3B,qBAA6B;QAE7B,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACvD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAChC,IACE,IAAI;oBACJ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAChE,CAAC;oBACD,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { DEFAULT_CLOSE_BUTTON } from \"../../shared/constants\";\nimport { ClickEvent } from \"../../shared/model\";\nimport {\n cls,\n getBoolean,\n getBooleanAsString,\n stringPropVisible,\n} from \"../../utils\";\nimport { DBButton } from \"../button/button\";\nimport { DBNotificationProps, DBNotificationState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Event,\n EventEmitter,\n Prop,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n * @slot image - TODO: Add description for slotImage\n * @slot link - TODO: Add description for slotLink\n */\n @Component({\n tag: \"db-notification\",\n})\nexport class DBNotification {\n private _ref!: HTMLDivElement | any;\n @Event() close: EventEmitter<\n Parameters<Required<DBNotificationProps>[\"onClose\"]>[number]\n > | void;\n @Prop() id: DBNotificationProps[\"id\"];\n @Prop({attribute: \"classname\"}) className: DBNotificationProps[\"className\"];\n @Prop() ariaLive: DBNotificationProps[\"ariaLive\"];\n @Prop() semantic: DBNotificationProps[\"semantic\"];\n @Prop() variant: DBNotificationProps[\"variant\"];\n @Prop() showIcon: DBNotificationProps[\"showIcon\"];\n @Prop() icon: DBNotificationProps[\"icon\"];\n @Prop() linkVariant: DBNotificationProps[\"linkVariant\"];\n @Prop() headline: DBNotificationProps[\"headline\"];\n @Prop() showHeadline: DBNotificationProps[\"showHeadline\"];\n @Prop() text: DBNotificationProps[\"text\"];\n @Prop() timestamp: DBNotificationProps[\"timestamp\"];\n @Prop() showTimestamp: DBNotificationProps[\"showTimestamp\"];\n @Prop() closeable: DBNotificationProps[\"closeable\"];\n @Prop() closeButtonId: DBNotificationProps[\"closeButtonId\"];\n @Prop() closeButtonText: DBNotificationProps[\"closeButtonText\"];\n\n handleClose(event?: ClickEvent<HTMLButtonElement> | void) {\n if (!event) return;\n event.stopPropagation();\n if (this.close) {\n this.close.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-notification\");\n }\n\n render() {\n return (\n <article\n class={cls(\"db-notification\", this.className)}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this.id}\n aria-live={this.ariaLive}\n data-semantic={this.semantic}\n data-variant={this.variant}\n data-icon={getBoolean(this.showIcon) !== false ? this.icon : undefined}\n data-show-icon={getBooleanAsString(this.showIcon)}\n data-link-variant={this.linkVariant}\n >\n <slot name=\"image\"></slot>\n {stringPropVisible(this.headline, this.showHeadline) ? (\n <header>{this.headline}</header>\n ) : null}\n <p>{this.text ? this.text : <slot></slot>}</p>\n {stringPropVisible(this.timestamp, this.showTimestamp) ? (\n <span>{this.timestamp}</span>\n ) : null}\n <slot name=\"link\"></slot>\n {getBoolean(this.closeable, \"closeable\") ? (\n <db-button\n icon=\"cross\"\n variant=\"ghost\"\n size=\"small\"\n id={this.closeButtonId}\n noText={true}\n onClick={(event) => this.handleClose(event)}\n >\n {this.closeButtonText ?? DEFAULT_CLOSE_BUTTON}\n </db-button>\n ) : null}\n </article>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/components/radio/model.ts"],"names":[],"mappings":"","sourcesContent":["import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormCheckProps, FormProps, FormState, GlobalProps, GlobalState, InitializedState, SizeProps } from '../../shared/model';\nexport type DBRadioDefaultProps = {};\nexport type DBRadioProps = DBRadioDefaultProps & GlobalProps & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & FormCheckProps & SizeProps;\nexport type DBRadioDefaultState = {};\nexport type DBRadioState = DBRadioDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState & InitializedState"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/components/radio/model.ts"],"names":[],"mappings":"","sourcesContent":["import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormCheckProps, FormProps, FormState, GlobalProps, GlobalState, InitializedState, InputEventProps, InputEventState, SizeProps } from '../../shared/model';\nexport type DBRadioDefaultProps = {};\nexport type DBRadioProps = DBRadioDefaultProps & GlobalProps & InputEventProps<HTMLInputElement> & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & FormCheckProps & SizeProps;\nexport type DBRadioDefaultState = {};\nexport type DBRadioState = DBRadioDefaultState & GlobalState & InputEventState<HTMLInputElement> & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState & InitializedState"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { cls, getBoolean, getHideProp, uuid } from "../../utils";
|
|
1
|
+
import { cls, delay, getBoolean, getHideProp, uuid } from "../../utils";
|
|
2
|
+
import { addResetEventListener, } from "../../utils/form-components";
|
|
2
3
|
import { h, } from "@stencil/core";
|
|
3
4
|
/**
|
|
4
5
|
* @slot children - This is a default/unnamed slot
|
|
@@ -8,8 +9,14 @@ export class DBRadio {
|
|
|
8
9
|
constructor() {
|
|
9
10
|
this.initialized = false;
|
|
10
11
|
this._id = undefined;
|
|
12
|
+
this.abortController = undefined;
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
handleInput(event, reset) {
|
|
15
|
+
if (this.input) {
|
|
16
|
+
this.input.emit(event);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
handleChange(event, reset) {
|
|
13
20
|
if (this.change) {
|
|
14
21
|
this.change.emit(event);
|
|
15
22
|
}
|
|
@@ -64,17 +71,47 @@ export class DBRadio {
|
|
|
64
71
|
watch0() {
|
|
65
72
|
this.watch0Fn();
|
|
66
73
|
}
|
|
74
|
+
watch1Fn() {
|
|
75
|
+
if (this._ref) {
|
|
76
|
+
const defaultChecked = undefined;
|
|
77
|
+
let controller = this.abortController;
|
|
78
|
+
if (!controller) {
|
|
79
|
+
controller = new AbortController();
|
|
80
|
+
this.abortController = controller;
|
|
81
|
+
}
|
|
82
|
+
addResetEventListener(this._ref, (event) => {
|
|
83
|
+
void delay(() => {
|
|
84
|
+
const resetChecked = this.checked
|
|
85
|
+
? this.checked
|
|
86
|
+
: defaultChecked
|
|
87
|
+
? defaultChecked
|
|
88
|
+
: this._ref.checked;
|
|
89
|
+
const valueEvent = Object.assign(Object.assign({}, event), { target: Object.assign(Object.assign({}, event.target), { value: "", checked: resetChecked }) });
|
|
90
|
+
this.handleChange(valueEvent, true);
|
|
91
|
+
this.handleInput(valueEvent, true);
|
|
92
|
+
}, 1);
|
|
93
|
+
}, controller.signal);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
watch1() {
|
|
97
|
+
this.watch1Fn();
|
|
98
|
+
}
|
|
67
99
|
componentDidLoad() {
|
|
68
100
|
var _a;
|
|
69
101
|
this.enableAttributePassing(this._ref, "db-radio");
|
|
70
102
|
this.initialized = true;
|
|
71
103
|
this._id = (_a = this.id) !== null && _a !== void 0 ? _a : `radio-${uuid()}`;
|
|
72
104
|
this.watch0Fn();
|
|
105
|
+
this.watch1Fn();
|
|
106
|
+
}
|
|
107
|
+
disconnectedCallback() {
|
|
108
|
+
var _a;
|
|
109
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
73
110
|
}
|
|
74
111
|
render() {
|
|
75
|
-
return (h("label", { key: '
|
|
112
|
+
return (h("label", { key: '2d573f1bd633fdedf2fde15c11d52cfa8a70b3ef', class: cls("db-radio", this.className), "data-size": this.size, "data-hide-label": getHideProp(this.showLabel), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), htmlFor: this._id }, h("input", { key: 'dd0ae78f833d0cd170824fd38aef50797529557a', type: "radio", "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
76
113
|
this._ref = el;
|
|
77
|
-
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : h("slot", null)));
|
|
114
|
+
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : h("slot", null)));
|
|
78
115
|
}
|
|
79
116
|
static get is() { return "db-radio"; }
|
|
80
117
|
static get properties() {
|
|
@@ -384,11 +421,27 @@ export class DBRadio {
|
|
|
384
421
|
static get states() {
|
|
385
422
|
return {
|
|
386
423
|
"initialized": {},
|
|
387
|
-
"_id": {}
|
|
424
|
+
"_id": {},
|
|
425
|
+
"abortController": {}
|
|
388
426
|
};
|
|
389
427
|
}
|
|
390
428
|
static get events() {
|
|
391
429
|
return [{
|
|
430
|
+
"method": "input",
|
|
431
|
+
"name": "input",
|
|
432
|
+
"bubbles": true,
|
|
433
|
+
"cancelable": true,
|
|
434
|
+
"composed": true,
|
|
435
|
+
"docs": {
|
|
436
|
+
"tags": [],
|
|
437
|
+
"text": ""
|
|
438
|
+
},
|
|
439
|
+
"complexType": {
|
|
440
|
+
"original": "any",
|
|
441
|
+
"resolved": "any",
|
|
442
|
+
"references": {}
|
|
443
|
+
}
|
|
444
|
+
}, {
|
|
392
445
|
"method": "change",
|
|
393
446
|
"name": "change",
|
|
394
447
|
"bubbles": true,
|
|
@@ -445,6 +498,9 @@ export class DBRadio {
|
|
|
445
498
|
}, {
|
|
446
499
|
"propName": "checked",
|
|
447
500
|
"methodName": "watch0"
|
|
501
|
+
}, {
|
|
502
|
+
"propName": "_ref",
|
|
503
|
+
"methodName": "watch1"
|
|
448
504
|
}];
|
|
449
505
|
}
|
|
450
506
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOjE,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,OAAO;IAHnB;QA0BU,gBAAW,GAAG,KAAK,CAAC;QACpB,QAAG,GAAG,SA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport { cls, getBoolean, getHideProp, uuid } from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBRadioProps, DBRadioState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-radio\",\n})\nexport class DBRadio {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBRadioProps[\"id\"];\n @Prop() checked: DBRadioProps[\"checked\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() size: DBRadioProps[\"size\"];\n @Prop() showLabel: DBRadioProps[\"showLabel\"];\n @Prop() showRequiredAsterisk: DBRadioProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBRadioProps[\"className\"];\n @Prop() validation: DBRadioProps[\"validation\"];\n @Prop() name: DBRadioProps[\"name\"];\n @Prop() disabled: DBRadioProps[\"disabled\"];\n @Prop() value: DBRadioProps[\"value\"];\n @Prop() required: DBRadioProps[\"required\"];\n @Prop() label: DBRadioProps[\"label\"];\n @State() initialized = false;\n @State() _id = undefined;\n\n handleChange(event: ChangeEvent<HTMLInputElement> | any) {\n if (this.change) {\n this.change.emit(event);\n }\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n if (this.checked && this.initialized && this._ref) {\n this._ref.checked = true;\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"checked\")\n watch0() {\n this.watch0Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-radio\");\n this.initialized = true;\n this._id = this.id ?? `radio-${uuid()}`;\n this.watch0Fn();\n }\n\n render() {\n return (\n <label\n class={cls(\"db-radio\", this.className)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n htmlFor={this._id}\n >\n <input\n type=\"radio\"\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n name={this.name}\n checked={getBoolean(this.checked, \"checked\")}\n disabled={getBoolean(this.disabled, \"disabled\")}\n value={this.value}\n required={getBoolean(this.required, \"required\")}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EACL,qBAAqB,GAGtB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,OAAO;IAHnB;QA6BU,gBAAW,GAAG,KAAK,CAAC;QACpB,QAAG,GAAG,SAAS,CAAC;QAChB,oBAAe,GAAG,SAAS,CAAC;KA6JtC;IA3JC,WAAW,CAAC,KAA0C,EAAE,KAAe;QACrE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,YAAY,CAAC,KAA0C,EAAE,KAAe;QACtE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,UAAU,CAAC,KAA+C;QACxD,IAAI,IAAI,CAAC,IAAI,EAAE,CA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;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport { cls, delay, getBoolean, getHideProp, uuid } from \"../../utils\";\nimport {\n addResetEventListener,\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBRadioProps, DBRadioState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-radio\",\n})\nexport class DBRadio {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBRadioProps[\"id\"];\n @Prop() checked: DBRadioProps[\"checked\"];\n @Event() input: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() size: DBRadioProps[\"size\"];\n @Prop() showLabel: DBRadioProps[\"showLabel\"];\n @Prop() showRequiredAsterisk: DBRadioProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBRadioProps[\"className\"];\n @Prop() validation: DBRadioProps[\"validation\"];\n @Prop() name: DBRadioProps[\"name\"];\n @Prop() disabled: DBRadioProps[\"disabled\"];\n @Prop() value: DBRadioProps[\"value\"];\n @Prop() required: DBRadioProps[\"required\"];\n @Prop() label: DBRadioProps[\"label\"];\n @State() initialized = false;\n @State() _id = undefined;\n @State() abortController = undefined;\n\n handleInput(event: ChangeEvent<HTMLInputElement> | any, reset?: boolean) {\n if (this.input) {\n this.input.emit(event);\n }\n }\n handleChange(event: ChangeEvent<HTMLInputElement> | any, reset?: boolean) {\n if (this.change) {\n this.change.emit(event);\n }\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n if (this.checked && this.initialized && this._ref) {\n this._ref.checked = true;\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"checked\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._ref) {\n const defaultChecked = undefined;\n let controller = this.abortController;\n if (!controller) {\n controller = new AbortController();\n this.abortController = controller;\n }\n addResetEventListener(\n this._ref,\n (event: Event) => {\n void delay(() => {\n const resetChecked = this.checked\n ? this.checked\n : defaultChecked\n ? defaultChecked\n : this._ref.checked;\n const valueEvent: any = {\n ...event,\n target: {\n ...event.target,\n value: \"\",\n checked: resetChecked,\n },\n };\n this.handleChange(valueEvent, true);\n this.handleInput(valueEvent, true);\n }, 1);\n },\n controller.signal\n );\n }\n }\n\n @Watch(\"_ref\")\n watch1() {\n this.watch1Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-radio\");\n this.initialized = true;\n this._id = this.id ?? `radio-${uuid()}`;\n this.watch0Fn();\n this.watch1Fn();\n }\n disconnectedCallback() {\n this.abortController?.abort();\n }\n\n render() {\n return (\n <label\n class={cls(\"db-radio\", this.className)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n htmlFor={this._id}\n >\n <input\n type=\"radio\"\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n name={this.name}\n checked={getBoolean(this.checked, \"checked\")}\n disabled={getBoolean(this.disabled, \"disabled\")}\n value={this.value}\n required={getBoolean(this.required, \"required\")}\n onInput={(event) => this.handleInput(event)}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n );\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_LABEL, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_PLACEHOLDER_ID_SUFFIX, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
|
|
2
2
|
import { cls, delay, getBoolean, getBooleanAsString, getHideProp, hasVoiceOver, stringPropVisible, uuid, } from "../../utils";
|
|
3
|
+
import { addValueResetEventListener, } from "../../utils/form-components";
|
|
3
4
|
import { h, Fragment, } from "@stencil/core";
|
|
4
5
|
/**
|
|
5
6
|
* @slot children - This is a default/unnamed slot
|
|
@@ -17,6 +18,7 @@ export class DBSelect {
|
|
|
17
18
|
this._value = "";
|
|
18
19
|
this.initialized = false;
|
|
19
20
|
this._voiceOverFallback = "";
|
|
21
|
+
this.abortController = undefined;
|
|
20
22
|
}
|
|
21
23
|
hasValidState() {
|
|
22
24
|
var _a;
|
|
@@ -60,13 +62,13 @@ export class DBSelect {
|
|
|
60
62
|
this.click.emit(event);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
handleInput(event) {
|
|
65
|
+
handleInput(event, reset) {
|
|
64
66
|
if (this.input) {
|
|
65
67
|
this.input.emit(event);
|
|
66
68
|
}
|
|
67
69
|
this.handleValidation();
|
|
68
70
|
}
|
|
69
|
-
handleChange(event) {
|
|
71
|
+
handleChange(event, reset) {
|
|
70
72
|
if (this.change) {
|
|
71
73
|
this.change.emit(event);
|
|
72
74
|
}
|
|
@@ -158,6 +160,26 @@ export class DBSelect {
|
|
|
158
160
|
watch2() {
|
|
159
161
|
this.watch2Fn();
|
|
160
162
|
}
|
|
163
|
+
watch3Fn() {
|
|
164
|
+
if (this._ref) {
|
|
165
|
+
const defaultValue = undefined;
|
|
166
|
+
let controller = this.abortController;
|
|
167
|
+
if (!controller) {
|
|
168
|
+
controller = new AbortController();
|
|
169
|
+
this.abortController = controller;
|
|
170
|
+
}
|
|
171
|
+
addValueResetEventListener(this._ref, {
|
|
172
|
+
value: this.value,
|
|
173
|
+
defaultValue,
|
|
174
|
+
}, (event) => {
|
|
175
|
+
this.handleChange(event, true);
|
|
176
|
+
this.handleInput(event, true);
|
|
177
|
+
}, controller.signal);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
watch3() {
|
|
181
|
+
this.watch3Fn();
|
|
182
|
+
}
|
|
161
183
|
componentDidLoad() {
|
|
162
184
|
var _a;
|
|
163
185
|
this.enableAttributePassing(this._ref, "db-select");
|
|
@@ -172,17 +194,22 @@ export class DBSelect {
|
|
|
172
194
|
this.watch0Fn();
|
|
173
195
|
this.watch1Fn();
|
|
174
196
|
this.watch2Fn();
|
|
197
|
+
this.watch3Fn();
|
|
198
|
+
}
|
|
199
|
+
disconnectedCallback() {
|
|
200
|
+
var _a;
|
|
201
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
175
202
|
}
|
|
176
203
|
render() {
|
|
177
204
|
var _a, _b, _c, _d, _e;
|
|
178
|
-
return (h("div", { key: '
|
|
205
|
+
return (h("div", { key: '6f0b33fa59eabb7891532225ec76bec1156c4fad', class: cls("db-select", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon) }, h("label", { key: 'bc79488892bd8983ff118f0ea5aa1946a9cb64c0', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("select", { key: '757d18a1e4ca479094c74e072538f2c5ff165a20', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
179
206
|
this._ref = el;
|
|
180
207
|
}, required: getBoolean(this.required, "required"), disabled: getBoolean(this.disabled, "disabled"), id: this._id, name: this.name, size: this.size,
|
|
181
208
|
/* @ts-ignore */
|
|
182
209
|
value: (_b = this.value) !== null && _b !== void 0 ? _b : this._value, autocomplete: this.autocomplete, multiple: this.multiple, onInput: (event) => this.handleInput(event), onClick: (event) => this.handleClick(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_c = this.ariaDescribedBy) !== null && _c !== void 0 ? _c : this._descByIds }, this.variant === "floating" || this.placeholder ? (h("option", { class: "placeholder", value: "" })) : null, ((_d = this.options) === null || _d === void 0 ? void 0 : _d.length) ? ((_e = this.options) === null || _e === void 0 ? void 0 : _e.map((option) => {
|
|
183
210
|
var _a;
|
|
184
211
|
return (h(Fragment, null, option.options ? (h("optgroup", { label: this.getOptionLabel(option), key: undefined }, (_a = option.options) === null || _a === void 0 ? void 0 : _a.map((optgroupOption) => (h("option", { value: optgroupOption.value, selected: optgroupOption.selected, disabled: optgroupOption.disabled, key: undefined }, this.getOptionLabel(optgroupOption)))))) : (h("option", { value: option.value, disabled: option.disabled, selected: option.selected, key: undefined }, this.getOptionLabel(option)))));
|
|
185
|
-
})) : (h("slot", null))), this.placeholder ? (h("span", { class: "db-select-placeholder", id: this._placeholderId }, this.placeholder)) : null, stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '
|
|
212
|
+
})) : (h("slot", null))), this.placeholder ? (h("span", { class: "db-select-placeholder", id: this._placeholderId }, this.placeholder)) : null, stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '9090d9710df91b2ba2ead2ff1db38e3feb7385ad', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '0989f2ea0636fb0e1b25d85a2a5cc057df89f38d', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
186
213
|
}
|
|
187
214
|
static get is() { return "db-select"; }
|
|
188
215
|
static get properties() {
|
|
@@ -798,7 +825,8 @@ export class DBSelect {
|
|
|
798
825
|
"_descByIds": {},
|
|
799
826
|
"_value": {},
|
|
800
827
|
"initialized": {},
|
|
801
|
-
"_voiceOverFallback": {}
|
|
828
|
+
"_voiceOverFallback": {},
|
|
829
|
+
"abortController": {}
|
|
802
830
|
};
|
|
803
831
|
}
|
|
804
832
|
static get events() {
|
|
@@ -895,6 +923,9 @@ export class DBSelect {
|
|
|
895
923
|
}, {
|
|
896
924
|
"propName": "value",
|
|
897
925
|
"methodName": "watch2"
|
|
926
|
+
}, {
|
|
927
|
+
"propName": "_ref",
|
|
928
|
+
"methodName": "watch3"
|
|
898
929
|
}];
|
|
899
930
|
}
|
|
900
931
|
}
|