@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.
@@ -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,13 @@ 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.selectedLI = this.getElementByValue(currentValue);
5058
+ this.isDynamicData = false;
5059
+ }
5051
5060
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5052
5061
  if ((this.allowCustom || (this.allowFiltering && !this.isValueInList(list, this.value) &&
5053
5062
  this.dataSource instanceof DataManager)) && !this.enableVirtualization) {
@@ -5056,7 +5065,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5056
5065
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5057
5066
  else if ((this.allowCustom || (this.allowFiltering && this.isValueInList(list, this.value))) &&
5058
5067
  !this.enableVirtualization) {
5059
- this.addNewItem(list, selectedItem);
5068
+ var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
5069
+ var isValidAddition = !isNullOrUndefined(this.value) && selectedItem && selectedItem.getAttribute('data-value') === value.toString();
5070
+ if (isValidAddition) {
5071
+ this.addNewItem(list, selectedItem);
5072
+ }
5060
5073
  }
5061
5074
  if (!isNullOrUndefined(this.itemData) || (isNullOrUndefined(this.itemData) && this.enableVirtualization)) {
5062
5075
  this.getSkeletonCount();
@@ -9311,6 +9324,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9311
9324
  }
9312
9325
  };
9313
9326
  DropDownTree.prototype.setMultiSelectValue = function (newValues) {
9327
+ var _this = this;
9314
9328
  if (!this.isFilteredData) {
9315
9329
  this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length === 0 ? this.value : newValues }, true);
9316
9330
  this.isFromFilterChange = false;
@@ -9322,6 +9336,13 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9322
9336
  }
9323
9337
  else {
9324
9338
  var selectedValues = isNullOrUndefined(this.value) ? [] : this.value;
9339
+ selectedValues = selectedValues.filter(function (selectedValue) {
9340
+ var nodeData = _this.treeObj.getTreeData(selectedValue);
9341
+ if (Array.isArray(nodeData)) {
9342
+ return nodeData.every(function (nodeSelectedData) { return nodeSelectedData.selected; });
9343
+ }
9344
+ return true;
9345
+ });
9325
9346
  for (var i = 0; i < newValues.length; i++) {
9326
9347
  if (isNullOrUndefined(this.value) || this.value.indexOf(newValues[i]) === -1) {
9327
9348
  selectedValues.push(newValues[i]);
@@ -10298,7 +10319,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
10298
10319
  this.isPopupOpen = false;
10299
10320
  if (this.isReact) {
10300
10321
  this.clearTemplate(['headerTemplate', 'footerTemplate', 'itemTemplate', 'actionFailureTemplate',
10301
- 'noRecordsTemplate', 'customTemplate']);
10322
+ 'noRecordsTemplate']);
10302
10323
  }
10303
10324
  if (this.popupObj) {
10304
10325
  this.popupObj.destroy();
@@ -10660,6 +10681,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
10660
10681
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10661
10682
  ComboBox.prototype.setOldValue = function (value) {
10662
10683
  if (this.allowCustom) {
10684
+ this.selectedLI = this.getElementByValue(this.value);
10663
10685
  this.valueMuteChange(this.value);
10664
10686
  }
10665
10687
  else {
@@ -11920,6 +11942,7 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
11920
11942
  }
11921
11943
  else {
11922
11944
  _super.prototype.setSelection.call(this, li, e);
11945
+ this.isFiltered = false;
11923
11946
  }
11924
11947
  };
11925
11948
  AutoComplete.prototype.listOption = function (dataSource, fieldsSettings) {
@@ -14299,9 +14322,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14299
14322
  else {
14300
14323
  this.updateDelimeter(this.delimiterChar, e);
14301
14324
  }
14325
+ var isFilterData = this.targetElement().trim() !== '' ? true : false;
14302
14326
  this.makeTextBoxEmpty();
14303
14327
  if (this.mode !== 'CheckBox') {
14304
- this.refreshListItems(li.textContent);
14328
+ this.refreshListItems(li.textContent, isFilterData);
14305
14329
  }
14306
14330
  if (!this.changeOnBlur) {
14307
14331
  this.updateValueState(e, this.value, this.tempValues);
@@ -14352,7 +14376,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14352
14376
  }
14353
14377
  this.refreshPlaceHolder();
14354
14378
  };
14355
- MultiSelect.prototype.refreshListItems = function (data) {
14379
+ MultiSelect.prototype.refreshListItems = function (data, isFilterData) {
14356
14380
  if ((this.allowFiltering || (this.mode === 'CheckBox' && this.enableSelectionOrder === true)
14357
14381
  || this.allowCustomValue) && this.mainList && this.listData) {
14358
14382
  var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
@@ -14364,7 +14388,25 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14364
14388
  this.renderItems(this.mainData, this.fields);
14365
14389
  }
14366
14390
  else {
14367
- this.onActionComplete(this.list, this.listData);
14391
+ if (this.allowFiltering && isFilterData) {
14392
+ this.updateInitialData();
14393
+ this.onActionComplete(list, this.mainData);
14394
+ this.isVirtualTrackHeight = false;
14395
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14396
+ if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
14397
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14398
+ this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
14399
+ }
14400
+ else if (!this.list.querySelector('.e-virtual-ddl') && this.skeletonCount > 0) {
14401
+ var virualElement = this.createElement('div', {
14402
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
14403
+ });
14404
+ this.popupWrapper.querySelector('.e-dropdownbase').appendChild(virualElement);
14405
+ }
14406
+ }
14407
+ else {
14408
+ this.onActionComplete(this.list, this.listData);
14409
+ }
14368
14410
  }
14369
14411
  }
14370
14412
  else {
@@ -14711,7 +14753,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14711
14753
  _this.removeIndex++;
14712
14754
  }
14713
14755
  else {
14714
- _this.isRemoveSelection = true;
14756
+ _this.isRemoveSelection = _this.enableVirtualization ? true : _this.isRemoveSelection;
14715
14757
  _this.currentRemoveValue = _this.allowObjectBinding ? getValue(((_this.fields.value) ?
14716
14758
  _this.fields.value : ''), value) : value;
14717
14759
  _this.virtualSelectAll = false;
@@ -15404,7 +15446,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15404
15446
  endIndex: this.itemCount
15405
15447
  };
15406
15448
  this.previousStartIndex = 0;
15407
- this.previousEndIndex = 0;
15449
+ this.previousEndIndex = this.itemCount;
15408
15450
  if (this.dataSource instanceof DataManager) {
15409
15451
  if (this.remoteDataCount >= 0) {
15410
15452
  this.totalItemCount = this.dataCount = this.remoteDataCount;
@@ -16335,10 +16377,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16335
16377
  else {
16336
16378
  e.preventDefault();
16337
16379
  }
16380
+ var isFilterData = this.targetElement().trim() !== '' ? true : false;
16338
16381
  this.makeTextBoxEmpty();
16339
16382
  this.findGroupStart(target);
16340
16383
  if (this.mode !== 'CheckBox') {
16341
- this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent);
16384
+ this.refreshListItems(isNullOrUndefined(li) ? null : li.textContent, isFilterData);
16342
16385
  }
16343
16386
  }
16344
16387
  else {