source: trip-planner-front/node_modules/@angular/cdk/esm2015/scrolling/virtual-for-of.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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