@syncfusion/ej2-dropdowns 23.1.41 → 23.1.43-17627

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.
@@ -1424,6 +1424,23 @@ let DropDownBase = class DropDownBase extends Component {
1424
1424
  }
1425
1425
  return dataSource;
1426
1426
  }
1427
+ /**
1428
+ * Return the index of item which matched with given value in data source
1429
+ *
1430
+ * @param {string | number | boolean} value - Specifies given value.
1431
+ * @returns {number} Returns the index of the item.
1432
+ */
1433
+ getIndexByValueFilter(value) {
1434
+ let index;
1435
+ const listItems = this.renderItems(this.selectData, this.fields);
1436
+ for (let i = 0; i < listItems.children.length; i++) {
1437
+ if (!isNullOrUndefined(value) && listItems.children[i].getAttribute('data-value') === value.toString()) {
1438
+ index = i;
1439
+ break;
1440
+ }
1441
+ }
1442
+ return index;
1443
+ }
1427
1444
  /**
1428
1445
  * Return the index of item which matched with given value in data source
1429
1446
  *
@@ -2692,6 +2709,13 @@ let DropDownList = class DropDownList extends DropDownBase {
2692
2709
  }
2693
2710
  }
2694
2711
  updateUpDownAction(e, isVirtualKeyAction) {
2712
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
2713
+ let value = this.getItemData().value;
2714
+ let filterIndex = this.getIndexByValue(value);
2715
+ if (!isNullOrUndefined(filterIndex)) {
2716
+ this.activeIndex = filterIndex;
2717
+ }
2718
+ }
2695
2719
  const focusEle = this.list.querySelector('.' + dropDownListClasses.focus);
2696
2720
  if (this.isSelectFocusItem(focusEle) && !isVirtualKeyAction) {
2697
2721
  this.setSelection(focusEle, e);
@@ -2736,6 +2760,13 @@ let DropDownList = class DropDownList extends DropDownBase {
2736
2760
  this.setSelection(nextItem, e);
2737
2761
  }
2738
2762
  }
2763
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
2764
+ let value = this.getItemData().value;
2765
+ let filterIndex = this.getIndexByValueFilter(value);
2766
+ if (!isNullOrUndefined(filterIndex)) {
2767
+ this.activeIndex = filterIndex;
2768
+ }
2769
+ }
2739
2770
  e.preventDefault();
2740
2771
  }
2741
2772
  updateHomeEndAction(e, isVirtualKeyAction) {
@@ -3036,7 +3067,18 @@ let DropDownList = class DropDownList extends DropDownBase {
3036
3067
  if (isNullOrUndefined(value)) {
3037
3068
  value = 'null';
3038
3069
  }
3039
- this.activeIndex = this.getIndexByValue(value);
3070
+ if (this.allowFiltering && !this.enableVirtualization && this.getModuleName() !== 'autocomplete') {
3071
+ let filterIndex = this.getIndexByValueFilter(value);
3072
+ if (!isNullOrUndefined(filterIndex)) {
3073
+ this.activeIndex = filterIndex;
3074
+ }
3075
+ else {
3076
+ this.activeIndex = this.getIndexByValue(value);
3077
+ }
3078
+ }
3079
+ else {
3080
+ this.activeIndex = this.getIndexByValue(value);
3081
+ }
3040
3082
  }
3041
3083
  activeItem(li) {
3042
3084
  if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.selected)) {
@@ -3062,6 +3104,9 @@ let DropDownList = class DropDownList extends DropDownBase {
3062
3104
  detach(this.valueTempElement);
3063
3105
  this.inputElement.style.display = 'block';
3064
3106
  }
3107
+ if (!isNullOrUndefined(dataItem.value) && !this.enableVirtualization && this.allowFiltering) {
3108
+ this.activeIndex = this.getIndexByValueFilter(dataItem.value);
3109
+ }
3065
3110
  const clearIcon = dropDownListClasses.clearIcon;
3066
3111
  const isFilterElement = this.isFiltering() && this.filterInput && (this.getModuleName() === 'combobox');
3067
3112
  const clearElement = isFilterElement && this.filterInput.parentElement.querySelector('.' + clearIcon);
@@ -4538,7 +4583,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4538
4583
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4539
4584
  this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
4540
4585
  }
4541
- this.getSkeletonCount();
4586
+ if (this.getModuleName() !== 'autocomplete' && this.totalItemCount != 0 && this.totalItemCount > (this.itemCount * 2)) {
4587
+ this.getSkeletonCount();
4588
+ }
4542
4589
  this.UpdateSkeleton();
4543
4590
  this.listData = currentData;
4544
4591
  this.updateActionCompleteDataValues(ulElement, currentData);
@@ -7395,12 +7442,12 @@ let DropDownTree = class DropDownTree extends Component {
7395
7442
  const nodes = this.treeObj.element.querySelectorAll('li');
7396
7443
  const checkedNodes = this.treeObj.element.querySelectorAll('li .e-checkbox-wrapper[aria-checked=true]');
7397
7444
  const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
7398
- if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || args.data[0].isChecked == "false")) {
7445
+ if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) {
7399
7446
  this.isReverseUpdate = true;
7400
7447
  this.changeState(wrap, 'uncheck');
7401
7448
  this.isReverseUpdate = false;
7402
7449
  }
7403
- else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || args.data[0].isChecked == "true")) {
7450
+ else if (wrap && args.action === 'check' && checkedNodes.length === nodes.length && (args.isInteracted || this.isCheckAllCalled || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'true'))) {
7404
7451
  this.isReverseUpdate = true;
7405
7452
  this.isCheckAllCalled = false;
7406
7453
  this.changeState(wrap, 'check');
@@ -8363,7 +8410,6 @@ let DropDownTree = class DropDownTree extends Component {
8363
8410
  this.clearTemplate();
8364
8411
  this.unWireEvents();
8365
8412
  this.setCssClass(null, this.cssClass);
8366
- this.setProperties({ value: [] }, true);
8367
8413
  this.setProperties({ text: null }, true);
8368
8414
  this.treeObj.destroy();
8369
8415
  this.destroyFilter();
@@ -8406,6 +8452,7 @@ let DropDownTree = class DropDownTree extends Component {
8406
8452
  this.overFlowWrapper = null;
8407
8453
  this.keyboardModule = null;
8408
8454
  super.destroy();
8455
+ this.setProperties({ value: [] }, true);
8409
8456
  }
8410
8457
  destroyFilter() {
8411
8458
  if (this.filterObj) {
@@ -10979,6 +11026,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
10979
11026
  if (!isNullOrUndefined(this.overAllWrapper) && !isNullOrUndefined(this.overAllWrapper.getElementsByClassName('e-ddl-icon')[0] && this.overAllWrapper.getElementsByClassName('e-float-text-content')[0] && this.floatLabelType !== 'Never')) {
10980
11027
  this.overAllWrapper.getElementsByClassName('e-float-text-content')[0].classList.add('e-icon');
10981
11028
  }
11029
+ this.dispatchEvent(this.inputElement, 'blur');
10982
11030
  }
10983
11031
  calculateWidth() {
10984
11032
  let elementWidth;
@@ -18010,6 +18058,8 @@ let Mention = class Mention extends DropDownBase {
18010
18058
  this.initializePopup(popupEle, offsetValue, left);
18011
18059
  this.checkCollision(popupEle);
18012
18060
  popupEle.style.visibility = 'visible';
18061
+ let popupLeft = popupEle.parentElement.offsetWidth - popupEle.offsetWidth;
18062
+ let popupHeight = popupEle.offsetHeight;
18013
18063
  addClass([popupEle], ['e-mention', 'e-popup', 'e-popup-close']);
18014
18064
  if (!isNullOrUndefined(this.list)) {
18015
18065
  this.unWireListEvents();
@@ -18038,9 +18088,23 @@ let Mention = class Mention extends DropDownBase {
18038
18088
  popupEle.style.cssText = 'top: '.concat(coordinates.top.toString(), 'px;\n left: ').concat(coordinates.left.toString(), 'px;\nposition: absolute;\n display: block;');
18039
18089
  }
18040
18090
  else {
18041
- popupEle.style.left = formatUnit(coordinates.left);
18042
- popupEle.style.top = formatUnit(coordinates.top - parseInt(this.popupHeight.toString()));
18091
+ if (this.collision.length > 0 && this.collision.indexOf('right') > -1 && this.collision.indexOf('bottom') === -1) {
18092
+ popupEle.style.cssText = 'top: '.concat(coordinates.top.toString(), 'px;\n left: ').concat(popupLeft.toString(), 'px;\nposition: absolute;\n display: block;');
18093
+ }
18094
+ else if (this.collision && this.collision.length > 0 && this.collision.indexOf('bottom') > -1 && this.collision.indexOf('right') === -1) {
18095
+ popupEle.style.left = formatUnit(coordinates.left);
18096
+ popupEle.style.top = formatUnit(coordinates.top - parseInt(popupHeight.toString()));
18097
+ }
18098
+ else if (this.collision && this.collision.length > 0 && this.collision.indexOf('bottom') > -1 && this.collision.indexOf('right') > -1) {
18099
+ popupEle.style.left = formatUnit(popupLeft);
18100
+ popupEle.style.top = formatUnit(coordinates.top - parseInt(popupHeight.toString()));
18101
+ }
18102
+ else {
18103
+ popupEle.style.left = formatUnit(coordinates.left);
18104
+ popupEle.style.top = formatUnit(coordinates.top - parseInt(this.popupHeight.toString()));
18105
+ }
18043
18106
  this.isCollided = false;
18107
+ this.collision = [];
18044
18108
  }
18045
18109
  popupEle.style.width = this.popupWidth !== '100%' && !isNullOrUndefined(this.popupWidth) ? formatUnit(this.popupWidth) : 'auto';
18046
18110
  this.setHeight(popupEle);
@@ -18069,8 +18133,8 @@ let Mention = class Mention extends DropDownBase {
18069
18133
  checkCollision(popupEle) {
18070
18134
  if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
18071
18135
  let coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
18072
- const collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
18073
- if (collision.length > 0) {
18136
+ this.collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
18137
+ if (this.collision.length > 0) {
18074
18138
  popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
18075
18139
  this.isCollided = true;
18076
18140
  }
@@ -18204,10 +18268,18 @@ let Mention = class Mention extends DropDownBase {
18204
18268
  document.body.removeChild(div);
18205
18269
  }
18206
18270
  else {
18207
- coordinates = {
18208
- top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10) - (this.isCollided ? 10 : 0),
18209
- left: rect.left + windowLeft + width
18210
- };
18271
+ if (this.collision && this.collision.length > 0 && this.collision.indexOf('right') > -1 && this.collision.indexOf('bottom') === -1) {
18272
+ coordinates = {
18273
+ top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
18274
+ left: rect.left + windowLeft + width
18275
+ };
18276
+ }
18277
+ else {
18278
+ coordinates = {
18279
+ top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10) - (this.isCollided ? 10 : 0),
18280
+ left: rect.left + windowLeft + width
18281
+ };
18282
+ }
18211
18283
  }
18212
18284
  return coordinates;
18213
18285
  }
@@ -18510,7 +18582,12 @@ let Mention = class Mention extends DropDownBase {
18510
18582
  value = this.displayTempElement.innerHTML;
18511
18583
  }
18512
18584
  if (this.isContentEditable(this.inputElement)) {
18513
- return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18585
+ if (Browser.isAndroid) {
18586
+ return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18587
+ }
18588
+ else {
18589
+ return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
18590
+ }
18514
18591
  }
18515
18592
  else {
18516
18593
  return showChar + value;