@syncfusion/ej2-dropdowns 34.1.29 → 34.1.30

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 34.1.29
3
+ * version : 34.1.30
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-dropdowns",
3
- "version": "34.1.29",
3
+ "version": "34.1.30",
4
4
  "description": "Essential JS 2 DropDown Components",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,11 +8,11 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-dropdowns.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~34.1.29",
11
+ "@syncfusion/ej2-base": "~34.1.30",
12
12
  "@syncfusion/ej2-data": "~34.1.29",
13
- "@syncfusion/ej2-inputs": "~34.1.29",
14
- "@syncfusion/ej2-lists": "~34.1.29",
15
- "@syncfusion/ej2-navigations": "~34.1.29",
13
+ "@syncfusion/ej2-inputs": "~34.1.30",
14
+ "@syncfusion/ej2-lists": "~34.1.30",
15
+ "@syncfusion/ej2-navigations": "~34.1.30",
16
16
  "@syncfusion/ej2-notifications": "~34.1.29",
17
17
  "@syncfusion/ej2-popups": "~34.1.29"
18
18
  },
@@ -475,7 +475,7 @@ var ComboBox = /** @class */ (function (_super) {
475
475
  return false;
476
476
  }
477
477
  else {
478
- return _super.prototype.setValue.call(this, e);
478
+ return _super.prototype.setValue.call(this, e, this.autofill);
479
479
  }
480
480
  };
