@syncfusion/ej2-dropdowns 29.2.11 → 30.1.39

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.
Files changed (39) hide show
  1. package/.eslintrc.json +2 -0
  2. package/dist/ej2-dropdowns.min.js +2 -2
  3. package/dist/ej2-dropdowns.umd.min.js +2 -2
  4. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-dropdowns.es2015.js +88 -45
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +90 -48
  8. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  9. package/dist/global/ej2-dropdowns.min.js +2 -2
  10. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/license +1 -1
  13. package/package.json +8 -8
  14. package/src/auto-complete/auto-complete.d.ts +1 -1
  15. package/src/auto-complete/auto-complete.js +22 -22
  16. package/src/combo-box/combo-box.js +1 -1
  17. package/src/common/incremental-search.js +1 -1
  18. package/src/drop-down-list/drop-down-list.d.ts +1 -0
  19. package/src/drop-down-list/drop-down-list.js +21 -4
  20. package/src/drop-down-tree/drop-down-tree-model.d.ts +1 -1
  21. package/src/drop-down-tree/drop-down-tree.d.ts +1 -0
  22. package/src/drop-down-tree/drop-down-tree.js +10 -2
  23. package/src/mention/mention.d.ts +0 -1
  24. package/src/mention/mention.js +13 -10
  25. package/src/multi-select/multi-select.js +23 -9
  26. package/styles/bootstrap5-dark-lite.css +1 -1
  27. package/styles/bootstrap5-dark.css +1 -1
  28. package/styles/bootstrap5-lite.css +1 -1
  29. package/styles/bootstrap5.css +1 -1
  30. package/styles/drop-down-tree/_bootstrap5-definition.scss +1 -1
  31. package/styles/drop-down-tree/_material3-definition.scss +2 -2
  32. package/styles/drop-down-tree/bootstrap5-dark.css +1 -1
  33. package/styles/drop-down-tree/bootstrap5.css +1 -1
  34. package/styles/drop-down-tree/material3-dark.css +4 -4
  35. package/styles/drop-down-tree/material3.css +4 -4
  36. package/styles/material3-dark-lite.css +3 -3
  37. package/styles/material3-dark.css +4 -4
  38. package/styles/material3-lite.css +3 -3
  39. package/styles/material3.css +4 -4
