@scania/tegel 1.23.0-fix-form-components-slider-reset-beta.2 → 1.23.0-value-prop.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-checkbox.cjs.entry.js +9 -2
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +146 -158
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +19 -3
- package/dist/collection/components/dropdown/dropdown.js +218 -208
- package/dist/components/{p-2523819c.js → p-097af62b.js} +153 -163
- package/dist/components/{p-e4d7c655.js → p-d921fe75.js} +10 -3
- package/dist/components/{p-462b77e8.js → p-e7868876.js} +1 -1
- package/dist/components/tds-checkbox.js +1 -1
- package/dist/components/tds-dropdown-option.js +1 -1
- package/dist/components/tds-dropdown.js +1 -1
- package/dist/components/tds-table-body-row.js +1 -1
- package/dist/components/tds-table-footer.js +3 -3
- package/dist/components/tds-table-header.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-checkbox.entry.js +9 -2
- package/dist/esm/tds-dropdown_2.entry.js +146 -158
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-6a52ed63.entry.js +1 -0
- package/dist/tegel/p-a0925278.entry.js +1 -0
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/dropdown/dropdown.d.ts +23 -36
- package/dist/types/components.d.ts +21 -11
- package/package.json +1 -1
- package/dist/tegel/p-979f5255.entry.js +0 -1
- package/dist/tegel/p-a464920f.entry.js +0 -1
|
@@ -7,6 +7,13 @@ import appendHiddenInput from "../../utils/appendHiddenInput";
|
|
|
7
7
|
*/
|
|
8
8
|
export class TdsDropdown {
|
|
9
9
|
constructor() {
|
|
10
|
+
this.handleChange = () => {
|
|
11
|
+
const value = Array.isArray(this.value) ? this.value.join(',') : this.value;
|
|
12
|
+
this.tdsChange.emit({
|
|
13
|
+
name: this.name,
|
|
14
|
+
value: value !== null && value !== void 0 ? value : null,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
10
17
|
this.setDefaultOption = () => {
|
|
11
18
|
if (this.defaultValue) {
|
|
12
19
|
const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
@@ -35,7 +42,6 @@ export class TdsDropdown {
|
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
};
|
|
38
|
-
/* Returns a list of all children that are tds-dropdown-option elements */
|
|
39
45
|
this.getChildren = () => {
|
|
40
46
|
const tdsDropdownOptions = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
41
47
|
if (tdsDropdownOptions.length === 0) {
|
|
@@ -44,6 +50,38 @@ export class TdsDropdown {
|
|
|
44
50
|
else
|
|
45
51
|
return tdsDropdownOptions;
|
|
46
52
|
};
|
|
53
|
+
this.getSelectedChildren = () => {
|
|
54
|
+
if (!this.value)
|
|
55
|
+
return [];
|
|
56
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
57
|
+
return valueArray
|
|
58
|
+
.map((stringValue) => {
|
|
59
|
+
const matchingElement = this.getChildren().find((element) => element.value === stringValue);
|
|
60
|
+
return matchingElement;
|
|
61
|
+
})
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
};
|
|
64
|
+
this.getSelectedChildrenLabels = () => {
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
|
|
67
|
+
};
|
|
68
|
+
this.getValue = () => {
|
|
69
|
+
const labels = this.getSelectedChildrenLabels();
|
|
70
|
+
if (!labels) {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
return labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
74
|
+
};
|
|
75
|
+
this.setValueAttribute = () => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
|
|
78
|
+
this.host.removeAttribute('value');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
82
|
+
this.host.setAttribute('value', valueArray.map((val) => val).toString());
|
|
83
|
+
}
|
|
84
|
+
};
|
|
47
85
|
this.getOpenDirection = () => {
|
|
48
86
|
var _a, _b, _c, _d, _e;
|
|
49
87
|
if (this.openDirection === 'auto' || !this.openDirection) {
|
|
@@ -57,7 +95,6 @@ export class TdsDropdown {
|
|
|
57
95
|
}
|
|
58
96
|
return this.openDirection;
|
|
59
97
|
};
|
|
60
|
-
/* Toggles the open state of the Dropdown and sets focus to the input element */
|
|
61
98
|
this.handleToggleOpen = () => {
|
|
62
99
|
if (!this.disabled) {
|
|
63
100
|
this.open = !this.open;
|
|
@@ -66,38 +103,10 @@ export class TdsDropdown {
|
|
|
66
103
|
}
|
|
67
104
|
}
|
|
68
105
|
};
|
|
69
|
-
/* Focuses the input element in the Dropdown, if the reference is present. */
|
|
70
106
|
this.focusInputElement = () => {
|
|
71
107
|
if (this.inputElement)
|
|
72
108
|
this.inputElement.focus();
|
|
73
109
|
};
|
|
74
|
-
this.getSelectedChildren = () => {
|
|
75
|
-
var _a;
|
|
76
|
-
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((stringValue) => {
|
|
77
|
-
const matchingElement = this.getChildren().find((element) => element.value === stringValue);
|
|
78
|
-
return matchingElement;
|
|
79
|
-
}).filter(Boolean);
|
|
80
|
-
};
|
|
81
|
-
this.getSelectedChildrenLabels = () => {
|
|
82
|
-
var _a;
|
|
83
|
-
return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
|
|
84
|
-
};
|
|
85
|
-
this.getValue = () => {
|
|
86
|
-
const labels = this.getSelectedChildrenLabels();
|
|
87
|
-
if (!labels) {
|
|
88
|
-
return '';
|
|
89
|
-
}
|
|
90
|
-
return labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
91
|
-
};
|
|
92
|
-
this.setValueAttribute = () => {
|
|
93
|
-
var _a;
|
|
94
|
-
if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
|
|
95
|
-
this.host.removeAttribute('value');
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
this.host.setAttribute('value', this.value.map((val) => val).toString());
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
110
|
this.handleFilter = (event) => {
|
|
102
111
|
this.tdsInput.emit(event);
|
|
103
112
|
const query = event.target.value.toLowerCase();
|
|
@@ -143,12 +152,11 @@ export class TdsDropdown {
|
|
|
143
152
|
this.handleBlur = (event) => {
|
|
144
153
|
this.tdsBlur.emit(event);
|
|
145
154
|
};
|
|
146
|
-
this.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
155
|
+
this.resetInput = () => {
|
|
156
|
+
const inputEl = this.host.querySelector('input');
|
|
157
|
+
if (inputEl) {
|
|
158
|
+
this.reset();
|
|
159
|
+
}
|
|
152
160
|
};
|
|
153
161
|
this.name = undefined;
|
|
154
162
|
this.disabled = false;
|
|
@@ -166,107 +174,93 @@ export class TdsDropdown {
|
|
|
166
174
|
this.normalizeText = true;
|
|
167
175
|
this.noResultText = 'No result';
|
|
168
176
|
this.defaultValue = undefined;
|
|
169
|
-
this.open = false;
|
|
170
177
|
this.value = undefined;
|
|
178
|
+
this.open = false;
|
|
179
|
+
this.internalValue = undefined;
|
|
171
180
|
this.filterResult = undefined;
|
|
172
181
|
this.filterFocus = undefined;
|
|
173
182
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* <code>
|
|
190
|
-
* dropdown.setValue('option-1', 'Option 1');
|
|
191
|
-
* </code>
|
|
192
|
-
*
|
|
193
|
-
* Multiselect example:
|
|
194
|
-
*
|
|
195
|
-
* <code>
|
|
196
|
-
* dropdown.setValue(['option-1', 'option-2']);
|
|
197
|
-
* </code>
|
|
198
|
-
*/
|
|
199
|
-
// The label is optional here ONLY to not break the API. Should be removed for 2.0.
|
|
200
|
-
// @ts-ignore
|
|
201
|
-
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
202
|
-
async setValue(value, label) {
|
|
203
|
-
let nextValue;
|
|
204
|
-
if (typeof value === 'string')
|
|
205
|
-
nextValue = [value];
|
|
206
|
-
else
|
|
207
|
-
nextValue = value;
|
|
208
|
-
if (!this.multiselect && nextValue.length > 1) {
|
|
209
|
-
console.warn('Tried to select multiple items, but multiselect is not enabled.');
|
|
210
|
-
nextValue = [nextValue[0]];
|
|
183
|
+
handleValueChange(newValue) {
|
|
184
|
+
// Convert both newValue and this.value to arrays for comparison
|
|
185
|
+
const newValueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : [];
|
|
186
|
+
const currentValueArray = Array.isArray(this.value)
|
|
187
|
+
? this.value
|
|
188
|
+
: this.value
|
|
189
|
+
? [this.value]
|
|
190
|
+
: [];
|
|
191
|
+
// Check if the new value is different from the current value
|
|
192
|
+
const hasChanged = newValueArray.length !== currentValueArray.length ||
|
|
193
|
+
newValueArray.some((val, index) => val !== currentValueArray[index]);
|
|
194
|
+
if (hasChanged) {
|
|
195
|
+
// Proceed with updating selections and emitting changes
|
|
196
|
+
this.updateSelections(newValueArray);
|
|
197
|
+
this.handleChange();
|
|
211
198
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
199
|
+
}
|
|
200
|
+
updateSelections(valueArray) {
|
|
201
|
+
// Reset current selections
|
|
202
|
+
this.getChildren().forEach((element) => {
|
|
203
|
+
element.setSelected(false);
|
|
204
|
+
});
|
|
205
|
+
if (valueArray) {
|
|
206
|
+
// Validate and filter values
|
|
207
|
+
const validValues = valueArray.filter((val) => {
|
|
208
|
+
const optionExists = this.getChildren().some((element) => element.value === val);
|
|
209
|
+
if (!optionExists) {
|
|
210
|
+
console.warn(`Option with value "${val}" does not exist`);
|
|
211
|
+
}
|
|
212
|
+
return optionExists;
|
|
213
|
+
});
|
|
214
|
+
// Update internal state and selections
|
|
215
|
+
this.internalValue = validValues.join(', ');
|
|
216
|
+
this.getChildren().forEach((element) => {
|
|
217
|
+
if (validValues.includes(element.value)) {
|
|
218
|
+
element.setSelected(true);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
// Update value prop with validated values
|
|
222
|
+
if (this.multiselect) {
|
|
223
|
+
this.value = validValues;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
this.value = validValues[0] || null;
|
|
218
227
|
}
|
|
219
228
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
229
|
+
else {
|
|
230
|
+
// Handle null/undefined case
|
|
231
|
+
this.internalValue = '';
|
|
232
|
+
this.value = this.multiselect ? [] : null;
|
|
233
|
+
}
|
|
234
|
+
// Emit change events
|
|
223
235
|
this.handleChange();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
236
|
+
// Update filter input if present
|
|
237
|
+
if (this.filter && this.inputElement) {
|
|
238
|
+
this.inputElement.value = this.internalValue;
|
|
239
|
+
}
|
|
240
|
+
this.setValueAttribute();
|
|
241
|
+
}
|
|
242
|
+
async setValue(value) {
|
|
243
|
+
this.value = value;
|
|
244
|
+
return this.getSelectedChildren().map((element) => ({
|
|
227
245
|
value: element.value,
|
|
228
246
|
label: element.textContent.trim(),
|
|
229
247
|
}));
|
|
230
|
-
// Update inputElement value and placeholder text
|
|
231
|
-
if (this.filter) {
|
|
232
|
-
this.inputElement.value = this.getValue();
|
|
233
|
-
}
|
|
234
|
-
return selection;
|
|
235
248
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
*/
|
|
239
|
-
async appendValue(value) {
|
|
240
|
-
if (this.multiselect && this.value) {
|
|
241
|
-
this.setValue([...this.value, value]);
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
this.setValue(value);
|
|
245
|
-
}
|
|
249
|
+
async reset() {
|
|
250
|
+
this.value = this.multiselect ? [] : null;
|
|
246
251
|
}
|
|
247
|
-
/** Method for removing a selected value in the Dropdown. */
|
|
248
252
|
async removeValue(oldValue) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (this.multiselect) {
|
|
252
|
-
(_a = this.getChildren()) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
253
|
-
var _a;
|
|
254
|
-
if (element.value === oldValue) {
|
|
255
|
-
this.value = (_a = this.value) === null || _a === void 0 ? void 0 : _a.filter((value) => value !== element.value);
|
|
256
|
-
label = element.textContent.trim();
|
|
257
|
-
element.setSelected(false);
|
|
258
|
-
}
|
|
259
|
-
return element;
|
|
260
|
-
});
|
|
253
|
+
if (this.multiselect && Array.isArray(this.value)) {
|
|
254
|
+
this.value = this.value.filter((v) => v !== oldValue);
|
|
261
255
|
}
|
|
262
256
|
else {
|
|
263
|
-
this.
|
|
257
|
+
this.value = null;
|
|
264
258
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
259
|
+
}
|
|
260
|
+
/** Method that forces focus on the input element. */
|
|
261
|
+
async focusElement() {
|
|
262
|
+
this.focusInputElement();
|
|
263
|
+
this.handleFocus({});
|
|
270
264
|
}
|
|
271
265
|
/** Method for closing the Dropdown. */
|
|
272
266
|
async close() {
|
|
@@ -320,6 +314,9 @@ export class TdsDropdown {
|
|
|
320
314
|
}
|
|
321
315
|
}
|
|
322
316
|
componentWillLoad() {
|
|
317
|
+
if (this.defaultValue && !this.value) {
|
|
318
|
+
this.value = this.defaultValue;
|
|
319
|
+
}
|
|
323
320
|
this.setDefaultOption();
|
|
324
321
|
}
|
|
325
322
|
/** Method to handle slot changes */
|
|
@@ -330,34 +327,31 @@ export class TdsDropdown {
|
|
|
330
327
|
normalizeString(text) {
|
|
331
328
|
return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
|
|
332
329
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
this.setValueAttribute();
|
|
330
|
+
async appendValue(value) {
|
|
331
|
+
if (this.multiselect) {
|
|
332
|
+
this.value = Array.isArray(this.value) ? [...this.value, value] : [value];
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
this.value = value;
|
|
336
|
+
}
|
|
341
337
|
}
|
|
342
|
-
|
|
343
|
-
this.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
});
|
|
338
|
+
componentDidRender() {
|
|
339
|
+
const form = this.host.closest('form');
|
|
340
|
+
if (form) {
|
|
341
|
+
form.addEventListener('reset', this.resetInput);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
disconnectedCallback() {
|
|
345
|
+
const form = this.host.closest('form');
|
|
346
|
+
if (form) {
|
|
347
|
+
form.removeEventListener('reset', this.resetInput);
|
|
348
|
+
}
|
|
356
349
|
}
|
|
357
350
|
render() {
|
|
358
|
-
var _a, _b, _c
|
|
359
|
-
|
|
360
|
-
|
|
351
|
+
var _a, _b, _c;
|
|
352
|
+
const valueArray = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
|
|
353
|
+
appendHiddenInput(this.host, this.name, valueArray.map((value) => value).toString(), this.disabled);
|
|
354
|
+
return (h(Host, { key: '65dc50a4788d2fdade55db41bfc6cdfcad76b7d5', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '389e82159e7756782fc12af15d7efb43d8cfeafb', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'e7e4585e630ebbab3ae178bbe7b0d3eb0793ba60', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
361
355
|
filter: true,
|
|
362
356
|
focus: this.filterFocus,
|
|
363
357
|
disabled: this.disabled,
|
|
@@ -365,7 +359,7 @@ export class TdsDropdown {
|
|
|
365
359
|
} }, h("div", { class: "value-wrapper" }, this.label && this.labelPosition === 'inside' && this.placeholder && (h("div", { class: `label-inside ${this.size}` }, this.label)), this.label && this.labelPosition === 'inside' && !this.placeholder && (h("div", { class: `
|
|
366
360
|
label-inside-as-placeholder
|
|
367
361
|
${this.size}
|
|
368
|
-
${((
|
|
362
|
+
${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
|
|
369
363
|
` }, this.label)), h("input", {
|
|
370
364
|
// eslint-disable-next-line no-return-assign
|
|
371
365
|
ref: (inputEl) => (this.inputElement = inputEl), class: `${this.labelPosition === 'inside' ? 'placeholder' : ''}`, type: "text", placeholder: this.filterFocus ? '' : this.placeholder, value: this.multiselect && this.filterFocus ? '' : this.getValue(), disabled: this.disabled, onInput: (event) => this.handleFilter(event), onBlur: (event) => {
|
|
@@ -374,15 +368,7 @@ export class TdsDropdown {
|
|
|
374
368
|
this.inputElement.value = this.getValue();
|
|
375
369
|
}
|
|
376
370
|
this.handleBlur(event);
|
|
377
|
-
}, onFocus: (event) => {
|
|
378
|
-
this.open = true;
|
|
379
|
-
this.filterFocus = true;
|
|
380
|
-
if (this.multiselect) {
|
|
381
|
-
this.inputElement.value = '';
|
|
382
|
-
}
|
|
383
|
-
this.handleFocus(event);
|
|
384
|
-
this.handleFilter({ target: { value: '' } });
|
|
385
|
-
}, onKeyDown: (event) => {
|
|
371
|
+
}, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
|
|
386
372
|
if (event.key === 'Escape') {
|
|
387
373
|
this.open = false;
|
|
388
374
|
}
|
|
@@ -406,8 +392,8 @@ export class TdsDropdown {
|
|
|
406
392
|
`, disabled: this.disabled }, h("div", { class: `value-wrapper ${this.size}` }, this.label && this.labelPosition === 'inside' && this.placeholder && (h("div", { class: `label-inside ${this.size}` }, this.label)), this.label && this.labelPosition === 'inside' && !this.placeholder && (h("div", { class: `
|
|
407
393
|
label-inside-as-placeholder
|
|
408
394
|
${this.size}
|
|
409
|
-
${((
|
|
410
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((
|
|
395
|
+
${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
|
|
396
|
+
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) ? this.getValue() : this.placeholder), h("tds-icon", { "aria-label": "Open/Close dropdown", svgTitle: "Open/Close dropdown", class: `menu-icon ${this.open ? 'open' : 'closed'}`, name: "chevron_down", size: "16px" }))))), h("div", { key: 'c79561725649f2cda46d13e7290ec0ea698f930e', ref: (element) => (this.dropdownList = element), class: {
|
|
411
397
|
'dropdown-list': true,
|
|
412
398
|
[this.size]: true,
|
|
413
399
|
[this.getOpenDirection()]: true,
|
|
@@ -416,7 +402,7 @@ export class TdsDropdown {
|
|
|
416
402
|
'closed': !this.open,
|
|
417
403
|
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
418
404
|
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
419
|
-
} }, h("slot", { key: '
|
|
405
|
+
} }, h("slot", { key: '958aa0e620a825c8d20ec4cfeae334c3c59e85dc', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '8138e3340cd62d46ea8938b2d9f0609c03951a1f', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: '3e7a1e9e8520eadc5b805d5512c6fbe177d69755', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: '882c2152620d7d7c2ad576db12ecd65d04446600', name: "error", size: "16px" }), this.helper))));
|
|
420
406
|
}
|
|
421
407
|
static get is() { return "tds-dropdown"; }
|
|
422
408
|
static get encapsulation() { return "shadow"; }
|
|
@@ -713,13 +699,30 @@ export class TdsDropdown {
|
|
|
713
699
|
},
|
|
714
700
|
"attribute": "default-value",
|
|
715
701
|
"reflect": false
|
|
702
|
+
},
|
|
703
|
+
"value": {
|
|
704
|
+
"type": "string",
|
|
705
|
+
"mutable": true,
|
|
706
|
+
"complexType": {
|
|
707
|
+
"original": "string | string[]",
|
|
708
|
+
"resolved": "string | string[]",
|
|
709
|
+
"references": {}
|
|
710
|
+
},
|
|
711
|
+
"required": false,
|
|
712
|
+
"optional": false,
|
|
713
|
+
"docs": {
|
|
714
|
+
"tags": [],
|
|
715
|
+
"text": "Value of the dropdown. For multiselect, provide array of strings. For single select, provide a string."
|
|
716
|
+
},
|
|
717
|
+
"attribute": "value",
|
|
718
|
+
"reflect": false
|
|
716
719
|
}
|
|
717
720
|
};
|
|
718
721
|
}
|
|
719
722
|
static get states() {
|
|
720
723
|
return {
|
|
721
724
|
"open": {},
|
|
722
|
-
"
|
|
725
|
+
"internalValue": {},
|
|
723
726
|
"filterResult": {},
|
|
724
727
|
"filterFocus": {}
|
|
725
728
|
};
|
|
@@ -800,28 +803,51 @@ export class TdsDropdown {
|
|
|
800
803
|
}
|
|
801
804
|
}
|
|
802
805
|
}
|
|
806
|
+
}, {
|
|
807
|
+
"method": "tdsValueChange",
|
|
808
|
+
"name": "tdsValueChange",
|
|
809
|
+
"bubbles": true,
|
|
810
|
+
"cancelable": false,
|
|
811
|
+
"composed": true,
|
|
812
|
+
"docs": {
|
|
813
|
+
"tags": [],
|
|
814
|
+
"text": "Value change event for the Dropdown."
|
|
815
|
+
},
|
|
816
|
+
"complexType": {
|
|
817
|
+
"original": "{\n name: string;\n value: string;\n }",
|
|
818
|
+
"resolved": "{ name: string; value: string; }",
|
|
819
|
+
"references": {}
|
|
820
|
+
}
|
|
803
821
|
}];
|
|
804
822
|
}
|
|
805
823
|
static get methods() {
|
|
806
824
|
return {
|
|
807
|
-
"
|
|
825
|
+
"setValue": {
|
|
808
826
|
"complexType": {
|
|
809
|
-
"signature": "() => Promise<
|
|
810
|
-
"parameters": [
|
|
827
|
+
"signature": "(value: string | string[]) => Promise<{ value: string; label: string; }[]>",
|
|
828
|
+
"parameters": [{
|
|
829
|
+
"name": "value",
|
|
830
|
+
"type": "string | string[]",
|
|
831
|
+
"docs": ""
|
|
832
|
+
}],
|
|
811
833
|
"references": {
|
|
812
834
|
"Promise": {
|
|
813
835
|
"location": "global",
|
|
814
836
|
"id": "global::Promise"
|
|
837
|
+
},
|
|
838
|
+
"HTMLTdsDropdownOptionElement": {
|
|
839
|
+
"location": "global",
|
|
840
|
+
"id": "global::HTMLTdsDropdownOptionElement"
|
|
815
841
|
}
|
|
816
842
|
},
|
|
817
|
-
"return": "Promise<
|
|
843
|
+
"return": "Promise<{ value: string; label: string; }[]>"
|
|
818
844
|
},
|
|
819
845
|
"docs": {
|
|
820
|
-
"text": "
|
|
846
|
+
"text": "",
|
|
821
847
|
"tags": []
|
|
822
848
|
}
|
|
823
849
|
},
|
|
824
|
-
"
|
|
850
|
+
"reset": {
|
|
825
851
|
"complexType": {
|
|
826
852
|
"signature": "() => Promise<void>",
|
|
827
853
|
"parameters": [],
|
|
@@ -834,19 +860,15 @@ export class TdsDropdown {
|
|
|
834
860
|
"return": "Promise<void>"
|
|
835
861
|
},
|
|
836
862
|
"docs": {
|
|
837
|
-
"text": "
|
|
863
|
+
"text": "",
|
|
838
864
|
"tags": []
|
|
839
865
|
}
|
|
840
866
|
},
|
|
841
|
-
"
|
|
867
|
+
"removeValue": {
|
|
842
868
|
"complexType": {
|
|
843
|
-
"signature": "(
|
|
869
|
+
"signature": "(oldValue: string) => Promise<void>",
|
|
844
870
|
"parameters": [{
|
|
845
|
-
"name": "
|
|
846
|
-
"type": "string | string[]",
|
|
847
|
-
"docs": ""
|
|
848
|
-
}, {
|
|
849
|
-
"name": "label",
|
|
871
|
+
"name": "oldValue",
|
|
850
872
|
"type": "string",
|
|
851
873
|
"docs": ""
|
|
852
874
|
}],
|
|
@@ -854,27 +876,19 @@ export class TdsDropdown {
|
|
|
854
876
|
"Promise": {
|
|
855
877
|
"location": "global",
|
|
856
878
|
"id": "global::Promise"
|
|
857
|
-
},
|
|
858
|
-
"HTMLTdsDropdownOptionElement": {
|
|
859
|
-
"location": "global",
|
|
860
|
-
"id": "global::HTMLTdsDropdownOptionElement"
|
|
861
879
|
}
|
|
862
880
|
},
|
|
863
|
-
"return": "Promise<
|
|
881
|
+
"return": "Promise<void>"
|
|
864
882
|
},
|
|
865
883
|
"docs": {
|
|
866
|
-
"text": "
|
|
884
|
+
"text": "",
|
|
867
885
|
"tags": []
|
|
868
886
|
}
|
|
869
887
|
},
|
|
870
|
-
"
|
|
888
|
+
"focusElement": {
|
|
871
889
|
"complexType": {
|
|
872
|
-
"signature": "(
|
|
873
|
-
"parameters": [
|
|
874
|
-
"name": "value",
|
|
875
|
-
"type": "string",
|
|
876
|
-
"docs": ""
|
|
877
|
-
}],
|
|
890
|
+
"signature": "() => Promise<void>",
|
|
891
|
+
"parameters": [],
|
|
878
892
|
"references": {
|
|
879
893
|
"Promise": {
|
|
880
894
|
"location": "global",
|
|
@@ -884,42 +898,35 @@ export class TdsDropdown {
|
|
|
884
898
|
"return": "Promise<void>"
|
|
885
899
|
},
|
|
886
900
|
"docs": {
|
|
887
|
-
"text": "",
|
|
888
|
-
"tags": [
|
|
889
|
-
"name": "internal",
|
|
890
|
-
"text": undefined
|
|
891
|
-
}]
|
|
901
|
+
"text": "Method that forces focus on the input element.",
|
|
902
|
+
"tags": []
|
|
892
903
|
}
|
|
893
904
|
},
|
|
894
|
-
"
|
|
905
|
+
"close": {
|
|
895
906
|
"complexType": {
|
|
896
|
-
"signature": "(
|
|
897
|
-
"parameters": [
|
|
898
|
-
"name": "oldValue",
|
|
899
|
-
"type": "string",
|
|
900
|
-
"docs": ""
|
|
901
|
-
}],
|
|
907
|
+
"signature": "() => Promise<void>",
|
|
908
|
+
"parameters": [],
|
|
902
909
|
"references": {
|
|
903
910
|
"Promise": {
|
|
904
911
|
"location": "global",
|
|
905
912
|
"id": "global::Promise"
|
|
906
|
-
},
|
|
907
|
-
"HTMLTdsDropdownOptionElement": {
|
|
908
|
-
"location": "global",
|
|
909
|
-
"id": "global::HTMLTdsDropdownOptionElement"
|
|
910
913
|
}
|
|
911
914
|
},
|
|
912
|
-
"return": "Promise<
|
|
915
|
+
"return": "Promise<void>"
|
|
913
916
|
},
|
|
914
917
|
"docs": {
|
|
915
|
-
"text": "Method for
|
|
918
|
+
"text": "Method for closing the Dropdown.",
|
|
916
919
|
"tags": []
|
|
917
920
|
}
|
|
918
921
|
},
|
|
919
|
-
"
|
|
922
|
+
"appendValue": {
|
|
920
923
|
"complexType": {
|
|
921
|
-
"signature": "() => Promise<void>",
|
|
922
|
-
"parameters": [
|
|
924
|
+
"signature": "(value: string) => Promise<void>",
|
|
925
|
+
"parameters": [{
|
|
926
|
+
"name": "value",
|
|
927
|
+
"type": "string",
|
|
928
|
+
"docs": ""
|
|
929
|
+
}],
|
|
923
930
|
"references": {
|
|
924
931
|
"Promise": {
|
|
925
932
|
"location": "global",
|
|
@@ -929,7 +936,7 @@ export class TdsDropdown {
|
|
|
929
936
|
"return": "Promise<void>"
|
|
930
937
|
},
|
|
931
938
|
"docs": {
|
|
932
|
-
"text": "
|
|
939
|
+
"text": "",
|
|
933
940
|
"tags": []
|
|
934
941
|
}
|
|
935
942
|
}
|
|
@@ -938,6 +945,9 @@ export class TdsDropdown {
|
|
|
938
945
|
static get elementRef() { return "host"; }
|
|
939
946
|
static get watchers() {
|
|
940
947
|
return [{
|
|
948
|
+
"propName": "value",
|
|
949
|
+
"methodName": "handleValueChange"
|
|
950
|
+
}, {
|
|
941
951
|
"propName": "open",
|
|
942
952
|
"methodName": "handleOpenState"
|
|
943
953
|
}];
|