* 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>[]>,
)
| 1091 | * `(T, CdkRowDef)` pair. |
| 1092 | */ |
| 1093 | private _getRenderRowsForData( |
| 1094 | data: T, |
| 1095 | dataIndex: number, |
| 1096 | cache?: WeakMap<CdkRowDef<T>, RenderRow<T>[]>, |
| 1097 | ): RenderRow<T>[] { |
| 1098 | const rowDefs = this._getRowDefs(data, dataIndex); |
| 1099 | |
| 1100 | return rowDefs.map(rowDef => { |
| 1101 | const cachedRenderRows = cache && cache.has(rowDef) ? cache.get(rowDef)! : []; |
| 1102 | if (cachedRenderRows.length) { |
| 1103 | const dataRow = cachedRenderRows.shift()!; |
| 1104 | dataRow.dataIndex = dataIndex; |
| 1105 | return dataRow; |
| 1106 | } else { |
| 1107 | return {data, rowDef, dataIndex}; |
| 1108 | } |
| 1109 | }); |
| 1110 | } |
| 1111 | |
| 1112 | /** Update the map containing the content's column definitions. */ |
| 1113 | private _cacheColumnDefs() { |
no test coverage detected