Given an Observable containing a stream of the raw data, returns an Observable containing the RenderingData
(dataStream: Observable<readonly T[]>)
| 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) { |
no test coverage detected