@onecx/angular-accelerator 6.10.0 → 6.11.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.
@@ -2627,6 +2627,12 @@ class DataTableComponent extends DataSortBase {
2627
2627
  set pageSize(value) {
2628
2628
  this._pageSize$.next(value);
2629
2629
  }
2630
+ get page() {
2631
+ return this._page$.getValue();
2632
+ }
2633
+ set page(value) {
2634
+ this._page$.next(value);
2635
+ }
2630
2636
  get totalRecordsOnServer() {
2631
2637
  return this.params['totalRecordsOnServer'] ? Number(this.params['totalRecordsOnServer']) : undefined;
2632
2638
  }
@@ -2728,7 +2734,7 @@ class DataTableComponent extends DataSortBase {
2728
2734
  this.name = '';
2729
2735
  this.allowSelectAll = true;
2730
2736
  this.paginator = true;
2731
- this.page = 0;
2737
+ this._page$ = new BehaviorSubject(0);
2732
2738
  this.currentPageShowingKey = 'OCX_DATA_TABLE.SHOWING';
2733
2739
  this.currentPageShowingWithTotalOnServerKey = 'OCX_DATA_TABLE.SHOWING_WITH_TOTAL_ON_SERVER';
2734
2740
  this.params = {
@@ -3029,10 +3035,12 @@ class DataTableComponent extends DataSortBase {
3029
3035
  }
3030
3036
  }
3031
3037
  mapSelectionToRows() {
3032
- this.selectedRows$ = combineLatest([this._selectionIds$, this._rows$]).pipe(map(([selectedRowIds, rows]) => {
3033
- return selectedRowIds.map((rowId) => {
3034
- return rows.find((r) => r.id === rowId);
3035
- });
3038
+ // Include _page$ to force fresh array references on page navigation
3039
+ // to satisfy PrimeNG DataTable selection tracking, because it needs new object references to detect changes
3040
+ this.selectedRows$ = combineLatest([this._selectionIds$, this._rows$, this._page$]).pipe(map(([selectedRowIds, rows, _]) => {
3041
+ return selectedRowIds
3042
+ .map((rowId) => rows.find((r) => r.id === rowId))
3043
+ .filter((row) => row !== undefined);
3036
3044
  }));
3037
3045
  }
3038
3046
  isRowSelectionDisabled(rowObject) {
@@ -3051,9 +3059,12 @@ class DataTableComponent extends DataSortBase {
3051
3059
  }
3052
3060
  }
3053
3061
  this._selectionIds$.next(newSelectionIds);
3054
- this.selectionChanged.emit(this._rows$.getValue().filter((row) => newSelectionIds.includes(row.id)));
3062
+ this.emitSelectionChanged();
3055
3063
  this.emitComponentStateChanged();
3056
3064
  }
3065
+ emitSelectionChanged() {
3066
+ this.selectionChanged.emit(this._rows$.getValue().filter((row) => this._selectionIds$.getValue().includes(row.id)));
3067
+ }
3057
3068
  mergeWithDisabledKeys(newSelectionIds, disabledRowIds) {
3058
3069
  const previousSelectionIds = this._selectionIds$.getValue();
3059
3070
  const previouslySelectedAndDisabled = previousSelectionIds.filter((id) => disabledRowIds.includes(id));