gd-bs 6.6.36 → 6.6.38
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 +23 -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 +27 -17
|
@@ -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++) {
|
|
@@ -184,7 +184,6 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
184
184
|
if (menu) {
|
|
185
185
|
// Add a change event
|
|
186
186
|
menu.addEventListener("change", function (ev) {
|
|
187
|
-
var values = "";
|
|
188
187
|
// See if multiple options are allowed
|
|
189
188
|
if (_this.props.multi == true) {
|
|
190
189
|
// See if we are selecting the values
|
|
@@ -194,8 +193,6 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
194
193
|
var item = _this._items[i];
|
|
195
194
|
// Update the flag
|
|
196
195
|
item.isSelected = item.el.selected;
|
|
197
|
-
// Append the value
|
|
198
|
-
values = (values ? ", " : "") + (item.props.text || item.props.value);
|
|
199
196
|
}
|
|
200
197
|
}
|
|
201
198
|
// Call the change event
|
|
@@ -204,8 +201,6 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
204
201
|
else {
|
|
205
202
|
// Get the selected value
|
|
206
203
|
var selectedValue = (ev.target.value || "").trim();
|
|
207
|
-
// Set the selected value
|
|
208
|
-
values = selectedValue;
|
|
209
204
|
// Parse the items
|
|
210
205
|
for (var i = 0; i < _this._items.length; i++) {
|
|
211
206
|
var item = _this._items[i];
|
|
@@ -228,14 +223,6 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
228
223
|
}
|
|
229
224
|
}
|
|
230
225
|
}
|
|
231
|
-
// See if we are updating the label
|
|
232
|
-
if (_this.props.updateLabel) {
|
|
233
|
-
// Set the label
|
|
234
|
-
var toggle_1 = _this.el.querySelector(".dropdown-toggle");
|
|
235
|
-
if (toggle_1) {
|
|
236
|
-
toggle_1.innerHTML = values || _this.props.label;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
226
|
});
|
|
240
227
|
}
|
|
241
228
|
// Get the toggle
|
|
@@ -353,6 +340,20 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
353
340
|
selectedItem.toggle();
|
|
354
341
|
}
|
|
355
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
|
+
}
|
|
356
357
|
});
|
|
357
358
|
}
|
|
358
359
|
// Add a click event
|
|
@@ -366,6 +367,15 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
366
367
|
}
|
|
367
368
|
// Execute the event
|
|
368
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
|
+
}
|
|
369
379
|
});
|
|
370
380
|
};
|
|
371
381
|
// Configures the dropdown for a nav bar
|