@syncfusion/ej2-dropdowns 25.1.41 → 25.2.4

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.
@@ -918,6 +918,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
918
918
  _this.appendUncheckList = false;
919
919
  _this.getInitialData = false;
920
920
  _this.preventPopupOpen = true;
921
+ _this.virtualSelectAllState = false;
922
+ _this.CurrentEvent = null;
921
923
  _this.virtualListInfo = {
922
924
  currentPageNumber: null,
923
925
  direction: null,
@@ -1517,8 +1519,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1517
1519
  if (!isWhereExist_1) {
1518
1520
  _this.remoteDataCount = e.count;
1519
1521
  }
1520
- _this.dataCount = e.count;
1521
- _this.totalItemCount = e.count;
1522
+ _this.dataCount = !_this.virtualSelectAll ? e.count : _this.dataCount;
1523
+ _this.totalItemCount = !_this.virtualSelectAll ? e.count : _this.totalItemCount;
1522
1524
  ulElement = _this.renderItems(listItems, fields);
1523
1525
  _this.appendUncheckList = false;
1524
1526
  _this.onActionComplete(ulElement, listItems, e);
@@ -1544,6 +1546,12 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1544
1546
  if (_this.isVirtualizationEnabled) {
1545
1547
  _this.getFilteringSkeletonCount();
1546
1548
  }
1549
+ if (_this.virtualSelectAll && _this.virtualSelectAllData) {
1550
+ _this.virtualSelectionAll(_this.virtualSelectAllState, _this.liCollections, _this.CurrentEvent);
1551
+ _this.virtualSelectAllState = false;
1552
+ _this.CurrentEvent = null;
1553
+ _this.virtualSelectAll = false;
1554
+ }
1547
1555
  }
1548
1556
  });
1549
1557
  }).catch(function (e) {
@@ -1595,11 +1603,11 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1595
1603
  }
1596
1604
  }
1597
1605
  }
