@one-paragon/angular-utilities 2.0.4 → 2.0.5

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.
@@ -26,6 +26,6 @@ export interface State extends EntityState<ActionStatus> {
26
26
  }
27
27
  export declare const initialState: StatusState;
28
28
  export declare const getStatusState: import("@ngrx/store").MemoizedSelector<object, State, import("@ngrx/store").DefaultProjectorFn<State>>;
29
- export declare const selectIds: import("@ngrx/store").MemoizedSelector<object, string[] | number[], (entityState: EntityState<ActionStatus>) => string[] | number[]>, selectEntities: import("@ngrx/store").MemoizedSelector<object, import("@ngrx/entity").Dictionary<ActionStatus>, (entityState: EntityState<ActionStatus>) => import("@ngrx/entity").Dictionary<ActionStatus>>, selectAll: import("@ngrx/store").MemoizedSelector<object, ActionStatus[], (entityState: EntityState<ActionStatus>) => ActionStatus[]>, selectTotal: import("@ngrx/store").MemoizedSelector<object, number, (entityState: EntityState<ActionStatus>) => number>;
29
+ export declare const selectIds: import("@ngrx/store").MemoizedSelector<object, number[] | string[], (entityState: EntityState<ActionStatus>) => string[] | number[]>, selectEntities: import("@ngrx/store").MemoizedSelector<object, import("@ngrx/entity").Dictionary<ActionStatus>, (entityState: EntityState<ActionStatus>) => import("@ngrx/entity").Dictionary<ActionStatus>>, selectAll: import("@ngrx/store").MemoizedSelector<object, ActionStatus[], (entityState: EntityState<ActionStatus>) => ActionStatus[]>, selectTotal: import("@ngrx/store").MemoizedSelector<object, number, (entityState: EntityState<ActionStatus>) => number>;
30
30
  export declare const selectEntity: (id: string) => import("@ngrx/store").MemoizedSelector<object, any, (s1: import("@ngrx/entity").Dictionary<ActionStatus>) => any>;
31
31
  export declare function actionStatusReducer(state: StatusState | undefined, action: Action): StatusState;
@@ -887,6 +887,10 @@ class VirtualScrollOptions {
887
887
  * If `maxViewPortHeight` is set that will be the max table size
888
888
  */
889
889
  dynamicHeight = false;
890
+ /**
891
+ * If `dynamicHeight` is set to true, we will try to add this amount of space from the bottom of view port
892
+ */
893
+ dynamicalHeightBuffer = 0;
890
894
  }
891
895
  class PaginatorOptions {
892
896
  pageSize = undefined;
@@ -5264,22 +5268,28 @@ class VirtualScrollContainer {
5264
5268
  const virtualScrollOptions = this.$virtualScrollOptions();
5265
5269
  const t = this.tableContainer.elementRef.nativeElement.querySelector(`#${TableContainerComponent.headerId}`);
5266
5270
  const rect = t?.getBoundingClientRect();
5267
- const viewportHeight = window.innerHeight;
5268
- const distanceFromBottom = viewportHeight - rect.bottom;
5271
+ const windowHeight = window.innerHeight;
5272
+ const distanceFromBottom = windowHeight - rect.bottom;
5269
5273
  const rowHeight = this.computedRowHeight();
5270
5274
  const footerHeight = this.computedFooterHeight();
5271
5275
  const headerHeight = this.computedHeaderHeight();
5276
+ const buffer = this.computedBuffer();
5277
+ const horizontalScrollPadding = el.nativeElement.scrollWidth > el.nativeElement.clientWidth ? 17 : 0;
5272
5278
  const maxViewPortHeightPx = parseTbSizeToPixels(virtualScrollOptions.maxViewPortHeight) || 0;
5273
5279
  let tableSize = distanceFromBottom;
5274
5280
  if (virtualScrollOptions?.maxViewPortHeight && maxViewPortHeightPx < tableSize) {
5275
5281
  tableSize = maxViewPortHeightPx;
5276
5282
  }
5277
- const available = (distanceFromBottom - footerHeight) - headerHeight - (this.$usePaginator() ? 20 : 0);
5283
+ const available = (distanceFromBottom - footerHeight)
5284
+ - headerHeight
5285
+ - (this.$usePaginator() ? 20 : 0)
5286
+ - buffer
5287
+ - horizontalScrollPadding;
5278
5288
  const amountOfRowsThatWillFit = Math.floor(available / rowHeight);
5279
5289
  const minAmountOfRows = virtualScrollOptions?.amountOfVisibleItems || this.defaultOptions.amountOfVisibleItems;
5280
5290
  const amountOfVisibleItems = Math.min(Math.max(amountOfRowsThatWillFit, minAmountOfRows), this.$dataLength());
5281
5291
  let height = (rowHeight * amountOfVisibleItems);
5282
- height += (footerHeight + headerHeight);
5292
+ height += (footerHeight + headerHeight + horizontalScrollPadding);
5283
5293
  this.setHeight(height, el);
5284
5294
  }
5285
5295
  setHeight(height, el) {
@@ -5309,6 +5319,12 @@ class VirtualScrollContainer {
5309
5319
  computedFooterHeight = computed(() => {
5310
5320
  return parseFloat(this.genericTable()?.$footerHeight()?.replace('px', '') || '0');
5311
5321
  });
5322
+ computedBuffer = computed(() => {
5323
+ const virtualScrollOptions = this.state.$tableSettings().virtualSettings;
5324
+ if (!virtualScrollOptions.dynamicalHeightBuffer)
5325
+ return 0;
5326
+ return parseTbSizeToPixels(virtualScrollOptions.dynamicalHeightBuffer) || 0;
5327
+ });
5312
5328
  scrollStrategy = new TableVirtualScrollStrategy(this);
5313
5329
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: VirtualScrollContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
5314
5330
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.0", type: VirtualScrollContainer, isStandalone: true, selector: "tb-virtual-scroll-container", queries: [{ propertyName: "genericTable", first: true, predicate: GenericTableComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: `