@syncfusion/ej2-dropdowns 29.2.10 → 29.2.11

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.
@@ -13346,7 +13346,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13346
13346
  if (!isNullOrUndefined(this.value)) {
13347
13347
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
13348
13348
  }
13349
- var customValue = this.allowObjectBinding ?
13349
+ var customValue = this.allowObjectBinding ? this.enableVirtualization ?
13350
+ this.getVirtualDataByValue(this.getFormattedValue(value)) :
13350
13351
  this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
13351
13352
  if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
13352
13353
  customValue.toString() === 'NaN'))) {
@@ -13768,9 +13769,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13768
13769
  return this.virtualFilterQuery(filterQuery);
13769
13770
  }
13770
13771
  if (this.virtualSelectAll) {
13771
- return query ? query.take(this.maximumSelectionLength).requiresCount() : this.query ?
13772
- this.query.take(this.maximumSelectionLength).requiresCount() :
13773
- new Query().take(this.maximumSelectionLength).requiresCount();
13772
+ return query ? query.skip(0).take(this.maximumSelectionLength).requiresCount() : this.query ?
13773
+ this.query.skip(0).take(this.maximumSelectionLength).requiresCount() :
13774
+ new Query().skip(0).take(this.maximumSelectionLength).requiresCount();
13774
13775
  }
13775
13776
  return query ? query : this.query ? this.query : new Query();
13776
13777
  }
@@ -14747,6 +14748,15 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14747
14748
  var focuseElem = this.list.querySelector('li.' + dropDownBaseClasses.focus);
14748
14749
  this.focusFirstListItem = !isNullOrUndefined(this.liCollections[0]) ? this.liCollections[0].classList.contains('e-item-focus') :
14749
14750
  false;
14751
+ if (this.list && this.list.querySelector('.e-list-parent.e-ul.e-reorder')) {
14752
+ var elements = this.list.querySelectorAll('li.'
14753
+ + dropDownBaseClasses.li
14754
+ + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list-end)');
14755
+ if (elements.length > 0) {
14756
+ this.focusFirstListItem = !isNullOrUndefined(elements[0]) ? elements[0].classList.contains('e-item-focus') :
14757
+ false;
14758
+ }
14759
+ }
14750
14760
  var index = Array.prototype.slice.call(list).indexOf(focuseElem);
14751
14761
  if (index <= 0 && (this.mode === 'CheckBox' && this.allowFiltering)) {
14752
14762
  this.keyAction = false;
@@ -15169,10 +15179,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15169
15179
  }
