@syncfusion/ej2-dropdowns 27.2.3 → 27.2.4

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.
@@ -392,7 +392,7 @@ class VirtualScroll {
392
392
  this.component = component.component;
393
393
  }
394
394
  let endIndex = this.parent.viewPortInfo.endIndex;
395
- if (this.component === 'multiselect' && this.parent.mode === 'CheckBox' && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.enableSelectionOrder) {
395
+ if (this.component === 'multiselect' && this.parent.mode === 'CheckBox' && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.enableSelectionOrder && this.parent.targetElement().trim() === '') {
396
396
  if (this.parent.viewPortInfo.startIndex < this.parent.value.length) {
397
397
  endIndex = this.parent.viewPortInfo.endIndex - this.parent.value.length;
398
398
  if (this.parent.viewPortInfo.startIndex === 0) {
@@ -490,7 +490,8 @@ class VirtualScroll {
490
490
  if (index === endIndex - 1) {
491
491
  if (currentData.length !== this.parent.itemCount) {
492
492
  if (this.parent.hideSelectedItem) {
493
- let query = this.parent.getForQuery(this.parent.value).clone();
493
+ let query = this.parent.value && this.parent.value.length > 0 ?
494
+ this.parent.getForQuery(this.parent.value).clone() : new Query;
494
495
  if (this.parent.viewPortInfo.endIndex === this.parent.totalItemCount + this.parent.value.length &&
495
496
  this.parent.hideSelectedItem) {
496
497
  query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
@@ -887,6 +888,7 @@ let DropDownBase = class DropDownBase extends Component {
887
888
  this.virtualSelectAllState = false;
888
889
  this.CurrentEvent = null;
889
890
  this.isDynamicData = false;
891
+ this.isPrimitiveData = false;
890
892
  this.virtualListInfo = {
891
893
  currentPageNumber: null,
892
894
  direction: null,
@@ -2209,6 +2211,7 @@ let DropDownBase = class DropDownBase extends Component {
2209
2211
  this.updateFields(this.fields.text, this.fields.text);
2210
2212
  }
2211
2213
  else if (!this.fields.value && !this.fields.text) {
2214
+ this.isPrimitiveData = true;
2212
2215
  this.updateFields('text', 'text');
2213
2216
  }
2214
2217
  }
@@ -2256,6 +2259,7 @@ let DropDownBase = class DropDownBase extends Component {
2256
2259
  }
2257
2260
  setUpdateInitial(props, newProp, oldProp) {
2258
2261
  this.isDataFetched = false;
2262
+ this.isPrimitiveData = false;
2259
2263
  const updateData = {};
2260
2264
  for (let j = 0; props.length > j; j++) {
2261
2265
  if (newProp[props[j]] && props[j] === 'fields') {
@@ -4192,7 +4196,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4192
4196
  else {
4193
4197
  this.setSelectOptions(li, e);
4194
4198
  if (this.enableVirtualization && this.value) {
4195
- const fields = (this.fields.value) ? this.fields.value : '';
4199
+ const fields = !this.isPrimitiveData ? this.fields.value : '';
4196
4200
  const currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
4197
4201
  getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4198
4202
  if (this.dataSource instanceof DataManager) {
@@ -12601,7 +12605,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12601
12605
  }
12602
12606
  getForQuery(valuecheck, isCheckbox) {
12603
12607
  let predicate;
12604
- const field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
12608
+ const field = this.isPrimitiveData ? '' : this.fields.value;
12605
12609
  if (this.enableVirtualization && valuecheck) {
12606
12610
  if (isCheckbox) {
12607
12611
  for (let i = 0; i < valuecheck.length; i++) {
@@ -13041,32 +13045,48 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13041
13045
  if (this.targetElement().trim() === '') {
13042
13046
  const list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ?
13043
13047
  this.mainList.cloneNode(true) : this.mainList;
13044
- if (this.backCommand) {
13048
+ if (this.backCommand || (this.enableVirtualization && this.mode === 'CheckBox' && this.value && this.value.length > 0)) {
13045
13049
  this.remoteCustomValue = false;
13050
+ let isReordered = false;
13046
13051
  if (this.allowCustomValue && list.querySelectorAll('li').length === 0 && this.mainData.length > 0) {
13047
13052
  this.mainData = [];
13048
13053
  }
13049
13054
  if (this.enableVirtualization) {
13050
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13051
- this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
13052
- this.resetList(dataSource, fields, query);
13053
- if (this.mode !== 'CheckBox') {
13054
- this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length :
13055
- this.totalItemCount;
13055
+ if (this.allowFiltering) {
13056
+ this.isPreventScrollAction = true;
13057
+ this.list.scrollTop = 0;
13058
+ this.previousStartIndex = 0;
13059
+ this.virtualListInfo = null;
13056
13060
  }
13057
- this.UpdateSkeleton();
13058
- if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
13059
- if (!this.list.querySelector('.e-virtual-ddl-content')) {
13060
- this.list.appendChild(this.createElement('div', {
13061
- className: 'e-virtual-ddl-content',
13062
- styles: this.getTransformValues()
13063
- })).appendChild(this.list.querySelector('.e-list-parent'));
13061
+ if (this.value && this.value.length > 0 && this.mode === 'CheckBox') {
13062
+ this.notify('setCurrentViewDataAsync', {
13063
+ component: this.getModuleName(),
13064
+ module: 'VirtualScroll'
13065
+ });
13066
+ isReordered = true;
13067
+ }
13068
+ else {
13069
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13070
+ this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
13071
+ this.resetList(dataSource, fields, query);
13072
+ if (this.mode !== 'CheckBox') {
13073
+ this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length :
13074
+ this.totalItemCount;
13064
13075
  }
13065
- if (!this.list.querySelector('.e-virtual-ddl')) {
13066
- const virualElement = this.createElement('div', {
13067
- id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
13068
- });
13069
- document.getElementsByClassName('e-multi-select-list-wrapper')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
13076
+ this.UpdateSkeleton();
13077
+ if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
13078
+ if (!this.list.querySelector('.e-virtual-ddl-content')) {
13079
+ this.list.appendChild(this.createElement('div', {
13080
+ className: 'e-virtual-ddl-content',
13081
+ styles: this.getTransformValues()
13082
+ })).appendChild(this.list.querySelector('.e-list-parent'));
13083
+ }
13084
+ if (!this.list.querySelector('.e-virtual-ddl')) {
13085
+ const virualElement = this.createElement('div', {
13086
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
13087
+ });
13088
+ document.getElementsByClassName('e-multi-select-list-wrapper')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
13089
+ }
13070
13090
  }
13071
13091
  }
13072
13092
  }
@@ -13077,7 +13097,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13077
13097
  if (this.keyCode !== 8) {
13078
13098
  this.focusAtFirstListItem();
13079
13099
  }
13080
- this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13100
+ if (!isReordered) {
13101
+ this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13102
+ }
13081
13103
  }
13082
13104
  }
13083
13105
  else {
@@ -13086,6 +13108,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13086
13108
  this.list.scrollTop = 0;
13087
13109
  this.previousStartIndex = 0;
13088
13110
  this.virtualListInfo = null;
13111
+ if (this.list.querySelector('.e-list-parent' + '.e-reorder')) {
13112
+ this.list.querySelector('.e-list-parent' + '.e-reorder').remove();
13113
+ }
13089
13114
  }
13090
13115
  this.resetList(dataSource, fields, query);
13091
13116
  if (this.enableVirtualization && (isNoData || this.allowCustomValue) &&
@@ -15586,7 +15611,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15586
15611
  endIndex: this.itemCount
15587
15612
  };
15588
15613
  }
15589
- updateData(delimiterChar, e) {
15614
+ updateData(delimiterChar, e, isInitialVirtualData) {
15590
15615
  let data = '';
15591
15616
  const delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
15592
15617
  let text = [];
@@ -15629,8 +15654,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15629
15654
  text = this.text.split(delimiterChar);
15630
15655
  }
15631
15656
  else {
15632
- temp = this.getTextByValue(value);
15633
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + temp : temp;
15657
+ temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
15658
+ const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + ',' + temp : temp);
15634
15659
  data += temp + delimiterChar + ' ';
15635
15660
  text.push(textValues);
15636
15661
  hiddenElementContent = this.hiddenElement.innerHTML;
@@ -15753,8 +15778,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15753
15778
  text = null;
15754
15779
  if (listItems != null && listItems.length > 0) {
15755
15780
  for (let i = 0; i < listItems.length; i++) {
15756
- if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
15757
- text = getValue(this.fields.text, listItems[i]);
15781
+ if ((this.isPrimitiveData && listItems[i] === value) || (!this.isPrimitiveData
15782
+ && getValue((this.fields.value ? this.fields.value :
15783
+ 'value'), listItems[i]) === value)) {
15784
+ text = this.isPrimitiveData ? listItems[i] :
15785
+ getValue(this.fields.text, listItems[i]);
15758
15786
  if (this.enableVirtualization) {
15759
15787
  if (isNullOrUndefined(this.selectedListData)) {
15760
15788
  this.selectedListData = [listItems[i]];
@@ -15840,7 +15868,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15840
15868
  this.refreshInputHight();
15841
15869
  }
15842
15870
  else {
15843
- this.updateDelimeter(this.delimiterChar);
15871
+ this.updateDelimeter(this.delimiterChar, null, isInitialVirtualData);
15844
15872
  }
15845
15873
  if (this.mode === 'CheckBox' && this.showSelectAll && (isNullOrUndefined(this.value) || !this.value.length)) {
15846
15874
  this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'uncheck' });
@@ -16051,8 +16079,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16051
16079
  this.selectedElementID = element.id;
16052
16080
  }
16053
16081
  }
16054
- updateDelimeter(delimChar, e) {
16055
- this.updateData(delimChar, e);
16082
+ updateDelimeter(delimChar, e, isInitialVirtualData) {
16083
+ this.updateData(delimChar, e, isInitialVirtualData);
16056
16084
  }
16057
16085
  onMouseClick(e) {
16058
16086
  if (!this.isClearAllItem) {
@@ -17789,7 +17817,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17789
17817
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17790
17818
  let listItems;
17791
17819
  if (this.enableVirtualization) {
17792
- const fields = (this.fields.value) ? this.fields.value : '';
17820
+ const fields = !this.isPrimitiveData ? this.fields.value : '';
17793
17821
  let predicate;
17794
17822
  for (let i = 0; i < this.value.length; i++) {
17795
17823
  const value = this.allowObjectBinding ?
@@ -17821,7 +17849,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17821
17849
  }
17822
17850
  }
17823
17851
  if (!(this.dataSource instanceof DataManager)) {
17824
- this.initialValueUpdate(listItems);
17852
+ this.initialValueUpdate(listItems, true);
17825
17853
  this.initialUpdate();
17826
17854
  }
17827
17855
  else {
@@ -18596,7 +18624,10 @@ class CheckBoxSelection {
18596
18624
  this.parent.refreshPopup();
18597
18625
  this.clearIconElement.style.visibility = 'hidden';
18598
18626
  this.filterInput.focus();
18599
- this.setReorder(e);
18627
+ if (!this.parent.enableVirtualization || (this.parent.enableVirtualization && (isNullOrUndefined(this.parent.value)
18628
+ || (this.parent.value && this.parent.value.length === 0)))) {
18629
+ this.setReorder(e);
18630
+ }
18600
18631
  this.boundPreventListSelection = this.preventListSelection.bind(this);
18601
18632
  this.parent.popupWrapper.addEventListener('mouseup', this.boundPreventListSelection, true);
18602
18633
  e.preventDefault();