@onecx/angular-accelerator 5.50.0 → 5.51.0

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.
@@ -2369,6 +2369,12 @@ class DataTableComponent extends DataSortBase {
2369
2369
  set showAllOption(value) {
2370
2370
  this._showAllOption$.next(value);
2371
2371
  }
2372
+ get page() {
2373
+ return this._page$.getValue();
2374
+ }
2375
+ set page(value) {
2376
+ this._page$.next(value);
2377
+ }
2372
2378
  get totalRecordsOnServer() {
2373
2379
  return this.params['totalRecordsOnServer'] ? Number(this.params['totalRecordsOnServer']) : undefined;
2374
2380
  }
@@ -2475,7 +2481,7 @@ class DataTableComponent extends DataSortBase {
2475
2481
  this.name = '';
2476
2482
  this.allowSelectAll = true;
2477
2483
  this.paginator = true;
2478
- this.page = 0;
2484
+ this._page$ = new BehaviorSubject(0);
2479
2485
  this.currentPageShowingKey = 'OCX_DATA_TABLE.SHOWING';
2480
2486
  this.currentPageShowingWithTotalOnServerKey = 'OCX_DATA_TABLE.SHOWING_WITH_TOTAL_ON_SERVER';
2481
2487
  this.params = {
@@ -2793,10 +2799,12 @@ class DataTableComponent extends DataSortBase {
2793
2799
  }
2794
2800
  }
2795
2801
  mapSelectionToRows() {
2796
- this.selectedRows$ = combineLatest([this._selectionIds$, this._rows$]).pipe(map(([selectedRowIds, rows]) => {
2797
- return selectedRowIds.map((rowId) => {
2798
- return rows.find((r) => r.id === rowId);
2799
- });
2802
+ // Include _page$ to force fresh array references on page navigation
2803
+ // to satisfy PrimeNG DataTable selection tracking, because it needs new object references to detect changes
2804
+ this.selectedRows$ = combineLatest([this._selectionIds$, this._rows$, this._page$]).pipe(map(([selectedRowIds, rows, _]) => {
2805
+ return selectedRowIds
2806
+ .map((rowId) => rows.find((r) => r.id === rowId))
2807
+ .filter((row) => row !== undefined);
2800
2808
  }));
2801
2809
  }
2802
2810
  isRowSelectionDisabled(rowObject) {
@@ -2815,9 +2823,12 @@ class DataTableComponent extends DataSortBase {
2815
2823
  }
2816
2824
  }
2817
2825
  this._selectionIds$.next(newSelectionIds);
2818
- this.selectionChanged.emit(this._rows$.getValue().filter((row) => newSelectionIds.includes(row.id)));
2826
+ this.emitSelectionChanged();
2819
2827
  this.emitComponentStateChanged();
2820
2828
  }
2829
+ emitSelectionChanged() {
2830
+ this.selectionChanged.emit(this._rows$.getValue().filter((row) => this._selectionIds$.getValue().includes(row.id)));
2831
+ }
2821
2832
  mergeWithDisabledKeys(newSelectionIds, disabledRowIds) {
2822
2833
  const previousSelectionIds = this._selectionIds$.getValue();
2823
2834
  const previouslySelectedAndDisabled = previousSelectionIds.filter((id) => disabledRowIds.includes(id));