@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.
@@ -440,7 +440,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
440
440
  this.component = component.component;
441
441
  }
442
442
  var endIndex = this.parent.viewPortInfo.endIndex;
443
- if (this.component === 'multiselect' && this.parent.mode === 'CheckBox' && this.parent.value && Array.isArray(this.parent.value) && this.parent.value.length > 0 && this.parent.enableSelectionOrder) {
443
+ 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() === '') {
444
444
  if (this.parent.viewPortInfo.startIndex < this.parent.value.length) {
445
445
  endIndex = this.parent.viewPortInfo.endIndex - this.parent.value.length;
446
446
  if (this.parent.viewPortInfo.startIndex === 0) {
@@ -538,7 +538,8 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
538
538
  if (index === endIndex - 1) {
539
539
  if (currentData.length !== this.parent.itemCount) {
540
540
  if (this.parent.hideSelectedItem) {
541
- var query = this.parent.getForQuery(this.parent.value).clone();
541
+ var query = this.parent.value && this.parent.value.length > 0 ?
542
+ this.parent.getForQuery(this.parent.value).clone() : new Query;
542
543
  if (this.parent.viewPortInfo.endIndex === this.parent.totalItemCount + this.parent.value.length &&
543
544
  this.parent.hideSelectedItem) {
544
545
  query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
@@ -965,6 +966,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
965
966
  _this.virtualSelectAllState = false;
966
967
  _this.CurrentEvent = null;
967
968
  _this.isDynamicData = false;
969
+ _this.isPrimitiveData = false;
968
970
  _this.virtualListInfo = {
969
971
  currentPageNumber: null,
970
972
  direction: null,
@@ -2294,6 +2296,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2294
2296
  this.updateFields(this.fields.text, this.fields.text);
2295
2297
  }
2296
2298
  else if (!this.fields.value && !this.fields.text) {
2299
+ this.isPrimitiveData = true;
2297
2300
  this.updateFields('text', 'text');
2298
2301
  }
2299
2302
  };
@@ -2341,6 +2344,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2341
2344
  };
2342
2345
  DropDownBase.prototype.setUpdateInitial = function (props, newProp, oldProp) {
2343
2346
  this.isDataFetched = false;
2347
+ this.isPrimitiveData = false;
2344
2348
  var updateData = {};
2345
2349
  for (var j = 0; props.length > j; j++) {
2346
2350
  if (newProp[props[j]] && props[j] === 'fields') {
@@ -4299,7 +4303,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4299
4303
  else {
4300
4304
  this.setSelectOptions(li, e);
4301
4305
  if (this.enableVirtualization && this.value) {
4302
- var fields = (this.fields.value) ? this.fields.value : '';
4306
+ var fields = !this.isPrimitiveData ? this.fields.value : '';
4303
4307
  var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
4304
4308
  getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4305
4309
  if (this.dataSource instanceof DataManager) {
@@ -12852,7 +12856,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12852
12856
  };
12853
12857
  MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
12854
12858
  var predicate;
12855
- var field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
12859
+ var field = this.isPrimitiveData ? '' : this.fields.value;
12856
12860
  if (this.enableVirtualization && valuecheck) {
12857
12861
  if (isCheckbox) {
12858
12862
  for (var i = 0; i < valuecheck.length; i++) {
@@ -13292,32 +13296,48 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13292
13296
  if (this.targetElement().trim() === '') {
13293
13297
  var list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ?
13294
13298
  this.mainList.cloneNode(true) : this.mainList;
13295
- if (this.backCommand) {
13299
+ if (this.backCommand || (this.enableVirtualization && this.mode === 'CheckBox' && this.value && this.value.length > 0)) {
13296
13300
  this.remoteCustomValue = false;
13301
+ var isReordered = false;
13297
13302
  if (this.allowCustomValue && list.querySelectorAll('li').length === 0 && this.mainData.length > 0) {
13298
13303
  this.mainData = [];
13299
13304
  }
13300
13305
  if (this.enableVirtualization) {
13301
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13302
- this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
13303
- this.resetList(dataSource, fields, query);
13304
- if (this.mode !== 'CheckBox') {
13305
- this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length :
13306
- this.totalItemCount;
13306
+ if (this.allowFiltering) {
13307
+ this.isPreventScrollAction = true;
13308
+ this.list.scrollTop = 0;
13309
+ this.previousStartIndex = 0;
13310
+ this.virtualListInfo = null;
13307
13311
  }
13308
- this.UpdateSkeleton();
13309
- if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
13310
- if (!this.list.querySelector('.e-virtual-ddl-content')) {
13311
- this.list.appendChild(this.createElement('div', {
13312
- className: 'e-virtual-ddl-content',
13313
- styles: this.getTransformValues()
13314
- })).appendChild(this.list.querySelector('.e-list-parent'));
13312
+ if (this.value && this.value.length > 0 && this.mode === 'CheckBox') {
13313
+ this.notify('setCurrentViewDataAsync', {
13314
+ component: this.getModuleName(),
13315
+ module: 'VirtualScroll'
13316
+ });
13317
+ isReordered = true;
13318
+ }
13319
+ else {
13320
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13321
+ this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
13322
+ this.resetList(dataSource, fields, query);
13323
+ if (this.mode !== 'CheckBox') {
13324
+ this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length :
13325
+ this.totalItemCount;
13315
13326
  }
13316
- if (!this.list.querySelector('.e-virtual-ddl')) {
13317
- var virualElement = this.createElement('div', {
13318
- id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
13319
- });
13320
- document.getElementsByClassName('e-multi-select-list-wrapper')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
13327
+ this.UpdateSkeleton();
13328
+ if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
13329
+ if (!this.list.querySelector('.e-virtual-ddl-content')) {
13330
+ this.list.appendChild(this.createElement('div', {
13331
+ className: 'e-virtual-ddl-content',
13332
+ styles: this.getTransformValues()
13333
+ })).appendChild(this.list.querySelector('.e-list-parent'));
13334
+ }
13335
+ if (!this.list.querySelector('.e-virtual-ddl')) {
13336
+ var virualElement = this.createElement('div', {
13337
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
13338
+ });
13339
+ document.getElementsByClassName('e-multi-select-list-wrapper')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
13340
+ }
13321
13341
  }
13322
13342
  }
13323
13343
  }
@@ -13328,7 +13348,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13328
13348
  if (this.keyCode !== 8) {
13329
13349
  this.focusAtFirstListItem();
13330
13350
  }
13331
- this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13351
+ if (!isReordered) {
13352
+ this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13353
+ }
13332
13354
  }
13333
13355
  }
13334
13356
  else {
@@ -13337,6 +13359,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13337
13359
  this.list.scrollTop = 0;
13338
13360
  this.previousStartIndex = 0;
13339
13361
  this.virtualListInfo = null;
13362
+ if (this.list.querySelector('.e-list-parent' + '.e-reorder')) {
13363
+ this.list.querySelector('.e-list-parent' + '.e-reorder').remove();
13364
+ }
13340
13365
  }
13341
13366
  this.resetList(dataSource, fields, query);
13342
13367
  if (this.enableVirtualization && (isNoData || this.allowCustomValue) &&
@@ -15853,7 +15878,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15853
15878
  endIndex: this.itemCount
15854
15879
  };
15855
15880
  };
15856
- MultiSelect.prototype.updateData = function (delimiterChar, e) {
15881
+ MultiSelect.prototype.updateData = function (delimiterChar, e, isInitialVirtualData) {
15857
15882
  var data = '';
15858
15883
  var delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
15859
15884
  var text = [];
@@ -15896,8 +15921,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15896
15921
  text = this_1.text.split(delimiterChar);
15897
15922
  }
15898
15923
  else {
15899
- temp = this_1.getTextByValue(value);
15900
- var textValues = this_1.text != null && this_1.text !== '' ? this_1.text + ',' + temp : temp;
15924
+ temp = isInitialVirtualData && delim ? this_1.text : this_1.getTextByValue(value);
15925
+ var textValues = isInitialVirtualData ? this_1.text : (this_1.text && this_1.text !== '' ? this_1.text + ',' + temp : temp);
15901
15926
  data += temp + delimiterChar + ' ';
15902
15927
  text.push(textValues);
15903
15928
  hiddenElementContent = this_1.hiddenElement.innerHTML;
@@ -16028,8 +16053,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16028
16053
  text = null;
16029
16054
  if (listItems != null && listItems.length > 0) {
16030
16055
  for (var i = 0; i < listItems.length; i++) {
16031
- if (getValue((this.fields.value ? this.fields.value : 'value'), listItems[i]) === value) {
16032
- text = getValue(this.fields.text, listItems[i]);
16056
+ if ((this.isPrimitiveData && listItems[i] === value) || (!this.isPrimitiveData
16057
+ && getValue((this.fields.value ? this.fields.value :
16058
+ 'value'), listItems[i]) === value)) {
16059
+ text = this.isPrimitiveData ? listItems[i] :
16060
+ getValue(this.fields.text, listItems[i]);
16033
16061
  if (this.enableVirtualization) {
16034
16062
  if (isNullOrUndefined(this.selectedListData)) {
16035
16063
  this.selectedListData = [listItems[i]];
@@ -16115,7 +16143,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16115
16143
  this.refreshInputHight();
16116
16144
  }
16117
16145
  else {
16118
- this.updateDelimeter(this.delimiterChar);
16146
+ this.updateDelimeter(this.delimiterChar, null, isInitialVirtualData);
16119
16147
  }
16120
16148
  if (this.mode === 'CheckBox' && this.showSelectAll && (isNullOrUndefined(this.value) || !this.value.length)) {
16121
16149
  this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'uncheck' });
@@ -16327,8 +16355,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16327
16355
  this.selectedElementID = element.id;
16328
16356
  }
16329
16357
  };
16330
- MultiSelect.prototype.updateDelimeter = function (delimChar, e) {
16331
- this.updateData(delimChar, e);
16358
+ MultiSelect.prototype.updateDelimeter = function (delimChar, e, isInitialVirtualData) {
16359
+ this.updateData(delimChar, e, isInitialVirtualData);
16332
16360
  };
16333
16361
  MultiSelect.prototype.onMouseClick = function (e) {
16334
16362
  var _this = this;
@@ -18077,7 +18105,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18077
18105
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18078
18106
  var listItems_2;
18079
18107
  if (this.enableVirtualization) {
18080
- var fields = (this.fields.value) ? this.fields.value : '';
18108
+ var fields = !this.isPrimitiveData ? this.fields.value : '';
18081
18109
  var predicate = void 0;
18082
18110
  for (var i = 0; i < this.value.length; i++) {
18083
18111
  var value = this.allowObjectBinding ?
@@ -18109,7 +18137,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18109
18137
  }
18110
18138
  }
18111
18139
  if (!(this.dataSource instanceof DataManager)) {
18112
- this.initialValueUpdate(listItems_2);
18140
+ this.initialValueUpdate(listItems_2, true);
18113
18141
  this.initialUpdate();
18114
18142
  }
18115
18143
  else {
@@ -18887,7 +18915,10 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
18887
18915
  this.parent.refreshPopup();
18888
18916
  this.clearIconElement.style.visibility = 'hidden';
18889
18917
  this.filterInput.focus();
18890
- this.setReorder(e);
18918
+ if (!this.parent.enableVirtualization || (this.parent.enableVirtualization && (isNullOrUndefined(this.parent.value)
18919
+ || (this.parent.value && this.parent.value.length === 0)))) {
18920
+ this.setReorder(e);
18921
+ }
18891
18922
  this.boundPreventListSelection = this.preventListSelection.bind(this);
18892
18923
  this.parent.popupWrapper.addEventListener('mouseup', this.boundPreventListSelection, true);
18893
18924
  e.preventDefault();