@den4ik92/ng2-smart-table 19.6.0 → 19.6.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.
@@ -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 }));
@@ -2184,7 +2188,8 @@ class DataSet {
2184
2188
  this.storeSelectedRow(row);
2185
2189
  }
2186
2190
  multipleSelectRow(row) {
2187
- row.isSelected.set(!row.isSelected());
2191
+ row.isSelected.update((old) => !old);
2192
+ console.log('row', row);
2188
2193
  this.storeSelectedRow(row);
2189
2194
  return row;
2190
2195
  }
@@ -2228,7 +2233,7 @@ class DataSet {
2228
2233
  this.selectedRowsData.push(row.rowData());
2229
2234
  }
2230
2235
  else {
2231
- const index = this.selectedRowsData.findIndex((rowData) => isObjectsIdentical(rowData, row));
2236
+ const index = this.selectedRowsData.findIndex((rowData) => isObjectsIdentical(rowData, row.rowData()));
2232
2237
  if (index !== -1) {
2233
2238
  this.selectedRowsData.splice(index, 1);
2234
2239
  }
@@ -2527,10 +2532,14 @@ class Ng2SmartTableComponent {
2527
2532
  * @description If you want to display pagination in your custom container, you can pass it to "paginationSlot".
2528
2533
  * @example
2529
2534
  * <ng2-smart-table
2530
- * [paginationSlot]="paginationSlot">
2535
+ * [paginationSlot]="paginationContainerRef()">
2531
2536
  * </ng2-smart-table>
2532
2537
  * <div #paginationSlot>
2533
2538
  * </div>
2539
+ * inside component
2540
+ * readonly paginationContainerRef = viewChild<'paginationSlot', ViewContainerRef>('paginationSlot', {
2541
+ * read: ViewContainerRef,
2542
+ * });
2534
2543
  */
2535
2544
  this.paginationSlot = input();
2536
2545
  /**