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