(props: {
readonly localRowId: Id;
readonly params: RelationshipInHtmlRowParams;
})
| 48 | }; |
| 49 | |
| 50 | export const RelationshipInHtmlRow = (props: { |
| 51 | readonly localRowId: Id; |
| 52 | readonly params: RelationshipInHtmlRowParams; |
| 53 | }) => { |
| 54 | const [ |
| 55 | idColumn, |
| 56 | cells, |
| 57 | localTableId, |
| 58 | remoteTableId, |
| 59 | relationshipId, |
| 60 | relationships, |
| 61 | store, |
| 62 | extraCellsBefore, |
| 63 | extraCellsAfter, |
| 64 | ] = props.params; |
| 65 | const remoteRowId = useRemoteRowId( |
| 66 | () => relationshipId, |
| 67 | () => props.localRowId, |
| 68 | () => relationships, |
| 69 | ); |
| 70 | const rowProps: RowProps = { |
| 71 | tableId: localTableId ?? '', |
| 72 | rowId: props.localRowId, |
| 73 | store, |
| 74 | }; |
| 75 | return ( |
| 76 | <tr> |
| 77 | {extraRowCells(extraCellsBefore, rowProps)} |
| 78 | {isFalse(idColumn) ? null : ( |
| 79 | <> |
| 80 | <th title={props.localRowId}>{props.localRowId}</th> |
| 81 | <th title={remoteRowId()}>{remoteRowId()}</th> |
| 82 | </> |
| 83 | )} |
| 84 | {objToArray( |
| 85 | getValue(cells), |
| 86 | ({component: CellView, getComponentProps}, compoundCellId) => { |
| 87 | const [tableId, cellId] = strSplit(compoundCellId, DOT, 2); |
| 88 | const rowId = |
| 89 | tableId === localTableId |
| 90 | ? props.localRowId |
| 91 | : tableId === remoteTableId |
| 92 | ? remoteRowId() |
| 93 | : undefined; |
| 94 | return isUndefined(rowId) ? null : ( |
| 95 | <td> |
| 96 | <CellView |
| 97 | {...getProps(getComponentProps, rowId, cellId)} |
| 98 | store={store} |
| 99 | tableId={tableId} |
| 100 | rowId={rowId} |
| 101 | cellId={cellId} |
| 102 | /> |
| 103 | </td> |
| 104 | ); |
| 105 | }, |
| 106 | )} |
| 107 | {extraRowCells(extraCellsAfter, rowProps)} |
no test coverage detected
searching dependent graphs…