@syncfusion/ej2-dropdowns 25.2.3 → 25.2.5

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.
@@ -840,6 +840,8 @@ let DropDownBase = class DropDownBase extends Component {
840
840
  this.appendUncheckList = false;
841
841
  this.getInitialData = false;
842
842
  this.preventPopupOpen = true;
843
+ this.virtualSelectAllState = false;
844
+ this.CurrentEvent = null;
843
845
  this.virtualListInfo = {
844
846
  currentPageNumber: null,
845
847
  direction: null,
@@ -1434,8 +1436,8 @@ let DropDownBase = class DropDownBase extends Component {
1434
1436
  if (!isWhereExist) {
1435
1437
  this.remoteDataCount = e.count;
1436
1438
  }
1437
- this.dataCount = e.count;
1438
- this.totalItemCount = e.count;
1439
+ this.dataCount = !this.virtualSelectAll ? e.count : this.dataCount;
1440
+ this.totalItemCount = !this.virtualSelectAll ? e.count : this.totalItemCount;
1439
1441
  ulElement = this.renderItems(listItems, fields);
1440
1442
  this.appendUncheckList = false;
1441
1443
  this.onActionComplete(ulElement, listItems, e);
@@ -1461,6 +1463,12 @@ let DropDownBase = class DropDownBase extends Component {
1461
1463
  if (this.isVirtualizationEnabled) {
1462
1464
  this.getFilteringSkeletonCount();
1463
1465
  }
1466
+ if (this.virtualSelectAll && this.virtualSelectAllData) {
1467
+ this.virtualSelectionAll(this.virtualSelectAllState, this.liCollections, this.CurrentEvent);
1468
+ this.virtualSelectAllState = false;
1469
+ this.CurrentEvent = null;
1470
+ this.virtualSelectAll = false;
1471
+ }
1464
1472
  }
1465
1473
  });
1466
1474
  }).catch((e) => {
@@ -1512,11 +1520,11 @@ let DropDownBase = class DropDownBase extends Component {
1512
1520
  }
1513
1521
  }
1514
1522
  }
