@syncfusion/ej2-dropdowns 29.2.4 → 29.2.5

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.
@@ -1872,6 +1872,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1872
1872
  };
1873
1873
  /* eslint-disable @typescript-eslint/no-unused-vars */
1874
1874
  DropDownBase.prototype.onActionComplete = function (ulElement, list, e) {
1875
+ var _this = this;
1875
1876
  /* eslint-enable @typescript-eslint/no-unused-vars */
1876
1877
  this.listData = list;
1877
1878
  if (this.isVirtualizationEnabled && !this.isCustomDataUpdated && !this.virtualSelectAll) {
@@ -1901,6 +1902,13 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1901
1902
  }
1902
1903
  }
1903
1904
  }
1905
+ if (this.getModuleName() === 'multiselect' && this.isAngular && this.ngEle) {
1906
+ var popupHolder = this.list;
1907
+ if (popupHolder) {
1908
+ var prevHeight = popupHolder.offsetHeight + 'px';
1909
+ popupHolder.style.height = prevHeight;
1910
+ }
1911
+ }
1904
1912
  if (!isNullOrUndefined(this.list)) {
1905
1913
  if (!this.isVirtualizationEnabled) {
1906
1914
  this.list.innerHTML = '';
@@ -1910,6 +1918,15 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1910
1918
  this.postRender(this.list, list, this.bindEvent);
1911
1919
  }
1912
1920
  }
1921
+ if (this.getModuleName() === 'multiselect' && this.isAngular && this.ngEle) {
1922
+ var popupHolder_1 = this.list;
1923
+ if (popupHolder_1) {
1924
+ setTimeout(function () {
1925
+ popupHolder_1.style.height = '';
1926
+ _this.refreshPopup();
1927
+ }, 0);
1928
+ }
1929
+ }
1913
1930
  };
1914
1931
  /* eslint-disable @typescript-eslint/no-unused-vars */
