@syncfusion/ej2-dropdowns 33.1.46 → 33.1.49

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.
@@ -1651,12 +1651,25 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1651
1651
  _this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
1652
1652
  var isReOrder = true;
1653
1653
  if (!_this.virtualSelectAll) {
1654
+ var newQueryWhereCount = 0;
1655
+ var queryWhereCount = 0;
1654
1656
  var newQuery = query_1.clone();
1655
1657
  for (var queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
1656
1658
  if (newQuery.queries[queryElements].fn === 'onWhere') {
1657
1659
  isWhereExist_1 = true;
1660
+ newQueryWhereCount++;
1658
1661
  }
1659
1662
  }
1663
+ for (var queryElements = 0; !isNullOrUndefined(_this.query) &&
1664
+ queryElements < _this.query.queries.length; queryElements++) {
1665
+ if (_this.query.queries[queryElements].fn === 'onWhere') {
1666
+ isWhereExist_1 = true;
1667
+ queryWhereCount++;
1668
+ }
1669
+ }
1670
+ if (queryWhereCount === newQueryWhereCount) {
1671
+ isWhereExist_1 = false;
1672
+ }
1660
1673
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1661
1674
  if (_this.isVirtualizationEnabled && (e.count !== 0 && e.count < (_this.itemCount * 2))) {
1662
1675
  if (newQuery) {
@@ -8247,6 +8260,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8247
8260
  _this.filterDelayTime = 300;
8248
8261
  _this.isClicked = false;
8249
8262
  _this.documentClickContext = _this.onDocumentClick.bind(_this);
8263
+ _this.windowResizeContext = _this.windowResize.bind(_this);
8250
8264
  // Specifies if the checkAll method has been called
8251
8265
  _this.isCheckAllCalled = false;
8252
8266
  _this.isFromFilterChange = false;
@@ -8736,11 +8750,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8736
8750
  EventHandler.add(this.inputWrapper, 'mousemove', this.mouseIn, this);
8737
8751
  EventHandler.add(this.inputWrapper, 'mouseout', this.onMouseLeave, this);
8738
8752
  EventHandler.add(this.overAllClear, 'mousedown', this.clearAll, this);
8739
- EventHandler.add(window, 'resize', this.windowResize, this);
8753
+ EventHandler.add(window, 'resize', this.windowResizeContext);
8740
8754
  var formElement = closest(this.inputWrapper, 'form');
8741
8755
  if (formElement) {
8742
8756
  EventHandler.add(formElement, 'reset', this.resetValueHandler, this);
8743
8757
  }
8758
+ if (this.keyboardModule && typeof this.keyboardModule.destroy === 'function') {
8759
+ this.keyboardModule.destroy();
8760
+ }
8744
8761
  this.keyboardModule = new KeyboardEvents(this.inputWrapper, {
8745
8762
  keyAction: this.keyActionHandler.bind(this),
8746
8763
  keyConfigs: this.keyConfigs,
@@ -8748,6 +8765,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8748
8765
  });
8749
8766
  };
8750
8767
  DropDownTree.prototype.wireTreeEvents = function () {
8768
+ if (this.keyboardModule && typeof this.keyboardModule.destroy === 'function') {
8769
+ this.keyboardModule.destroy();
8770
+ }
8751
8771
  this.keyboardModule = new KeyboardEvents(this.tree, {
8752
8772
  keyAction: this.treeAction.bind(this),
8753
8773
  keyConfigs: this.keyConfigs,
@@ -8772,7 +8792,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8772
8792
  EventHandler.remove(this.inputWrapper, 'mousemove', this.mouseIn);
8773
8793
  EventHandler.remove(this.inputWrapper, 'mouseout', this.onMouseLeave);
8774
8794
  EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
8775
- EventHandler.remove(window, 'resize', this.windowResize);
8795
+ EventHandler.remove(window, 'resize', this.windowResizeContext);
8776
8796
  var formElement = closest(this.inputWrapper, 'form');
8777
8797
  if (formElement) {
8778
8798
  EventHandler.remove(formElement, 'reset', this.resetValueHandler);
@@ -18566,7 +18586,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18566
18586
  this.virtualSelectAll = true;
18567
18587
  length = this.virtualSelectAllData && this.virtualSelectAllData.length !== 0 ? this.virtualSelectAllData.length : length;
18568
18588
  this.listData = this.virtualSelectAllData;
18569
- var ulElement = this.createListItems(this.virtualSelectAllData.slice(0, 30), this.fields);
18589
+ var ulElement = this.createListItems(this.virtualSelectAllData.slice(0, Math.min(50, this.virtualSelectAllData.length)), this.fields);
18570
18590
  var firstItems = ulElement.querySelectorAll('li');
18571
18591
  var fragment_1 = document.createDocumentFragment();
18572
18592
  firstItems.forEach(function (node) {
@@ -18593,7 +18613,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18593
18613
  this.updateListSelection(concatenatedNodeList[index], event, length - index);
18594
18614
  }
18595
18615
  else {
18596
- var value = getValue(this.fields.value ? this.fields.value : '', this.virtualSelectAllData[index]);
18616
+ var rawItem = this.virtualSelectAllData[index];
18617
+ var value = this.fields.value
18618
+ ? getValue(this.fields.value, rawItem)
18619
+ : (typeof rawItem === 'object' && rawItem !== null ? rawItem : rawItem);
18597
18620
  value = this.allowObjectBinding ? this.getDataByValue(value) : value;
18598
18621
  if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) >= 0) ||
18599
18622
  (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) >= 0))) {
@@ -18625,12 +18648,17 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18625
18648
  var batch = dataArray.slice(currentIndex, endIndex);
18626
18649
  // Use map on the batch
18627
18650
  batch.map(function (obj) {
18628
- if (_this.value && obj[_this.fields.value] != null && Array.isArray(_this.value) &&
18629
- ((!_this.allowObjectBinding && _this.value.indexOf(obj[_this.fields.value]) < 0) ||
18630
- (_this.allowObjectBinding && !_this.isObjectInArray(obj[_this.fields.value], _this.value)))) {
18631
- var value = obj[_this.fields.value];
18632
- var text = (obj[_this.fields.text]).toString();
18633
- _this.dispatchSelect(value, event, null, false, length, obj, text);
18651
+ var isPlainValue = typeof obj !== 'object' || obj === null;
18652
+ var value = isPlainValue
18653
+ ? obj
18654
+ : (_this.fields.value ? obj[_this.fields.value] : obj);
18655
+ var text = isPlainValue
18656
+ ? String(obj)
18657
+ : (_this.fields.text ? (obj[_this.fields.text]).toString() : String(obj));
18658
+ if (_this.value && value != null && Array.isArray(_this.value) &&
18659
+ ((!_this.allowObjectBinding && _this.value.indexOf(value) < 0) ||
18660
+ (_this.allowObjectBinding && !_this.isObjectInArray(value, _this.value)))) {
18661
+ _this.dispatchSelect(value, event, null, false, length, isPlainValue ? null : obj, text);
18634
18662
  }
18635
18663
  });
18636
18664
  currentIndex = endIndex;
@@ -24219,6 +24247,12 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
24219
24247
  }
24220
24248
  }
24221
24249
  var currentRange = this.getTextRange();
24250
+ // Pre-flight guard: close popup if mention character is no longer present
24251
+ if (this.isPopupOpen && currentRange !== undefined && currentRange.indexOf(this.mentionChar) === -1) {
24252
+ this.queryString = '';
24253
+ this.hidePopup();
24254
+ return;
24255
+ }
24222
24256
  // eslint-disable-next-line security/detect-non-literal-regexp
24223
24257
  var mentionRegex = new RegExp(this.mentionChar.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\s');
24224
24258
  var isValid = currentRange && mentionRegex.test(currentRange) ? false : true;