@syncfusion/ej2-dropdowns 20.1.50 → 20.1.55

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
  }
@@ -1059,6 +1060,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1059
1060
  dataSource = this.selectData;
1060
1061
  }
1061
1062
  }
1063
+ dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length ? this.selectData : dataSource;
1062
1064
  this.setListData(dataSource, fields, query);
1063
1065
  }
1064
1066
  };
@@ -1242,7 +1244,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1242
1244
  }
1243
1245
  if (this.itemTemplate && !isHeader) {
1244
1246
  var itemCheck = this.templateCompiler(this.itemTemplate);
1245
- 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);
1246
1249
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1247
1250
  var addItemTemplate = compiledString(item, this, 'itemTemplate', this.itemTemplateId, this.isStringTemplate, null, li);
1248
1251
  if (addItemTemplate) {
@@ -3958,7 +3961,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3958
3961
  if (!this.enabled) {
3959
3962
  return;
3960
3963
  }
3961
- 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) &&
3962
3965
  this.actionData.list && this.actionData.ulElement) {
3963
3966
  this.actionCompleteData = this.actionData;
3964
3967
  this.onActionComplete(this.actionCompleteData.ulElement, this.actionCompleteData.list, null, true);
@@ -6500,7 +6503,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6500
6503
  addClass([this.inputWrapper], SHOW_CHIP);
6501
6504
  }
6502
6505
  var chip = this.createElement('span', {
6503
- className: CHIP,
6506
+ className: CHIP
6504
6507
  });
6505
6508
  if (!this.inputEle.classList.contains(CHIP_INPUT)) {
6506
6509
  addClass([this.inputEle], CHIP_INPUT);
@@ -6636,7 +6639,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6636
6639
  this.ensurePlaceHolder();
6637
6640
  };
6638
6641
  DropDownTree.prototype.resetValue = function (isDynamicChange) {
6639
- if (this.value == [] && this.text == null) {
6642
+ if (this.value === [] && this.text === null) {
6640
6643
  return;
6641
6644
  }
6642
6645
  Input.setValue(null, this.inputEle, this.floatLabelType);
@@ -7018,10 +7021,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7018
7021
  this.updateTreeSettings(newProp);
7019
7022
  break;
7020
7023
  case 'customTemplate':
7021
- if (this.mode !== "Custom") {
7024
+ if (this.mode !== 'Custom') {
7022
7025
  return;
7023
7026
  }
7024
- this.chipCollection.innerHTML = "";
7027
+ this.chipCollection.innerHTML = '';
7025
7028
  this.setTagValues();
7026
7029
  break;
7027
7030
  case 'sortOrder':
@@ -7238,7 +7241,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7238
7241
  Property('')
7239
7242
  ], DropDownTree.prototype, "cssClass", void 0);
7240
7243
  __decorate$2([
7241
- Property("${value.length} item(s) selected")
7244
+ Property('${value.length} item(s) selected')
7242
7245
  ], DropDownTree.prototype, "customTemplate", void 0);
7243
7246
  __decorate$2([
7244
7247
  Property(',')
@@ -7716,7 +7719,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7716
7719
  }
7717
7720
  }
7718
7721
  if (!this.isAndroidAutoFill(currentValue)) {
7719
- this.setAutoFillSelection(currentValue);
7722
+ this.setAutoFillSelection(currentValue, isHover);
7720
7723
  }
7721
7724
  }
7722
7725
  };
@@ -7784,7 +7787,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7784
7787
  e.preventDefault();
7785
7788
  }
7786
7789
  };
