@one-paragon/angular-utilities 2.1.0 → 2.1.2

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.
@@ -4866,6 +4866,7 @@ class PaginatorComponent {
4866
4866
  data = inject(DataStore);
4867
4867
  $paginator = viewChild(MatPaginator);
4868
4868
  $dataLength = this.data.selectSignal(d => d.sortedFilteredDataLength);
4869
+ $viewableDataLength = this.data.selectSignal(d => d.sortedFilteredGroupedDataLength);
4869
4870
  pageEvent$ = toObservable(this.$paginator).pipe(notNull(), switchMap(p => p.page));
4870
4871
  $pageEvent = toSignal(this.pageEvent$);
4871
4872
  $pageIndexChangeEvent = computed(() => this.$pageEvent()?.pageIndex);
@@ -4906,11 +4907,11 @@ class PaginatorComponent {
4906
4907
  });
4907
4908
  onDataLengthEffect = effect(() => {
4908
4909
  const paginator = this.$paginator();
4909
- const dataLength = this.$dataLength();
4910
+ const dataLength = this.$viewableDataLength();
4910
4911
  untracked(() => {
4911
4912
  if (paginator) {
4912
4913
  paginator.length = dataLength;
4913
- const maxIndex = Math.ceil(dataLength / paginator.pageSize) - 1;
4914
+ const maxIndex = Math.max(0, Math.ceil(dataLength / paginator.pageSize) - 1);
4914
4915
  if (paginator.pageIndex > maxIndex) {
4915
4916
  paginator.pageIndex = maxIndex;
4916
4917
  this.state.setCurrentPage(maxIndex);