gd-bs 6.6.0 → 6.6.2

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.
@@ -66,7 +66,9 @@ var AccordionItem = /** @class */ (function () {
66
66
  _this._props.onClick ? _this._props.onClick(_this._elHeader, _this._props) : null;
67
67
  });
68
68
  // Execute the render event
69
- this._props.onRender ? this._props.onRender(this._el.querySelector(".accordion-body"), this._props) : null;
69
+ this._props.onRender ? this._props.onRender(this._el, this._props) : null;
70
+ this._props.onRenderBody ? this._props.onRenderBody(this._el.querySelector(".accordion-body"), this._props) : null;
71
+ this._props.onRenderHeader ? this._props.onRenderHeader(this._el.querySelector(".accordion-header"), this._props) : null;
70
72
  };
71
73
  // Renders the header
72
74
  AccordionItem.prototype.renderHeader = function () {
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.Dropdown = exports.DropdownTypes = void 0;
19
19
  var base_1 = require("../base");
20
20
  var button_1 = require("../button");
21
+ var checkboxGroup_1 = require("../checkboxGroup");
21
22
  var popover_1 = require("../popover");
22
23
  var formItem_1 = require("./formItem");
23
24
  var item_1 = require("./item");
@@ -54,6 +55,7 @@ var _Dropdown = /** @class */ (function (_super) {
54
55
  if (template === void 0) { template = GetHTML(props); }
55
56
  var _this = _super.call(this, template, props) || this;
56
57
  _this._autoSelect = null;
58
+ _this._cb = null;
57
59
  _this._initFl = false;
58
60
  _this._items = null;
59
61
  _this._popover = null;
@@ -381,28 +383,55 @@ var _Dropdown = /** @class */ (function (_super) {
381
383
  // Get the menu
382
384
  var menu = this.el.querySelector(".dropdown-menu") || this.el.querySelector("select");
383
385
  if (menu) {
384
- var isForm = menu.nodeName == "SELECT";
385
- // Parse the items
386
- var items = this.props.items || [];
387
- for (var i = 0; i < items.length; i++) {
388
- // Create the item
389
- var item = isForm ? new formItem_1.DropdownFormItem(items[i], this.props) : new item_1.DropdownItem(items[i], this.props);
390
- this._items.push(item);
391
- // See if this isn't for a form
392
- if (!isForm) {
393
- // Configure the item events
394
- this.configureItemEvents(item);
386
+ // See if we are creating checkboxes
387
+ if (this.props.isCheckbox) {
388
+ var cbItems = [];
389
+ // Parse the items
390
+ var items = this.props.items || [];
391
+ for (var i = 0; i < items.length; i++) {
392
+ var item = items[i];
393
+ // Create the checkbox item
394
+ cbItems.push({
395
+ data: item,
396
+ isDisabled: item.isDisabled,
397
+ isSelected: item.isSelected,
398
+ label: item.text,
399
+ onChange: item.onClick,
400
+ type: checkboxGroup_1.CheckboxGroupTypes.Checkbox
401
+ });
395
402
  }
396
- // Add the item to the menu
397
- menu.appendChild(item.el);
403
+ // Render the checkbox
404
+ this._cb = (0, checkboxGroup_1.CheckboxGroup)({
405
+ className: "m-2",
406
+ el: menu,
407
+ items: cbItems,
408
+ multi: this.props.multi
409
+ });
398
410
  }
399
- // See if this is a form
400
- if (isForm) {
401
- // Ensure the selected values match the index
402
- var idx = menu.selectedIndex;
403
- if (this._items[idx] && this._items[idx].isSelected == false) {
404
- // Select the item
405
- this._items[idx].toggle();
411
+ else {
412
+ var isForm = menu.nodeName == "SELECT";
413
+ // Parse the items
414
+ var items = this.props.items || [];
415
+ for (var i = 0; i < items.length; i++) {
416
+ // Create the item
417
+ var item = isForm ? new formItem_1.DropdownFormItem(items[i], this.props) : new item_1.DropdownItem(items[i], this.props);
418
+ this._items.push(item);
419
+ // See if this isn't for a form
420
+ if (!isForm) {
421
+ // Configure the item events
422
+ this.configureItemEvents(item);
423
+ }
424
+ // Add the item to the menu
425
+ menu.appendChild(item.el);
426
+ }
427
+ // See if this is a form
428
+ if (isForm) {
429
+ // Ensure the selected values match the index
430
+ var idx = menu.selectedIndex;
431
+ if (this._items[idx] && this._items[idx].isSelected == false) {
432
+ // Select the item
433
+ this._items[idx].toggle();
434
+ }
406
435
  }
407
436
  }
408
437
  }
@@ -431,17 +460,31 @@ var _Dropdown = /** @class */ (function (_super) {
431
460
  // Gets the value
432
461
  _Dropdown.prototype.getValue = function () {
433
462
  var values = [];
434
- // Parse the items
435
- for (var i = 0; i < this._items.length; i++) {
436
- var item = this._items[i];
437
- // Skip disabled items
438
- if (item.el.disabled) {
439
- continue;
440
- }
441
- // See if this item is selected
442
- if (item.isSelected) {
463
+ // See if the checkboxes exist
464
+ if (this._cb) {
465
+ // Get the values
466
+ var items = this._cb.getValue();
467
+ items = typeof (items["length"]) === "number" ? items : [items];
468
+ // Parse the items
469
+ for (var i = 0; i < items.length; i++) {
443
470
  // Add the value
444
- values.push(item.props);
471
+ values.push(items[i].data);
472
+ }
473
+ // Return the value
474
+ }
475
+ else {
476
+ // Parse the items
477
+ for (var i = 0; i < this._items.length; i++) {
478
+ var item = this._items[i];
479
+ // Skip disabled items
480
+ if (item.el.disabled) {
481
+ continue;
482
+ }
483
+ // See if this item is selected
484
+ if (item.isSelected) {
485
+ // Add the value
486
+ values.push(item.props);
487
+ }
445
488
  }
446
489
  }
447
490
  // Return the value
@@ -156,6 +156,8 @@ var FormControl = /** @class */ (function () {
156
156
  break;
157
157
  // Dropdown
158
158
  case _1.FormControlTypes.Dropdown:
159
+ case _1.FormControlTypes.DropdownButton:
160
+ case _1.FormControlTypes.DropdownCheckbox:
159
161
  // Add the dropdown
160
162
  this._ddl = (0, dropdown_1.Dropdown)({
161
163
  className: className,
@@ -11,20 +11,24 @@ var FormControlTypes;
11
11
  FormControlTypes[FormControlTypes["Email"] = 3] = "Email";
12
12
  FormControlTypes[FormControlTypes["Datalist"] = 4] = "Datalist";
13
13
  FormControlTypes[FormControlTypes["Dropdown"] = 5] = "Dropdown";
14
- FormControlTypes[FormControlTypes["File"] = 6] = "File";
15
- FormControlTypes[FormControlTypes["ListBox"] = 7] = "ListBox";
16
- FormControlTypes[FormControlTypes["MultiCheckbox"] = 8] = "MultiCheckbox";
17
- FormControlTypes[FormControlTypes["MultiDropdown"] = 9] = "MultiDropdown";
18
- FormControlTypes[FormControlTypes["MultiListBox"] = 10] = "MultiListBox";
19
- FormControlTypes[FormControlTypes["MultiRadio"] = 11] = "MultiRadio";
20
- FormControlTypes[FormControlTypes["MultiSwitch"] = 12] = "MultiSwitch";
21
- FormControlTypes[FormControlTypes["Password"] = 13] = "Password";
22
- FormControlTypes[FormControlTypes["Radio"] = 14] = "Radio";
23
- FormControlTypes[FormControlTypes["Range"] = 15] = "Range";
24
- FormControlTypes[FormControlTypes["Readonly"] = 16] = "Readonly";
25
- FormControlTypes[FormControlTypes["Switch"] = 17] = "Switch";
26
- FormControlTypes[FormControlTypes["TextArea"] = 18] = "TextArea";
27
- FormControlTypes[FormControlTypes["TextField"] = 19] = "TextField";
14
+ FormControlTypes[FormControlTypes["DropdownButton"] = 6] = "DropdownButton";
15
+ FormControlTypes[FormControlTypes["DropdownCheckbox"] = 7] = "DropdownCheckbox";
16
+ FormControlTypes[FormControlTypes["File"] = 8] = "File";
17
+ FormControlTypes[FormControlTypes["ListBox"] = 9] = "ListBox";
18
+ FormControlTypes[FormControlTypes["MultiCheckbox"] = 10] = "MultiCheckbox";
19
+ FormControlTypes[FormControlTypes["MultiDropdown"] = 11] = "MultiDropdown";
20
+ FormControlTypes[FormControlTypes["MultiDropdownButton"] = 12] = "MultiDropdownButton";
21
+ FormControlTypes[FormControlTypes["MultiDropdownCheckbox"] = 13] = "MultiDropdownCheckbox";
22
+ FormControlTypes[FormControlTypes["MultiListBox"] = 14] = "MultiListBox";
23
+ FormControlTypes[FormControlTypes["MultiRadio"] = 15] = "MultiRadio";
24
+ FormControlTypes[FormControlTypes["MultiSwitch"] = 16] = "MultiSwitch";
25
+ FormControlTypes[FormControlTypes["Password"] = 17] = "Password";
26
+ FormControlTypes[FormControlTypes["Radio"] = 18] = "Radio";
27
+ FormControlTypes[FormControlTypes["Range"] = 19] = "Range";
28
+ FormControlTypes[FormControlTypes["Readonly"] = 20] = "Readonly";
29
+ FormControlTypes[FormControlTypes["Switch"] = 21] = "Switch";
30
+ FormControlTypes[FormControlTypes["TextArea"] = 22] = "TextArea";
31
+ FormControlTypes[FormControlTypes["TextField"] = 23] = "TextField";
28
32
  })(FormControlTypes = exports.FormControlTypes || (exports.FormControlTypes = {}));
29
33
  /**
30
34
  * Form Validation Types