@syncfusion/ej2-dropdowns 27.2.3 → 27.2.5

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,
@@ -1996,7 +1998,13 @@ let DropDownBase = class DropDownBase extends Component {
1996
1998
  const oldUlElement = this.list.querySelector('.e-list-parent');
1997
1999
  const virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
1998
2000
  if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && this.getModuleName() === 'autocomplete')) {
1999
- virtualUlElement.replaceChild(ulElement, oldUlElement);
2001
+ if (this.getModuleName() === 'multiselect' && this.isCheckBoxSelection && this.appendUncheckList && this.list && this.list.querySelector('.e-active')) {
2002
+ virtualUlElement.appendChild(ulElement);
2003
+ isCheckBoxUpdate = true;
2004
+ }
2005
+ else {
2006
+ virtualUlElement.replaceChild(ulElement, oldUlElement);
2007
+ }
2000
2008
  const reOrderList = this.list.querySelectorAll('.e-reorder');
2001
2009
  if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList && reOrderList.length > 0 && !isCheckBoxUpdate) {
2002
2010
  this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList[0]);
@@ -2209,6 +2217,7 @@ let DropDownBase = class DropDownBase extends Component {
2209
2217
  this.updateFields(this.fields.text, this.fields.text);
2210
2218
  }
2211
2219
  else if (!this.fields.value && !this.fields.text) {
2220
+ this.isPrimitiveData = true;
2212
2221
  this.updateFields('text', 'text');
2213
2222
  }
2214
2223
  }
@@ -2256,6 +2265,7 @@ let DropDownBase = class DropDownBase extends Component {
2256
2265
  }
