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
package/package.json
CHANGED
package/src/components/common.ts
CHANGED
|
@@ -49,9 +49,9 @@ export const configureParent = (component: Element, parent: Element): Element =>
|
|
|
49
49
|
return el;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export const setClassNames = (el: HTMLElement, className
|
|
53
|
-
// Ensure the element exists
|
|
54
|
-
if (el) {
|
|
52
|
+
export const setClassNames = (el: HTMLElement, className) => {
|
|
53
|
+
// Ensure the element and class name exists exists
|
|
54
|
+
if (el && className) {
|
|
55
55
|
// Set the class names
|
|
56
56
|
let classNames = className.split(' ');
|
|
57
57
|
for (let i = 0; i < classNames.length; i++) {
|
|
@@ -332,17 +332,12 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
|
|
|
332
332
|
|
|
333
333
|
// See if we are updating the label
|
|
334
334
|
if (this.props.updateLabel) {
|
|
335
|
-
let
|
|
336
|
-
let selectedValues = [];
|
|
337
|
-
for (let i = 0; i < selectedItems.length; i++) {
|
|
338
|
-
// Append the value
|
|
339
|
-
selectedValues.push(selectedItems[i].text);
|
|
340
|
-
}
|
|
335
|
+
let selectedItem = this.getValue() as IDropdownItem;
|
|
341
336
|
|
|
342
337
|
// Set the label
|
|
343
338
|
let toggle = this.el.querySelector(".dropdown-toggle");
|
|
344
339
|
if (toggle) {
|
|
345
|
-
toggle.innerHTML =
|
|
340
|
+
toggle.innerHTML = selectedItem ? selectedItem.text : this.props.label;
|
|
346
341
|
}
|
|
347
342
|
}
|
|
348
343
|
});
|
|
@@ -358,20 +353,26 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
|
|
|
358
353
|
// Toggle the menu if it's visible
|
|
359
354
|
this.isVisible ? this.toggle() : null;
|
|
360
355
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
356
|
+
// Else, see if we are updating the label for a multi-dropdown
|
|
357
|
+
else if (this.props.updateLabel) {
|
|
358
|
+
// Set the selected values
|
|
359
|
+
let selectedItems: IDropdownItem[] = this.getValue();
|
|
360
|
+
let selectedValues = [];
|
|
361
|
+
for (let i = 0; i < selectedItems.length; i++) {
|
|
362
|
+
// Append the value
|
|
363
|
+
selectedValues.push(selectedItems[i].text);
|
|
364
|
+
}
|
|
368
365
|
|
|
369
366
|
// Set the label
|
|
370
367
|
let toggle = this.el.querySelector(".dropdown-toggle");
|
|
371
368
|
if (toggle) {
|
|
372
|
-
|
|
369
|
+
// Set the label
|
|
370
|
+
toggle.innerHTML = selectedValues.length == 0 ? this.props.label : selectedValues.join(', ');
|
|
373
371
|
}
|
|
374
372
|
}
|
|
373
|
+
|
|
374
|
+
// Execute the event
|
|
375
|
+
this.props.onChange ? this.props.onChange(this.getValue(), ev) : null;
|
|
375
376
|
});
|
|
376
377
|
}
|
|
377
378
|
|