@syncfusion/ej2-dropdowns 20.1.51 → 20.1.52

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.
@@ -92,7 +92,7 @@ function Search(inputVal, items, searchType, ignoreCase) {
92
92
  for (var i = 0, itemsData = listItems; i < itemsData.length; i++) {
93
93
  var item = itemsData[i];
94
94
  var text = (ignoreCase ? item.textContent.toLocaleLowerCase() : item.textContent).replace(/^\s+|\s+$/g, '');
95
- if ((searchType === 'Equal' && text === queryStr) || (searchType === 'StartsWith' && text.substr(0, strLength) === queryStr) || (searchType === 'EndsWith' && text.substr(text.length - queryStr.length) === queryStr) || (searchType === 'Contains' && new RegExp(queryStr, "g").test(text))) {
95
+ if ((searchType === 'Equal' && text === queryStr) || (searchType === 'StartsWith' && text.substr(0, strLength) === queryStr) || (searchType === 'EndsWith' && text.substr(text.length - queryStr.length) === queryStr) || (searchType === 'Contains' && new RegExp(queryStr, 'g').test(text))) {
96
96
  itemData.item = item;
97
97
  itemData.index = i;
98
98
  return { item: item, index: i };
@@ -330,7 +330,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
330
330
  compareValue_1 = value;
331
331
  dataSource.filter(function (item) {
332
332
  var itemValue = getValue(fields.value, item);
333
- if (!isNullOrUndefined(itemValue) && !isNullOrUndefined(value) && itemValue.toString() === compareValue_1.toString()) {
333
+ if (!isNullOrUndefined(itemValue) && !isNullOrUndefined(value)
334
+ && itemValue.toString() === compareValue_1.toString()) {
334
335
  value = getValue(fields.text, item);
335
336
  }
336
337
  });
@@ -756,7 +757,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
756
757
  if (this.getModuleName() === 'multiselect' && this.properties.allowCustomValue && this.fields.groupBy) {
757
758
  for (var i = 0; i < ulElement.childElementCount; i++) {
758
759
  if (ulElement.children[i].classList.contains('e-list-group-item')) {
759
- if (isNullOrUndefined(ulElement.children[i].innerHTML) || ulElement.children[i].innerHTML == "") {
760
+ if (isNullOrUndefined(ulElement.children[i].innerHTML) || ulElement.children[i].innerHTML === '') {
760
761
  addClass([ulElement.children[i]], HIDE_GROUPLIST);
761
762
  }
762
763
  }
@@ -1243,7 +1244,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1243
1244
  }
1244
1245
  if (this.itemTemplate && !isHeader) {
1245
1246
  var itemCheck = this.templateCompiler(this.itemTemplate);
1246
- var compiledString = itemCheck ? compile(select(this.itemTemplate, document).innerHTML.trim()) : compile(this.itemTemplate);
1247
+ var compiledString = itemCheck ?
1248
+ compile(select(this.itemTemplate, document).innerHTML.trim()) : compile(this.itemTemplate);
1247
1249
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1248
1250
  var addItemTemplate = compiledString(item, this, 'itemTemplate', this.itemTemplateId, this.isStringTemplate, null, li);
1249
1251
  if (addItemTemplate) {
@@ -3959,7 +3961,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3959
3961
  if (!this.enabled) {
3960
3962
  return;
3961
3963
  }
3962
- if (this.isFiltering() && this.dataSource instanceof DataManager && (this.actionData.list != this.actionCompleteData.list) &&
3964
+ if (this.isFiltering() && this.dataSource instanceof DataManager && (this.actionData.list !== this.actionCompleteData.list) &&
3963
3965
  this.actionData.list && this.actionData.ulElement) {
3964
3966
  this.actionCompleteData = this.actionData;
3965
3967
  this.onActionComplete(this.actionCompleteData.ulElement, this.actionCompleteData.list, null, true);
@@ -6501,7 +6503,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6501
6503
  addClass([this.inputWrapper], SHOW_CHIP);
6502
6504
  }
6503
6505
  var chip = this.createElement('span', {
6504
- className: CHIP,
6506
+ className: CHIP
6505
6507
  });
6506
6508
  if (!this.inputEle.classList.contains(CHIP_INPUT)) {
6507
6509
  addClass([this.inputEle], CHIP_INPUT);
@@ -6637,7 +6639,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6637
6639
  this.ensurePlaceHolder();
6638
6640
  };
6639
6641
  DropDownTree.prototype.resetValue = function (isDynamicChange) {
6640
- if (this.value == [] && this.text == null) {
6642
+ if (this.value === [] && this.text === null) {
6641
6643
  return;
6642
6644
  }
6643
6645
  Input.setValue(null, this.inputEle, this.floatLabelType);
@@ -7019,10 +7021,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7019
7021
  this.updateTreeSettings(newProp);
7020
7022
  break;
7021
7023
  case 'customTemplate':
7022
- if (this.mode !== "Custom") {
7024
+ if (this.mode !== 'Custom') {
7023
7025
  return;
7024
7026
  }
7025
- this.chipCollection.innerHTML = "";
7027
+ this.chipCollection.innerHTML = '';
7026
7028
  this.setTagValues();
7027
7029
  break;
7028
7030
  case 'sortOrder':
@@ -7239,7 +7241,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7239
7241
  Property('')
7240
7242
  ], DropDownTree.prototype, "cssClass", void 0);
7241
7243
  __decorate$2([
7242
- Property("${value.length} item(s) selected")
7244
+ Property('${value.length} item(s) selected')
7243
7245
  ], DropDownTree.prototype, "customTemplate", void 0);
7244
7246
  __decorate$2([
7245
7247
  Property(',')
@@ -7717,7 +7719,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7717
7719
  }
7718
7720
  }
7719
7721
  if (!this.isAndroidAutoFill(currentValue)) {
7720
- this.setAutoFillSelection(currentValue);
7722
+ this.setAutoFillSelection(currentValue, isHover);
7721
7723
  }
7722
7724
  }
7723
7725
  };
@@ -7785,7 +7787,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7785
7787
  e.preventDefault();
7786
7788
  }
7787
7789
  };
7788
- ComboBox.prototype.setAutoFillSelection = function (currentValue) {
7790
+ ComboBox.prototype.setAutoFillSelection = function (currentValue, isKeyNavigate) {
7791
+ if (isKeyNavigate === void 0) { isKeyNavigate = false; }
7789
7792
  var selection = this.getSelectionPoints();
7790
7793
  var value = this.inputElement.value.substr(0, selection.start);
7791
7794
  if (value && (value.toLowerCase() === currentValue.substr(0, selection.start).toLowerCase())) {
@@ -7793,7 +7796,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7793
7796
  Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
7794
7797
  this.inputElement.setSelectionRange(selection.start, this.inputElement.value.length);
7795
7798
  }
7796
- else {
7799
+ else if (isKeyNavigate) {
7797
7800
  Input.setValue(currentValue, this.inputElement, this.floatLabelType, this.showClearButton);
7798
7801
  this.inputElement.setSelectionRange(0, this.inputElement.value.length);
7799
7802
  }
@@ -8429,7 +8432,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
8429
8432
  this.setScrollPosition(e);
8430
8433
  if (this.autofill && this.isPopupOpen) {
8431
8434
  this.preventAutoFill = false;
8432
- _super.prototype.setAutoFill.call(this, li);
8435
+ var isKeyNavigate = (e && e.action === 'down' || e.action === 'up' ||
8436
+ e.action === 'home' || e.action === 'end' || e.action === 'pageUp' || e.action === 'pageDown');
8437
+ _super.prototype.setAutoFill.call(this, li, isKeyNavigate);
8433
8438
  }
8434
8439
  attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
8435
8440
  }
@@ -9440,7 +9445,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9440
9445
  var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
9441
9446
  if (this.backCommand) {
9442
9447
  this.remoteCustomValue = false;
9443
- if (this.allowCustomValue && list.querySelectorAll('li').length == 0 && this.mainData.length > 0) {
9448
+ if (this.allowCustomValue && list.querySelectorAll('li').length === 0 && this.mainData.length > 0) {
9444
9449
  this.mainData = [];
9445
9450
  }
9446
9451
  this.onActionComplete(list, this.mainData);
@@ -9835,7 +9840,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9835
9840
  var filterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
9836
9841
  filterInput && filterInput.setAttribute('aria-activedescendant', focusedItem.id);
9837
9842
  }
9838
- else if (this.mode == "CheckBox") {
9843
+ else if (this.mode === 'CheckBox') {
9839
9844
  this.overAllWrapper.setAttribute('aria-activedescendant', focusedItem.id);
9840
9845
  }
9841
9846
  }
@@ -11247,8 +11252,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11247
11252
  MultiSelect.prototype.updateDataList = function () {
11248
11253
  if (this.mainList && this.ulElement) {
11249
11254
  var isDynamicGroupItemUpdate = this.mainList.childElementCount < this.ulElement.childElementCount;
11250
- var isReactTemplateUpdate = ((this.ulElement.childElementCount > 0 && this.ulElement.children[0].childElementCount > 0) && (this.mainList.children[0].childElementCount < this.ulElement.children[0].childElementCount));
11251
- var isAngularTemplateUpdate = this.itemTemplate && this.ulElement.childElementCount > 0 && !(this.ulElement.childElementCount < this.mainList.childElementCount) && (this.ulElement.children[0].childElementCount > 0 || (this.fields.groupBy && this.ulElement.children[1] && this.ulElement.children[1].childElementCount > 0));
11255
+ var isReactTemplateUpdate = ((this.ulElement.childElementCount > 0 &&
11256
+ this.ulElement.children[0].childElementCount > 0) &&
11257
+ (this.mainList.children[0].childElementCount < this.ulElement.children[0].childElementCount));
11258
+ var isAngularTemplateUpdate = this.itemTemplate && this.ulElement.childElementCount > 0
11259
+ && !(this.ulElement.childElementCount < this.mainList.childElementCount)
11260
+ && (this.ulElement.children[0].childElementCount > 0
11261
+ || (this.fields.groupBy && this.ulElement.children[1] && this.ulElement.children[1].childElementCount > 0));
11252
11262
  if (isDynamicGroupItemUpdate || isReactTemplateUpdate || isAngularTemplateUpdate) {
11253
11263
  //EJ2-57748 - for this task, we prevent the ul element cloning ( this.mainList = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
11254
11264
  this.mainList = this.ulElement;
@@ -12320,7 +12330,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12320
12330
  }
12321
12331
  return valuecheck;
12322
12332
  };
12323
-
12324
12333
  MultiSelect.prototype.addNonPresentItems = function (valuecheck, ulElement, list, event) {
12325
12334
  var _this = this;
12326
12335
  this.dataSource.executeQuery(this.getForQuery(valuecheck)).then(function (e) {
@@ -12328,7 +12337,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12328
12337
  _this.updateActionList(ulElement, list, event);
12329
12338
  });
12330
12339
  };
12331
-
12332
12340
  MultiSelect.prototype.updateVal = function (newProp, oldProp, prop) {
12333
12341
  if (!this.list) {
12334
12342
  this.onLoadSelect();
@@ -12341,7 +12349,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12341
12349
  if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
12342
12350
  valuecheck = this.presentItemValue(this.ulElement);
12343
12351
  }
12344
- if (prop == 'value' && valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
12352
+ if (prop === 'value' && valuecheck.length > 0 && this.dataSource instanceof DataManager && !isNullOrUndefined(this.value)
12345
12353
  && this.listData != null) {
12346
12354
  this.mainData = null;
12347
12355
  this.setDynValue = true;
@@ -13875,10 +13883,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
13875
13883
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13876
13884
  var event = args.event;
13877
13885
  var wrapper;
13878
- if (args.target && (args.target.classList.contains("e-listbox-wrapper") || args.target.classList.contains("e-list-item")
13879
- || args.target.classList.contains("e-filter-parent") || args.target.classList.contains("e-input-group"))) {
13880
- if (args.target.classList.contains("e-list-item") || args.target.classList.contains("e-filter-parent")
13881
- || args.target.classList.contains("e-input-group")) {
13886
+ if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
13887
+ || args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
13888
+ if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
13889
+ || args.target.classList.contains('e-input-group')) {
13882
13890
  wrapper = args.target.closest('.e-listbox-wrapper');
13883
13891
  }
13884
13892
  else {
@@ -13933,7 +13941,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
13933
13941
  var getArgs = this.getDragArgs({ target: args.droppedElement }, true);
13934
13942
  var sourceArgs = { previousData: this.dataSource };
13935
13943
  var destArgs = { previousData: listObj.dataSource };
13936
- var dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource }, previousIndex: args.previousIndex, currentIndex: args.currentIndex });
13944
+ var dragArgs = extend({}, getArgs, { target: args.target, source: { previousData: this.dataSource },
13945
+ previousIndex: args.previousIndex, currentIndex: args.currentIndex });
13937
13946
  if (listObj !== this) {
13938
13947
  var sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
13939
13948
  dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
@@ -14064,7 +14073,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14064
14073
  };
14065
14074
  ListBox.prototype.updateListItems = function (sourceElem, destElem) {
14066
14075
  var i = 0;
14067
- destElem.innerHTML = "";
14076
+ destElem.innerHTML = '';
14068
14077
  while (i < sourceElem.childNodes.length) {
14069
14078
  destElem.appendChild(sourceElem.childNodes[i]);
14070
14079
  }
@@ -14253,6 +14262,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14253
14262
  if (this.listData.length === 0) {
14254
14263
  this.l10nUpdate();
14255
14264
  }
14265
+ this.value = null;
14266
+ this.updateToolBarState();
14256
14267
  };
14257
14268
  /**
14258
14269
  * Gets the array of data Object that matches the given array of values.
@@ -14503,7 +14514,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14503
14514
  var filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
14504
14515
  if (this.allowFiltering) {
14505
14516
  var filterType = this.inputString === '' ? 'contains' : this.filterType;
14506
- var dataType = this.typeOfData(this.jsonData).typeof;
14517
+ var dataType = this.typeOfData(this.dataSource).typeof;
14518
+ if (dataType === null) {
14519
+ dataType = this.typeOfData(this.jsonData).typeof;
14520
+ }
14507
14521
  if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
14508
14522
  filterQuery.where('', filterType, this.inputString, this.ignoreCase, this.ignoreAccent);
14509
14523
  }
@@ -15099,7 +15113,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15099
15113
  }
15100
15114
  }
15101
15115
  }
15102
- else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== "KeyA") {
15116
+ else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
15103
15117
  this.upDownKeyHandler(e);
15104
15118
  }
15105
15119
  }
@@ -15143,8 +15157,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15143
15157
  }
15144
15158
  if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
15145
15159
  var selectedidx = Array.prototype.indexOf.call(ul.children, fli);
15146
- var sidx = e.code === "Home" ? 0 : selectedidx;
15147
- var eidx = e.code === "Home" ? selectedidx : ul.children.length - 1;
15160
+ var sidx = e.code === 'Home' ? 0 : selectedidx;
15161
+ var eidx = e.code === 'Home' ? selectedidx : ul.children.length - 1;
15148
15162
  for (var i = sidx; i <= eidx; i++) {
15149
15163
  var item = ul.children[i];
15150
15164
  this.notify('updatelist', { li: item, e: {