1515
- if (isReOrder && (!(this.dataSource instanceof DataManager) && !this.isCustomDataUpdated)) {
1523
+ if (isReOrder && (!(this.dataSource instanceof DataManager) && !this.isCustomDataUpdated) && !this.virtualSelectAll) {
1516
1524
  // eslint-disable @typescript-eslint/no-explicit-any
1517
1525
  this.dataCount = this.totalItemCount = this.virtualSelectAll ? listItems.length : listItems.count;
1518
1526
  }
1519
- listItems = this.isVirtualizationEnabled && !this.virtualSelectAll ? listItems.result : listItems;
1527
+ listItems = this.isVirtualizationEnabled ? listItems.result : listItems;
1520
1528
  // eslint-enable @typescript-eslint/no-explicit-any
1521
1529
  const localDataArgs = { cancel: false, result: listItems };
1522
1530
  this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
@@ -1555,6 +1563,9 @@ let DropDownBase = class DropDownBase extends Component {
1555
1563
  updatePopupState() {
1556
1564
  // Used this method in component side.
1557
1565
  }
1566
+ virtualSelectionAll(state, li, event) {
1567
+ // Used this method in component side.
1568
+ }
1558
1569
  updateRemoteData() {
1559
1570
  this.setListData(this.dataSource, this.fields, this.query);
1560
1571
  }
@@ -1845,10 +1856,14 @@ let DropDownBase = class DropDownBase extends Component {
1845
1856
  }
1846
1857
  }
1847
1858
  updateGroupFixedHeader(element, target) {
1848
- this.fixedHeaderElement.innerHTML = element.innerHTML;
1849
- this.fixedHeaderElement.style.position = 'fixed';
1850
- this.fixedHeaderElement.style.top = this.list.parentElement.offsetTop + this.list.offsetTop + 'px';
1851
- this.fixedHeaderElement.style.display = 'block';
1859
+ if (this.fixedHeaderElement) {
1860
+ if (!isNullOrUndefined(element.innerHTML)) {
1861
+ this.fixedHeaderElement.innerHTML = element.innerHTML;
1862
+ }
1863
+ this.fixedHeaderElement.style.position = 'fixed';
1864
+ this.fixedHeaderElement.style.top = (this.list.parentElement.offsetTop + this.list.offsetTop) - window.scrollY + 'px';
1865
+ this.fixedHeaderElement.style.display = 'block';
1866
+ }
1852
1867
  }
1853
1868
  getValidLi() {
1854
1869
  if (this.isVirtualizationEnabled) {
@@ -2039,12 +2054,15 @@ let DropDownBase = class DropDownBase extends Component {
2039
2054
  * @param {string | number | boolean} value - Specifies given value.
2040
2055
  * @returns {number} Returns the index of the item.
2041
2056
  */
2042
- getIndexByValueFilter(value) {
2057
+ getIndexByValueFilter(value, ulElement) {
2043
2058
  let index;
2044
- const listItems = this.renderItems(this.selectData, this.fields);
2045
- if (listItems && listItems.children) {
2046
- for (let i = 0; i < listItems.children.length; i++) {
2047
- if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
2059
+ if (!ulElement) {
2060
+ return null;
2061
+ }
2062
+ const listItems = ulElement.querySelectorAll('li' + ':not(.e-list-group-item)');
2063
+ if (listItems) {
2064
+ for (let i = 0; i < listItems.length; i++) {
2065
+ if (!isNullOrUndefined(value) && listItems[i].getAttribute('data-value') === value.toString()) {
2048
2066
  index = i;
2049
2067
  break;
2050
2068
  }
@@ -2205,6 +2223,7 @@ let DropDownBase = class DropDownBase extends Component {
2205
2223
  const group = this.element.querySelector('select>optgroup');
2206
2224
  if ((this.fields.groupBy || !isNullOrUndefined(group)) && !this.isGroupChecking) {
2207
2225
  EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
2226
+ EventHandler.add(document, 'scroll', this.updateGroupFixedHeader, this);
2208
2227
  }
2209
2228
  if (this.getModuleName() === 'dropdownbase') {
2210
2229
  if (this.element.getAttribute('tabindex')) {
@@ -2456,12 +2475,15 @@ let DropDownBase = class DropDownBase extends Component {
2456
2475
  * @returns {void}
2457
2476
  */
2458
2477
  destroy() {
2459
- if (document.body.contains(this.list)) {
2460
- EventHandler.remove(this.list, 'scroll', this.setFloatingHeader);
2461
- if (!isNullOrUndefined(this.rippleFun)) {
2462
- this.rippleFun();
2478
+ if (document) {
2479
+ EventHandler.remove(document, 'scroll', this.updateGroupFixedHeader);
2480
+ if (document.body.contains(this.list)) {
2481
+ EventHandler.remove(this.list, 'scroll', this.setFloatingHeader);
2482
+ if (!isNullOrUndefined(this.rippleFun)) {
2483
+ this.rippleFun();
2484
+ }
2485
+ detach(this.list);
2463
2486
  }
2464
- detach(this.list);
2465
2487
  }
2466
2488
  this.liCollections = null;
2467
2489
  this.ulElement = null;
@@ -2610,6 +2632,12 @@ let DropDownList = class DropDownList extends DropDownBase {
2610
2632
  this.IsScrollerAtEnd = function () {
2611
2633
  return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
2612
2634
  };
2635
+ this.removeAllChildren = function (element) {
2636
+ while (element.children[0]) {
2637
+ this.removeAllChildren(element.children[0]);
2638
+ element.removeChild(element.children[0]);
2639
+ }
2640
+ };
2613
2641
  }
2614
2642
  /**
2615
2643
  * Initialize the event handler.
@@ -3496,7 +3524,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3496
3524
  }
3497
3525
  if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
3498
3526
  let value = this.getItemData().value;
3499
- let filterIndex = this.getIndexByValueFilter(value);
3527
+ let filterIndex = this.getIndexByValueFilter(value, this.actionCompleteData.ulElement);
3500
3528
  if (!isNullOrUndefined(filterIndex)) {
3501
3529
  this.activeIndex = filterIndex;
3502
3530
  }
@@ -3838,7 +3866,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3838
3866
  value = 'null';
3839
3867
  }
3840
3868
  if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
3841
- let filterIndex = this.getIndexByValueFilter(value);
3869
+ let filterIndex = this.getIndexByValueFilter(value, this.actionCompleteData.ulElement);
3842
3870
  if (!isNullOrUndefined(filterIndex)) {
3843
3871
  this.activeIndex = filterIndex;
3844
3872
  }
@@ -3880,7 +3908,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3880
3908
  this.inputElement.style.display = 'block';
3881
3909
  }
3882
3910
  if (!isNullOrUndefined(dataItem.value) && !this.enableVirtualization && this.allowFiltering) {
3883
- this.activeIndex = this.getIndexByValueFilter(dataItem.value);
3911
+ this.activeIndex = this.getIndexByValueFilter(dataItem.value, this.actionCompleteData.ulElement);
3884
3912
  }
3885
3913
  const clearIcon = dropDownListClasses.clearIcon;
3886
3914
  const isFilterElement = this.isFiltering() && this.filterInput && (this.getModuleName() === 'combobox');
@@ -4953,7 +4981,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4953
4981
  this.popupContentElement.setAttribute('id', 'no-record');
4954
4982
  }
4955
4983
  this.inputElement.setAttribute('aria-expanded', 'true');
4956
- this.inputElement.setAttribute('aria-controls', this.element.id);
4984
+ this.inputElement.setAttribute('aria-controls', this.element.id + '_popup');
4957
4985
  const inputParent = this.isFiltering() ? this.filterInput.parentElement : this.inputWrapper.container;
4958
4986
  addClass([inputParent], [dropDownListClasses.inputFocus]);
4959
4987
  const animModel = { name: 'FadeIn', duration: 100 };
@@ -5328,6 +5356,14 @@ let DropDownList = class DropDownList extends DropDownBase {
5328
5356
  this.keyboardEvent = null;
5329
5357
  EventHandler.remove(document, 'mousedown', this.onDocumentClick);
5330
5358
  this.isActive = false;
5359
+ if (this.getModuleName() === 'dropdownlist') {
5360
+ Input.destroy({
5361
+ element: this.filterInput,
5362
+ floatLabelType: this.floatLabelType,
5363
+ properties: { placeholder: this.filterBarPlaceholder },
5364
+ buttons: this.clearIconElement,
5365
+ }, this.clearIconElement);
5366
+ }
5331
5367
  this.filterInputObj = null;
5332
5368
  this.isDropDownClick = false;
5333
5369
  this.preventAutoFill = false;
@@ -5358,6 +5394,11 @@ let DropDownList = class DropDownList extends DropDownBase {
5358
5394
  }
5359
5395
  if (this.allowFiltering && this.getModuleName() === 'dropdownlist') {
5360
5396
  this.filterInput.removeAttribute('aria-activedescendant');
5397
+ this.filterInput.removeAttribute('aria-disabled');
5398
+ this.filterInput.removeAttribute('role');
5399
+ this.filterInput.removeAttribute('autocomplete');
5400
+ this.filterInput.removeAttribute('autocapitalize');
5401
+ this.filterInput.removeAttribute('spellcheck');
5361
5402
  }
5362
5403
  this.filterInput = null;
5363
5404
  }
@@ -5477,6 +5518,7 @@ let DropDownList = class DropDownList extends DropDownBase {
5477
5518
  destroyPopup() {
5478
5519
  this.isPopupOpen = false;
5479
5520
  this.isFilterFocus = false;
5521
+ this.inputElement.removeAttribute('aria-controls');
5480
5522
  if (this.popupObj) {
5481
5523
  this.popupObj.destroy();
5482
5524
  detach(this.popupObj.element);
@@ -5567,7 +5609,6 @@ let DropDownList = class DropDownList extends DropDownBase {
5567
5609
  attributes(this.targetElement(), { 'aria-label': this.getModuleName() });
5568
5610
  this.inputElement.setAttribute('aria-label', this.getModuleName());
5569
5611
  this.inputElement.setAttribute('aria-expanded', 'false');
5570
- this.inputElement.setAttribute('aria-controls', this.element.id + '_popups');
5571
5612
  }
5572
5613
  attributes(this.targetElement(), this.getAriaAttributes());
5573
5614
  this.updateDataAttribute(this.htmlAttributes);
@@ -5784,8 +5825,8 @@ let DropDownList = class DropDownList extends DropDownBase {
5784
5825
  */
5785
5826
  onPropertyChanged(newProp, oldProp) {
5786
5827
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5787
- if (!isNullOrUndefined(newProp.dataSource) && !this.isTouched && (isNullOrUndefined(newProp.value) && isNullOrUndefined(newProp.index)) && !isNullOrUndefined(this.preselectedIndex)) {
5788
- newProp.index = this.preselectedIndex;
5828
+ if (!isNullOrUndefined(newProp.dataSource) && !this.isTouched && (isNullOrUndefined(newProp.value) && isNullOrUndefined(newProp.index)) && !isNullOrUndefined(this.preselectedIndex) && !isNullOrUndefined(this.index)) {
5829
+ newProp.index = this.index;
5789
5830
  }
5790
5831
  if (!isNullOrUndefined(newProp.value) || !isNullOrUndefined(newProp.index)) {
5791
5832
  this.isTouched = true;
@@ -6298,10 +6339,12 @@ let DropDownList = class DropDownList extends DropDownBase {
6298
6339
  this.inputWrapper.container.parentElement.insertBefore(this.element, this.inputWrapper.container);
6299
6340
  detach(this.inputWrapper.container);
6300
6341
  }
6301
- this.hiddenElement = null;
6342
+ delete this.hiddenElement;
6302
6343
  this.filterInput = null;
6303
- this.inputWrapper = null;
6304
6344
  this.keyboardModule = null;
6345
+ if (!isNullOrUndefined(this.ulElement)) {
6346
+ this.removeAllChildren(this.ulElement);
6347
+ }
6305
6348
  this.ulElement = null;
6306
6349
  this.list = null;
6307
6350
  this.clearIconElement = null;
@@ -6325,10 +6368,12 @@ let DropDownList = class DropDownList extends DropDownBase {
6325
6368
  Input.destroy({
6326
6369
  element: this.inputElement,
6327
6370
  floatLabelType: this.floatLabelType,
6328
- properties: this.properties
6371
+ properties: this.properties,
6372
+ buttons: this.inputWrapper.container.querySelectorAll('.e-input-group-icon')[0],
6329
6373
  }, this.clearButton);
6330
6374
  this.clearButton = null;
6331
6375
  this.inputElement = null;
6376
+ this.inputWrapper = null;
6332
6377
  super.destroy();
6333
6378
  }
6334
6379
  /* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
@@ -8029,10 +8074,14 @@ let DropDownTree = class DropDownTree extends Component {
8029
8074
  focusedElement.focus();
8030
8075
  addClass([focusedElement], ['e-node-focus']);
8031
8076
  }
8032
- if (this.checkSelectAll && this.checkBoxElement) {
8033
- const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
8034
- this.changeState(wrap, 'check');
8035
- this.checkSelectAll = false;
8077
+ if (this.treeObj.checkedNodes.length > 0) {
8078
+ const nodes = this.treeObj.element.querySelectorAll('li');
8079
+ const checkedNodes = this.treeObj.element.querySelectorAll('li[aria-checked=true]');
8080
+ if ((checkedNodes.length === nodes.length || this.checkSelectAll) && this.checkBoxElement) {
8081
+ const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
8082
+ this.changeState(wrap, 'check');
8083
+ this.checkSelectAll = false;
8084
+ }
8036
8085
  }
8037
8086
  if (this.allowFiltering) {
8038
8087
  removeClass([this.inputWrapper], [INPUTFOCUS]);
@@ -8379,6 +8428,8 @@ let DropDownTree = class DropDownTree extends Component {
8379
8428
  if (this.showCheckBox) {
8380
8429
  return;
8381
8430
  }
8431
+ const eventArgs = this.getEventArgs(args);
8432
+ this.trigger('select', eventArgs);
8382
8433
  let selectedText;
8383
8434
  if (args.isInteracted) {
8384
8435
  const id = getValue('id', args.nodeData).toString();
@@ -8406,8 +8457,6 @@ let DropDownTree = class DropDownTree extends Component {
8406
8457
  this.setMultiSelect();
8407
8458
  }
8408
8459
  }
8409
- const eventArgs = this.getEventArgs(args);
8410
- this.trigger('select', eventArgs);
8411
8460
  if (this.isValueChange && !this.changeOnBlur) {
8412
8461
  this.triggerChangeEvent(this.keyEventArgs);
8413
8462
  this.isValueChange = false;
@@ -11241,6 +11290,7 @@ function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement,
11241
11290
  element.id = id;
11242
11291
  if (!isNullOrUndefined(element.id) && element.id !== '') {
11243
11292
  floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');
11293
+ floatLabelElement.setAttribute('for', element.id);
11244
11294
  attributes(inputElement, { 'aria-labelledby': floatLabelElement.id });
11245
11295
  }
11246
11296
  if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {
@@ -11448,6 +11498,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11448
11498
  this.resetMainList = null;
11449
11499
  this.resetFilteredData = false;
11450
11500
  this.preventSetCurrentData = false;
11501
+ this.isSelectAllLoop = false;
11451
11502
  this.scrollFocusStatus = false;
11452
11503
  this.keyDownStatus = false;
11453
11504
  this.IsScrollerAtEnd = function () {
@@ -11772,7 +11823,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11772
11823
  if (!isNullOrUndefined(this.value)) {
11773
11824
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
11774
11825
  }
11775
- let customValue = this.allowObjectBinding ? this.getDataByValue(value) : this.getFormattedValue(value);
11826
+ let customValue = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
11776
11827
  if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
11777
11828
  customValue.toString() === 'NaN'))) {
11778
11829
  customValue = value;
@@ -12146,6 +12197,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12146
12197
  if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
12147
12198
  return this.virtualFilterQuery(filterQuery);
12148
12199
  }
12200
+ if (this.virtualSelectAll) {
12201
+ return query ? query.take(this.maximumSelectionLength).requiresCount() : this.query ? this.query.take(this.maximumSelectionLength).requiresCount() : new Query().take(this.maximumSelectionLength).requiresCount();
12202
+ }
12149
12203
  return query ? query : this.query ? this.query : new Query();
12150
12204
  }
12151
12205
  }
@@ -13311,7 +13365,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13311
13365
  this.removeChipSelection();
13312
13366
  this.addChipSelection(temp, e);
13313
13367
  }
13314
- const currentChip = this.allowObjectBinding ? this.getDataByValue(selectedElem.getAttribute('data-value')) : selectedElem.getAttribute('data-value');
13368
+ const currentChip = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(selectedElem.getAttribute('data-value'))) : selectedElem.getAttribute('data-value');
13315
13369
  this.removeValue(currentChip, e);
13316
13370
  this.makeTextBoxEmpty();
13317
13371
  }
@@ -13497,7 +13551,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13497
13551
  if (this.enabled && !this.readonly) {
13498
13552
  const element = e.target.parentElement;
13499
13553
  const customVal = element.getAttribute('data-value');
13500
- let value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
13554
+ let value = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
13501
13555
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
13502
13556
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
13503
13557
  value = customVal;
@@ -13587,8 +13641,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13587
13641
  dropDownBaseClasses.selected;
13588
13642
  if (index !== -1) {
13589
13643
  const currentValue = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
13590
- const element = this.findListElement(this.list, 'li', 'data-value', currentValue);
13591
- const val = this.getDataByValue(value);
13644
+ const element = this.virtualSelectAll ? null : this.findListElement(this.list, 'li', 'data-value', currentValue);
13645
+ const val = this.allowObjectBinding ? value : this.getDataByValue(value);
13592
13646
  const eventArgs = {
13593
13647
  e: eve,
13594
13648
  item: element,
@@ -13771,9 +13825,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13771
13825
  this.value = [];
13772
13826
  }
13773
13827
  let currentValue = this.allowObjectBinding ? this.getDataByValue(value) : value;
13774
- if ((this.allowObjectBinding && !this.isObjectInArray(value, this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
13828
+ if ((this.allowObjectBinding && !this.isObjectInArray(this.getDataByValue(value), this.value)) || (!this.allowObjectBinding && this.value.indexOf(currentValue) < 0)) {
13775
13829
  this.setProperties({ value: [].concat([], this.value, [currentValue]) }, true);
13776
- if (this.enableVirtualization) {
13830
+ if (this.enableVirtualization && !this.isSelectAllLoop) {
13777
13831
  let data = this.viewWrapper.innerHTML;
13778
13832
  let temp;
13779
13833
  data += (this.value.length === 1) ? '' : this.delimiterChar + ' ';
@@ -14609,7 +14663,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14609
14663
  if (!this.enableVirtualization) {
14610
14664
  this.listData = this.mainData;
14611
14665
  }
14612
- if (!isNullOrUndefined(this.hiddenElement)) {
14666
+ if (!isNullOrUndefined(this.hiddenElement) && !this.enableVirtualization) {
14613
14667
  this.hiddenElement.innerHTML = '';
14614
14668
  }
14615
14669
  if (!isNullOrUndefined(this.value)) {
@@ -14637,7 +14691,27 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14637
14691
  let textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
14638
14692
  data += temp + delimiterChar + ' ';
14639
14693
  text.push(textValues);
14640
- hiddenElementContent += `<option selected value="${valueItem}">${index}</option>`;
14694
+ hiddenElementContent = this.hiddenElement.innerHTML;
14695
+ if ((e && e.currentTarget && e.currentTarget.classList.contains('e-chips-close')) || (e && (e.key === 'Backspace'))) {
14696
+ var item = e.target.parentElement.getAttribute('data-value');
14697
+ if (e.key === 'Backspace') {
14698
+ const lastChild = this.hiddenElement.lastChild;
14699
+ if (lastChild) {
14700
+ this.hiddenElement.removeChild(lastChild);
14701
+ }
14702
+ }
14703
+ else {
14704
+ this.hiddenElement.childNodes.forEach((option) => {
14705
+ if (option.value === item) {
14706
+ option.parentNode.removeChild(option);
14707
+ }
14708
+ });
14709
+ }
14710
+ hiddenElementContent = this.hiddenElement.innerHTML;
14711
+ }
14712
+ else {
14713
+ hiddenElementContent += "<option selected value=\"" + value + "\">" + index + "</option>";
14714
+ }
14641
14715
  break;
14642
14716
  }
14643
14717
  else {
@@ -14856,7 +14930,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14856
14930
  }
14857
14931
  updateListSelection(li, e, length) {
14858
14932
  const customVal = li.getAttribute('data-value');
14859
- let value = this.allowObjectBinding ? this.getDataByValue(customVal) : this.getFormattedValue(customVal);
14933
+ let value = this.allowObjectBinding ? this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
14860
14934
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
14861
14935
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
14862
14936
  value = customVal;
@@ -15560,14 +15634,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15560
15634
  let li;
15561
15635
  if (!isNullOrUndefined(this.list)) {
15562
15636
  li = this.list.querySelectorAll(state ?
15563
- 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
15564
- 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
15637
+ 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide):not(.e-virtual-list)' :
15638
+ 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide):not(.e-virtual-list)');
15565
15639
  }
15566
15640
  if (this.value && this.value.length && event && event.target
15567
15641
  && closest(event.target, '.e-close-hooker') && this.allowFiltering) {
15568
15642
  li = this.mainList.querySelectorAll(state ?
15569
- 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide)' :
15570
- 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide)');
15643
+ 'li.e-list-item:not([aria-selected="true"]):not(.e-reorder-hide):not(.e-virtual-list)' :
15644
+ 'li.e-list-item[aria-selected="true"]:not(.e-reorder-hide):not(.e-virtual-list)');
15571
15645
  }
15572
15646
  if (this.enableGroupCheckBox && this.mode === 'CheckBox' && !isNullOrUndefined(this.fields.groupBy)) {
15573
15647
  let target = (event ? (this.groupTemplate ? closest(event.target, '.e-list-group-item') : event.target) : null);
@@ -15629,8 +15703,109 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15629
15703
  }
15630
15704
  this.addValidInputClass();
15631
15705
  }
15706
+ virtualSelectionAll(state, li, event) {
15707
+ let index = 0;
15708
+ let length = li.length;
15709
+ let count = this.maximumSelectionLength;
15710
+ if (state) {
15711
+ length = this.virtualSelectAllData && this.virtualSelectAllData.length != 0 ? this.virtualSelectAllData.length : length;
15712
+ this.listData = this.virtualSelectAllData;
15713
+ const ulElement = this.createListItems(this.virtualSelectAllData.slice(0, 30), this.fields);
15714
+ const firstItems = ulElement.querySelectorAll('li');
15715
+ const fragment = document.createDocumentFragment();
15716
+ firstItems.forEach((node) => {
15717
+ fragment.appendChild(node.cloneNode(true));
15718
+ });
15719
+ li.forEach((node) => {
15720
+ fragment.appendChild(node.cloneNode(true));
15721
+ });
15722
+ const concatenatedNodeList = fragment.childNodes;
15723
+ if (this.virtualSelectAllData instanceof Array) {
15724
+ while (index < length && index <= 50 && index < count) {
15725
+ this.isSelectAllTarget = (length === index + 1);
15726
+ if (concatenatedNodeList[index]) {
15727
+ let value = this.allowObjectBinding ? this.getDataByValue(concatenatedNodeList[index].getAttribute('data-value')) : this.getFormattedValue(concatenatedNodeList[index].getAttribute('data-value'));
15728
+ if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) >= 0) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) >= 0))) {
15729
+ index++;
15730
+ continue;
15731
+ }
15732
+ this.updateListSelection(concatenatedNodeList[index], event, length - index);
15733
+ }
15734
+ else {
15735
+ let value = getValue((this.fields.value) ? this.fields.value : '', this.virtualSelectAllData[index]);
15736
+ value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15737
+ if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) >= 0) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) >= 0))) {
15738
+ index++;
15739
+ continue;
15740
+ }
15741
+ if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
15742
+ this.dispatchSelect(value, event, null, false, length);
15743
+ }
15744
+ }
15745
+ index++;
15746
+ }
15747
+ if (length > 50) {
15748
+ setTimeout(() => {
15749
+ if (this.virtualSelectAllData && this.virtualSelectAllData.length > 0) {
15750
+ this.virtualSelectAllData.map((obj) => {
15751
+ 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)))) {
15752
+ this.dispatchSelect(obj[this.fields.value], event, null, false, length);
15753
+ }
15754
+ });
15755
+ }
15756
+ this.updatedataValueItems(event);
15757
+ this.isSelectAllLoop = false;
15758
+ if (!this.changeOnBlur) {
15759
+ this.updateValueState(event, this.value, this.tempValues);
15760
+ this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
15761
+ }
15762
+ this.updateHiddenElement();
15763
+ if (this.popupWrapper && li[index - 1] && li[index - 1].classList.contains('e-item-focus')) {
15764
+ const selectAllParent = document.getElementsByClassName('e-selectall-parent')[0];
15765
+ if (selectAllParent && selectAllParent.classList.contains('e-item-focus')) {
15766
+ li[index - 1].classList.remove('e-item-focus');
15767
+ }
15768
+ }
15769
+ }, 0);
15770
+ }
15771
+ }
15772
+ }
15773
+ else {
15774
+ if (this.virtualSelectAllData && this.virtualSelectAllData.length > 0) {
15775
+ this.virtualSelectAllData.map((obj) => {
15776
+ this.virtualSelectAll = true;
15777
+ this.removeValue(this.value[index], event, this.value.length - index);
15778
+ });
15779
+ }
15780
+ this.updatedataValueItems(event);
15781
+ if (!this.changeOnBlur) {
15782
+ this.updateValueState(event, this.value, this.tempValues);
15783
+ this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
15784
+ }
15785
+ this.updateHiddenElement();
15786
+ this.value = [];
15787
+ this.virtualSelectAll = false;
15788
+ if (!isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
15789
+ this.notify("setCurrentViewDataAsync", {
15790
+ component: this.getModuleName(),
15791
+ module: "VirtualScroll",
15792
+ });
15793
+ }
15794
+ }
15795
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15796
+ const virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
15797
+ if (virtualTrackElement) {
15798
+ (virtualTrackElement).style = this.GetVirtualTrackHeight();
15799
+ }
15800
+ this.UpdateSkeleton();
15801
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15802
+ const virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
15803
+ if (virtualContentElement) {
15804
+ (virtualContentElement).style = this.getTransformValues();
15805
+ }
15806
+ }
15632
15807
  updateValue(event, li, state) {
15633
- const length = li.length;
15808
+ let length = li.length;
15634
15809
  const beforeSelectArgs = {
15635
15810
  event: event,
15636
15811
  items: state ? li : [],
@@ -15651,95 +15826,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15651
15826
  }
15652
15827
  if (!beforeSelectArgs.preventSelectEvent) {
15653
15828
  if (this.enableVirtualization) {
15654
- if (state) {
15655
- this.virtualSelectAll = true;
15829
+ this.virtualSelectAll = true;
15830
+ this.virtualSelectAllState = state;
15831
+ this.CurrentEvent = event;
15832
+ if (!this.virtualSelectAllData) {
15656
15833
  this.resetList(this.dataSource, this.fields, new Query());
15657
- if (this.virtualSelectAllData instanceof Array) {
15658
- for (var i = 0; i < this.virtualSelectAllData.length; i++) {
15659
- if (li[this.skeletonCount + i]) {
15660
- let value = this.allowObjectBinding ? this.getDataByValue(li[this.skeletonCount + i].getAttribute('data-value')) : this.getFormattedValue(li[this.skeletonCount + i].getAttribute('data-value'));
15661
- if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === 1))) {
15662
- continue;
15663
- }
15664
- this.updateListSelection(li[this.skeletonCount + i], event, length - i);
15665
- }
15666
- else {
15667
- if (this.fields) {
15668
- let value = getValue(this.fields.value, this.virtualSelectAllData[i]);
15669
- value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15670
- if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) === 1) || (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) === 1))) {
15671
- continue;
15672
- }
15673
- if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
15674
- this.dispatchSelect(value, event, null, false, length);
15675
- }
15676
- }
15677
- }
15678
- }
15679
- if (this.virtualSelectAllData && this.value.length != this.virtualSelectAllData.length && this.virtualItemStartIndex != 0) {
15680
- if (this.virtualItemStartIndex > this.itemCount) {
15681
- for (var i = 0; i < this.itemCount; i++) {
15682
- if (this.fields) {
15683
- let value = getValue(this.fields.value, this.virtualSelectAllData[i]);
15684
- value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15685
- if (this.value && value != null && Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
15686
- this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
15687
- }
15688
- }
15689
- }
15690
- }
15691
- }
15692
- else {
15693
- for (var i = 0; i < this.virtualItemStartIndex; i++) {
15694
- if (this.fields) {
15695
- var value = getValue(this.fields.value, this.virtualSelectAllData[i]);
15696
- value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15697
- if (Array.isArray(this.value) && ((!this.allowObjectBinding && this.value.indexOf(value) < 0) || (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
15698
- this.setProperties({ value: [].concat([], this.value, this.allowObjectBinding ? [this.virtualSelectAllData[i]] : [value]) }, true);
15699
- }
15700
- }
15701
- }
15702
- }
15703
- }
15704
15834
  }
15705
- else {
15706
- while (index < this.value.length && index <= 50 && index < count && this.value.length > 0) {
15707
- this.removeValue(this.value[index], event, this.value.length - index);
15708
- index++;
15709
- }
15710
- if (length > 50) {
15711
- setTimeout(() => {
15712
- while (index < this.value.length && index < count && this.value.length > 0) {
15713
- this.removeValue(value[index], event, this.value.length - index);
15714
- index++;
15715
- }
15716
- this.updatedataValueItems(event);
15717
- if (!this.changeOnBlur) {
15718
- this.updateValueState(event, this.value, this.tempValues);
15719
- this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
15720
- }
15721
- this.updateHiddenElement();
15722
- }, 0);
15723
- }
15724
- this.value = [];
15725
- this.virtualSelectAll = false;
15726
- if (!isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
15727
- this.notify("setCurrentViewDataAsync", {
15728
- component: this.getModuleName(),
15729
- module: "VirtualScroll",
15730
- });
15731
- }
15732
- }
15733
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15734
- const virtualTrackElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
15735
- if (virtualTrackElement) {
15736
- (virtualTrackElement).style = this.GetVirtualTrackHeight();
15737
- }
15738
- this.UpdateSkeleton();
15739
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15740
- const virtualContentElement = this.list.getElementsByClassName('e-virtual-ddl-content')[0];
15741
- if (virtualContentElement) {
15742
- (virtualContentElement).style = this.getTransformValues();
15835
+ if (this.virtualSelectAllData) {
15836
+ this.virtualSelectionAll(state, li, event);
15743
15837
  }
15744
15838
  }
15745
15839
  else {
@@ -15828,7 +15922,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15828
15922
  this.updateValueState(event, this.value, this.tempValues);
15829
15923
  this.isSelectAll = this.isSelectAll ? !this.isSelectAll : this.isSelectAll;
15830
15924
  }
15831
- this.updateHiddenElement();
15925
+ if ((this.enableVirtualization && this.value && this.value.length > 0) || !this.enableVirtualization) {
15926
+ this.updateHiddenElement();
15927
+ }
15832
15928
  }
15833
15929
  }
15834
15930
  updateHiddenElement() {
@@ -15932,7 +16028,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15932
16028
  }
15933
16029
  this.selectAllItem(state, event);
15934
16030
  }
15935
- this.virtualSelectAll = false;
16031
+ if (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualSelectAllData)) {
16032
+ this.virtualSelectAll = false;
16033
+ }
15936
16034
  }
15937
16035
  /**
15938
16036
  * Get the properties to be maintained in the persisted state.