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 { CollectionViewer, DataSource, ListRange, _RecycleViewRepeaterStrategy } from '@angular/cdk/collections';
|
---|
9 | import { DoCheck, IterableDiffers, NgIterable, NgZone, OnDestroy, TemplateRef, TrackByFunction, ViewContainerRef } from '@angular/core';
|
---|
10 | import { NumberInput } from '@angular/cdk/coercion';
|
---|
11 | import { Observable, Subject } from 'rxjs';
|
---|
12 | import { CdkVirtualScrollRepeater } from './virtual-scroll-repeater';
|
---|
13 | import { CdkVirtualScrollViewport } from './virtual-scroll-viewport';
|
---|
14 | /** The context for an item rendered by `CdkVirtualForOf` */
|
---|
15 | import * as ɵngcc0 from '@angular/core';
|
---|
16 | export declare type CdkVirtualForOfContext<T> = {
|
---|
17 | /** The item value. */
|
---|
18 | $implicit: T;
|
---|
19 | /** The DataSource, Observable, or NgIterable that was passed to *cdkVirtualFor. */
|
---|
20 | cdkVirtualForOf: DataSource<T> | Observable<T[]> | NgIterable<T>;
|
---|
21 | /** The index of the item in the DataSource. */
|
---|
22 | index: number;
|
---|
23 | /** The number of items in the DataSource. */
|
---|
24 | count: number;
|
---|
25 | /** Whether this is the first item in the DataSource. */
|
---|
26 | first: boolean;
|
---|
27 | /** Whether this is the last item in the DataSource. */
|
---|
28 | last: boolean;
|
---|
29 | /** Whether the index is even. */
|
---|
30 | even: boolean;
|
---|
31 | /** Whether the index is odd. */
|
---|
32 | odd: boolean;
|
---|
33 | };
|
---|
34 | /**
|
---|
35 | * A directive similar to `ngForOf` to be used for rendering data inside a virtual scrolling
|
---|
36 | * container.
|
---|
37 | */
|
---|
38 | export declare class CdkVirtualForOf<T> implements CdkVirtualScrollRepeater<T>, CollectionViewer, DoCheck, OnDestroy {
|
---|
39 | /** The view container to add items to. */
|
---|
40 | private _viewContainerRef;
|
---|
41 | /** The template to use when stamping out new items. */
|
---|
42 | private _template;
|
---|
43 | /** The set of available differs. */
|
---|
44 | private _differs;
|
---|
45 | /** The strategy used to render items in the virtual scroll viewport. */
|
---|
46 | private _viewRepeater;
|
---|
47 | /** The virtual scrolling viewport that these items are being rendered in. */
|
---|
48 | private _viewport;
|
---|
49 | /** Emits when the rendered view of the data changes. */
|
---|
50 | readonly viewChange: Subject<ListRange>;
|
---|
51 | /** Subject that emits when a new DataSource instance is given. */
|
---|
52 | private readonly _dataSourceChanges;
|
---|
53 | /** The DataSource to display. */
|
---|
54 | get cdkVirtualForOf(): DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined;
|
---|
55 | set cdkVirtualForOf(value: DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined);
|
---|
56 | _cdkVirtualForOf: DataSource<T> | Observable<T[]> | NgIterable<T> | null | undefined;
|
---|
57 | /**
|
---|
58 | * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and
|
---|
59 | * the item and produces a value to be used as the item's identity when tracking changes.
|
---|
60 | */
|
---|
61 | get cdkVirtualForTrackBy(): TrackByFunction<T> | undefined;
|
---|
62 | set cdkVirtualForTrackBy(fn: TrackByFunction<T> | undefined);
|
---|
63 | private _cdkVirtualForTrackBy;
|
---|
64 | /** The template used to stamp out new elements. */
|
---|
65 | set cdkVirtualForTemplate(value: TemplateRef<CdkVirtualForOfContext<T>>);
|
---|
66 | /**
|
---|
67 | * The size of the cache used to store templates that are not being used for re-use later.
|
---|
68 | * Setting the cache size to `0` will disable caching. Defaults to 20 templates.
|
---|
69 | */
|
---|
70 | get cdkVirtualForTemplateCacheSize(): number;
|
---|
71 | set cdkVirtualForTemplateCacheSize(size: number);
|
---|
72 | /** Emits whenever the data in the current DataSource changes. */
|
---|
73 | readonly dataStream: Observable<readonly T[]>;
|
---|
74 | /** The differ used to calculate changes to the data. */
|
---|
75 | private _differ;
|
---|
76 | /** The most recent data emitted from the DataSource. */
|
---|
77 | private _data;
|
---|
78 | /** The currently rendered items. */
|
---|
79 | private _renderedItems;
|
---|
80 | /** The currently rendered range of indices. */
|
---|
81 | private _renderedRange;
|
---|
82 | /** Whether the rendered data should be updated during the next ngDoCheck cycle. */
|
---|
83 | private _needsUpdate;
|
---|
84 | private readonly _destroyed;
|
---|
85 | constructor(
|
---|
86 | /** The view container to add items to. */
|
---|
87 | _viewContainerRef: ViewContainerRef,
|
---|
88 | /** The template to use when stamping out new items. */
|
---|
89 | _template: TemplateRef<CdkVirtualForOfContext<T>>,
|
---|
90 | /** The set of available differs. */
|
---|
91 | _differs: IterableDiffers,
|
---|
92 | /** The strategy used to render items in the virtual scroll viewport. */
|
---|
93 | _viewRepeater: _RecycleViewRepeaterStrategy<T, T, CdkVirtualForOfContext<T>>,
|
---|
94 | /** The virtual scrolling viewport that these items are being rendered in. */
|
---|
95 | _viewport: CdkVirtualScrollViewport, ngZone: NgZone);
|
---|
96 | /**
|
---|
97 | * Measures the combined size (width for horizontal orientation, height for vertical) of all items
|
---|
98 | * in the specified range. Throws an error if the range includes items that are not currently
|
---|
99 | * rendered.
|
---|
100 | */
|
---|
101 | measureRangeSize(range: ListRange, orientation: 'horizontal' | 'vertical'): number;
|
---|
102 | ngDoCheck(): void;
|
---|
103 | ngOnDestroy(): void;
|
---|
104 | /** React to scroll state changes in the viewport. */
|
---|
105 | private _onRenderedDataChange;
|
---|
106 | /** Swap out one `DataSource` for another. */
|
---|
107 | private _changeDataSource;
|
---|
108 | /** Update the `CdkVirtualForOfContext` for all views. */
|
---|
109 | private _updateContext;
|
---|
110 | /** Apply changes to the DOM. */
|
---|
111 | private _applyChanges;
|
---|
112 | /** Update the computed properties on the `CdkVirtualForOfContext`. */
|
---|
113 | private _updateComputedContextProperties;
|
---|
114 | private _getEmbeddedViewArgs;
|
---|
115 | static ngAcceptInputType_cdkVirtualForTemplateCacheSize: NumberInput;
|
---|
116 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkVirtualForOf<any>, [null, null, null, null, { skipSelf: true; }, null]>;
|
---|
117 | static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkVirtualForOf<any>, "[cdkVirtualFor][cdkVirtualForOf]", never, { "cdkVirtualForOf": "cdkVirtualForOf"; "cdkVirtualForTrackBy": "cdkVirtualForTrackBy"; "cdkVirtualForTemplate": "cdkVirtualForTemplate"; "cdkVirtualForTemplateCacheSize": "cdkVirtualForTemplateCacheSize"; }, {}, never>;
|
---|
118 | }
|
---|
119 |
|
---|
120 | //# sourceMappingURL=virtual-for-of.d.ts.map |
---|