Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Body/BodyRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
component={RowComponent}
cellComponent={cellComponent}
colSpan={flattenColumns.length}
isEmpty={false}
>
{expandContent}
</ExpandedRow>
Expand Down
9 changes: 7 additions & 2 deletions src/Body/ExpandedRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ExpandedRowProps {
expanded: boolean;
children: React.ReactNode;
colSpan: number;
isEmpty: boolean;
}

function ExpandedRow({
Expand All @@ -22,15 +23,17 @@ function ExpandedRow({
className,
expanded,
colSpan,
isEmpty,
}: ExpandedRowProps) {
const { scrollbarSize } = React.useContext(TableContext);
const { fixHeader, fixColumn, componentWidth } = React.useContext(ExpandedRowContext);
const { fixHeader, fixColumn, componentWidth, horizonScroll } =
React.useContext(ExpandedRowContext);

// Cache render node
return React.useMemo(() => {
let contentNode = children;

if (fixColumn) {
if (isEmpty ? horizonScroll : fixColumn) {
contentNode = (
<div
style={{
Expand Down Expand Up @@ -64,10 +67,12 @@ function ExpandedRow({
className,
expanded,
colSpan,
isEmpty,
scrollbarSize,
componentWidth,
fixColumn,
fixHeader,
horizonScroll,
]);
}

Expand Down
1 change: 1 addition & 0 deletions src/Body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function Body<RecordType>({
component={trComponent}
cellComponent={tdComponent}
colSpan={flattenColumns.length}
isEmpty
>
{emptyNode}
</ExpandedRow>
Expand Down
3 changes: 2 additions & 1 deletion src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,9 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
componentWidth,
fixHeader,
fixColumn,
horizonScroll
}),
[componentWidth, fixHeader, fixColumn],
[componentWidth, fixHeader, fixColumn, horizonScroll],
);

const ResizeContextValue = React.useMemo(() => ({ onColumnResize }), [onColumnResize]);
Expand Down
1 change: 1 addition & 0 deletions src/context/ExpandedRowContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface ExpandedRowProps {
componentWidth: number;
fixHeader: boolean;
fixColumn: boolean;
horizonScroll: boolean;
}

const ExpandedRowContext = React.createContext<ExpandedRowProps>(null);
Expand Down