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
|
@@ -340,6 +340,20 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
340
340
|
selectedItem.toggle();
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
+
// See if we are updating the label
|
|
344
|
+
if (_this.props.updateLabel) {
|
|
345
|
+
var selectedItems = _this.getValue();
|
|
346
|
+
var selectedValues = [];
|
|
347
|
+
for (var i = 0; i < selectedItems.length; i++) {
|
|
348
|
+
// Append the value
|
|
349
|
+
selectedValues.push(selectedItems[i].text);
|
|
350
|
+
}
|
|
351
|
+
// Set the label
|
|
352
|
+
var toggle = _this.el.querySelector(".dropdown-toggle");
|
|
353
|
+
if (toggle) {
|
|
354
|
+
toggle.innerHTML = selectedValues.length > 0 ? selectedValues.join(', ') : _this.props.label;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
343
357
|
});
|
|
344
358
|
}
|
|
345
359
|
// Add a click event
|
|
@@ -353,6 +367,15 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
353
367
|
}
|
|
354
368
|
// Execute the event
|
|
355
369
|
_this.props.onChange ? _this.props.onChange(_this.getValue(), ev) : null;
|
|
370
|
+
// See if we are updating the label
|
|
371
|
+
if (_this.props.updateLabel) {
|
|
372
|
+
var selectedItem = _this.getValue();
|
|
373
|
+
// Set the label
|
|
374
|
+
var toggle = _this.el.querySelector(".dropdown-toggle");
|
|
375
|
+
if (toggle) {
|
|
376
|
+
toggle.innerHTML = selectedItem ? selectedItem.text : _this.props.label;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
356
379
|
});
|
|
357
380
|
};
|
|
358
381
|
// Configures the dropdown for a nav bar
|