15170
15180
  else if (elements.length) {
15171
15181
  if (this.mode === 'CheckBox' && this.showSelectAll && !isNullOrUndefined(selectAllParent && position === -1)) {
15172
- if (!this.focusFirstListItem && selectAllParent.classList.contains('e-item-focus')) {
15182
+ if ((!this.focusFirstListItem || position === 1) && selectAllParent.classList.contains('e-item-focus')) {
15173
15183
  selectAllParent.classList.remove('e-item-focus');
15174
15184
  }
15175
- else if (this.focusFirstListItem && !selectAllParent.classList.contains('e-item-focus')) {
15185
+ else if (this.focusFirstListItem && !selectAllParent.classList.contains('e-item-focus') && !(position === 1 && this.list.querySelector('.e-item-focus'))) {
15176
15186
  selectAllParent.classList.add('e-item-focus');
15177
15187
  }
15178
15188
  }
@@ -15310,6 +15320,28 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15310
15320
  addClass([element], CHIP_SELECTED);
15311
15321
  this.trigger('chipSelection', e);
15312
15322
  };
15323
+ MultiSelect.prototype.getVirtualDataByValue = function (value) {
15324
+ if (!isNullOrUndefined(this.selectedListData)) {
15325
+ var type = this.typeOfData(this.selectedListData).typeof;
15326
+ if (type === 'string' || type === 'number' || type === 'boolean') {
15327
+ for (var _i = 0, _a = this.selectedListData; _i < _a.length; _i++) {
15328
+ var item = _a[_i];
15329
+ if (!isNullOrUndefined(item) && item === value) {
15330
+ return item;
15331
+ }
15332
+ }
15333
+ }
15334
+ else {
15335
+ for (var _b = 0, _c = this.selectedListData; _b < _c.length; _b++) {
15336
+ var item = _c[_b];
15337
+ if (!isNullOrUndefined(item) && getValue((this.fields.value ? this.fields.value : 'value'), item) === value) {
15338
+ return item;
15339
+ }
15340
+ }
15341
+ }
15342
+ }
15343
+ return null;
15344
+ };
15313
15345
  MultiSelect.prototype.onChipRemove = function (e) {
15314
15346
  if (e.which === 3 || e.button === 2) {
15315
15347
  return;
@@ -15317,7 +15349,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15317
15349
  if (this.enabled && !this.readonly) {
15318
15350
  var element = e.target.parentElement;
15319
15351
  var customVal = element.getAttribute('data-value');
15320
- var value = this.allowObjectBinding ?
15352
+ var value = this.allowObjectBinding ? this.enableVirtualization ?
15353
+ this.getVirtualDataByValue(this.getFormattedValue(customVal)) :
15321
15354
  this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
15322
15355
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
15323
15356
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
@@ -15435,7 +15468,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15435
15468
  _this.virtualSelectAll = false;
15436
15469
  var removeVal = _this.value.slice(0);
15437
15470
  removeVal.splice(index, 1);
15438
- if (_this.enableVirtualization && _this.mode === 'CheckBox') {
15471
+ if (_this.enableVirtualization && _this.selectedListData) {
15439
15472
  _this.selectedListData.splice(index, 1);
15440
15473
  }
15441
15474
  _this.setProperties({ value: [].concat([], removeVal) }, true);
@@ -15700,7 +15733,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15700
15733
  value = _this.allowObjectBinding ? _this.getDataByValue(value) : value;
15701
15734
  if (_this.enableVirtualization) {
15702
15735
  if (isNullOrUndefined(_this.selectedListData)) {
15703
- _this.selectedListData = [(_this.getDataByValue(value))];
15736
+ _this.selectedListData = _this.allowObjectBinding ? [value] : [(_this.getDataByValue(value))];
15704
15737
  }
15705
15738
  else {
15706
15739
  if (dataValue) {
@@ -15713,10 +15746,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15713
15746
  }
15714
15747
  else {
15715
15748
  if (Array.isArray(_this.selectedListData)) {
15716
- _this.selectedListData.push((_this.getDataByValue(value)));
15749
+ _this.selectedListData.push(_this.allowObjectBinding ? value :
15750
+ (_this.getDataByValue(value)));
15717
15751
  }
15718
15752
  else {
15719
- _this.selectedListData = [_this.selectedListData, (_this.getDataByValue(value))];
15753
+ _this.selectedListData = [_this.selectedListData, _this.allowObjectBinding ? value :
15754
+ (_this.getDataByValue(value))];
15720
15755
  }
15721
15756
  }
15722
15757
  }
@@ -16729,11 +16764,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16729
16764
  this.selectedListData = [listItems[i]];
16730
16765
  }
16731
16766
  else {
16732
- if (Array.isArray(this.selectedListData)) {
16733
- this.selectedListData.push((listItems[i]));
16734
- }
16735
- else {
16736
- this.selectedListData = [this.selectedListData, (listItems[i])];
16767
+ if ((this.allowObjectBinding && !this.isObjectInArray(listItems[i], this.selectedListData)) ||
16768
+ !this.allowObjectBinding) {
16769
+ if (Array.isArray(this.selectedListData)) {
16770
+ this.selectedListData.push((listItems[i]));
16771
+ }
16772
+ else {
16773
+ this.selectedListData = [this.selectedListData, (listItems[i])];
16774
+ }
16737
16775
  }
16738
16776
  }
16739
16777
  }
@@ -17802,6 +17840,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17802
17840
  }
17803
17841
  this.updateHiddenElement();
17804
17842
  this.setProperties({ value: [] }, true);
17843
+ this.selectedListData = [];
17805
17844
  this.virtualSelectAll = false;
17806
17845
  if (!isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
17807
17846
  this.notify('setCurrentViewDataAsync', {
@@ -18318,6 +18357,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18318
18357
  this.onLoadSelect();
18319
18358
  if (this.enableVirtualization) {
18320
18359
  this.setProperties({ text: '' }, true);
18360
+ this.selectedListData = [];
18321
18361
  this.checkInitialValue();
18322
18362
  }
18323
18363
  }