1598
- if (isReOrder && (!(_this.dataSource instanceof DataManager) && !_this.isCustomDataUpdated)) {
1606
+ if (isReOrder && (!(_this.dataSource instanceof DataManager) && !_this.isCustomDataUpdated) && !_this.virtualSelectAll) {
1599
1607
  // eslint-disable @typescript-eslint/no-explicit-any
1600
1608
  _this.dataCount = _this.totalItemCount = _this.virtualSelectAll ? listItems.length : listItems.count;
1601
1609
  }
1602
- listItems = _this.isVirtualizationEnabled && !_this.virtualSelectAll ? listItems.result : listItems;
1610
+ listItems = _this.isVirtualizationEnabled ? listItems.result : listItems;
1603
1611
  // eslint-enable @typescript-eslint/no-explicit-any
1604
1612
  var localDataArgs = { cancel: false, result: listItems };
1605
1613
  _this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
@@ -1638,6 +1646,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1638
1646
  DropDownBase.prototype.updatePopupState = function () {
1639
1647
  // Used this method in component side.
1640
1648
  };
1649
+ DropDownBase.prototype.virtualSelectionAll = function (state, li, event) {
1650
+ // Used this method in component side.
1651
+ };
1641
1652
  DropDownBase.prototype.updateRemoteData = function () {
1642
1653
  this.setListData(this.dataSource, this.fields, this.query);
1643
1654
  };
@@ -2125,10 +2136,10 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2125
2136
  */
2126
2137
  DropDownBase.prototype.getIndexByValueFilter = function (value) {
2127
2138
  var index;
2128
- var listItems = this.renderItems(this.selectData, this.fields);
2129
- if (listItems && listItems.children) {
2130
- for (var i = 0; i < listItems.children.length; i++) {
2131
- if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
2139
+ var listItems = this.renderItems(this.dataSource, this.fields).querySelectorAll('li' + ':not(.e-list-group-item)');
2140
+ if (listItems) {
2141
+ for (var i = 0; i < listItems.length; i++) {
2142
+ if (!isNullOrUndefined(value) && listItems[i].getAttribute('data-value') === value.toString()) {
2132
2143
  index = i;
2133
2144
  break;
2134
2145
  }
@@ -2406,6 +2417,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2406
2417
  }
2407
2418
  if (this.getModuleName() === 'listbox') {
2408
2419
  this.updateActionCompleteData(li, item, isListboxEmpty ? null : index);
2420
+ isListboxEmpty = true;
2409
2421
  }
2410
2422
  else {
2411
2423
  this.updateActionCompleteData(li, item, index);
@@ -2453,7 +2465,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2453
2465
  }
2454
2466
  }
2455
2467
  else {
2456
- if (this.liCollections[index]) {
2468
+ if (this.liCollections[index] && this.liCollections[index].parentNode) {
2457
2469
  this.liCollections[index].parentNode.insertBefore(liCollections[i], this.liCollections[index]);
2458
2470
  }
2459
2471
  else {
@@ -5072,7 +5084,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5072
5084
  _this.popupContentElement.setAttribute('id', 'no-record');
5073
5085
  }
5074
5086
  _this.inputElement.setAttribute('aria-expanded', 'true');
5075
- _this.inputElement.setAttribute('aria-controls', _this.element.id);
5087
+ _this.inputElement.setAttribute('aria-controls', _this.element.id + '_popup');
5076
5088
  var inputParent = _this.isFiltering() ? _this.filterInput.parentElement : _this.inputWrapper.container;
5077
5089
  addClass([inputParent], [dropDownListClasses.inputFocus]);
5078
5090
  var animModel = { name: 'FadeIn', duration: 100 };
@@ -5603,6 +5615,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5603
5615
  DropDownList.prototype.destroyPopup = function () {
5604
5616
  this.isPopupOpen = false;
5605
5617
  this.isFilterFocus = false;
5618
+ this.inputElement.removeAttribute('aria-controls');
5606
5619
  if (this.popupObj) {
5607
5620
  this.popupObj.destroy();
5608
5621
  detach(this.popupObj.element);
@@ -5693,7 +5706,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5693
5706
  attributes(this.targetElement(), { 'aria-label': this.getModuleName() });
5694
5707
  this.inputElement.setAttribute('aria-label', this.getModuleName());
5695
5708
  this.inputElement.setAttribute('aria-expanded', 'false');
5696
- this.inputElement.setAttribute('aria-controls', this.element.id + '_popups');
5697
5709
  }
5698
5710
  attributes(this.targetElement(), this.getAriaAttributes());
5699
5711
  this.updateDataAttribute(this.htmlAttributes);
@@ -8204,10 +8216,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8204
8216
  focusedElement.focus();
8205
8217
  addClass([focusedElement], ['e-node-focus']);
8206
8218
  }
8207
- if (_this.checkSelectAll && _this.checkBoxElement) {
8208
- var wrap = closest(_this.checkBoxElement, '.' + CHECKBOXWRAP);
8209
- _this.changeState(wrap, 'check');
8210
- _this.checkSelectAll = false;
8219
+ if (_this.treeObj.checkedNodes.length > 0) {
8220
+ var nodes = _this.treeObj.element.querySelectorAll('li');
8221
+ var checkedNodes = _this.treeObj.element.querySelectorAll('li[aria-checked=true]');
8222
+ if ((checkedNodes.length === nodes.length || _this.checkSelectAll) && _this.checkBoxElement) {
8223
+ var wrap = closest(_this.checkBoxElement, '.' + CHECKBOXWRAP);
8224
+ _this.changeState(wrap, 'check');
8225
+ _this.checkSelectAll = false;
8226
+ }
8211
8227
  }
8212
8228
  if (_this.allowFiltering) {
8213
8229
  removeClass([_this.inputWrapper], [INPUTFOCUS]);
@@ -11679,6 +11695,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11679
11695
  _this.resetMainList = null;
11680
11696
  _this.resetFilteredData = false;
11681
11697
  _this.preventSetCurrentData = false;
11698
+ _this.isSelectAllLoop = false;
11682
11699
  _this.scrollFocusStatus = false;
11683
11700
  _this.keyDownStatus = false;
11684
11701
  _this.IsScrollerAtEnd = function () {
@@ -12006,7 +12023,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12006
12023
  if (!isNullOrUndefined(this.value)) {
12007
12024
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
12008
12025
  }
12009
- var customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
12026
+ var customValue = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
12010
12027
  if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
12011
12028
  customValue.toString() === 'NaN'))) {
12012
12029
  customValue = value;
@@ -12380,6 +12397,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12380
12397
  if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
12381
12398
  return this.virtualFilterQuery(filterQuery);
12382
12399
  }
12400
+ if (this.virtualSelectAll) {
12401
+ return query ? query.take(this.maximumSelectionLength).requiresCount() : this.query ? this.query.take(this.maximumSelectionLength).requiresCount() : new Query().take(this.maximumSelectionLength).requiresCount();
12402
+ }
12383
12403
  return query ? query : this.query ? this.query : new Query();
12384
12404
  }
12385
12405
  };
@@ -13549,7 +13569,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13549
13569
  this.removeChipSelection();
13550
13570
  this.addChipSelection(temp, e);
13551
13571
  }
13552
- var currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
13572
+ var currentChip = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) : selectedElem.getAttribute('data-value');
13553
13573
  this.removeValue(currentChip, e);
13554
13574
  this.makeTextBoxEmpty();
13555
13575
  }
@@ -13736,7 +13756,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13736
13756
  if (this.enabled && !this.readonly) {
13737
13757
  var element = e.target.parentElement;
13738
13758
  var customVal = element.getAttribute('data-value');
13739
- var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
13759
+ var value = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
13740
13760
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
13741
13761
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
13742
13762
  value = customVal;
@@ -13827,8 +13847,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13827
13847
  dropDownBaseClasses.selected;
13828
13848
  if (index !== -1) {
13829
13849
  var currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
13830
- var element_1 = this.findListElement(this.list, 'li', 'data-value', currentValue);
13831
- var val_1 = this.getDataByValue(value);
13850
+ var element_1 = this.virtualSelectAll ? null : this.findListElement(this.list, 'li', 'data-value', currentValue);
13851
+ var val_1 = this.allowObjectBinding ? value : this.getDataByValue(value);
13832
13852
  var eventArgs = {
13833
13853
  e: eve,
13834
13854
  item: element_1,
@@ -14016,9 +14036,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14016
14036
  this.value = [];
14017
14037
  }
14018
14038
  var currentValue = this.allowObjectBinding ? this.getDataByValue(value) : value;
14019
- if ((this.allowObjectBinding && !this.isObjectInArray(value, this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
14039
+ if ((this.allowObjectBinding && !this.isObjectInArray(this.getDataByValue(value), this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
14020
14040
  this.setProperties({ value: [].concat([], this.value, [currentValue]) }, true);
14021
- if (this.enableVirtualization) {
14041
+ if (this.enableVirtualization && !this.isSelectAllLoop) {
14022
14042
  var data = this.viewWrapper.innerHTML;
14023
14043
  var temp = void 0;
14024
14044
  data += (this.value.length === 1) ? '' : this.delimiterChar + ' ';
@@ -14859,7 +14879,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14859
14879
  if (!this.enableVirtualization) {
14860
14880
  this.listData = this.mainData;
14861
14881
  }
14862
- if (!isNullOrUndefined(this.hiddenElement)) {
14882
+ if (!isNullOrUndefined(this.hiddenElement) && !this.enableVirtualization) {
14863
14883
  this.hiddenElement.innerHTML = '';
14864
14884
  }
14865
14885
  if (!isNullOrUndefined(this.value)) {
@@ -14887,6 +14907,27 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14887
14907
  var textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
14888
14908
  data += temp + delimiterChar + ' ';
14889
14909
  text.push(textValues);
14910
+ hiddenElementContent = this.hiddenElement.innerHTML;
14911
+ if ((e && e.currentTarget && e.currentTarget.classList.contains('e-chips-close')) || (e && (e.key === 'Backspace'))) {
14912
+ var item = e.target.parentElement.getAttribute('data-value');
14913
+ if (e.key === 'Backspace') {
14914
+ var lastChild = this.hiddenElement.lastChild;
14915
+ if (lastChild) {
14916
+ this.hiddenElement.removeChild(lastChild);
14917
+ }
14918
+ }
14919
+ else {
14920
+ this.hiddenElement.childNodes.forEach(function (option) {
14921
+ if (option.value === item) {
14922
+ option.parentNode.removeChild(option);
14923
+ }
14924
+ });
14925
+ }
14926
+ hiddenElementContent = this.hiddenElement.innerHTML;
14927
+ }
14928
+ else {
14929
+ hiddenElementContent += "<option selected value=\"" + value + "\">" + index + "</option>";
14930
+ }
14890
14931
  break;
14891
14932
  }
14892
14933
  else {
@@ -15105,7 +15146,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15105
15146
  };
15106
15147
  MultiSelect.prototype.updateListSelection = function (li, e, length) {
15107
15148
  var customVal = li.getAttribute('data-value');
15108
- var value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
15149
+ var value = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
15109
15150
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
15110
15151
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
15111
15152
  value = customVal;
@@ -15811,14 +15852,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15811
15852
  var li;
15812
15853
  if (!isNullOrUndefined(this.list)) {
15813
15854
  li = this.list.querySelectorAll(state ?
15814
- 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
15815
- 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
15855
+ 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide):not(.e-virtual-list)' :
15856
+ 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide):not(.e-virtual-list)');
15816
15857
  }
15817
15858
  if (this.value && this.value.length && event && event.target
15818
15859
  && closest(event.target, '.e-close-hooker') && this.allowFiltering) {
15819
15860
  li = this.mainList.querySelectorAll(state ?
15820
- 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
15821
- 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
15861
+ 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide):not(.e-virtual-list)' :
15862
+ 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide):not(.e-virtual-list)');
15822
15863
  }
15823
15864
  if (this.enableGroupCheckBox && this.mode === 'CheckBox' && !isNullOrUndefined(this.fields.groupBy)) {
15824
15865
  var target = (event ? (this.groupTemplate ? closest(event.target, '.e-list-group-item') : event.target) : null);
@@ -15880,6 +15921,108 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15880
15921
  }
15881
15922
  this.addValidInputClass();
15882
15923
  };
15924
+ MultiSelect.prototype.virtualSelectionAll = function (state, li, event) {
15925
+ var _this = this;
15926
+ var index = 0;
15927
+ var length = li.length;
15928
+ var count = this.maximumSelectionLength;
15929
+ if (state) {
15930
+ length = this.virtualSelectAllData && this.virtualSelectAllData.length != 0 ? this.virtualSelectAllData.length : length;
15931
+ this.listData = this.virtualSelectAllData;
15932
+ var ulElement = this.createListItems(this.virtualSelectAllData.slice(0, 30), this.fields);
15933
+ var firstItems = ulElement.querySelectorAll('li');
15934
+ var fragment_1 = document.createDocumentFragment();
15935
+ firstItems.forEach(function (node) {
15936
+ fragment_1.appendChild(node.cloneNode(true));
15937
+ });
15938
+ li.forEach(function (node) {
15939
+ fragment_1.appendChild(node.cloneNode(true));
15940
+ });
15941
+ var concatenatedNodeList = fragment_1.childNodes;
15942
+ if (this.virtualSelectAllData instanceof Array) {
15943
+ while (index < length && index <= 50 && index < count) {
15944
+ this.isSelectAllTarget = (length === index + 1);
15945
+ if (concatenatedNodeList[index]) {
15946
+ var value = this.allowObjectBinding ? this.getDataByValue(concatenatedNodeList[index].getAttribute('data-value')) : this.getFormattedValue(concatenatedNodeList[index].getAttribute('data-value'));
15947
+ if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) >= 0) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) >= 0))) {
15948
+ index++;
15949
+ continue;
15950
+ }
15951
+ this.updateListSelection(concatenatedNodeList[index], event, length - index);
15952
+ }
15953
+ else {
15954
+ var value = getValue((this.fields.value) ? this.fields.value : '', this.virtualSelectAllData[index]);
15955
+ value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15956
+ if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) >= 0) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) >= 0))) {
15957
+ index++;
15958
+ continue;
15959
+ }
15960
+ if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
15961
+ this.dispatchSelect(value, event, null, false, length);
15962
+ }
15963
+ }
15964
+ index++;
15965
+ }
15966
+ if (length > 50) {
15967
+ setTimeout(function () {
15968
+ if (_this.virtualSelectAllData && _this.virtualSelectAllData.length > 0) {
15969
+ _this.virtualSelectAllData.map(function (obj) {
15970
+ if (_this.value && obj[_this.fields.value] != null && Array.isArray(_this.value) && ((!_this.allowObjectBinding && _this.value.indexOf(obj[_this.fields.value]) < 0) || (_this.allowObjectBinding && !_this.isObjectInArray(obj[_this.fields.value], _this.value)))) {
15971
+ _this.dispatchSelect(obj[_this.fields.value], event, null, false, length);
15972
+ }
15973
+ });
15974
+ }
15975
+ _this.updatedataValueItems(event);
15976
+ _this.isSelectAllLoop = false;
15977
+ if (!_this.changeOnBlur) {
15978
+ _this.updateValueState(event, _this.value, _this.tempValues);
15979
+ _this.isSelectAll = _this.isSelectAll ? !_this.isSelectAll : _this.isSelectAll;
15980
+ }
15981
+ _this.updateHiddenElement();
15982
+ if (_this.popupWrapper && li[index - 1] && li[index - 1].classList.contains('e-item-focus')) {
15983
+ var selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
15984
+ if (selectAllParent && selectAllParent.classList.contains('e-item-focus')) {
15985
+ li[index - 1].classList.remove('e-item-focus');
15986
+ }
15987
+ }
15988
+ }, 0);
15989
+ }
15990
+ }
15991
+ }
15992
+ else {
15993
+ if (this.virtualSelectAllData && this.virtualSelectAllData.length > 0) {
15994
+ this.virtualSelectAllData.map(function (obj) {
15995
+ _this.virtualSelectAll = true;
15996
+ _this.removeValue(_this.value[index], event, _this.value.length - index);
15997
+ });
15998
+ }
15999
+ this.updatedataValueItems(event);
16000
+ if (!this.changeOnBlur) {
16001
+ this.updateValueState(event, this.value, this.tempValues);
16002
+ this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
16003
+ }
16004
+ this.updateHiddenElement();
16005
+ this.value = [];
16006
+ this.virtualSelectAll = false;
16007
+ if (!isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
16008
+ this.notify("setCurrentViewDataAsync", {
16009
+ component: this.getModuleName(),
16010
+ module: "VirtualScroll",
16011
+ });
16012
+ }
16013
+ }
16014
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16015
+ var virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
16016
+ if (virtualTrackElement) {
16017
+ (virtualTrackElement).style = this.GetVirtualTrackHeight();
16018
+ }
16019
+ this.UpdateSkeleton();
16020
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16021
+ var virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
16022
+ if (virtualContentElement) {
16023
+ (virtualContentElement).style = this.getTransformValues();
16024
+ }
16025
+ };
15883
16026
  MultiSelect.prototype.updateValue = function (event, li, state) {
15884
16027
  var _this = this;
15885
16028
  var length = li.length;
@@ -15903,95 +16046,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15903
16046
  }
