[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { InjectionToken } from '@angular/core';
|
---|
| 9 | import { Observable } from 'rxjs';
|
---|
| 10 | import { CdkVirtualScrollViewport } from './virtual-scroll-viewport';
|
---|
| 11 | /** The injection token used to specify the virtual scrolling strategy. */
|
---|
| 12 | export declare const VIRTUAL_SCROLL_STRATEGY: InjectionToken<VirtualScrollStrategy>;
|
---|
| 13 | /** A strategy that dictates which items should be rendered in the viewport. */
|
---|
| 14 | export interface VirtualScrollStrategy {
|
---|
| 15 | /** Emits when the index of the first element visible in the viewport changes. */
|
---|
| 16 | scrolledIndexChange: Observable<number>;
|
---|
| 17 | /**
|
---|
| 18 | * Attaches this scroll strategy to a viewport.
|
---|
| 19 | * @param viewport The viewport to attach this strategy to.
|
---|
| 20 | */
|
---|
| 21 | attach(viewport: CdkVirtualScrollViewport): void;
|
---|
| 22 | /** Detaches this scroll strategy from the currently attached viewport. */
|
---|
| 23 | detach(): void;
|
---|
| 24 | /** Called when the viewport is scrolled (debounced using requestAnimationFrame). */
|
---|
| 25 | onContentScrolled(): void;
|
---|
| 26 | /** Called when the length of the data changes. */
|
---|
| 27 | onDataLengthChanged(): void;
|
---|
| 28 | /** Called when the range of items rendered in the DOM has changed. */
|
---|
| 29 | onContentRendered(): void;
|
---|
| 30 | /** Called when the offset of the rendered items changed. */
|
---|
| 31 | onRenderedOffsetChanged(): void;
|
---|
| 32 | /**
|
---|
| 33 | * Scroll to the offset for the given index.
|
---|
| 34 | * @param index The index of the element to scroll to.
|
---|
| 35 | * @param behavior The ScrollBehavior to use when scrolling.
|
---|
| 36 | */
|
---|
| 37 | scrollToIndex(index: number, behavior: ScrollBehavior): void;
|
---|
| 38 | }
|
---|