gd-bs 6.6.37 → 6.6.39
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/common.js +2 -3
- package/build/components/dropdown/index.js +15 -13
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/common.ts +3 -3
- package/src/components/dropdown/index.ts +16 -15
|
@@ -53,9 +53,8 @@ var configureParent = function (component, parent) {
|
|
|
53
53
|
};
|
|
54
54
|
exports.configureParent = configureParent;
|
|
55
55
|
var setClassNames = function (el, className) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (el) {
|
|
56
|
+
// Ensure the element and class name exists exists
|
|
57
|
+
if (el && className) {
|
|
59
58
|
// Set the class names
|
|
60
59
|
var classNames = className.split(' ');
|
|
61
60
|
for (var i = 0; i < classNames.length; i++) {
|
|
@@ -342,16 +342,11 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
342
342
|
}
|
|
343
343
|
// See if we are updating the label
|
|
344
344
|
if (_this.props.updateLabel) {
|
|
345
|
-
var
|
|
346
|
-
var selectedValues = [];
|
|
347
|
-
for (var i = 0; i < selectedItems.length; i++) {
|
|
348
|
-
// Append the value
|
|
349
|
-
selectedValues.push(selectedItems[i].text);
|
|
350
|
-
}
|
|
345
|
+
var selectedItem = _this.getValue();
|
|
351
346
|
// Set the label
|
|
352
347
|
var toggle = _this.el.querySelector(".dropdown-toggle");
|
|
353
348
|
if (toggle) {
|
|
354
|
-
toggle.innerHTML =
|
|
349
|
+
toggle.innerHTML = selectedItem ? selectedItem.text : _this.props.label;
|
|
355
350
|
}
|
|
356
351
|
}
|
|
357
352
|
});
|
|
@@ -365,17 +360,24 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
365
360
|
// Toggle the menu if it's visible
|
|
366
361
|
_this.isVisible ? _this.toggle() : null;
|
|
367
362
|
}
|
|
368
|
-
//
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
var
|
|
363
|
+
// Else, see if we are updating the label for a multi-dropdown
|
|
364
|
+
else if (_this.props.updateLabel) {
|
|
365
|
+
// Set the selected values
|
|
366
|
+
var selectedItems = _this.getValue();
|
|
367
|
+
var selectedValues = [];
|
|
368
|
+
for (var i = 0; i < selectedItems.length; i++) {
|
|
369
|
+
// Append the value
|
|
370
|
+
selectedValues.push(selectedItems[i].text);
|
|
371
|
+
}
|
|
373
372
|
// Set the label
|
|
374
373
|
var toggle = _this.el.querySelector(".dropdown-toggle");
|
|
375
374
|
if (toggle) {
|
|
376
|
-
|
|
375
|
+
// Set the label
|
|
376
|
+
toggle.innerHTML = selectedValues.length == 0 ? _this.props.label : selectedValues.join(', ');
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
+
// Execute the event
|
|
380
|
+
_this.props.onChange ? _this.props.onChange(_this.getValue(), ev) : null;
|
|
379
381
|
});
|
|
380
382
|
};
|
|
381
383
|
// Configures the dropdown for a nav bar
|