File tree Expand file tree Collapse file tree 6 files changed +17
-4
lines changed Expand file tree Collapse file tree 6 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,18 @@ const columns: ColumnsType = [
11
11
width : 100 ,
12
12
onCell : ( _ , index ) => {
13
13
const props : React . TdHTMLAttributes < HTMLTableCellElement > = { } ;
14
- if ( index === 1 ) {
14
+ if ( index === 0 ) {
15
+ props . rowSpan = 1 ;
16
+ } else if ( index === 1 ) {
15
17
props . rowSpan = 4 ;
16
18
} else if ( index === 2 ) {
17
19
props . rowSpan = 0 ;
18
20
} else if ( index === 3 ) {
19
21
props . rowSpan = 0 ;
20
22
} else if ( index === 4 ) {
21
23
props . rowSpan = 0 ;
24
+ } else if ( index === 5 ) {
25
+ props . rowSpan = 1 ;
22
26
}
23
27
24
28
return props ;
@@ -46,7 +50,10 @@ const Demo = () => (
46
50
rowKey = "key"
47
51
columns = { columns }
48
52
data = { data }
49
- expandable = { { expandedRowRender : record => < p style = { { margin : 0 } } > { record . key } </ p > } }
53
+ expandable = { {
54
+ offset : 0 ,
55
+ expandedRowRender : record => < p style = { { margin : 0 } } > { record . key } </ p > ,
56
+ } }
50
57
className = "table"
51
58
/>
52
59
</ div >
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ export function getCellProps<RecordType>(
47
47
onTriggerExpand,
48
48
expandable,
49
49
expandedKeys,
50
+ offset,
50
51
} = rowInfo ;
51
52
52
53
const key = columnsKey [ colIndex ] ;
@@ -79,7 +80,7 @@ export function getCellProps<RecordType>(
79
80
80
81
// For expandable row with rowSpan,
81
82
// We should increase the rowSpan if the row is expanded
82
- if ( expandable && rowSpan > 1 ) {
83
+ if ( expandable && rowSpan > offset ) {
83
84
let currentRowSpan = rowSpan ;
84
85
85
86
for ( let i = index ; i < index + rowSpan ; i += 1 ) {
Original file line number Diff line number Diff line change @@ -842,6 +842,7 @@ function Table<RecordType extends DefaultRecordType>(
842
842
expandableType,
843
843
expandRowByClick : expandableConfig . expandRowByClick ,
844
844
expandedRowRender : expandableConfig . expandedRowRender ,
845
+ offset : expandableConfig . offset ,
845
846
onTriggerExpand,
846
847
expandIconColumnIndex : expandableConfig . expandIconColumnIndex ,
847
848
indentSize : expandableConfig . indentSize ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type {
3
3
ColumnsType ,
4
4
ColumnType ,
5
5
Direction ,
6
+ ExpandableConfig ,
6
7
ExpandableType ,
7
8
ExpandedRowRender ,
8
9
GetComponent ,
@@ -49,6 +50,7 @@ export interface TableContextProps<RecordType = any> {
49
50
expandableType : ExpandableType ;
50
51
expandRowByClick : boolean ;
51
52
expandedRowRender : ExpandedRowRender < RecordType > ;
53
+ offset : ExpandableConfig < RecordType > [ 'offset' ] ;
52
54
expandIcon : RenderExpandIcon < RecordType > ;
53
55
onTriggerExpand : TriggerEventHandler < RecordType > ;
54
56
expandIconColumnIndex : number ;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export default function useRowInfo<RecordType>(
27
27
| 'expandedKeys'
28
28
| 'childrenColumnName'
29
29
| 'onRow'
30
+ | 'offset'
30
31
> & {
31
32
columnsKey : React . Key [ ] ;
32
33
nestExpandable : boolean ;
@@ -54,6 +55,7 @@ export default function useRowInfo<RecordType>(
54
55
'childrenColumnName' ,
55
56
'rowExpandable' ,
56
57
'onRow' ,
58
+ 'offset' ,
57
59
] ) ;
58
60
59
61
const {
@@ -103,7 +105,6 @@ export default function useRowInfo<RecordType>(
103
105
104
106
// ========================= Column =========================
105
107
const columnsKey = getColumnsKey ( flattenColumns ) ;
106
-
107
108
return {
108
109
...context ,
109
110
columnsKey,
Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ export interface ExpandableConfig<RecordType> {
256
256
rowExpandable ?: ( record : RecordType ) => boolean ;
257
257
columnWidth ?: number | string ;
258
258
fixed ?: FixedType ;
259
+ offset ?: number ;
259
260
}
260
261
261
262
// =================== Render ===================
You can’t perform that action at this time.
0 commit comments