gd-bs 6.6.7 → 6.6.9

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.
@@ -82,6 +82,8 @@ var _CheckboxGroup = /** @class */ (function (_super) {
82
82
  }
83
83
  // Render the checkboxes
84
84
  this.renderItems();
85
+ // Set the value
86
+ this.setValue(this.props.value);
85
87
  };
86
88
  // Configure the events
87
89
  _CheckboxGroup.prototype.configureEvents = function (item) {
@@ -129,14 +131,6 @@ var _CheckboxGroup = /** @class */ (function (_super) {
129
131
  label: this.props.label || ""
130
132
  });
131
133
  }
132
- // See if this is a single checkbox
133
- if (this.props.multi != true && items.length > 0) {
134
- // See if this checkbox should be checked
135
- if (typeof (this.props.value) === "boolean" && this.props.value) {
136
- // Select the item
137
- items[0].isSelected = true;
138
- }
139
- }
140
134
  // Parse the items
141
135
  for (var i = 0; i < items.length; i++) {
142
136
  var item = items[i];
@@ -185,6 +179,15 @@ var _CheckboxGroup = /** @class */ (function (_super) {
185
179
  // Method to set the value
186
180
  // Sets the dropdown value
187
181
  _CheckboxGroup.prototype.setValue = function (value) {
182
+ // See if this is a single checkbox
183
+ if (this.props.multi != true && this._checkboxes.length == 1) {
184
+ // See if this checkbox should be checked
185
+ if (typeof (value) === "boolean" && value) {
186
+ // Select the item
187
+ this._checkboxes[0].isChecked ? null : this._checkboxes[0].toggle();
188
+ }
189
+ return;
190
+ }
188
191
  // Ensure it's an array
189
192
  var values = value ? (typeof (value.length) === "number" && typeof (value) !== "string" ? value : [value]) : [];
190
193
  // Parse the items
@@ -408,6 +408,7 @@ var _Dropdown = /** @class */ (function (_super) {
408
408
  el: menu,
409
409
  items: cbItems,
410
410
  multi: this.props.multi,
411
+ value: this.props.value,
411
412
  onChange: this.props.onChange ? function (values, ev) {
412
413
  // Pass the current values
413
414
  _this.props.onChange(_this.getValue(), ev);