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

Function RelationshipInHtmlTable

src/ui-solid-dom/RelationshipInHtmlTable.tsx:112–183  ·  view source on GitHub ↗
(
  props: RelationshipInHtmlTableProps & HtmlTableProps,
)

Source from the content-addressed store, hash-verified

110};
111
112export const RelationshipInHtmlTable = (
113 props: RelationshipInHtmlTableProps & HtmlTableProps,
114): JSXElement => {
115 const resolvedRelationships = useRelationshipsOrRelationshipsById(
116 () => props.relationships,
117 );
118 const details = createMemo(() =>
119 getRelationshipsStoreTableIds(
120 resolvedRelationships(),
121 props.relationshipId,
122 ),
123 );
124 const localCellIds = useDottedCellIds(
125 () => details()[2],
126 () => details()[1],
127 );
128 const remoteCellIds = useDottedCellIds(
129 () => details()[3],
130 () => details()[1],
131 );
132 const cellIds = createMemo(() => [...localCellIds(), ...remoteCellIds()]);
133 const cells = useCells(
134 cellIds,
135 () => props.customCells,
136 () => (props.editable ? EditableCellView : CellView),
137 );
138 const rowIds = useRowIds(
139 () => details()[2] as Id,
140 () => details()[1],
141 );
142 const content = () => {
143 const [relationships, store, localTableId, remoteTableId] = details();
144 const params = getParams(
145 props.idColumn ?? true,
146 cells,
147 localTableId,
148 remoteTableId,
149 props.relationshipId,
150 relationships,
151 store,
152 props.extraCellsBefore,
153 props.extraCellsAfter,
154 );
155 return (
156 <table class={props.className}>
157 {isFalse(props.headerRow) ? null : (
158 <thead>
159 <tr>
160 {extraHeaders(props.extraCellsBefore)}
161 {isFalse(props.idColumn) ? null : (
162 <>
163 <th>{localTableId}.Id</th>
164 <th>{remoteTableId}.Id</th>
165 </>
166 )}
167 {objToArray(cells(), (cell) => (
168 <th>{cell.label}</th>
169 ))}

Callers

nothing calls this directly

Calls 6

useCellsFunction · 0.90
useRowIdsFunction · 0.90
useDottedCellIdsFunction · 0.70
contentFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…