@syncfusion/ej2-dropdowns 25.1.40 → 25.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.
@@ -269,10 +269,9 @@ var MultiSelect = /** @class */ (function (_super) {
269
269
  attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.element.id + '_popup', 'aria-controls': _this.element.id });
270
270
  _this.updateAriaActiveDescendant();
271
271
  if (_this.isFirstClick) {
272
- if (_this.enableVirtualization && _this.mode === 'CheckBox' && _this.value && _this.enableSelectionOrder) {
273
- _this.updateVirtualReOrderList();
272
+ if (!_this.enableVirtualization) {
273
+ _this.loadTemplate();
274
274
  }
275
- _this.loadTemplate();
276
275
  }
277
276
  if (_this.mode === 'CheckBox' && _this.showSelectAll) {
278
277
  EventHandler.add(_this.popupObj.element, 'click', _this.clickHandler, _this);
@@ -282,7 +281,12 @@ var MultiSelect = /** @class */ (function (_super) {
282
281
  };
283
282
  MultiSelect.prototype.updateVirtualReOrderList = function (isCheckBoxUpdate) {
284
283
  var query = this.getForQuery(this.value, true).clone();
285
- this.resetList(this.dataSource, this.fields, query);
284
+ if (this.enableVirtualization && this.dataSource instanceof DataManager) {
285
+ this.resetList(this.selectedListData, this.fields, query);
286
+ }
287
+ else {
288
+ this.resetList(this.dataSource, this.fields, query);
289
+ }
286
290
  this.UpdateSkeleton();
287
291
  this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
288
292
  this.virtualItemCount = this.itemCount;
@@ -339,6 +343,7 @@ var MultiSelect = /** @class */ (function (_super) {
339
343
  }
340
344
  if (this.enableVirtualization) {
341
345
  var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
346
+ this.isKeyBoardAction = false;
342
347
  this.scrollBottom(focusedItem);
343
348
  }
344
349
  };
@@ -456,15 +461,15 @@ var MultiSelect = /** @class */ (function (_super) {
456
461
  MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
457
462
  var predicate;
458
463
  var field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
459
- if (this.enableVirtualization) {
464
+ if (this.enableVirtualization && valuecheck) {
460
465
  if (isCheckbox) {
461
466
  for (var i = 0; i < valuecheck.length; i++) {
462
467
  var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
463
468
  if (i === 0) {
464
- predicate = new Predicate(field, 'equal', value);
469
+ predicate = new Predicate(field, 'equal', (value));
465
470
  }
466
471
  else {
467
- predicate = predicate.or(field, 'equal', value);
472
+ predicate = predicate.or(field, 'equal', (value));
468
473
  }
469
474
  }
470
475
  return new Query().where(predicate);
@@ -473,10 +478,10 @@ var MultiSelect = /** @class */ (function (_super) {
473
478
  for (var i = 0; i < valuecheck.length; i++) {
474
479
  var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', valuecheck[i]) : valuecheck[i];
475
480
  if (i === 0) {
476
- predicate = new Predicate(field, 'notequal', value);
481
+ predicate = new Predicate(field, 'notequal', (value));
477
482
  }
478
483
  else {
479
- predicate = predicate.and(field, 'notequal', value);
484
+ predicate = predicate.and(field, 'notequal', (value));
480
485
  }
481
486
  }
482
487
  return new Query().where(predicate);
@@ -526,7 +531,7 @@ var MultiSelect = /** @class */ (function (_super) {
526
531
  valuecheck = this.presentItemValue(this.ulElement);
527
532
  }
528
533
  if (valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
529
- && this.listData != null) {
534
+ && this.listData != null && !this.enableVirtualization) {
530
535
  this.addNonPresentItems(valuecheck, this.ulElement, this.listData);
531
536
  }
532
537
  else {
@@ -537,6 +542,7 @@ var MultiSelect = /** @class */ (function (_super) {
537
542
  query = this.allowFiltering ? query.where(this.fields.text, 'startswith', this.inputElement.value, this.ignoreCase, this.ignoreAccent) : query;
538
543
  this.checkForCustomValue(query, this.fields);
539
544
  this.isCustomRendered = true;
545
+ this.remoteCustomValue = this.enableVirtualization ? false : this.remoteCustomValue;
540
546
  }
541
547
  if (this.dataSource instanceof DataManager && this.mode === 'CheckBox' && this.allowFiltering) {
542
548
  this.removeFocus();
@@ -581,7 +587,9 @@ var MultiSelect = /** @class */ (function (_super) {
581
587
  if (!isNullOrUndefined(this.text) && (isNullOrUndefined(this.value) || this.value.length === 0)) {
582
588
  this.initialTextUpdate();
583
589
  }
584
- this.initialValueUpdate();
590
+ if (!this.enableVirtualization || (this.enableVirtualization && (!(this.dataSource instanceof DataManager)))) {
591
+ this.initialValueUpdate();
592
+ }
585
593
  this.initialUpdate();
586
594
  this.refreshPlaceHolder();
587
595
  if (this.mode !== 'CheckBox' && this.changeOnBlur) {
@@ -784,7 +792,7 @@ var MultiSelect = /** @class */ (function (_super) {
784
792
  if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
785
793
  filterQuery.where('', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
786
794
  }
787
- else {
795
+ else if ((this.enableVirtualization && this.targetElement() !== "") || !this.enableVirtualization) {
788
796
  var fields = this.fields;
789
797
  filterQuery.where(!isNullOrUndefined(fields.text) ? fields.text : '', this.filterType, this.targetElement(), this.ignoreCase, this.ignoreAccent);
790
798
  }
@@ -795,18 +803,9 @@ var MultiSelect = /** @class */ (function (_super) {
795
803
  return filterQuery;
796
804
  }
797
805
  else {
798
- if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
806
+ if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && !this.virtualSelectAll) {
799
807
  return this.virtualFilterQuery(filterQuery);
800
808
  }
801
- else if (this.enableVirtualization && (this.dataSource instanceof DataManager && !this.virtualGroupDataSource)) {
802
- for (var queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
803
- if (filterQuery.queries[queryElements].fn === 'onSkip' || filterQuery.queries[queryElements].fn === 'onTake') {
804
- filterQuery.queries.splice(queryElements, 1);
805
- --queryElements;
806
- }
807
- }
808
- return filterQuery;
809
- }
810
809
  return query ? query : this.query ? this.query : new Query();
811
810
  }
812
811
  };
@@ -970,7 +969,7 @@ var MultiSelect = /** @class */ (function (_super) {
970
969
  var dataItem_1 = {};
971
970
  setValue(field.text, value, dataItem_1);
972
971
  if (typeof getValue((this.fields.value ? this.fields.value : 'value'), customData)
973
- === 'number') {
972
+ === 'number' && this.fields.value !== this.fields.text) {
974
973
  setValue(field.value, Math.random(), dataItem_1);
975
974
  }
976
975
  else {
@@ -987,17 +986,19 @@ var MultiSelect = /** @class */ (function (_super) {
987
986
  dataItem_1 = this.allowObjectBinding ? emptyObject_1 : dataItem_1;
988
987
  if (this.enableVirtualization) {
989
988
  this.virtualCustomData = dataItem_1;
990
- var tempData = this.virtualGroupDataSource ? JSON.parse(JSON.stringify(this.virtualGroupDataSource)) : JSON.parse(JSON.stringify(this.dataSource));
989
+ var tempData = this.dataSource instanceof DataManager ? JSON.parse(JSON.stringify(this.listData)) : JSON.parse(JSON.stringify(this.dataSource));
991
990
  var totalData = [];
992
991
  if (this.virtualCustomSelectData && this.virtualCustomSelectData.length > 0) {
993
992
  totalData = tempData.concat(this.virtualCustomSelectData);
994
993
  }
995
994
  tempData.splice(0, 0, dataItem_1);
996
995
  this.isCustomDataUpdated = true;
996
+ var tempCount = this.totalItemCount;
997
997
  this.viewPortInfo.startIndex = this.virtualItemStartIndex = 0;
998
998
  this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
999
999
  this.resetList(tempData, field, query);
1000
1000
  this.isCustomDataUpdated = false;
1001
+ this.totalItemCount = this.enableVirtualization && this.dataSource instanceof DataManager ? tempCount : this.totalItemCount;
1001
1002
  }
1002
1003
  else {
1003
1004
  var tempData = JSON.parse(JSON.stringify(this.listData));
@@ -1018,7 +1019,9 @@ var MultiSelect = /** @class */ (function (_super) {
1018
1019
  else if (this.listData && this.mainData && !dataChecks && this.allowCustomValue) {
1019
1020
  if (this.allowFiltering && this.isRemoteSelection && this.remoteCustomValue) {
1020
1021
  this.isRemoteSelection = false;
1021
- this.resetList(this.listData, field, query);
1022
+ if (!this.enableVirtualization) {
1023
+ this.resetList(this.listData, field, query);
1024
+ }
1022
1025
  }
1023
1026
  else if (!this.allowFiltering && this.list) {
1024
1027
  var liCollections = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + ':not(.e-hide-listitem)');
@@ -1275,21 +1278,25 @@ var MultiSelect = /** @class */ (function (_super) {
1275
1278
  + dropDownBaseClasses.li + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
1276
1279
  var previousItem = steps >= 0 ? collection[steps + 1] : collection[0];
1277
1280
  if (this.enableVirtualization && isVirtualKeyAction) {
1278
- previousItem = steps >= 0 && this.viewPortInfo.startIndex != 0 ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[this.skeletonCount];
1281
+ previousItem = (this.liCollections.length >= steps && steps >= 0) ? this.liCollections[steps] : this.liCollections[this.skeletonCount];
1279
1282
  }
1280
1283
  if (!isNullOrUndefined(previousItem) && previousItem.classList.contains('e-virtual-list')) {
1281
1284
  previousItem = this.liCollections[this.skeletonCount];
1282
1285
  }
1283
1286
  if (this.enableVirtualization) {
1284
1287
  if (!isNullOrUndefined(previousItem) && !previousItem.classList.contains('e-item-focus')) {
1288
+ this.isKeyBoardAction = true;
1285
1289
  this.addListFocus(previousItem);
1286
1290
  this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
1287
1291
  }
1288
1292
  else if (this.viewPortInfo.startIndex == 0) {
1293
+ this.isKeyBoardAction = true;
1289
1294
  this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
1290
1295
  }
1296
+ this.previousFocusItem = previousItem;
1291
1297
  }
1292
1298
  else {
1299
+ this.isKeyBoardAction = true;
1293
1300
  this.addListFocus(previousItem);
1294
1301
  this.scrollTop(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), this.keyboardEvent.keyCode);
1295
1302
  }
@@ -1306,7 +1313,9 @@ var MultiSelect = /** @class */ (function (_super) {
1306
1313
  if (this.enableVirtualization && isVirtualKeyAction) {
1307
1314
  previousItem = steps <= list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
1308
1315
  }
1316
+ this.isKeyBoardAction = true;
1309
1317
  this.addListFocus(previousItem);
1318
+ this.previousFocusItem = previousItem;
1310
1319
  this.scrollBottom(previousItem, this.getIndexByValue(previousItem.getAttribute('data-value')), false, this.keyboardEvent.keyCode);
1311
1320
  };
1312
1321
  MultiSelect.prototype.getItems = function () {
@@ -1495,18 +1504,16 @@ var MultiSelect = /** @class */ (function (_super) {
1495
1504
  case 33:
1496
1505
  e.preventDefault();
1497
1506
  if (focusedItem) {
1498
- var count = (this.getPageCount() * 2) - 4;
1499
- activeIndex = Math.round(count);
1500
- activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
1501
- this.pageUpSelection(activeIndex - this.getPageCount(), true);
1507
+ activeIndex = this.getIndexByValue(this.previousFocusItem.getAttribute('data-value')) - 1;
1508
+ this.pageUpSelection(activeIndex, true);
1502
1509
  this.updateAriaAttribute();
1503
1510
  }
1504
1511
  break;
1505
1512
  case 34:
1506
1513
  e.preventDefault();
1507
1514
  if (focusedItem) {
1508
- activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
1509
- this.pageDownSelection(activeIndex + this.getPageCount() + 1, true);
1515
+ activeIndex = this.getIndexByValue(this.previousFocusItem.getAttribute('data-value'));
1516
+ this.pageDownSelection(activeIndex, true);
1510
1517
  this.updateAriaAttribute();
1511
1518
  }
1512
1519
  break;
@@ -1542,11 +1549,11 @@ var MultiSelect = /** @class */ (function (_super) {
1542
1549
  else if (this.isPopupOpen()) {
1543
1550
  var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
1544
1551
  var activeIndex = void 0;
1545
- this.isKeyBoardAction = true;
1546
1552
  switch (e.keyCode) {
1547
1553
  case 36:
1548
1554
  case 35:
1549
1555
  this.isMouseScrollAction = true;
1556
+ this.isKeyBoardAction = true;
1550
1557
  this.homeNavigation((e.keyCode === 36) ? true : false);
1551
1558
  break;
1552
1559
  case 33:
@@ -1560,19 +1567,22 @@ var MultiSelect = /** @class */ (function (_super) {
1560
1567
  case 34:
1561
1568
  e.preventDefault();
1562
1569
  if (focusedItem) {
1563
- this.getIndexByValue(focusedItem.getAttribute('data-value'));
1570
+ activeIndex = this.getIndexByValue(focusedItem.getAttribute('data-value'));
1564
1571
  this.pageDownSelection(activeIndex + this.getPageCount());
1565
1572
  this.updateAriaAttribute();
1566
1573
  }
1567
1574
  return;
1568
1575
  case 38:
1576
+ this.isKeyBoardAction = true;
1569
1577
  this.arrowUp(e);
1570
1578
  break;
1571
1579
  case 40:
1580
+ this.isKeyBoardAction = true;
1572
1581
  this.arrowDown(e);
1573
1582
  break;
1574
1583
  case 27:
1575
1584
  e.preventDefault();
1585
+ this.isKeyBoardAction = true;
1576
1586
  this.hidePopup(e);
1577
1587
  if (this.mode === 'CheckBox') {
1578
1588
  this.inputElement.focus();
@@ -1580,16 +1590,19 @@ var MultiSelect = /** @class */ (function (_super) {
1580
1590
  return;
1581
1591
  case 13:
1582
1592
  e.preventDefault();
1593
+ this.isKeyBoardAction = true;
1583
1594
  if (this.mode !== 'CheckBox') {
1584
1595
  this.selectByKey(e);
1585
1596
  }
1586
1597
  this.checkPlaceholderSize();
1587
1598
  return;
1588
1599
  case 32:
1600
+ this.isKeyBoardAction = true;
1589
1601
  this.spaceKeySelection(e);
1590
1602
  return;
1591
1603
  case 9:
1592
1604
  e.preventDefault();
1605
+ this.isKeyBoardAction = true;
1593
1606
  this.hidePopup(e);
1594
1607
  this.inputElement.focus();
1595
1608
  this.overAllWrapper.classList.add(FOCUS);
@@ -1791,7 +1804,6 @@ var MultiSelect = /** @class */ (function (_super) {
1791
1804
  this.isPreventKeyAction = false;
1792
1805
  this.isKeyBoardAction = false;
1793
1806
  this.isPreventScrollAction = false;
1794
- nextOffset = nextOffset + (selectedLI.offsetHeight * liCount);
1795
1807
  }
1796
1808
  this.list.scrollTop = nextOffset;
1797
1809
  }
@@ -1823,9 +1835,9 @@ var MultiSelect = /** @class */ (function (_super) {
1823
1835
  if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyCode != 36 && !this.isVirtualScrolling) {
1824
1836
  this.isUpwardScrolling = true;
1825
1837
  this.isPreventKeyAction = true;
1838
+ this.isKeyBoardAction = false;
1826
1839
  this.list.scrollTop -= selectedLI.offsetHeight * liCount;
1827
1840
  this.isPreventKeyAction = this.list.scrollTop != 0 ? this.isPreventKeyAction : false;
1828
- this.isKeyBoardAction = false;
1829
1841
  this.isPreventScrollAction = false;
1830
1842
  }
1831
1843
  else if (this.enableVirtualization && keyCode == 36) {
@@ -1839,7 +1851,6 @@ var MultiSelect = /** @class */ (function (_super) {
1839
1851
  this.isPreventKeyAction = false;
1840
1852
  this.isKeyBoardAction = false;
1841
1853
  this.isPreventScrollAction = false;
1842
- nextOffset = nextOffset - (selectedLI.offsetHeight * liCount);
1843
1854
  }
1844
1855
  this.list.scrollTop = this.list.scrollTop + nextOffset;
1845
1856
  }
@@ -2040,7 +2051,12 @@ var MultiSelect = /** @class */ (function (_super) {
2040
2051
  this.addListFocus(elements[temp]);
2041
2052
  }
2042
2053
  else {
2043
- this.addListFocus(elements[++temp]);
2054
+ if (this.enableVirtualization && elements[temp + 1].classList.contains('e-virtual-list')) {
2055
+ this.addListFocus(elements[this.skeletonCount]);
2056
+ }
2057
+ else {
2058
+ this.addListFocus(elements[++temp]);
2059
+ }
2044
2060
  }
2045
2061
  if (temp > -1) {
2046
2062
  this.updateCheck(elements[temp]);
@@ -2259,6 +2275,9 @@ var MultiSelect = /** @class */ (function (_super) {
2259
2275
  removeVal = [];
2260
2276
  }
2261
2277
  removeVal.splice(index, 1);
2278
+ if (_this.enableVirtualization && _this.mode === 'CheckBox') {
2279
+ _this.selectedListData.splice(index, 1);
2280
+ }
2262
2281
  _this.setProperties({ value: [].concat([], removeVal) }, true);
2263
2282
  if (_this.enableVirtualization) {
2264
2283
  var currentText = index == 0 ? _this.text.replace(_this.text.split(_this.delimiterChar)[index] + _this.delimiterChar, '') : _this.text.replace(_this.delimiterChar + _this.text.split(_this.delimiterChar)[index], '');
@@ -2503,6 +2522,19 @@ var MultiSelect = /** @class */ (function (_super) {
2503
2522
  _this.listData = list;
2504
2523
  }
2505
2524
  value = _this.allowObjectBinding ? _this.getDataByValue(value) : value;
2525
+ if (_this.enableVirtualization) {
2526
+ if (isNullOrUndefined(_this.selectedListData)) {
2527
+ _this.selectedListData = [(_this.getDataByValue(value))];
2528
+ }
2529
+ else {
2530
+ if (Array.isArray(_this.selectedListData)) {
2531
+ _this.selectedListData.push((_this.getDataByValue(value)));
2532
+ }
2533
+ else {
2534
+ _this.selectedListData = [_this.selectedListData, (_this.getDataByValue(value))];
2535
+ }
2536
+ }
2537
+ }
2506
2538
  if ((_this.enableVirtualization && value) || !_this.enableVirtualization) {
2507
2539
  _this.updateListSelectEventCallback(value, element, eve);
2508
2540
  }
@@ -2694,7 +2726,7 @@ var MultiSelect = /** @class */ (function (_super) {
2694
2726
  this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
2695
2727
  this.virtualItemCount = this.itemCount;
2696
2728
  if (this.mode !== 'CheckBox') {
2697
- this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
2729
+ this.totalItemsCount();
2698
2730
  }
2699
2731
  if (!this.list.querySelector('.e-virtual-ddl')) {
2700
2732
  var virualElement = this.createElement('div', {
@@ -2787,6 +2819,13 @@ var MultiSelect = /** @class */ (function (_super) {
2787
2819
  }
2788
2820
  _this.isPreventScrollAction = true;
2789
2821
  _this.setScrollPosition();
2822
+ if (!_this.list.classList.contains(dropDownBaseClasses.noData) && _this.getItems()[1] && _this.getItems()[1].offsetHeight !== 0) {
2823
+ _this.listItemHeight = _this.getItems()[1].offsetHeight;
2824
+ if (_this.list.getElementsByClassName('e-virtual-ddl-content')[0]) {
2825
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2826
+ _this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = _this.getTransformValues();
2827
+ }
2828
+ }
2790
2829
  if (_this.allowFiltering) {
2791
2830
  _this.notify('inputFocus', {
2792
2831
  module: 'CheckBoxSelection', enable: _this.mode === 'CheckBox', value: 'focus'
@@ -2892,13 +2931,17 @@ var MultiSelect = /** @class */ (function (_super) {
2892
2931
  sentinelInfo: {},
2893
2932
  offsets: {},
2894
2933
  startIndex: 0,
2895
- endIndex: 0,
2934
+ endIndex: this.itemCount,
2896
2935
  };
2897
2936
  this.previousStartIndex = 0;
2898
2937
  this.previousEndIndex = 0;
2899
2938
  if (this.dataSource instanceof DataManager) {
2900
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2901
- this.totalItemCount = this.dataCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
2939
+ if (this.remoteDataCount >= 0) {
2940
+ this.totalItemCount = this.dataCount = this.remoteDataCount;
2941
+ }
2942
+ else {
2943
+ this.resetList(this.dataSource);
2944
+ }
2902
2945
  }
2903
2946
  else {
2904
2947
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -3040,7 +3083,7 @@ var MultiSelect = /** @class */ (function (_super) {
3040
3083
  EventHandler.add(formElement, 'reset', this.resetValueHandler, this);
3041
3084
  }
3042
3085
  EventHandler.add(this.componentWrapper, 'mouseout', this.mouseOut, this);
3043
- EventHandler.add(this.overAllClear, 'mouseup', this.clearAll, this);
3086
+ EventHandler.add(this.overAllClear, 'mousedown', this.clearAll, this);
3044
3087
  EventHandler.add(this.inputElement, 'paste', this.pasteHandler, this);
3045
3088
  };
3046
3089
  MultiSelect.prototype.onInput = function (e) {
@@ -3084,9 +3127,7 @@ var MultiSelect = /** @class */ (function (_super) {
3084
3127
  if (this.allowCustomValue) {
3085
3128
  this.isRemoteSelection = true;
3086
3129
  }
3087
- if (!this.backCommand) {
3088
- this.checkAndResetCache();
3089
- }
3130
+ this.checkAndResetCache();
3090
3131
  var eventArgs_1 = {
3091
3132
  preventDefaultAction: false,
3092
3133
  text: this.targetElement(),
@@ -3115,12 +3156,7 @@ var MultiSelect = /** @class */ (function (_super) {
3115
3156
  var query = new Query();
3116
3157
  query = this.allowFiltering && (text !== '') ? query.where(this.fields.text, 'startswith', text, this.ignoreCase, this.ignoreAccent) : query;
3117
3158
  if (this.enableVirtualization) {
3118
- if (this.dataSource instanceof DataManager) {
3119
- this.dataUpdater(this.virtualGroupDataSource, query, this.fields);
3120
- }
3121
- else {
3122
- this.dataUpdater(this.dataSource, query, this.fields);
3123
- }
3159
+ this.dataUpdater(this.dataSource, query, this.fields);
3124
3160
  }
3125
3161
  else {
3126
3162
  this.dataUpdater(this.mainData, query, this.fields);
@@ -3279,6 +3315,7 @@ var MultiSelect = /** @class */ (function (_super) {
3279
3315
  var textValues = this.text != null && this.text != "" ? this.text + ',' + temp : temp;
3280
3316
  data += temp + delimiterChar + ' ';
3281
3317
  text.push(textValues);
3318
+ hiddenElementContent += "<option selected value=\"" + valueItem + "\">" + index + "</option>";
3282
3319
  break;
3283
3320
  }
3284
3321
  else {
@@ -3348,7 +3385,7 @@ var MultiSelect = /** @class */ (function (_super) {
3348
3385
  this.unwireListEvents();
3349
3386
  this.wireListEvents();
3350
3387
  };
3351
- MultiSelect.prototype.initialValueUpdate = function (listItems) {
3388
+ MultiSelect.prototype.initialValueUpdate = function (listItems, isInitialVirtualData) {
3352
3389
  if (this.list) {
3353
3390
  var text = void 0;
3354
3391
  var element = void 0;
@@ -3368,11 +3405,24 @@ var MultiSelect = /** @class */ (function (_super) {
3368
3405
  for (var i = 0; i < listItems.length; i++) {
3369
3406
  if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
3370
3407
  text = getValue(this.fields.text, listItems[i]);
3408
+ if (this.enableVirtualization) {
3409
+ if (isNullOrUndefined(this.selectedListData)) {
3410
+ this.selectedListData = [listItems[i]];
3411
+ }
3412
+ else {
3413
+ if (Array.isArray(this.selectedListData)) {
3414
+ this.selectedListData.push((listItems[i]));
3415
+ }
3416
+ else {
3417
+ this.selectedListData = [this.selectedListData, (listItems[i])];
3418
+ }
3419
+ }
3420
+ }
3371
3421
  break;
3372
3422
  }
3373
3423
  }
3374
3424
  }
3375
- if (isNullOrUndefined(text) && this.allowCustomValue) {
3425
+ if ((isNullOrUndefined(text) && this.allowCustomValue) && ((!(this.dataSource instanceof DataManager)) || (this.dataSource instanceof DataManager && isInitialVirtualData))) {
3376
3426
  text = this.getTextByValue(value);
3377
3427
  isCustomData = true;
3378
3428
  }
@@ -3390,13 +3440,15 @@ var MultiSelect = /** @class */ (function (_super) {
3390
3440
  this.addChip(text, value);
3391
3441
  this.addListSelection(element);
3392
3442
  }
3393
- else if (value && this.allowCustomValue) {
3443
+ else if ((!this.enableVirtualization && value && this.allowCustomValue) || ((this.enableVirtualization && value && this.allowCustomValue) && ((!(this.dataSource instanceof DataManager)) || (this.dataSource instanceof DataManager && isInitialVirtualData)))) {
3394
3444
  var indexItem = this.listData.length;
3395
3445
  var newValue = {};
3396
3446
  setValue(this.fields.text, value, newValue);
3397
3447
  setValue(this.fields.value, value, newValue);
3398
3448
  var noDataEle = this.popupWrapper.querySelector('.' + dropDownBaseClasses.noData);
3399
- this.addItem(newValue, indexItem);
3449
+ if (!this.enableVirtualization) {
3450
+ this.addItem(newValue, indexItem);
3451
+ }
3400
3452
  if (this.enableVirtualization) {
3401
3453
  if (this.virtualCustomSelectData && this.virtualCustomSelectData.length >= 0) {
3402
3454
  this.virtualCustomSelectData.push(newValue);
@@ -4734,8 +4786,12 @@ var MultiSelect = /** @class */ (function (_super) {
4734
4786
  MultiSelect.prototype.totalItemsCount = function () {
4735
4787
  var dataSourceCount;
4736
4788
  if (this.dataSource instanceof DataManager) {
4737
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4738
- dataSourceCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
4789
+ if (this.remoteDataCount >= 0) {
4790
+ dataSourceCount = this.totalItemCount = this.dataCount = this.remoteDataCount;
4791
+ }
4792
+ else {
4793
+ this.resetList(this.dataSource);
4794
+ }
4739
4795
  }
4740
4796
  else {
4741
4797
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -4745,7 +4801,26 @@ var MultiSelect = /** @class */ (function (_super) {
4745
4801
  this.totalItemCount = dataSourceCount != 0 ? dataSourceCount : this.totalItemCount;
4746
4802
  }
4747
4803
  else {
4748
- this.totalItemCount = dataSourceCount != 0 ? dataSourceCount - this.value.length : this.totalItemCount;
4804
+ if (this.hideSelectedItem) {
4805
+ this.totalItemCount = dataSourceCount != 0 && this.value ? dataSourceCount - this.value.length : this.totalItemCount;
4806
+ if (this.allowCustomValue && this.virtualCustomSelectData && this.virtualCustomSelectData.length > 0) {
4807
+ for (var i = 0; i < this.virtualCustomSelectData.length; i++) {
4808
+ for (var j = 0; j < this.value.length; j++) {
4809
+ var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value[j]) : this.value[j];
4810
+ var customValue = getValue((this.fields.value) ? this.fields.value : '', this.virtualCustomSelectData[i]);
4811
+ if (value === customValue) {
4812
+ this.totalItemCount += 1;
4813
+ }
4814
+ }
4815
+ }
4816
+ }
4817
+ }
4818
+ else {
4819
+ this.totalItemCount = dataSourceCount != 0 ? dataSourceCount : this.totalItemCount;
4820
+ if (this.allowCustomValue && this.virtualCustomSelectData && this.virtualCustomSelectData.length > 0) {
4821
+ this.totalItemCount += this.virtualCustomSelectData.length;
4822
+ }
4823
+ }
4749
4824
  }
4750
4825
  };
4751
4826
  MultiSelect.prototype.presentItemValue = function (ulElement) {
@@ -4784,7 +4859,7 @@ var MultiSelect = /** @class */ (function (_super) {
4784
4859
  valuecheck = this.presentItemValue(this.ulElement);
4785
4860
  }
4786
4861
  if (prop == 'value' && valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
4787
- && this.listData != null) {
4862
+ && this.listData != null && !this.enableVirtualization) {
4788
4863
  this.mainData = null;
4789
4864
  this.setDynValue = true;
4790
4865
  this.addNonPresentItems(valuecheck, this.ulElement, this.listData);
@@ -4803,7 +4878,9 @@ var MultiSelect = /** @class */ (function (_super) {
4803
4878
  var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
4804
4879
  this.onActionComplete(list, this.mainData);
4805
4880
  }
4806
- this.initialValueUpdate();
4881
+ if (!this.enableVirtualization || (this.enableVirtualization && (!(this.dataSource instanceof DataManager)))) {
4882
+ this.initialValueUpdate();
4883
+ }
4807
4884
  if (this.mode !== 'Box' && !this.inputFocus) {
4808
4885
  this.updateDelimView();
4809
4886
  }
@@ -4856,6 +4933,7 @@ var MultiSelect = /** @class */ (function (_super) {
4856
4933
  }
4857
4934
  _this.beforePopupOpen = false;
4858
4935
  _this.overAllWrapper.classList.remove(iconAnimation);
4936
+ var typedValue = _this.mode == 'CheckBox' ? _this.targetElement() : null;
4859
4937
  _this.popupObj.hide(new Animation(eventArgs.animation));
4860
4938
  attributes(_this.inputElement, { 'aria-expanded': 'false' });
4861
4939
  _this.inputElement.removeAttribute('aria-owns');
@@ -4869,22 +4947,27 @@ var MultiSelect = /** @class */ (function (_super) {
4869
4947
  if (_this.mode === 'CheckBox' && _this.showSelectAll) {
4870
4948
  EventHandler.remove(_this.popupObj.element, 'click', _this.clickHandler);
4871
4949
  }
4872
- if (_this.enableVirtualization && _this.mode === 'CheckBox' && _this.enableSelectionOrder) {
4950
+ if (_this.enableVirtualization && _this.mode === 'CheckBox' && _this.value && _this.value.length > 0 && _this.enableSelectionOrder) {
4873
4951
  _this.viewPortInfo.startIndex = _this.virtualItemStartIndex = 0;
4874
4952
  _this.viewPortInfo.endIndex = _this.virtualItemEndIndex = _this.viewPortInfo.startIndex > 0 ? _this.viewPortInfo.endIndex : _this.itemCount;
4953
+ _this.virtualListInfo = _this.viewPortInfo;
4875
4954
  _this.previousStartIndex = 0;
4876
4955
  _this.previousEndIndex = 0;
4877
4956
  }
4878
4957
  var dataSourceCount = void 0;
4879
4958
  if (_this.dataSource instanceof DataManager) {
4880
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4881
- dataSourceCount = _this.virtualGroupDataSource && _this.virtualGroupDataSource.length ? _this.virtualGroupDataSource.length : 0;
4959
+ if (_this.remoteDataCount >= 0) {
4960
+ _this.totalItemCount = _this.dataCount = _this.remoteDataCount;
4961
+ }
4962
+ else {
4963
+ _this.resetList(_this.dataSource);
4964
+ }
4882
4965
  }
4883
4966
  else {
4884
4967
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4885
4968
  dataSourceCount = _this.dataSource && _this.dataSource.length ? _this.dataSource.length : 0;
4886
4969
  }
4887
- if (_this.enableVirtualization && (_this.allowFiltering || _this.allowCustomValue) && _this.value != null && _this.targetElement() && _this.totalItemCount !== dataSourceCount) {
4970
+ if (_this.enableVirtualization && (_this.allowFiltering || _this.allowCustomValue) && (_this.targetElement() || typedValue) && _this.totalItemCount !== dataSourceCount) {
4888
4971
  _this.updateInitialData();
4889
4972
  _this.checkAndResetCache();
4890
4973
  }
@@ -5219,8 +5302,12 @@ var MultiSelect = /** @class */ (function (_super) {
5219
5302
  if (this.dataSource instanceof DataManager) {
5220
5303
  this.dataSource.executeQuery(new Query().where(predicate))
5221
5304
  .then(function (e) {
5222
- if (e.result.result.length > 0) {
5223
- listItems_2 = e.result.result;
5305
+ if (e.result.length > 0) {
5306
+ listItems_2 = e.result;
5307
+ _this.initStatus = false;
5308
+ _this.initialValueUpdate(listItems_2, true);
5309
+ _this.initialUpdate();
5310
+ _this.initStatus = true;
5224
5311
  }
5225
5312
  });
5226
5313
  }
@@ -5235,7 +5322,9 @@ var MultiSelect = /** @class */ (function (_super) {
5235
5322
  else {
5236
5323
  this.setInitialValue = function () {
5237
5324
  _this.initStatus = false;
5238
- _this.initialValueUpdate(listItems_2);
5325
+ if (!_this.enableVirtualization || (_this.enableVirtualization && (!(_this.dataSource instanceof DataManager)))) {
5326
+ _this.initialValueUpdate(listItems_2);
5327
+ }
5239
5328
  _this.initialUpdate();
5240
5329
  _this.setInitialValue = null;
5241
5330
  _this.initStatus = true;