@syncfusion/ej2-dropdowns 27.1.55 → 27.1.58

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.
@@ -886,6 +886,7 @@ let DropDownBase = class DropDownBase extends Component {
886
886
  this.preventPopupOpen = true;
887
887
  this.virtualSelectAllState = false;
888
888
  this.CurrentEvent = null;
889
+ this.isDynamicData = false;
889
890
  this.virtualListInfo = {
890
891
  currentPageNumber: null,
891
892
  direction: null,
@@ -2260,6 +2261,7 @@ let DropDownBase = class DropDownBase extends Component {
2260
2261
  }
2261
2262
  }
2262
2263
  else {
2264
+ this.isDynamicData = true;
2263
2265
  this.updateDataSource(updateData, oldProp);
2264
2266
  }
2265
2267
  }
@@ -4634,7 +4636,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4634
4636
  return;
4635
4637
  }
4636
4638
  this.isCustomFilter = true;
4637
- this.customFilterQuery = query.clone();
4639
+ this.customFilterQuery = query ? query.clone() : query;
4638
4640
  this.filteringAction(dataSource, query, fields);
4639
4641
  },
4640
4642
  baseEventArgs: e,
@@ -4931,6 +4933,13 @@ let DropDownList = class DropDownList extends DropDownBase {
4931
4933
  this.updateActionCompleteDataValues(ulElement, list);
4932
4934
  }
4933
4935
  }
