@syncfusion/ej2-dropdowns 25.1.39 → 25.1.41

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.
@@ -898,8 +898,11 @@ var DropDownList = /** @class */ (function (_super) {
898
898
  var focusEle = this.list.querySelector('.' + dropDownListClasses.focus);
899
899
  if (this.isSelectFocusItem(focusEle) && !isVirtualKeyAction) {
900
900
  this.setSelection(focusEle, e);
901
- if (this.enableVirtualization && !this.fields.groupBy && this.getModuleName() !== 'combobox') {
901
+ if (this.enableVirtualization) {
902
902
  var selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.selectedLI.offsetTop + (this.virtualListInfo.startIndex * this.selectedLI.offsetHeight) : this.selectedLI.offsetTop;
903
+ if (this.fields.groupBy) {
904
+ selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex == 0 ? this.selectedLI.offsetHeight - selectedLiOffsetTop : selectedLiOffsetTop - this.selectedLI.offsetHeight;
905
+ }
903
906
  this.list.scrollTop = selectedLiOffsetTop - (this.list.querySelectorAll('.e-virtual-list').length * this.selectedLI.offsetHeight);
904
907
  }
905
908
  }
@@ -936,7 +939,13 @@ var DropDownList = /** @class */ (function (_super) {
936
939
  }
937
940
  }
938
941
  if (!isNullOrUndefined(nextItem)) {
942
+ var focusAtFirstElement = this.liCollections[this.skeletonCount] && this.liCollections[this.skeletonCount].classList.contains('e-item-focus');
939
943
  this.setSelection(nextItem, e);
944
+ if (focusAtFirstElement && this.enableVirtualization && this.getModuleName() === 'autocomplete' && !isVirtualKeyAction) {
945
+ var selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex ? this.selectedLI.offsetTop + (this.virtualListInfo.startIndex * this.selectedLI.offsetHeight) : this.selectedLI.offsetTop;
946
+ selectedLiOffsetTop = this.virtualListInfo && this.virtualListInfo.startIndex == 0 && this.fields.groupBy ? this.selectedLI.offsetHeight - selectedLiOffsetTop : selectedLiOffsetTop - this.selectedLI.offsetHeight;
947
+ this.list.scrollTop = selectedLiOffsetTop - (this.list.querySelectorAll('.e-virtual-list').length * this.selectedLI.offsetHeight);
948
+ }
940
949
  }
941
950
  else if (this.enableVirtualization && !this.isPopupOpen && this.getModuleName() !== 'autocomplete' && ((this.viewPortInfo.endIndex !== this.totalItemCount && e.action === 'down') || (this.viewPortInfo.startIndex !== 0 && e.action === 'up'))) {
942
951
  if (e.action === 'down') {
@@ -1063,14 +1072,13 @@ var DropDownList = /** @class */ (function (_super) {
1063
1072
  }
1064
1073
  break;
1065
1074
  case 'pageUp':
1066
- var count = (pageCount * 2) - 4;
1067
- this.activeIndex = Math.round(count);
1075
+ this.activeIndex = this.getModuleName() === 'autocomplete' ? this.getIndexByValue(this.selectedLI.getAttribute('data-value')) + this.getPageCount() - 1 : this.getIndexByValue(this.previousValue);
1068
1076
  this.pageUpSelection(this.activeIndex - this.getPageCount(), e, true);
1069
1077
  e.preventDefault();
1070
1078
  break;
1071
1079
  case 'pageDown':
1072
- this.activeIndex = 1;
1073
- this.pageDownSelection(this.activeIndex + this.getPageCount(), e, true);
1080
+ this.activeIndex = this.getModuleName() === 'autocomplete' ? this.getIndexByValue(this.selectedLI.getAttribute('data-value')) - this.getPageCount() : this.getIndexByValue(this.previousValue);
1081
+ this.pageDownSelection(!isNullOrUndefined(this.activeIndex) ? (this.activeIndex + this.getPageCount()) : (2 * this.getPageCount()), e, true);
1074
1082
  e.preventDefault();
1075
1083
  break;
1076
1084
  case 'home':
@@ -1107,8 +1115,8 @@ var DropDownList = /** @class */ (function (_super) {
1107
1115
  };
1108
1116
  DropDownList.prototype.pageUpSelection = function (steps, event, isVirtualKeyAction) {
1109
1117
  var previousItem = steps >= 0 ? this.liCollections[steps + 1] : this.liCollections[0];
1110
- if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
1111
- previousItem = steps >= 0 ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[0];
1118
+ if ((this.enableVirtualization && this.activeIndex == null)) {
1119
+ previousItem = (this.liCollections.length >= steps && steps >= 0) ? this.liCollections[steps + this.skeletonCount + 1] : this.liCollections[0];
1112
1120
  }
1113
1121
  if (!isNullOrUndefined(previousItem) && previousItem.classList.contains('e-virtual-list')) {
1114
1122
  previousItem = this.liCollections[this.skeletonCount];
@@ -1140,7 +1148,7 @@ var DropDownList = /** @class */ (function (_super) {
1140
1148
  steps = this.getModuleName() === 'dropdownlist' && this.allowFiltering ? steps + 1 : steps;
1141
1149
  previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
1142
1150
  }
1143
- if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
1151
+ if ((this.enableVirtualization && this.activeIndex == null)) {
1144
1152
  previousItem = steps <= list.length ? this.liCollections[steps + this.skeletonCount - 1] : this.liCollections[list.length - 1];
1145
1153
  }
1146
1154
  this.PageUpDownSelection(previousItem, event);
@@ -1326,6 +1334,11 @@ var DropDownList = /** @class */ (function (_super) {
1326
1334
  }
1327
1335
  }
1328
1336
  else {
1337
+ if (this.enableVirtualization && this.activeIndex == null && this.dataSource instanceof DataManager) {
1338
+ this.UpdateSkeleton();
1339
+ this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
1340
+ this.ulElement = this.list.querySelector('ul');
1341
+ }
1329
1342
  this.activeIndex = this.getIndexByValue(value);
1330
1343
  }
1331
1344
  };
@@ -1385,7 +1398,7 @@ var DropDownList = /** @class */ (function (_super) {
1385
1398
  if (this.enableVirtualization && this.value) {
1386
1399
  var fields = (this.fields.value) ? this.fields.value : '';
1387
1400
  var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
1388
- if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
1401
+ if (this.dataSource instanceof DataManager) {
1389
1402
  var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
1390
1403
  if (getItem && getItem.length > 0) {
1391
1404
  this.itemData = getItem[0];
@@ -1730,7 +1743,7 @@ var DropDownList = /** @class */ (function (_super) {
1730
1743
  if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
1731
1744
  filterQuery.where('', filterType, this.typedString, this.ignoreCase, this.ignoreAccent);
1732
1745
  }
1733
- else if (((this.getModuleName() !== 'combobox') || this.enableVirtualization) || (this.isFiltering() && this.getModuleName() === 'combobox' && this.typedString !== '')) {
1746
+ else if (((this.getModuleName() !== 'combobox')) || (this.isFiltering() && this.getModuleName() === 'combobox' && this.typedString !== '')) {
1734
1747
  var fields = (this.fields.text) ? this.fields.text : '';
1735
1748
  filterQuery.where(fields, filterType, this.typedString, this.ignoreCase, this.ignoreAccent);
1736
1749
  }
@@ -1738,7 +1751,7 @@ var DropDownList = /** @class */ (function (_super) {
1738
1751
  else {
1739
1752
  filterQuery = (this.enableVirtualization && !isNullOrUndefined(this.customFilterQuery)) ? this.customFilterQuery.clone() : query ? query.clone() : this.query ? this.query.clone() : new Query();
1740
1753
  }
1741
- if (this.enableVirtualization && (this.viewPortInfo.endIndex != 0) && (!(this.dataSource instanceof DataManager) || (this.dataSource instanceof DataManager && this.virtualGroupDataSource))) {
1754
+ if (this.enableVirtualization && this.viewPortInfo.endIndex != 0) {
1742
1755
  var takeValue = this.getTakeValue();
1743
1756
  var alreadySkipAdded = false;
1744
1757
  if (filterQuery) {
@@ -1805,14 +1818,6 @@ var DropDownList = /** @class */ (function (_super) {
1805
1818
  }
1806
1819
  filterQuery.requiresCount();
1807
1820
  }
1808
- else if (this.enableVirtualization && (this.dataSource instanceof DataManager && !this.virtualGroupDataSource)) {
1809
- for (var queryElements_4 = 0; queryElements_4 < filterQuery.queries.length; queryElements_4++) {
1810
- if (filterQuery.queries[queryElements_4].fn === 'onSkip' || filterQuery.queries[queryElements_4].fn === 'onTake') {
1811
- filterQuery.queries.splice(queryElements_4, 1);
1812
- --queryElements_4;
1813
- }
1814
- }
1815
- }
1816
1821
  return filterQuery;
1817
1822
  };
1818
1823
  DropDownList.prototype.getSelectionPoints = function () {
@@ -1839,7 +1844,7 @@ var DropDownList = /** @class */ (function (_super) {
1839
1844
  return;
1840
1845
  }
1841
1846
  _this.isCustomFilter = true;
1842
- _this.customFilterQuery = query;
1847
+ _this.customFilterQuery = query.clone();
1843
1848
  _this.filteringAction(dataSource, query, fields);
1844
1849
  },
1845
1850
  baseEventArgs: e,
@@ -2145,6 +2150,9 @@ var DropDownList = /** @class */ (function (_super) {
2145
2150
  this.addNewItem(list, selectedItem);
2146
2151
  }
2147
2152
  if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
2153
+ this.getSkeletonCount();
2154
+ this.skeletonCount = this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2) ? 0 : this.skeletonCount;
2155
+ this.UpdateSkeleton();
2148
2156
  this.focusIndexItem();
2149
2157
  }
2150
2158
  if (this.enableVirtualization) {
@@ -2247,7 +2255,7 @@ var DropDownList = /** @class */ (function (_super) {
2247
2255
  };
2248
2256
  DropDownList.prototype.focusIndexItem = function () {
2249
2257
  var value = this.getItemData().value;
2250
- this.activeIndex = this.getIndexByValue(value);
2258
+ this.activeIndex = ((this.enableVirtualization && !isNullOrUndefined(value)) || !this.enableVirtualization) ? this.getIndexByValue(value) : this.activeIndex;
2251
2259
  var element = this.findListElement(this.list, 'li', 'data-value', value);
2252
2260
  this.selectedLI = element;
2253
2261
  this.activeItem(element);
@@ -2668,7 +2676,7 @@ var DropDownList = /** @class */ (function (_super) {
2668
2676
  }
2669
2677
  else {
2670
2678
  if (this.enableVirtualization) {
2671
- liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
2679
+ liCount = keyAction == "pageDown" ? this.getPageCount() + 1 : liCount;
2672
2680
  }
2673
2681
  this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
2674
2682
  }
@@ -2687,7 +2695,6 @@ var DropDownList = /** @class */ (function (_super) {
2687
2695
  this.isPreventKeyAction = false;
2688
2696
  this.isKeyBoardAction = false;
2689
2697
  this.isPreventScrollAction = false;
2690
- nextOffset = nextOffset + (this.selectedLI.offsetHeight * liCount);
2691
2698
  }
2692
2699
  this.list.scrollTop = nextOffset;
2693
2700
  }
@@ -2745,7 +2752,6 @@ var DropDownList = /** @class */ (function (_super) {
2745
2752
  this.isPreventKeyAction = false;
2746
2753
  this.isKeyBoardAction = false;
2747
2754
  this.isPreventScrollAction = false;
2748
- nextOffset = nextOffset - (this.selectedLI.offsetHeight * liCount);
2749
2755
  }
2750
2756
  this.list.scrollTop = this.list.scrollTop + nextOffset;
2751
2757
  }
@@ -2940,7 +2946,7 @@ var DropDownList = /** @class */ (function (_super) {
2940
2946
  sentinelInfo: {},
2941
2947
  offsets: {},
2942
2948
  startIndex: 0,
2943
- endIndex: 0,
2949
+ endIndex: this.itemCount,
2944
2950
  };
2945
2951
  if (this.getModuleName() === 'combobox') {
2946
2952
  this.typedString = "";
@@ -2948,8 +2954,12 @@ var DropDownList = /** @class */ (function (_super) {
2948
2954
  this.previousStartIndex = 0;
2949
2955
  this.previousEndIndex = 0;
2950
2956
  if (this.dataSource instanceof DataManager) {
2951
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2952
- this.totalItemCount = this.dataCount = this.virtualGroupDataSource && this.virtualGroupDataSource.length ? this.virtualGroupDataSource.length : 0;
2957
+ if (this.remoteDataCount >= 0) {
2958
+ this.totalItemCount = this.dataCount = this.remoteDataCount;
2959
+ }
2960
+ else {
2961
+ this.resetList(this.dataSource);
2962
+ }
2953
2963
  }
2954
2964
  else {
2955
2965
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -497,12 +497,14 @@ var ListBox = /** @class */ (function (_super) {
497
497
  else {
498
498
  scrollParent = wrapper;
499
499
  }
500
- boundRect = scrollParent.getBoundingClientRect();
501
- if ((boundRect.y + scrollParent.offsetHeight) - (event.clientY + scrollMoved) < 1) {
502
- this.timer = window.setInterval(function () { _this.setScrollDown(scrollParent, scrollHeight, true); }, 70);
503
- }
504
- else if ((event.clientY - scrollMoved) - boundRect.y < 1) {
505
- this.timer = window.setInterval(function () { _this.setScrollDown(scrollParent, scrollHeight, false); }, 70);
500
+ if (scrollParent) {
501
+ boundRect = scrollParent.getBoundingClientRect();
502
+ if ((boundRect.y + scrollParent.offsetHeight) - (event.clientY + scrollMoved) < 1) {
503
+ this.timer = window.setInterval(function () { _this.setScrollDown(scrollParent, scrollHeight, true); }, 70);
504
+ }
505
+ else if ((event.clientY - scrollMoved) - boundRect.y < 1) {
506
+ this.timer = window.setInterval(function () { _this.setScrollDown(scrollParent, scrollHeight, false); }, 70);
507
+ }
506
508
  }
507
509
  }
508
510
  if (args.target === null) {
@@ -925,6 +927,9 @@ var ListBox = /** @class */ (function (_super) {
925
927
  if (this.listData.length === 0) {
926
928
  this.l10nUpdate();
927
929
  }
930
+ if (this.listData.length !== this.sortedData.length) {
931
+ this.sortedData = this.listData;
932
+ }
928
933
  this.value = [];
929
934
  this.updateToolBarState();
930
935
  };
@@ -1647,6 +1652,9 @@ var ListBox = /** @class */ (function (_super) {
1647
1652
  var jsonData = [].slice.call(tListBox.jsonData);
1648
1653
  var isRefresh = tListBox.sortOrder !== 'None' || (tListBox.selectionSettings.showCheckbox !==
1649
1654
  fListBox.selectionSettings.showCheckbox) || tListBox.fields.groupBy || tListBox.itemTemplate || fListBox.itemTemplate;
1655
+ var tempLiColl = [];
1656
+ var tempData = [];
1657
+ var flistboxarray = [];
1650
1658
  this.removeSelected(fListBox, fListBox.getSelectedItems());
1651
1659
  var tempItems = [].slice.call(fListBox.listData);
1652
1660
  var localDataArgs = { cancel: false, items: tempItems, eventName: this.toolbarAction };
@@ -1660,29 +1668,43 @@ var ListBox = /** @class */ (function (_super) {
1660
1668
  tListBox.ulElement.removeChild(noRecElem);
1661
1669
  }
1662
1670
  }
1663
- if (isRefresh) {
1664
- var noRecElem = fListBox.ulElement.childNodes[0];
1665
- if (noRecElem) {
1666
- fListBox.ulElement.removeChild(noRecElem);
1671
+ if (fListBox.listData.length > 0) {
1672
+ // eslint-disable-next-line prefer-spread
1673
+ flistboxarray = Array.apply(null, { length: fListBox.ulElement.childElementCount }).map(Number.call, Number);
1674
+ }
1675
+ var _loop_3 = function (i) {
1676
+ if (fListBox.ulElement.childNodes[i].classList.contains('e-disabled')) {
1677
+ flistboxarray = flistboxarray.filter(function (item) { return item !== i; });
1678
+ tempLiColl.push(fListBox.ulElement.childNodes[i]);
1679
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1680
+ tempData.push(fListBox.listData[i]);
1667
1681
  }
1682
+ };
1683
+ for (var i = 0; i < fListBox.ulElement.childElementCount; i++) {
1684
+ _loop_3(i);
1668
1685
  }
1669
- moveTo(fListBox.ulElement, tListBox.ulElement,
1670
- // eslint-disable-next-line prefer-spread
1671
- Array.apply(null, { length: fListBox.ulElement.childElementCount }).map(Number.call, Number), index);
1686
+ moveTo(fListBox.ulElement, tListBox.ulElement, flistboxarray, index);
1672
1687
  this.trigger('actionComplete', { items: tempItems, eventName: this.toolbarAction });
1673
1688
  if (isKey) {
1674
1689
  this.list.focus();
1675
1690
  }
1676
1691
  index = (index) ? index : listData.length;
1677
- for (var i = 0; i < fListBox.listData.length; i++) {
1678
- listData.splice(index + i, 0, fListBox.listData[i]);
1692
+ for (var i = 0; i < flistboxarray.length; i++) {
1693
+ listData.splice(index + i, 0, fListBox.listData[flistboxarray[i]]);
1679
1694
  }
1680
- for (var i = 0; i < fListBox.jsonData.length; i++) {
1681
- jsonData.splice(index + i, 0, fListBox.jsonData[i]);
1695
+ for (var i = 0; i < flistboxarray.length; i++) {
1696
+ jsonData.splice(index + i, 0, fListBox.jsonData[flistboxarray[i]]);
1697
+ }
1698
+ var fliCollections = [];
1699
+ if (tempLiColl.length > 0) {
1700
+ fListBox.liCollections = tempLiColl;
1701
+ fliCollections = [].slice.call(fListBox.liCollections);
1702
+ }
1703
+ else {
1704
+ fliCollections = [].slice.call(fListBox.liCollections);
1705
+ fListBox.liCollections = [];
1682
1706
  }
1683
- var fliCollections = [].slice.call(fListBox.liCollections);
1684
1707
  var tliCollections = [].slice.call(tListBox.liCollections);
1685
- fListBox.liCollections = [];
1686
1708
  if (index) {
1687
1709
  var toColl = tliCollections.splice(0, index);
1688
1710
  tListBox.liCollections = toColl.concat(fliCollections).concat(tliCollections);
@@ -1691,6 +1713,7 @@ var ListBox = /** @class */ (function (_super) {
1691
1713
  tListBox.liCollections = tliCollections.concat(fliCollections);
1692
1714
  }
1693
1715
  fListBox.value = [];
1716
+ listData = listData.filter(function (data) { return (data !== undefined); });
1694
1717
  listData = listData
1695
1718
  .filter(function (data) { return data.isHeader !== true; });
1696
1719
  var sortedData = listData.filter(function (val) {
@@ -1702,7 +1725,7 @@ var ListBox = /** @class */ (function (_super) {
1702
1725
  }
1703
1726
  tListBox.listData = listData;
1704
1727
  if (fListBox.listData.length === fListBox.jsonData.length) {
1705
- fListBox.listData = fListBox.sortedData = fListBox.jsonData = [];
1728
+ fListBox.listData = fListBox.sortedData = fListBox.jsonData = tempData;
1706
1729
  }
1707
1730
  else if (fListBox.allowFiltering) {
1708
1731
  for (var i = 0; i < fListBox.listData.length; i++) {
@@ -1723,6 +1746,11 @@ var ListBox = /** @class */ (function (_super) {
1723
1746
  tListBox.sortedData = listData;
1724
1747
  }
1725
1748
  fListBox.updateSelectedOptions();
1749
+ if (tempLiColl.length > 0) {
1750
+ var wrap = this.list.parentElement.getElementsByClassName('e-listbox-tool')[0];
1751
+ var btn = wrap.querySelector('[data-value="' + this.toolbarAction + '"]');
1752
+ btn.disabled = true;
1753
+ }
1726
1754
  if (fListBox.listData.length === 0) {
1727
1755
  fListBox.l10nUpdate();
1728
1756
  }
@@ -1943,6 +1971,9 @@ var ListBox = /** @class */ (function (_super) {
1943
1971
  if (!args.cancel && !_this.isCustomFiltering && !args.preventDefaultAction) {
1944
1972
  _this.inputString = _this.filterInput.value;
1945
1973
  _this.filteringAction(_this.jsonData, new Query(), _this.fields);
1974
+ if (_this.toolbarSettings.items.length > 0) {
1975
+ _this.updateToolBarState();
1976
+ }
1946
1977
  }
1947
1978
  if (!_this.isFiltered && !_this.isCustomFiltering && !args.preventDefaultAction) {
1948
1979
  _this.dataUpdater(_this.jsonData, new Query(), _this.fields);
@@ -53,6 +53,8 @@ export declare class MultiSelect extends DropDownBase implements IInput {
53
53
  private isCustomRendered;
54
54
  private isRemoteSelection;
55
55
  private isSelectAllTarget;
56
+ private previousFocusItem;
57
+ private selectedListData;
56
58
  /**
57
59
  * The `fields` property maps the columns of the data table and binds the data to the component.
58
60
  * * text - Maps the text column from data table for each list item.
@@ -687,7 +689,7 @@ export declare class MultiSelect extends DropDownBase implements IInput {
687
689
  private updateAriaAttribute;
688
690
  private homeNavigation;
689
691
  private updateSelectionList;
690
- private handleVirtualKeyboardActions;
692
+ protected handleVirtualKeyboardActions(e: KeyboardEventArgs, pageCount: number): void;
691
693
  private onKeyDown;
692
694
  private arrowDown;
693
695
  private arrowUp;