@syncfusion/ej2-dropdowns 29.2.4 → 29.2.7

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();
@@ -5256,6 +5274,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5256
5274
  }
5257
5275
  if (this.getInitialData) {
5258
5276
  this.updateActionCompleteDataValues(ulElement, list);
5277
+ if (this.enableVirtualization) {
5278
+ this.updateSelectElementData(this.allowFiltering);
5279
+ }
5259
5280
  this.getInitialData = false;
5260
5281
  this.isReactTemplateUpdate = true;
5261
5282
  this.searchLists(this.filterArgs);
@@ -5310,16 +5331,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5310
5331
  if (!_this.enableVirtualization) {
5311
5332
  _this.addItem(e.result, list.length);
5312
5333
  }
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
5334
  _this.updateValues();
5324
5335
  }
5325
5336
  else {
@@ -5446,10 +5457,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5446
5457
  DropDownList.prototype.addNewItem = function (listData, newElement) {
5447
5458
  var _this = this;
5448
5459
  if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
5449
- var value_3 = this.getItemData().value;
5460
+ var value_2 = this.getItemData().value;
5450
5461
  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));
5462
+ return (((typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean') && data === value_2) ||
5463
+ (getValue(_this.fields.value, data) === value_2));
5453
5464
  });
5454
5465
  if (!isExist) {
5455
5466
  this.addItem(this.itemData);
@@ -6270,6 +6281,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6270
6281
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6271
6282
  dataSourceCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
6272
6283
  }
6284
+ this.customFilterQuery = null;
6273
6285
  if (this.enableVirtualization && this.isFiltering() && isFilterValue && this.totalItemCount !== dataSourceCount) {
6274
6286
  this.updateInitialData();
6275
6287
  this.checkAndResetCache();
@@ -6824,9 +6836,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
6824
6836
  var listLength_2 = this_1.getItems().length;
6825
6837
  var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
6826
6838
  this_1.typedString = '';
6827
- var value_4 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
6839
+ var value_3 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ?
6828
6840
  getValue(checkField, newProp.value) : newProp.value;
6829
- this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_4)))
6841
+ this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_3)))
6830
6842
  .then(function (e) {
6831
6843
  if (e.result.length > 0) {
6832
6844
  _this.addItem(e.result, listLength_2);
@@ -7015,6 +7027,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
7015
7027
  if (!this.enabled) {
7016
7028
  return;
7017
7029
  }
7030
+ if (this.getModuleName() === 'dropdownlist' && this.beforePopupOpen && !this.isPopupOpen) {
7031
+ this.beforePopupOpen = false;
7032
+ }
7018
7033
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
7019
7034
  if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
7020
7035
  this.renderList();
@@ -9093,7 +9108,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9093
9108
  loadOnDemand: this.treeSettings.loadOnDemand,
9094
9109
  nodeSelecting: this.onBeforeSelect.bind(this),
9095
9110
  nodeTemplate: this.itemTemplate,
9096
- checkDisabledChildren: this.treeSettings.checkDisabledChildren
9111
+ checkDisabledChildren: this.treeSettings.checkDisabledChildren,
9112
+ checkOnClick: true
9097
9113
  });
9098
9114
  this.treeObj.root = this.root ? this.root : this;
9099
9115
  this.treeObj.appendTo(this.tree);
@@ -9174,7 +9190,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9174
9190
  _this.popupObj.refreshPosition();
9175
9191
  if (!(_this.showSelectAll || _this.allowFiltering) && (!_this.popupDiv.classList.contains(NODATA)
9176
9192
  && _this.treeItems.length > 0)) {
9177
- var focusedElement = _this.value != null && _this.text != null ? _this.treeObj.element.querySelector('[data-uid="' + _this.value[0] + '"]') : null;
9193
+ var focusedElement = _this.value != null && _this.text != null ? _this.treeObj.element.querySelector('[data-uid="' + _this.value[_this.value.length - 1] + '"]') : null;
9178
9194
  if (focusedElement) {
9179
9195
  _this.treeObj.element.querySelector('li').setAttribute('tabindex', '-1');
9180
9196
  focusedElement.setAttribute('tabindex', '0');
@@ -9621,15 +9637,6 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9621
9637
  }
9622
9638
  var target = args.event.target;
9623
9639
  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
9640
  this.setMultiSelect();
9634
9641
  this.ensurePlaceHolder();
9635
9642
  }
@@ -11219,6 +11226,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11219
11226
  }
