@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.
@@ -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();
@@ -412,24 +413,30 @@ let DropDownBase = class DropDownBase extends Component {
412
413
  }
413
414
  const templateName = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
414
415
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
415
- const noDataCompTemp = compiledString({}, this, templateName, templateId, this.isStringTemplate, null, ele);
416
- if (noDataCompTemp && noDataCompTemp.length > 0) {
417
- for (let i = 0; i < noDataCompTemp.length; i++) {
416
+ let noDataElement;
417
+ if ((this.isReact) && typeof template === 'function') {
418
+ noDataElement = compiledString({}, this, templateName, templateId, this.isStringTemplate, null);
419
+ }
420
+ else {
421
+ noDataElement = compiledString({}, this, templateName, templateId, this.isStringTemplate, null, ele);
422
+ }
423
+ if (noDataElement && noDataElement.length > 0) {
424
+ for (let i = 0; i < noDataElement.length; i++) {
418
425
  if (this.getModuleName() === 'listbox' && templateName === 'noRecordsTemplate') {
419
- if (noDataCompTemp[i].nodeName === '#text') {
426
+ if (noDataElement[i].nodeName === '#text') {
420
427
  const liElem = this.createElement('li');
421
- liElem.textContent = noDataCompTemp[i].textContent;
428
+ liElem.textContent = noDataElement[i].textContent;
422
429
  liElem.classList.add('e-list-nrt');
423
430
  liElem.setAttribute('role', 'option');
424
431
  ele.appendChild(liElem);
425
432
  }
426
433
  else {
427
- noDataCompTemp[i].classList.add('e-list-nr-template');
428
- ele.appendChild(noDataCompTemp[i]);
434
+ noDataElement[i].classList.add('e-list-nr-template');
435
+ ele.appendChild(noDataElement[i]);
429
436
  }
430
437
  }
431
438
  else {
432
- ele.appendChild(noDataCompTemp[i]);
439
+ ele.appendChild(noDataElement[i]);
433
440
  }
434
441
  }
435
442
  }
@@ -637,61 +644,67 @@ let DropDownBase = class DropDownBase extends Component {
637
644
  this.isActive = true;
638
645
  const eventArgs = { cancel: false, data: dataSource, query: query };
639
646
  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;
647
+ if (!this.isRequesting) {
648
+ this.trigger('actionBegin', eventArgs, (eventArgs) => {
649
+ if (!eventArgs.cancel) {
650
+ this.isRequesting = true;
651
+ this.showSpinner();
652
+ if (dataSource instanceof DataManager) {
653
+ this.isRequested = true;
654
+ if (this.isDataFetched) {
655
+ this.emptyDataRequest(fields);
656
+ return;
657
+ }
658
+ eventArgs.data.executeQuery(this.getQuery(eventArgs.query)).then((e) => {
659
+ this.isPreventChange = this.isAngular && this.preventChange ? true : this.isPreventChange;
660
+ this.trigger('actionComplete', e, (e) => {
661
+ if (!e.cancel) {
662
+ this.isRequesting = false;
663
+ const listItems = e.result;
664
+ if (listItems.length === 0) {
665
+ this.isDataFetched = true;
666
+ }
667
+ ulElement = this.renderItems(listItems, fields);
668
+ this.onActionComplete(ulElement, listItems, e);
669
+ if (this.groupTemplate) {
670
+ this.renderGroupTemplate(ulElement);
671
+ }
672
+ this.isRequested = false;
673
+ this.bindChildItems(listItems, ulElement, fields, e);
674
+ }
675
+ });
676
+ }).catch((e) => {
677
+ this.isRequested = false;
678
+ this.isRequesting = false;
679
+ this.onActionFailure(e);
680
+ this.hideSpinner();
681
+ });
648
682
  }
649
- eventArgs.data.executeQuery(this.getQuery(eventArgs.query)).then((e) => {
683
+ else {
684
+ const dataManager = new DataManager(eventArgs.data);
685
+ const listItems = (this.getQuery(eventArgs.query)).executeLocal(dataManager);
686
+ const localDataArgs = { cancel: false, result: listItems };
650
687
  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);
688
+ this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
689
+ if (!localDataArgs.cancel) {
690
+ this.isRequesting = false;
691
+ ulElement = this.renderItems(localDataArgs.result, fields);
692
+ this.onActionComplete(ulElement, localDataArgs.result, event);
659
693
  if (this.groupTemplate) {
660
694
  this.renderGroupTemplate(ulElement);
661
695
  }
662
- this.isRequested = false;
663
- this.bindChildItems(listItems, ulElement, fields, e);
696
+ this.bindChildItems(localDataArgs.result, ulElement, fields);
697
+ setTimeout(() => {
698
+ 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)))) {
699
+ this.updateDataList();
700
+ }
701
+ });
664
702
  }
665
703
  });
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
- });
704
+ }
692
705
  }
