@syncfusion/ej2-dropdowns 32.1.20 → 32.1.22

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.
@@ -473,6 +473,10 @@ class VirtualScroll {
473
473
  this.parent.totalItemsCount();
474
474
  }
475
475
  if (isListUpdated) {
476
+ if (this.component === 'multiselect' && this.parent.itemCount * 2 > this.parent.totalItemCount) {
477
+ this.parent.viewPortInfo.endIndex = endIndex = this.parent.totalItemCount;
478
+ this.parent.isVirtualTrackHeight = true;
479
+ }
476
480
  for (let i = this.parent.viewPortInfo.startIndex; i < endIndex; i++) {
477
481
  const index = i;
478
482
  if (this.component === 'multiselect' && this.parent.mode === 'CheckBox') {
@@ -1646,13 +1650,15 @@ let DropDownBase = class DropDownBase extends Component {
1646
1650
  const newQuery = this.getQuery(eventArgs.query);
1647
1651
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1648
1652
  if (this.isVirtualizationEnabled && (listItems.count !== 0 &&
1649
- listItems.count < (this.itemCount * 2)) && !this.appendUncheckList) {
1653
+ listItems.count < (this.itemCount * 2))) {
1650
1654
  if (newQuery) {
1651
1655
  for (let queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
1652
1656
  if (this.getModuleName() === 'multiselect' && this.isCheckBoxSelection && (newQuery.queries[queryElements].e && (newQuery.queries[queryElements].e.operator === 'notequal' ||
1653
1657
  newQuery.queries[queryElements].e.operator === 'equal' || newQuery.queries[queryElements].e.condition === 'or' || newQuery.queries[queryElements].e.condition === 'and') && !this.isCustomFiltering)) {
1654
- isReOrder = false;
1655
- break;
1658
+ if (this.totalItemCount > (this.itemCount * 2)) {
1659
+ isReOrder = false;
1660
+ break;
1661
+ }
1656
1662
  }
1657
1663
  if (newQuery.queries[queryElements].fn === 'onTake') {
1658
1664
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -18833,7 +18839,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18833
18839
  if (this.hideSelectedItem && this.value && Array.isArray(this.value) && this.value.length > 0) {
18834
18840
  this.totalItemsCount();
18835
18841
  }
18836
- if (!this.preventSetCurrentData && this.totalItemCount > (this.itemCount * 2) &&
18842
+ if (!this.preventSetCurrentData &&
18837
18843
  !isNullOrUndefined(this.viewPortInfo.startIndex) &&
18838
18844
  !isNullOrUndefined(this.viewPortInfo.endIndex)) {
18839
18845
  this.notify('setCurrentViewDataAsync', {
@@ -23403,13 +23409,33 @@ let Mention = class Mention extends DropDownBase {
23403
23409
  this.hidePopup();
23404
23410
  return;
23405
23411
  }
23412
+ const prevSiblingIsChip = (() => {
23413
+ if (!this.isContentEditable(this.inputElement) || !this.range || !this.range.startContainer) {
23414
+ return false;
23415
+ }
23416
+ const startContainer = this.range.startContainer;
23417
+ const textNode = startContainer.nodeType === Node.TEXT_NODE ? startContainer : (() => {
23418
+ const idx = Math.min(this.range.startOffset, startContainer.childNodes.length - 1);
23419
+ const child = startContainer.childNodes[idx] || startContainer.firstChild;
23420
+ return child && child.nodeType === Node.TEXT_NODE ? child : null;
23421
+ })();
23422
+ if (!textNode) {
23423
+ return false;
23424
+ }
23425
+ const firstChar = (textNode.data || '').replace(/\u200B/g, '').replace(/\u00A0/g, ' ').charAt(0);
23426
+ let previousSibling = textNode.previousSibling;
23427
+ while (previousSibling && ((previousSibling.nodeType === Node.TEXT_NODE && !(previousSibling.data || '').trim()) || (previousSibling.tagName === 'BR'))) {
23428
+ previousSibling = previousSibling.previousSibling;
23429
+ }
23430
+ return firstChar === this.mentionChar && !!(previousSibling && previousSibling.classList && previousSibling.classList.contains('e-mention-chip'));
23431
+ })();
23406
23432
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23407
23433
  if (((!currentRange || !lastWordRange) || (!lastWordRange.includes(this.mentionChar) && !this.requireLeadingSpace && !this.allowSpaces)) || e.code === 'Enter' || e.keyCode === 27 ||
23408
23434
  (lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
23409
23435
  (this.isContentEditable(this.inputElement) && this.range.startContainer &&
23410
23436
  this.range.startContainer.previousElementSibling && this.range.startContainer.previousElementSibling.tagName !== 'BR' && this.range.startContainer.textContent.split('').length > 0 &&
23411
23437
  (rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
23412
- this.range.startContainer.nodeType === 1))) {
23438
+ this.range.startContainer.nodeType === 1)) && !prevSiblingIsChip) {
23413
23439
  if (isValid && this.isPopupOpen && this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
23414
23440
  && !this.isMatchedText() && this.list && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' && e.code !== 'Enter') {
23415
23441
  this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
@@ -23434,11 +23460,11 @@ let Mention = class Mention extends DropDownBase {
23434
23460
  this.searchLists(e);
23435
23461
  if (!this.isPopupOpen && this.queryString.length >= this.minLength) {
23436
23462
  if (!this.isContentEditable(this.inputElement)) {
23437
- this.showPopup();
23463
+ this.showPopupWithDebounce();
23438
23464
  }
23439
23465
  else if (this.isContentEditable(this.inputElement) && this.range &&
23440
23466
  this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
23441
- this.showPopup();
23467
+ this.showPopupWithDebounce();
23442
23468
  }
23443
23469
  }
23444
23470
  }
@@ -23476,6 +23502,14 @@ let Mention = class Mention extends DropDownBase {
23476
23502
  }
23477
23503
  this.isListResetted = false;
23478
23504
  }
23505
+ showPopupWithDebounce() {
23506
+ if (this.minLength > 0 && this.minLength === this.queryString.length) {
23507
+ setTimeout(() => { this.showPopup(); }, this.debounceDelay);
23508
+ }
23509
+ else {
23510
+ this.showPopup();
23511
+ }
23512
+ }
23479
23513
  isMatchedText() {
23480
23514
  let isMatched = false;
23481
23515
  for (let i = 0; i < (this.liCollections && this.liCollections.length); i++) {
@@ -23882,15 +23916,13 @@ let Mention = class Mention extends DropDownBase {
23882
23916
  }
23883
23917
  }
23884
23918
  checkCollision(popupEle) {
23885
- if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
23886
- const coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
23887
- this.collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
23888
- if (this.collision.length > 0) {
23889
- popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
23890
- this.isCollided = true;
23891
- }
23892
- this.popupObj.resolveCollision();
23919
+ const coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
23920
+ this.collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
23921
+ if (this.collision.length > 0) {
23922
+ popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
23923
+ this.isCollided = true;
23893
23924
  }
23925
+ this.popupObj.resolveCollision();
23894
23926
  }
23895
23927
  getTriggerCharPosition() {
23896
23928
  let mostRecentTriggerCharPos;
@@ -23939,7 +23971,7 @@ let Mention = class Mention extends DropDownBase {
23939
23971
  this.popupObj.element.removeAttribute('style');
23940
23972
  this.popupObj.element.removeAttribute('aria-disabled');
23941
23973
  }
23942
- if (this.list.classList.contains('e-nodata')) {
23974
+ if (this.list && this.list.classList.contains('e-nodata')) {
23943
23975
  this.list = null;
23944
23976
  }
23945
23977
  }
@@ -24374,14 +24406,15 @@ let Mention = class Mention extends DropDownBase {
24374
24406
  value = this.displayTempElement.innerHTML;
24375
24407
  }
24376
24408
  if (this.isContentEditable(this.inputElement)) {
24409
+ const defaultSuffix = this.isRTE ? '&#8203;' : '';
24377
24410
  if (Browser.isAndroid) {
24378
- return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : '&#8203;');
24411
+ return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
24379
24412
  }
24380
24413
  else if (Browser.info.name === 'mozilla') {
24381
- return '<span>&#65279;<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>&#65279;</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : '&#8203;');
24414
+ return '<span>&#65279;<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>&#65279;</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
24382
24415
  }
24383
24416
  else {
24384
- return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : '&#8203;');
24417
+ return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
24385
24418
  }
24386
24419
  }
24387
24420
  else {