gd-bs 6.6.35 → 6.6.37
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/build/components/dropdown/index.js +23 -0
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +1 -0
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/dropdown/index.ts +27 -0
- package/src/components/dropdown/types.d.ts +1 -0
package/package.json
CHANGED
|
@@ -329,6 +329,22 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
|
|
|
329
329
|
selectedItem.toggle();
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
+
|
|
333
|
+
// See if we are updating the label
|
|
334
|
+
if (this.props.updateLabel) {
|
|
335
|
+
let selectedItems = this.getValue() as IDropdownItem[];
|
|
336
|
+
let selectedValues = [];
|
|
337
|
+
for (let i = 0; i < selectedItems.length; i++) {
|
|
338
|
+
// Append the value
|
|
339
|
+
selectedValues.push(selectedItems[i].text);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Set the label
|
|
343
|
+
let toggle = this.el.querySelector(".dropdown-toggle");
|
|
344
|
+
if (toggle) {
|
|
345
|
+
toggle.innerHTML = selectedValues.length > 0 ? selectedValues.join(', ') : this.props.label;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
332
348
|
});
|
|
333
349
|
}
|
|
334
350
|
|
|
@@ -345,6 +361,17 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
|
|
|
345
361
|
|
|
346
362
|
// Execute the event
|
|
347
363
|
this.props.onChange ? this.props.onChange(this.getValue(), ev) : null;
|
|
364
|
+
|
|
365
|
+
// See if we are updating the label
|
|
366
|
+
if (this.props.updateLabel) {
|
|
367
|
+
let selectedItem = this.getValue() as IDropdownItem;
|
|
368
|
+
|
|
369
|
+
// Set the label
|
|
370
|
+
let toggle = this.el.querySelector(".dropdown-toggle");
|
|
371
|
+
if (toggle) {
|
|
372
|
+
toggle.innerHTML = selectedItem ? selectedItem.text : this.props.label;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
348
375
|
});
|
|
349
376
|
}
|
|
350
377
|
|