MCPcopy
hub / github.com/tinyplex/tinybase / HtmlTable

Function HtmlTable

src/ui-react-dom/common/components.tsx:72–140  ·  view source on GitHub ↗
({
  className,
  headerRow,
  idColumn,
  params: [
    cells,
    cellComponentProps,
    rowIds,
    extraCellsBefore,
    extraCellsAfter,
    sortAndOffset,
    handleSort,
    paginatorComponent,
  ],
}: HtmlTableProps & {
  readonly params: HtmlTableParams;
})

Source from the content-addressed store, hash-verified

70 </th>
71);
72export const HtmlTable = ({
73 className,
74 headerRow,
75 idColumn,
76 params: [
77 cells,
78 cellComponentProps,
79 rowIds,
80 extraCellsBefore,
81 extraCellsAfter,
82 sortAndOffset,
83 handleSort,
84 paginatorComponent,
85 ],
86}: HtmlTableProps & {
87 readonly params: HtmlTableParams;
88}) => (
89 <table className={className}>
90 {paginatorComponent ? <caption>{paginatorComponent}</caption> : null}
91 {headerRow === false ? null : (
92 <thead>
93 <tr>
94 {extraHeaders(extraCellsBefore)}
95 {idColumn === false ? null : (
96 <HtmlHeaderCell
97 sort={sortAndOffset ?? []}
98 label="Id"
99 onClick={handleSort}
100 />
101 )}
102 {objToArray(cells, ({label}, cellId) => (
103 <HtmlHeaderCell
104 key={cellId}
105 cellId={cellId}
106 label={label}
107 sort={sortAndOffset ?? []}
108 onClick={handleSort}
109 />
110 ))}
111 {extraHeaders(extraCellsAfter, 1)}
112 </tr>
113 </thead>
114 )}
115 <tbody>
116 {arrayMap(rowIds, (rowId) => {
117 const rowProps = {...(cellComponentProps as any), rowId};
118 return (
119 <tr key={rowId}>
120 {extraRowCells(extraCellsBefore, rowProps)}
121 {isFalse(idColumn) ? null : <th title={rowId}>{rowId}</th>}
122 {objToArray(
123 cells,
124 ({component: CellView, getComponentProps}, cellId) => (
125 <td key={cellId}>
126 <CellView
127 {...getProps(getComponentProps, rowId, cellId)}
128 {...rowProps}
129 cellId={cellId}

Callers

nothing calls this directly

Calls 6

extraHeadersFunction · 0.90
objToArrayFunction · 0.90
arrayMapFunction · 0.90
extraRowCellsFunction · 0.90
isFalseFunction · 0.90
getPropsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…