1915
1932
  DropDownBase.prototype.postRender = function (listElement, list, bindEvent) {
@@ -4395,7 +4412,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4395
4412
  // eslint-disable-next-line @typescript-eslint/no-this-alias
4396
4413
  var proxy_1 = this;
4397
4414
  // eslint-disable-next-line max-len
4398
- var duration = (this.element.tagName === this.getNgDirective() && this.itemTemplate) ? 500 : 100;
4415
+ var duration = ((this.dataSource instanceof DataManager) && this.groupTemplate) ? 700 :
4416
+ (this.element.tagName === this.getNgDirective() && this.itemTemplate) ? 500 : 100;
4399
4417
  if (!this.isSecondClick) {
4400
4418
  setTimeout(function () {
4401
4419
  proxy_1.cloneElements();
@@ -5310,16 +5328,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5310
5328
  if (!_this.enableVirtualization) {
5311
5329
  _this.addItem(e.result, list.length);
5312
5330
  }
5313
- else {
5314
- _this.itemData = e.result[0];
5315
- var dataItem = _this.getItemData();
5316
- var value_2 = _this.allowObjectBinding ?
5317
- _this.getDataByValue(dataItem.value) : dataItem.value;
5318
- if ((_this.value === dataItem.value && _this.text !== dataItem.text) ||
5319
- (_this.value !== dataItem.value && _this.text === dataItem.text)) {
5320
- _this.setProperties({ 'text': dataItem.text ? dataItem.text.toString() : dataItem.text, 'value': value_2 });
5321
- }
5322
- }
5323
5331
  _this.updateValues();
5324
5332
  }
5325
5333
  else {
@@ -5446,10 +5454,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5446
5454
  DropDownList.prototype.addNewItem = function (listData, newElement) {
5447
5455
  var _this = this;
5448
5456
  if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
5449
- var value_3 = this.getItemData().value;
5457
+ var value_2 = this.getItemData().value;
5450
5458
  var isExist = listData.some(function (data) {
5451
- return (((typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') && data === value_3) ||
5452
- (getValue(_this.fields.value, data) === value_3));
5459
+ return (((typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') && data === value_2) ||
5460
+ (getValue(_this.fields.value, data) === value_2));
5453
5461
  });
5454
5462
  if (!isExist) {
5455
5463
  this.addItem(this.itemData);
@@ -6824,9 +6832,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6824
6832
  var listLength_2 = this_1.getItems().length;
6825
6833
  var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
6826
6834
  this_1.typedString = '';
6827
- var value_4 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
6835
+ var value_3 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
6828
6836
  getValue(checkField, newProp.value) : newProp.value;
6829
- this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_4)))
6837
+ this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_3)))
6830
6838
  .then(function (e) {
6831
6839
  if (e.result.length > 0) {
6832
6840
  _this.addItem(e.result, listLength_2);
@@ -7015,6 +7023,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7015
7023
  if (!this.enabled) {
7016
7024
  return;
7017
7025
  }
7026
+ if (this.getModuleName() === 'dropdownlist' && this.beforePopupOpen && !this.isPopupOpen) {
7027
+ this.beforePopupOpen = false;
7028
+ }
7018
7029
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
7019
7030
  if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
7020
7031
  this.renderList();
@@ -9093,7 +9104,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9093
9104
  loadOnDemand: this.treeSettings.loadOnDemand,
9094
9105
  nodeSelecting: this.onBeforeSelect.bind(this),
9095
9106
  nodeTemplate: this.itemTemplate,
9096
- checkDisabledChildren: this.treeSettings.checkDisabledChildren
9107
+ checkDisabledChildren: this.treeSettings.checkDisabledChildren,
9108
+ checkOnClick: true
9097
9109
  });
9098
9110
  this.treeObj.root = this.root ? this.root : this;
9099
9111
  this.treeObj.appendTo(this.tree);
@@ -9174,7 +9186,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9174
9186
  _this.popupObj.refreshPosition();
9175
9187
  if (!(_this.showSelectAll || _this.allowFiltering) && (!_this.popupDiv.classList.contains(NODATA)
9176
9188
  && _this.treeItems.length > 0)) {
9177
- var focusedElement = _this.value != null && _this.text != null ? _this.treeObj.element.querySelector('[data-uid="' + _this.value[0] + '"]') : null;
9189
+ var focusedElement = _this.value != null && _this.text != null ? _this.treeObj.element.querySelector('[data-uid="' + _this.value[_this.value.length - 1] + '"]') : null;
9178
9190
  if (focusedElement) {
9179
9191
  _this.treeObj.element.querySelector('li').setAttribute('tabindex', '-1');
9180
9192
  focusedElement.setAttribute('tabindex', '0');
@@ -9621,15 +9633,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9621
9633
  }
9622
9634
  var target = args.event.target;
9623
9635
  if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
9624
- this.isClicked = true;
9625
- var getNodeDetails = this.treeObj.getNode(args.node);
9626
- if (getNodeDetails.isChecked === 'true') {
9627
- this.treeObj.uncheckAll([args.node]);
9628
- }
9629
- else {
9630
- this.treeObj.checkAll([args.node]);
9631
- }
9632
- this.isClicked = false;
9633
9636
  this.setMultiSelect();
9634
9637
  this.ensurePlaceHolder();
9635
9638
  }
@@ -11219,6 +11222,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11219
11222
  }
11220
11223
  };
11221
11224
  ComboBox.prototype.updateValues = function () {
11225
+ var _this = this;
11222
11226
  if (this.fields.disabled) {
11223
11227
  if (this.value != null) {
11224
11228
  this.value = !this.isDisableItemValue(this.value) ? this.value : null;
@@ -11239,19 +11243,22 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11239
11243
  var fields = (this.fields.value) ? this.fields.value : '';
11240
11244
  var currentValue_1 = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
11241
11245
  if (this.dataSource instanceof DataManager) {
11242
- var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
11243
- if (getItem && getItem.length > 0) {
11244
- this.itemData = getItem[0];
11245
- doesItemExist = true;
11246
- var dataItem = this.getItemData();
11247
- var value = this.allowObjectBinding
11248
- ? this.getDataByValue(dataItem.value)
11249
- : dataItem.value;
11250
- if ((this.value === dataItem.value && this.text !== dataItem.text)
11251
- || (this.value !== dataItem.value && this.text === dataItem.text)) {
11252
- this.setProperties({ 'text': dataItem.text ? dataItem.text.toString() : dataItem.text, 'value': value });
11246
+ this.dataSource.executeQuery(new Query().where(new Predicate(fields, 'equal', currentValue_1)))
11247
+ .then(function (e) {
11248
+ if (e.result.length > 0) {
11249
+ _this.itemData = e.result[0];
11250
+ var dataItem = _this.getItemData();
11251
+ var value = _this.allowObjectBinding ?
11252
+ _this.getDataByValue(dataItem.value) : dataItem.value;
11253
+ if ((_this.value === dataItem.value && _this.text !== dataItem.text) ||
11254
+ (_this.value !== dataItem.value && _this.text === dataItem.text)) {
11255
+ _this.setProperties({ 'text': dataItem.text ? dataItem.text.toString() : dataItem.text, 'value': value });
11256
+ }
11253
11257
  }
11254
- }
11258
+ else {
11259
+ _this.valueMuteChange(null);
11260
+ }
11261
+ });
11255
11262
  }
11256
11263
  else {
11257
11264
  var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
@@ -11279,7 +11286,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11279
11286
  (this.allowCustom && this.enableVirtualization && !doesItemExist)) {
11280
11287
  this.valueMuteChange(this.value);
11281
11288
  }
11282
- else if (!this.enableVirtualization || (this.enableVirtualization && !doesItemExist)) {
11289
+ else if (!this.enableVirtualization || (this.enableVirtualization && !(this.dataSource instanceof DataManager)
11290
+ && !doesItemExist)) {
11283
11291
  this.valueMuteChange(null);
11284
11292
  }
11285
11293
  }
@@ -11443,7 +11451,10 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11443
11451
  }
11444
11452
  }
11445
11453
  var activeElement = activeItem.item;
11446
- if (!isNullOrUndefined(activeElement)) {
11454
+ var dataItem_1 = this.getItemData();
11455
+ if ((!isNullOrUndefined(activeElement) && !this.enableVirtualization) || (this.enableVirtualization &&
11456
+ this.isTyped && isNullOrUndefined(dataItem_1) && isNullOrUndefined(dataItem_1.value) &&
11457
+ dataItem_1.value.toString() === activeElement.getAttribute('data-value').toString())) {
11447
11458
  var count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
11448
11459
  var height = parseInt(getComputedStyle(this.liCollections[0], null).getPropertyValue('height'), 10);
11449
11460
  if (!isNaN(height) && this.getModuleName() !== 'autocomplete') {
@@ -14071,13 +14082,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14071
14082
  this.checkAndScrollParent();
14072
14083
  };
14073
14084
  MultiSelect.prototype.checkAndScrollParent = function () {
14074
- var parentElement = this.overAllWrapper ? this.overAllWrapper.parentElement : null;
14075
- if (parentElement) {
14076
- var wrapperHeight = parseFloat(getComputedStyle(this.overAllWrapper).height);
14077
- var parentMaxHeight = parseFloat(getComputedStyle(parentElement).maxHeight);
14078
- if (!isNaN(parentMaxHeight) && wrapperHeight > parentMaxHeight) {
14079
- parentElement.scrollTop = parentElement.scrollHeight;
14085
+ var scrollElement = this.overAllWrapper ? this.overAllWrapper.parentElement : null;
14086
+ while (scrollElement) {
14087
+ var scrollElementStyle = getComputedStyle(scrollElement);
14088
+ var scrollElmentHeight = parseFloat(scrollElementStyle.maxHeight) || parseFloat(scrollElementStyle.height);
14089
+ if (!isNaN(scrollElmentHeight)) {
14090
+ var overflowY = scrollElementStyle.overflowY;
14091
+ if (overflowY === 'auto' || overflowY === 'scroll') {
14092
+ scrollElement.scrollTop = scrollElement.scrollHeight;
14093
+ return;
14094
+ }
14080
14095
  }
14096
+ scrollElement = scrollElement.parentElement;
14081
14097
  }
14082
14098
  };
14083
14099
  MultiSelect.prototype.enable = function (state) {