@syncfusion/ej2-dropdowns 33.1.44 → 33.1.47

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.
@@ -477,7 +477,7 @@ class VirtualScroll {
477
477
  this.parent.totalItemsCount();
478
478
  }
479
479
  if (isListUpdated) {
480
- if (this.component === 'multiselect' && this.parent.itemCount * 2 > this.parent.totalItemCount) {
480
+ if (this.component === 'multiselect' && this.parent.itemCount * 2 > this.parent.totalItemCount && !(this.parent.dataSource instanceof DataManager)) {
481
481
  this.parent.viewPortInfo.endIndex = endIndex = this.parent.totalItemCount;
482
482
  this.parent.isVirtualTrackHeight = true;
483
483
  }
@@ -1282,6 +1282,12 @@ let DropDownBase = class DropDownBase extends Component {
1282
1282
  translateY = translateY - (this.skeletonCount * this.listItemHeight);
1283
1283
  translateY = ((this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0) ||
1284
1284
  this.skeletonCount === 0) ? 0 : translateY;
1285
+ const virtualElement = this.list.getElementsByClassName('e-virtual-ddl')[0];
1286
+ const style = virtualElement && virtualElement.style && virtualElement.style.height;
1287
+ if (this.getModuleName() === 'multiselect' && !isNullOrUndefined(style) && style === '' &&
1288
+ this.dataSource instanceof DataManager) {
1289
+ translateY = 0;
1290
+ }
1285
1291
  const styleText = `transform: translate(0px, ${translateY}px);`;
1286
1292
  return styleText;
1287
1293
  }
@@ -1561,12 +1567,25 @@ let DropDownBase = class DropDownBase extends Component {
1561
1567
  this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
1562
1568
  let isReOrder = true;
1563
1569
  if (!this.virtualSelectAll) {
1570
+ let newQueryWhereCount;
1571
+ let queryWhereCount;
1564
1572
  const newQuery = query.clone();
1565
1573
  for (let queryElements = 0; queryElements < newQuery.queries.length; queryElements++) {
1566
1574
  if (newQuery.queries[queryElements].fn === 'onWhere') {
1567
1575
  isWhereExist = true;
1576
+ newQueryWhereCount++;
1568
1577
  }
1569
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
+ }
1570
1589
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1571
1590
  if (this.isVirtualizationEnabled && (e.count !== 0 && e.count < (this.itemCount * 2))) {
1572
1591
  if (newQuery) {
@@ -3626,6 +3645,11 @@ let DropDownList = class DropDownList extends DropDownBase {
3626
3645
  this.isActive = false;
3627
3646
  this.beforePopupOpen = false;
3628
3647
  }
3648
+ // Cancel any pending debounced filtering when focus leaves the component.
3649
+ if (this.debounceTimer !== null) {
3650
+ clearTimeout(this.debounceTimer);
3651
+ this.debounceTimer = null;
3652
+ }
3629
3653
  this.isFocused = false;
3630
3654
  }
3631
3655
  focusOutAction(e) {
@@ -6676,6 +6700,12 @@ let DropDownList = class DropDownList extends DropDownBase {
6676
6700
  }
6677
6701
  else {
6678
6702
  this.inputElement = this.createElement('input', { attrs: { role: 'combobox', type: 'text' } });
6703
+ if (this.element.tagName === this.getNgDirective()) {
6704
+ // Pre-populate id so Input.createInput/createFloatingInput can wire label.for correctly
6705
+ const ngId = this.element.getAttribute('id') ? this.element.getAttribute('id') : getUniqueID('ej2_dropdownlist');
6706
+ this.element.id = ngId;
6707
+ this.inputElement.id = ngId + '_input';
6708
+ }
6679
6709
  if (this.element.tagName !== this.getNgDirective()) {
6680
6710
  this.element.style.display = 'none';
6681
6711
  }
@@ -6739,6 +6769,9 @@ let DropDownList = class DropDownList extends DropDownBase {
6739
6769
  const id = this.element.getAttribute('id') ? this.element.getAttribute('id') : getUniqueID('ej2_dropdownlist');
6740
6770
  this.element.id = id;
6741
6771
  this.hiddenElement.id = id + '_hidden';
6772
+ if (this.element.tagName === this.getNgDirective() && !this.inputElement.id) {
6773
+ this.inputElement.id = id + '_input';
6774
+ }
6742
6775
  this.targetElement().setAttribute('tabindex', this.tabIndex);
6743
6776
  if ((this.getModuleName() === 'autocomplete' || this.getModuleName() === 'combobox') && !this.readonly) {
6744
6777
  if (!this.inputElement.hasAttribute('aria-label')) {
@@ -8058,6 +8091,7 @@ let DropDownTree = class DropDownTree extends Component {
8058
8091
  this.filterDelayTime = 300;
8059
8092
  this.isClicked = false;
8060
8093
  this.documentClickContext = this.onDocumentClick.bind(this);
8094
+ this.windowResizeContext = this.windowResize.bind(this);
8061
8095
  // Specifies if the checkAll method has been called
8062
8096
  this.isCheckAllCalled = false;
8063
8097
  this.isFromFilterChange = false;
@@ -8538,7 +8572,7 @@ let DropDownTree = class DropDownTree extends Component {
8538
8572
  EventHandler.add(this.inputWrapper, 'mousemove', this.mouseIn, this);
8539
8573
  EventHandler.add(this.inputWrapper, 'mouseout', this.onMouseLeave, this);
8540
8574
  EventHandler.add(this.overAllClear, 'mousedown', this.clearAll, this);
8541
- EventHandler.add(window, 'resize', this.windowResize, this);
8575
+ EventHandler.add(window, 'resize', this.windowResizeContext);
8542
8576
  const formElement = closest(this.inputWrapper, 'form');
8543
8577
  if (formElement) {
8544
8578
  EventHandler.add(formElement, 'reset', this.resetValueHandler, this);
@@ -8574,7 +8608,7 @@ let DropDownTree = class DropDownTree extends Component {
8574
8608
  EventHandler.remove(this.inputWrapper, 'mousemove', this.mouseIn);
8575
8609
  EventHandler.remove(this.inputWrapper, 'mouseout', this.onMouseLeave);
8576
8610
  EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
8577
- EventHandler.remove(window, 'resize', this.windowResize);
8611
+ EventHandler.remove(window, 'resize', this.windowResizeContext);
8578
8612
  const formElement = closest(this.inputWrapper, 'form');
8579
8613
  if (formElement) {
8580
8614
  EventHandler.remove(formElement, 'reset', this.resetValueHandler);
@@ -13128,9 +13162,15 @@ function createFloatLabel(overAllWrapper, searchWrapper, element, inputElement,
13128
13162
  const floatLabelElement = createElement('label', { className: FLOATTEXT });
13129
13163
  const id = element.getAttribute('id') ? element.getAttribute('id') : getUniqueID('ej2_multiselect');
13130
13164
  element.id = id;
13165
+ let isAngularComponent = false;
13166
+ if (element.tagName && element.tagName.indexOf('EJS-') === 0 && inputElement.id === '' && element !== inputElement) {
13167
+ inputElement.id = id + '_input';
13168
+ isAngularComponent = true;
13169
+ }
13131
13170
  if (!isNullOrUndefined(element.id) && element.id !== '') {
13132
- floatLabelElement.id = 'label_' + element.id.replace(/ /g, '_');
13133
- floatLabelElement.setAttribute('for', element.id);
13171
+ const labelTarget = isAngularComponent ? inputElement.id || element.id : element.id;
13172
+ floatLabelElement.id = 'label_' + labelTarget.replace(/ /g, '_');
13173
+ floatLabelElement.setAttribute('for', labelTarget);
13134
13174
  attributes(inputElement, { 'aria-labelledby': floatLabelElement.id });
13135
13175
  }
13136
13176
  if (!isNullOrUndefined(inputElement.placeholder) && inputElement.placeholder !== '') {
@@ -15739,6 +15779,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15739
15779
  selectedChips[0].removeAttribute('id');
15740
15780
  if (!isNullOrUndefined(this.inputElement) && this.inputElement.hasAttribute('aria-activedescendant')) {
15741
15781
  this.inputElement.removeAttribute('aria-activedescendant');
15782
+ if (!this.inputElement.hasAttribute('aria-describedby') && this.chipCollectionWrapper.id) {
15783
+ this.inputElement.setAttribute('aria-describedby', this.chipCollectionWrapper.id);
15784
+ }
15742
15785
  }
15743
15786
  }
15744
15787
  this.removeChipFocus();
@@ -15750,6 +15793,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15750
15793
  element.setAttribute('id', this.element.id + '_chip_item');
15751
15794
  if (!isNullOrUndefined(this.inputElement) && element.id) {
15752
15795
  this.inputElement.setAttribute('aria-activedescendant', element.id);
15796
+ if (this.inputElement.hasAttribute('aria-describedby')) {
15797
+ this.inputElement.removeAttribute('aria-describedby');
15798
+ }
15753
15799
  }
15754
15800
  const chipClose = element.querySelector('span.' + CHIP_CLOSE$1.split(' ')[0]);
15755
15801
  if (chipClose) {
@@ -18250,9 +18296,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18250
18296
  firstItems.forEach((node) => {
18251
18297
  fragment.appendChild(node.cloneNode(true));
18252
18298
  });
18253
- li.forEach((node) => {
18254
- fragment.appendChild(node.cloneNode(true));
18255
- });
18299
+ if ((this.totalItemCount >= (this.itemCount * 2) && this.dataSource instanceof DataManager)) {
18300
+ li.forEach((node) => {
18301
+ fragment.appendChild(node.cloneNode(true));
18302
+ });
18303
+ }
18256
18304
  const concatenatedNodeList = fragment.childNodes;
18257
18305
  if (this.virtualSelectAllData instanceof Array) {
18258
18306
  while (index < length && index <= 50 && index < count) {
@@ -19146,7 +19194,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
19146
19194
  this.renderItems(this.mainData, this.fields);
19147
19195
  }
19148
19196
  this.virtualCustomData = null;
19149
- this.isVirtualTrackHeight = this.totalItemCount >= (this.itemCount * 2) ? false : true;
19197
+ this.isVirtualTrackHeight = (this.totalItemCount >= (this.itemCount * 2) ||
19198
+ this.dataSource instanceof DataManager) ? false : true;
19150
19199
  }
19151
19200
  });
19152
19201
  }
@@ -19360,7 +19409,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
19360
19409
  }
19361
19410
  else {
19362
19411
  this.chipCollectionWrapper = this.createElement('span', {
19363
- className: CHIP_WRAPPER$1, attrs: { role: 'listbox' }
19412
+ className: CHIP_WRAPPER$1
19364
19413
  });
19365
19414
  this.chipCollectionWrapper.style.display = 'none';
19366
19415
  if (this.mode === 'Default') {
@@ -23794,6 +23843,12 @@ let Mention = class Mention extends DropDownBase {
23794
23843
  }
23795
23844
  }
23796
23845
  const currentRange = this.getTextRange();
23846
+ // Pre-flight guard: close popup if mention character is no longer present
23847
+ if (this.isPopupOpen && currentRange !== undefined && currentRange.indexOf(this.mentionChar) === -1) {
23848
+ this.queryString = '';
23849
+ this.hidePopup();
23850
+ return;
23851
+ }
23797
23852
  // eslint-disable-next-line security/detect-non-literal-regexp
23798
23853
  const mentionRegex = new RegExp(this.mentionChar.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\s');
23799
23854
  const isValid = currentRange && mentionRegex.test(currentRange) ? false : true;