@scania/tegel 1.22.0 → 1.23.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-chip.cjs.entry.js +13 -1
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +128 -159
- package/dist/cjs/tds-header.cjs.entry.js +1 -1
- package/dist/cjs/tds-icon.cjs.entry.js +1 -1
- package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
- package/dist/cjs/tds-slider.cjs.entry.js +18 -14
- package/dist/cjs/tds-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/banner/banner.js +1 -1
- package/dist/collection/components/chip/chip.js +39 -1
- package/dist/collection/components/dropdown/dropdown.js +200 -209
- package/dist/collection/components/header/header.css +4 -0
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/iconsArray.js +26 -1
- package/dist/collection/components/popover-core/tds-popover-core.css +1 -1
- package/dist/collection/components/slider/slider.js +18 -14
- package/dist/collection/components/tooltip/tooltip.css +5 -0
- package/dist/collection/utils/testConfiguration.js +65 -0
- package/dist/components/p-18c1245b.js +65 -0
- package/dist/components/{p-9411c8ea.js → p-462b77e8.js} +1 -1
- package/dist/components/{p-ad93662a.js → p-c48c68b3.js} +1 -1
- package/dist/components/{p-8bc36666.js → p-ca4b945d.js} +136 -165
- package/dist/components/{p-7f87740b.js → p-dcfecf4d.js} +1 -1
- package/dist/components/{p-3191ad55.js → p-e02b091c.js} +1 -1
- package/dist/components/tds-accordion-item.js +1 -1
- package/dist/components/tds-banner.js +1 -1
- package/dist/components/tds-chip.js +14 -2
- package/dist/components/tds-datetime.js +1 -1
- package/dist/components/tds-dropdown-option.js +1 -1
- package/dist/components/tds-dropdown.js +1 -1
- package/dist/components/tds-folder-tabs.js +1 -1
- package/dist/components/tds-footer-group.js +1 -1
- package/dist/components/tds-header-cell.js +1 -1
- package/dist/components/tds-header-dropdown.js +3 -3
- package/dist/components/tds-header-hamburger.js +1 -1
- package/dist/components/tds-header-launcher-button.js +1 -1
- package/dist/components/tds-header-launcher.js +4 -4
- package/dist/components/tds-header.js +1 -1
- package/dist/components/tds-icon.js +1 -1
- package/dist/components/tds-inline-tabs.js +1 -1
- package/dist/components/tds-message.js +1 -1
- package/dist/components/tds-modal.js +1 -1
- package/dist/components/tds-navigation-tabs.js +1 -1
- package/dist/components/tds-popover-canvas.js +1 -1
- package/dist/components/tds-popover-core.js +1 -1
- package/dist/components/tds-popover-menu.js +1 -1
- package/dist/components/tds-side-menu-close-button.js +1 -1
- package/dist/components/tds-side-menu-dropdown.js +1 -1
- package/dist/components/tds-slider.js +19 -15
- package/dist/components/tds-step.js +1 -1
- package/dist/components/tds-table-body-input-wrapper.js +1 -1
- package/dist/components/tds-table-footer.js +3 -3
- package/dist/components/tds-table-header-input-wrapper.js +1 -1
- package/dist/components/tds-table-toolbar.js +1 -1
- package/dist/components/tds-text-field.js +1 -1
- package/dist/components/tds-textarea.js +1 -1
- package/dist/components/tds-toast.js +1 -1
- package/dist/components/tds-tooltip.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-chip.entry.js +13 -1
- package/dist/esm/tds-dropdown_2.entry.js +128 -159
- package/dist/esm/tds-header.entry.js +1 -1
- package/dist/esm/tds-icon.entry.js +1 -1
- package/dist/esm/tds-popover-core.entry.js +1 -1
- package/dist/esm/tds-slider.entry.js +18 -14
- package/dist/esm/tds-tooltip.entry.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/{p-443d8501.entry.js → p-220affa9.entry.js} +1 -1
- package/dist/tegel/{p-89235968.entry.js → p-590b5f55.entry.js} +1 -1
- package/dist/tegel/{p-7cb43ebe.entry.js → p-ac46b0a4.entry.js} +1 -1
- package/dist/tegel/p-e0ce5daa.entry.js +1 -0
- package/dist/tegel/p-e252ba6e.entry.js +1 -0
- package/dist/tegel/p-f91c6e9d.entry.js +1 -0
- package/dist/tegel/p-fc0079d2.entry.js +1 -0
- package/dist/tegel/tegel.css +1 -1
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/chip/chip.d.ts +11 -0
- package/dist/types/components/dropdown/dropdown.d.ts +20 -36
- package/dist/types/components.d.ts +26 -11
- package/dist/types/types/Icons.d.ts +1 -1
- package/dist/types/utils/testConfiguration.d.ts +13 -0
- package/package.json +4 -2
- package/dist/components/p-a32f9097.js +0 -65
- package/dist/tegel/p-07825c63.entry.js +0 -1
- package/dist/tegel/p-85d1ec5b.entry.js +0 -1
- package/dist/tegel/p-c64f2fba.entry.js +0 -1
- package/dist/tegel/p-fe9b385f.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 this.filter ? labels === null || labels === void 0 ? void 0 : labels.join(', ') : labels === null || labels === void 0 ? void 0 : labels.toString();
|
|
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,13 +152,6 @@ export class TdsDropdown {
|
|
|
143
152
|
this.handleBlur = (event) => {
|
|
144
153
|
this.tdsBlur.emit(event);
|
|
145
154
|
};
|
|
146
|
-
this.handleChange = () => {
|
|
147
|
-
var _a, _b;
|
|
148
|
-
this.tdsChange.emit({
|
|
149
|
-
name: this.name,
|
|
150
|
-
value: (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString()) !== null && _b !== void 0 ? _b : null,
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
155
|
this.name = undefined;
|
|
154
156
|
this.disabled = false;
|
|
155
157
|
this.helper = undefined;
|
|
@@ -166,107 +168,92 @@ export class TdsDropdown {
|
|
|
166
168
|
this.normalizeText = true;
|
|
167
169
|
this.noResultText = 'No result';
|
|
168
170
|
this.defaultValue = undefined;
|
|
169
|
-
this.open = false;
|
|
170
171
|
this.value = undefined;
|
|
172
|
+
this.open = false;
|
|
173
|
+
this.internalValue = undefined;
|
|
171
174
|
this.filterResult = undefined;
|
|
172
175
|
this.filterFocus = undefined;
|
|
173
176
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
async focusElement() {
|
|
182
|
-
this.focusInputElement();
|
|
183
|
-
this.handleFocus({});
|
|
184
|
-
}
|
|
185
|
-
/** Method for setting the value of the Dropdown.
|
|
186
|
-
*
|
|
187
|
-
* Single selection example:
|
|
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) {
|
|
177
|
+
handleValueChange(newValue) {
|
|
178
|
+
if (newValue === undefined)
|
|
179
|
+
return;
|
|
180
|
+
// Ensure consistent internal array representation
|
|
181
|
+
const valueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : null;
|
|
182
|
+
// Handle multiselect validation
|
|
183
|
+
if (!this.multiselect && Array.isArray(valueArray) && valueArray.length > 1) {
|
|
209
184
|
console.warn('Tried to select multiple items, but multiselect is not enabled.');
|
|
210
|
-
|
|
185
|
+
// Coerce to single value for non-multiselect
|
|
186
|
+
this.value = valueArray[0];
|
|
187
|
+
return;
|
|
211
188
|
}
|
|
212
|
-
|
|
213
|
-
this.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
189
|
+
// Ensure value is always array internally for backward compatibility
|
|
190
|
+
this.updateSelections(valueArray);
|
|
191
|
+
this.handleChange();
|
|
192
|
+
}
|
|
193
|
+
updateSelections(valueArray) {
|
|
194
|
+
// Reset current selections
|
|
195
|
+
this.getChildren().forEach((element) => {
|
|
196
|
+
element.setSelected(false);
|
|
197
|
+
});
|
|
198
|
+
if (valueArray) {
|
|
199
|
+
// Validate and filter values
|
|
200
|
+
const validValues = valueArray.filter((val) => {
|
|
201
|
+
const optionExists = this.getChildren().some((element) => element.value === val);
|
|
202
|
+
if (!optionExists) {
|
|
203
|
+
console.warn(`Option with value "${val}" does not exist`);
|
|
204
|
+
}
|
|
205
|
+
return optionExists;
|
|
206
|
+
});
|
|
207
|
+
// Update internal state and selections
|
|
208
|
+
this.internalValue = validValues.join(', ');
|
|
209
|
+
this.getChildren().forEach((element) => {
|
|
210
|
+
if (validValues.includes(element.value)) {
|
|
211
|
+
element.setSelected(true);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
// Update value prop with validated values
|
|
215
|
+
if (this.multiselect) {
|
|
216
|
+
this.value = validValues;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
this.value = validValues[0] || null;
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
else {
|
|
223
|
+
// Handle null/undefined case
|
|
224
|
+
this.internalValue = '';
|
|
225
|
+
this.value = this.multiselect ? [] : null;
|
|
226
|
+
}
|
|
227
|
+
// Emit change events
|
|
223
228
|
this.handleChange();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
// Update filter input if present
|
|
230
|
+
if (this.filter && this.inputElement) {
|
|
231
|
+
this.inputElement.value = this.internalValue;
|
|
232
|
+
}
|
|
233
|
+
this.setValueAttribute();
|
|
234
|
+
}
|
|
235
|
+
async setValue(value) {
|
|
236
|
+
this.value = value;
|
|
237
|
+
return this.getSelectedChildren().map((element) => ({
|
|
227
238
|
value: element.value,
|
|
228
239
|
label: element.textContent.trim(),
|
|
229
240
|
}));
|
|
230
|
-
// Update inputElement value and placeholder text
|
|
231
|
-
if (this.filter) {
|
|
232
|
-
this.inputElement.value = this.getValue();
|
|
233
|
-
}
|
|
234
|
-
return selection;
|
|
235
241
|
}
|
|
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
|
-
}
|
|
242
|
+
async reset() {
|
|
243
|
+
this.value = this.multiselect ? [] : null;
|
|
246
244
|
}
|
|
247
|
-
/** Method for removing a selected value in the Dropdown. */
|
|
248
245
|
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
|
-
});
|
|
246
|
+
if (this.multiselect && Array.isArray(this.value)) {
|
|
247
|
+
this.value = this.value.filter((v) => v !== oldValue);
|
|
261
248
|
}
|
|
262
249
|
else {
|
|
263
|
-
this.
|
|
250
|
+
this.value = null;
|
|
264
251
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
252
|
+
}
|
|
253
|
+
/** Method that forces focus on the input element. */
|
|
254
|
+
async focusElement() {
|
|
255
|
+
this.focusInputElement();
|
|
256
|
+
this.handleFocus({});
|
|
270
257
|
}
|
|
271
258
|
/** Method for closing the Dropdown. */
|
|
272
259
|
async close() {
|
|
@@ -320,6 +307,9 @@ export class TdsDropdown {
|
|
|
320
307
|
}
|
|
321
308
|
}
|
|
322
309
|
componentWillLoad() {
|
|
310
|
+
if (this.defaultValue && !this.value) {
|
|
311
|
+
this.value = this.defaultValue;
|
|
312
|
+
}
|
|
323
313
|
this.setDefaultOption();
|
|
324
314
|
}
|
|
325
315
|
/** Method to handle slot changes */
|
|
@@ -330,34 +320,19 @@ export class TdsDropdown {
|
|
|
330
320
|
normalizeString(text) {
|
|
331
321
|
return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
|
|
332
322
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
this.setValueAttribute();
|
|
341
|
-
}
|
|
342
|
-
selectChildrenAsSelectedBasedOnSelectionProp() {
|
|
343
|
-
this.getChildren().forEach((element) => {
|
|
344
|
-
this.value.forEach((selection) => {
|
|
345
|
-
if (element.value !== selection) {
|
|
346
|
-
// If not multiselect, we need to unselect all other options.
|
|
347
|
-
if (!this.multiselect) {
|
|
348
|
-
element.setSelected(false);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
element.setSelected(true);
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
});
|
|
323
|
+
async appendValue(value) {
|
|
324
|
+
if (this.multiselect) {
|
|
325
|
+
this.value = Array.isArray(this.value) ? [...this.value, value] : [value];
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
this.value = value;
|
|
329
|
+
}
|
|
356
330
|
}
|
|
357
331
|
render() {
|
|
358
|
-
var _a, _b, _c
|
|
359
|
-
|
|
360
|
-
|
|
332
|
+
var _a, _b, _c;
|
|
333
|
+
const valueArray = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
|
|
334
|
+
appendHiddenInput(this.host, this.name, valueArray.map((value) => value).toString(), this.disabled);
|
|
335
|
+
return (h(Host, { key: '2d1d0d7551c4f5a3197538a21b245b06abb95a5b', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: '44bf815fc834febcf5bf90aeabeb4ff75ca74e0b', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: 'fe8bddaad6f52c6860a8a3b02db796d927553c64', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
361
336
|
filter: true,
|
|
362
337
|
focus: this.filterFocus,
|
|
363
338
|
disabled: this.disabled,
|
|
@@ -365,7 +340,7 @@ export class TdsDropdown {
|
|
|
365
340
|
} }, 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
341
|
label-inside-as-placeholder
|
|
367
342
|
${this.size}
|
|
368
|
-
${((
|
|
343
|
+
${((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) ? 'selected' : ''}
|
|
369
344
|
` }, this.label)), h("input", {
|
|
370
345
|
// eslint-disable-next-line no-return-assign
|
|
371
346
|
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 +349,7 @@ export class TdsDropdown {
|
|
|
374
349
|
this.inputElement.value = this.getValue();
|
|
375
350
|
}
|
|
376
351
|
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) => {
|
|
352
|
+
}, onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => {
|
|
386
353
|
if (event.key === 'Escape') {
|
|
387
354
|
this.open = false;
|
|
388
355
|
}
|
|
@@ -406,8 +373,8 @@ export class TdsDropdown {
|
|
|
406
373
|
`, 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
374
|
label-inside-as-placeholder
|
|
408
375
|
${this.size}
|
|
409
|
-
${((
|
|
410
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((
|
|
376
|
+
${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
|
|
377
|
+
` }, 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: '5a725e0e42ada175ff588849debe814f4558f907', ref: (element) => (this.dropdownList = element), class: {
|
|
411
378
|
'dropdown-list': true,
|
|
412
379
|
[this.size]: true,
|
|
413
380
|
[this.getOpenDirection()]: true,
|
|
@@ -416,7 +383,7 @@ export class TdsDropdown {
|
|
|
416
383
|
'closed': !this.open,
|
|
417
384
|
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
418
385
|
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
419
|
-
} }, h("slot", { key: '
|
|
386
|
+
} }, h("slot", { key: '7cece8ee2247cf1249719673734408216b1b9ad6', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: 'c8e1bfb413f6247710b34707e6e86e454b04739c', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: '90dcb3ed5268866c95f88bb53a9a066451ebc505', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: 'a216d63de9d7d6011c4bce0ee0b64f6ea90fa4e4', name: "error", size: "16px" }), this.helper))));
|
|
420
387
|
}
|
|
421
388
|
static get is() { return "tds-dropdown"; }
|
|
422
389
|
static get encapsulation() { return "shadow"; }
|
|
@@ -713,13 +680,30 @@ export class TdsDropdown {
|
|
|
713
680
|
},
|
|
714
681
|
"attribute": "default-value",
|
|
715
682
|
"reflect": false
|
|
683
|
+
},
|
|
684
|
+
"value": {
|
|
685
|
+
"type": "string",
|
|
686
|
+
"mutable": true,
|
|
687
|
+
"complexType": {
|
|
688
|
+
"original": "string | string[]",
|
|
689
|
+
"resolved": "string | string[]",
|
|
690
|
+
"references": {}
|
|
691
|
+
},
|
|
692
|
+
"required": false,
|
|
693
|
+
"optional": false,
|
|
694
|
+
"docs": {
|
|
695
|
+
"tags": [],
|
|
696
|
+
"text": "Value of the dropdown. For multiselect, provide array of strings. For single select, provide a string."
|
|
697
|
+
},
|
|
698
|
+
"attribute": "value",
|
|
699
|
+
"reflect": false
|
|
716
700
|
}
|
|
717
701
|
};
|
|
718
702
|
}
|
|
719
703
|
static get states() {
|
|
720
704
|
return {
|
|
721
705
|
"open": {},
|
|
722
|
-
"
|
|
706
|
+
"internalValue": {},
|
|
723
707
|
"filterResult": {},
|
|
724
708
|
"filterFocus": {}
|
|
725
709
|
};
|
|
@@ -800,28 +784,51 @@ export class TdsDropdown {
|
|
|
800
784
|
}
|
|
801
785
|
}
|
|
802
786
|
}
|
|
787
|
+
}, {
|
|
788
|
+
"method": "tdsValueChange",
|
|
789
|
+
"name": "tdsValueChange",
|
|
790
|
+
"bubbles": true,
|
|
791
|
+
"cancelable": false,
|
|
792
|
+
"composed": true,
|
|
793
|
+
"docs": {
|
|
794
|
+
"tags": [],
|
|
795
|
+
"text": "Value change event for the Dropdown."
|
|
796
|
+
},
|
|
797
|
+
"complexType": {
|
|
798
|
+
"original": "{\n name: string;\n value: string;\n }",
|
|
799
|
+
"resolved": "{ name: string; value: string; }",
|
|
800
|
+
"references": {}
|
|
801
|
+
}
|
|
803
802
|
}];
|
|
804
803
|
}
|
|
805
804
|
static get methods() {
|
|
806
805
|
return {
|
|
807
|
-
"
|
|
806
|
+
"setValue": {
|
|
808
807
|
"complexType": {
|
|
809
|
-
"signature": "() => Promise<
|
|
810
|
-
"parameters": [
|
|
808
|
+
"signature": "(value: string | string[]) => Promise<{ value: string; label: string; }[]>",
|
|
809
|
+
"parameters": [{
|
|
810
|
+
"name": "value",
|
|
811
|
+
"type": "string | string[]",
|
|
812
|
+
"docs": ""
|
|
813
|
+
}],
|
|
811
814
|
"references": {
|
|
812
815
|
"Promise": {
|
|
813
816
|
"location": "global",
|
|
814
817
|
"id": "global::Promise"
|
|
818
|
+
},
|
|
819
|
+
"HTMLTdsDropdownOptionElement": {
|
|
820
|
+
"location": "global",
|
|
821
|
+
"id": "global::HTMLTdsDropdownOptionElement"
|
|
815
822
|
}
|
|
816
823
|
},
|
|
817
|
-
"return": "Promise<
|
|
824
|
+
"return": "Promise<{ value: string; label: string; }[]>"
|
|
818
825
|
},
|
|
819
826
|
"docs": {
|
|
820
|
-
"text": "
|
|
827
|
+
"text": "",
|
|
821
828
|
"tags": []
|
|
822
829
|
}
|
|
823
830
|
},
|
|
824
|
-
"
|
|
831
|
+
"reset": {
|
|
825
832
|
"complexType": {
|
|
826
833
|
"signature": "() => Promise<void>",
|
|
827
834
|
"parameters": [],
|
|
@@ -834,19 +841,15 @@ export class TdsDropdown {
|
|
|
834
841
|
"return": "Promise<void>"
|
|
835
842
|
},
|
|
836
843
|
"docs": {
|
|
837
|
-
"text": "
|
|
844
|
+
"text": "",
|
|
838
845
|
"tags": []
|
|
839
846
|
}
|
|
840
847
|
},
|
|
841
|
-
"
|
|
848
|
+
"removeValue": {
|
|
842
849
|
"complexType": {
|
|
843
|
-
"signature": "(
|
|
850
|
+
"signature": "(oldValue: string) => Promise<void>",
|
|
844
851
|
"parameters": [{
|
|
845
|
-
"name": "
|
|
846
|
-
"type": "string | string[]",
|
|
847
|
-
"docs": ""
|
|
848
|
-
}, {
|
|
849
|
-
"name": "label",
|
|
852
|
+
"name": "oldValue",
|
|
850
853
|
"type": "string",
|
|
851
854
|
"docs": ""
|
|
852
855
|
}],
|
|
@@ -854,27 +857,19 @@ export class TdsDropdown {
|
|
|
854
857
|
"Promise": {
|
|
855
858
|
"location": "global",
|
|
856
859
|
"id": "global::Promise"
|
|
857
|
-
},
|
|
858
|
-
"HTMLTdsDropdownOptionElement": {
|
|
859
|
-
"location": "global",
|
|
860
|
-
"id": "global::HTMLTdsDropdownOptionElement"
|
|
861
860
|
}
|
|
862
861
|
},
|
|
863
|
-
"return": "Promise<
|
|
862
|
+
"return": "Promise<void>"
|
|
864
863
|
},
|
|
865
864
|
"docs": {
|
|
866
|
-
"text": "
|
|
865
|
+
"text": "",
|
|
867
866
|
"tags": []
|
|
868
867
|
}
|
|
869
868
|
},
|
|
870
|
-
"
|
|
869
|
+
"focusElement": {
|
|
871
870
|
"complexType": {
|
|
872
|
-
"signature": "(
|
|
873
|
-
"parameters": [
|
|
874
|
-
"name": "value",
|
|
875
|
-
"type": "string",
|
|
876
|
-
"docs": ""
|
|
877
|
-
}],
|
|
871
|
+
"signature": "() => Promise<void>",
|
|
872
|
+
"parameters": [],
|
|
878
873
|
"references": {
|
|
879
874
|
"Promise": {
|
|
880
875
|
"location": "global",
|
|
@@ -884,42 +879,35 @@ export class TdsDropdown {
|
|
|
884
879
|
"return": "Promise<void>"
|
|
885
880
|
},
|
|
886
881
|
"docs": {
|
|
887
|
-
"text": "",
|
|
888
|
-
"tags": [
|
|
889
|
-
"name": "internal",
|
|
890
|
-
"text": undefined
|
|
891
|
-
}]
|
|
882
|
+
"text": "Method that forces focus on the input element.",
|
|
883
|
+
"tags": []
|
|
892
884
|
}
|
|
893
885
|
},
|
|
894
|
-
"
|
|
886
|
+
"close": {
|
|
895
887
|
"complexType": {
|
|
896
|
-
"signature": "(
|
|
897
|
-
"parameters": [
|
|
898
|
-
"name": "oldValue",
|
|
899
|
-
"type": "string",
|
|
900
|
-
"docs": ""
|
|
901
|
-
}],
|
|
888
|
+
"signature": "() => Promise<void>",
|
|
889
|
+
"parameters": [],
|
|
902
890
|
"references": {
|
|
903
891
|
"Promise": {
|
|
904
892
|
"location": "global",
|
|
905
893
|
"id": "global::Promise"
|
|
906
|
-
},
|
|
907
|
-
"HTMLTdsDropdownOptionElement": {
|
|
908
|
-
"location": "global",
|
|
909
|
-
"id": "global::HTMLTdsDropdownOptionElement"
|
|
910
894
|
}
|
|
911
895
|
},
|
|
912
|
-
"return": "Promise<
|
|
896
|
+
"return": "Promise<void>"
|
|
913
897
|
},
|
|
914
898
|
"docs": {
|
|
915
|
-
"text": "Method for
|
|
899
|
+
"text": "Method for closing the Dropdown.",
|
|
916
900
|
"tags": []
|
|
917
901
|
}
|
|
918
902
|
},
|
|
919
|
-
"
|
|
903
|
+
"appendValue": {
|
|
920
904
|
"complexType": {
|
|
921
|
-
"signature": "() => Promise<void>",
|
|
922
|
-
"parameters": [
|
|
905
|
+
"signature": "(value: string) => Promise<void>",
|
|
906
|
+
"parameters": [{
|
|
907
|
+
"name": "value",
|
|
908
|
+
"type": "string",
|
|
909
|
+
"docs": ""
|
|
910
|
+
}],
|
|
923
911
|
"references": {
|
|
924
912
|
"Promise": {
|
|
925
913
|
"location": "global",
|
|
@@ -929,7 +917,7 @@ export class TdsDropdown {
|
|
|
929
917
|
"return": "Promise<void>"
|
|
930
918
|
},
|
|
931
919
|
"docs": {
|
|
932
|
-
"text": "
|
|
920
|
+
"text": "",
|
|
933
921
|
"tags": []
|
|
934
922
|
}
|
|
935
923
|
}
|
|
@@ -938,6 +926,9 @@ export class TdsDropdown {
|
|
|
938
926
|
static get elementRef() { return "host"; }
|
|
939
927
|
static get watchers() {
|
|
940
928
|
return [{
|
|
929
|
+
"propName": "value",
|
|
930
|
+
"methodName": "handleValueChange"
|
|
931
|
+
}, {
|
|
941
932
|
"propName": "open",
|
|
942
933
|
"methodName": "handleOpenState"
|
|
943
934
|
}];
|
|
@@ -49,7 +49,7 @@ export class Icon {
|
|
|
49
49
|
"mutable": false,
|
|
50
50
|
"complexType": {
|
|
51
51
|
"original": "IconNames",
|
|
52
|
-
"resolved": "\"profile\" | \"info\" | \"error\" | \"global\" | \"copy\" | \"document\" | \"link\" | \"image\" | \"download\" | \"history\" | \"print\" | \"arrow_diagonal\" | \"arrow_down\" | \"arrow_left\" | \"arrow_right\" | \"arrow_up\" | \"back\" | \"bento\" | \"burger\" | \"calendar_inactive\" | \"calendar\" | \"card\" | \"cart\" | \"chevron_down\" | \"chevron_left\" | \"chevron_right\" | \"chevron_up\" | \"clock_inactive\" | \"clock\" | \"contact_inactive\" | \"contact\" | \"cross\" | \"dashboard\" | \"document_check\" | \"document_doc\" | \"document_eye\" | \"document_pdf\" | \"document_ppt\" | \"document_tool\" | \"document_wrong\" | \"document_xls\" | \"dollar\" | \"doner\" | \"double_kebab\" | \"edit_inactive\" | \"edit\" | \"email\" | \"export_inactive\" | \"export\" | \"eye_inactive\" | \"eye\" | \"face_dissatisfied\" | \"face_neutral\" | \"face_satisfied\" | \"filters_inactive\" | \"filters\" | \"flash\" | \"folder\" | \"fuel_gauge_inactive\" | \"fuel_gauge\" | \"heart_inactive\" | \"heart\" | \"home_inactive\" | \"home\" | \"image_add\" | \"image_inactive\" | \"image_set\" | \"insights\" | \"kebab\" | \"link_broken\" | \"lock_inactive\" | \"lock\" | \"meatballs\" | \"message_inactive\" | \"message\" | \"mileage_inactive\" | \"mileage\" | \"minus\" | \"notification_inactive\" | \"notification\" | \"phone_inactive\" | \"phone\" | \"pie_chart\" | \"pin_inactive\" | \"pin\" | \"plus\" | \"print_inactive\" | \"profile_inactive\" | \"proportions_inactive\" | \"proportions\" | \"redirect\" | \"refresh\" | \"report_inactive\" | \"report\" | \"save_inactive\" | \"save\" | \"search\" | \"send_inactive\" | \"send\" | \"settings\" | \"share\" | \"skip_backwards\" | \"skip_forward\" | \"smartphone_inactive\" | \"smartphone\" | \"sorting\" | \"speedometer_inactive\" | \"speedometer\" | \"star\" | \"support\" | \"tick\" | \"timer\" | \"tool_inactive\" | \"tool\" | \"trailer\" | \"trash_inactive\" | \"trash\" | \"truck\" | \"upload\" | \"wallet\" | \"warning\" | \"wifi_inactive\" | \"wifi\"",
|
|
52
|
+
"resolved": "\"profile\" | \"expand\" | \"info\" | \"error\" | \"global\" | \"copy\" | \"document\" | \"link\" | \"image\" | \"download\" | \"target\" | \"history\" | \"print\" | \"24v-battery-inactive\" | \"24v-battery\" | \"arrow_diagonal\" | \"arrow_down\" | \"arrow_left\" | \"arrow_right\" | \"arrow_up\" | \"audio-inactive\" | \"back\" | \"backward-inactive\" | \"backward\" | \"bento\" | \"burger\" | \"calendar_inactive\" | \"calendar\" | \"card\" | \"cart\" | \"charging-speed-inactive\" | \"charging-speed\" | \"charging-stopped\" | \"chevron_down\" | \"chevron_left\" | \"chevron_right\" | \"chevron_up\" | \"clock_inactive\" | \"clock\" | \"contact_inactive\" | \"contact\" | \"cross\" | \"dashboard\" | \"document_check\" | \"document_doc\" | \"document_eye\" | \"document_pdf\" | \"document_ppt\" | \"document_tool\" | \"document_wrong\" | \"document_xls\" | \"dollar\" | \"doner\" | \"double_kebab\" | \"edit_inactive\" | \"edit\" | \"email\" | \"export_inactive\" | \"export\" | \"eye_inactive\" | \"eye\" | \"face_dissatisfied\" | \"face_neutral\" | \"face_satisfied\" | \"filters_inactive\" | \"filters\" | \"flash\" | \"folder\" | \"forward-inactive\" | \"fuel_gauge_inactive\" | \"fuel_gauge\" | \"hatch-open-inactive\" | \"heart_inactive\" | \"heart\" | \"heating-inactive-screen\" | \"history-inactive\" | \"home_inactive\" | \"home\" | \"image_add\" | \"image_inactive\" | \"image_set\" | \"insights\" | \"kebab\" | \"link_broken\" | \"lock_inactive\" | \"lock\" | \"maximize-fullscreen\" | \"meatballs\" | \"message_inactive\" | \"message\" | \"mileage_inactive\" | \"mileage\" | \"minimize-fullscreen\" | \"minus\" | \"notification_inactive\" | \"notification\" | \"pause-inactive\" | \"pause\" | \"phone_inactive\" | \"phone\" | \"pie_chart\" | \"pin_inactive\" | \"pin\" | \"plus\" | \"print_inactive\" | \"profile_inactive\" | \"proportions_inactive\" | \"proportions\" | \"range-inactive\" | \"range\" | \"redirect\" | \"refresh-inactive\" | \"refresh\" | \"reload-inactive\" | \"reload\" | \"report_inactive\" | \"report\" | \"save_inactive\" | \"save\" | \"search\" | \"send_inactive\" | \"send\" | \"settings\" | \"share\" | \"skip_backwards\" | \"skip_forward\" | \"smartphone_inactive\" | \"smartphone\" | \"sorting\" | \"speedometer_inactive\" | \"speedometer\" | \"star\" | \"support\" | \"target-inactive\" | \"text-inactive\" | \"tick\" | \"timer\" | \"tool_inactive\" | \"tool\" | \"trailer\" | \"trash_inactive\" | \"trash\" | \"truck\" | \"upload\" | \"wallet\" | \"warning\" | \"wifi_inactive\" | \"wifi\"",
|
|
53
53
|
"references": {
|
|
54
54
|
"IconNames": {
|
|
55
55
|
"location": "import",
|