Skip to content

Commit a3e7ee9

Browse files
committed
chore: expanded support
1 parent ed838a7 commit a3e7ee9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/StaticTable/BodyLine.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
2323
const { data, index, className, rowKey, style, extra, getHeight, ...restProps } = props;
2424
const { record, indent } = data;
2525

26-
const { flattenColumns, prefixCls, expandableType, rowExpandable } = useContext(TableContext, [
26+
const { flattenColumns, prefixCls } = useContext(TableContext, [
2727
'prefixCls',
2828
'flattenColumns',
2929
'expandableType',
@@ -34,6 +34,12 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
3434
const rowInfo = useRowInfo(record, rowKey);
3535

3636
// ========================== Expand ==========================
37+
const { expandable, expanded } = rowInfo;
38+
39+
let expandRowNode: React.ReactElement;
40+
if (expandable && expanded) {
41+
expandRowNode = <>233</>;
42+
}
3743

3844
// ========================== Render ==========================
3945

@@ -47,10 +53,10 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
4753
rowStyle.pointerEvents = 'none';
4854
}
4955

50-
return (
56+
const rowNode = (
5157
<div
5258
{...restProps}
53-
ref={ref}
59+
ref={expandable ? null : ref}
5460
className={classNames(className, `${prefixCls}-row`, {
5561
[`${prefixCls}-row-extra`]: extra,
5662
})}
@@ -73,6 +79,17 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
7379
})}
7480
</div>
7581
);
82+
83+
if (expandable) {
84+
return (
85+
<div ref={ref}>
86+
{rowNode}
87+
{expandRowNode}
88+
</div>
89+
);
90+
}
91+
92+
return rowNode;
7693
});
7794

7895
const ResponseBodyLine = responseImmutable(BodyLine);

0 commit comments

Comments
 (0)