4936
+ if (this.isDynamicData) {
4937
+ const currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
4938
+ getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4939
+ this.itemData = this.getDataByValue(currentValue);
4940
+ this.selectedLI = this.getElementByValue(currentValue);
4941
+ this.isDynamicData = false;
4942
+ }
4934
4943
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4935
4944
  if ((this.allowCustom || (this.allowFiltering && !this.isValueInList(list, this.value) &&
4936
4945
  this.dataSource instanceof DataManager)) && !this.enableVirtualization) {
@@ -4939,7 +4948,11 @@ let DropDownList = class DropDownList extends DropDownBase {
4939
4948
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4940
4949
  else if ((this.allowCustom || (this.allowFiltering && this.isValueInList(list, this.value))) &&
4941
4950
  !this.enableVirtualization) {
4942
- this.addNewItem(list, selectedItem);
4951
+ const value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4952
+ const isValidAddition = !isNullOrUndefined(this.value) && selectedItem && selectedItem.getAttribute('data-value') === value.toString();
4953
+ if (isValidAddition) {
4954
+ this.addNewItem(list, selectedItem);
4955
+ }
4943
4956
  }
4944
4957
  if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
4945
4958
  this.getSkeletonCount();
@@ -9136,7 +9149,14 @@ let DropDownTree = class DropDownTree extends Component {
9136
9149
  }
9137
9150
  }
9138
9151
  else {
9139
- const selectedValues = isNullOrUndefined(this.value) ? [] : this.value;
9152
+ let selectedValues = isNullOrUndefined(this.value) ? [] : this.value;
9153
+ selectedValues = selectedValues.filter((selectedValue) => {
9154
+ const nodeData = this.treeObj.getTreeData(selectedValue);
9155
+ if (Array.isArray(nodeData)) {
9156
+ return nodeData.every((nodeSelectedData) => nodeSelectedData.selected);
9157
+ }
9158
+ return true;
9159
+ });
9140
9160
  for (let i = 0; i < newValues.length; i++) {
9141
9161
  if (isNullOrUndefined(this.value) || this.value.indexOf(newValues[i]) === -1) {
9142
9162
  selectedValues.push(newValues[i]);
@@ -10106,7 +10126,7 @@ let DropDownTree = class DropDownTree extends Component {
10106
10126
  this.isPopupOpen = false;
10107
10127
  if (this.isReact) {
10108
10128
  this.clearTemplate(['headerTemplate', 'footerTemplate', 'itemTemplate', 'actionFailureTemplate',
10109
- 'noRecordsTemplate', 'customTemplate']);
10129
+ 'noRecordsTemplate']);
10110
10130
  }
10111
10131
  if (this.popupObj) {
10112
10132
  this.popupObj.destroy();
@@ -10453,6 +10473,7 @@ let ComboBox = class ComboBox extends DropDownList {
10453
10473
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10454
10474
  setOldValue(value) {
10455
10475
  if (this.allowCustom) {
10476
+ this.selectedLI = this.getElementByValue(this.value);
10456
10477
  this.valueMuteChange(this.value);
10457
10478
  }
10458
10479
  else {
@@ -11691,6 +11712,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
11691
11712
  }
11692
11713
  else {
11693
11714
  super.setSelection(li, e);
11715
+ this.isFiltered = false;
11694
11716
  }
11695
11717
  }
11696
11718
  listOption(dataSource, fieldsSettings) {
@@ -14046,9 +14068,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14046
14068
  else {
14047
14069
  this.updateDelimeter(this.delimiterChar, e);
14048
14070
  }
14071
+ const isFilterData = this.targetElement().trim() !== '' ? true : false;
14049
14072
  this.makeTextBoxEmpty();
14050
14073
  if (this.mode !== 'CheckBox') {
14051
- this.refreshListItems(li.textContent);
14074
+ this.refreshListItems(li.textContent, isFilterData);
14052
14075
  }
14053
14076
  if (!this.changeOnBlur) {
14054
14077
  this.updateValueState(e, this.value, this.tempValues);
@@ -14099,7 +14122,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14099
14122
  }
14100
14123
  this.refreshPlaceHolder();
14101
14124
  }
14102
- refreshListItems(data) {
14125
+ refreshListItems(data, isFilterData) {
14103
14126
  if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
14104
14127
  || this.allowCustomValue) && this.mainList && this.listData) {
14105
14128
  const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
@@ -14111,7 +14134,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14111
14134
  this.renderItems(this.mainData, this.fields);
14112
14135
  }
14113
14136
  else {
14114
- this.onActionComplete(this.list, this.listData);
14137
+ if (this.allowFiltering && isFilterData) {
14138
+ this.updateInitialData();
14139
+ this.onActionComplete(list, this.mainData);
14140
+ this.isVirtualTrackHeight = false;
14141
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14142
+ if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
14143
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14144
+ this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
14145
+ }
14146
+ else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
14147
+ const virualElement = this.createElement('div', {
14148
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
14149
+ });
14150
+ this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
14151
+ }
14152
+ }
14153
+ else {
14154
+ this.onActionComplete(this.list, this.listData);
14155
+ }
14115
14156
  }
14116
14157
  }
14117
14158
  else {
@@ -14456,7 +14497,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14456
14497
  this.removeIndex++;
14457
14498
  }
14458
14499
  else {
14459
- this.isRemoveSelection = true;
14500
+ this.isRemoveSelection = this.enableVirtualization ? true : this.isRemoveSelection;
14460
14501
  this.currentRemoveValue = this.allowObjectBinding ? getValue(((this.fields.value) ?
14461
14502
  this.fields.value : ''), value) : value;
14462
14503
  this.virtualSelectAll = false;
@@ -15141,7 +15182,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15141
15182
  endIndex: this.itemCount
15142
15183
  };
15143
15184
  this.previousStartIndex = 0;
15144
- this.previousEndIndex = 0;
15185
+ this.previousEndIndex = this.itemCount;
15145
15186
  if (this.dataSource instanceof DataManager) {
15146
15187
  if (this.remoteDataCount >= 0) {
15147
15188
  this.totalItemCount = this.dataCount = this.remoteDataCount;
@@ -16060,10 +16101,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16060
16101
  else {
16061
16102
  e.preventDefault();
16062
16103
  }
16104
+ const isFilterData = this.targetElement().trim() !== '' ? true : false;
16063
16105
  this.makeTextBoxEmpty();
16064
16106
  this.findGroupStart(target);
16065
16107
  if (this.mode !== 'CheckBox') {
16066
- this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent);
16108
+ this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent, isFilterData);
16067
16109
  }
16068
16110
  }
16069
16111
  else {