7787
- ComboBox.prototype.setAutoFillSelection = function (currentValue) {
7790
+ ComboBox.prototype.setAutoFillSelection = function (currentValue, isKeyNavigate) {
7791
+ if (isKeyNavigate === void 0) { isKeyNavigate = false; }
7788
7792
  var selection = this.getSelectionPoints();
7789
7793
  var value = this.inputElement.value.substr(0, selection.start);
7790
7794
  if (value && (value.toLowerCase() === currentValue.substr(0, selection.start).toLowerCase())) {
@@ -7792,7 +7796,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7792
7796
  Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
7793
7797
  this.inputElement.setSelectionRange(selection.start, this.inputElement.value.length);
7794
7798
  }
7795
- else {
7799
+ else if (isKeyNavigate) {
7796
7800
  Input.setValue(currentValue, this.inputElement, this.floatLabelType, this.showClearButton);
7797
7801
  this.inputElement.setSelectionRange(0, this.inputElement.value.length);
7798
7802
  }
@@ -8428,7 +8432,9 @@ var AutoComplete = /** @__PURE__ @class */ (function (_super) {
8428
8432
  this.setScrollPosition(e);
8429
8433
  if (this.autofill && this.isPopupOpen) {
8430
8434
  this.preventAutoFill = false;
8431
- _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);
8432
8438
  }
8433
8439
  attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
8434
8440
  }
@@ -9439,7 +9445,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9439
9445
  var list = this.mainList.cloneNode ? this.mainList.cloneNode(true) : this.mainList;
9440
9446
  if (this.backCommand) {
9441
9447
  this.remoteCustomValue = false;
9442
- 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) {
9443
9449
  this.mainData = [];
9444
9450
  }
9445
9451
  this.onActionComplete(list, this.mainData);
@@ -9834,7 +9840,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9834
9840
  var filterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
9835
9841
  filterInput && filterInput.setAttribute('aria-activedescendant', focusedItem.id);
9836
9842
  }
9837
- else if (this.mode == "CheckBox") {
9843
+ else if (this.mode === 'CheckBox') {
9838
9844
  this.overAllWrapper.setAttribute('aria-activedescendant', focusedItem.id);
9839
9845
  }
9840
9846
  }
@@ -11246,8 +11252,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11246
11252
  MultiSelect.prototype.updateDataList = function () {
11247
11253
  if (this.mainList && this.ulElement) {
11248
11254
  var isDynamicGroupItemUpdate = this.mainList.childElementCount < this.ulElement.childElementCount;
11249
- var isReactTemplateUpdate = ((this.ulElement.childElementCount > 0 && this.ulElement.children[0].childElementCount > 0) && (this.mainList.children[0].childElementCount < this.ulElement.children[0].childElementCount));
11250
- 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));
11251
11262
  if (isDynamicGroupItemUpdate || isReactTemplateUpdate || isAngularTemplateUpdate) {
11252
11263
  //EJ2-57748 - for this task, we prevent the ul element cloning ( this.mainList = this.ulElement.cloneNode ? <HTMLElement>this.ulElement.cloneNode(true) : this.ulElement;)
11253
11264
  this.mainList = this.ulElement;
@@ -12319,7 +12330,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12319
12330
  }
12320
12331
  return valuecheck;
12321
12332
  };
12322
-
12323
12333
  MultiSelect.prototype.addNonPresentItems = function (valuecheck, ulElement, list, event) {
12324
12334
  var _this = this;
12325
12335
  this.dataSource.executeQuery(this.getForQuery(valuecheck)).then(function (e) {
@@ -12327,7 +12337,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12327
12337
  _this.updateActionList(ulElement, list, event);
12328
12338
  });
12329
12339
  };
12330
-
12331
12340
  MultiSelect.prototype.updateVal = function (newProp, oldProp, prop) {
12332
12341
  if (!this.list) {
12333
12342
  this.onLoadSelect();
@@ -12340,7 +12349,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12340
12349
  if (!isNullOrUndefined(this.value) && !this.allowCustomValue) {
12341
12350
  valuecheck = this.presentItemValue(this.ulElement);
12342
12351
  }
12343
- 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)
12344
12353
  && this.listData != null) {
12345
12354
  this.mainData = null;
12346
12355
  this.setDynValue = true;
@@ -13874,10 +13883,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
13874
13883
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13875
13884
  var event = args.event;
13876
13885
  var wrapper;
13877
- if (args.target && (args.target.classList.contains("e-listbox-wrapper") || args.target.classList.contains("e-list-item")
13878
- || args.target.classList.contains("e-filter-parent") || args.target.classList.contains("e-input-group"))) {
13879
- if (args.target.classList.contains("e-list-item") || args.target.classList.contains("e-filter-parent")
13880
- || 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')) {
13881
13890
  wrapper = args.target.closest('.e-listbox-wrapper');
13882
13891
  }
13883
13892
  else {
@@ -13932,7 +13941,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
13932
13941
  var getArgs = this.getDragArgs({ target: args.droppedElement }, true);
13933
13942
  var sourceArgs = { previousData: this.dataSource };
13934
13943
  var destArgs = { previousData: listObj.dataSource };
13935
- 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 });
13936
13946
  if (listObj !== this) {
13937
13947
  var sourceArgs1 = extend(sourceArgs, { currentData: this.listData });
13938
13948
  dragArgs = extend(dragArgs, { source: sourceArgs1, destination: destArgs });
@@ -14063,7 +14073,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14063
14073
  };
14064
14074
  ListBox.prototype.updateListItems = function (sourceElem, destElem) {
14065
14075
  var i = 0;
14066
- destElem.innerHTML = "";
14076
+ destElem.innerHTML = '';
14067
14077
  while (i < sourceElem.childNodes.length) {
14068
14078
  destElem.appendChild(sourceElem.childNodes[i]);
14069
14079
  }
@@ -14252,6 +14262,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14252
14262
  if (this.listData.length === 0) {
14253
14263
  this.l10nUpdate();
14254
14264
  }
14265
+ this.value = null;
14266
+ this.updateToolBarState();
14255
14267
  };
14256
14268
  /**
14257
14269
  * Gets the array of data Object that matches the given array of values.
@@ -14503,6 +14515,9 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14503
14515
  if (this.allowFiltering) {
14504
14516
  var filterType = this.inputString === '' ? 'contains' : this.filterType;
14505
14517
  var dataType = this.typeOfData(this.dataSource).typeof;
14518
+ if (dataType === null) {
14519
+ dataType = this.typeOfData(this.jsonData).typeof;
14520
+ }
14506
14521
  if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
14507
14522
  filterQuery.where('', filterType, this.inputString, this.ignoreCase, this.ignoreAccent);
14508
14523
  }
@@ -15098,7 +15113,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15098
15113
  }
15099
15114
  }
15100
15115
  }
15101
- else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== "KeyA") {
15116
+ else if (e.keyCode !== 37 && e.keyCode !== 39 && e.code !== 'KeyA') {
15102
15117
  this.upDownKeyHandler(e);
15103
15118
  }
15104
15119
  }
@@ -15142,8 +15157,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15142
15157
  }
15143
15158
  if (this.selectionSettings.showCheckbox && e.ctrlKey && e.shiftKey && (e.keyCode === 36 || e.keyCode === 35)) {
15144
15159
  var selectedidx = Array.prototype.indexOf.call(ul.children, fli);
15145
- var sidx = e.code === "Home" ? 0 : selectedidx;
15146
- 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;
15147
15162
  for (var i = sidx; i <= eidx; i++) {
15148
15163
  var item = ul.children[i];
15149
15164
  this.notify('updatelist', { li: item, e: {