diff --git a/src/qqq/components/widgets/tables/DataTable.tsx b/src/qqq/components/widgets/tables/DataTable.tsx index d039c2a..1cb35c9 100644 --- a/src/qqq/components/widgets/tables/DataTable.tsx +++ b/src/qqq/components/widgets/tables/DataTable.tsx @@ -321,137 +321,133 @@ function DataTable({ innerBoxStyle = {overflowY: "auto", scrollbarGutter: "stable"}; } + /////////////////////////////////////////////////////////////////////////////////// + // note - at one point, we had the table's sx including: whiteSpace: "nowrap"... // + /////////////////////////////////////////////////////////////////////////////////// return - +
{ includeHead && ( - - {headerGroups.map((headerGroup: any, i: number) => ( - - {headerGroup.headers.map((column: any) => ( - column.type !== "hidden" && ( - - {column.render("header")} - - ) - ))} - - ))} - + headerGroups.map((headerGroup: any, i: number) => ( + headerGroup.headers.map((column: any) => ( + column.type !== "hidden" && ( + + {column.render("header")} + + ) + )) + )) ) } - - {rows.map((row: any, key: any) => + {rows.map((row: any, key: any) => + { + prepareRow(row); + + let overrideNoEndBorder = false; + + ////////////////////////////////////////////////////////////////////////////////// + // don't do an end-border on nested rows - unless they're the last one in a set // + ////////////////////////////////////////////////////////////////////////////////// + if (row.depth > 0) { - prepareRow(row); - - let overrideNoEndBorder = false; - - ////////////////////////////////////////////////////////////////////////////////// - // don't do an end-border on nested rows - unless they're the last one in a set // - ////////////////////////////////////////////////////////////////////////////////// - if (row.depth > 0) + overrideNoEndBorder = true; + if (key + 1 < rows.length && rows[key + 1].depth == 0) { - overrideNoEndBorder = true; - if (key + 1 < rows.length && rows[key + 1].depth == 0) - { - overrideNoEndBorder = false; - } + overrideNoEndBorder = false; } + } - /////////////////////////////////////// - // don't do end-border on the footer // - /////////////////////////////////////// - if (isFooter) - { - overrideNoEndBorder = true; - } + /////////////////////////////////////// + // don't do end-border on the footer // + /////////////////////////////////////// + if (isFooter) + { + overrideNoEndBorder = true; + } - let background = "initial"; - if (isFooter) - { - background = "#EEEEEE"; - } - else if (row.depth > 0 || row.isExpanded) - { - background = "#FAFAFA"; - } + let background = "initial"; + if (isFooter) + { + background = "#EEEEEE"; + } + else if (row.depth > 0 || row.isExpanded) + { + background = "#FAFAFA"; + } - return ( - - {row.cells.map((cell: any) => ( - cell.column.type !== "hidden" && ( - - { - cell.column.type === "default" && ( - cell.value && "number" === typeof cell.value ? ( - {cell.value.toLocaleString()} - ) : ({cell.render("Cell")}) - ) - } - { - cell.column.type === "htmlAndTooltip" && ( - - - - {parse(cell.value)} - - - - ) - } - { - cell.column.type === "html" && ( - {parse(cell.value ?? "")} - ) - } - { - cell.column.type === "composite" && ( - - - - ) - } - { - cell.column.type === "block" && ( - - - - ) - } - { - cell.column.type === "image" && row.values["imageTotal"] && ( - - ) - } - { - cell.column.type === "image" && !row.values["imageTotal"] && ( - - ) - } - { - (cell.column.id === "__expander") && cell.render("cell") - } - - ) - ))} - - ); - })} - - + return ( + row.cells.map((cell: any) => ( + cell.column.type !== "hidden" && ( + + { + cell.column.type === "default" && ( + cell.value && "number" === typeof cell.value ? ( + {cell.value.toLocaleString()} + ) : ({cell.render("Cell")}) + ) + } + { + cell.column.type === "htmlAndTooltip" && ( + + + + {parse(cell.value)} + + + + ) + } + { + cell.column.type === "html" && ( + {parse(cell.value ?? "")} + ) + } + { + cell.column.type === "composite" && ( + + + + ) + } + { + cell.column.type === "block" && ( + + + + ) + } + { + cell.column.type === "image" && row.values["imageTotal"] && ( + + ) + } + { + cell.column.type === "image" && !row.values["imageTotal"] && ( + + ) + } + { + (cell.column.id === "__expander") && cell.render("cell") + } + + ) + )) + ); + })}
; } diff --git a/src/qqq/components/widgets/tables/cells/DataTableBodyCell.tsx b/src/qqq/components/widgets/tables/cells/DataTableBodyCell.tsx index 5f22d53..2e13d22 100644 --- a/src/qqq/components/widgets/tables/cells/DataTableBodyCell.tsx +++ b/src/qqq/components/widgets/tables/cells/DataTableBodyCell.tsx @@ -36,7 +36,7 @@ function DataTableBodyCell({noBorder, align, children}: Props): JSX.Element { return ( ({ borderBottom: `${borderWidth[1]} solid ${colors.grayLines.main}`, - "&:nth-of-type(1)": { - paddingLeft: "1rem" - }, - "&:last-child": { - paddingRight: "1rem" - }, + position: "sticky", top: 0, background: "white" })} >