@syncfusion/ej2-dropdowns 27.2.2 → 27.2.3

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.
@@ -1430,9 +1430,11 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1430
1430
  };
1431
1431
  DropDownBase.prototype.renderItemsBySelect = function () {
1432
1432
  var element = this.element;
1433
- var fields = { value: 'value', text: 'text' };
1434
- var jsonElement = [];
1435
1433
  var group = element.querySelectorAll('select>optgroup');
1434
+ var fields;
1435
+ var isSelectGroupCheck = this.getModuleName() === 'multiselect' && this.isGroupChecking && group.length > 0;
1436
+ fields = isSelectGroupCheck ? { value: 'value', text: 'text', groupBy: 'categeory' } : fields = { value: 'value', text: 'text' };
1437
+ var jsonElement = [];
1436
1438
  var option = element.querySelectorAll('select>option');
1437
1439
  this.getJSONfromOption(jsonElement, option, fields);
1438
1440
  if (group.length) {
@@ -1442,12 +1444,17 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1442
1444
  optionGroup[fields.text] = item.label;
1443
1445
  optionGroup.isHeader = true;
1444
1446
  var child = item.querySelectorAll('option');
1445
- jsonElement.push(optionGroup);
1446
- this.getJSONfromOption(jsonElement, child, fields);
1447
+ if (isSelectGroupCheck) {
1448
+ this.getJSONfromOption(jsonElement, child, fields, item.label);
1449
+ }
1450
+ else {
1451
+ jsonElement.push(optionGroup);
1452
+ this.getJSONfromOption(jsonElement, child, fields);
1453
+ }
1447
1454
  }
1448
1455
  element.querySelectorAll('select>option');
1449
1456
  }
1450
- this.updateFields(fields.text, fields.value, this.fields.groupBy, this.fields.htmlAttributes, this.fields.iconCss, this.fields.disabled);
1457
+ this.updateFields(fields.text, fields.value, isSelectGroupCheck ? fields.groupBy : this.fields.groupBy, this.fields.htmlAttributes, this.fields.iconCss, this.fields.disabled);
1451
1458
  this.resetList(jsonElement, fields);
1452
1459
  };
1453
1460
  DropDownBase.prototype.updateFields = function (text, value, groupBy, htmlAttributes, iconCss, disabled) {
@@ -1463,13 +1470,17 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1463
1470
  };
1464
1471
  this.setProperties(field, true);
1465
1472
  };
1466
- DropDownBase.prototype.getJSONfromOption = function (items, options, fields) {
1473
+ DropDownBase.prototype.getJSONfromOption = function (items, options, fields, category) {
1474
+ if (category === void 0) { category = null; }
1467
1475
  for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
1468
1476
  var option = options_1[_i];
1469
1477
  var json = {};
1470
1478
  json[fields.text] = option.innerText;
1471
1479
  json[fields.value] = !isNullOrUndefined(option.getAttribute(fields.value)) ?
1472
1480
  option.getAttribute(fields.value) : option.innerText;
1481
+ if (!isNullOrUndefined(category)) {
1482
+ json[fields.groupBy] = category;
1483
+ }
1473
1484
  items.push(json);
1474
1485
  }
1475
1486
  };
@@ -1925,7 +1936,12 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1925
1936
  if (this.sortOrder !== 'None') {
1926
1937
  dataSource = this.getSortedDataSource(dataSource);
1927
1938
  }
1928
- dataSource = ListBase.groupDataSource(dataSource, fields.properties, this.sortOrder);
1939
+ if (this.element.querySelector('optgroup') && this.isGroupChecking && this.getModuleName() === 'multiselect') {
1940
+ dataSource = ListBase.groupDataSource(dataSource, fields, this.sortOrder);
1941
+ }
1942
+ else {
1943
+ dataSource = ListBase.groupDataSource(dataSource, fields.properties, this.sortOrder);
1944
+ }
1929
1945
  }
1930
1946
  addClass([this.list], dropDownBaseClasses.grouping);
1931
1947
  }
@@ -20772,11 +20788,13 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
20772
20788
  if (fListBox.value.length === 1 && fListBox.getSelectedItems().length) {
20773
20789
  fListBox.value[0] = fListBox.getFormattedValue(fListBox.getSelectedItems()[0].getAttribute('data-value'));
20774
20790
  }
20775
- if (fListBox.liCollections.length === fListBox.ulElement.querySelectorAll('.e-disabled').length) {
20791
+ if (fListBox.liCollections.length === fListBox.ulElement.querySelectorAll('.e-disabled').length && this.toolbarAction) {
20776
20792
  var wrap = this.list.parentElement.getElementsByClassName('e-listbox-tool')[0];
20777
20793
  var toolbarAction = this.toolbarAction === 'moveFrom' ? 'moveAllFrom' : 'moveAllTo';
20778
- var btn = wrap.querySelector('[data-value="' + toolbarAction + '"]');
20779
- btn.disabled = true;
20794
+ if (wrap) {
20795
+ var btn = wrap.querySelector('[data-value="' + toolbarAction + '"]');
20796
+ btn.disabled = true;
20797
+ }
20780
20798
  }
20781
20799
  };
20782
20800
  ListBox.prototype.selectNextList = function (elems, dataLiIdx, dataIdx, inst) {