gd-bs 6.6.35 → 6.6.36

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.36",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -167,6 +167,8 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
167
167
  if (menu) {
168
168
  // Add a change event
169
169
  menu.addEventListener("change", ev => {
170
+ let values = "";
171
+
170
172
  // See if multiple options are allowed
171
173
  if (this.props.multi == true) {
172
174
  // See if we are selecting the values
@@ -177,6 +179,9 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
177
179
 
178
180
  // Update the flag
179
181
  item.isSelected = (item.el as HTMLOptionElement).selected;
182
+
183
+ // Append the value
184
+ values = (values ? ", " : "") + (item.props.text || item.props.value);
180
185
  }
181
186
  }
182
187
 
@@ -186,6 +191,9 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
186
191
  // Get the selected value
187
192
  let selectedValue = ((ev.target as HTMLSelectElement).value || "").trim();
188
193
 
194
+ // Set the selected value
195
+ values = selectedValue;
196
+
189
197
  // Parse the items
190
198
  for (let i = 0; i < this._items.length; i++) {
191
199
  let item = this._items[i];
@@ -206,6 +214,15 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
206
214
  }
207
215
  }
208
216
  }
217
+
218
+ // See if we are updating the label
219
+ if (this.props.updateLabel) {
220
+ // Set the label
221
+ let toggle = this.el.querySelector(".dropdown-toggle");
222
+ if (toggle) {
223
+ toggle.innerHTML = values || this.props.label;
224
+ }
225
+ }
209
226
  });
210
227
  }
211
228
 
@@ -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
  }