@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.
@@ -13092,7 +13092,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13092
13092
  if (!isNullOrUndefined(this.value)) {
13093
13093
  this.tempValues = this.allowObjectBinding ? this.value.slice() : this.value.slice();
13094
13094
  }
13095
- let customValue = this.allowObjectBinding ?
13095
+ let customValue = this.allowObjectBinding ? this.enableVirtualization ?
13096
+ this.getVirtualDataByValue(this.getFormattedValue(value)) :
13096
13097
  this.getDataByValue(this.getFormattedValue(value)) : this.getFormattedValue(value);
13097
13098
  if (this.allowCustomValue && (value !== 'false' && customValue === false || (!isNullOrUndefined(customValue) &&
13098
13099
  customValue.toString() === 'NaN'))) {
@@ -13513,9 +13514,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13513
13514
  return this.virtualFilterQuery(filterQuery);
13514
13515
  }
13515
13516
  if (this.virtualSelectAll) {
13516
- return query ? query.take(this.maximumSelectionLength).requiresCount() : this.query ?
13517
- this.query.take(this.maximumSelectionLength).requiresCount() :
13518
- new Query().take(this.maximumSelectionLength).requiresCount();
13517
+ return query ? query.skip(0).take(this.maximumSelectionLength).requiresCount() : this.query ?
13518
+ this.query.skip(0).take(this.maximumSelectionLength).requiresCount() :
13519
+ new Query().skip(0).take(this.maximumSelectionLength).requiresCount();
13519
13520
  }
13520
13521
  return query ? query : this.query ? this.query : new Query();
13521
13522
  }
@@ -14491,6 +14492,15 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14491
14492
  const focuseElem = this.list.querySelector('li.' + dropDownBaseClasses.focus);
14492
14493
  this.focusFirstListItem = !isNullOrUndefined(this.liCollections[0]) ? this.liCollections[0].classList.contains('e-item-focus') :
14493
14494
  false;
14495
+ if (this.list && this.list.querySelector('.e-list-parent.e-ul.e-reorder')) {
14496
+ const elements = this.list.querySelectorAll('li.'
14497
+ + dropDownBaseClasses.li
14498
+ + ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)' + ':not(.e-virtual-list-end)');
14499
+ if (elements.length > 0) {
14500
+ this.focusFirstListItem = !isNullOrUndefined(elements[0]) ? elements[0].classList.contains('e-item-focus') :
14501
+ false;
14502
+ }
14503
+ }
14494
14504
  const index = Array.prototype.slice.call(list).indexOf(focuseElem);
14495
14505
  if (index <= 0 && (this.mode === 'CheckBox' && this.allowFiltering)) {
14496
14506
  this.keyAction = false;
@@ -14909,10 +14919,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
14909
14919
  }