15904
16047
  if (!beforeSelectArgs.preventSelectEvent) {
15905
16048
  if (this.enableVirtualization) {
15906
- if (state) {
15907
- this.virtualSelectAll = true;
16049
+ this.virtualSelectAll = true;
16050
+ this.virtualSelectAllState = state;
16051
+ this.CurrentEvent = event;
16052
+ if (!this.virtualSelectAllData) {
15908
16053
  this.resetList(this.dataSource, this.fields, new Query());
15909
- if (this.virtualSelectAllData instanceof Array) {
15910
- for (var i = 0; i < this.virtualSelectAllData.length; i++) {
15911
- if (li[this.skeletonCount + i]) {
15912
- var value_2 = this.allowObjectBinding ? this.getDataByValue(li[this.skeletonCount + i].getAttribute('data-value')) : this.getFormattedValue(li[this.skeletonCount + i].getAttribute('data-value'));
15913
- if (((!this.allowObjectBinding && this.value && this.value.indexOf(value_2) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value_2, this.value) === 1))) {
15914
- continue;
15915
- }
15916
- this.updateListSelection(li[this.skeletonCount + i], event, length - i);
15917
- }
15918
- else {
15919
- if (this.fields) {
15920
- var value_3 = getValue(this.fields.value, this.virtualSelectAllData[i]);
15921
- value_3 = this.allowObjectBinding ? this.getDataByValue(value_3) : value_3;
15922
- if (((!this.allowObjectBinding && this.value && this.value.indexOf(value_3) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value_3, this.value) === 1))) {
15923
- continue;
15924
- }
15925
- if (this.value && value_3 != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value_3) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_3, this.value)))) {
15926
- this.dispatchSelect(value_3, event, null, false, length);
15927
- }
15928
- }
15929
- }
15930
- }
15931
- if (this.virtualSelectAllData && this.value.length != this.virtualSelectAllData.length && this.virtualItemStartIndex != 0) {
15932
- if (this.virtualItemStartIndex > this.itemCount) {
15933
- for (var i = 0; i < this.itemCount; i++) {
15934
- if (this.fields) {
15935
- var value_4 = getValue(this.fields.value, this.virtualSelectAllData[i]);
15936
- value_4 = this.allowObjectBinding ? this.getDataByValue(value_4) : value_4;
15937
- if (this.value && value_4 != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value_4) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_4, this.value)))) {
15938
- this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value_4]) }, true);
15939
- }
15940
- }
15941
- }
15942
- }
15943
- }
15944
- else {
15945
- for (var i = 0; i < this.virtualItemStartIndex; i++) {
15946
- if (this.fields) {
15947
- var value = getValue(this.fields.value, this.virtualSelectAllData[i]);
15948
- value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15949
- if (Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
15950
- this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
15951
- }
15952
- }
15953
- }
15954
- }
15955
- }
15956
- }
15957
- else {
15958
- while (index_2 < this.value.length && index_2 <= 50 && index_2 < count_1 && this.value.length > 0) {
15959
- this.removeValue(this.value[index_2], event, this.value.length - index_2);
15960
- index_2++;
15961
- }
15962
- if (length > 50) {
15963
- setTimeout(function () {
15964
- while (index_2 < _this.value.length && index_2 < count_1 && _this.value.length > 0) {
15965
- _this.removeValue(value[index_2], event, _this.value.length - index_2);
15966
- index_2++;
15967
- }
15968
- _this.updatedataValueItems(event);
15969
- if (!_this.changeOnBlur) {
15970
- _this.updateValueState(event, _this.value, _this.tempValues);
15971
- _this.isSelectAll = _this.isSelectAll ? !_this.isSelectAll : _this.isSelectAll;
15972
- }
15973
- _this.updateHiddenElement();
15974
- }, 0);
15975
- }
15976
- this.value = [];
15977
- this.virtualSelectAll = false;
15978
- if (!isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
15979
- this.notify("setCurrentViewDataAsync", {
15980
- component: this.getModuleName(),
15981
- module: "VirtualScroll",
15982
- });
15983
- }
15984
- }
15985
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15986
- var virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
15987
- if (virtualTrackElement) {
15988
- (virtualTrackElement).style = this.GetVirtualTrackHeight();
15989
16054
  }