693
- }
694
- });
706
+ });
707
+ }
695
708
  }
696
709
  bindChildItems(listItems, ulElement, fields, e) {
697
710
  if (listItems.length >= 100 && this.getModuleName() === 'autocomplete') {
@@ -2994,7 +3007,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2994
3007
  this.isNotSearchList = false;
2995
3008
  return;
2996
3009
  }
2997
- if (this.isActive) {
3010
+ if (this.isActive || !isNullOrUndefined(ulElement)) {
2998
3011
  const selectedItem = this.selectedLI ? this.selectedLI.cloneNode(true) : null;
2999
3012
  super.onActionComplete(ulElement, list, e);
3000
3013
  this.updateSelectElementData(this.allowFiltering);
@@ -3698,7 +3711,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3698
3711
  setFooterTemplate(popupEle) {
3699
3712
  let compiledString;
3700
3713
  if (this.footer) {
3701
- if (this.isReact) {
3714
+ if (this.isReact && typeof this.footerTemplate === 'function') {
3702
3715
  this.clearTemplate(['footerTemplate']);
3703
3716
  }
3704
3717
  else {
@@ -3784,6 +3797,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3784
3797
  if (this.allowFiltering && newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))) {
3785
3798
  this.actionCompleteData = { ulElement: null, list: null, isUpdated: false };
3786
3799
  this.actionData = this.actionCompleteData;
3800
+ this.itemData = null;
3787
3801
  }
3788
3802
  else if (this.allowFiltering && newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
3789
3803
  this.actionCompleteData = this.getModuleName() === 'combobox' ?
@@ -4284,6 +4298,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4284
4298
  if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
4285
4299
  this.inputElement.onchange = null;
4286
4300
  }
4301
+ if (this.isAngular) {
4302
+ this.inputElement = null;
4303
+ }
4287
4304
  super.destroy();
4288
4305
  }
4289
4306
  /* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
@@ -7787,7 +7804,8 @@ let ComboBox = class ComboBox extends DropDownList {
7787
7804
  }
7788
7805
  setSearchBox() {
7789
7806
  this.filterInput = this.inputElement;
7790
- return (this.isFiltering() ? this.inputWrapper : inputObject$1);
7807
+ let searchBoxContainer = (this.isFiltering() || (this.isReact && this.getModuleName() === 'combobox')) ? this.inputWrapper : inputObject$1;
7808
+ return searchBoxContainer;
7791
7809
  }
7792
7810
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7793
7811
  onActionComplete(ulElement, list, e, isUpdated) {
@@ -12839,6 +12857,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12839
12857
  * @returns {void}
12840
12858
  */
12841
12859
  render() {
12860
+ if (!isNullOrUndefined(this.value)) {
12861
+ // eslint-disable-next-line
12862
+ this.value = [...this.value];
12863
+ }
12842
12864
  this.setDynValue = this.initStatus = false;
12843
12865
  this.isSelectAll = false;
12844
12866
  this.selectAllEventEle = [];