MCPcopy Create free account
hub / github.com/angular/components / _getRenderRowsForData

Method _getRenderRowsForData

src/cdk/table/table.ts:1111–1128  ·  view source on GitHub ↗

* 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>[]>,
  )

Source from the content-addressed store, hash-verified

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() {

Callers 1

_getAllRenderRowsMethod · 0.95

Calls 2

_getRowDefsMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected