@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.
@@ -1567,12 +1567,25 @@ let DropDownBase = class DropDownBase extends Component {
1567
1567
  this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
1568
1568
  let isReOrder = true;
1569
1569
  if (!this.virtualSelectAll) {
1570
+ let newQueryWhereCount = 0;
1571
+ let queryWhereCount = 0;
1570
1572
  const newQuery = query.clone();
1571
1573
  for (let queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
1572
1574
  if (newQuery.queries[queryElements].fn === 'onWhere') {
1573
1575
  isWhereExist = true;
1576
+ newQueryWhereCount++;
1574
1577
  }
1575
1578
  }
1579
+ for (let queryElements = 0; !isNullOrUndefined(this.query) &&
1580
+ queryElements < this.query.queries.length; queryElements++) {
1581
+ if (this.query.queries[queryElements].fn === 'onWhere') {
1582
+ isWhereExist = true;
1583
+ queryWhereCount++;
1584
+ }
1585
+ }
1586
+ if (queryWhereCount === newQueryWhereCount) {
1587
+ isWhereExist = false;
1588
+ }
1576
1589
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1577
1590
  if (this.isVirtualizationEnabled && (e.count !== 0 && e.count < (this.itemCount * 2))) {
1578
1591
  if (newQuery) {
@@ -8078,6 +8091,7 @@ let DropDownTree = class DropDownTree extends Component {
8078
8091
  this.filterDelayTime = 300;
8079
8092
  this.isClicked = false;
8080
8093
  this.documentClickContext = this.onDocumentClick.bind(this);
8094
+ this.windowResizeContext = this.windowResize.bind(this);
8081
8095
  // Specifies if the checkAll method has been called
8082
8096
  this.isCheckAllCalled = false;
8083
8097
  this.isFromFilterChange = false;
@@ -8558,11 +8572,14 @@ let DropDownTree = class DropDownTree extends Component {
8558
8572
  EventHandler.add(this.inputWrapper, 'mousemove', this.mouseIn, this);
8559
8573
  EventHandler.add(this.inputWrapper, 'mouseout', this.onMouseLeave, this);
8560
8574
  EventHandler.add(this.overAllClear, 'mousedown', this.clearAll, this);
8561
- EventHandler.add(window, 'resize', this.windowResize, this);
8575
+ EventHandler.add(window, 'resize', this.windowResizeContext);
8562
8576
  const formElement = closest(this.inputWrapper, 'form');
8563
8577
  if (formElement) {
8564
8578
  EventHandler.add(formElement, 'reset', this.resetValueHandler, this);
8565
8579
  }
8580
+ if (this.keyboardModule && typeof this.keyboardModule.destroy === 'function') {
8581
+ this.keyboardModule.destroy();
8582
+ }
8566
8583
  this.keyboardModule = new KeyboardEvents(this.inputWrapper, {
8567
8584
  keyAction: this.keyActionHandler.bind(this),
8568
8585
  keyConfigs: this.keyConfigs,
@@ -8570,6 +8587,9 @@ let DropDownTree = class DropDownTree extends Component {
8570
8587
  });
8571
8588
  }
8572
8589
  wireTreeEvents() {
8590
+ if (this.keyboardModule && typeof this.keyboardModule.destroy === 'function') {
8591
+ this.keyboardModule.destroy();
8592
+ }
8573
8593
  this.keyboardModule = new KeyboardEvents(this.tree, {
8574
8594
  keyAction: this.treeAction.bind(this),
8575
8595
  keyConfigs: this.keyConfigs,
@@ -8594,7 +8614,7 @@ let DropDownTree = class DropDownTree extends Component {
8594
8614
  EventHandler.remove(this.inputWrapper, 'mousemove', this.mouseIn);
8595
8615
  EventHandler.remove(this.inputWrapper, 'mouseout', this.onMouseLeave);
8596
8616
  EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
8597
- EventHandler.remove(window, 'resize', this.windowResize);
8617
+ EventHandler.remove(window, 'resize', this.windowResizeContext);
8598
8618
  const formElement = closest(this.inputWrapper, 'form');
8599
8619
  if (formElement) {
8600
8620
  EventHandler.remove(formElement, 'reset', this.resetValueHandler);
@@ -18276,7 +18296,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18276
18296
  this.virtualSelectAll = true;
18277
18297
  length = this.virtualSelectAllData && this.virtualSelectAllData.length !== 0 ? this.virtualSelectAllData.length : length;
18278
18298
  this.listData = this.virtualSelectAllData;
18279
- const ulElement = this.createListItems(this.virtualSelectAllData.slice(0, 30), this.fields);
18299
+ const ulElement = this.createListItems(this.virtualSelectAllData.slice(0, Math.min(50, this.virtualSelectAllData.length)), this.fields);
18280
18300
  const firstItems = ulElement.querySelectorAll('li');
18281
18301
  const fragment = document.createDocumentFragment();
18282
18302
  firstItems.forEach((node) => {
@@ -18303,7 +18323,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18303
18323
  this.updateListSelection(concatenatedNodeList[index], event, length - index);
18304
18324
  }
18305
18325
  else {
18306
- let value = getValue(this.fields.value ? this.fields.value : '', this.virtualSelectAllData[index]);
18326
+ const rawItem = this.virtualSelectAllData[index];
18327
+ let value = this.fields.value
18328
+ ? getValue(this.fields.value, rawItem)
18329
+ : (typeof rawItem === 'object' && rawItem !== null ? rawItem : rawItem);
18307
18330
  value = this.allowObjectBinding ? this.getDataByValue(value) : value;
18308
18331
  if (((!this.allowObjectBinding && this.value && this.value.indexOf(value) >= 0) ||
18309
18332
  (this.allowObjectBinding && this.indexOfObjectInArray(value, this.value) >= 0))) {
@@ -18335,12 +18358,17 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18335
18358
  const batch = dataArray.slice(currentIndex, endIndex);
18336
18359
  // Use map on the batch
18337
18360
  batch.map((obj) => {
18338
- if (this.value && obj[this.fields.value] != null && Array.isArray(this.value) &&
18339
- ((!this.allowObjectBinding && this.value.indexOf(obj[this.fields.value]) < 0) ||
18340
- (this.allowObjectBinding && !this.isObjectInArray(obj[this.fields.value], this.value)))) {
18341
- const value = obj[this.fields.value];
18342
- const text = (obj[this.fields.text]).toString();
18343
- this.dispatchSelect(value, event, null, false, length, obj, text);
18361
+ const isPlainValue = typeof obj !== 'object' || obj === null;
18362
+ const value = isPlainValue
18363
+ ? obj
18364
+ : (this.fields.value ? obj[this.fields.value] : obj);
18365
+ const text = isPlainValue
18366
+ ? String(obj)
18367
+ : (this.fields.text ? (obj[this.fields.text]).toString() : String(obj));
18368
+ if (this.value && value != null && Array.isArray(this.value) &&
18369
+ ((!this.allowObjectBinding && this.value.indexOf(value) < 0) ||
18370
+ (this.allowObjectBinding && !this.isObjectInArray(value, this.value)))) {
18371
+ this.dispatchSelect(value, event, null, false, length, isPlainValue ? null : obj, text);
18344
18372
  }
18345
18373
  });
18346
18374
  currentIndex = endIndex;
@@ -23829,6 +23857,12 @@ let Mention = class Mention extends DropDownBase {
23829
23857
  }
23830
23858
  }
23831
23859
  const currentRange = this.getTextRange();
23860
+ // Pre-flight guard: close popup if mention character is no longer present
23861
+ if (this.isPopupOpen && currentRange !== undefined && currentRange.indexOf(this.mentionChar) === -1) {
23862
+ this.queryString = '';
23863
+ this.hidePopup();
23864
+ return;
23865
+ }
23832
23866
  // eslint-disable-next-line security/detect-non-literal-regexp
23833
23867
  const mentionRegex = new RegExp(this.mentionChar.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\s');
23834
23868
  const isValid = currentRange && mentionRegex.test(currentRange) ? false : true;