@syncfusion/ej2-dropdowns 27.1.53 → 27.1.57

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,12 @@ 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.isDynamicData = false;
4941
+ }
4934
4942
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4935
4943
  if ((this.allowCustom || (this.allowFiltering && !this.isValueInList(list, this.value) &&
4936
4944
  this.dataSource instanceof DataManager)) && !this.enableVirtualization) {
@@ -4939,7 +4947,11 @@ let DropDownList = class DropDownList extends DropDownBase {
4939
4947
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4940
4948
  else if ((this.allowCustom || (this.allowFiltering && this.isValueInList(list, this.value))) &&
4941
4949
  !this.enableVirtualization) {
4942
- this.addNewItem(list, selectedItem);
4950
+ const value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4951
+ const isValidAddition = !isNullOrUndefined(this.value) && selectedItem && selectedItem.getAttribute('data-value') === value.toString();
4952
+ if (isValidAddition) {
4953
+ this.addNewItem(list, selectedItem);
4954
+ }
4943
4955
  }
4944
4956
  if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
4945
4957
  this.getSkeletonCount();
@@ -9136,7 +9148,14 @@ let DropDownTree = class DropDownTree extends Component {
9136
9148
  }
9137
9149
  }
9138
9150
  else {
9139
- const selectedValues = isNullOrUndefined(this.value) ? [] : this.value;
9151
+ let selectedValues = isNullOrUndefined(this.value) ? [] : this.value;
9152
+ selectedValues = selectedValues.filter((selectedValue) => {
9153
+ const nodeData = this.treeObj.getTreeData(selectedValue);
9154
+ if (Array.isArray(nodeData)) {
9155
+ return nodeData.every((nodeSelectedData) => nodeSelectedData.selected);
9156
+ }
9157
+ return true;
9158
+ });
9140
9159
  for (let i = 0; i < newValues.length; i++) {
9141
9160
  if (isNullOrUndefined(this.value) || this.value.indexOf(newValues[i]) === -1) {
9142
9161
  selectedValues.push(newValues[i]);
@@ -11691,6 +11710,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
11691
11710
  }
11692
11711
  else {
11693
11712
  super.setSelection(li, e);
11713
+ this.isFiltered = false;
11694
11714
  }
11695
11715
  }
11696
11716
  listOption(dataSource, fieldsSettings) {
@@ -14046,9 +14066,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14046
14066
  else {
14047
14067
  this.updateDelimeter(this.delimiterChar, e);
14048
14068
  }
14069
+ const isFilterData = this.targetElement().trim() !== '' ? true : false;
14049
14070
  this.makeTextBoxEmpty();
14050
14071
  if (this.mode !== 'CheckBox') {
14051
- this.refreshListItems(li.textContent);
14072
+ this.refreshListItems(li.textContent, isFilterData);
14052
14073
  }
14053
14074
  if (!this.changeOnBlur) {
14054
14075
  this.updateValueState(e, this.value, this.tempValues);
@@ -14099,7 +14120,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14099
14120
  }
14100
14121
  this.refreshPlaceHolder();
14101
14122
  }
14102
- refreshListItems(data) {
14123
+ refreshListItems(data, isFilterData) {
14103
14124
  if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
14104
14125
  || this.allowCustomValue) && this.mainList && this.listData) {
14105
14126
  const list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
@@ -14111,7 +14132,25 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14111
14132
  this.renderItems(this.mainData, this.fields);
14112
14133
  }
14113
14134
  else {
14114
- this.onActionComplete(this.list, this.listData);
14135
+ if (this.allowFiltering && isFilterData) {
14136
+ this.updateInitialData();
14137
+ this.onActionComplete(list, this.mainData);
14138
+ this.isVirtualTrackHeight = false;
14139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14140
+ if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
14141
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14142
+ this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
14143
+ }
14144
+ else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
14145
+ const virualElement = this.createElement('div', {
14146
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
14147
+ });
14148
+ this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
14149
+ }
14150
+ }
14151
+ else {
14152
+ this.onActionComplete(this.list, this.listData);
14153
+ }
14115
14154
  }
14116
14155
  }
14117
14156
  else {
@@ -14456,7 +14495,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14456
14495
  this.removeIndex++;
14457
14496
  }
14458
14497
  else {
14459
- this.isRemoveSelection = true;
14498
+ this.isRemoveSelection = this.enableVirtualization ? true : this.isRemoveSelection;
14460
14499
  this.currentRemoveValue = this.allowObjectBinding ? getValue(((this.fields.value) ?
14461
14500
  this.fields.value : ''), value) : value;
14462
14501
  this.virtualSelectAll = false;
@@ -15141,7 +15180,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15141
15180
  endIndex: this.itemCount
15142
15181
  };
15143
15182
  this.previousStartIndex = 0;
15144
- this.previousEndIndex = 0;
15183
+ this.previousEndIndex = this.itemCount;
15145
15184
  if (this.dataSource instanceof DataManager) {
15146
15185
  if (this.remoteDataCount >= 0) {
15147
15186
  this.totalItemCount = this.dataCount = this.remoteDataCount;
@@ -16060,10 +16099,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16060
16099
  else {
16061
16100
  e.preventDefault();
16062
16101
  }
16102
+ const isFilterData = this.targetElement().trim() !== '' ? true : false;
16063
16103
  this.makeTextBoxEmpty();
16064
16104
  this.findGroupStart(target);
16065
16105
  if (this.mode !== 'CheckBox') {
16066
- this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent);
16106
+ this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent, isFilterData);
16067
16107
  }
16068
16108
  }
16069
16109
  else {