MCPcopy Index your code
hub / github.com/angular/components / _getRenderData

Method _getRenderData

src/cdk/tree/tree.ts:402–428  ·  view source on GitHub ↗

Given an Observable containing a stream of the raw data, returns an Observable containing the RenderingData

(dataStream: Observable<readonly T[]>)

Source from the content-addressed store, hash-verified

400
401 /** Given an Observable containing a stream of the raw data, returns an Observable containing the RenderingData */
402 private _getRenderData(dataStream: Observable<readonly T[]>): Observable<RenderingData<T>> {
403 const expansionModel = this._getExpansionModel();
404 return combineLatest([
405 dataStream,
406 this._nodeType,
407 // We don't use the expansion data directly, however we add it here to essentially
408 // trigger data rendering when expansion changes occur.
409 expansionModel.changed.pipe(
410 startWith(null),
411 tap(expansionChanges => {
412 this._emitExpansionChanges(expansionChanges);
413 }),
414 ),
415 ]).pipe(
416 switchMap(([data, nodeType]) => {
417 if (nodeType === null) {
418 return observableOf({renderNodes: data, flattenedNodes: null, nodeType} as const);
419 }
420
421 // If we're here, then we know what our node type is, and therefore can
422 // perform our usual rendering pipeline, which necessitates converting the data
423 return this._computeRenderingData(data, nodeType).pipe(
424 map(convertedData => ({...convertedData, nodeType}) as const),
425 );
426 }),
427 );
428 }
429
430 private _renderDataChanges(data: RenderingData<T>) {
431 if (data.nodeType === null) {

Callers 1

Calls 3

_getExpansionModelMethod · 0.95
_emitExpansionChangesMethod · 0.95
_computeRenderingDataMethod · 0.95

Tested by

no test coverage detected