* Gets a list of `RenderRow ` for the provided data object and any `CdkRowDef` objects that * should be rendered for this data. Reuses the cached RenderRow objects if they match the same * `(T, CdkRowDef)` pair.
(
data: T,
dataIndex: number,
cache?: WeakMap<CdkRowDef<T>, RenderRow<T>[]>,
)
| 1109 | * `(T, CdkRowDef)` pair. |
| 1110 | */ |
| 1111 | private _getRenderRowsForData( |
| 1112 | data: T, |
| 1113 | dataIndex: number, |
| 1114 | cache?: WeakMap<CdkRowDef<T>, RenderRow<T>[]>, |
| 1115 | ): RenderRow<T>[] { |
| 1116 | const rowDefs = this._getRowDefs(data, dataIndex); |
| 1117 | |
| 1118 | return rowDefs.map(rowDef => { |
| 1119 | const cachedRenderRows = cache && cache.has(rowDef) ? cache.get(rowDef)! : []; |
| 1120 | if (cachedRenderRows.length) { |
| 1121 | const dataRow = cachedRenderRows.shift()!; |
| 1122 | dataRow.dataIndex = dataIndex; |
| 1123 | return dataRow; |
| 1124 | } else { |
| 1125 | return {data, rowDef, dataIndex}; |
| 1126 | } |
| 1127 | }); |
| 1128 | } |
| 1129 | |
| 1130 | /** Update the map containing the content's column definitions. */ |
| 1131 | private _cacheColumnDefs() { |
no test coverage detected