@syncfusion/ej2-dropdowns 32.2.7 → 32.2.9

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.
@@ -416,7 +416,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
416
416
  if (this.component === 'combobox') {
417
417
  var totalData = 0;
418
418
  if (this.parent.dataSource instanceof DataManager) {
419
- totalData = this.parent.remoteDataCount;
419
+ totalData = this.parent.dataSource.dataSource.json.length;
420
420
  }
421
421
  else if (this.parent.dataSource && this.parent.dataSource.length > 0) {
422
422
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5647,8 +5647,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5647
5647
  });
5648
5648
  return checkField;
5649
5649
  };
5650
- DropDownList.prototype.checkAndFetchItemData = function (list, value, checkField) {
5650
+ DropDownList.prototype.checkAndFetchItemData = function (list, value, checkField, isOffline) {
5651
5651
  var _this = this;
5652
+ if (isOffline === void 0) { isOffline = false; }
5652
5653
  var fieldValue = this.fields.value.split('.');
5653
5654
  var checkVal = list.some(function (x) {
5654
5655
  return isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
@@ -5661,27 +5662,67 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5661
5662
  });
5662
5663
  }
5663
5664
  if (!checkVal && this.dataSource instanceof DataManager) {
5664
- (this.dataSource).executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
5665
- .then(function (e) {
5666
- if (e.result.length > 0) {
5667
- if (!_this.enableVirtualization) {
5668
- _this.addItem(e.result, list.length);
5665
+ if (isOffline) {
5666
+ this.searchOfflineData(value, checkField);
5667
+ }
5668
+ else {
5669
+ (this.dataSource).executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
5670
+ .then(function (e) {
5671
+ if (e.result.length > 0) {
5672
+ if (!_this.enableVirtualization) {
5673
+ _this.addItem(e.result, list.length);
5674
+ }
5675
+ else {
5676
+ _this.itemData = e.result[0];
5677
+ var dataItem = _this.getItemData();
5678
+ if ((_this.value === dataItem.value && _this.text !== dataItem.text) ||
5679
+ (_this.value !== dataItem.value && _this.text === dataItem.text)) {
5680
+ _this.setProperties({ text: dataItem.text.toString() });
5681
+ Input.setValue(_this.text, _this.inputElement, _this.floatLabelType, _this.showClearButton);
5682
+ }
5683
+ }
5684
+ _this.updateValues();
5669
5685
  }
5670
5686
  else {
5671
- _this.itemData = e.result[0];
5672
- var dataItem = _this.getItemData();
5673
- if ((_this.value === dataItem.value && _this.text !== dataItem.text) ||
5674
- (_this.value !== dataItem.value && _this.text === dataItem.text)) {
5675
- _this.setProperties({ text: dataItem.text.toString() });
5676
- Input.setValue(_this.text, _this.inputElement, _this.floatLabelType, _this.showClearButton);
5677
- }
5687
+ _this.updateValues();
5678
5688
  }
5679
- _this.updateValues();
5680
- }
5681
- else {
5682
- _this.updateValues();
5689
+ });
5690
+ }
5691
+ }
5692
+ else {
5693
+ this.updateValues();
5694
+ }
5695
+ };
5696
+ DropDownList.prototype.searchOfflineData = function (value, checkField) {
5697
+ var _this = this;
5698
+ if (!(this.dataSource instanceof DataManager)) {
5699
+ this.updateValues();
5700
+ return;
5701
+ }
5702
+ var dataManager = this.dataSource;
5703
+ var fullData = dataManager.dataSource.json || [];
5704
+ if (fullData && fullData.length > 0) {
5705
+ var foundItem = fullData.find(function (item) {
5706
+ if (_this.fields.value && _this.fields.value.includes('.')) {
5707
+ var fieldValueArray = _this.fields.value.split('.');
5708
+ var fieldVal = _this.checkFieldValue(item, fieldValueArray);
5709
+ return fieldVal === value;
5683
5710
  }
5711
+ return item[checkField] === value;
5684
5712
  });
5713
+ if (foundItem) {
5714
+ this.itemData = foundItem;
5715
+ var dataItem = this.getItemData();
5716
+ if ((this.value === dataItem.value && this.text !== dataItem.text) ||
5717
+ (this.value !== dataItem.value && this.text === dataItem.text)) {
5718
+ this.setProperties({ text: dataItem.text.toString() });
5719
+ Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
5720
+ }
5721
+ this.updateValues();
5722
+ }
5723
+ else {
5724
+ this.updateValues();
5725
+ }
5685
5726
  }
5686
5727
  else {
5687
5728
  this.updateValues();
@@ -5804,7 +5845,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5804
5845
  _this.setFooterTemplate(popupEle_1);
5805
5846
  _this.isUpdateFooterHeight = _this.footer.offsetHeight !== 0;
5806
5847
  }
5807
- document.body.appendChild(popupEle_1);
5848
+ var appendToElement = _this.getAppendToElement();
5849
+ appendToElement.appendChild(popupEle_1);
5808
5850
  popupEle_1.style.top = '0px';
5809
5851
  initialPopupHeight = popupEle_1.clientHeight;
5810
5852
  if (_this.enableVirtualization && (_this.itemTemplate || _this.isAngular)) {
@@ -6066,6 +6108,16 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6066
6108
  }
6067
6109
  });
6068
6110
  };
6111
+ DropDownList.prototype.getAppendToElement = function () {
6112
+ if (this.isAngular) {
6113
+ var cdkPane = this.element && this.element.closest ? this.element.closest('.cdk-overlay-pane') : null;
6114
+ var popoverEl = this.element && this.element.closest ? this.element.closest('[popover]') : null;
6115
+ if (cdkPane && popoverEl) {
6116
+ return cdkPane;
6117
+ }
6118
+ }
6119
+ return document.body;
6120
+ };
6069
6121
  DropDownList.prototype.checkCollision = function (popupEle) {
6070
6122
  if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'dropdownlist' || this.isDropDownClick))) {
6071
6123
  var collision = isCollide(popupEle);
@@ -6838,7 +6890,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6838
6890
  var listParentHeight = formatUnit(this.popupHeight);
6839
6891
  listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
6840
6892
  listParent.appendChild(item);
6841
- document.body.appendChild(listParent);
6893
+ var appendToElement = this.getAppendToElement();
6894
+ appendToElement.appendChild(listParent);
6842
6895
  this.virtualListHeight = listParent.getBoundingClientRect().height;
6843
6896
  var listItemHeight = Math.ceil(item.getBoundingClientRect().height) +
6844
6897
  parseInt(window.getComputedStyle(item).marginBottom, 10);
@@ -7113,10 +7166,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7113
7166
  }
