@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.
@@ -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,
@@ -2081,7 +2083,13 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2081
2083
  var oldUlElement = this.list.querySelector('.e-list-parent');
2082
2084
  var virtualUlElement = this.list.querySelector('.e-virtual-ddl-content');
2083
2085
  if ((listData.length >= this.virtualizedItemsCount && oldUlElement && virtualUlElement) || (oldUlElement && virtualUlElement && this.isAllowFiltering) || (oldUlElement && virtualUlElement && this.getModuleName() === 'autocomplete')) {
2084
- virtualUlElement.replaceChild(ulElement, oldUlElement);
2086
+ if (this.getModuleName() === 'multiselect' && this.isCheckBoxSelection && this.appendUncheckList && this.list && this.list.querySelector('.e-active')) {
2087
+ virtualUlElement.appendChild(ulElement);
2088
+ isCheckBoxUpdate = true;
2089
+ }
2090
+ else {
2091
+ virtualUlElement.replaceChild(ulElement, oldUlElement);
2092
+ }
2085
2093
  var reOrderList = this.list.querySelectorAll('.e-reorder');
2086
2094
  if (this.list.querySelector('.e-virtual-ddl-content') && reOrderList && reOrderList.length > 0 && !isCheckBoxUpdate) {
2087
2095
  this.list.querySelector('.e-virtual-ddl-content').removeChild(reOrderList[0]);
@@ -2294,6 +2302,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2294
2302
  this.updateFields(this.fields.text, this.fields.text);
2295
2303
  }
2296
2304
  else if (!this.fields.value && !this.fields.text) {
2305
+ this.isPrimitiveData = true;
2297
2306
  this.updateFields('text', 'text');
2298
2307
  }
2299
2308
  };
@@ -2341,6 +2350,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2341
2350
  };
