@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.
@@ -521,6 +521,10 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
521
521
  this.parent.totalItemsCount();
522
522
  }
523
523
  if (isListUpdated) {
524
+ if (this.component === 'multiselect' && this.parent.itemCount * 2 > this.parent.totalItemCount) {
525
+ this.parent.viewPortInfo.endIndex = endIndex = this.parent.totalItemCount;
526
+ this.parent.isVirtualTrackHeight = true;
527
+ }
524
528
  for (var i = this.parent.viewPortInfo.startIndex; i < endIndex; i++) {
525
529
  var index = i;
526
530
  if (this.component === 'multiselect' && this.parent.mode === 'CheckBox') {
@@ -1730,13 +1734,15 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1730
1734
  var newQuery = _this.getQuery(eventArgs.query);
1731
1735
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1732
1736
  if (_this.isVirtualizationEnabled && (listItems.count !== 0 &&
1733
- listItems.count < (_this.itemCount * 2)) && !_this.appendUncheckList) {
1737
+ listItems.count < (_this.itemCount * 2))) {
1734
1738
  if (newQuery) {
1735
1739
  for (var queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
1736
1740
  if (_this.getModuleName() === 'multiselect' && _this.isCheckBoxSelection && (newQuery.queries[queryElements].e && (newQuery.queries[queryElements].e.operator === 'notequal' ||
1737
1741
  newQuery.queries[queryElements].e.operator === 'equal' || newQuery.queries[queryElements].e.condition === 'or' || newQuery.queries[queryElements].e.condition === 'and') && !_this.isCustomFiltering)) {
1738
- isReOrder = false;
1739
- break;
1742
+ if (_this.totalItemCount > (_this.itemCount * 2)) {
1743
+ isReOrder = false;
1744
+ break;
1745
+ }
1740
1746
  }
1741
1747
  if (newQuery.queries[queryElements].fn === 'onTake') {
1742
1748
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -19128,7 +19134,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
19128
19134
  if (_this.hideSelectedItem && _this.value && Array.isArray(_this.value) && _this.value.length > 0) {
19129
19135
  _this.totalItemsCount();
19130
19136
  }
19131
- if (!_this.preventSetCurrentData && _this.totalItemCount > (_this.itemCount * 2) &&
19137
+ if (!_this.preventSetCurrentData &&
19132
19138
  !isNullOrUndefined(_this.viewPortInfo.startIndex) &&
19133
19139
  !isNullOrUndefined(_this.viewPortInfo.endIndex)) {
19134
19140
  _this.notify('setCurrentViewDataAsync', {
@@ -23738,6 +23744,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
23738
23744
  }
23739
23745
  };
23740
23746
  Mention.prototype.onKeyUp = function (e) {
23747
+ var _this = this;
23741
23748
  var rangetextContent;
23742
23749
  if (this.isUpDownKey && this.isPopupOpen && e.keyCode === 229) {
23743
23750
  this.isUpDownKey = false;
@@ -23789,13 +23796,33 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
23789
23796
  this.hidePopup();
23790
23797
  return;
23791
23798
  }
23799
+ var prevSiblingIsChip = (function () {
23800
+ if (!_this.isContentEditable(_this.inputElement) || !_this.range || !_this.range.startContainer) {
23801
+ return false;
23802
+ }
23803
+ var startContainer = _this.range.startContainer;
23804
+ var textNode = startContainer.nodeType === Node.TEXT_NODE ? startContainer : (function () {
23805
+ var idx = Math.min(_this.range.startOffset, startContainer.childNodes.length - 1);
23806
+ var child = startContainer.childNodes[idx] || startContainer.firstChild;
23807
+ return child && child.nodeType === Node.TEXT_NODE ? child : null;
23808
+ })();
23809
+ if (!textNode) {
23810
+ return false;
23811
+ }
23812
+ var firstChar = (textNode.data || '').replace(/\u200B/g, '').replace(/\u00A0/g, ' ').charAt(0);
23813
+ var previousSibling = textNode.previousSibling;
23814
+ while (previousSibling && ((previousSibling.nodeType === Node.TEXT_NODE && !(previousSibling.data || '').trim()) || (previousSibling.tagName === 'BR'))) {
23815
+ previousSibling = previousSibling.previousSibling;
23816
+ }
23817
+ return firstChar === _this.mentionChar && !!(previousSibling && previousSibling.classList && previousSibling.classList.contains('e-mention-chip'));
23818
+ })();
23792
23819
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23793
23820
  if (((!currentRange || !lastWordRange) || (!lastWordRange.includes(this.mentionChar) && !this.requireLeadingSpace && !this.allowSpaces)) || e.code === 'Enter' || e.keyCode === 27 ||
23794
23821
  (lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
23795
23822
  (this.isContentEditable(this.inputElement) && this.range.startContainer &&
23796
23823
  this.range.startContainer.previousElementSibling && this.range.startContainer.previousElementSibling.tagName !== 'BR' && this.range.startContainer.textContent.split('').length > 0 &&
23797
23824
  (rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
23798
- this.range.startContainer.nodeType === 1))) {
23825
+ this.range.startContainer.nodeType === 1)) && !prevSiblingIsChip) {
23799
23826
  if (isValid && this.isPopupOpen && this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
23800
23827
  && !this.isMatchedText() && this.list && e.code !== 'ArrowDown' && e.code !== 'ArrowUp' && e.code !== 'Enter') {
23801
23828
  this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
@@ -23820,11 +23847,11 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
23820
23847
  this.searchLists(e);
23821
23848
  if (!this.isPopupOpen && this.queryString.length >= this.minLength) {
23822
23849
  if (!this.isContentEditable(this.inputElement)) {
23823
- this.showPopup();
23850
+ this.showPopupWithDebounce();
23824
23851
  }
23825
23852
  else if (this.isContentEditable(this.inputElement) && this.range &&
23826
23853
  this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
23827
- this.showPopup();
23854
+ this.showPopupWithDebounce();
23828
23855
  }
23829
23856
  }
23830
23857
  }
@@ -23862,6 +23889,15 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
23862
23889
  }
23863
23890
  this.isListResetted = false;
23864
23891
  };
23892
+ Mention.prototype.showPopupWithDebounce = function () {
23893
+ var _this = this;
23894
+ if (this.minLength > 0 && this.minLength === this.queryString.length) {
23895
+ setTimeout(function () { _this.showPopup(); }, this.debounceDelay);
23896
+ }
23897
+ else {
23898
+ this.showPopup();
23899
+ }
23900
+ };
23865
23901
  Mention.prototype.isMatchedText = function () {
23866
23902
  var isMatched = false;
23867
23903
  for (var i = 0; i < (this.liCollections && this.liCollections.length); i++) {
@@ -24272,15 +24308,13 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
24272
24308
  }
24273
24309
  };
24274
24310
  Mention.prototype.checkCollision = function (popupEle) {
24275
- if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
24276
- var coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
24277
- this.collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
24278
- if (this.collision.length > 0) {
24279
- popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
24280
- this.isCollided = true;
24281
- }
24282
- this.popupObj.resolveCollision();
24311
+ var coordinates = this.getCoordinates(this.inputElement, this.getTriggerCharPosition());
24312
+ this.collision = isCollide(popupEle, null, coordinates.left, coordinates.top);
24313
+ if (this.collision.length > 0) {
24314
+ popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
24315
+ this.isCollided = true;
24283
24316
  }
24317
+ this.popupObj.resolveCollision();
24284
24318
  };
24285
24319
  Mention.prototype.getTriggerCharPosition = function () {
24286
24320
  var mostRecentTriggerCharPos;
@@ -24330,7 +24364,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
24330
24364
  this.popupObj.element.removeAttribute('style');
24331
24365
  this.popupObj.element.removeAttribute('aria-disabled');
24332
24366
  }
24333
- if (this.list.classList.contains('e-nodata')) {
24367
+ if (this.list && this.list.classList.contains('e-nodata')) {
24334
24368
  this.list = null;
24335
24369
  }
24336
24370
  };
@@ -24766,14 +24800,15 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
24766
24800
  value = this.displayTempElement.innerHTML;
24767
24801
  }
24768
24802
  if (this.isContentEditable(this.inputElement)) {
24803
+ var defaultSuffix = this.isRTE ? '&#8203;' : '';
24769
24804
  if (Browser.isAndroid) {
24770
- return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : '&#8203;');
24805
+ return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
24771
24806
  }
24772
24807
  else if (Browser.info.name === 'mozilla') {
24773
- return '<span>&#65279;<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>&#65279;</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : '&#8203;');
24808
+ return '<span>&#65279;<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>&#65279;</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
24774
24809
  }
24775
24810
  else {
24776
- return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : '&#8203;');
24811
+ return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
24777
24812
  }
24778
24813
  }
24779
24814
  else {