gd-bs 6.6.65 → 6.6.67

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.
@@ -123,8 +123,9 @@ var _CheckboxGroup = /** @class */ (function (_super) {
123
123
  if (this.props.onChange) {
124
124
  // Add a click event
125
125
  item.checkbox.addEventListener("click", function (ev) {
126
+ var value = _this.getValue();
126
127
  // Call the event
127
- _this.props.onChange(_this.getValue(), ev);
128
+ _this.props.onChange(value.selectedItems, value.allItems, ev);
128
129
  });
129
130
  }
130
131
  };
@@ -160,18 +161,21 @@ var _CheckboxGroup = /** @class */ (function (_super) {
160
161
  */
161
162
  // Method to get the value
162
163
  _CheckboxGroup.prototype.getValue = function () {
163
- var values = [];
164
+ var allItems = [];
165
+ var selectedItems = [];
164
166
  // Parse the checkboxes
165
167
  for (var i = 0; i < this._checkboxes.length; i++) {
166
168
  var cb = this._checkboxes[i];
169
+ // Add the item
170
+ allItems.push(cb.props);
167
171
  // See if it's checked
168
172
  if (cb.isChecked) {
169
173
  // Add the value
170
- values.push(cb.props);
174
+ selectedItems.push(cb.props);
171
175
  }
172
176
  }
173
177
  // Return the values
174
- return this.props.multi ? values : values[0];
178
+ return { selectedItems: this.props.multi ? selectedItems : selectedItems[0], allItems: allItems };
175
179
  };
176
180
  // Sets the checkbox items
177
181
  _CheckboxGroup.prototype.setItems = function (newItems) {
@@ -219,8 +223,9 @@ var _CheckboxGroup = /** @class */ (function (_super) {
219
223
  }
220
224
  // See if a change event exists
221
225
  if (this._initFl && this.props.onChange) {
226
+ var value_2 = this.getValue();
222
227
  // Execute the change event
223
- this.props.onChange(this.getValue());
228
+ this.props.onChange(value_2.selectedItems, value_2.allItems);
224
229
  }
225
230
  };
226
231
  return _CheckboxGroup;
@@ -94,6 +94,7 @@ var CheckboxItem = /** @class */ (function () {
94
94
  this._elCheckbox.addEventListener("click", function (ev) {
95
95
  // Update the value
96
96
  _this._isSelected = !_this._isSelected;
97
+ _this._props.isSelected = _this._isSelected;
97
98
  _this._elCheckbox.checked = _this._isSelected;
98
99
  // See if an event is defined
99
100
  if (_this._props.onChange) {
@@ -153,6 +154,7 @@ var CheckboxItem = /** @class */ (function () {
153
154
  CheckboxItem.prototype.toggle = function () {
154
155
  // Update the value
155
156
  this._isSelected = !this._isSelected;
157
+ this._props.isSelected = this._isSelected;
156
158
  // Set the checkbox value
157
159
  this._el.querySelector("input").checked = this._isSelected;
158
160
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "6.6.65",
3
+ "version": "6.6.67",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -114,8 +114,10 @@ class _CheckboxGroup extends Base<ICheckboxGroupProps> implements ICheckboxGroup
114
114
  if (this.props.onChange) {
115
115
  // Add a click event
116
116
  item.checkbox.addEventListener("click", ev => {
117
+ let value = this.getValue();
118
+
117
119
  // Call the event
118
- this.props.onChange(this.getValue(), ev);
120
+ this.props.onChange(value.selectedItems, value.allItems, ev);
119
121
  });
120
122
  }
121
123
  }
@@ -159,22 +161,26 @@ class _CheckboxGroup extends Base<ICheckboxGroupProps> implements ICheckboxGroup
159
161
  */
160
162
 
161
163
  // Method to get the value
162
- getValue(): ICheckboxGroupItem | Array<ICheckboxGroupItem> {
163
- let values: Array<ICheckboxGroupItem> = [];
164
+ getValue(): { selectedItems: ICheckboxGroupItem | Array<ICheckboxGroupItem>, allItems: Array<ICheckboxGroupItem> } {
165
+ let allItems: Array<ICheckboxGroupItem> = [];
166
+ let selectedItems: Array<ICheckboxGroupItem> = [];
164
167
 
165
168
  // Parse the checkboxes
166
169
  for (let i = 0; i < this._checkboxes.length; i++) {
167
170
  let cb = this._checkboxes[i];
168
171
 
172
+ // Add the item
173
+ allItems.push(cb.props);
174
+
169
175
  // See if it's checked
170
176
  if (cb.isChecked) {
171
177
  // Add the value
172
- values.push(cb.props);
178
+ selectedItems.push(cb.props);
173
179
  }
174
180
  }
175
181
 
176
182
  // Return the values
177
- return this.props.multi ? values : values[0];
183
+ return { selectedItems: this.props.multi ? selectedItems : selectedItems[0], allItems };
178
184
  }
179
185
 
180
186
  // Sets the checkbox items
@@ -231,8 +237,10 @@ class _CheckboxGroup extends Base<ICheckboxGroupProps> implements ICheckboxGroup
231
237
 
232
238
  // See if a change event exists
233
239
  if (this._initFl && this.props.onChange) {
240
+ let value = this.getValue();
241
+
234
242
  // Execute the change event
235
- this.props.onChange(this.getValue());
243
+ this.props.onChange(value.selectedItems, value.allItems);
236
244
  }
237
245
  }
238
246
  }
@@ -105,6 +105,7 @@ export class CheckboxItem {
105
105
  this._elCheckbox.addEventListener("click", ev => {
106
106
  // Update the value
107
107
  this._isSelected = !this._isSelected;
108
+ this._props.isSelected = this._isSelected
108
109
  this._elCheckbox.checked = this._isSelected;
109
110
 
110
111
  // See if an event is defined
@@ -157,6 +158,7 @@ export class CheckboxItem {
157
158
  toggle() {
158
159
  // Update the value
159
160
  this._isSelected = !this._isSelected;
161
+ this._props.isSelected = this._isSelected;
160
162
 
161
163
  // Set the checkbox value
162
164
  this._el.querySelector("input").checked = this._isSelected;
@@ -56,7 +56,7 @@ export interface ICheckboxGroup {
56
56
  el: HTMLElement;
57
57
 
58
58
  /** Gets the values. */
59
- getValue: () => ICheckboxGroupItem | Array<ICheckboxGroupItem>;
59
+ getValue: () => { selectedItems: ICheckboxGroupItem | Array<ICheckboxGroupItem>, allItems: Array<ICheckboxGroupItem> };
60
60
 
61
61
  /** Hides the checkbox group. */
62
62
  hide: () => void;
@@ -80,7 +80,7 @@ export interface ICheckboxGroupItem {
80
80
  isSelected?: boolean;
81
81
  label?: string;
82
82
  name?: string;
83
- onChange?: (item: ICheckboxGroupItem, ev?: Event) => void;
83
+ onChange?: (selectedItem: ICheckboxGroupItem, ev?: Event) => void;
84
84
  title?: string;
85
85
  type?: number;
86
86
  }
@@ -98,7 +98,7 @@ export interface ICheckboxGroupProps extends IBaseProps<ICheckboxGroup> {
98
98
  items?: Array<ICheckboxGroupItem>;
99
99
  multi?: boolean;
100
100
  onRender?: (el?: HTMLElement, item?: ICheckboxGroupItem) => void;
101
- onChange?: (items: ICheckboxGroupItem | Array<ICheckboxGroupItem>, ev?: Event) => void;
101
+ onChange?: (selectedItems: ICheckboxGroupItem | Array<ICheckboxGroupItem>, allItems?: Array<ICheckboxGroupItem>, ev?: Event) => void;
102
102
  required?: boolean;
103
103
  title?: string;
104
104
  type?: number;
@@ -101,7 +101,7 @@ export interface IFormControlPropsCheckbox extends IFormControlProps {
101
101
  hideLabel?: boolean;
102
102
  isInline?: boolean;
103
103
  items?: Array<ICheckboxGroupItem>;
104
- onChange?: (item: ICheckboxGroupItem, ev?: Event) => void;
104
+ onChange?: (selectedItem: ICheckboxGroupItem, allItems?: Array<ICheckboxGroupItem>, ev?: Event) => void;
105
105
  onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
106
106
  onGetValue?: (control: IFormControlPropsCheckbox) => any;
107
107
  onValidate?: (control: IFormControlPropsCheckbox, value: IFormControlValidationResult) => boolean | IFormControlValidationResult;
@@ -153,7 +153,7 @@ export interface IFormControlPropsMultiCheckbox extends IFormControlProps {
153
153
  hideLabel?: boolean;
154
154
  isInline?: boolean;
155
155
  items?: Array<ICheckboxGroupItem>;
156
- onChange?: (item: Array<ICheckboxGroupItem>, ev?: Event) => void;
156
+ onChange?: (selectedItems: Array<ICheckboxGroupItem>, allItems?: Array<ICheckboxGroupItem>, ev?: Event) => void;
157
157
  onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
158
158
  onGetValue?: (control: IFormControlPropsCheckbox) => any;
159
159
  onValidate?: (control: IFormControlPropsCheckbox, value: IFormControlValidationResult) => boolean | IFormControlValidationResult;