2342
2351
  DropDownBase.prototype.setUpdateInitial = function (props, newProp, oldProp) {
2343
2352
  this.isDataFetched = false;
2353
+ this.isPrimitiveData = false;
2344
2354
  var updateData = {};
2345
2355
  for (var j = 0; props.length > j; j++) {
2346
2356
  if (newProp[props[j]] && props[j] === 'fields') {
@@ -4299,7 +4309,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4299
4309
  else {
4300
4310
  this.setSelectOptions(li, e);
4301
4311
  if (this.enableVirtualization && this.value) {
4302
- var fields = (this.fields.value) ? this.fields.value : '';
4312
+ var fields = !this.isPrimitiveData ? this.fields.value : '';
4303
4313
  var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ?
4304
4314
  getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
4305
4315
  if (this.dataSource instanceof DataManager) {
@@ -7342,7 +7352,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7342
7352
  }
7343
7353
  else {
7344
7354
  if (!isNullOrUndefined(this.element.id)) {
7345
- this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text', id: this.element.id } });
7355
+ this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text', id: this.element.id + '_textbox' } });
7346
7356
  }
7347
7357
  else {
7348
7358
  this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
@@ -8587,6 +8597,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8587
8597
  var id = this.value[0].toString();
8588
8598
  if (this.treeObj.selectedNodes[0] !== id) {
8589
8599
  setValue('selectedNodes', [id], this.treeObj);
8600
+ if (this.fields.dataSource instanceof DataManager) {
8601
+ this.updateSelectedValues();
8602
+ }
8590
8603
  }
8591
8604
  }
8592
8605
  else {
@@ -12852,7 +12865,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12852
12865
  };
12853
12866
  MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
12854
12867
  var predicate;
12855
- var field = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
12868
+ var field = this.isPrimitiveData ? '' : this.fields.value;
12856
12869
  if (this.enableVirtualization && valuecheck) {
12857
12870
  if (isCheckbox) {
12858
12871
  for (var i = 0; i < valuecheck.length; i++) {
@@ -13292,32 +13305,48 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13292
13305
  if (this.targetElement().trim() === '') {
13293
13306
  var list = this.enableVirtualization ? this.list.cloneNode(true) : this.mainList.cloneNode ?
13294
13307
  this.mainList.cloneNode(true) : this.mainList;
13295
- if (this.backCommand) {
13308
+ if (this.backCommand || (this.enableVirtualization && this.mode === 'CheckBox' && this.value && this.value.length > 0)) {
13296
13309
  this.remoteCustomValue = false;
13310
+ var isReordered = false;
13297
13311
  if (this.allowCustomValue && list.querySelectorAll('li').length === 0 && this.mainData.length > 0) {
13298
13312
  this.mainData = [];
13299
13313
  }
13300
13314
  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;
13315
+ if (this.allowFiltering) {
13316
+ this.isPreventScrollAction = true;
13317
+ this.list.scrollTop = 0;
13318
+ this.previousStartIndex = 0;
13319
+ this.virtualListInfo = null;
13307
13320
  }
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'));
13321
+ if (this.value && this.value.length > 0 && this.mode === 'CheckBox') {
13322
+ this.notify('setCurrentViewDataAsync', {
13323
+ component: this.getModuleName(),
13324
+ module: 'VirtualScroll'
13325
+ });
13326
+ isReordered = true;
13327
+ }
13328
+ else {
13329
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13330
+ this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
13331
+ this.resetList(dataSource, fields, query);
13332
+ if (this.mode !== 'CheckBox') {
13333
+ this.totalItemCount = this.value && this.value.length ? this.totalItemCount - this.value.length :
13334
+ this.totalItemCount;
13315
13335
  }
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);
13336
+ this.UpdateSkeleton();
13337
+ if ((isNoData || this.allowCustomValue) && !this.list.classList.contains(dropDownBaseClasses.noData)) {
13338
+ if (!this.list.querySelector('.e-virtual-ddl-content')) {
13339
+ this.list.appendChild(this.createElement('div', {
13340
+ className: 'e-virtual-ddl-content',
13341
+ styles: this.getTransformValues()
13342
+ })).appendChild(this.list.querySelector('.e-list-parent'));
13343
+ }
13344
+ if (!this.list.querySelector('.e-virtual-ddl')) {
13345
+ var virualElement = this.createElement('div', {
13346
+ id: this.element.id + '_popup', className: 'e-virtual-ddl', styles: this.GetVirtualTrackHeight()
13347
+ });
13348
+ document.getElementsByClassName('e-multi-select-list-wrapper')[0].querySelector('.e-dropdownbase').appendChild(virualElement);
13349
+ }
13321
13350
  }
13322
13351
  }
13323
13352
  }
@@ -13328,7 +13357,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13328
13357
  if (this.keyCode !== 8) {
13329
13358
  this.focusAtFirstListItem();
13330
13359
  }
13331
- this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13360
+ if (!isReordered) {
13361
+ this.notify('reOrder', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', e: this });
13362
+ }
13332
13363
  }
13333
13364
  }
13334
13365
  else {
@@ -13337,6 +13368,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13337
13368
  this.list.scrollTop = 0;
13338
13369
  this.previousStartIndex = 0;
13339
13370
  this.virtualListInfo = null;
13371
+ if (this.list.querySelector('.e-list-parent' + '.e-reorder')) {
13372
+ this.list.querySelector('.e-list-parent' + '.e-reorder').remove();
13373
+ }
13340
13374
  }
13341
13375
  this.resetList(dataSource, fields, query);
13342
13376
  if (this.enableVirtualization && (isNoData || this.allowCustomValue) &&
@@ -15512,6 +15546,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15512
15546
  MultiSelect.prototype.clearAll = function (e) {
15513
15547
  if (this.enabled && !this.readonly) {
15514
15548
  var temp = void 0;
15549
+ this.setDynValue = false;
15515
15550
  if (this.value && this.value.length > 0) {
15516
15551
  if (this.allowFiltering) {
15517
15552
  this.refreshListItems(null);
@@ -15853,7 +15888,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15853
15888
  endIndex: this.itemCount
15854
15889
  };
15855
15890
  };
15856
- MultiSelect.prototype.updateData = function (delimiterChar, e) {
15891
+ MultiSelect.prototype.updateData = function (delimiterChar, e, isInitialVirtualData) {
15857
15892
  var data = '';
15858
15893
  var delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
15859
15894
  var text = [];
@@ -15896,8 +15931,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15896
15931
  text = this_1.text.split(delimiterChar);
15897
15932
  }
15898
15933
  else {
15899
- temp = this_1.getTextByValue(value);
15900
- var textValues = this_1.text != null && this_1.text !== '' ? this_1.text + ',' + temp : temp;
15934
+ temp = isInitialVirtualData && delim ? this_1.text : this_1.getTextByValue(value);
15935
+ var textValues = isInitialVirtualData ? this_1.text : (this_1.text && this_1.text !== '' ? this_1.text + ',' + temp : temp);
15901
15936
  data += temp + delimiterChar + ' ';
15902
15937
  text.push(textValues);
15903
15938
  hiddenElementContent = this_1.hiddenElement.innerHTML;
@@ -16028,8 +16063,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16028
16063
  text = null;
16029
16064
  if (listItems != null && listItems.length > 0) {
16030
16065
  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]);
16066
+ if ((this.isPrimitiveData && listItems[i] === value) || (!this.isPrimitiveData
16067
+ && getValue((this.fields.value ? this.fields.value :
16068
+ 'value'), listItems[i]) === value)) {
16069
+ text = this.isPrimitiveData ? listItems[i] :
16070
+ getValue(this.fields.text, listItems[i]);
16033
16071
  if (this.enableVirtualization) {
16034
16072
  if (isNullOrUndefined(this.selectedListData)) {
16035
16073
  this.selectedListData = [listItems[i]];
@@ -16115,7 +16153,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16115
16153
  this.refreshInputHight();
16116
16154
  }
16117
16155
  else {
16118
- this.updateDelimeter(this.delimiterChar);
16156
+ this.updateDelimeter(this.delimiterChar, null, isInitialVirtualData);
16119
16157
  }
16120
16158
  if (this.mode === 'CheckBox' && this.showSelectAll && (isNullOrUndefined(this.value) || !this.value.length)) {
16121
16159
  this.notify('checkSelectAll', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox', value: 'uncheck' });
@@ -16327,8 +16365,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16327
16365
  this.selectedElementID = element.id;
16328
16366
  }
16329
16367
  };
16330
- MultiSelect.prototype.updateDelimeter = function (delimChar, e) {
16331
- this.updateData(delimChar, e);
16368
+ MultiSelect.prototype.updateDelimeter = function (delimChar, e, isInitialVirtualData) {
16369
+ this.updateData(delimChar, e, isInitialVirtualData);
16332
16370
  };
16333
16371
  MultiSelect.prototype.onMouseClick = function (e) {
16334
16372
  var _this = this;
@@ -18077,7 +18115,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18077
18115
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18078
18116
  var listItems_2;
18079
18117
  if (this.enableVirtualization) {
18080
- var fields = (this.fields.value) ? this.fields.value : '';
18118
+ var fields = !this.isPrimitiveData ? this.fields.value : '';
18081
18119
  var predicate = void 0;
18082
18120
  for (var i = 0; i < this.value.length; i++) {
18083
18121
  var value = this.allowObjectBinding ?
@@ -18109,7 +18147,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18109
18147
  }
18110
18148
  }
18111
18149
  if (!(this.dataSource instanceof DataManager)) {
18112
- this.initialValueUpdate(listItems_2);
18150
+ this.initialValueUpdate(listItems_2, true);
18113
18151
  this.initialUpdate();
18114
18152
  }
18115
18153
  else {
@@ -18887,7 +18925,10 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
18887
18925
  this.parent.refreshPopup();
18888
18926
  this.clearIconElement.style.visibility = 'hidden';
18889
18927
  this.filterInput.focus();
18890
- this.setReorder(e);
18928
+ if (!this.parent.enableVirtualization || (this.parent.enableVirtualization && (isNullOrUndefined(this.parent.value)
18929
+ || (this.parent.value && this.parent.value.length === 0)))) {
18930
+ this.setReorder(e);
18931
+ }
18891
18932
  this.boundPreventListSelection = this.preventListSelection.bind(this);
18892
18933
  this.parent.popupWrapper.addEventListener('mouseup', this.boundPreventListSelection, true);
18893
18934
  e.preventDefault();