@@ -136,7 +136,7 @@ function Search(inputVal, items, searchType, ignoreCase, dataSource, fields, typ
136
136
  const listItems = items;
137
137
  ignoreCase = ignoreCase !== undefined && ignoreCase !== null ? ignoreCase : true;
138
138
  const itemData = { item: null, index: null };
139
- if (inputVal && inputVal.length) {
139
+ if (inputVal && inputVal.length && items) {
140
140
  const strLength = inputVal.length;
141
141
  let queryStr = ignoreCase ? inputVal.toLocaleLowerCase() : inputVal;
142
142
  queryStr = escapeCharRegExp(queryStr);
@@ -2958,6 +2958,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2958
2958
  initializeData() {
2959
2959
  this.isPopupOpen = false;
2960
2960
  this.isDocumentClick = false;
2961
+ this.isPopupRender = false;
2961
2962
  this.isInteracted = false;
2962
2963
  this.isFilterFocus = false;
2963
2964
  this.beforePopupOpen = false;
@@ -4288,7 +4289,8 @@ let DropDownList = class DropDownList extends DropDownBase {
4288
4289
  e.preventDefault();
4289
4290
  }
4290
4291
  if (!this.readonly) {
4291
- if (this.isPopupOpen) {
4292
+ if (this.isPopupOpen || (this.popupObj && document.body.contains(this.popupObj.element) &&
4293
+ this.beforePopupOpen && this.isPopupRender)) {
4292
4294
  this.hidePopup(e);
4293
4295
  if (this.isFilterLayout()) {
4294
4296
  this.focusDropDown(e);
@@ -5163,6 +5165,7 @@ let DropDownList = class DropDownList extends DropDownBase {
5163
5165
  }
5164
5166
  this.getInitialData = false;
5165
5167
  this.isReactTemplateUpdate = true;
5168
+ this.typedString = this.filterInput.value;
5166
5169
  this.searchLists(this.filterArgs);
5167
5170
  return;
5168
5171
  }
@@ -5437,10 +5440,21 @@ let DropDownList = class DropDownList extends DropDownBase {
5437
5440
  document.body.appendChild(popupEle);
5438
5441
  popupEle.style.top = '0px';
5439
5442
  initialPopupHeight = popupEle.clientHeight;
5440
- if (this.enableVirtualization && this.itemTemplate) {
5443
+ if (this.enableVirtualization && (this.itemTemplate || this.isAngular)) {
5441
5444
  const listitems = popupEle.querySelectorAll('li.e-list-item:not(.e-virtual-list)');
5442
- this.listItemHeight = listitems.length > 0 ? Math.ceil(listitems[0].getBoundingClientRect().height) +
5443
- parseInt(window.getComputedStyle(listitems[0]).marginBottom, 10) : 0;
5445
+ const virtualListitems = popupEle.querySelectorAll('li.e-virtual-list');
5446
+ const listitemsHeight = listitems && listitems.length > 0 ?
5447
+ Math.ceil(listitems[0].getBoundingClientRect().height) +
5448
+ parseInt(window.getComputedStyle(listitems[0]).marginBottom, 10) : 0;
5449
+ const VirtualLiHeight = virtualListitems && virtualListitems.length > 0 ?
5450
+ Math.ceil(virtualListitems[0].getBoundingClientRect().height) +
5451
+ parseInt(window.getComputedStyle(virtualListitems[0]).marginBottom, 10) : 0;
5452
+ if (listitemsHeight !== VirtualLiHeight && virtualListitems && virtualListitems.length > 0) {
5453
+ virtualListitems.forEach((item) => {
5454
+ item.parentNode.removeChild(item);
5455
+ });
5456
+ }
5457
+ this.listItemHeight = listitemsHeight;
5444
5458
  }
5445
5459
  if (this.enableVirtualization && !this.list.classList.contains(dropDownBaseClasses.noData)) {
5446
5460
  this.getSkeletonCount();
@@ -5602,6 +5616,7 @@ let DropDownList = class DropDownList extends DropDownBase {
5602
5616
  }
5603
5617
  if (!isNullOrUndefined(this.popupObj)) {
5604
5618
  this.popupObj.show(new Animation(eventArgs.animation), (this.zIndex === 1000) ? this.element : null);
5619
+ this.isPopupRender = true;
5605
5620
  }
5606
5621
  if (this.isReact) {
5607
5622
  setTimeout(() => {
@@ -6130,6 +6145,7 @@ let DropDownList = class DropDownList extends DropDownBase {
6130
6145
  this.rippleFun();
6131
6146
  }
6132
6147
  if (this.isPopupOpen) {
6148
+ this.isPopupRender = false;
6133
6149
  this.popupObj.hide(new Animation(eventArgs.animation));
6134
6150
  }
6135
6151
  else {
@@ -7138,6 +7154,7 @@ let DropDownList = class DropDownList extends DropDownBase {
7138
7154
  }
7139
7155
  this.hidePopup();
7140
7156
  if (this.popupObj) {
7157
+ this.isPopupRender = false;
7141
7158
  this.popupObj.hide();
7142
7159
  }
7143
7160
  this.unWireEvent();
@@ -8028,7 +8045,7 @@ let DropDownTree = class DropDownTree extends Component {
8028
8045
  if (this.isPopupOpen) {
8029
8046
  this.hidePopup();
8030
8047
  }
8031
- else {
8048
+ else if (!(e instanceof TouchEvent) && e.button !== 2) {
8032
8049
  this.focusIn(e);
8033
8050
  this.renderPopup();
8034
8051
  }
@@ -9006,6 +9023,7 @@ let DropDownTree = class DropDownTree extends Component {
9006
9023
  removeClass([this.popupEle], DDTHIDEICON);
9007
9024
  this.updatePopupHeight();
9008
9025
  this.popupObj.refreshPosition();
9026
+ this.checkCollision(this.popupEle);
9009
9027
  if (!(this.showSelectAll || this.allowFiltering) && (!this.popupDiv.classList.contains(NODATA)
9010
9028
  && this.treeItems.length > 0)) {
9011
9029
  let focusedElement = this.value != null && this.text != null ? this.treeObj.element.querySelector('[data-uid="' + this.value[this.value.length - 1] + '"]') : null;
@@ -9049,6 +9067,13 @@ let DropDownTree = class DropDownTree extends Component {
9049
9067
  }
9050
9068
  });
9051
9069
  }
9070
+ checkCollision(popupEle) {
9071
+ const collision = isCollide(popupEle);
9072
+ if (collision.length > 0) {
9073
+ popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
9074
+ }
9075
+ this.popupObj.resolveCollision();
9076
+ }
9052
9077
  removeFocus(focusedElement, oldFocusedElement) {
9053
9078
  if (oldFocusedElement && oldFocusedElement !== focusedElement) {
9054
9079
  oldFocusedElement.setAttribute('tabindex', '-1');
@@ -11752,7 +11777,7 @@ let ComboBox = class ComboBox extends DropDownList {
11752
11777
  this.removeFillSelection();
11753
11778
  }
11754
11779
  const dataItem = this.isSelectCustom ? { text: '' } : this.getItemData();
11755
- const text = !isNullOrUndefined(dataItem.text) ? dataItem.text.replace(/\r\n|\n|\r/g, '') : dataItem.text;
11780
+ const text = !isNullOrUndefined(dataItem.text) ? dataItem.text.toString().replace(/\r\n|\n|\r/g, '') : dataItem.text;
11756
11781
  const selected = !isNullOrUndefined(this.list) ? this.list.querySelector('.' + dropDownListClasses.selected) : null;
11757
11782
  if (this.inputElement && text === this.inputElement.value && !isNullOrUndefined(selected)) {
11758
11783
  if (this.isSelected) {
@@ -12061,6 +12086,27 @@ let AutoComplete = class AutoComplete extends ComboBox {
12061
12086
  }
12062
12087
  return filterQuery;
12063
12088
  }
12089
+ performFiltering(e) {
12090
+ const eventArgs = {
12091
+ preventDefaultAction: false,
12092
+ text: this.filterInput ? this.filterInput.value : null,
12093
+ updateData: (dataSource, query, fields) => {
12094
+ if (eventArgs.cancel) {
12095
+ return;
12096
+ }
12097
+ this.isFiltered = true;
12098
+ this.customFilterQuery = query;
12099
+ this.filterAction(dataSource, query, fields);
12100
+ },
12101
+ cancel: false
12102
+ };
12103
+ this.trigger('filtering', eventArgs, (eventArgs) => {
12104
+ if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
12105
+ this.searchList = true;
12106
+ this.filterAction(this.dataSource, null, this.fields, e);
12107
+ }
12108
+ });
12109
+ }
12064
12110
  searchLists(e) {
12065
12111
  this.isTyped = true;
12066
12112
  this.isDataFetched = this.isSelectCustom = false;
@@ -12086,27 +12132,6 @@ let AutoComplete = class AutoComplete extends ComboBox {
12086
12132
  this.performFiltering(e);
12087
12133
  }
12088
12134
  }
12089
- performFiltering(e) {
12090
- const eventArgs = {
12091
- preventDefaultAction: false,
12092
- text: this.filterInput.value,
12093
- updateData: (dataSource, query, fields) => {
12094
- if (eventArgs.cancel) {
12095
- return;
12096
- }
12097
- this.isFiltered = true;
12098
- this.customFilterQuery = query;
12099
- this.filterAction(dataSource, query, fields);
12100
- },
12101
- cancel: false
12102
- };
12103
- this.trigger('filtering', eventArgs, (eventArgs) => {
12104
- if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
12105
- this.searchList = true;
12106
- this.filterAction(this.dataSource, null, this.fields, e);
12107
- }
12108
- });
12109
- }
12110
12135
  /**
12111
12136
  * To filter the data from given data source by using query
12112
12137
  *
@@ -13118,7 +13143,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13118
13143
  if (this.mode === 'CheckBox' && this.allowFiltering) {
13119
13144
  this.notify('targetElement', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
13120
13145
  }
13121
- return this.targetInputElement.value;
13146
+ return this.targetInputElement ? this.targetInputElement.value : null;
13122
13147
  }
13123
13148
  getForQuery(valuecheck, isCheckbox) {
13124
13149
  let predicate;
@@ -13282,11 +13307,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13282
13307
  if (!isNullOrUndefined(this.text) && (isNullOrUndefined(this.value) || this.value.length === 0)) {
13283
13308
  this.initialTextUpdate();
13284
13309
  }
13285
- if (!this.enableVirtualization || (this.enableVirtualization && (!(this.dataSource instanceof DataManager)))) {
13286
- this.initialValueUpdate();
13310
+ if (!this.enableVirtualization) {
13311
+ if (!this.isRemoveSelection) {
13312
+ this.initialValueUpdate(this.listData, true);
13313
+ }
13314
+ else {
13315
+ this.initialValueUpdate();
13316
+ }
13287
13317
  }
13288
- else if (!this.isRemoveSelection) {
13289
- this.initialValueUpdate(this.listData, true);
13318
+ else if (!(this.dataSource instanceof DataManager)) {
13319
+ this.initialValueUpdate();
13290
13320
  }
13291
13321
  this.initialUpdate();
13292
13322
  this.refreshPlaceHolder();
@@ -15430,7 +15460,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15430
15460
  }
15431
15461
  dispatchSelect(value, eve, element, isNotTrigger, length, dataValue, text) {
15432
15462
  const list = this.listData;
15433
- if (this.initStatus && !isNotTrigger) {
15463
+ if (this.initStatus && !isNotTrigger && (!this.allowObjectBinding || (this.allowObjectBinding && value))) {
15434
15464
  value = this.allowObjectBinding ? getValue(((this.fields.value) ? this.fields.value : ''), value) : value;
15435
15465
  const val = dataValue ? dataValue : this.getDataByValue(value);
15436
15466
  const eventArgs = {
@@ -16335,7 +16365,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16335
16365
  else {
16336
16366
  if (this.listData) {
16337
16367
  if (this.enableVirtualization) {
16338
- if (delim && !this.isDynamicRemoteVirtualData) {
16368
+ if (delim && !this.isDynamicRemoteVirtualData && !isInitialVirtualData) {
16339
16369
  data = this.delimiterWrapper && this.delimiterWrapper.innerHTML === '' ? data :
16340
16370
  this.delimiterWrapper.innerHTML;
16341
16371
  }
@@ -16347,7 +16377,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16347
16377
  text = this.text.split(delimiterChar);
16348
16378
  }
16349
16379
  else {
16350
- temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
16380
+ temp = isInitialVirtualData && delim ? this.text.replace(/,/g, delimiterChar + ' ') : this.getTextByValue(value);
16351
16381
  const textValues = this.isDynamicRemoteVirtualData && value != null && value !== '' && !isInitialVirtualData ?
16352
16382
  this.getTextByValue(value) : isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + this.delimiterChar + temp : temp);
16353
16383
  data += temp + delimiterChar + ' ';
@@ -16503,6 +16533,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16503
16533
  text = this.getTextByValue(value);
16504
16534
  isCustomData = true;
16505
16535
  }
16536
+ else if ((isNullOrUndefined(text) && !this.allowCustomValue) &&
16537
+ ((!(this.dataSource instanceof DataManager)) ||
16538
+ (this.dataSource instanceof DataManager && isInitialVirtualData))) {
16539
+ this.value.splice(index, 1);
16540
+ index -= 1;
16541
+ }
16506
16542
  }
16507
16543
  else {
16508
16544
  text = this.getTextByValue(value);
@@ -18088,6 +18124,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18088
18124
  this.isaddNonPresentItems = false;
18089
18125
  }
18090
18126
  else {
18127
+ this.selectedListData = [];
18091
18128
  if (prop === 'text') {
18092
18129
  this.initialTextUpdate();
18093
18130
  newProp = this.value;
@@ -18131,7 +18168,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
18131
18168
  setTimeout(() => {
18132
18169
  this.initialValueUpdate(listItems, true);
18133
18170
  this.isDynamicRemoteVirtualData = false;
18134
- this.initialUpdate();
18171
+ if (!this.inputFocus || (this.inputFocus && this.mode !== 'Default')) {
18172
+ this.initialUpdate();
18173
+ }
18135
18174
  }, 100);
18136
18175
  }
18137
18176
  });
@@ -22421,7 +22460,6 @@ let Mention = class Mention extends DropDownBase {
22421
22460
  */
22422
22461
  constructor(options, element) {
22423
22462
  super(options, element);
22424
- this.debounceTimer = null;
22425
22463
  }
22426
22464
  /**
22427
22465
  * When property value changes happened, then onPropertyChanged method will execute the respective changes in this component.
@@ -22750,12 +22788,16 @@ let Mention = class Mention extends DropDownBase {
22750
22788
  const isValid = currentRange && mentionRegex.test(currentRange) ? false : true;
22751
22789
  let lastWordRange = this.getLastLetter(currentRange);
22752
22790
  const previousChar = currentRange ? currentRange.charAt(Math.max(0, currentRange.indexOf(this.mentionChar) - 1)) : '';
22753
- if (isValid && this.allowSpaces && currentRange && currentRange.includes(this.mentionChar) && currentRange.split(this.mentionChar).pop() !== ''
22754
- && (!this.requireLeadingSpace || (this.requireLeadingSpace && (previousChar === ' ' || currentRange.indexOf(this.mentionChar) === 0)))) {
22755
- lastWordRange = this.mentionChar + currentRange.split(this.mentionChar).pop();
22756
- }
22757
- if (!this.requireLeadingSpace && lastWordRange && lastWordRange.includes(this.mentionChar)) {
22758
- lastWordRange = this.mentionChar + lastWordRange.split(this.mentionChar).pop();
22791
+ if (!this.allowSpaces) {
22792
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22793
+ if (isValid && currentRange && currentRange.includes(this.mentionChar) && currentRange.split(this.mentionChar).pop() !== ''
22794
+ && (!this.requireLeadingSpace || (this.requireLeadingSpace && (previousChar === ' ' || currentRange.indexOf(this.mentionChar) === 0)))) {
22795
+ lastWordRange = this.mentionChar + currentRange.split(this.mentionChar).pop();
22796
+ }
22797
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22798
+ if (!this.requireLeadingSpace && lastWordRange && lastWordRange.includes(this.mentionChar)) {
22799
+ lastWordRange = this.mentionChar + lastWordRange.split(this.mentionChar).pop();
22800
+ }
22759
22801
  }
22760
22802
  const lastTwoLetters = this.mentionChar.toString() + this.mentionChar.toString();
22761
22803
  // eslint-disable-next-line security/detect-non-literal-regexp
@@ -22768,7 +22810,8 @@ let Mention = class Mention extends DropDownBase {
22768
22810
  this.hidePopup();
22769
22811
  return;
22770
22812
  }
22771
- if (((!currentRange || !lastWordRange) || (!lastWordRange.includes(this.mentionChar) && !this.requireLeadingSpace)) || e.code === 'Enter' || e.keyCode === 27 ||
22813
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22814
+ if (((!currentRange || !lastWordRange) || (!lastWordRange.includes(this.mentionChar) && !this.requireLeadingSpace && !this.allowSpaces)) || e.code === 'Enter' || e.keyCode === 27 ||
22772
22815
  (lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
22773
22816
  (this.isContentEditable(this.inputElement) && this.range.startContainer &&
22774
22817
  this.range.startContainer.previousElementSibling && this.range.startContainer.previousElementSibling.tagName !== 'BR' && this.range.startContainer.textContent.split('').length > 0 &&