@syncfusion/ej2-dropdowns 28.1.39 → 28.2.3

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.
@@ -401,7 +401,7 @@ class VirtualScroll {
401
401
  endIndex = this.parent.viewPortInfo.endIndex - this.parent.value.length;
402
402
  if (this.parent.viewPortInfo.startIndex === 0) {
403
403
  this.parent.updateVirtualReOrderList(true);
404
- if (this.parent.value.length < this.parent.itemCount) {
404
+ if (this.parent.value.length < this.parent.itemCount && this.parent.value.length !== this.parent.totalItemCount) {
405
405
  const oldUlElement = this.parent.list.querySelector('.e-list-parent' + ':not(.e-reorder)');
406
406
  if (oldUlElement) {
407
407
  this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
@@ -464,6 +464,12 @@ class VirtualScroll {
464
464
  if (isListUpdated) {
465
465
  for (let i = this.parent.viewPortInfo.startIndex; i < endIndex; i++) {
466
466
  const index = i;
467
+ if (this.component === 'multiselect' && this.parent.mode === 'CheckBox') {
468
+ const oldUlElement = this.parent.list.querySelector('.e-list-parent' + '.e-reorder');
469
+ if (oldUlElement) {
470
+ this.parent.list.querySelector('.e-virtual-ddl-content').removeChild(oldUlElement);
471
+ }
472
+ }
467
473
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
468
474
  const alreadyAddedData = this.parent.generatedDataObject[index];
469
475
  if (this.component === 'multiselect' && this.parent.hideSelectedItem) {
@@ -533,6 +539,7 @@ class VirtualScroll {
533
539
  }
534
540
  if (this.component === 'multiselect') {
535
541
  this.parent.updatevirtualizationList();
542
+ this.parent.checkMaxSelection();
536
543
  }
537
544
  this.parent.getSkeletonCount();
538
545
  this.parent.skeletonCount = this.parent.totalItemCount !== 0 && this.parent.totalItemCount < this.parent.itemCount * 2 &&
@@ -3095,7 +3102,9 @@ let DropDownList = class DropDownList extends DropDownBase {
3095
3102
  };
3096
3103
  }
3097
3104
  setEnableRtl() {
3098
- Input.setEnableRtl(this.enableRtl, [this.inputElement.parentElement]);
3105
+ if (!isNullOrUndefined(this.inputElement) && !isNullOrUndefined(this.inputElement.parentElement)) {
3106
+ Input.setEnableRtl(this.enableRtl, [this.inputElement.parentElement]);
3107
+ }
3099
3108
  if (this.popupObj) {
3100
3109
  this.popupObj.enableRtl = this.enableRtl;
3101
3110
  this.popupObj.dataBind();
@@ -6020,6 +6029,9 @@ let DropDownList = class DropDownList extends DropDownBase {
6020
6029
  }
6021
6030
  updateInitialData() {
6022
6031
  const currentData = this.selectData;
6032
+ if (isNullOrUndefined(currentData)) {
6033
+ return;
6034
+ }
6023
6035
  const ulElement = this.renderItems(currentData, this.fields);
6024
6036
  this.list.scrollTop = 0;
6025
6037
  this.virtualListInfo = {
@@ -6052,7 +6064,7 @@ let DropDownList = class DropDownList extends DropDownBase {
6052
6064
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6053
6065
  this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
6054
6066
  }
6055
- else if (!this.list.querySelector('.e-virtual-ddl')) {
6067
+ else if (!this.list.querySelector('.e-virtual-ddl') && this.list.parentElement) {
6056
6068
  const virualElement = this.createElement('div', {
6057
6069
  id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
6058
6070
  });
@@ -6801,7 +6813,7 @@ let DropDownList = class DropDownList extends DropDownBase {
6801
6813
  if (this.isReact && this.isFiltering() && this.itemTemplate != null) {
6802
6814
  setTimeout(() => {
6803
6815
  proxy.cloneElements();
6804
- proxy.isSecondClick = true;
6816
+ proxy.isSecondClick = proxy.isReact && proxy.isFiltering() && proxy.dataSource instanceof DataManager && !proxy.list.querySelector('ul') ? false : true;
6805
6817
  }, duration);
6806
6818
  }
6807
6819
  }
@@ -7508,7 +7520,7 @@ let DropDownTree = class DropDownTree extends Component {
7508
7520
  if (firstUl && firstUl.getAttribute('aria-multiselectable')) {
7509
7521
  firstUl.removeAttribute('aria-multiselectable');
7510
7522
  }
7511
- this.oldValue = this.value;
7523
+ this.setOldValue();
7512
7524
  if (!this.isRemoteData) {
7513
7525
  this.isInitialized = true;
7514
7526
  }
@@ -7928,7 +7940,7 @@ let DropDownTree = class DropDownTree extends Component {
7928
7940
  this.triggerChangeEvent(event);
7929
7941
  }
7930
7942
  this.removeValue = false;
7931
- this.oldValue = this.value;
7943
+ this.setOldValue();
7932
7944
  this.trigger('blur');
7933
7945
  }
7934
7946
  updateView() {
@@ -7961,7 +7973,7 @@ let DropDownTree = class DropDownTree extends Component {
7961
7973
  element: this.element
7962
7974
  };
7963
7975
  this.trigger('change', eventArgs);
7964
- this.oldValue = this.value;
7976
+ this.setOldValue();
7965
7977
  }
7966
7978
  }
7967
7979
  ddtCompareValues(oldValue, newValue) {
@@ -8428,6 +8440,7 @@ let DropDownTree = class DropDownTree extends Component {
8428
8440
  frameSpan.classList.add(CHECK);
8429
8441
  ariaState = 'true';
8430
8442
  if (!this.isReverseUpdate) {
8443
+ this.setOldValue();
8431
8444
  this.isCheckAllCalled = true;
8432
8445
  this.treeObj.checkAll();
8433
8446
  if (!this.changeOnBlur) {
@@ -8590,7 +8603,7 @@ let DropDownTree = class DropDownTree extends Component {
8590
8603
  }
8591
8604
  }
8592
8605
  if (valArr.length !== 0) {
8593
- this.oldValue = this.value;
8606
+ this.setOldValue();
8594
8607
  this.setProperties({ value: valArr }, true);
8595
8608
  this.setValidValue();
8596
8609
  }
@@ -8601,7 +8614,7 @@ let DropDownTree = class DropDownTree extends Component {
8601
8614
  else {
8602
8615
  data = this.getItems(this.text);
8603
8616
  if (!isNullOrUndefined(data)) {
8604
- this.oldValue = this.value;
8617
+ this.setOldValue();
8605
8618
  this.setProperties({ value: [data[this.fields.value].toString()] }, true);
8606
8619
  this.setValidValue();
8607
8620
  }
@@ -8616,7 +8629,7 @@ let DropDownTree = class DropDownTree extends Component {
8616
8629
  return;
8617
8630
  }
8618
8631
  if (!this.isInitialized) {
8619
- this.oldValue = this.value;
8632
+ this.setOldValue();
8620
8633
  if (this.treeObj.selectedNodes.length > 0 && !this.showCheckBox) {
8621
8634
  this.setProperties({ value: this.treeObj.selectedNodes }, true);
8622
8635
  if (this.allowMultiSelection) {
@@ -9201,7 +9214,7 @@ let DropDownTree = class DropDownTree extends Component {
9201
9214
  }
9202
9215
  onBeforeSelect(args) {
9203
9216
  if (args.isInteracted) {
9204
- this.oldValue = this.value ? this.value.slice() : this.value;
9217
+ this.setOldValue();
9205
9218
  if (this.value === null) {
9206
9219
  this.setProperties({ value: [] }, true);
9207
9220
  }
@@ -9322,7 +9335,7 @@ let DropDownTree = class DropDownTree extends Component {
9322
9335
  }
9323
9336
  beforeCheck(args) {
9324
9337
  if (args.isInteracted) {
9325
- this.oldValue = this.value ? this.value.slice() : this.value;
9338
+ this.setOldValue();
9326
9339
  }
9327
9340
  }
9328
9341
  onNodeExpanded() {
@@ -9868,7 +9881,7 @@ let DropDownTree = class DropDownTree extends Component {
9868
9881
  }
9869
9882
  Input.setValue(null, this.inputEle, this.floatLabelType);
9870
9883
  if (!isDynamicChange) {
9871
- this.oldValue = this.value;
9884
+ this.setOldValue();
9872
9885
  this.setProperties({ value: [] }, true);
9873
9886
  this.showOrHideValueTemplate(false);
9874
9887
  }
@@ -9904,6 +9917,9 @@ let DropDownTree = class DropDownTree extends Component {
9904
9917
  this.setLocale(false);
9905
9918
  }
9906
9919
  }
9920
+ setOldValue() {
9921
+ this.oldValue = Array.isArray(this.value) ? this.value.slice() : this.value;
9922
+ }
9907
9923
  selectAllItems(state) {
9908
9924
  if (this.showCheckBox) {
9909
9925
  if (state) {
@@ -12501,11 +12517,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12501
12517
  this.isUpdateFooterHeight = false;
12502
12518
  this.isBlurDispatching = false;
12503
12519
  this.isFilterPrevented = false;
12520
+ this.isFilteringAction = false;
12504
12521
  this.isValidKey = false;
12505
12522
  this.selectAllEventData = [];
12506
12523
  this.selectAllEventEle = [];
12507
- this.resetMainList = null;
12508
- this.resetFilteredData = false;
12509
12524
  this.preventSetCurrentData = false;
12510
12525
  this.isSelectAllLoop = false;
12511
12526
  this.scrollFocusStatus = false;
@@ -12960,7 +12975,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12960
12975
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12961
12976
  this.totalItemCount = e.count;
12962
12977
  }
12963
- if (this.value && list && list.length > 0 && this.allowFiltering && this.mode !== 'CheckBox' && !this.enableVirtualization && !this.isFilterPrevented && !this.allowCustomValue) {
12978
+ if (this.value && list && list.length > 0 && this.allowFiltering && this.mode !== 'CheckBox' && !this.enableVirtualization && !this.isFilterPrevented && !this.allowCustomValue && this.isFilteringAction) {
12964
12979
  const allItemsInValue = list.every((item) => {
12965
12980
  const itemValue = getValue((this.fields.value) ? this.fields.value : '', item);
12966
12981
  return this.value.some((val) => {
@@ -13062,6 +13077,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13062
13077
  if (!this.enableVirtualization || (this.enableVirtualization && (!(this.dataSource instanceof DataManager)))) {
13063
13078
  this.initialValueUpdate();
13064
13079
  }
13080
+ else {
13081
+ this.initialValueUpdate(this.listData, true);
13082
+ }
13065
13083
  this.initialUpdate();
13066
13084
  this.refreshPlaceHolder();
13067
13085
  if (this.mode !== 'CheckBox' && this.changeOnBlur) {
@@ -13670,10 +13688,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13670
13688
  }
13671
13689
  }
13672
13690
  this.updateDataList();
13673
- if (this.resetMainList) {
13674
- this.mainList = this.resetMainList;
13675
- this.resetMainList = null;
13676
- }
13677
13691
  this.refreshListItems(null);
13678
13692
  if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
13679
13693
  this.updateDelimView();
@@ -15615,6 +15629,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15615
15629
  this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length : this.totalItemCount;
15616
15630
  }
15617
15631
  this.getSkeletonCount();
15632
+ this.skeletonCount = this.totalItemCount !== 0 && this.totalItemCount < this.itemCount * 2 &&
15633
+ ((!(this.dataSource instanceof DataManager)) || ((this.dataSource instanceof DataManager) &&
15634
+ (this.totalItemCount <= this.itemCount))) ? 0 : this.skeletonCount;
15618
15635
  this.UpdateSkeleton();
15619
15636
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15620
15637
  if (this.list.getElementsByClassName('e-virtual-ddl')[0]) {
@@ -15803,7 +15820,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15803
15820
  });
15804
15821
  }
15805
15822
  search(e) {
15806
- this.resetFilteredData = true;
15807
15823
  this.preventSetCurrentData = false;
15808
15824
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
15809
15825
  if (!isNullOrUndefined(e)) {
@@ -15844,10 +15860,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15844
15860
  if (!eventArgs.cancel) {
15845
15861
  if (!this.isFiltered && !eventArgs.preventDefaultAction) {
15846
15862
  this.filterAction = true;
15863
+ this.isFilteringAction = true;
15847
15864
  if (this.dataSource instanceof DataManager && this.allowCustomValue) {
15848
15865
  this.isCustomRendered = false;
15849
15866
  }
15850
15867
  this.dataUpdater(this.dataSource, null, this.fields);
15868
+ this.isFilteringAction = false;
15851
15869
  }
15852
15870
  }
15853
15871
  });
@@ -16020,7 +16038,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16020
16038
  else {
16021
16039
  if (this.listData) {
16022
16040
  if (this.enableVirtualization) {
16023
- if (delim) {
16041
+ if (delim && !this.isDynamicRemoteVirtualData) {
16024
16042
  data = this.delimiterWrapper && this.delimiterWrapper.innerHTML === '' ? data :
16025
16043
  this.delimiterWrapper.innerHTML;
16026
16044
  }
@@ -16033,7 +16051,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16033
16051
  }
16034
16052
  else {
16035
16053
  temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
16036
- const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + this.delimiterChar + temp : temp);
16054
+ const textValues = this.isDynamicRemoteVirtualData && value != null && value !== '' ? this.getTextByValue(value) : isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + this.delimiterChar + temp : temp);
16037
16055
  data += temp + delimiterChar + ' ';
16038
16056
  text.push(textValues);
16039
16057
  hiddenElementContent = this.hiddenElement.innerHTML;
@@ -16193,7 +16211,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16193
16211
  (this.mode === 'Box' || this.mode === 'Default'))) ||
16194
16212
  (this.enableVirtualization && value != null && text != null && !isCustomData)) {
16195
16213
  const currentText = [];
16196
- const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16214
+ const textValues = this.isDynamicRemoteVirtualData && text != null && text !== '' ? text : this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16197
16215
  currentText.push(textValues);
16198
16216
  this.setProperties({ text: currentText.toString() }, true);
16199
16217
  this.addChip(text, value);
@@ -17501,11 +17519,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17501
17519
  onPropertyChanged(newProp, oldProp) {
17502
17520
  if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
17503
17521
  || newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
17504
- if (this.resetFilteredData) {
17505
- // The filtered data is not being reset in the component after the user focuses out.
17506
- this.resetMainList = !this.resetMainList ? this.mainList : this.resetMainList;
17507
- this.resetFilteredData = false;
17508
- }
17509
17522
  this.mainList = null;
17510
17523
  this.mainData = null;
17511
17524
  this.isFirstClick = false;
@@ -17772,6 +17785,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17772
17785
  if (!this.enableVirtualization || (this.enableVirtualization && (!(this.dataSource instanceof DataManager)))) {
17773
17786
  this.initialValueUpdate();
17774
17787
  }
17788
+ else if (!this.isInitRemoteVirtualData) {
17789
+ this.isDynamicRemoteVirtualData = true;
17790
+ this.initialValueUpdate(this.listData, true);
17791
+ this.isDynamicRemoteVirtualData = false;
17792
+ this.initialUpdate();
17793
+ }
17775
17794
  if (this.mode !== 'Box' && !this.inputFocus) {
17776
17795
  this.updateDelimView();
17777
17796
  }
@@ -18364,9 +18383,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18364
18383
  if (e.result.length > 0) {
18365
18384
  listItems = e.result;
18366
18385
  this.initStatus = false;
18386
+ this.isInitRemoteVirtualData = true;
18367
18387
  setTimeout(() => {
18368
18388
  this.initialValueUpdate(listItems, true);
18369
18389
  this.initialUpdate();
18390
+ this.isInitRemoteVirtualData = false;
18370
18391
  }, 100);
18371
18392
  this.initStatus = true;
18372
18393
  }