* Get the matching row definitions that should be used for this row data. If there is only * one row definition, it is returned. Otherwise, find the row definitions that has a when * predicate that returns true with the data. If none return true, return the default row * definition.
(data: T, dataIndex: number)
| 1321 | * definition. |
| 1322 | */ |
| 1323 | _getRowDefs(data: T, dataIndex: number): CdkRowDef<T>[] { |
| 1324 | if (this._rowDefs.length === 1) { |
| 1325 | return [this._rowDefs[0]]; |
| 1326 | } |
| 1327 | |
| 1328 | let rowDefs: CdkRowDef<T>[] = []; |
| 1329 | if (this.multiTemplateDataRows) { |
| 1330 | rowDefs = this._rowDefs.filter(def => !def.when || def.when(dataIndex, data)); |
| 1331 | } else { |
| 1332 | let rowDef = |
| 1333 | this._rowDefs.find(def => def.when && def.when(dataIndex, data)) || this._defaultRowDef; |
| 1334 | if (rowDef) { |
| 1335 | rowDefs.push(rowDef); |
| 1336 | } |
| 1337 | } |
| 1338 | |
| 1339 | if (!rowDefs.length && (typeof ngDevMode === 'undefined' || ngDevMode)) { |
| 1340 | throw getTableMissingMatchingRowDefError(data); |
| 1341 | } |
| 1342 | |
| 1343 | return rowDefs; |
| 1344 | } |
| 1345 | |
| 1346 | private _getEmbeddedViewArgs( |
| 1347 | renderRow: RenderRow<T>, |
no test coverage detected