2257
2266
  setUpdateInitial(props, newProp, oldProp) {
2258
2267
  this.isDataFetched = false;
2268
+ this.isPrimitiveData = false;
2259
2269
  const updateData = {};
2260
2270
  for (let j = 0; props.length > j; j++) {
2261
2271
  if (newProp[props[j]] && props[j] === 'fields') {
@@ -4192,7 +4202,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4192
4202
  else {
4193
4203
  this.setSelectOptions(li, e);
4194
4204
  if (this.enableVirtualization && this.value) {
4195
- const fields = (this.fields.value) ? this.fields.value : '';
4205
+ const fields = !this.isPrimitiveData ? this.fields.value : '';
4196
4206
  const currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
4197
4207
  getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4198
4208
  if (this.dataSource instanceof DataManager) {
@@ -7178,7 +7188,7 @@ let DropDownTree = class DropDownTree extends Component {
7178
7188
  }
7179
7189
  else {
7180
7190
  if (!isNullOrUndefined(this.element.id)) {
7181
- this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text', id: this.element.id } });
7191
+ this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text', id: this.element.id + '_textbox' } });
7182
7192
  }
7183
7193
  else {
7184
7194
  this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
@@ -8405,6 +8415,9 @@ let DropDownTree = class DropDownTree extends Component {
8405
8415
  const id = this.value[0].toString();
8406
8416
  if (this.treeObj.selectedNodes[0] !== id) {
8407
8417
  setValue('selectedNodes', [id], this.treeObj);
8418
+ if (this.fields.dataSource instanceof DataManager) {
8419
+ this.updateSelectedValues();
8420
+ }
8408
8421
  }
8409
8422
  }
8410
8423
  else {
@@ -12601,7 +12614,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12601
12614
  }
12602
12615
  getForQuery(valuecheck, isCheckbox) {
12603
12616
  let predicate;
12604
- const field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
12617
+ const field = this.isPrimitiveData ? '' : this.fields.value;
12605
12618
  if (this.enableVirtualization && valuecheck) {
12606
12619
  if (isCheckbox) {
12607
12620
  for (let i = 0; i < valuecheck.length; i++) {
@@ -13041,32 +13054,48 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13041
13054
  if (this.targetElement().trim() === '') {
13042
13055
  const list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ?
13043
13056
  this.mainList.cloneNode(true) : this.mainList;
13044
- if (this.backCommand) {
13057
+ if (this.backCommand || (this.enableVirtualization && this.mode === 'CheckBox' && this.value && this.value.length > 0)) {
13045
13058
  this.remoteCustomValue = false;
13059
+ let isReordered = false;
13046
13060
  if (this.allowCustomValue && list.querySelectorAll('li').length === 0 && this.mainData.length > 0) {
13047
13061
  this.mainData = [];
13048
13062
  }
13049
13063
  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;
13064
+ if (this.allowFiltering) {
13065
+ this.isPreventScrollAction = true;
13066
+ this.list.scrollTop = 0;
13067
+ this.previousStartIndex = 0;
13068
+ this.virtualListInfo = null;
13056
13069
  }
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'));
13070
+ if (this.value && this.value.length > 0 && this.mode === 'CheckBox') {
13071
+ this.notify('setCurrentViewDataAsync', {
13072
+ component: this.getModuleName(),
13073
+ module: 'VirtualScroll'
13074
+ });
13075
+ isReordered = true;
13076
+ }
13077
+ else {
13078
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13079
+ this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
13080
+ this.resetList(dataSource, fields, query);
13081
+ if (this.mode !== 'CheckBox') {
13082
+ this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length :
13083
+ this.totalItemCount;
13064
13084
  }
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);
13085
+ this.UpdateSkeleton();
13086
+ if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
13087
+ if (!this.list.querySelector('.e-virtual-ddl-content')) {
13088
+ this.list.appendChild(this.createElement('div', {
13089
+ className: 'e-virtual-ddl-content',
13090
+ styles: this.getTransformValues()
13091
+ })).appendChild(this.list.querySelector('.e-list-parent'));
13092
+ }
13093
+ if (!this.list.querySelector('.e-virtual-ddl')) {
13094
+ const virualElement = this.createElement('div', {
13095
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
13096
+ });
13097
+ document.getElementsByClassName('e-multi-select-list-wrapper')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
13098
+ }
13070
13099
  }
13071
13100
  }
13072
13101
  }
@@ -13077,7 +13106,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13077
13106
  if (this.keyCode !== 8) {
13078
13107
  this.focusAtFirstListItem();
13079
13108
  }
13080
- this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13109
+ if (!isReordered) {
13110
+ this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13111
+ }
13081
13112
  }
13082
13113
  }
13083
13114
  else {
@@ -13086,6 +13117,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13086
13117
  this.list.scrollTop = 0;
13087
13118
  this.previousStartIndex = 0;
13088
13119
  this.virtualListInfo = null;
13120
+ if (this.list.querySelector('.e-list-parent' + '.e-reorder')) {
13121
+ this.list.querySelector('.e-list-parent' + '.e-reorder').remove();
13122
+ }
13089
13123
  }
13090
13124
  this.resetList(dataSource, fields, query);
13091
13125
  if (this.enableVirtualization && (isNoData || this.allowCustomValue) &&
@@ -15247,6 +15281,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15247
15281
  clearAll(e) {
15248
15282
  if (this.enabled && !this.readonly) {
15249
15283
  let temp;
15284
+ this.setDynValue = false;
15250
15285
  if (this.value && this.value.length > 0) {
15251
15286
  if (this.allowFiltering) {
15252
15287
  this.refreshListItems(null);
@@ -15586,7 +15621,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15586
15621
  endIndex: this.itemCount
15587
15622
  };
15588
15623
  }
15589
- updateData(delimiterChar, e) {
15624
+ updateData(delimiterChar, e, isInitialVirtualData) {
15590
15625
  let data = '';
15591
15626
  const delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
15592
15627
  let text = [];
@@ -15629,8 +15664,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15629
15664
  text = this.text.split(delimiterChar);
15630
15665
  }
15631
15666
  else {
15632
- temp = this.getTextByValue(value);
15633
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + temp : temp;
15667
+ temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
15668
+ const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + ',' + temp : temp);
15634
15669
  data += temp + delimiterChar + ' ';
15635
15670
  text.push(textValues);
15636
15671
  hiddenElementContent = this.hiddenElement.innerHTML;
@@ -15753,8 +15788,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15753
15788
  text = null;
15754
15789
  if (listItems != null && listItems.length > 0) {
15755
15790
  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]);
15791
+ if ((this.isPrimitiveData && listItems[i] === value) || (!this.isPrimitiveData
15792
+ && getValue((this.fields.value ? this.fields.value :
15793
+ 'value'), listItems[i]) === value)) {
15794
+ text = this.isPrimitiveData ? listItems[i] :
15795
+ getValue(this.fields.text, listItems[i]);
15758
15796
  if (this.enableVirtualization) {
15759
15797
  if (isNullOrUndefined(this.selectedListData)) {
15760
15798
  this.selectedListData = [listItems[i]];
@@ -15840,7 +15878,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15840
15878
  this.refreshInputHight();
15841
15879
  }
15842
15880
  else {
15843
- this.updateDelimeter(this.delimiterChar);
15881
+ this.updateDelimeter(this.delimiterChar, null, isInitialVirtualData);
15844
15882
  }
15845
15883
  if (this.mode === 'CheckBox' && this.showSelectAll && (isNullOrUndefined(this.value) || !this.value.length)) {
15846
15884
  this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'uncheck' });
@@ -16051,8 +16089,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16051
16089
  this.selectedElementID = element.id;
16052
16090
  }
16053
16091
  }
16054
- updateDelimeter(delimChar, e) {
16055
- this.updateData(delimChar, e);
16092
+ updateDelimeter(delimChar, e, isInitialVirtualData) {
16093
+ this.updateData(delimChar, e, isInitialVirtualData);
16056
16094
  }
16057
16095
  onMouseClick(e) {
16058
16096
  if (!this.isClearAllItem) {
@@ -17789,7 +17827,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17789
17827
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17790
17828
  let listItems;
17791
17829
  if (this.enableVirtualization) {
17792
- const fields = (this.fields.value) ? this.fields.value : '';
17830
+ const fields = !this.isPrimitiveData ? this.fields.value : '';
17793
17831
  let predicate;
17794
17832
  for (let i = 0; i < this.value.length; i++) {
17795
17833
  const value = this.allowObjectBinding ?
@@ -17821,7 +17859,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17821
17859
  }
17822
17860
  }
17823
17861
  if (!(this.dataSource instanceof DataManager)) {
17824
- this.initialValueUpdate(listItems);
17862
+ this.initialValueUpdate(listItems, true);
17825
17863
  this.initialUpdate();
17826
17864
  }
17827
17865
  else {
@@ -18596,7 +18634,10 @@ class CheckBoxSelection {
18596
18634
  this.parent.refreshPopup();
18597
18635
  this.clearIconElement.style.visibility = 'hidden';
18598
18636
  this.filterInput.focus();
18599
- this.setReorder(e);
18637
+ if (!this.parent.enableVirtualization || (this.parent.enableVirtualization && (isNullOrUndefined(this.parent.value)
18638
+ || (this.parent.value && this.parent.value.length === 0)))) {
18639
+ this.setReorder(e);
18640
+ }
18600
18641
  this.boundPreventListSelection = this.preventListSelection.bind(this);
18601
18642
  this.parent.popupWrapper.addEventListener('mouseup', this.boundPreventListSelection, true);
18602
18643
  e.preventDefault();