@syncfusion/ej2-dropdowns 22.2.8 → 22.2.10

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.
@@ -283,6 +283,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
283
283
  _this.isDynamicDataChange = false;
284
284
  _this.addedNewItem = false;
285
285
  _this.isAddNewItemTemplate = false;
286
+ _this.isRequesting = false;
286
287
  return _this;
287
288
  }
288
289
  DropDownBase.prototype.getPropObject = function (prop, newProp, oldProp) {
@@ -439,24 +440,30 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
439
440
  }
440
441
  var templateName = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
441
442
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
442
- var noDataCompTemp = compiledString({}, this, templateName, templateId, this.isStringTemplate, null, ele);
443
- if (noDataCompTemp && noDataCompTemp.length > 0) {
444
- for (var i = 0; i < noDataCompTemp.length; i++) {
443
+ var noDataElement = void 0;
444
+ if ((this.isReact) && typeof template === 'function') {
445
+ noDataElement = compiledString({}, this, templateName, templateId, this.isStringTemplate, null);
446
+ }
447
+ else {
448
+ noDataElement = compiledString({}, this, templateName, templateId, this.isStringTemplate, null, ele);
449
+ }
450
+ if (noDataElement && noDataElement.length > 0) {
451
+ for (var i = 0; i < noDataElement.length; i++) {
445
452
  if (this.getModuleName() === 'listbox' && templateName === 'noRecordsTemplate') {
446
- if (noDataCompTemp[i].nodeName === '#text') {
453
+ if (noDataElement[i].nodeName === '#text') {
447
454
  var liElem = this.createElement('li');
448
- liElem.textContent = noDataCompTemp[i].textContent;
455
+ liElem.textContent = noDataElement[i].textContent;
449
456
  liElem.classList.add('e-list-nrt');
450
457
  liElem.setAttribute('role', 'option');
451
458
  ele.appendChild(liElem);
452
459
  }
453
460
  else {
454
- noDataCompTemp[i].classList.add('e-list-nr-template');
455
- ele.appendChild(noDataCompTemp[i]);
461
+ noDataElement[i].classList.add('e-list-nr-template');
462
+ ele.appendChild(noDataElement[i]);
456
463
  }
457
464
  }
458
465
  else {
459
- ele.appendChild(noDataCompTemp[i]);
466
+ ele.appendChild(noDataElement[i]);
460
467
  }
461
468
  }
462
469
  }
@@ -666,61 +673,67 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
666
673
  this.isActive = true;
667
674
  var eventArgs = { cancel: false, data: dataSource, query: query };
668
675
  this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
669
- this.trigger('actionBegin', eventArgs, function (eventArgs) {
670
- if (!eventArgs.cancel) {
671
- _this.showSpinner();
672
- if (dataSource instanceof DataManager) {
673
- _this.isRequested = true;
674
- if (_this.isDataFetched) {
675
- _this.emptyDataRequest(fields);
676
- return;
676
+ if (!this.isRequesting) {
677
+ this.trigger('actionBegin', eventArgs, function (eventArgs) {
678
+ if (!eventArgs.cancel) {
679
+ _this.isRequesting = true;
680
+ _this.showSpinner();
681
+ if (dataSource instanceof DataManager) {
682
+ _this.isRequested = true;
683
+ if (_this.isDataFetched) {
684
+ _this.emptyDataRequest(fields);
685
+ return;
686
+ }
687
+ eventArgs.data.executeQuery(_this.getQuery(eventArgs.query)).then(function (e) {
688
+ _this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
689
+ _this.trigger('actionComplete', e, function (e) {
690
+ if (!e.cancel) {
691
+ _this.isRequesting = false;
692
+ var listItems = e.result;
693
+ if (listItems.length === 0) {
694
+ _this.isDataFetched = true;
695
+ }
696
+ ulElement = _this.renderItems(listItems, fields);
697
+ _this.onActionComplete(ulElement, listItems, e);
698
+ if (_this.groupTemplate) {
699
+ _this.renderGroupTemplate(ulElement);
700
+ }
701
+ _this.isRequested = false;
702
+ _this.bindChildItems(listItems, ulElement, fields, e);
703
+ }
704
+ });
705
+ }).catch(function (e) {
706
+ _this.isRequested = false;
707
+ _this.isRequesting = false;
708
+ _this.onActionFailure(e);
709
+ _this.hideSpinner();
710
+ });
677
711
  }
678
- eventArgs.data.executeQuery(_this.getQuery(eventArgs.query)).then(function (e) {
712
+ else {
713
+ var dataManager = new DataManager(eventArgs.data);
714
+ var listItems = (_this.getQuery(eventArgs.query)).executeLocal(dataManager);
715
+ var localDataArgs = { cancel: false, result: listItems };
679
716
  _this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
680
- _this.trigger('actionComplete', e, function (e) {
681
- if (!e.cancel) {
682
- var listItems = e.result;
683
- if (listItems.length === 0) {
684
- _this.isDataFetched = true;
685
- }
686
- ulElement = _this.renderItems(listItems, fields);
687
- _this.onActionComplete(ulElement, listItems, e);
717
+ _this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
718
+ if (!localDataArgs.cancel) {
719
+ _this.isRequesting = false;
720
+ ulElement = _this.renderItems(localDataArgs.result, fields);
721
+ _this.onActionComplete(ulElement, localDataArgs.result, event);
688
722
  if (_this.groupTemplate) {
689
723
  _this.renderGroupTemplate(ulElement);
690
724
  }
691
- _this.isRequested = false;
692
- _this.bindChildItems(listItems, ulElement, fields, e);
725
+ _this.bindChildItems(localDataArgs.result, ulElement, fields);
726
+ setTimeout(function () {
727
+ if (_this.getModuleName() === 'multiselect' && _this.itemTemplate != null && (ulElement.childElementCount > 0 && (ulElement.children[0].childElementCount > 0 || (_this.fields.groupBy && ulElement.children[1] && ulElement.children[1].childElementCount > 0)))) {
728
+ _this.updateDataList();
729
+ }
730
+ });
693
731
  }
694
732
  });
695
- }).catch(function (e) {
696
- _this.isRequested = false;
697
- _this.onActionFailure(e);
698
- _this.hideSpinner();
699
- });
700
- }
701
- else {
702
- var dataManager = new DataManager(eventArgs.data);
703
- var listItems = (_this.getQuery(eventArgs.query)).executeLocal(dataManager);
704
- var localDataArgs = { cancel: false, result: listItems };
705
- _this.isPreventChange = _this.isAngular && _this.preventChange ? true : _this.isPreventChange;
706
- _this.trigger('actionComplete', localDataArgs, function (localDataArgs) {
707
- if (!localDataArgs.cancel) {
708
- ulElement = _this.renderItems(localDataArgs.result, fields);
709
- _this.onActionComplete(ulElement, localDataArgs.result, event);
710
- if (_this.groupTemplate) {
711
- _this.renderGroupTemplate(ulElement);
712
- }
713
- _this.bindChildItems(localDataArgs.result, ulElement, fields);
714
- setTimeout(function () {
715
- if (_this.getModuleName() === 'multiselect' && _this.itemTemplate != null && (ulElement.childElementCount > 0 && (ulElement.children[0].childElementCount > 0 || (_this.fields.groupBy && ulElement.children[1] && ulElement.children[1].childElementCount > 0)))) {
716
- _this.updateDataList();
717
- }
718
- });
719
- }
720
- });
733
+ }
721
734
  }
722
- }
723
- });
735
+ });
736
+ }
724
737
  };
725
738
  DropDownBase.prototype.bindChildItems = function (listItems, ulElement, fields, e) {
726
739
  var _this = this;
@@ -3049,7 +3062,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3049
3062
  this.isNotSearchList = false;
3050
3063
  return;
3051
3064
  }
3052
- if (this.isActive) {
3065
+ if (this.isActive || !isNullOrUndefined(ulElement)) {
3053
3066
  var selectedItem = this.selectedLI ? this.selectedLI.cloneNode(true) : null;
3054
3067
  _super.prototype.onActionComplete.call(this, ulElement, list, e);
3055
3068
  this.updateSelectElementData(this.allowFiltering);
@@ -3762,7 +3775,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3762
3775
  DropDownList.prototype.setFooterTemplate = function (popupEle) {
3763
3776
  var compiledString;
3764
3777
  if (this.footer) {
3765
- if (this.isReact) {
3778
+ if (this.isReact && typeof this.footerTemplate === 'function') {
3766
3779
  this.clearTemplate(['footerTemplate']);
3767
3780
  }
3768
3781
  else {
@@ -3848,6 +3861,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3848
3861
  if (this.allowFiltering && newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))) {
3849
3862
  this.actionCompleteData = { ulElement: null, list: null, isUpdated: false };
3850
3863
  this.actionData = this.actionCompleteData;
3864
+ this.itemData = null;
3851
3865
  }
3852
3866
  else if (this.allowFiltering && newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
3853
3867
  this.actionCompleteData = this.getModuleName() === 'combobox' ?
@@ -4355,6 +4369,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4355
4369
  if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
4356
4370
  this.inputElement.onchange = null;
4357
4371
  }
4372
+ if (this.isAngular) {
4373
+ this.inputElement = null;
4374
+ }
4358
4375
  _super.prototype.destroy.call(this);
4359
4376
  };
4360
4377
  /* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
@@ -7910,7 +7927,8 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7910
7927
  };
7911
7928
  ComboBox.prototype.setSearchBox = function () {
7912
7929
  this.filterInput = this.inputElement;
7913
- return (this.isFiltering() ? this.inputWrapper : inputObject$1);
7930
+ var searchBoxContainer = (this.isFiltering() || (this.isReact && this.getModuleName() === 'combobox')) ? this.inputWrapper : inputObject$1;
7931
+ return searchBoxContainer;
7914
7932
  };
7915
7933
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7916
7934
  ComboBox.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
@@ -13020,6 +13038,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13020
13038
  * @returns {void}
13021
13039
  */
13022
13040
  MultiSelect.prototype.render = function () {
13041
+ if (!isNullOrUndefined(this.value)) {
13042
+ // eslint-disable-next-line
13043
+ this.value = this.value.slice();
13044
+ }
13023
13045
  this.setDynValue = this.initStatus = false;
13024
13046
  this.isSelectAll = false;
13025
13047
  this.selectAllEventEle = [];