14910
14920
  else if (elements.length) {
14911
14921
  if (this.mode === 'CheckBox' && this.showSelectAll && !isNullOrUndefined(selectAllParent && position === -1)) {
14912
- if (!this.focusFirstListItem && selectAllParent.classList.contains('e-item-focus')) {
14922
+ if ((!this.focusFirstListItem || position === 1) && selectAllParent.classList.contains('e-item-focus')) {
14913
14923
  selectAllParent.classList.remove('e-item-focus');
14914
14924
  }
14915
- else if (this.focusFirstListItem && !selectAllParent.classList.contains('e-item-focus')) {
14925
+ else if (this.focusFirstListItem && !selectAllParent.classList.contains('e-item-focus') && !(position === 1 && this.list.querySelector('.e-item-focus'))) {
14916
14926
  selectAllParent.classList.add('e-item-focus');
14917
14927
  }
14918
14928
  }
@@ -15049,6 +15059,26 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15049
15059
  addClass([element], CHIP_SELECTED);
15050
15060
  this.trigger('chipSelection', e);
15051
15061
  }
15062
+ getVirtualDataByValue(value) {
15063
+ if (!isNullOrUndefined(this.selectedListData)) {
15064
+ const type = this.typeOfData(this.selectedListData).typeof;
15065
+ if (type === 'string' || type === 'number' || type === 'boolean') {
15066
+ for (const item of this.selectedListData) {
15067
+ if (!isNullOrUndefined(item) && item === value) {
15068
+ return item;
15069
+ }
15070
+ }
15071
+ }
15072
+ else {
15073
+ for (const item of this.selectedListData) {
15074
+ if (!isNullOrUndefined(item) && getValue((this.fields.value ? this.fields.value : 'value'), item) === value) {
15075
+ return item;
15076
+ }
15077
+ }
15078
+ }
15079
+ }
15080
+ return null;
15081
+ }
15052
15082
  onChipRemove(e) {
15053
15083
  if (e.which === 3 || e.button === 2) {
15054
15084
  return;
@@ -15056,7 +15086,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15056
15086
  if (this.enabled && !this.readonly) {
15057
15087
  const element = e.target.parentElement;
15058
15088
  const customVal = element.getAttribute('data-value');
15059
- let value = this.allowObjectBinding ?
15089
+ let value = this.allowObjectBinding ? this.enableVirtualization ?
15090
+ this.getVirtualDataByValue(this.getFormattedValue(customVal)) :
15060
15091
  this.getDataByValue(this.getFormattedValue(customVal)) : this.getFormattedValue(customVal);
15061
15092
  if (this.allowCustomValue && ((customVal !== 'false' && value === false) ||
15062
15093
  (!isNullOrUndefined(value) && value.toString() === 'NaN'))) {
@@ -15173,7 +15204,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15173
15204
  this.virtualSelectAll = false;
15174
15205
  const removeVal = this.value.slice(0);
15175
15206
  removeVal.splice(index, 1);
15176
- if (this.enableVirtualization && this.mode === 'CheckBox') {
15207
+ if (this.enableVirtualization && this.selectedListData) {
15177
15208
  this.selectedListData.splice(index, 1);
15178
15209
  }
15179
15210
  this.setProperties({ value: [].concat([], removeVal) }, true);
@@ -15432,7 +15463,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15432
15463
  value = this.allowObjectBinding ? this.getDataByValue(value) : value;
15433
15464
  if (this.enableVirtualization) {
15434
15465
  if (isNullOrUndefined(this.selectedListData)) {
15435
- this.selectedListData = [(this.getDataByValue(value))];
15466
+ this.selectedListData = this.allowObjectBinding ? [value] : [(this.getDataByValue(value))];
15436
15467
  }
15437
15468
  else {
15438
15469
  if (dataValue) {
@@ -15445,10 +15476,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15445
15476
  }
15446
15477
  else {
15447
15478
  if (Array.isArray(this.selectedListData)) {
15448
- this.selectedListData.push((this.getDataByValue(value)));
15479
+ this.selectedListData.push(this.allowObjectBinding ? value :
15480
+ (this.getDataByValue(value)));
15449
15481
  }
15450
15482
  else {
15451
- this.selectedListData = [this.selectedListData, (this.getDataByValue(value))];
15483
+ this.selectedListData = [this.selectedListData, this.allowObjectBinding ? value :
15484
+ (this.getDataByValue(value))];
15452
15485
  }
15453
15486
  }
15454
15487
  }
@@ -16449,11 +16482,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16449
16482
  this.selectedListData = [listItems[i]];
16450
16483
  }
16451
16484
  else {
16452
- if (Array.isArray(this.selectedListData)) {
16453
- this.selectedListData.push((listItems[i]));
16454
- }
16455
- else {
16456
- this.selectedListData = [this.selectedListData, (listItems[i])];
16485
+ if ((this.allowObjectBinding && !this.isObjectInArray(listItems[i], this.selectedListData)) ||
16486
+ !this.allowObjectBinding) {
16487
+ if (Array.isArray(this.selectedListData)) {
16488
+ this.selectedListData.push((listItems[i]));
16489
+ }
16490
+ else {
16491
+ this.selectedListData = [this.selectedListData, (listItems[i])];
16492
+ }
16457
16493
  }
16458
16494
  }
16459
16495
  }
@@ -17519,6 +17555,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17519
17555
  }
17520
17556
  this.updateHiddenElement();
17521
17557
  this.setProperties({ value: [] }, true);
17558
+ this.selectedListData = [];
17522
17559
  this.virtualSelectAll = false;
17523
17560
  if (!isNullOrUndefined(this.viewPortInfo.startIndex) && !isNullOrUndefined(this.viewPortInfo.endIndex)) {
17524
17561
  this.notify('setCurrentViewDataAsync', {
@@ -18029,6 +18066,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18029
18066
  this.onLoadSelect();
18030
18067
  if (this.enableVirtualization) {
18031
18068
  this.setProperties({ text: '' }, true);
18069
+ this.selectedListData = [];
18032
18070
  this.checkInitialValue();
18033
18071
  }
18034
18072
  }