@syncfusion/ej2-dropdowns 32.2.8 → 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.
@@ -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();
@@ -7125,10 +7166,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7125
7166
  }
7126
7167
  if (this_1.enableVirtualization) {
7127
7168
  if (newProp.value && this_1.dataSource instanceof DataManager) {
7169
+ var isOfflineMode = this_1.dataSource instanceof DataManager &&
7170
+ this_1.dataSource.dataSource.offline === true;
7128
7171
  var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
7129
7172
  var value = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
7130
7173
  getValue(checkField, newProp.value) : newProp.value;
7131
- this_1.checkAndFetchItemData(this_1.listData, value, checkField);
7174
+ this_1.checkAndFetchItemData(this_1.listData, value, checkField, isOfflineMode);
7132
7175
  }
7133
7176
  this_1.updateValues();
7134
7177
  this_1.updateInputFields();
@@ -15596,7 +15639,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15596
15639
  }
15597
15640
  }
15598
15641
  else {
15599
- 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);
15600
15646
  }
15601
15647
  this.focusAtLastListItem(data);
15602
15648
  if (this.value && this.value.length) {
@@ -15828,9 +15874,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15828
15874
  addClass([element], CHIP_SELECTED);
15829
15875
  if (element) {
15830
15876
  element.setAttribute('id', this.element.id + '_chip_item');
15831
- if (!isNullOrUndefined(this.inputElement) && element.id && !this.inputElement.hasAttribute('aria-activedescendant')) {
15877
+ if (!isNullOrUndefined(this.inputElement) && element.id) {
15832
15878
  this.inputElement.setAttribute('aria-activedescendant', element.id);
15833
15879
  }
15880
+ var chipClose = element.querySelector('span.' + CHIP_CLOSE$1.split(' ')[0]);
15881
+ if (chipClose) {
15882
+ chipClose.removeAttribute('aria-hidden');
15883
+ }
15834
15884
  }
15835
15885
  this.trigger('chipSelection', e);
15836
15886
  };
@@ -16234,6 +16284,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16234
16284
  var _this = this;
16235
16285
  var list = this.listData;
16236
16286
  if (this.initStatus && !isNotTrigger && (!this.allowObjectBinding || (this.allowObjectBinding && value))) {
16287
+ var selectAllArgsLocal_1 = null;
16237
16288
  value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
16238
16289
  var val_2 = dataValue ? dataValue : this.getDataByValue(value);
16239
16290
  var eventArgs = {
@@ -16250,15 +16301,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16250
16301
  _this.selectAllEventEle.push(element);
16251
16302
  }
16252
16303
  if (length === 1) {
16253
- var args = {
16304
+ selectAllArgsLocal_1 = {
16254
16305
  event: eve,
16255
16306
  items: _this.selectAllEventEle,
16256
16307
  itemData: _this.selectAllEventData,
16257
16308
  isInteracted: eve ? true : false,
16258
16309
  isChecked: true
16259
16310
  };
16260
- _this.trigger('selectedAll', args);
16261
- _this.selectAllEventData = [];
16262
16311
  }
16263
16312
  if (_this.allowCustomValue && _this.isServerRendered && _this.listData !== list) {
16264
16313
  _this.listData = list;
@@ -16295,6 +16344,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16295
16344
  if (_this.hideSelectedItem && _this.fixedHeaderElement && _this.fields.groupBy && _this.mode !== 'CheckBox') {
16296
16345
  _super.prototype.scrollStop.call(_this);
16297
16346
  }
16347
+ if (selectAllArgsLocal_1) {
16348
+ _this.trigger('selectedAll', selectAllArgsLocal_1);
16349
+ _this.selectAllEventData = [];
16350
+ }
16298
16351
  }
16299
16352
  });
16300
16353
  }
@@ -16307,12 +16360,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16307
16360
  MultiSelect.prototype.removeChipFocus = function () {
16308
16361
  var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1 + '.' + CHIP_SELECTED);
16309
16362
  removeClass(elements, CHIP_SELECTED);
16363
+ var closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16310
16364
  if (Browser.isDevice) {
16311
- var closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16312
16365
  for (var index = 0; index < closeElements.length; index++) {
16366
+ closeElements[index].setAttribute('aria-hidden', 'true');
16313
16367
  closeElements[index].style.display = 'none';
16314
16368
  }
16315
16369
  }
16370
+ else {
16371
+ for (var index = 0; index < closeElements.length; index++) {
16372
+ closeElements[index].setAttribute('aria-hidden', 'true');
16373
+ }
16374
+ }
16316
16375
  };
16317
16376
  MultiSelect.prototype.onMobileChipInteraction = function (e) {
16318
16377
  var chipElem = closest(e.target, '.' + CHIP$1);
@@ -16353,7 +16412,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16353
16412
  });
16354
16413
  var compiledString;
16355
16414
  var chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
16356
- 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' } });
16357
16416
  if (this.mainData) {
16358
16417
  itemData = this.getDataByValue(value);
16359
16418
  }
@@ -17710,6 +17769,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17710
17769
  }
17711
17770
  else {
17712
17771
  e.preventDefault();
17772
+ if (this.value.length === this.listData.length && this.isPopupOpen()) {
17773
+ this.hidePopup(e);
17774
+ }
17713
17775
  }
17714
17776
  var isFilterData = this.targetElement().trim() !== '' ? true : false;
17715
17777
  this.makeTextBoxEmpty();
@@ -19355,7 +19417,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19355
19417
  }
19356
19418
  else {
19357
19419
  this.chipCollectionWrapper = this.createElement('span', {
19358
- className: CHIP_WRAPPER$1
19420
+ className: CHIP_WRAPPER$1, attrs: { role: 'listbox' }
19359
19421
  });
19360
19422
  this.chipCollectionWrapper.style.display = 'none';
19361
19423
  if (this.mode === 'Default') {