@den4ik92/ng2-smart-table 19.6.0 → 19.6.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.
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, computed, ChangeDetectionStrategy, Component, signal, effect, inject, ElementRef, Directive, untracked, ViewContainerRef, ViewChild, output, viewChild } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import { distinctUntilChanged, debounceTime, takeUntil, switchMap, take } from 'rxjs/operators';
|
|
5
|
+
import { distinctUntilChanged, debounceTime, takeUntil, switchMap, take, finalize } from 'rxjs/operators';
|
|
6
6
|
import * as i1$2 from '@angular/cdk/overlay';
|
|
7
7
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
8
8
|
import * as i1$1 from '@angular/cdk/portal';
|
|
@@ -749,6 +749,7 @@ class ServerDataSource extends DataSource {
|
|
|
749
749
|
super();
|
|
750
750
|
this.initPagingConf = initPagingConf;
|
|
751
751
|
this.count = computed(() => this.pagingConf().total);
|
|
752
|
+
this.pending = signal(false);
|
|
752
753
|
this.pagingConf.update((old) => ({ ...old, ...this.initPagingConf }));
|
|
753
754
|
this.paramPrepareFunction = paramPrepareFunction;
|
|
754
755
|
this.requestFunction = requestFunction;
|
|
@@ -764,13 +765,16 @@ class ServerDataSource extends DataSource {
|
|
|
764
765
|
SmartTableOnChangedEventName.paging,
|
|
765
766
|
SmartTableOnChangedEventName.refresh,
|
|
766
767
|
].includes(eventData.action)) {
|
|
768
|
+
this.pending.set(true);
|
|
767
769
|
this.paramPrepareFunction({
|
|
768
770
|
sort: this.sortConf(),
|
|
769
771
|
filters: this.filters(),
|
|
770
772
|
page: this.pagingConf().page,
|
|
771
773
|
limit: this.pagingConf().perPage,
|
|
772
774
|
})
|
|
773
|
-
.pipe(switchMap((params) => this.requestFunction(params)), take(1))
|
|
775
|
+
.pipe(switchMap((params) => this.requestFunction(params)), take(1), finalize(() => {
|
|
776
|
+
this.pending.set(false);
|
|
777
|
+
}))
|
|
774
778
|
.subscribe((res) => {
|
|
775
779
|
this.data.set(res.data);
|
|
776
780
|
this.pagingConf.update((old) => ({ ...old, total: res.total }));
|
|
@@ -2527,10 +2531,14 @@ class Ng2SmartTableComponent {
|
|
|
2527
2531
|
* @description If you want to display pagination in your custom container, you can pass it to "paginationSlot".
|
|
2528
2532
|
* @example
|
|
2529
2533
|
* <ng2-smart-table
|
|
2530
|
-
* [paginationSlot]="
|
|
2534
|
+
* [paginationSlot]="paginationContainerRef()">
|
|
2531
2535
|
* </ng2-smart-table>
|
|
2532
2536
|
* <div #paginationSlot>
|
|
2533
2537
|
* </div>
|
|
2538
|
+
* inside component
|
|
2539
|
+
* readonly paginationContainerRef = viewChild<'paginationSlot', ViewContainerRef>('paginationSlot', {
|
|
2540
|
+
* read: ViewContainerRef,
|
|
2541
|
+
* });
|
|
2534
2542
|
*/
|
|
2535
2543
|
this.paginationSlot = input();
|
|
2536
2544
|
/**
|