import { OnDestroy } from '@angular/core'; import { Observable } from 'rxjs'; import { ListRange, RxVirtualScrollStrategy, RxVirtualScrollViewport, RxVirtualViewRepeater } from '../model'; import { RxVirtualScrollDefaultOptions } from '../virtual-scroll.config'; import { RxResizeObserver } from './resize-observer'; import * as i0 from "@angular/core"; /** * @Directive AutosizeVirtualScrollStrategy * * @description * * The `AutosizeVirtualScrollStrategy` provides a twitter-like virtual-scrolling * experience. It is able to render and position items based on their individual * size. It is comparable to \@angular/cdk/experimental `AutosizeVirtualScrollStrategy`, but * with a high performant layouting technique and more features. * * On top of this the `AutosizeVirtualScrollStrategy` is leveraging the native * `ResizeObserver` in order to detect size changes for each individual view * rendered to the DOM and properly re-position accordingly. * * In order to provide top-notch runtime performance the `AutosizeVirtualScrollStrategy` * builds up caches that prevent DOM interactions whenever possible. Once a view * was visited, its properties will be stored instead of re-read from the DOM again as * this can potentially lead to unwanted forced reflows. * * @docsCategory RxVirtualFor * @docsPage RxVirtualFor * @publicApi */ export declare class AutoSizeVirtualScrollStrategy extends RxVirtualScrollStrategy implements OnDestroy { private resizeObserver; private readonly defaults?; /** * @description * The amount of items to render upfront in scroll direction */ private _runwayItems; set runwayItems(runwayItems: number); get runwayItems(): number; /** * @description * The amount of items to render upfront in reverse scroll direction */ private _runwayItemsOpposite; set runwayItemsOpposite(runwayItemsOpposite: number); get runwayItemsOpposite(): number; /** * @description * The default size of the items being rendered. The autosized strategy will assume * this size for items it doesn't know yet. For the smoothest experience, * you provide the mean size of all items being rendered - if possible of course. * * As soon as rxVirtualFor is able to also render actual tombstone items, this * will be the size of a tombstone item being rendered before the actual item * is inserted into its position. */ tombstoneSize: number; /** * @description * The autosized strategy uses the native ResizeObserver in order to determine * if an item changed in size to afterwards properly position the views. * You can customize the config passed to the ResizeObserver as well as determine * which result property to use when determining the views size. */ resizeObserverConfig?: { options?: ResizeObserverOptions; extractSize?: (entry: ResizeObserverEntry) => number; }; private _appendOnly; set appendOnly(input: boolean); get appendOnly(): boolean; /** * @description * When enabled, the autosized scroll strategy uses attaches a `ResizeObserver` * to every view within the given renderedRange. If your views receive * dimension changes that are not caused by list updates, this is a way to * still track height changes. This also applies to resize events of the whole * document. */ set withResizeObserver(input: boolean); get withResizeObserver(): boolean; private _withResizeObserver; /** @internal */ private viewport; /** @internal */ private viewRepeater; /** @internal */ private readonly _contentSize$; /** @internal */ readonly contentSize$: Observable; /** @internal */ private _contentSize; /** @internal */ private set contentSize(value); private get contentSize(); /** @internal */ private readonly _renderedRange$; /** @internal */ readonly renderedRange$: Observable; /** @internal */ private _renderedRange; /** @internal */ private set renderedRange(value); /** @internal */ private get renderedRange(); /** @internal */ private readonly _scrolledIndex$; /** @internal */ readonly scrolledIndex$: Observable; /** @internal */ private _scrolledIndex; /** @internal */ private get scrolledIndex(); /** @internal */ private set scrolledIndex(value); /** * is set, when scrollToIndex is called * @internal * */ private _scrollToIndex; /** @internal */ private containerSize; /** @internal */ private contentLength; /** @internal */ private _virtualItems; /** @internal */ private scrollTop; /** @internal */ private scrollTopWithOutOffset; /** @internal */ private scrollTopAfterOffset; /** @internal */ private viewportOffset; /** @internal */ private direction; /** @internal */ private anchorScrollTop; /** @internal */ private anchorItem; /** @internal */ private lastScreenItem; /** @internal */ private readonly detached$; /** @internal */ private readonly recalculateRange$; /** @internal */ private until$; /** @internal */ private get extractSize(); constructor(resizeObserver: RxResizeObserver, defaults?: RxVirtualScrollDefaultOptions); /** @internal */ ngOnDestroy(): void; /** @internal */ attach(viewport: RxVirtualScrollViewport, viewRepeater: RxVirtualViewRepeater): void; /** @internal */ detach(): void; scrollToIndex(index: number, behavior?: ScrollBehavior): void; private scrollTo; /** * starts the subscriptions that maintain the virtualItems array on changes * to the underlying dataset * @internal */ private maintainVirtualItems; /** * listen to triggers that should change the renderedRange * @internal */ private calcRenderedRange; /** * position elements after they are created/updated/moved or their dimensions * change from other sources * @internal */ private positionElements; /** @internal */ private adjustContentSize; /** @internal */ private observeViewSize$; /** * @internal * heavily inspired by * https://github.com/GoogleChromeLabs/ui-element-samples/blob/gh-pages/infinite-scroller/scripts/infinite-scroll.js */ private calculateAnchoredItem; /** @internal */ private positionUnchangedViews; /** * Adjust the scroll position when the anchorScrollTop differs from * the actual scrollTop. * Trigger a range recalculation if there is empty space * * @internal */ private maybeAdjustScrollPosition; /** @internal */ private calcAnchorScrollTop; /** @internal */ private calcInitialPosition; /** @internal */ private getViewRef; /** @internal */ private updateElementSize; /** @internal */ private getItemSize; /** @internal */ private getElementSize; /** @internal */ private positionElement; static ɵfac: i0.ɵɵFactoryDeclaration, [null, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration, "rx-virtual-scroll-viewport[autosize]", never, { "runwayItems": "runwayItems"; "runwayItemsOpposite": "runwayItemsOpposite"; "tombstoneSize": "tombstoneSize"; "resizeObserverConfig": "resizeObserverConfig"; "appendOnly": "appendOnly"; "withResizeObserver": "withResizeObserver"; }, {}, never>; } export declare class AutoSizeVirtualScrollStrategyModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; }