(rows: Row<TData>[], depth = 0)
| 599 | |
| 600 | // Filters top level and nested rows |
| 601 | const recurseRows = (rows: Row<TData>[], depth = 0): Row<TData>[] => { |
| 602 | return rows |
| 603 | .map((row) => { |
| 604 | const isSelected = isRowSelected(row, rowSelection) |
| 605 | |
| 606 | if (isSelected) { |
| 607 | newSelectedFlatRows.push(row) |
| 608 | newSelectedRowsById[row.id] = row |
| 609 | } |
| 610 | |
| 611 | if (row.subRows?.length) { |
| 612 | row = { |
| 613 | ...row, |
| 614 | subRows: recurseRows(row.subRows, depth + 1), |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | if (isSelected) { |
| 619 | return row |
| 620 | } |
| 621 | }) |
| 622 | .filter(Boolean) as Row<TData>[] |
| 623 | } |
| 624 | |
| 625 | return { |
| 626 | rows: recurseRows(rowModel.rows), |
no test coverage detected