@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.
@@ -5530,7 +5530,7 @@ let DropDownList = class DropDownList extends DropDownBase {
5530
5530
  });
5531
5531
  return checkField;
5532
5532
  }
5533
- checkAndFetchItemData(list, value, checkField) {
5533
+ checkAndFetchItemData(list, value, checkField, isOffline = false) {
5534
5534
  const fieldValue = this.fields.value.split('.');
5535
5535
  let checkVal = list.some((x) => isNullOrUndefined(x[checkField]) && fieldValue.length > 1 ?
5536
5536
  this.checkFieldValue(x, fieldValue) === value : x[checkField] === value);
@@ -5539,27 +5539,66 @@ let DropDownList = class DropDownList extends DropDownBase {
5539
5539
  this.checkFieldValue(x, fieldValue) === value : x[checkField] === value);
5540
5540
  }
5541
5541
  if (!checkVal && this.dataSource instanceof DataManager) {
5542
- (this.dataSource).executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
5543
- .then((e) => {
5544
- if (e.result.length > 0) {
5545
- if (!this.enableVirtualization) {
5546
- this.addItem(e.result, list.length);
5542
+ if (isOffline) {
5543
+ this.searchOfflineData(value, checkField);
5544
+ }
5545
+ else {
5546
+ (this.dataSource).executeQuery(this.getQuery(this.query).where(new Predicate(checkField, 'equal', value)))
5547
+ .then((e) => {
5548
+ if (e.result.length > 0) {
5549
+ if (!this.enableVirtualization) {
5550
+ this.addItem(e.result, list.length);
5551
+ }
5552
+ else {
5553
+ this.itemData = e.result[0];
5554
+ const dataItem = this.getItemData();
5555
+ if ((this.value === dataItem.value && this.text !== dataItem.text) ||
5556
+ (this.value !== dataItem.value && this.text === dataItem.text)) {
5557
+ this.setProperties({ text: dataItem.text.toString() });
5558
+ Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
5559
+ }
5560
+ }
5561
+ this.updateValues();
5547
5562
  }
5548
5563
  else {
5549
- this.itemData = e.result[0];
5550
- const dataItem = this.getItemData();
5551
- if ((this.value === dataItem.value && this.text !== dataItem.text) ||
5552
- (this.value !== dataItem.value && this.text === dataItem.text)) {
5553
- this.setProperties({ text: dataItem.text.toString() });
5554
- Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
5555
- }
5564
+ this.updateValues();
5556
5565
  }
5557
- this.updateValues();
5558
- }
5559
- else {
5560
- this.updateValues();
5566
+ });
5567
+ }
5568
+ }
5569
+ else {
5570
+ this.updateValues();
5571
+ }
5572
+ }
5573
+ searchOfflineData(value, checkField) {
5574
+ if (!(this.dataSource instanceof DataManager)) {
5575
+ this.updateValues();
5576
+ return;
5577
+ }
5578
+ const dataManager = this.dataSource;
5579
+ const fullData = dataManager.dataSource.json || [];
5580
+ if (fullData && fullData.length > 0) {
5581
+ const foundItem = fullData.find((item) => {
5582
+ if (this.fields.value && this.fields.value.includes('.')) {
5583
+ const fieldValueArray = this.fields.value.split('.');
5584
+ const fieldVal = this.checkFieldValue(item, fieldValueArray);
5585
+ return fieldVal === value;
5561
5586
  }
5587
+ return item[checkField] === value;
5562
5588
  });
5589
+ if (foundItem) {
5590
+ this.itemData = foundItem;
5591
+ const dataItem = this.getItemData();
5592
+ if ((this.value === dataItem.value && this.text !== dataItem.text) ||
5593
+ (this.value !== dataItem.value && this.text === dataItem.text)) {
5594
+ this.setProperties({ text: dataItem.text.toString() });
5595
+ Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
5596
+ }
5597
+ this.updateValues();
5598
+ }
5599
+ else {
5600
+ this.updateValues();
5601
+ }
5563
5602
  }
5564
5603
  else {
5565
5604
  this.updateValues();
@@ -6991,10 +7030,12 @@ let DropDownList = class DropDownList extends DropDownBase {
6991
7030
  }
6992
7031
  if (this.enableVirtualization) {
6993
7032
  if (newProp.value && this.dataSource instanceof DataManager) {
7033
+ const isOfflineMode = this.dataSource instanceof DataManager &&
7034
+ this.dataSource.dataSource.offline === true;
6994
7035
  const checkField = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
6995
7036
  const value = this.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
6996
7037
  getValue(checkField, newProp.value) : newProp.value;
6997
- this.checkAndFetchItemData(this.listData, value, checkField);
7038
+ this.checkAndFetchItemData(this.listData, value, checkField, isOfflineMode);
6998
7039
  }
6999
7040
  this.updateValues();
7000
7041
  this.updateInputFields();
@@ -15334,7 +15375,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15334
15375
  }
15335
15376
  }
15336
15377
  else {
15337
- this.onActionComplete(list, this.mainData);
15378
+ const listUl = this.list && this.list.querySelector('ul');
15379
+ const isFullList = this.isReact && this.itemTemplate && listUl != null &&
15380
+ listUl.querySelectorAll('.e-list-item').length === this.mainData.length;
15381
+ this.onActionComplete(isFullList ? listUl : list, this.mainData);
15338
15382
  }
15339
15383
  this.focusAtLastListItem(data);
15340
15384
  if (this.value && this.value.length) {
@@ -15565,9 +15609,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15565
15609
  addClass([element], CHIP_SELECTED);
15566
15610
  if (element) {
15567
15611
  element.setAttribute('id', this.element.id + '_chip_item');
15568
- if (!isNullOrUndefined(this.inputElement) && element.id && !this.inputElement.hasAttribute('aria-activedescendant')) {
15612
+ if (!isNullOrUndefined(this.inputElement) && element.id) {
15569
15613
  this.inputElement.setAttribute('aria-activedescendant', element.id);
15570
15614
  }
15615
+ const chipClose = element.querySelector('span.' + CHIP_CLOSE$1.split(' ')[0]);
15616
+ if (chipClose) {
15617
+ chipClose.removeAttribute('aria-hidden');
15618
+ }
15571
15619
  }
15572
15620
  this.trigger('chipSelection', e);
15573
15621
  }
@@ -15962,6 +16010,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15962
16010
  dispatchSelect(value, eve, element, isNotTrigger, length, dataValue, text) {
15963
16011
  const list = this.listData;
15964
16012
  if (this.initStatus && !isNotTrigger && (!this.allowObjectBinding || (this.allowObjectBinding && value))) {
16013
+ let selectAllArgsLocal = null;
15965
16014
  value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
15966
16015
  const val = dataValue ? dataValue : this.getDataByValue(value);
15967
16016
  const eventArgs = {
@@ -15978,15 +16027,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15978
16027
  this.selectAllEventEle.push(element);
15979
16028
  }
15980
16029
  if (length === 1) {
15981
- const args = {
16030
+ selectAllArgsLocal = {
15982
16031
  event: eve,
15983
16032
  items: this.selectAllEventEle,
15984
16033
  itemData: this.selectAllEventData,
15985
16034
  isInteracted: eve ? true : false,
15986
16035
  isChecked: true
15987
16036
  };
15988
- this.trigger('selectedAll', args);
15989
- this.selectAllEventData = [];
15990
16037
  }
15991
16038
  if (this.allowCustomValue && this.isServerRendered && this.listData !== list) {
15992
16039
  this.listData = list;
@@ -16023,6 +16070,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16023
16070
  if (this.hideSelectedItem && this.fixedHeaderElement && this.fields.groupBy && this.mode !== 'CheckBox') {
16024
16071
  super.scrollStop();
16025
16072
  }
16073
+ if (selectAllArgsLocal) {
16074
+ this.trigger('selectedAll', selectAllArgsLocal);
16075
+ this.selectAllEventData = [];
16076
+ }
16026
16077
  }
16027
16078
  });
16028
16079
  }
@@ -16035,12 +16086,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16035
16086
  removeChipFocus() {
16036
16087
  const elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1 + '.' + CHIP_SELECTED);
16037
16088
  removeClass(elements, CHIP_SELECTED);
16089
+ const closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16038
16090
  if (Browser.isDevice) {
16039
- const closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
16040
16091
  for (let index = 0; index < closeElements.length; index++) {
16092
+ closeElements[index].setAttribute('aria-hidden', 'true');
16041
16093
  closeElements[index].style.display = 'none';
16042
16094
  }
16043
16095
  }
16096
+ else {
16097
+ for (let index = 0; index < closeElements.length; index++) {
16098
+ closeElements[index].setAttribute('aria-hidden', 'true');
16099
+ }
16100
+ }
16044
16101
  }
16045
16102
  onMobileChipInteraction(e) {
16046
16103
  const chipElem = closest(e.target, '.' + CHIP$1);
@@ -16080,7 +16137,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16080
16137
  });
16081
16138
  let compiledString;
16082
16139
  const chipContent = this.createElement('span', { className: CHIP_CONTENT$1 });
16083
- const chipClose = this.createElement('span', { className: CHIP_CLOSE$1 });
16140
+ const chipClose = this.createElement('span', { className: CHIP_CLOSE$1, attrs: { 'aria-label': 'delete', 'aria-hidden': 'true', 'tabindex': '-1' } });
16084
16141
  if (this.mainData) {
16085
16142
  itemData = this.getDataByValue(value);
16086
16143
  }
@@ -17423,6 +17480,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17423
17480
  }
17424
17481
  else {
17425
17482
  e.preventDefault();
17483
+ if (this.value.length === this.listData.length && this.isPopupOpen()) {
17484
+ this.hidePopup(e);
17485
+ }
17426
17486
  }
17427
17487
  const isFilterData = this.targetElement().trim() !== '' ? true : false;
17428
17488
  this.makeTextBoxEmpty();
@@ -19057,7 +19117,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
19057
19117
  }
19058
19118
  else {
19059
19119
  this.chipCollectionWrapper = this.createElement('span', {
19060
- className: CHIP_WRAPPER$1
19120
+ className: CHIP_WRAPPER$1, attrs: { role: 'listbox' }
19061
19121
  });
19062
19122
  this.chipCollectionWrapper.style.display = 'none';
19063
19123
  if (this.mode === 'Default') {