ngx-render-material-forms 1.4.9 → 1.5.1

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.
@@ -2594,7 +2594,7 @@ class MaterialSelectComponent extends MaterialComponent {
2594
2594
  });
2595
2595
  }
2596
2596
  registerPanelScrollEvent(selectElem) {
2597
- const panelElement = selectElem.panel.nativeElement;
2597
+ const panelElement = selectElem?.panel?.nativeElement;
2598
2598
  panelElement.addEventListener('scroll', this.onScroll.bind(this));
2599
2599
  }
2600
2600
  onScroll(event) {
@@ -2691,7 +2691,7 @@ class MaterialSelectComponent extends MaterialComponent {
2691
2691
  this.searching = false;
2692
2692
  this.productsloadingFlag = true;
2693
2693
  setTimeout(() => {
2694
- const ele = this.selectElem.panel.nativeElement;
2694
+ const ele = this.selectElem?.panel?.nativeElement;
2695
2695
  const trackHeight = ele.scrollHeight - ele.offsetHeight;
2696
2696
  const middlePosition = trackHeight / 2 - 50;
2697
2697
  ele.scrollTo({ top: middlePosition, behavior: 'auto' });
@@ -2761,8 +2761,11 @@ class MaterialSelectComponent extends MaterialComponent {
2761
2761
  this.removePanelScrollEvent();
2762
2762
  this.searching = false;
2763
2763
  let selectedValue = this.getValue();
2764
- if (selectedValue.toString().length == 0 && this.searchQuery == '') {
2764
+ if ((selectedValue.toString().length == 0 && this.searchQuery == '') || this.productList?.length === 0) {
2765
2765
  this.productList = [];
2766
+ this.pageNumber = 1;
2767
+ this.pageSize = 20;
2768
+ this.searchQuery = '';
2766
2769
  this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
2767
2770
  }
2768
2771
  }
@@ -2789,6 +2792,7 @@ class MaterialSelectComponent extends MaterialComponent {
2789
2792
  this.pageSize = 20;
2790
2793
  this.productList = [];
2791
2794
  this.searching = true;
2795
+ this.searchQuery = searchQuery;
2792
2796
  this.loadData(this.pageNumber, this.pageSize, searchQuery);
2793
2797
  }
2794
2798
  });