@scania/tegel 1.23.0-beta.0 → 1.23.0-block-nesting-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-block.cjs.entry.js +1 -1
- package/dist/cjs/tds-checkbox.cjs.entry.js +9 -2
- package/dist/cjs/tds-dropdown_2.cjs.entry.js +159 -128
- package/dist/cjs/tds-popover-core.cjs.entry.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/block/block.css +1 -3
- package/dist/collection/components/checkbox/checkbox.js +19 -3
- package/dist/collection/components/dropdown/dropdown.js +209 -200
- package/dist/collection/components/popover-core/tds-popover-core.css +6 -16
- package/dist/components/{p-ca4b945d.js → p-2523819c.js} +164 -135
- package/dist/components/{p-e02b091c.js → p-3a32c37c.js} +1 -1
- package/dist/components/{p-dcfecf4d.js → p-50179eca.js} +1 -1
- 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-block.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-header-dropdown.js +2 -2
- package/dist/components/tds-header-launcher.js +2 -2
- 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-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/components/tds-tooltip.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-block.entry.js +1 -1
- package/dist/esm/tds-checkbox.entry.js +9 -2
- package/dist/esm/tds-dropdown_2.entry.js +159 -128
- package/dist/esm/tds-popover-core.entry.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/{p-590b5f55.entry.js → p-2a2756ac.entry.js} +1 -1
- package/dist/tegel/p-6a52ed63.entry.js +1 -0
- package/dist/tegel/p-979f5255.entry.js +1 -0
- package/dist/tegel/p-9dba483c.entry.js +1 -0
- package/dist/tegel/tegel.css +1 -1
- 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 +36 -20
- package/dist/types/components.d.ts +11 -21
- package/package.json +1 -1
- package/dist/tegel/p-a464920f.entry.js +0 -1
- package/dist/tegel/p-db00f607.entry.js +0 -1
- package/dist/tegel/p-e252ba6e.entry.js +0 -1
|
@@ -68,14 +68,6 @@ const TdsDropdown = class {
|
|
|
68
68
|
this.tdsFocus = createEvent(this, "tdsFocus", 6);
|
|
69
69
|
this.tdsBlur = createEvent(this, "tdsBlur", 6);
|
|
70
70
|
this.tdsInput = createEvent(this, "tdsInput", 6);
|
|
71
|
-
this.tdsValueChange = createEvent(this, "tdsValueChange", 6);
|
|
72
|
-
this.handleChange = () => {
|
|
73
|
-
const value = Array.isArray(this.value) ? this.value.join(',') : this.value;
|
|
74
|
-
this.tdsChange.emit({
|
|
75
|
-
name: this.name,
|
|
76
|
-
value: value !== null && value !== void 0 ? value : null,
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
71
|
this.setDefaultOption = () => {
|
|
80
72
|
if (this.defaultValue) {
|
|
81
73
|
const children = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
@@ -104,6 +96,7 @@ const TdsDropdown = class {
|
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
98
|
};
|
|
99
|
+
/* Returns a list of all children that are tds-dropdown-option elements */
|
|
107
100
|
this.getChildren = () => {
|
|
108
101
|
const tdsDropdownOptions = Array.from(this.host.children).filter((element) => element.tagName === 'TDS-DROPDOWN-OPTION');
|
|
109
102
|
if (tdsDropdownOptions.length === 0) {
|
|
@@ -112,38 +105,6 @@ const TdsDropdown = class {
|
|
|
112
105
|
else
|
|
113
106
|
return tdsDropdownOptions;
|
|
114
107
|
};
|
|
115
|
-
this.getSelectedChildren = () => {
|
|
116
|
-
if (!this.value)
|
|
117
|
-
return [];
|
|
118
|
-
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
119
|
-
return valueArray
|
|
120
|
-
.map((stringValue) => {
|
|
121
|
-
const matchingElement = this.getChildren().find((element) => element.value === stringValue);
|
|
122
|
-
return matchingElement;
|
|
123
|
-
})
|
|
124
|
-
.filter(Boolean);
|
|
125
|
-
};
|
|
126
|
-
this.getSelectedChildrenLabels = () => {
|
|
127
|
-
var _a;
|
|
128
|
-
return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
|
|
129
|
-
};
|
|
130
|
-
this.getValue = () => {
|
|
131
|
-
const labels = this.getSelectedChildrenLabels();
|
|
132
|
-
if (!labels) {
|
|
133
|
-
return '';
|
|
134
|
-
}
|
|
135
|
-
return labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
136
|
-
};
|
|
137
|
-
this.setValueAttribute = () => {
|
|
138
|
-
var _a;
|
|
139
|
-
if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
|
|
140
|
-
this.host.removeAttribute('value');
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
144
|
-
this.host.setAttribute('value', valueArray.map((val) => val).toString());
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
108
|
this.getOpenDirection = () => {
|
|
148
109
|
var _a, _b, _c, _d, _e;
|
|
149
110
|
if (this.openDirection === 'auto' || !this.openDirection) {
|
|
@@ -157,6 +118,7 @@ const TdsDropdown = class {
|
|
|
157
118
|
}
|
|
158
119
|
return this.openDirection;
|
|
159
120
|
};
|
|
121
|
+
/* Toggles the open state of the Dropdown and sets focus to the input element */
|
|
160
122
|
this.handleToggleOpen = () => {
|
|
161
123
|
if (!this.disabled) {
|
|
162
124
|
this.open = !this.open;
|
|
@@ -165,10 +127,38 @@ const TdsDropdown = class {
|
|
|
165
127
|
}
|
|
166
128
|
}
|
|
167
129
|
};
|
|
130
|
+
/* Focuses the input element in the Dropdown, if the reference is present. */
|
|
168
131
|
this.focusInputElement = () => {
|
|
169
132
|
if (this.inputElement)
|
|
170
133
|
this.inputElement.focus();
|
|
171
134
|
};
|
|
135
|
+
this.getSelectedChildren = () => {
|
|
136
|
+
var _a;
|
|
137
|
+
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((stringValue) => {
|
|
138
|
+
const matchingElement = this.getChildren().find((element) => element.value === stringValue);
|
|
139
|
+
return matchingElement;
|
|
140
|
+
}).filter(Boolean);
|
|
141
|
+
};
|
|
142
|
+
this.getSelectedChildrenLabels = () => {
|
|
143
|
+
var _a;
|
|
144
|
+
return (_a = this.getSelectedChildren()) === null || _a === void 0 ? void 0 : _a.map((element) => element.textContent.trim());
|
|
145
|
+
};
|
|
146
|
+
this.getValue = () => {
|
|
147
|
+
const labels = this.getSelectedChildrenLabels();
|
|
148
|
+
if (!labels) {
|
|
149
|
+
return '';
|
|
150
|
+
}
|
|
151
|
+
return labels === null || labels === void 0 ? void 0 : labels.join(', ');
|
|
152
|
+
};
|
|
153
|
+
this.setValueAttribute = () => {
|
|
154
|
+
var _a;
|
|
155
|
+
if (!this.value || ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) === '') {
|
|
156
|
+
this.host.removeAttribute('value');
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.host.setAttribute('value', this.value.map((val) => val).toString());
|
|
160
|
+
}
|
|
161
|
+
};
|
|
172
162
|
this.handleFilter = (event) => {
|
|
173
163
|
this.tdsInput.emit(event);
|
|
174
164
|
const query = event.target.value.toLowerCase();
|
|
@@ -214,6 +204,13 @@ const TdsDropdown = class {
|
|
|
214
204
|
this.handleBlur = (event) => {
|
|
215
205
|
this.tdsBlur.emit(event);
|
|
216
206
|
};
|
|
207
|
+
this.handleChange = () => {
|
|
208
|
+
var _a, _b;
|
|
209
|
+
this.tdsChange.emit({
|
|
210
|
+
name: this.name,
|
|
211
|
+
value: (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString()) !== null && _b !== void 0 ? _b : null,
|
|
212
|
+
});
|
|
213
|
+
};
|
|
217
214
|
this.name = undefined;
|
|
218
215
|
this.disabled = false;
|
|
219
216
|
this.helper = undefined;
|
|
@@ -230,92 +227,107 @@ const TdsDropdown = class {
|
|
|
230
227
|
this.normalizeText = true;
|
|
231
228
|
this.noResultText = 'No result';
|
|
232
229
|
this.defaultValue = undefined;
|
|
233
|
-
this.value = undefined;
|
|
234
230
|
this.open = false;
|
|
235
|
-
this.
|
|
231
|
+
this.value = undefined;
|
|
236
232
|
this.filterResult = undefined;
|
|
237
233
|
this.filterFocus = undefined;
|
|
238
234
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const valueArray = Array.isArray(newValue) ? newValue : newValue ? [newValue] : null;
|
|
244
|
-
// Handle multiselect validation
|
|
245
|
-
if (!this.multiselect && Array.isArray(valueArray) && valueArray.length > 1) {
|
|
246
|
-
console.warn('Tried to select multiple items, but multiselect is not enabled.');
|
|
247
|
-
// Coerce to single value for non-multiselect
|
|
248
|
-
this.value = valueArray[0];
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
// Ensure value is always array internally for backward compatibility
|
|
252
|
-
this.updateSelections(valueArray);
|
|
235
|
+
/** Method that resets the Dropdown, marks all children as non-selected and resets the value to null. */
|
|
236
|
+
async reset() {
|
|
237
|
+
this.dropdownList.scrollTop = 0;
|
|
238
|
+
this.internalReset();
|
|
253
239
|
this.handleChange();
|
|
254
240
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
this.internalValue = '';
|
|
287
|
-
this.value = this.multiselect ? [] : null;
|
|
241
|
+
/** Method that forces focus on the input element. */
|
|
242
|
+
async focusElement() {
|
|
243
|
+
this.focusInputElement();
|
|
244
|
+
this.handleFocus({});
|
|
245
|
+
}
|
|
246
|
+
/** Method for setting the value of the Dropdown.
|
|
247
|
+
*
|
|
248
|
+
* Single selection example:
|
|
249
|
+
*
|
|
250
|
+
* <code>
|
|
251
|
+
* dropdown.setValue('option-1', 'Option 1');
|
|
252
|
+
* </code>
|
|
253
|
+
*
|
|
254
|
+
* Multiselect example:
|
|
255
|
+
*
|
|
256
|
+
* <code>
|
|
257
|
+
* dropdown.setValue(['option-1', 'option-2']);
|
|
258
|
+
* </code>
|
|
259
|
+
*/
|
|
260
|
+
// The label is optional here ONLY to not break the API. Should be removed for 2.0.
|
|
261
|
+
// @ts-ignore
|
|
262
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
263
|
+
async setValue(value, label) {
|
|
264
|
+
let nextValue;
|
|
265
|
+
if (typeof value === 'string')
|
|
266
|
+
nextValue = [value];
|
|
267
|
+
else
|
|
268
|
+
nextValue = value;
|
|
269
|
+
if (!this.multiselect && nextValue.length > 1) {
|
|
270
|
+
console.warn('Tried to select multiple items, but multiselect is not enabled.');
|
|
271
|
+
nextValue = [nextValue[0]];
|
|
288
272
|
}
|
|
289
|
-
|
|
290
|
-
this.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
273
|
+
nextValue = [...new Set(nextValue)];
|
|
274
|
+
this.internalReset();
|
|
275
|
+
for (let i = 0; i < nextValue.length; i++) {
|
|
276
|
+
const optionExist = this.getChildren().some((element) => element.value === nextValue[i]);
|
|
277
|
+
if (!optionExist) {
|
|
278
|
+
nextValue.splice(i, 1);
|
|
279
|
+
}
|
|
294
280
|
}
|
|
281
|
+
this.value = nextValue;
|
|
295
282
|
this.setValueAttribute();
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
283
|
+
this.selectChildrenAsSelectedBasedOnSelectionProp();
|
|
284
|
+
this.handleChange();
|
|
285
|
+
/* This returns an array of object with a value and label pair. This is ONLY to not break the API. Should be removed for 2.0. */
|
|
286
|
+
/* https://tegel.atlassian.net/browse/CDEP-2703 */
|
|
287
|
+
const selection = this.getSelectedChildren().map((element) => ({
|
|
300
288
|
value: element.value,
|
|
301
289
|
label: element.textContent.trim(),
|
|
302
290
|
}));
|
|
291
|
+
// Update inputElement value and placeholder text
|
|
292
|
+
if (this.filter) {
|
|
293
|
+
this.inputElement.value = this.getValue();
|
|
294
|
+
}
|
|
295
|
+
return selection;
|
|
303
296
|
}
|
|
304
|
-
|
|
305
|
-
|
|
297
|
+
/**
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
async appendValue(value) {
|
|
301
|
+
if (this.multiselect && this.value) {
|
|
302
|
+
this.setValue([...this.value, value]);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
this.setValue(value);
|
|
306
|
+
}
|
|
306
307
|
}
|
|
308
|
+
/** Method for removing a selected value in the Dropdown. */
|
|
307
309
|
async removeValue(oldValue) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
+
var _a, _b;
|
|
311
|
+
let label;
|
|
312
|
+
if (this.multiselect) {
|
|
313
|
+
(_a = this.getChildren()) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
314
|
+
var _a;
|
|
315
|
+
if (element.value === oldValue) {
|
|
316
|
+
this.value = (_a = this.value) === null || _a === void 0 ? void 0 : _a.filter((value) => value !== element.value);
|
|
317
|
+
label = element.textContent.trim();
|
|
318
|
+
element.setSelected(false);
|
|
319
|
+
}
|
|
320
|
+
return element;
|
|
321
|
+
});
|
|
310
322
|
}
|
|
311
323
|
else {
|
|
312
|
-
this.
|
|
324
|
+
this.reset();
|
|
313
325
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
this.
|
|
326
|
+
this.handleChange();
|
|
327
|
+
this.setValueAttribute();
|
|
328
|
+
/* This returns an array of object with a value and label pair. This is ONLY to not break the API. Should be removed for 2.0. */
|
|
329
|
+
/* https://tegel.atlassian.net/browse/CDEP-2703 */
|
|
330
|
+
return (_b = this.value) === null || _b === void 0 ? void 0 : _b.map((value) => ({ value, label }));
|
|
319
331
|
}
|
|
320
332
|
/** Method for closing the Dropdown. */
|
|
321
333
|
async close() {
|
|
@@ -369,9 +381,6 @@ const TdsDropdown = class {
|
|
|
369
381
|
}
|
|
370
382
|
}
|
|
371
383
|
componentWillLoad() {
|
|
372
|
-
if (this.defaultValue && !this.value) {
|
|
373
|
-
this.value = this.defaultValue;
|
|
374
|
-
}
|
|
375
384
|
this.setDefaultOption();
|
|
376
385
|
}
|
|
377
386
|
/** Method to handle slot changes */
|
|
@@ -382,19 +391,34 @@ const TdsDropdown = class {
|
|
|
382
391
|
normalizeString(text) {
|
|
383
392
|
return this.normalizeText ? text.normalize('NFD').replace(/\p{Diacritic}/gu, '') : text;
|
|
384
393
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
394
|
+
/** Method that resets the dropdown without emitting an event. */
|
|
395
|
+
internalReset() {
|
|
396
|
+
this.getChildren().forEach((element) => {
|
|
397
|
+
element.setSelected(false);
|
|
398
|
+
return element;
|
|
399
|
+
});
|
|
400
|
+
this.value = null;
|
|
401
|
+
this.setValueAttribute();
|
|
402
|
+
}
|
|
403
|
+
selectChildrenAsSelectedBasedOnSelectionProp() {
|
|
404
|
+
this.getChildren().forEach((element) => {
|
|
405
|
+
this.value.forEach((selection) => {
|
|
406
|
+
if (element.value !== selection) {
|
|
407
|
+
// If not multiselect, we need to unselect all other options.
|
|
408
|
+
if (!this.multiselect) {
|
|
409
|
+
element.setSelected(false);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
element.setSelected(true);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
});
|
|
392
417
|
}
|
|
393
418
|
render() {
|
|
394
|
-
var _a, _b, _c;
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
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: {
|
|
419
|
+
var _a, _b, _c, _d;
|
|
420
|
+
appendHiddenInput(this.host, this.name, (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => value).toString(), this.disabled);
|
|
421
|
+
return (h(Host, { key: '1c4995be9b1e47e254ec9976b334c4d74a44263b', role: "select", class: `${this.modeVariant ? `tds-mode-variant-${this.modeVariant}` : ''}` }, this.label && this.labelPosition === 'outside' && (h("div", { key: 'ad423934dedc56ff39d06bf7746e47d011bed002', class: `label-outside ${this.disabled ? 'disabled' : ''}` }, this.label)), h("div", { key: '99c87c0add1152f47533bf6ef5e6794cffdbb18c', class: `dropdown-select ${this.size} ${this.disabled ? 'disabled' : ''}` }, this.filter ? (h("div", { class: {
|
|
398
422
|
filter: true,
|
|
399
423
|
focus: this.filterFocus,
|
|
400
424
|
disabled: this.disabled,
|
|
@@ -402,7 +426,7 @@ const TdsDropdown = class {
|
|
|
402
426
|
} }, 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: `
|
|
403
427
|
label-inside-as-placeholder
|
|
404
428
|
${this.size}
|
|
405
|
-
${((
|
|
429
|
+
${((_b = this.value) === null || _b === void 0 ? void 0 : _b.length) ? 'selected' : ''}
|
|
406
430
|
` }, this.label)), h("input", {
|
|
407
431
|
// eslint-disable-next-line no-return-assign
|
|
408
432
|
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) => {
|
|
@@ -411,7 +435,15 @@ const TdsDropdown = class {
|
|
|
411
435
|
this.inputElement.value = this.getValue();
|
|
412
436
|
}
|
|
413
437
|
this.handleBlur(event);
|
|
414
|
-
}, onFocus: (event) =>
|
|
438
|
+
}, onFocus: (event) => {
|
|
439
|
+
this.open = true;
|
|
440
|
+
this.filterFocus = true;
|
|
441
|
+
if (this.multiselect) {
|
|
442
|
+
this.inputElement.value = '';
|
|
443
|
+
}
|
|
444
|
+
this.handleFocus(event);
|
|
445
|
+
this.handleFilter({ target: { value: '' } });
|
|
446
|
+
}, onKeyDown: (event) => {
|
|
415
447
|
if (event.key === 'Escape') {
|
|
416
448
|
this.open = false;
|
|
417
449
|
}
|
|
@@ -435,8 +467,8 @@ const TdsDropdown = class {
|
|
|
435
467
|
`, 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: `
|
|
436
468
|
label-inside-as-placeholder
|
|
437
469
|
${this.size}
|
|
438
|
-
${((
|
|
439
|
-
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((
|
|
470
|
+
${((_c = this.value) === null || _c === void 0 ? void 0 : _c.length) ? 'selected' : ''}
|
|
471
|
+
` }, this.label)), h("div", { class: `placeholder ${this.size}` }, ((_d = this.value) === null || _d === void 0 ? void 0 : _d.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: 'dd850ac34b473f9cac51ad5bdc8417d994b7946a', ref: (element) => (this.dropdownList = element), class: {
|
|
440
472
|
'dropdown-list': true,
|
|
441
473
|
[this.size]: true,
|
|
442
474
|
[this.getOpenDirection()]: true,
|
|
@@ -445,11 +477,10 @@ const TdsDropdown = class {
|
|
|
445
477
|
'closed': !this.open,
|
|
446
478
|
[`animation-enter-${this.animation}`]: this.animation !== 'none' && this.open,
|
|
447
479
|
[`animation-exit-${this.animation}`]: this.animation !== 'none' && !this.open,
|
|
448
|
-
} }, h("slot", { key: '
|
|
480
|
+
} }, h("slot", { key: '790885487da46ec88e05ad98272cbd43eb6fc7ac', onSlotchange: () => this.handleSlotChange() }), this.filterResult === 0 && this.noResultText !== '' && (h("div", { key: '7d9c9f695c5dc2c734fa51a746c6c1c3547d5dec', class: `no-result ${this.size}` }, this.noResultText))), this.helper && (h("div", { key: 'b044b0d4dd3e39000fa0262a838aa860451e5986', class: `helper ${this.error ? 'error' : ''} ${this.disabled ? 'disabled' : ''}` }, this.error && h("tds-icon", { key: '506204fd3f113c6a903b616372660902295d0886', name: "error", size: "16px" }), this.helper))));
|
|
449
481
|
}
|
|
450
482
|
get host() { return getElement(this); }
|
|
451
483
|
static get watchers() { return {
|
|
452
|
-
"value": ["handleValueChange"],
|
|
453
484
|
"open": ["handleOpenState"]
|
|
454
485
|
}; }
|
|
455
486
|
};
|