481
481
  ComboBox.prototype.checkCustomValue = function () {
@@ -38,12 +38,14 @@ export declare class VirtualScroll {
38
38
  private touchModule;
39
39
  private component;
40
40
  private scrollHandler;
41
+ private previousScrollTop;
41
42
  constructor(parent: IDropdownlist);
42
43
  addEventListener(): void;
43
44
  removeEventListener(): void;
44
45
  private bindScrollEvent;
45
46
  private observe;
46
47
  getModuleName(): string;
48
+ private isFilterScrollScenario;
47
49
  private popupScrollHandler;
48
50
  private getPageQuery;
49
51
  private setGeneratedData;
@@ -50,6 +50,7 @@ import { DataManager, Query } from '@syncfusion/ej2-data';
50
50
  var VirtualScroll = /** @class */ (function () {
51
51
  function VirtualScroll(parent) {
52
52
  var _this = this;
53
+ this.previousScrollTop = 0;
53
54
  this.sentinelInfo = {
54
55
  'up': {
55
56
  check: function (rect, info) {
@@ -110,9 +111,14 @@ var VirtualScroll = /** @class */ (function () {
110
111
  VirtualScroll.prototype.getModuleName = function () {
111
112
  return 'VirtualScroll';
112
113
  };
114
+ VirtualScroll.prototype.isFilterScrollScenario = function () {
115
+ return this.component === 'dropdownlist' && this.parent.allowFiltering;
116
+ };
113
117
  VirtualScroll.prototype.popupScrollHandler = function () {
114
118
  this.parent.isMouseScrollAction = true;
115
- this.parent.isPreventScrollAction = false;
119
+ if (!(this.isFilterScrollScenario() && this.parent.isVirtualScrolling)) {
120
+ this.parent.isPreventScrollAction = false;
121
+ }
116
122
  };
117
123
  VirtualScroll.prototype.getPageQuery = function (query, virtualStartIndex, virtualEndIndex) {
118
124
  if (virtualEndIndex !== 0 && !this.parent.allowFiltering && this.component !== 'autocomplete') {
@@ -482,7 +488,8 @@ var VirtualScroll = /** @class */ (function () {
482
488
  };
483
489
  VirtualScroll.prototype.scrollListener = function (scrollArgs) {
484
490
  var _this = this;
485
- if (!this.parent.isPreventScrollAction && !this.parent.isVirtualTrackHeight) {
491
+ var preventReentrant = this.isFilterScrollScenario() && this.parent.isVirtualScrolling;
492
+ if (!this.parent.isPreventScrollAction && !this.parent.isVirtualTrackHeight && !preventReentrant) {
486
493
  this.parent.preventSetCurrentData = false;
487
494
  var info = scrollArgs.sentinel;
488
495
  var pStartIndex = this.parent.previousStartIndex;
@@ -494,6 +501,8 @@ var VirtualScroll = /** @class */ (function () {
494
501
  this.parent.virtualListInfo = __assign({}, this.parent.viewPortInfo);
495
502
  this.parent.isPreventKeyAction = true;
496
503
  this.parent.isVirtualScrolling = true;
504
+ var savedScrollTop_1 = this.parent.popupContentElement ?
505
+ this.parent.popupContentElement.scrollTop : 0;
497
506
  setTimeout(function () {
498
507
  _this.parent.pageCount = _this.parent.getPageCount();
499
508
  _this.parent.isRequesting = false;
@@ -503,9 +512,16 @@ var VirtualScroll = /** @class */ (function () {
503
512
  _this.parent.updateSelectionList();
504
513
  _this.parent.liCollections = _this.parent.getItems();
505
514
  }
515
+ if (_this.isFilterScrollScenario()) {
516
+ var scrollContainer = _this.parent.popupContentElement || _this.parent.list;
517
+ if (scrollContainer && scrollContainer.scrollTop < savedScrollTop_1) {
518
+ scrollContainer.scrollTop = savedScrollTop_1;
519
+ }
520
+ _this.previousScrollTop = scrollContainer ? scrollContainer.scrollTop : savedScrollTop_1;
521
+ }
506
522
  _this.parent.isKeyBoardAction = false;
507
- _this.parent.isVirtualScrolling = false;
508
523
  _this.parent.isPreventKeyAction = false;
524
+ _this.parent.isVirtualScrolling = false;
509
525
  });
510
526
  }, 5);
511
527
  }
@@ -579,14 +595,17 @@ var VirtualScroll = /** @class */ (function () {
579
595
  VirtualScroll.prototype.virtualScrollHandler = function (callback) {
580
596
  var _this = this;
581
597
  var delay = Browser.info.name === 'chrome' ? 200 : 100;
582
- var prevTop = 0;
583
598
  var debounced100 = debounce(callback, delay);
584
599
  var debounced50 = debounce(callback, 50);
585
600
  return function (e) {
586
601
  var top = e.target.scrollTop;
587
602
  var left = e.target.scrollLeft;
588
- var direction = prevTop < top && !_this.parent.isUpwardScrolling ? 'down' : 'up';
589
- prevTop = top;
603
+ if (_this.isFilterScrollScenario() && (_this.parent.isVirtualScrolling || _this.parent.isPreventScrollAction)) {
604
+ _this.previousScrollTop = top;
605
+ return;
606
+ }
607
+ var direction = _this.previousScrollTop < top && !_this.parent.isUpwardScrolling ? 'down' : 'up';
608
+ _this.previousScrollTop = top;
590
609
  var current = _this.sentinelInfo[direction];
591
610
  var pstartIndex = _this.parent.scrollPreStartIndex;
592
611
  var scrollOffsetargs = {
@@ -534,7 +534,7 @@ export declare class DropDownList extends DropDownBase implements IInput {
534
534
  protected updateSelectedItem(li: Element, e: MouseEvent | KeyboardEvent | TouchEvent, preventSelect?: boolean, isSelection?: boolean): void;
535
535
  private selectEventCallback;
536
536
  protected activeItem(li: Element): void;
537
- protected setValue(e?: KeyboardEventArgs): boolean;
537
+ protected setValue(e?: KeyboardEventArgs, autofill?: boolean): boolean;
538
538
  protected setSelection(li: Element, e: MouseEvent | KeyboardEventArgs | TouchEvent): void;
539
539
  private setSelectOptions;
540
540
  private dropdownCompiler;
@@ -1594,7 +1594,7 @@ var DropDownList = /** @class */ (function (_super) {
1594
1594
  }
1595
1595
  };
1596
1596
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1597
- DropDownList.prototype.setValue = function (e) {
1597
+ DropDownList.prototype.setValue = function (e, autofill) {
1598
1598
  var dataItem = this.getItemData();
1599
1599
  this.isTouched = !isNullOrUndefined(e);
1600
1600
  if (dataItem.value === null) {
@@ -1626,7 +1626,7 @@ var DropDownList = /** @class */ (function (_super) {
1626
1626
  (this.previousValue != null && this.isObjectInArray(this.previousValue, [this.allowCustom &&
1627
1627
  this.isObjectCustomValue ? this.value ? this.value : dataItem : dataItem.value ?
1628
1628
  this.getDataByValue(dataItem.value) : dataItem])))) {
1629
- if (this.getModuleName() === 'combobox' && this.autoFill && e && (e.type === 'click' || e.action === 'enter')) {
1629
+ if (this.getModuleName() === 'combobox' && autofill && e && (e.type === 'click' || e.action === 'enter')) {
1630
1630
  return false;
1631
1631
  }
1632
1632
  this.isSelected = false;
@@ -795,6 +795,7 @@ export declare class MultiSelect extends DropDownBase implements IInput {
795
795
  private invokeCheckboxSelection;
796
796
  private removeValue;
797
797
  private updateMainList;
798
+ private isFilteringWithRemoteData;
798
799
  private removeChip;
799
800
  private setWidth;
800
801
  private updateChipStatus;
@@ -540,49 +540,154 @@ var MultiSelect = /** @class */ (function (_super) {
540
540
  MultiSelect.prototype.getForQuery = function (valuecheck, isCheckbox) {
541
541
  var predicate;
542
542
  var field = this.isPrimitiveData ? '' : this.fields.value;
543
- if (this.enableVirtualization && valuecheck) {
544
- if (isCheckbox) {
545
- var startindex = this.viewPortInfo.startIndex;
546
- var endindex = (((startindex + this.viewPortInfo.endIndex) <= (valuecheck.length)) &&
547
- valuecheck[(startindex + this.viewPortInfo.endIndex)]) &&
548
- (this.dataSource instanceof DataManager && this.totalItemCount !== 0 && this.totalItemCount > (this.itemCount * 2))
549
- ? (startindex + this.viewPortInfo.endIndex)
550
- : (valuecheck.length);
551
- for (var i = startindex; i < endindex; i++) {
552
- var value = this.allowObjectBinding ? getValue((this.fields.value) ?
553
- this.fields.value : '', valuecheck[i]) : valuecheck[i];
554
- if (i === startindex) {
555
- predicate = new Predicate(field, 'equal', (value));
543
+ if (valuecheck && valuecheck.length >= 3000) {
544
+ // Batch size to prevent stack overflow with large preselected values (EJ2-Fix-MaxCallStack)
545
+ var BATCH_SIZE = 100;
546
+ if (this.enableVirtualization) {
547
+ if (isCheckbox) {
548
+ var startindex = this.viewPortInfo.startIndex;
549
+ var endindex = (((startindex + this.viewPortInfo.endIndex) <= (valuecheck.length)) &&
550
+ valuecheck[(startindex + this.viewPortInfo.endIndex)]) &&
551
+ (this.dataSource instanceof DataManager && this.totalItemCount !== 0 && this.totalItemCount > (this.itemCount * 2))
552
+ ? (startindex + this.viewPortInfo.endIndex)
553
+ : (valuecheck.length);
554
+ // Build predicates in batches to prevent stack overflow
555
+ var predicateBatches = [];
556
+ for (var batchStart = startindex; batchStart < endindex; batchStart += BATCH_SIZE) {
557
+ var batchPredicate = void 0;
558
+ var batchEnd = Math.min(batchStart + BATCH_SIZE, endindex);
559
+ for (var i = batchStart; i < batchEnd; i++) {
560
+ var itemAtIndex = valuecheck[i];
561
+ var value = this.allowObjectBinding ? getValue((this.fields.value) ?
562
+ this.fields.value : '', itemAtIndex) : itemAtIndex;
563
+ if (i === batchStart) {
564
+ batchPredicate = new Predicate(field, 'equal', (value));
565
+ }
566
+ else {
567
+ batchPredicate = batchPredicate.or(field, 'equal', (value));
568
+ }
569
+ }
570
+ predicateBatches.push(batchPredicate);
556
571
  }
557
- else {
558
- predicate = predicate.or(field, 'equal', (value));
572
+ // Combine all batch predicates
573
+ predicate = predicateBatches[0];
574
+ for (var i = 1; i < predicateBatches.length; i++) {
575
+ predicate = predicate.or(predicateBatches[i]);
576
+ }
577
+ return new Query().where(predicate);
578
+ }
579
+ else {
580
+ // Build predicates in batches to prevent stack overflow
581
+ var predicateBatches = [];
582
+ var isAddNonPresentItems = this.isaddNonPresentItems;
583
+ for (var batchStart = 0; batchStart < valuecheck.length; batchStart += BATCH_SIZE) {
584
+ var batchPredicate = void 0;
585
+ var batchEnd = Math.min(batchStart + BATCH_SIZE, valuecheck.length);
586
+ for (var i = batchStart; i < batchEnd; i++) {
587
+ var itemAtIndex = valuecheck[i];
588
+ var value = this.allowObjectBinding ? getValue((this.fields.value) ?
589
+ this.fields.value : '', itemAtIndex) : itemAtIndex;
590
+ if (i === batchStart) {
591
+ if (isAddNonPresentItems) {
592
+ batchPredicate = new Predicate(field, 'equal', itemAtIndex);
593
+ }
594
+ else {
595
+ batchPredicate = new Predicate(field, 'notequal', (value));
596
+ }
597
+ }
598
+ else {
599
+ if (isAddNonPresentItems) {
600
+ batchPredicate = batchPredicate.or(field, 'equal', itemAtIndex);
601
+ }
602
+ else {
603
+ batchPredicate = batchPredicate.and(field, 'notequal', (value));
604
+ }
605
+ }
606
+ }
607
+ predicateBatches.push(batchPredicate);
608
+ }
609
+ // Combine batch predicates
610
+ predicate = predicateBatches[0];
611
+ for (var i = 1; i < predicateBatches.length; i++) {
612
+ if (isAddNonPresentItems) {
613
+ predicate = predicate.or(predicateBatches[i]);
614
+ }
615
+ else {
616
+ predicate = predicate.and(predicateBatches[i]);
617
+ }
559
618
  }
619
+ return new Query().where(predicate);
560
620
  }
561
- return new Query().where(predicate);
562
621
  }
563
622
  else {
564
- for (var i = 0; i < valuecheck.length; i++) {
565
- var value = this.allowObjectBinding ? getValue((this.fields.value) ?
566
- this.fields.value : '', valuecheck[i]) : valuecheck[i];
567
- if (this.isaddNonPresentItems) {
568
- predicate = i === 0 ? new Predicate(field, 'equal', valuecheck[i])
569
- : predicate.or(field, 'equal', valuecheck[i]);
570
- }
571
- else {
572
- predicate = i === 0 ? predicate = new Predicate(field, 'notequal', (value))
573
- : predicate.and(field, 'notequal', (value));
623
+ // Build predicates in batches to prevent stack overflow with large preselected values
624
+ var predicateBatches = [];
625
+ for (var batchStart = 0; batchStart < valuecheck.length; batchStart += BATCH_SIZE) {
626
+ var batchPredicate = void 0;
627
+ var batchEnd = Math.min(batchStart + BATCH_SIZE, valuecheck.length);
628
+ for (var i = batchStart; i < batchEnd; i++) {
629
+ var itemAtIndex = valuecheck[i];
630
+ if (i === batchStart) {
631
+ batchPredicate = new Predicate(field, 'equal', itemAtIndex);
632
+ }
633
+ else {
634
+ batchPredicate = batchPredicate.or(field, 'equal', itemAtIndex);
635
+ }
574
636
  }
637
+ predicateBatches.push(batchPredicate);
638
+ }
639
+ // Combine all batch predicates
640
+ predicate = predicateBatches[0];
641
+ for (var i = 1; i < predicateBatches.length; i++) {
642
+ predicate = predicate.or(predicateBatches[i]);
575
643
  }
576
- return new Query().where(predicate);
577
644
  }
578
645
  }
579
646
  else {
580
- for (var i = 0; i < valuecheck.length; i++) {
581
- if (i === 0) {
582
- predicate = new Predicate(field, 'equal', valuecheck[i]);
647
+ if (this.enableVirtualization && valuecheck) {
648
+ if (isCheckbox) {
649
+ var startindex = this.viewPortInfo.startIndex;
650
+ var endindex = (((startindex + this.viewPortInfo.endIndex) <= (valuecheck.length)) &&
651
+ valuecheck[(startindex + this.viewPortInfo.endIndex)]) &&
652
+ (this.dataSource instanceof DataManager && this.totalItemCount !== 0 && this.totalItemCount > (this.itemCount * 2))
653
+ ? (startindex + this.viewPortInfo.endIndex)
654
+ : (valuecheck.length);
655
+ for (var i = startindex; i < endindex; i++) {
656
+ var value = this.allowObjectBinding ? getValue((this.fields.value) ?
657
+ this.fields.value : '', valuecheck[i]) : valuecheck[i];
658
+ if (i === startindex) {
659
+ predicate = new Predicate(field, 'equal', (value));
660
+ }
661
+ else {
662
+ predicate = predicate.or(field, 'equal', (value));
663
+ }
664
+ }
665
+ return new Query().where(predicate);
583
666
  }
584
667
  else {
585
- predicate = predicate.or(field, 'equal', valuecheck[i]);
668
+ for (var i = 0; i < valuecheck.length; i++) {
669
+ var value = this.allowObjectBinding ? getValue((this.fields.value) ?
670
+ this.fields.value : '', valuecheck[i]) : valuecheck[i];
671
+ if (this.isaddNonPresentItems) {
672
+ predicate = i === 0 ? new Predicate(field, 'equal', valuecheck[i])
673
+ : predicate.or(field, 'equal', valuecheck[i]);
674
+ }
675
+ else {
676
+ predicate = i === 0 ? predicate = new Predicate(field, 'notequal', (value))
677
+ : predicate.and(field, 'notequal', (value));
678
+ }
679
+ }
680
+ return new Query().where(predicate);
681
+ }
682
+ }
683
+ else {
684
+ for (var i = 0; i < valuecheck.length; i++) {
685
+ if (i === 0) {
686
+ predicate = new Predicate(field, 'equal', valuecheck[i]);
687
+ }
688
+ else {
689
+ predicate = predicate.or(field, 'equal', valuecheck[i]);
690
+ }
586
691
  }
587
692
  }
588
693
  }
@@ -2858,6 +2963,9 @@ var MultiSelect = /** @class */ (function (_super) {
2858
2963
  }
2859
2964
  }
2860
2965
  };
2966
+ MultiSelect.prototype.isFilteringWithRemoteData = function () {
2967
+ return !isNullOrUndefined(this.mainData) && this.mainData.length > 0 && this.allowFiltering;
2968
+ };
2861
2969
  MultiSelect.prototype.removeChip = function (value, isClearAll) {
2862
2970
  if (this.chipCollectionWrapper) {
2863
2971
  if (!(this.enableVirtualization && isClearAll)) {
@@ -4072,6 +4180,9 @@ var MultiSelect = /** @class */ (function (_super) {
4072
4180
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[index]) :
4073
4181
  this.value[index];
4074
4182
  element = this.findListElement(this.hideSelectedItem ? this.ulElement : this.list, 'li', 'data-value', value_2);
4183
+ if (!element && !isNullOrUndefined(this.mainList) && this.isFilteringWithRemoteData()) {
4184
+ element = this.findListElement(this.mainList, 'li', 'data-value', value_2);
4185
+ }
4075
4186
  var isCustomData = false;
4076
4187
  if (this.enableVirtualization) {
4077
4188
  text = null;
@@ -4118,6 +4229,12 @@ var MultiSelect = /** @class */ (function (_super) {
4118
4229
  }
4119
4230
  else {
4120
4231
  text = this.getTextByValue(value_2);
4232
+ if (text === value_2 && this.isFilteringWithRemoteData()) {
4233
+ var savedListData = this.listData;
4234
+ this.listData = this.mainData;
4235
+ text = this.getTextByValue(value_2);
4236
+ this.listData = savedListData;
4237
+ }
4121
4238
  }
4122
4239
  if (((element && (element.getAttribute('aria-selected') !== 'true')) ||
4123
4240
  (element && (element.getAttribute('aria-selected') === 'true' && this.hideSelectedItem) &&
@@ -6400,6 +6517,8 @@ var MultiSelect = /** @class */ (function (_super) {
6400
6517
  this.chipCollectionWrapper = this.createElement('span', {
6401
6518
  className: CHIP_WRAPPER
6402
6519
  });
6520
+ this.chipCollectionWrapper.setAttribute('role', 'listbox');
6521
+ this.chipCollectionWrapper.setAttribute('aria-label', 'multiselect');
6403
6522
  this.chipCollectionWrapper.style.display = 'none';
6404
6523
  if (this.mode === 'Default') {
6405
6524
  this.chipCollectionWrapper.setAttribute('id', getUniqueID('chip_default'));