7114
7167
  if (this_1.enableVirtualization) {
7115
7168
  if (newProp.value && this_1.dataSource instanceof DataManager) {
7169
+ var isOfflineMode = this_1.dataSource instanceof DataManager &&
7170
+ this_1.dataSource.dataSource.offline === true;
7116
7171
  var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
7117
7172
  var value = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
7118
7173
  getValue(checkField, newProp.value) : newProp.value;
7119
- this_1.checkAndFetchItemData(this_1.listData, value, checkField);
7174
+ this_1.checkAndFetchItemData(this_1.listData, value, checkField, isOfflineMode);
7120
7175
  }
7121
7176
  this_1.updateValues();
7122
7177
  this_1.updateInputFields();
@@ -15584,7 +15639,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15584
15639
  }
15585
15640
  }
15586
15641
  else {
15587
- this.onActionComplete(list, this.mainData);
15642
+ var listUl = this.list && this.list.querySelector('ul');
15643
+ var isFullList = this.isReact && this.itemTemplate && listUl != null &&
15644
+ listUl.querySelectorAll('.e-list-item').length === this.mainData.length;
15645
+ this.onActionComplete(isFullList ? listUl : list, this.mainData);
15588
15646
  }
15589
15647
  this.focusAtLastListItem(data);
15590
15648
  if (this.value && this.value.length) {
@@ -15816,9 +15874,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15816
15874
  addClass([element], CHIP_SELECTED);
15817
15875
  if (element) {
15818
15876
  element.setAttribute('id', this.element.id + '_chip_item');
15819
- if (!isNullOrUndefined(this.inputElement) && element.id && !this.inputElement.hasAttribute('aria-activedescendant')) {
15877
+ if (!isNullOrUndefined(this.inputElement) && element.id) {
15820
15878
  this.inputElement.setAttribute('aria-activedescendant', element.id);
15821
15879
  }
15880
+ var chipClose = element.querySelector('span.' + CHIP_CLOSE$1.split(' ')[0]);
15881
+ if (chipClose) {
15882
+ chipClose.removeAttribute('aria-hidden');
15883
+ }
15822
15884
  }
15823
15885
  this.trigger('chipSelection', e);
15824
15886
  };
@@ -16222,6 +16284,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16222
16284
  var _this = this;
16223
16285
  var list = this.listData;
16224
16286
  if (this.initStatus && !isNotTrigger && (!this.allowObjectBinding || (this.allowObjectBinding && value))) {
16287
+ var selectAllArgsLocal_1 = null;
16225
16288
  value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
16226
16289
  var val_2 = dataValue ? dataValue : this.getDataByValue(value);
16227
16290
  var eventArgs = {
@@ -16238,15 +16301,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16238
16301
  _this.selectAllEventEle.push(element);
16239
16302
  }
16240
16303
  if (length === 1) {
16241
- var args = {
16304
+ selectAllArgsLocal_1 = {
16242
16305
  event: eve,
16243
16306
  items: _this.selectAllEventEle,
16244
16307
  itemData: _this.selectAllEventData,
16245
16308
  isInteracted: eve ? true : false,
16246
16309
  isChecked: true
16247
16310
  };
16248
- _this.trigger('selectedAll', args);
16249
- _this.selectAllEventData = [];
16250
16311
  }
16251
16312
  if (_this.allowCustomValue && _this.isServerRendered && _this.listData !== list) {
16252
16313
  _this.listData = list;
@@ -16283,6 +16344,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16283
16344
  if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox') {
16284
16345
  _super.prototype.scrollStop.call(_this);
16285
16346
  }
16347
+ if (selectAllArgsLocal_1) {
16348
+ _this.trigger('selectedAll', selectAllArgsLocal_1);
16349
+ _this.selectAllEventData = [];
16350
+ }
16286
16351
  }
16287
16352
  });
