(props: TableProps & {readonly storeId?: Id} & StoreProp)
| 624 | }; |
| 625 | |
| 626 | const TableView = (props: TableProps & {readonly storeId?: Id} & StoreProp) => { |
| 627 | const uniqueId = getUniqueId('t', props.storeId, props.tableId); |
| 628 | const sort = useCell(STATE_TABLE, uniqueId, SORT_CELL, props.s); |
| 629 | const handleChange = useSetCellCallback( |
| 630 | STATE_TABLE, |
| 631 | uniqueId, |
| 632 | SORT_CELL, |
| 633 | jsonStringWithMap, |
| 634 | props.s, |
| 635 | ); |
| 636 | const [editable, handleEditable] = useEditable(uniqueId, props.s); |
| 637 | const cellIds = useTableCellIds(props.tableId, props.store); |
| 638 | return Details({ |
| 639 | uniqueId, |
| 640 | title: TABLE + ': ' + props.tableId, |
| 641 | editable, |
| 642 | handleEditable, |
| 643 | s: props.s, |
| 644 | get children() { |
| 645 | const [cellId, descending, offset] = jsonParse( |
| 646 | (sort() as string) ?? '[]', |
| 647 | ); |
| 648 | return ( |
| 649 | <> |
| 650 | <SortedTableInHtmlTable |
| 651 | tableId={props.tableId} |
| 652 | store={props.store} |
| 653 | cellId={cellId} |
| 654 | descending={descending} |
| 655 | offset={offset} |
| 656 | limit={10} |
| 657 | paginator={true} |
| 658 | sortOnClick={true} |
| 659 | onChange={handleChange} |
| 660 | editable={editable()} |
| 661 | extraCellsAfter={ |
| 662 | (() => (editable() ? rowActions : [])) as unknown as [] |
| 663 | } |
| 664 | customCells={ |
| 665 | (() => { |
| 666 | const CellComponent = editable() |
| 667 | ? EditableCellViewWithActions |
| 668 | : CellView; |
| 669 | return objNew( |
| 670 | arrayMap(cellIds(), (cellId) => [ |
| 671 | cellId, |
| 672 | {label: cellId, component: CellComponent}, |
| 673 | ]), |
| 674 | ); |
| 675 | }) as unknown as {[cellId: Id]: CustomCell} |
| 676 | } |
| 677 | /> |
| 678 | {editable() ? ( |
| 679 | <div class="actions"> |
| 680 | <div> |
| 681 | <TableActions1 tableId={props.tableId} store={props.store} /> |
| 682 | </div> |
| 683 | <div> |
nothing calls this directly
no test coverage detected
searching dependent graphs…