@syncfusion/ej2-dropdowns 21.1.38 → 21.1.41

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.
@@ -414,6 +414,9 @@ let DropDownBase = class DropDownBase extends Component {
414
414
  const noDataCompTemp = compiledString({}, this, templateName, templateId, this.isStringTemplate, null, ele);
415
415
  if (noDataCompTemp && noDataCompTemp.length > 0) {
416
416
  for (let i = 0; i < noDataCompTemp.length; i++) {
417
+ if (this.getModuleName() === 'listbox' && templateName === 'noRecordsTemplate') {
418
+ noDataCompTemp[i].classList.add('e-list-nr-template');
419
+ }
417
420
  ele.appendChild(noDataCompTemp[i]);
418
421
  }
419
422
  }
@@ -454,7 +457,13 @@ let DropDownBase = class DropDownBase extends Component {
454
457
  }
455
458
  getFormattedValue(value) {
456
459
  if (this.listData && this.listData.length) {
457
- const item = this.typeOfData(this.listData);
460
+ let item;
461
+ if (this.properties.allowCustomValue && this.properties.value && this.properties.value instanceof Array && this.properties.value.length > 0) {
462
+ item = this.typeOfData(this.properties.value);
463
+ }
464
+ else {
465
+ item = this.typeOfData(this.listData);
466
+ }
458
467
  if (typeof getValue((this.fields.value ? this.fields.value : 'value'), item.item) === 'number'
459
468
  || item.typeof === 'number') {
460
469
  return parseFloat(value);
@@ -4486,6 +4495,7 @@ let DropDownTree = class DropDownTree extends Component {
4486
4495
  this.isClicked = false;
4487
4496
  // Specifies if the checkAll method has been called
4488
4497
  this.isCheckAllCalled = false;
4498
+ this.isFromFilterChange = false;
4489
4499
  }
4490
4500
  /**
4491
4501
  * Get the properties to be maintained in the persisted state.
@@ -4696,6 +4706,7 @@ let DropDownTree = class DropDownTree extends Component {
4696
4706
  }
4697
4707
  }
4698
4708
  filterHandler(value, event) {
4709
+ this.isFromFilterChange = true;
4699
4710
  if (!this.isFilteredData) {
4700
4711
  this.treeData = this.treeObj.getTreeData();
4701
4712
  }
@@ -5964,7 +5975,7 @@ let DropDownTree = class DropDownTree extends Component {
5964
5975
  this.isDocumentClick = false;
5965
5976
  e.preventDefault();
5966
5977
  }
5967
- else if (this.inputWrapper != null && !this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
5978
+ else if (!isNullOrUndefined(this.inputWrapper) && !this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
5968
5979
  this.focusOut(e);
5969
5980
  }
5970
5981
  }
@@ -6383,7 +6394,8 @@ let DropDownTree = class DropDownTree extends Component {
6383
6394
  }
6384
6395
  setMultiSelectValue(newValues) {
6385
6396
  if (!this.isFilteredData) {
6386
- this.setProperties({ value: newValues }, true);
6397
+ this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length == 0 ? this.value : newValues }, true);
6398
+ this.isFromFilterChange = false;
6387
6399
  if (newValues && newValues.length !== 0 && !this.showCheckBox) {
6388
6400
  this.treeObj.selectedNodes = this.value.slice();
6389
6401
  this.treeObj.dataBind();
@@ -9129,7 +9141,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9129
9141
  this.trigger('open', eventArgs, (eventArgs) => {
9130
9142
  if (!eventArgs.cancel) {
9131
9143
  this.focusAtFirstListItem();
9132
- document.body.appendChild(this.popupObj.element);
9144
+ if (this.popupObj) {
9145
+ document.body.appendChild(this.popupObj.element);
9146
+ }
9133
9147
  if (this.mode === 'CheckBox' && this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
9134
9148
  this.updateListItems(this.list.querySelectorAll('li.e-list-item'), this.mainList.querySelectorAll('li.e-list-item'));
9135
9149
  }
@@ -9138,7 +9152,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9138
9152
  }
9139
9153
  this.refreshPopup();
9140
9154
  this.renderReactTemplates();
9141
- this.popupObj.show(eventArgs.animation, (this.zIndex === 1000) ? this.element : null);
9155
+ if (this.popupObj) {
9156
+ this.popupObj.show(eventArgs.animation, (this.zIndex === 1000) ? this.element : null);
9157
+ }
9142
9158
  attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
9143
9159
  this.updateAriaActiveDescendant();
9144
9160
  if (this.isFirstClick) {
@@ -10311,6 +10327,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
10311
10327
  this.refreshSelection();
10312
10328
  }
10313
10329
  }
10330
+ else if (!isNullOrUndefined(this.fields.groupBy) && this.value && this.value.length) {
10331
+ this.refreshSelection();
10332
+ }
10314
10333
  }
10315
10334
  removeSelectedChip(e) {
10316
10335
  const selectedElem = this.chipCollectionWrapper.querySelector('span.' + CHIP_SELECTED);
@@ -11919,7 +11938,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11919
11938
  overAllContainer = this.componentWrapper.offsetWidth -
11920
11939
  parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
11921
11940
  parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
11922
- if ((wrapperleng + downIconWidth + this.clearIconWidth) >= overAllContainer) {
11941
+ if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
11923
11942
  if (tempData !== undefined && tempData !== '') {
11924
11943
  temp = tempData;
11925
11944
  index = tempIndex + 1;
@@ -11928,7 +11947,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11928
11947
  remaining = this.value.length - index;
11929
11948
  wrapperleng = this.viewWrapper.offsetWidth +
11930
11949
  parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
11931
- while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) >= overAllContainer) && wrapperleng !== 0
11950
+ while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) > overAllContainer) && wrapperleng !== 0
11932
11951
  && this.viewWrapper.innerHTML !== '') {
11933
11952
  const textArr = [];
11934
11953
  this.viewWrapper.innerHTML = textArr.join(this.delimiterChar);
@@ -11938,7 +11957,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11938
11957
  }
11939
11958
  break;
11940
11959
  }
11941
- else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) < overAllContainer) {
11960
+ else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) <= overAllContainer) {
11942
11961
  tempData = data;
11943
11962
  tempIndex = index;
11944
11963
  }
@@ -13655,7 +13674,10 @@ class CheckBoxSelection {
13655
13674
  className: 'e-list-parent e-ul e-reorder'
13656
13675
  });
13657
13676
  if (activeLiCount > 0) {
13658
- append(this.parent.ulElement.querySelectorAll('li.e-active'), ulEle);
13677
+ const activeListItems = this.parent.ulElement.querySelectorAll('li.e-active');
13678
+ activeListItems.forEach(item => {
13679
+ ulEle.appendChild(item);
13680
+ });
13659
13681
  remLi = this.parent.ulElement.querySelectorAll('li.e-active');
13660
13682
  addClass(remLi, 'e-reorder-hide');
13661
13683
  prepend([ulEle], this.parent.list);
@@ -14055,13 +14077,28 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14055
14077
  let scrollParent;
14056
14078
  let boundRect;
14057
14079
  const scrollMoved = 36;
14080
+ let scrollHeight = 10;
14081
+ if (this.itemTemplate && args.target) {
14082
+ if (args.target && args.target.closest('.e-list-item')) {
14083
+ scrollHeight = args.target.closest('.e-list-item').scrollHeight;
14084
+ }
14085
+ else {
14086
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14087
+ const listItem = args.element.querySelector('.e-list-item');
14088
+ if (listItem) {
14089
+ scrollHeight = listItem.scrollHeight;
14090
+ }
14091
+ }
14092
+ }
14058
14093
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14059
14094
  const event = args.event;
14060
14095
  let wrapper;
14061
14096
  if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
14062
- || args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
14097
+ || args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group')
14098
+ || args.target.closest('.e-list-item'))) {
14063
14099
  if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
14064
- || args.target.classList.contains('e-input-group')) {
14100
+ || args.target.classList.contains('e-input-group')
14101
+ || args.target.closest('.e-list-item')) {
14065
14102
  wrapper = args.target.closest('.e-listbox-wrapper');
14066
14103
  }
14067
14104
  else {
@@ -14075,23 +14112,16 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14075
14112
  }
14076
14113
  boundRect = scrollParent.getBoundingClientRect();
14077
14114
  if ((boundRect.y + scrollParent.offsetHeight) - (event.pageY + scrollMoved) < 1) {
14078
- scrollParent.scrollTop = scrollParent.scrollTop + 10;
14115
+ scrollParent.scrollTop = scrollParent.scrollTop + scrollHeight;
14079
14116
  }
14080
14117
  else if ((event.pageY - scrollMoved) - boundRect.y < 1) {
14081
- scrollParent.scrollTop = scrollParent.scrollTop - 10;
14118
+ scrollParent.scrollTop = scrollParent.scrollTop - scrollHeight;
14082
14119
  }
14083
14120
  }
14084
14121
  if (args.target === null) {
14085
14122
  return;
14086
14123
  }
14087
14124
  this.trigger('drag', this.getDragArgs(args));
14088
- const listObj = this.getComponent(args.target);
14089
- if (listObj && listObj.listData.length === 0) {
14090
- const noRecElem = listObj.ulElement.childNodes[0];
14091
- if (noRecElem) {
14092
- listObj.ulElement.removeChild(noRecElem);
14093
- }
14094
- }
14095
14125
  }
14096
14126
  beforeDragEnd(args) {
14097
14127
  this.dragValue = this.getFormattedValue(args.droppedElement.getAttribute('data-value'));
@@ -14124,6 +14154,13 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14124
14154
  if (Browser.isIos) {
14125
14155
  this.list.style.overflow = '';
14126
14156
  }
14157
+ const targetListObj = this.getComponent(args.target);
14158
+ if (targetListObj && targetListObj.listData.length === 0) {
14159
+ const noRecElem = targetListObj.ulElement.childNodes[0];
14160
+ if (noRecElem) {
14161
+ targetListObj.ulElement.removeChild(noRecElem);
14162
+ }
14163
+ }
14127
14164
  if (listObj === this) {
14128
14165
  const ul = this.ulElement;
14129
14166
  listData = [].slice.call(this.listData);
@@ -16601,6 +16638,12 @@ let Mention = class Mention extends DropDownBase {
16601
16638
  }
16602
16639
  }
16603
16640
  append([this.list], popupEle);
16641
+ if (this.inputElement.parentElement && this.inputElement.parentElement.parentElement &&
16642
+ this.inputElement.parentElement.parentElement.classList.contains('e-richtexteditor')) {
16643
+ if (popupEle.firstElementChild && popupEle.firstElementChild.childElementCount > 0) {
16644
+ popupEle.firstElementChild.setAttribute('aria-owns', this.inputElement.parentElement.parentElement.id);
16645
+ }
16646
+ }
16604
16647
  if ((!this.popupObj || !document.body.contains(this.popupObj.element)) ||
16605
16648
  !document.contains(popupEle) && isNullOrUndefined(this.target)) {
16606
16649
  document.body.appendChild(popupEle);