@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.
@@ -763,7 +763,9 @@ let DropDownBase = class DropDownBase extends Component {
763
763
  }
764
764
  }
765
765
  else {
766
- ele.appendChild(noDataElement[i]);
766
+ if (noDataElement[i] instanceof HTMLElement) {
767
+ ele.appendChild(noDataElement[i]);
768
+ }
767
769
  }
768
770
  }
769
771
  }
@@ -1424,6 +1426,23 @@ let DropDownBase = class DropDownBase extends Component {
1424
1426
  }
1425
1427
  return dataSource;
1426
1428
  }
1429
+ /**
1430
+ * Return the index of item which matched with given value in data source
1431
+ *
1432
+ * @param {string | number | boolean} value - Specifies given value.
1433
+ * @returns {number} Returns the index of the item.
1434
+ */
1435
+ getIndexByValueFilter(value) {
1436
+ let index;
1437
+ const listItems = this.renderItems(this.selectData, this.fields);
1438
+ for (let i = 0; i < listItems.children.length; i++) {
1439
+ if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1440
+ index = i;
1441
+ break;
1442
+ }
1443
+ }
1444
+ return index;
1445
+ }
1427
1446
  /**
1428
1447
  * Return the index of item which matched with given value in data source
1429
1448
  *
@@ -2692,6 +2711,13 @@ let DropDownList = class DropDownList extends DropDownBase {
2692
2711
  }
2693
2712
  }
2694
2713
  updateUpDownAction(e, isVirtualKeyAction) {
2714
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
2715
+ let value = this.getItemData().value;
2716
+ let filterIndex = this.getIndexByValue(value);
2717
+ if (!isNullOrUndefined(filterIndex)) {
2718
+ this.activeIndex = filterIndex;
2719
+ }
2720
+ }
2695
2721
  const focusEle = this.list.querySelector('.' + dropDownListClasses.focus);
2696
2722
  if (this.isSelectFocusItem(focusEle) && !isVirtualKeyAction) {
2697
2723
  this.setSelection(focusEle, e);
@@ -2736,6 +2762,13 @@ let DropDownList = class DropDownList extends DropDownBase {
2736
2762
  this.setSelection(nextItem, e);
2737
2763
  }
2738
2764
  }
2765
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
2766
+ let value = this.getItemData().value;
2767
+ let filterIndex = this.getIndexByValueFilter(value);
2768
+ if (!isNullOrUndefined(filterIndex)) {
2769
+ this.activeIndex = filterIndex;
2770
+ }
2771
+ }
2739
2772
  e.preventDefault();
2740
2773
  }
2741
2774
  updateHomeEndAction(e, isVirtualKeyAction) {
@@ -3036,7 +3069,18 @@ let DropDownList = class DropDownList extends DropDownBase {
3036
3069
  if (isNullOrUndefined(value)) {
3037
3070
  value = 'null';
3038
3071
  }
3039
- this.activeIndex = this.getIndexByValue(value);
3072
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
3073
+ let filterIndex = this.getIndexByValueFilter(value);
3074
+ if (!isNullOrUndefined(filterIndex)) {
3075
+ this.activeIndex = filterIndex;
3076
+ }
3077
+ else {
3078
+ this.activeIndex = this.getIndexByValue(value);
3079
+ }
3080
+ }
3081
+ else {
3082
+ this.activeIndex = this.getIndexByValue(value);
3083
+ }
3040
3084
  }
3041
3085
  activeItem(li) {
3042
3086
  if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.selected)) {
@@ -3062,6 +3106,9 @@ let DropDownList = class DropDownList extends DropDownBase {
3062
3106
  detach(this.valueTempElement);
3063
3107
  this.inputElement.style.display = 'block';
3064
3108
  }
3109
+ if (!isNullOrUndefined(dataItem.value) && !this.enableVirtualization && this.allowFiltering) {
3110
+ this.activeIndex = this.getIndexByValueFilter(dataItem.value);
3111
+ }
3065
3112
  const clearIcon = dropDownListClasses.clearIcon;
3066
3113
  const isFilterElement = this.isFiltering() && this.filterInput && (this.getModuleName() === 'combobox');
3067
3114
  const clearElement = isFilterElement && this.filterInput.parentElement.querySelector('.' + clearIcon);
@@ -4538,7 +4585,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4538
4585
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4539
4586
  this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
4540
4587
  }
4541
- this.getSkeletonCount();
4588
+ if (this.getModuleName() !== 'autocomplete' && this.totalItemCount != 0 && this.totalItemCount > (this.itemCount * 2)) {
4589
+ this.getSkeletonCount();
4590
+ }
4542
4591
  this.UpdateSkeleton();
4543
4592
  this.listData = currentData;
4544
4593
  this.updateActionCompleteDataValues(ulElement, currentData);
@@ -7395,12 +7444,12 @@ let DropDownTree = class DropDownTree extends Component {
7395
7444
  const nodes = this.treeObj.element.querySelectorAll('li');
7396
7445
  const checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
7397
7446
  const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
7398
- if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || args.data[0].isChecked == "false")) {
7447
+ if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) {
7399
7448
  this.isReverseUpdate = true;
7400
7449
  this.changeState(wrap, 'uncheck');
7401
7450
  this.isReverseUpdate = false;
7402
7451
  }
7403
- else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || args.data[0].isChecked == "true")) {
7452
+ else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'true'))) {
7404
7453
  this.isReverseUpdate = true;
7405
7454
  this.isCheckAllCalled = false;
7406
7455
  this.changeState(wrap, 'check');
@@ -8363,7 +8412,6 @@ let DropDownTree = class DropDownTree extends Component {
8363
8412
  this.clearTemplate();
8364
8413
  this.unWireEvents();
8365
8414
  this.setCssClass(null, this.cssClass);
8366
- this.setProperties({ value: [] }, true);
8367
8415
  this.setProperties({ text: null }, true);
8368
8416
  this.treeObj.destroy();
8369
8417
  this.destroyFilter();
@@ -8406,6 +8454,7 @@ let DropDownTree = class DropDownTree extends Component {
8406
8454
  this.overFlowWrapper = null;
8407
8455
  this.keyboardModule = null;
8408
8456
  super.destroy();
8457
+ this.setProperties({ value: [] }, true);
8409
8458
  }
8410
8459
  destroyFilter() {
8411
8460
  if (this.filterObj) {
@@ -17635,7 +17684,7 @@ let Mention = class Mention extends DropDownBase {
17635
17684
  let currentRange = this.getTextRange();
17636
17685
  const lastWordRange = this.getLastLetter(currentRange);
17637
17686
  // eslint-disable-next-line security/detect-non-literal-regexp
17638
- const Regex = new RegExp(this.mentionChar, 'g');
17687
+ const Regex = new RegExp(this.mentionChar.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');
17639
17688
  const charRegex = new RegExp('[a-zA-Z]', 'g');
17640
17689
  if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
17641
17690
  return;
@@ -18534,7 +18583,12 @@ let Mention = class Mention extends DropDownBase {
18534
18583
  value = this.displayTempElement.innerHTML;
18535
18584
  }
18536
18585
  if (this.isContentEditable(this.inputElement)) {
18537
- return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18586
+ if (Browser.isAndroid) {
18587
+ return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18588
+ }
18589
+ else {
18590
+ return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18591
+ }
18538
18592
  }
18539
18593
  else {
18540
18594
  return showChar + value;
@@ -18765,7 +18819,6 @@ let Mention = class Mention extends DropDownBase {
18765
18819
  this.previousSelectedLI = null;
18766
18820
  this.item = null;
18767
18821
  this.selectedLI = null;
18768
- this.inputElement.innerText = null;
18769
18822
  this.popupObj = null;
18770
18823
  super.destroy();
18771
18824
  }