@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.
@@ -441,6 +441,9 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
441
441
  var noDataCompTemp = compiledString({}, this, templateName, templateId, this.isStringTemplate, null, ele);
442
442
  if (noDataCompTemp && noDataCompTemp.length > 0) {
443
443
  for (var i = 0; i < noDataCompTemp.length; i++) {
444
+ if (this.getModuleName() === 'listbox' && templateName === 'noRecordsTemplate') {
445
+ noDataCompTemp[i].classList.add('e-list-nr-template');
446
+ }
444
447
  ele.appendChild(noDataCompTemp[i]);
445
448
  }
446
449
  }
@@ -481,7 +484,13 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
481
484
  };
482
485
  DropDownBase.prototype.getFormattedValue = function (value) {
483
486
  if (this.listData && this.listData.length) {
484
- var item = this.typeOfData(this.listData);
487
+ var item = void 0;
488
+ if (this.properties.allowCustomValue && this.properties.value && this.properties.value instanceof Array && this.properties.value.length > 0) {
489
+ item = this.typeOfData(this.properties.value);
490
+ }
491
+ else {
492
+ item = this.typeOfData(this.listData);
493
+ }
485
494
  if (typeof getValue((this.fields.value ? this.fields.value : 'value'), item.item) === 'number'
486
495
  || item.typeof === 'number') {
487
496
  return parseFloat(value);
@@ -4582,6 +4591,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
4582
4591
  _this.isClicked = false;
4583
4592
  // Specifies if the checkAll method has been called
4584
4593
  _this.isCheckAllCalled = false;
4594
+ _this.isFromFilterChange = false;
4585
4595
  return _this;
4586
4596
  }
4587
4597
  /**
@@ -4795,6 +4805,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
4795
4805
  };
4796
4806
  DropDownTree.prototype.filterHandler = function (value, event) {
4797
4807
  var _this = this;
4808
+ this.isFromFilterChange = true;
4798
4809
  if (!this.isFilteredData) {
4799
4810
  this.treeData = this.treeObj.getTreeData();
4800
4811
  }
@@ -6071,7 +6082,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6071
6082
  this.isDocumentClick = false;
6072
6083
  e.preventDefault();
6073
6084
  }
6074
- else if (this.inputWrapper != null && !this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
6085
+ else if (!isNullOrUndefined(this.inputWrapper) && !this.inputWrapper.contains(target) && this.inputFocus && !isFilter) {
6075
6086
  this.focusOut(e);
6076
6087
  }
6077
6088
  };
@@ -6490,7 +6501,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6490
6501
  };
6491
6502
  DropDownTree.prototype.setMultiSelectValue = function (newValues) {
6492
6503
  if (!this.isFilteredData) {
6493
- this.setProperties({ value: newValues }, true);
6504
+ this.setProperties({ value: this.isFromFilterChange && newValues && newValues.length == 0 ? this.value : newValues }, true);
6505
+ this.isFromFilterChange = false;
6494
6506
  if (newValues && newValues.length !== 0 && !this.showCheckBox) {
6495
6507
  this.treeObj.selectedNodes = this.value.slice();
6496
6508
  this.treeObj.dataBind();
@@ -9293,7 +9305,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9293
9305
  this.trigger('open', eventArgs, function (eventArgs) {
9294
9306
  if (!eventArgs.cancel) {
9295
9307
  _this.focusAtFirstListItem();
9296
- document.body.appendChild(_this.popupObj.element);
9308
+ if (_this.popupObj) {
9309
+ document.body.appendChild(_this.popupObj.element);
9310
+ }
9297
9311
  if (_this.mode === 'CheckBox' && _this.enableGroupCheckBox && !isNullOrUndefined(_this.fields.groupBy)) {
9298
9312
  _this.updateListItems(_this.list.querySelectorAll('li.e-list-item'), _this.mainList.querySelectorAll('li.e-list-item'));
9299
9313
  }
@@ -9302,7 +9316,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9302
9316
  }
9303
9317
  _this.refreshPopup();
9304
9318
  _this.renderReactTemplates();
9305
- _this.popupObj.show(eventArgs.animation, (_this.zIndex === 1000) ? _this.element : null);
9319
+ if (_this.popupObj) {
9320
+ _this.popupObj.show(eventArgs.animation, (_this.zIndex === 1000) ? _this.element : null);
9321
+ }
9306
9322
  attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.inputElement.id + '_options' });
9307
9323
  _this.updateAriaActiveDescendant();
9308
9324
  if (_this.isFirstClick) {
@@ -10476,6 +10492,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
10476
10492
  this.refreshSelection();
10477
10493
  }
10478
10494
  }
10495
+ else if (!isNullOrUndefined(this.fields.groupBy) && this.value && this.value.length) {
10496
+ this.refreshSelection();
10497
+ }
10479
10498
  };
10480
10499
  MultiSelect.prototype.removeSelectedChip = function (e) {
10481
10500
  var selectedElem = this.chipCollectionWrapper.querySelector('span.' + CHIP_SELECTED);
@@ -12092,7 +12111,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12092
12111
  overAllContainer = this.componentWrapper.offsetWidth -
12093
12112
  parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
12094
12113
  parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
12095
- if ((wrapperleng + downIconWidth + this.clearIconWidth) >= overAllContainer) {
12114
+ if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
12096
12115
  if (tempData !== undefined && tempData !== '') {
12097
12116
  temp = tempData;
12098
12117
  index = tempIndex + 1;
@@ -12101,7 +12120,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12101
12120
  remaining = this.value.length - index;
12102
12121
  wrapperleng = this.viewWrapper.offsetWidth +
12103
12122
  parseInt(window.getComputedStyle(this.viewWrapper).paddingRight, 10);
12104
- while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) >= overAllContainer) && wrapperleng !== 0
12123
+ while (((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) > overAllContainer) && wrapperleng !== 0
12105
12124
  && this.viewWrapper.innerHTML !== '') {
12106
12125
  var textArr = [];
12107
12126
  this.viewWrapper.innerHTML = textArr.join(this.delimiterChar);
@@ -12111,7 +12130,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12111
12130
  }
12112
12131
  break;
12113
12132
  }
12114
- else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) < overAllContainer) {
12133
+ else if ((wrapperleng + remainSize + downIconWidth + this.clearIconWidth) <= overAllContainer) {
12115
12134
  tempData = data;
12116
12135
  tempIndex = index;
12117
12136
  }
@@ -13836,14 +13855,17 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
13836
13855
  if (this.parent.enableSelectionOrder && !isNullOrUndefined(this.parent.value)) {
13837
13856
  var activeLiCount = this.parent.ulElement.querySelectorAll('li.e-active').length;
13838
13857
  var remLi = void 0;
13839
- var ulEle = this.parent.createElement('ul', {
13858
+ var ulEle_1 = this.parent.createElement('ul', {
13840
13859
  className: 'e-list-parent e-ul e-reorder'
13841
13860
  });
13842
13861
  if (activeLiCount > 0) {
13843
- append(this.parent.ulElement.querySelectorAll('li.e-active'), ulEle);
13862
+ var activeListItems = this.parent.ulElement.querySelectorAll('li.e-active');
13863
+ activeListItems.forEach(function (item) {
13864
+ ulEle_1.appendChild(item);
13865
+ });
13844
13866
  remLi = this.parent.ulElement.querySelectorAll('li.e-active');
13845
13867
  addClass(remLi, 'e-reorder-hide');
13846
- prepend([ulEle], this.parent.list);
13868
+ prepend([ulEle_1], this.parent.list);
13847
13869
  }
13848
13870
  this.parent.focusAtFirstListItem();
13849
13871
  }
@@ -14269,13 +14291,28 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14269
14291
  var scrollParent;
14270
14292
  var boundRect;
14271
14293
  var scrollMoved = 36;
14294
+ var scrollHeight = 10;
14295
+ if (this.itemTemplate && args.target) {
14296
+ if (args.target && args.target.closest('.e-list-item')) {
14297
+ scrollHeight = args.target.closest('.e-list-item').scrollHeight;
14298
+ }
14299
+ else {
14300
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14301
+ var listItem = args.element.querySelector('.e-list-item');
14302
+ if (listItem) {
14303
+ scrollHeight = listItem.scrollHeight;
14304
+ }
14305
+ }
14306
+ }
14272
14307
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14273
14308
  var event = args.event;
14274
14309
  var wrapper;
14275
14310
  if (args.target && (args.target.classList.contains('e-listbox-wrapper') || args.target.classList.contains('e-list-item')
14276
- || args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group'))) {
14311
+ || args.target.classList.contains('e-filter-parent') || args.target.classList.contains('e-input-group')
14312
+ || args.target.closest('.e-list-item'))) {
14277
14313
  if (args.target.classList.contains('e-list-item') || args.target.classList.contains('e-filter-parent')
14278
- || args.target.classList.contains('e-input-group')) {
14314
+ || args.target.classList.contains('e-input-group')
14315
+ || args.target.closest('.e-list-item')) {
14279
14316
  wrapper = args.target.closest('.e-listbox-wrapper');
14280
14317
  }
14281
14318
  else {
@@ -14289,23 +14326,16 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14289
14326
  }
14290
14327
  boundRect = scrollParent.getBoundingClientRect();
14291
14328
  if ((boundRect.y + scrollParent.offsetHeight) - (event.pageY + scrollMoved) < 1) {
14292
- scrollParent.scrollTop = scrollParent.scrollTop + 10;
14329
+ scrollParent.scrollTop = scrollParent.scrollTop + scrollHeight;
14293
14330
  }
14294
14331
  else if ((event.pageY - scrollMoved) - boundRect.y < 1) {
14295
- scrollParent.scrollTop = scrollParent.scrollTop - 10;
14332
+ scrollParent.scrollTop = scrollParent.scrollTop - scrollHeight;
14296
14333
  }
14297
14334
  }
14298
14335
  if (args.target === null) {
14299
14336
  return;
14300
14337
  }
14301
14338
  this.trigger('drag', this.getDragArgs(args));
14302
- var listObj = this.getComponent(args.target);
14303
- if (listObj && listObj.listData.length === 0) {
14304
- var noRecElem = listObj.ulElement.childNodes[0];
14305
- if (noRecElem) {
14306
- listObj.ulElement.removeChild(noRecElem);
14307
- }
14308
- }
14309
14339
  };
14310
14340
  ListBox.prototype.beforeDragEnd = function (args) {
14311
14341
  this.dragValue = this.getFormattedValue(args.droppedElement.getAttribute('data-value'));
@@ -14339,6 +14369,13 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14339
14369
  if (Browser.isIos) {
14340
14370
  this.list.style.overflow = '';
14341
14371
  }
14372
+ var targetListObj = this.getComponent(args.target);
14373
+ if (targetListObj && targetListObj.listData.length === 0) {
14374
+ var noRecElem = targetListObj.ulElement.childNodes[0];
14375
+ if (noRecElem) {
14376
+ targetListObj.ulElement.removeChild(noRecElem);
14377
+ }
14378
+ }
14342
14379
  if (listObj === this) {
14343
14380
  var ul_1 = this.ulElement;
14344
14381
  listData = [].slice.call(this.listData);
@@ -16866,6 +16903,12 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
16866
16903
  }
16867
16904
  }
16868
16905
  append([_this.list], popupEle_1);
16906
+ if (_this.inputElement.parentElement && _this.inputElement.parentElement.parentElement &&
16907
+ _this.inputElement.parentElement.parentElement.classList.contains('e-richtexteditor')) {
16908
+ if (popupEle_1.firstElementChild && popupEle_1.firstElementChild.childElementCount > 0) {
16909
+ popupEle_1.firstElementChild.setAttribute('aria-owns', _this.inputElement.parentElement.parentElement.id);
16910
+ }
16911
+ }
16869
16912
  if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) ||
16870
16913
  !document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
16871
16914
  document.body.appendChild(popupEle_1);