16288
16353
  }
@@ -16295,12 +16360,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16295
16360
  MultiSelect.prototype.removeChipFocus = function () {
16296
16361
  var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1 + '.' + CHIP_SELECTED);
16297
16362
  removeClass(elements, CHIP_SELECTED);
16363
+ var closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16298
16364
  if (Browser.isDevice) {
16299
- var closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16300
16365
  for (var index = 0; index < closeElements.length; index++) {
16366
+ closeElements[index].setAttribute('aria-hidden', 'true');
16301
16367
  closeElements[index].style.display = 'none';
16302
16368
  }
16303
16369
  }
16370
+ else {
16371
+ for (var index = 0; index < closeElements.length; index++) {
16372
+ closeElements[index].setAttribute('aria-hidden', 'true');
16373
+ }
16374
+ }
16304
16375
  };
16305
16376
  MultiSelect.prototype.onMobileChipInteraction = function (e) {
16306
16377
  var chipElem = closest(e.target, '.' + CHIP$1);
@@ -16341,7 +16412,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16341
16412
  });
16342
16413
  var compiledString;
16343
16414
  var chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
16344
- var chipClose = this.createElement('span', { className: CHIP_CLOSE$1 });
16415
+ var chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-label': 'delete', 'aria-hidden': 'true', 'tabindex': '-1' } });
16345
16416
  if (this.mainData) {
16346
16417
  itemData = this.getDataByValue(value);
16347
16418
  }
@@ -17698,6 +17769,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17698
17769
  }
17699
17770
  else {
17700
17771
  e.preventDefault();
17772
+ if (this.value.length === this.listData.length && this.isPopupOpen()) {
17773
+ this.hidePopup(e);
17774
+ }
17701
17775
  }
17702
17776
  var isFilterData = this.targetElement().trim() !== '' ? true : false;
17703
17777
  this.makeTextBoxEmpty();
@@ -19343,7 +19417,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19343
19417
  }
19344
19418
  else {
19345
19419
  this.chipCollectionWrapper = this.createElement('span', {
19346
- className: CHIP_WRAPPER$1
19420
+ className: CHIP_WRAPPER$1, attrs: { role: 'listbox' }
19347
19421
  });
19348
19422
  this.chipCollectionWrapper.style.display = 'none';
19349
19423
  if (this.mode === 'Default') {