@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.
@@ -964,6 +964,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
964
964
  _this.preventPopupOpen = true;
965
965
  _this.virtualSelectAllState = false;
966
966
  _this.CurrentEvent = null;
967
+ _this.isDynamicData = false;
967
968
  _this.virtualListInfo = {
968
969
  currentPageNumber: null,
969
970
  direction: null,
@@ -2344,6 +2345,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2344
2345
  }
2345
2346
  }
2346
2347
  else {
2348
+ this.isDynamicData = true;
2347
2349
  this.updateDataSource(updateData, oldProp);
2348
2350
  }
2349
2351
  }
@@ -4745,7 +4747,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4745
4747
  return;
4746
4748
  }
4747
4749
  _this.isCustomFilter = true;
4748
- _this.customFilterQuery = query.clone();
4750
+ _this.customFilterQuery = query ? query.clone() : query;
4749
4751
  _this.filteringAction(dataSource, query, fields);
4750
4752
  },
4751
4753
  baseEventArgs: e,
@@ -5048,6 +5050,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5048
5050
  this.updateActionCompleteDataValues(ulElement, list);
5049
5051
  }
5050
5052
  }
5053
+ if (this.isDynamicData) {
5054
+ var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
5055
+ getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
5056
+ this.itemData = this.getDataByValue(currentValue);
5057
+ this.isDynamicData = false;
5058
+ }
5051
5059
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5052
5060
  if ((this.allowCustom || (this.allowFiltering && !this.isValueInList(list, this.value) &&
5053
5061
  this.dataSource instanceof DataManager)) && !this.enableVirtualization) {
@@ -5056,7 +5064,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5056
5064
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5057
5065
  else if ((this.allowCustom || (this.allowFiltering && this.isValueInList(list, this.value))) &&
5058
5066
  !this.enableVirtualization) {
5059
- this.addNewItem(list, selectedItem);
5067
+ var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
5068
+ var isValidAddition = !isNullOrUndefined(this.value) && selectedItem && selectedItem.getAttribute('data-value') === value.toString();
5069
+ if (isValidAddition) {
5070
+ this.addNewItem(list, selectedItem);
5071
+ }
5060
5072
  }
5061
5073
  if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
5062
5074
  this.getSkeletonCount();
@@ -9311,6 +9323,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9311
9323
  }
9312
9324
  };
9313
9325
  DropDownTree.prototype.setMultiSelectValue = function (newValues) {
9326
+ var _this = this;
9314
9327
  if (!this.isFilteredData) {
9315
9328
  this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length === 0 ? this.value : newValues }, true);
9316
9329
  this.isFromFilterChange = false;
@@ -9322,6 +9335,13 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9322
9335
  }
9323
9336
  else {
9324
9337
  var selectedValues = isNullOrUndefined(this.value) ? [] : this.value;
9338
+ selectedValues = selectedValues.filter(function (selectedValue) {
9339
+ var nodeData = _this.treeObj.getTreeData(selectedValue);
9340
+ if (Array.isArray(nodeData)) {
9341
+ return nodeData.every(function (nodeSelectedData) { return nodeSelectedData.selected; });
9342
+ }
9343
+ return true;
9344
+ });
9325
9345
  for (var i = 0; i < newValues.length; i++) {
9326
9346
  if (isNullOrUndefined(this.value) || this.value.indexOf(newValues[i]) === -1) {
9327
9347
  selectedValues.push(newValues[i]);
@@ -11920,6 +11940,7 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
11920
11940
  }
11921
11941
  else {
11922
11942
  _super.prototype.setSelection.call(this, li, e);
11943
+ this.isFiltered = false;
11923
11944
  }
11924
11945
  };
11925
11946
  AutoComplete.prototype.listOption = function (dataSource, fieldsSettings) {
@@ -14299,9 +14320,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14299
14320
  else {
14300
14321
  this.updateDelimeter(this.delimiterChar, e);
14301
14322
  }
14323
+ var isFilterData = this.targetElement().trim() !== '' ? true : false;
14302
14324
  this.makeTextBoxEmpty();
14303
14325
  if (this.mode !== 'CheckBox') {
14304
- this.refreshListItems(li.textContent);
14326
+ this.refreshListItems(li.textContent, isFilterData);
14305
14327
  }
14306
14328
  if (!this.changeOnBlur) {
14307
14329
  this.updateValueState(e, this.value, this.tempValues);
@@ -14352,7 +14374,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14352
14374
  }
14353
14375
  this.refreshPlaceHolder();
14354
14376
  };
14355
- MultiSelect.prototype.refreshListItems = function (data) {
14377
+ MultiSelect.prototype.refreshListItems = function (data, isFilterData) {
14356
14378
  if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
14357
14379
  || this.allowCustomValue) && this.mainList && this.listData) {
14358
14380
  var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
@@ -14364,7 +14386,25 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14364
14386
  this.renderItems(this.mainData, this.fields);
14365
14387
  }
14366
14388
  else {
14367
- this.onActionComplete(this.list, this.listData);
14389
+ if (this.allowFiltering && isFilterData) {
14390
+ this.updateInitialData();
14391
+ this.onActionComplete(list, this.mainData);
14392
+ this.isVirtualTrackHeight = false;
14393
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14394
+ if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
14395
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14396
+ this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
14397
+ }
14398
+ else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
14399
+ var virualElement = this.createElement('div', {
14400
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
14401
+ });
14402
+ this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
14403
+ }
14404
+ }
14405
+ else {
14406
+ this.onActionComplete(this.list, this.listData);
14407
+ }
14368
14408
  }
14369
14409
  }
14370
14410
  else {
@@ -14711,7 +14751,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14711
14751
  _this.removeIndex++;
14712
14752
  }
14713
14753
  else {
14714
- _this.isRemoveSelection = true;
14754
+ _this.isRemoveSelection = _this.enableVirtualization ? true : _this.isRemoveSelection;
14715
14755
  _this.currentRemoveValue = _this.allowObjectBinding ? getValue(((_this.fields.value) ?
14716
14756
  _this.fields.value : ''), value) : value;
14717
14757
  _this.virtualSelectAll = false;
@@ -15404,7 +15444,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15404
15444
  endIndex: this.itemCount
15405
15445
  };
15406
15446
  this.previousStartIndex = 0;
15407
- this.previousEndIndex = 0;
15447
+ this.previousEndIndex = this.itemCount;
15408
15448
  if (this.dataSource instanceof DataManager) {
15409
15449
  if (this.remoteDataCount >= 0) {
15410
15450
  this.totalItemCount = this.dataCount = this.remoteDataCount;
@@ -16335,10 +16375,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16335
16375
  else {
16336
16376
  e.preventDefault();
16337
16377
  }
16378
+ var isFilterData = this.targetElement().trim() !== '' ? true : false;
16338
16379
  this.makeTextBoxEmpty();
16339
16380
  this.findGroupStart(target);
16340
16381
  if (this.mode !== 'CheckBox') {
16341
- this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent);
16382
+ this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent, isFilterData);
16342
16383
  }
16343
16384
  }
16344
16385
  else {