basesite-shared-grid-lib 15.10.302 → 15.10.303

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.
@@ -2737,6 +2737,7 @@ class GridLibraryComponent {
2737
2737
  this.dataLoaded = true;
2738
2738
  setTimeout(() => this.updatePaginationInfo(), 0);
2739
2739
  setTimeout(() => this.applyFilterHighlightingWithRetry(), 100);
2740
+ this.setPageSizeMinusOne(e.api);
2740
2741
  this.firstDataRendered.emit(e);
2741
2742
  }
2742
2743
  onGridReadyExcel(params) {
@@ -3069,6 +3070,20 @@ class GridLibraryComponent {
3069
3070
  console.warn('Filter highlighting retry limit reached. Some filter inputs may not be highlighted.');
3070
3071
  }
3071
3072
  }
3073
+ onGridSizeChanged(params) {
3074
+ this.setPageSizeMinusOne(params.api);
3075
+ }
3076
+ setPageSizeMinusOne(api) {
3077
+ const rowHeight = api.getSizesForCurrentTheme().rowHeight;
3078
+ // Get the grid's displayed body height (viewport)
3079
+ const bodyHeight = api.getDisplayedRowCount() > 0
3080
+ ? api.gridOptionsWrapper.eGridDiv.querySelector('.ag-body-viewport').clientHeight
3081
+ : 0;
3082
+ if (bodyHeight > 0) {
3083
+ const rowsThatFit = Math.floor(bodyHeight / rowHeight);
3084
+ api.paginationSetPageSize(Math.max(rowsThatFit - 1, 1)); // ensure >=1
3085
+ }
3086
+ }
3072
3087
  //destroy all associated subscriptions on component destroy
3073
3088
  ngOnDestroy() {
3074
3089
  if (this.filterHighlightingObserver) {
@@ -3172,6 +3187,7 @@ class GridLibraryComponent {
3172
3187
  (selectionChanged)="onSelectionChanged($event)"
3173
3188
  (filterChanged)="onFilterChanged($event)"
3174
3189
  (firstDataRendered)="onFirstDataRendered($event)"
3190
+ (onGridSizeChanged)="onGridSizeChanged($event)"
3175
3191
  [rowHeight]="rowHeight"
3176
3192
  (paginationChanged)="onPaginationChanged($event)"
3177
3193
  [noRowsOverlayComponent]="noRowsOverlayComponent"
@@ -3254,6 +3270,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
3254
3270
  (selectionChanged)="onSelectionChanged($event)"
3255
3271
  (filterChanged)="onFilterChanged($event)"
3256
3272
  (firstDataRendered)="onFirstDataRendered($event)"
3273
+ (onGridSizeChanged)="onGridSizeChanged($event)"
3257
3274
  [rowHeight]="rowHeight"
3258
3275
  (paginationChanged)="onPaginationChanged($event)"
3259
3276
  [noRowsOverlayComponent]="noRowsOverlayComponent"