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 { ArrayDataSource, isDataSource, _RecycleViewRepeaterStrategy, _VIEW_REPEATER_STRATEGY, } from '@angular/cdk/collections';
|
9 | import { Directive, Inject, Input, IterableDiffers, NgZone, SkipSelf, TemplateRef, ViewContainerRef, } from '@angular/core';
|
10 | import { coerceNumberProperty } from '@angular/cdk/coercion';
|
11 | import { Subject, of as observableOf, isObservable } from 'rxjs';
|
12 | import { pairwise, shareReplay, startWith, switchMap, takeUntil } from 'rxjs/operators';
|
13 | import { CdkVirtualScrollViewport } from './virtual-scroll-viewport';
|
14 | import * as i0 from "@angular/core";
|
15 | import * as i1 from "./virtual-scroll-viewport";
|
16 | import * as i2 from "@angular/cdk/collections";
|
17 | /** Helper to extract the offset of a DOM Node in a certain direction. */
|
18 | function getOffset(orientation, direction, node) {
|
19 | const el = node;
|
20 | if (!el.getBoundingClientRect) {
|
21 | return 0;
|
22 | }
|
23 | const rect = el.getBoundingClientRect();
|
24 | if (orientation === 'horizontal') {
|
25 | return direction === 'start' ? rect.left : rect.right;
|
26 | }
|
27 | return direction === 'start' ? rect.top : rect.bottom;
|
28 | }
|
29 | /**
|
30 | * A directive similar to `ngForOf` to be used for rendering data inside a virtual scrolling
|
31 | * container.
|
32 | */
|
33 | class CdkVirtualForOf {
|
34 | /** The DataSource to display. */
|
35 | get cdkVirtualForOf() {
|
36 | return this._cdkVirtualForOf;
|
37 | }
|
38 | set cdkVirtualForOf(value) {
|
39 | this._cdkVirtualForOf = value;
|
40 | if (isDataSource(value)) {
|
41 | this._dataSourceChanges.next(value);
|
42 | }
|
43 | else {
|
44 | // If value is an an NgIterable, convert it to an array.
|
45 | this._dataSourceChanges.next(new ArrayDataSource(isObservable(value) ? value : Array.from(value || [])));
|
46 | }
|
47 | }
|
48 | /**
|
49 | * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and
|
50 | * the item and produces a value to be used as the item's identity when tracking changes.
|
51 | */
|
52 | get cdkVirtualForTrackBy() {
|
53 | return this._cdkVirtualForTrackBy;
|
54 | }
|
55 | set cdkVirtualForTrackBy(fn) {
|
56 | this._needsUpdate = true;
|
57 | this._cdkVirtualForTrackBy = fn
|
58 | ? (index, item) => fn(index + (this._renderedRange ? this._renderedRange.start : 0), item)
|
59 | : undefined;
|
60 | }
|
61 | /** The template used to stamp out new elements. */
|
62 | set cdkVirtualForTemplate(value) {
|
63 | if (value) {
|
64 | this._needsUpdate = true;
|
65 | this._template = value;
|
66 | }
|
67 | }
|
68 | /**
|
69 | * The size of the cache used to store templates that are not being used for re-use later.
|
70 | * Setting the cache size to `0` will disable caching. Defaults to 20 templates.
|
71 | */
|
72 | get cdkVirtualForTemplateCacheSize() {
|
73 | return this._viewRepeater.viewCacheSize;
|
74 | }
|
75 | set cdkVirtualForTemplateCacheSize(size) {
|
76 | this._viewRepeater.viewCacheSize = coerceNumberProperty(size);
|
77 | }
|
78 | constructor(
|
79 | /** The view container to add items to. */
|
80 | _viewContainerRef,
|
81 | /** The template to use when stamping out new items. */
|
82 | _template,
|
83 | /** The set of available differs. */
|
84 | _differs,
|
85 | /** The strategy used to render items in the virtual scroll viewport. */
|
86 | _viewRepeater,
|
87 | /** The virtual scrolling viewport that these items are being rendered in. */
|
88 | _viewport, ngZone) {
|
89 | this._viewContainerRef = _viewContainerRef;
|
90 | this._template = _template;
|
91 | this._differs = _differs;
|
92 | this._viewRepeater = _viewRepeater;
|
93 | this._viewport = _viewport;
|
94 | /** Emits when the rendered view of the data changes. */
|
95 | this.viewChange = new Subject();
|
96 | /** Subject that emits when a new DataSource instance is given. */
|
97 | this._dataSourceChanges = new Subject();
|
98 | /** Emits whenever the data in the current DataSource changes. */
|
99 | this.dataStream = this._dataSourceChanges.pipe(
|
100 | // Start off with null `DataSource`.
|
101 | startWith(null),
|
102 | // Bundle up the previous and current data sources so we can work with both.
|
103 | pairwise(),
|
104 | // Use `_changeDataSource` to disconnect from the previous data source and connect to the
|
105 | // new one, passing back a stream of data changes which we run through `switchMap` to give
|
106 | // us a data stream that emits the latest data from whatever the current `DataSource` is.
|
107 | switchMap(([prev, cur]) => this._changeDataSource(prev, cur)),
|
108 | // Replay the last emitted data when someone subscribes.
|
109 | shareReplay(1));
|
110 | /** The differ used to calculate changes to the data. */
|
111 | this._differ = null;
|
112 | /** Whether the rendered data should be updated during the next ngDoCheck cycle. */
|
113 | this._needsUpdate = false;
|
114 | this._destroyed = new Subject();
|
115 | this.dataStream.subscribe(data => {
|
116 | this._data = data;
|
117 | this._onRenderedDataChange();
|
118 | });
|
119 | this._viewport.renderedRangeStream.pipe(takeUntil(this._destroyed)).subscribe(range => {
|
120 | this._renderedRange = range;
|
121 | if (this.viewChange.observers.length) {
|
122 | ngZone.run(() => this.viewChange.next(this._renderedRange));
|
123 | }
|
124 | this._onRenderedDataChange();
|
125 | });
|
126 | this._viewport.attach(this);
|
127 | }
|
128 | /**
|
129 | * Measures the combined size (width for horizontal orientation, height for vertical) of all items
|
130 | * in the specified range. Throws an error if the range includes items that are not currently
|
131 | * rendered.
|
132 | */
|
133 | measureRangeSize(range, orientation) {
|
134 | if (range.start >= range.end) {
|
135 | return 0;
|
136 | }
|
137 | if ((range.start < this._renderedRange.start || range.end > this._renderedRange.end) &&
|
138 | (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
139 | throw Error(`Error: attempted to measure an item that isn't rendered.`);
|
140 | }
|
141 | // The index into the list of rendered views for the first item in the range.
|
142 | const renderedStartIndex = range.start - this._renderedRange.start;
|
143 | // The length of the range we're measuring.
|
144 | const rangeLen = range.end - range.start;
|
145 | // Loop over all the views, find the first and land node and compute the size by subtracting
|
146 | // the top of the first node from the bottom of the last one.
|
147 | let firstNode;
|
148 | let lastNode;
|
149 | // Find the first node by starting from the beginning and going forwards.
|
150 | for (let i = 0; i < rangeLen; i++) {
|
151 | const view = this._viewContainerRef.get(i + renderedStartIndex);
|
152 | if (view && view.rootNodes.length) {
|
153 | firstNode = lastNode = view.rootNodes[0];
|
154 | break;
|
155 | }
|
156 | }
|
157 | // Find the last node by starting from the end and going backwards.
|
158 | for (let i = rangeLen - 1; i > -1; i--) {
|
159 | const view = this._viewContainerRef.get(i + renderedStartIndex);
|
160 | if (view && view.rootNodes.length) {
|
161 | lastNode = view.rootNodes[view.rootNodes.length - 1];
|
162 | break;
|
163 | }
|
164 | }
|
165 | return firstNode && lastNode
|
166 | ? getOffset(orientation, 'end', lastNode) - getOffset(orientation, 'start', firstNode)
|
167 | : 0;
|
168 | }
|
169 | ngDoCheck() {
|
170 | if (this._differ && this._needsUpdate) {
|
171 | // TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of
|
172 | // this list being rendered (can use simpler algorithm) vs needs update due to data actually
|
173 | // changing (need to do this diff).
|
174 | const changes = this._differ.diff(this._renderedItems);
|
175 | if (!changes) {
|
176 | this._updateContext();
|
177 | }
|
178 | else {
|
179 | this._applyChanges(changes);
|
180 | }
|
181 | this._needsUpdate = false;
|
182 | }
|
183 | }
|
184 | ngOnDestroy() {
|
185 | this._viewport.detach();
|
186 | this._dataSourceChanges.next(undefined);
|
187 | this._dataSourceChanges.complete();
|
188 | this.viewChange.complete();
|
189 | this._destroyed.next();
|
190 | this._destroyed.complete();
|
191 | this._viewRepeater.detach();
|
192 | }
|
193 | /** React to scroll state changes in the viewport. */
|
194 | _onRenderedDataChange() {
|
195 | if (!this._renderedRange) {
|
196 | return;
|
197 | }
|
198 | this._renderedItems = this._data.slice(this._renderedRange.start, this._renderedRange.end);
|
199 | if (!this._differ) {
|
200 | // Use a wrapper function for the `trackBy` so any new values are
|
201 | // picked up automatically without having to recreate the differ.
|
202 | this._differ = this._differs.find(this._renderedItems).create((index, item) => {
|
203 | return this.cdkVirtualForTrackBy ? this.cdkVirtualForTrackBy(index, item) : item;
|
204 | });
|
205 | }
|
206 | this._needsUpdate = true;
|
207 | }
|
208 | /** Swap out one `DataSource` for another. */
|
209 | _changeDataSource(oldDs, newDs) {
|
210 | if (oldDs) {
|
211 | oldDs.disconnect(this);
|
212 | }
|
213 | this._needsUpdate = true;
|
214 | return newDs ? newDs.connect(this) : observableOf();
|
215 | }
|
216 | /** Update the `CdkVirtualForOfContext` for all views. */
|
217 | _updateContext() {
|
218 | const count = this._data.length;
|
219 | let i = this._viewContainerRef.length;
|
220 | while (i--) {
|
221 | const view = this._viewContainerRef.get(i);
|
222 | view.context.index = this._renderedRange.start + i;
|
223 | view.context.count = count;
|
224 | this._updateComputedContextProperties(view.context);
|
225 | view.detectChanges();
|
226 | }
|
227 | }
|
228 | /** Apply changes to the DOM. */
|
229 | _applyChanges(changes) {
|
230 | this._viewRepeater.applyChanges(changes, this._viewContainerRef, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record, currentIndex), record => record.item);
|
231 | // Update $implicit for any items that had an identity change.
|
232 | changes.forEachIdentityChange((record) => {
|
233 | const view = this._viewContainerRef.get(record.currentIndex);
|
234 | view.context.$implicit = record.item;
|
235 | });
|
236 | // Update the context variables on all items.
|
237 | const count = this._data.length;
|
238 | let i = this._viewContainerRef.length;
|
239 | while (i--) {
|
240 | const view = this._viewContainerRef.get(i);
|
241 | view.context.index = this._renderedRange.start + i;
|
242 | view.context.count = count;
|
243 | this._updateComputedContextProperties(view.context);
|
244 | }
|
245 | }
|
246 | /** Update the computed properties on the `CdkVirtualForOfContext`. */
|
247 | _updateComputedContextProperties(context) {
|
248 | context.first = context.index === 0;
|
249 | context.last = context.index === context.count - 1;
|
250 | context.even = context.index % 2 === 0;
|
251 | context.odd = !context.even;
|
252 | }
|
253 | _getEmbeddedViewArgs(record, index) {
|
254 | // Note that it's important that we insert the item directly at the proper index,
|
255 | // rather than inserting it and the moving it in place, because if there's a directive
|
256 | // on the same node that injects the `ViewContainerRef`, Angular will insert another
|
257 | // comment node which can throw off the move when it's being repeated for all items.
|
258 | return {
|
259 | templateRef: this._template,
|
260 | context: {
|
261 | $implicit: record.item,
|
262 | // It's guaranteed that the iterable is not "undefined" or "null" because we only
|
263 | // generate views for elements if the "cdkVirtualForOf" iterable has elements.
|
264 | cdkVirtualForOf: this._cdkVirtualForOf,
|
265 | index: -1,
|
266 | count: -1,
|
267 | first: false,
|
268 | last: false,
|
269 | odd: false,
|
270 | even: false,
|
271 | },
|
272 | index,
|
273 | };
|
274 | }
|
275 | static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkVirtualForOf, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: i0.IterableDiffers }, { token: _VIEW_REPEATER_STRATEGY }, { token: i1.CdkVirtualScrollViewport, skipSelf: true }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
276 | static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkVirtualForOf, isStandalone: true, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: { cdkVirtualForOf: "cdkVirtualForOf", cdkVirtualForTrackBy: "cdkVirtualForTrackBy", cdkVirtualForTemplate: "cdkVirtualForTemplate", cdkVirtualForTemplateCacheSize: "cdkVirtualForTemplateCacheSize" }, providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }], ngImport: i0 }); }
|
277 | }
|
278 | export { CdkVirtualForOf };
|
279 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkVirtualForOf, decorators: [{
|
280 | type: Directive,
|
281 | args: [{
|
282 | selector: '[cdkVirtualFor][cdkVirtualForOf]',
|
283 | providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }],
|
284 | standalone: true,
|
285 | }]
|
286 | }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i0.IterableDiffers }, { type: i2._RecycleViewRepeaterStrategy, decorators: [{
|
287 | type: Inject,
|
288 | args: [_VIEW_REPEATER_STRATEGY]
|
289 | }] }, { type: i1.CdkVirtualScrollViewport, decorators: [{
|
290 | type: SkipSelf
|
291 | }] }, { type: i0.NgZone }]; }, propDecorators: { cdkVirtualForOf: [{
|
292 | type: Input
|
293 | }], cdkVirtualForTrackBy: [{
|
294 | type: Input
|
295 | }], cdkVirtualForTemplate: [{
|
296 | type: Input
|
297 | }], cdkVirtualForTemplateCacheSize: [{
|
298 | type: Input
|
299 | }] } });
|
300 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlydHVhbC1mb3Itb2YuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3Njcm9sbGluZy92aXJ0dWFsLWZvci1vZi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQ0wsZUFBZSxFQUlmLFlBQVksRUFDWiw0QkFBNEIsRUFDNUIsdUJBQXVCLEdBRXhCLE1BQU0sMEJBQTBCLENBQUM7QUFDbEMsT0FBTyxFQUNMLFNBQVMsRUFHVCxNQUFNLEVBQ04sS0FBSyxFQUlMLGVBQWUsRUFFZixNQUFNLEVBRU4sUUFBUSxFQUNSLFdBQVcsRUFFWCxnQkFBZ0IsR0FDakIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLG9CQUFvQixFQUFjLE1BQU0sdUJBQXVCLENBQUM7QUFDeEUsT0FBTyxFQUFhLE9BQU8sRUFBRSxFQUFFLElBQUksWUFBWSxFQUFFLFlBQVksRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUMzRSxPQUFPLEVBQUMsUUFBUSxFQUFFLFdBQVcsRUFBRSxTQUFTLEVBQUUsU0FBUyxFQUFFLFNBQVMsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBR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