15990
- this.UpdateSkeleton();
15991
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15992
- var virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
15993
- if (virtualContentElement) {
15994
- (virtualContentElement).style = this.getTransformValues();
16055
+ if (this.virtualSelectAllData) {
16056
+ this.virtualSelectionAll(state, li, event);
15995
16057
  }
15996
16058
  }
15997
16059
  else {
@@ -16030,29 +16092,29 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16030
16092
  }
16031
16093
  }
16032
16094
  else {
16033
- for (var i_1 = 0; i_1 < li.length && i_1 < count_1; i_1++) {
16095
+ for (var i = 0; i < li.length && i < count_1; i++) {
16034
16096
  this.removeHover();
16035
- var customVal = li[i_1].getAttribute('data-value');
16036
- var value_5 = this.getFormattedValue(customVal);
16037
- value_5 = this.allowObjectBinding ? this.getDataByValue(value_5) : value_5;
16097
+ var customVal = li[i].getAttribute('data-value');
16098
+ var value = this.getFormattedValue(customVal);
16099
+ value = this.allowObjectBinding ? this.getDataByValue(value) : value;
16038
16100
  var mainElement = this.mainList ? this.mainList.querySelectorAll(state ?
16039
16101
  'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
16040
- 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[i_1] : null;
16102
+ 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)')[i] : null;
16041
16103
  if (state) {
16042
16104
  this.value = !this.value ? [] : this.value;
16043
- if ((!this.allowObjectBinding && this.value.indexOf(value_5) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value_5, this.value))) {
16044
- this.setProperties({ value: [].concat([], this.value, [value_5]) }, true);
16105
+ if ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value))) {
16106
+ this.setProperties({ value: [].concat([], this.value, [value]) }, true);
16045
16107
  }
16046
16108
  this.removeFocus();
16047
- this.addListSelection(li[i_1], mainElement);
16109
+ this.addListSelection(li[i], mainElement);
16048
16110
  this.updateChipStatus();
16049
16111
  this.checkMaxSelection();
16050
16112
  }