11220
11227
  };
11221
11228
  ComboBox.prototype.updateValues = function () {
11229
+ var _this = this;
11222
11230
  if (this.fields.disabled) {
11223
11231
  if (this.value != null) {
11224
11232
  this.value = !this.isDisableItemValue(this.value) ? this.value : null;
@@ -11239,19 +11247,22 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11239
11247
  var fields = (this.fields.value) ? this.fields.value : '';
11240
11248
  var currentValue_1 = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
11241
11249
  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 });
11250
+ this.dataSource.executeQuery(new Query().where(new Predicate(fields, 'equal', currentValue_1)))
11251
+ .then(function (e) {
11252
+ if (e.result.length > 0) {
11253
+ _this.itemData = e.result[0];
11254
+ var dataItem = _this.getItemData();
11255
+ var value = _this.allowObjectBinding ?
11256
+ _this.getDataByValue(dataItem.value) : dataItem.value;
11257
+ if ((_this.value === dataItem.value && _this.text !== dataItem.text) ||
11258
+ (_this.value !== dataItem.value && _this.text === dataItem.text)) {
11259
+ _this.setProperties({ 'text': dataItem.text ? dataItem.text.toString() : dataItem.text, 'value': value });
11260
+ }
11253
11261
  }
11254
- }
11262
+ else {
11263
+ _this.valueMuteChange(null);
11264
+ }
11265
+ });
11255
11266
  }
11256
11267
  else {
11257
11268
  var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue_1)));
@@ -11279,7 +11290,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11279
11290
  (this.allowCustom && this.enableVirtualization && !doesItemExist)) {
11280
11291
  this.valueMuteChange(this.value);
11281
11292
  }
11282
- else if (!this.enableVirtualization || (this.enableVirtualization && !doesItemExist)) {
11293
+ else if (!this.enableVirtualization || (this.enableVirtualization && !(this.dataSource instanceof DataManager)
11294
+ && !doesItemExist)) {
11283
11295
  this.valueMuteChange(null);
11284
11296
  }
11285
11297
  }
@@ -11443,7 +11455,10 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
11443
11455
  }
11444
11456
  }
11445
11457
  var activeElement = activeItem.item;
11446
- if (!isNullOrUndefined(activeElement)) {
11458
+ var dataItem_1 = this.getItemData();
11459
+ if ((!isNullOrUndefined(activeElement) && !this.enableVirtualization) || (this.enableVirtualization &&
11460
+ this.isTyped && isNullOrUndefined(dataItem_1) && isNullOrUndefined(dataItem_1.value) &&
11461
+ dataItem_1.value.toString() === activeElement.getAttribute('data-value').toString())) {
11447
11462
  var count = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
11448
11463
  var height = parseInt(getComputedStyle(this.liCollections[0], null).getPropertyValue('height'), 10);
11449
11464
  if (!isNaN(height) && this.getModuleName() !== 'autocomplete') {
@@ -14071,13 +14086,20 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14071
14086
  this.checkAndScrollParent();
14072
14087
  };
14073
14088
  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;
14089
+ var scrollElement = this.overAllWrapper ? this.overAllWrapper.parentElement : null;
14090
+ while (scrollElement) {
14091
+ var scrollElementStyle = getComputedStyle(scrollElement);
14092
+ var scrollElmentHeight = parseFloat(scrollElementStyle.maxHeight) || parseFloat(scrollElementStyle.height);
14093
+ if (!isNaN(scrollElmentHeight) && this.isPopupOpen()) {
14094
+ var overflowY = scrollElementStyle.overflowY;
14095
+ var wrapperBottom = this.overAllWrapper.getBoundingClientRect().bottom;
14096
+ var scrollElementBottom = scrollElement.getBoundingClientRect().bottom;
14097
+ if ((overflowY === 'auto' || overflowY === 'scroll') && wrapperBottom > scrollElementBottom) {
14098
+ scrollElement.scrollTop += (wrapperBottom - scrollElementBottom) + 10;
14099
+ return;
14100
+ }
14080
14101
  }
14102
+ scrollElement = scrollElement.parentElement;
14081
14103
  }
14082
14104
  };
14083
14105
  MultiSelect.prototype.enable = function (state) {