Skip to content

Commit e082bea

Browse files
authored
fix: should pass colGroup (#1358)
* fix: should pass colGroup * fix
1 parent 2cbe690 commit e082bea

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/FixedHolder/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface FixedHeaderProps<RecordType> extends HeaderProps<RecordType> {
4040
tableLayout?: TableLayout;
4141
onScroll: (info: { currentTarget: HTMLDivElement; scrollLeft?: number }) => void;
4242
children: (info: HeaderProps<RecordType>) => React.ReactNode;
43+
colGroup?: React.ReactNode;
4344
}
4445

4546
const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((props, ref) => {
@@ -54,6 +55,7 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
5455
columns,
5556
flattenColumns,
5657
colWidths,
58+
colGroup,
5759
columCount,
5860
stickyOffsets,
5961
direction,
@@ -185,7 +187,9 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
185187
width: scrollX,
186188
}}
187189
>
188-
{isColGroupEmpty ? null : (
190+
{isColGroupEmpty ? (
191+
colGroup
192+
) : (
189193
<ColGroup
190194
colWidths={[...mergedColumnWidth, combinationScrollBarSize]}
191195
columCount={columCount + 1}

src/Table.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ const Table = <RecordType extends DefaultRecordType>(
741741
stickyTopOffset={offsetHeader}
742742
className={`${prefixCls}-header`}
743743
ref={scrollHeaderRef}
744+
colGroup={bodyColGroup}
744745
>
745746
{renderFixedHeaderTable}
746747
</FixedHolder>
@@ -756,6 +757,7 @@ const Table = <RecordType extends DefaultRecordType>(
756757
stickyBottomOffset={offsetSummary}
757758
className={`${prefixCls}-summary`}
758759
ref={scrollSummaryRef}
760+
colGroup={bodyColGroup}
759761
>
760762
{renderFixedFooterTable}
761763
</FixedHolder>

tests/__snapshots__/FixedColumn.spec.tsx.snap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,26 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - without data 1`] = `
26962696
<table
26972697
style="table-layout: fixed; min-width: 100%; width: 1200px;"
26982698
>
2699+
<colgroup>
2700+
<col
2701+
style="width: 100px;"
2702+
/>
2703+
<col
2704+
style="width: 100px;"
2705+
/>
2706+
<col />
2707+
<col />
2708+
<col />
2709+
<col />
2710+
<col />
2711+
<col />
2712+
<col />
2713+
<col />
2714+
<col />
2715+
<col
2716+
style="width: 100px;"
2717+
/>
2718+
</colgroup>
26992719
<thead
27002720
class="rc-table-thead"
27012721
>

0 commit comments

Comments
 (0)