fix(chart-table): Scrollbar causing header + footer overflow (#21064)

This commit is contained in:
Reese 2022-12-16 00:25:20 -05:00 committed by GitHub
parent 89bb6c024b
commit 2679ee2e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 21 deletions

View File

@ -237,7 +237,7 @@ function StickyWrap({
const colWidths = columnWidths?.slice(0, columnCount); const colWidths = columnWidths?.slice(0, columnCount);
if (colWidths && bodyHeight) { if (colWidths && bodyHeight) {
const bodyColgroup = ( const colgroup = (
<colgroup> <colgroup>
{colWidths.map((w, i) => ( {colWidths.map((w, i) => (
// eslint-disable-next-line react/no-array-index-key // eslint-disable-next-line react/no-array-index-key
@ -246,23 +246,6 @@ function StickyWrap({
</colgroup> </colgroup>
); );
// header columns do not have vertical scroll bars,
// so we add scroll bar size to the last column
const headerColgroup =
sticky.hasVerticalScroll && scrollBarSize ? (
<colgroup>
{colWidths.map((x, i) => (
// eslint-disable-next-line react/no-array-index-key
<col
key={i}
width={x + (i === colWidths.length - 1 ? scrollBarSize : 0)}
/>
))}
</colgroup>
) : (
bodyColgroup
);
headerTable = ( headerTable = (
<div <div
key="header" key="header"
@ -274,7 +257,7 @@ function StickyWrap({
{React.cloneElement( {React.cloneElement(
table, table,
mergeStyleProp(table, fixedTableLayout), mergeStyleProp(table, fixedTableLayout),
headerColgroup, colgroup,
thead, thead,
)} )}
{headerTable} {headerTable}
@ -292,7 +275,7 @@ function StickyWrap({
{React.cloneElement( {React.cloneElement(
table, table,
mergeStyleProp(table, fixedTableLayout), mergeStyleProp(table, fixedTableLayout),
headerColgroup, colgroup,
tfoot, tfoot,
)} )}
{footerTable} {footerTable}
@ -320,7 +303,7 @@ function StickyWrap({
{React.cloneElement( {React.cloneElement(
table, table,
mergeStyleProp(table, fixedTableLayout), mergeStyleProp(table, fixedTableLayout),
bodyColgroup, colgroup,
tbody, tbody,
)} )}
</div> </div>