@syncfusion/ej2-dropdowns 22.2.8 → 22.2.9

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.
@@ -259,6 +259,7 @@ let DropDownBase = class DropDownBase extends Component {
259
259
  this.isDynamicDataChange = false;
260
260
  this.addedNewItem = false;
261
261
  this.isAddNewItemTemplate = false;
262
+ this.isRequesting = false;
262
263
  }
263
264
  getPropObject(prop, newProp, oldProp) {
264
265
  const newProperty = new Object();
@@ -637,61 +638,67 @@ let DropDownBase = class DropDownBase extends Component {
637
638
  this.isActive = true;
638
639
  const eventArgs = { cancel: false, data: dataSource, query: query };
639
640
  this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
640
- this.trigger('actionBegin', eventArgs, (eventArgs) => {
641
- if (!eventArgs.cancel) {
642
- this.showSpinner();
643
- if (dataSource instanceof DataManager) {
644
- this.isRequested = true;
645
- if (this.isDataFetched) {
646
- this.emptyDataRequest(fields);
647
- return;
641
+ if (!this.isRequesting) {
642
+ this.trigger('actionBegin', eventArgs, (eventArgs) => {
643
+ if (!eventArgs.cancel) {
644
+ this.isRequesting = true;
645
+ this.showSpinner();
646
+ if (dataSource instanceof DataManager) {
647
+ this.isRequested = true;
648
+ if (this.isDataFetched) {
649
+ this.emptyDataRequest(fields);
650
+ return;
651
+ }
652
+ eventArgs.data.executeQuery(this.getQuery(eventArgs.query)).then((e) => {
653
+ this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
654
+ this.trigger('actionComplete', e, (e) => {
655
+ if (!e.cancel) {
656
+ this.isRequesting = false;
657
+ const listItems = e.result;
658
+ if (listItems.length === 0) {
659
+ this.isDataFetched = true;
660
+ }
661
+ ulElement = this.renderItems(listItems, fields);
662
+ this.onActionComplete(ulElement, listItems, e);
663
+ if (this.groupTemplate) {
664
+ this.renderGroupTemplate(ulElement);
665
+ }
666
+ this.isRequested = false;
667
+ this.bindChildItems(listItems, ulElement, fields, e);
668
+ }
669
+ });
670
+ }).catch((e) => {
671
+ this.isRequested = false;
672
+ this.isRequesting = false;
673
+ this.onActionFailure(e);
674
+ this.hideSpinner();
675
+ });
648
676
  }
649
- eventArgs.data.executeQuery(this.getQuery(eventArgs.query)).then((e) => {
677
+ else {
678
+ const dataManager = new DataManager(eventArgs.data);
679
+ const listItems = (this.getQuery(eventArgs.query)).executeLocal(dataManager);
680
+ const localDataArgs = { cancel: false, result: listItems };
650
681
  this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
651
- this.trigger('actionComplete', e, (e) => {
652
- if (!e.cancel) {
653
- const listItems = e.result;
654
- if (listItems.length === 0) {
655
- this.isDataFetched = true;
656
- }
657
- ulElement = this.renderItems(listItems, fields);
658
- this.onActionComplete(ulElement, listItems, e);
682
+ this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
683
+ if (!localDataArgs.cancel) {
684
+ this.isRequesting = false;
685
+ ulElement = this.renderItems(localDataArgs.result, fields);
686
+ this.onActionComplete(ulElement, localDataArgs.result, event);
659
687
  if (this.groupTemplate) {
660
688
  this.renderGroupTemplate(ulElement);
661
689
  }
662
- this.isRequested = false;
663
- this.bindChildItems(listItems, ulElement, fields, e);
690
+ this.bindChildItems(localDataArgs.result, ulElement, fields);
691
+ setTimeout(() => {
692
+ 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)))) {
693
+ this.updateDataList();
694
+ }
695
+ });
664
696
  }
665
697
  });
666
- }).catch((e) => {
667
- this.isRequested = false;
668
- this.onActionFailure(e);
669
- this.hideSpinner();
670
- });
671
- }
672
- else {
673
- const dataManager = new DataManager(eventArgs.data);
674
- const listItems = (this.getQuery(eventArgs.query)).executeLocal(dataManager);
675
- const localDataArgs = { cancel: false, result: listItems };
676
- this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
677
- this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
678
- if (!localDataArgs.cancel) {
679
- ulElement = this.renderItems(localDataArgs.result, fields);
680
- this.onActionComplete(ulElement, localDataArgs.result, event);
681
- if (this.groupTemplate) {
682
- this.renderGroupTemplate(ulElement);
683
- }
684
- this.bindChildItems(localDataArgs.result, ulElement, fields);
685
- setTimeout(() => {
686
- 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)))) {
687
- this.updateDataList();
688
- }
689
- });
690
- }
691
- });
698
+ }
692
699
  }
693
- }
694
- });
700
+ });
701
+ }
695
702
  }
696
703
  bindChildItems(listItems, ulElement, fields, e) {
697
704
  if (listItems.length >= 100 && this.getModuleName() === 'autocomplete') {
@@ -2994,7 +3001,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2994
3001
  this.isNotSearchList = false;
2995
3002
  return;
2996
3003
  }
2997
- if (this.isActive) {
3004
+ if (this.isActive || !isNullOrUndefined(ulElement)) {
2998
3005
  const selectedItem = this.selectedLI ? this.selectedLI.cloneNode(true) : null;
2999
3006
  super.onActionComplete(ulElement, list, e);
3000
3007
  this.updateSelectElementData(this.allowFiltering);
@@ -3698,7 +3705,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3698
3705
  setFooterTemplate(popupEle) {
3699
3706
  let compiledString;
3700
3707
  if (this.footer) {
3701
- if (this.isReact) {
3708
+ if (this.isReact && typeof this.footerTemplate === 'function') {
3702
3709
  this.clearTemplate(['footerTemplate']);
3703
3710
  }
3704
3711
  else {
@@ -3784,6 +3791,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3784
3791
  if (this.allowFiltering && newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))) {
3785
3792
  this.actionCompleteData = { ulElement: null, list: null, isUpdated: false };
3786
3793
  this.actionData = this.actionCompleteData;
3794
+ this.itemData = null;
3787
3795
  }
3788
3796
  else if (this.allowFiltering && newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
3789
3797
  this.actionCompleteData = this.getModuleName() === 'combobox' ?
@@ -4284,6 +4292,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4284
4292
  if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
4285
4293
  this.inputElement.onchange = null;
4286
4294
  }
4295
+ if (this.isAngular) {
4296
+ this.inputElement = null;
4297
+ }
4287
4298
  super.destroy();
4288
4299
  }
4289
4300
  /* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
@@ -7787,7 +7798,8 @@ let ComboBox = class ComboBox extends DropDownList {
7787
7798
  }
7788
7799
  setSearchBox() {
7789
7800
  this.filterInput = this.inputElement;
7790
- return (this.isFiltering() ? this.inputWrapper : inputObject$1);
7801
+ let searchBoxContainer = (this.isFiltering() || (this.isReact && this.getModuleName() === 'combobox')) ? this.inputWrapper : inputObject$1;
7802
+ return searchBoxContainer;
7791
7803
  }
7792
7804
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7793
7805
  onActionComplete(ulElement, list, e, isUpdated) {