@syncfusion/ej2-dropdowns 23.1.42 → 23.1.44

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.
@@ -845,7 +845,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
845
845
  }
846
846
  }
847
847
  else {
848
- ele.appendChild(noDataElement[i]);
848
+ if (noDataElement[i] instanceof HTMLElement) {
849
+ ele.appendChild(noDataElement[i]);
850
+ }
849
851
  }
850
852
  }
851
853
  }
@@ -1509,6 +1511,23 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1509
1511
  }
1510
1512
  return dataSource;
1511
1513
  };
1514
+ /**
1515
+ * Return the index of item which matched with given value in data source
1516
+ *
1517
+ * @param {string | number | boolean} value - Specifies given value.
1518
+ * @returns {number} Returns the index of the item.
1519
+ */
1520
+ DropDownBase.prototype.getIndexByValueFilter = function (value) {
1521
+ var index;
1522
+ var listItems = this.renderItems(this.selectData, this.fields);
1523
+ for (var i = 0; i < listItems.children.length; i++) {
1524
+ if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1525
+ index = i;
1526
+ break;
1527
+ }
1528
+ }
1529
+ return index;
1530
+ };
1512
1531
  /**
1513
1532
  * Return the index of item which matched with given value in data source
1514
1533
  *
@@ -2798,6 +2817,13 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2798
2817
  }
2799
2818
  };
2800
2819
  DropDownList.prototype.updateUpDownAction = function (e, isVirtualKeyAction) {
2820
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
2821
+ var value_1 = this.getItemData().value;
2822
+ var filterIndex = this.getIndexByValue(value_1);
2823
+ if (!isNullOrUndefined(filterIndex)) {
2824
+ this.activeIndex = filterIndex;
2825
+ }
2826
+ }
2801
2827
  var focusEle = this.list.querySelector('.' + dropDownListClasses.focus);
2802
2828
  if (this.isSelectFocusItem(focusEle) && !isVirtualKeyAction) {
2803
2829
  this.setSelection(focusEle, e);
@@ -2842,6 +2868,13 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2842
2868
  this.setSelection(nextItem, e);
2843
2869
  }
2844
2870
  }
2871
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
2872
+ var value_2 = this.getItemData().value;
2873
+ var filterIndex = this.getIndexByValueFilter(value_2);
2874
+ if (!isNullOrUndefined(filterIndex)) {
2875
+ this.activeIndex = filterIndex;
2876
+ }
2877
+ }
2845
2878
  e.preventDefault();
2846
2879
  };
2847
2880
  DropDownList.prototype.updateHomeEndAction = function (e, isVirtualKeyAction) {
@@ -3143,7 +3176,18 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3143
3176
  if (isNullOrUndefined(value)) {
3144
3177
  value = 'null';
3145
3178
  }
3146
- this.activeIndex = this.getIndexByValue(value);
3179
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
3180
+ var filterIndex = this.getIndexByValueFilter(value);
3181
+ if (!isNullOrUndefined(filterIndex)) {
3182
+ this.activeIndex = filterIndex;
3183
+ }
3184
+ else {
3185
+ this.activeIndex = this.getIndexByValue(value);
3186
+ }
3187
+ }
3188
+ else {
3189
+ this.activeIndex = this.getIndexByValue(value);
3190
+ }
3147
3191
  };
3148
3192
  DropDownList.prototype.activeItem = function (li) {
3149
3193
  if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.selected)) {
@@ -3169,6 +3213,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3169
3213
  detach(this.valueTempElement);
3170
3214
  this.inputElement.style.display = 'block';
3171
3215
  }
3216
+ if (!isNullOrUndefined(dataItem.value) && !this.enableVirtualization && this.allowFiltering) {
3217
+ this.activeIndex = this.getIndexByValueFilter(dataItem.value);
3218
+ }
3172
3219
  var clearIcon = dropDownListClasses.clearIcon;
3173
3220
  var isFilterElement = this.isFiltering() && this.filterInput && (this.getModuleName() === 'combobox');
3174
3221
  var clearElement = isFilterElement && this.filterInput.parentElement.querySelector('.' + clearIcon);
@@ -3943,10 +3990,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3943
3990
  DropDownList.prototype.addNewItem = function (listData, newElement) {
3944
3991
  var _this = this;
3945
3992
  if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
3946
- var value_1 = this.getItemData().value;
3993
+ var value_3 = this.getItemData().value;
3947
3994
  var isExist = listData.some(function (data) {
3948
- return (((typeof data === 'string' || typeof data === 'number') && data === value_1) ||
3949
- (getValue(_this.fields.value, data) === value_1));
3995
+ return (((typeof data === 'string' || typeof data === 'number') && data === value_3) ||
3996
+ (getValue(_this.fields.value, data) === value_3));
3950
3997
  });
3951
3998
  if (!isExist) {
3952
3999
  this.addItem(this.itemData);
@@ -4660,7 +4707,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4660
4707
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4661
4708
  this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
4662
4709
  }
4663
- this.getSkeletonCount();
4710
+ if (this.getModuleName() !== 'autocomplete' && this.totalItemCount != 0 && this.totalItemCount > (this.itemCount * 2)) {
4711
+ this.getSkeletonCount();
4712
+ }
4664
4713
  this.UpdateSkeleton();
4665
4714
  this.listData = currentData;
4666
4715
  this.updateActionCompleteDataValues(ulElement, currentData);
@@ -7560,12 +7609,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7560
7609
  var nodes = this.treeObj.element.querySelectorAll('li');
7561
7610
  var checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
7562
7611
  var wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
7563
- if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || args.data[0].isChecked == "false")) {
7612
+ if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) {
7564
7613
  this.isReverseUpdate = true;
7565
7614
  this.changeState(wrap, 'uncheck');
7566
7615
  this.isReverseUpdate = false;
7567
7616
  }
7568
- else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || args.data[0].isChecked == "true")) {
7617
+ else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'true'))) {
7569
7618
  this.isReverseUpdate = true;
7570
7619
  this.isCheckAllCalled = false;
7571
7620
  this.changeState(wrap, 'check');
@@ -8529,7 +8578,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8529
8578
  this.clearTemplate();
8530
8579
  this.unWireEvents();
8531
8580
  this.setCssClass(null, this.cssClass);
8532
- this.setProperties({ value: [] }, true);
8533
8581
  this.setProperties({ text: null }, true);
8534
8582
  this.treeObj.destroy();
8535
8583
  this.destroyFilter();
@@ -8572,6 +8620,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8572
8620
  this.overFlowWrapper = null;
8573
8621
  this.keyboardModule = null;
8574
8622
  _super.prototype.destroy.call(this);
8623
+ this.setProperties({ value: [] }, true);
8575
8624
  };
8576
8625
  DropDownTree.prototype.destroyFilter = function () {
8577
8626
  if (this.filterObj) {
@@ -17954,7 +18003,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
17954
18003
  var currentRange = this.getTextRange();
17955
18004
  var lastWordRange = this.getLastLetter(currentRange);
17956
18005
  // eslint-disable-next-line security/detect-non-literal-regexp
17957
- var Regex = new RegExp(this.mentionChar, 'g');
18006
+ var Regex = new RegExp(this.mentionChar.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');
17958
18007
  var charRegex = new RegExp('[a-zA-Z]', 'g');
17959
18008
  if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
17960
18009
  return;
@@ -18859,7 +18908,12 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
18859
18908
  value = this.displayTempElement.innerHTML;
18860
18909
  }
18861
18910
  if (this.isContentEditable(this.inputElement)) {
18862
- return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18911
+ if (Browser.isAndroid) {
18912
+ return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18913
+ }
18914
+ else {
18915
+ return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18916
+ }
18863
18917
  }
18864
18918
  else {
18865
18919
  return showChar + value;
@@ -19092,7 +19146,6 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
19092
19146
  this.previousSelectedLI = null;
19093
19147
  this.item = null;
19094
19148
  this.selectedLI = null;
19095
- this.inputElement.innerText = null;
19096
19149
  this.popupObj = null;
19097
19150
  _super.prototype.destroy.call(this);
19098
19151
  };