MCPcopy Index your code
hub / github.com/tinyplex/tinybase / RelationshipInHtmlTable

Function RelationshipInHtmlTable

src/ui-react-dom/RelationshipInHtmlTable.tsx:97–162  ·  view source on GitHub ↗
({
  relationshipId,
  relationships,
  editable,
  customCells,
  extraCellsBefore,
  extraCellsAfter,
  className,
  headerRow,
  idColumn = true,
}: RelationshipInHtmlTableProps & HtmlTableProps)

Source from the content-addressed store, hash-verified

95};
96
97export const RelationshipInHtmlTable = ({
98 relationshipId,
99 relationships,
100 editable,
101 customCells,
102 extraCellsBefore,
103 extraCellsAfter,
104 className,
105 headerRow,
106 idColumn = true,
107}: RelationshipInHtmlTableProps & HtmlTableProps): any => {
108 const [resolvedRelationships, store, localTableId, remoteTableId] =
109 getRelationshipsStoreTableIds(
110 useRelationshipsOrRelationshipsById(relationships),
111 relationshipId,
112 );
113 const cells = useCells(
114 [
115 ...useDottedCellIds(localTableId, store),
116 ...useDottedCellIds(remoteTableId, store),
117 ],
118 customCells,
119 editable ? EditableCellView : CellView,
120 );
121 const params = useParams(
122 idColumn,
123 cells,
124 localTableId,
125 remoteTableId,
126 relationshipId,
127 resolvedRelationships,
128 store,
129 extraCellsBefore,
130 extraCellsAfter,
131 );
132 return (
133 <table className={className}>
134 {isFalse(headerRow) ? null : (
135 <thead>
136 <tr>
137 {extraHeaders(extraCellsBefore)}
138 {isFalse(idColumn) ? null : (
139 <>
140 <th>{localTableId}.Id</th>
141 <th>{remoteTableId}.Id</th>
142 </>
143 )}
144 {objToArray(cells, ({label}, cellId) => (
145 <th key={cellId}>{label}</th>
146 ))}
147 {extraHeaders(extraCellsAfter, 1)}
148 </tr>
149 </thead>
150 )}
151 <tbody>
152 {arrayMap(useRowIds(localTableId as Id, store), (localRowId) => (
153 <RelationshipInHtmlRow
154 key={localRowId}

Callers

nothing calls this directly

Calls 10

useCellsFunction · 0.90
useParamsFunction · 0.90
isFalseFunction · 0.90
extraHeadersFunction · 0.90
objToArrayFunction · 0.90
arrayMapFunction · 0.90
useRowIdsFunction · 0.90
useDottedCellIdsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…