@iharbeck/ngx-virtual-scroller
Version:
Virtual Scroll displays a virtual, "infinite" list. Supports horizontal/vertical, variable heights, & multi-column.
182 lines (178 loc) • 9.96 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit, OnChanges, OnDestroy, ElementRef, Renderer2, NgZone, ChangeDetectorRef, EventEmitter } from '@angular/core';
import * as tween from '@tweenjs/tween.js';
import * as i2 from '@angular/common';
interface VirtualScrollerDefaultOptions {
checkResizeInterval: number;
modifyOverflowStyleOfParentScroll: boolean;
resizeBypassRefreshThreshold: number;
scrollAnimationTime: number;
scrollDebounceTime: number;
scrollThrottlingTime: number;
scrollbarHeight?: number;
scrollbarWidth?: number;
stripedTable: boolean;
}
declare function VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY(): VirtualScrollerDefaultOptions;
interface WrapGroupDimensions {
maxChildSizePerWrapGroup: WrapGroupDimension[];
numberOfKnownWrapGroupChildSizes: number;
sumOfKnownWrapGroupChildHeights: number;
sumOfKnownWrapGroupChildWidths: number;
}
interface WrapGroupDimension {
childHeight: number;
childWidth: number;
items: any[];
}
interface IDimensions {
childHeight: number;
childWidth: number;
itemCount: number;
itemsPerPage: number;
itemsPerWrapGroup: number;
maxScrollPosition: number;
pageCount_fractional: number;
scrollLength: number;
viewportLength: number;
wrapGroupsPerPage: number;
}
interface IPageInfo {
endIndex: number;
endIndexWithBuffer: number;
maxScrollPosition: number;
scrollEndPosition: number;
scrollStartPosition: number;
startIndex: number;
startIndexWithBuffer: number;
}
interface IViewport extends IPageInfo {
padding: number;
scrollLength: number;
scrollbarLength: number;
}
declare class VirtualScrollerComponent implements OnInit, OnChanges, OnDestroy {
protected readonly element: ElementRef;
protected readonly renderer: Renderer2;
protected readonly zone: NgZone;
protected changeDetectorRef: ChangeDetectorRef;
viewPortItems: any[];
window: Window & typeof globalThis;
get viewPortInfo(): IPageInfo;
executeRefreshOutsideAngularZone: boolean;
protected _enableUnequalChildrenSizes: boolean;
get enableUnequalChildrenSizes(): boolean;
set enableUnequalChildrenSizes(value: boolean);
RTL: boolean;
useMarginInsteadOfTranslate: boolean;
modifyOverflowStyleOfParentScroll: boolean;
stripedTable: boolean;
scrollbarWidth: number;
scrollbarHeight: number;
childWidth: number;
childHeight: number;
ssrChildWidth: number;
ssrChildHeight: number;
ssrViewportWidth: number;
ssrViewportHeight: number;
protected _bufferAmount: number;
get bufferAmount(): number;
set bufferAmount(value: number);
scrollAnimationTime: number;
resizeBypassRefreshThreshold: number;
protected _scrollThrottlingTime: number;
get scrollThrottlingTime(): number;
set scrollThrottlingTime(value: number);
protected _scrollDebounceTime: number;
get scrollDebounceTime(): number;
set scrollDebounceTime(value: number);
protected onScroll: () => void;
protected updateOnScrollFunction(): void;
protected checkScrollElementResizedTimer: number;
protected _checkResizeInterval: number;
get checkResizeInterval(): number;
set checkResizeInterval(value: number);
protected _items: any[];
get items(): any[];
set items(value: any[]);
compareItems: (item1: any, item2: any) => boolean;
protected _horizontal: boolean;
get horizontal(): boolean;
set horizontal(value: boolean);
protected revertParentOverscroll(): void;
protected oldParentScrollOverflow: {
x: string;
y: string;
};
protected _parentScroll: Element | Window;
get parentScroll(): Element | Window;
set parentScroll(value: Element | Window);
vsUpdate: EventEmitter<any[]>;
vsChange: EventEmitter<IPageInfo>;
vsStart: EventEmitter<IPageInfo>;
vsEnd: EventEmitter<IPageInfo>;
protected contentElementRef: ElementRef;
protected invisiblePaddingElementRef: ElementRef;
protected containerElementRef: ElementRef;
ngOnInit(): void;
ngOnDestroy(): void;
ngOnChanges(changes: any): void;
ngDoCheck(): void;
refresh(): void;
invalidateAllCachedMeasurements(): void;
invalidateCachedMeasurementForItem(item: any): void;
invalidateCachedMeasurementAtIndex(index: number): void;
scrollInto(item: any, alignToBeginning?: boolean, additionalOffset?: number, animationMilliseconds?: number, animationCompletedCallback?: () => void): void;
scrollToIndex(index: number, alignToBeginning?: boolean, additionalOffset?: number, animationMilliseconds?: number, animationCompletedCallback?: () => void): void;
protected scrollToIndex_internal(index: number, alignToBeginning?: boolean, additionalOffset?: number, animationMilliseconds?: number, animationCompletedCallback?: () => void): void;
scrollToPosition(scrollPosition: number, animationMilliseconds?: number, animationCompletedCallback?: () => void): void;
protected isAngularUniversalSSR: boolean;
constructor(element: ElementRef, renderer: Renderer2, zone: NgZone, changeDetectorRef: ChangeDetectorRef, platformId: Object, options: VirtualScrollerDefaultOptions);
protected getElementSize(element: HTMLElement): any;
protected previousScrollBoundingRect: ClientRect;
protected checkScrollElementResized(): void;
protected _invisiblePaddingProperty: any;
protected _offsetType: any;
protected _scrollType: any;
protected _pageOffsetType: any;
protected _childScrollDim: any;
protected _translateDir: any;
protected _marginDir: any;
protected updateDirection(): void;
protected debounce(func: Function, wait: number): Function;
protected throttleTrailing(func: Function, wait: number): Function;
protected calculatedScrollbarWidth: number;
protected calculatedScrollbarHeight: number;
protected padding: number;
protected previousViewPort: IViewport;
protected currentTween: tween.Tween<any>;
protected cachedItemsLength: number;
protected disposeScrollHandler: () => void | undefined;
protected disposeResizeHandler: () => void | undefined;
protected refresh_internal(itemsArrayModified: boolean, refreshCompletedCallback?: () => void, maxRunTimes?: number): void;
protected getScrollElement(): HTMLElement;
protected addScrollEventHandlers(): void;
protected removeScrollEventHandlers(): void;
protected getElementsOffset(): number;
protected countItemsPerWrapGroup(): number;
protected getScrollStartPosition(): number;
protected minMeasuredChildWidth: number;
protected minMeasuredChildHeight: number;
protected wrapGroupDimensions: WrapGroupDimensions;
protected resetWrapGroupDimensions(): void;
protected calculateDimensions(): IDimensions;
protected cachedPageSize: number;
protected previousScrollNumberElements: number;
protected calculatePadding(arrayStartIndexWithBuffer: number, dimensions: IDimensions): number;
protected calculatePageInfo(scrollPosition: number, dimensions: IDimensions): IPageInfo;
protected calculateViewport(): IViewport;
static ɵfac: i0.ɵɵFactoryDeclaration<VirtualScrollerComponent, [null, null, null, null, null, { optional: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<VirtualScrollerComponent, "virtual-scroller,[virtualScroller]", ["virtualScroller"], { "executeRefreshOutsideAngularZone": { "alias": "executeRefreshOutsideAngularZone"; "required": false; }; "enableUnequalChildrenSizes": { "alias": "enableUnequalChildrenSizes"; "required": false; }; "RTL": { "alias": "RTL"; "required": false; }; "useMarginInsteadOfTranslate": { "alias": "useMarginInsteadOfTranslate"; "required": false; }; "modifyOverflowStyleOfParentScroll": { "alias": "modifyOverflowStyleOfParentScroll"; "required": false; }; "stripedTable": { "alias": "stripedTable"; "required": false; }; "scrollbarWidth": { "alias": "scrollbarWidth"; "required": false; }; "scrollbarHeight": { "alias": "scrollbarHeight"; "required": false; }; "childWidth": { "alias": "childWidth"; "required": false; }; "childHeight": { "alias": "childHeight"; "required": false; }; "ssrChildWidth": { "alias": "ssrChildWidth"; "required": false; }; "ssrChildHeight": { "alias": "ssrChildHeight"; "required": false; }; "ssrViewportWidth": { "alias": "ssrViewportWidth"; "required": false; }; "ssrViewportHeight": { "alias": "ssrViewportHeight"; "required": false; }; "bufferAmount": { "alias": "bufferAmount"; "required": false; }; "scrollAnimationTime": { "alias": "scrollAnimationTime"; "required": false; }; "resizeBypassRefreshThreshold": { "alias": "resizeBypassRefreshThreshold"; "required": false; }; "scrollThrottlingTime": { "alias": "scrollThrottlingTime"; "required": false; }; "scrollDebounceTime": { "alias": "scrollDebounceTime"; "required": false; }; "checkResizeInterval": { "alias": "checkResizeInterval"; "required": false; }; "items": { "alias": "items"; "required": false; }; "compareItems": { "alias": "compareItems"; "required": false; }; "horizontal": { "alias": "horizontal"; "required": false; }; "parentScroll": { "alias": "parentScroll"; "required": false; }; }, { "vsUpdate": "vsUpdate"; "vsChange": "vsChange"; "vsStart": "vsStart"; "vsEnd": "vsEnd"; }, ["containerElementRef"], ["[tab-header]", "*", "[tab-footer]"], false, never>;
}
declare class VirtualScrollerModule {
static ɵfac: i0.ɵɵFactoryDeclaration<VirtualScrollerModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<VirtualScrollerModule, [typeof VirtualScrollerComponent], [typeof i2.CommonModule], [typeof VirtualScrollerComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<VirtualScrollerModule>;
}
export { VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY, VirtualScrollerComponent, VirtualScrollerModule };
export type { IDimensions, IPageInfo, IViewport, VirtualScrollerDefaultOptions, WrapGroupDimension, WrapGroupDimensions };