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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "6.6.35",
3
+ "version": "6.6.37",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -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
 
@@ -157,5 +157,6 @@ export interface IDropdownProps extends IBaseProps<IDropdown> {
157
157
  required?: boolean;
158
158
  title?: string;
159
159
  type?: number;
160
+ updateLabel?: boolean;
160
161
  value?: any;
161
162
  }