16051
16113
  else {
16052
- this.removeAllItems(value_5, event, false, li[i_1], mainElement);
16114
+ this.removeAllItems(value, event, false, li[i], mainElement);
16053
16115
  }
16054
16116
  if (this.enableGroupCheckBox) {
16055
- this.findGroupStart(li[i_1]);
16117
+ this.findGroupStart(li[i]);
16056
16118
  }
16057
16119
  }
16058
16120
  if (!state) {
@@ -16080,7 +16142,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16080
16142
  this.updateValueState(event, this.value, this.tempValues);
16081
16143
  this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
16082
16144
  }
16083
- this.updateHiddenElement();
16145
+ if ((this.enableVirtualization && this.value && this.value.length > 0) || !this.enableVirtualization) {
16146
+ this.updateHiddenElement();
16147
+ }
16084
16148
  }
16085
16149
  };
16086
16150
  MultiSelect.prototype.updateHiddenElement = function () {
@@ -16186,7 +16250,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16186
16250
  }
16187
16251
  this.selectAllItem(state, event);
16188
16252
  }
16189
- this.virtualSelectAll = false;
16253
+ if (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualSelectAllData)) {
16254
+ this.virtualSelectAll = false;
16255
+ }
16190
16256
  };
16191
16257
  /**
16192
16258
  * Get the properties to be maintained in the persisted state.