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

Method _getRenderRowsForData

src/cdk/table/table.ts:1093–1110  ·  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

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

Callers 1

_getAllRenderRowsMethod · 0.95

Calls 2

_getRowDefsMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected