@@ -72,36 +72,36 @@ export function getCellProps<RecordType>(
72
72
) ;
73
73
}
74
74
75
- const addChildrenRowSpan = ( rowSpan : number , idx : number ) => {
76
- const nextIndex = idx + 1 ;
77
- const rowKey = rowKeys [ nextIndex ] ;
78
- let _rowSpan = rowSpan ;
79
- if ( rowKey !== undefined ) {
80
- // 下面如果是 0 的,增加 +1 逻辑
81
- const thisCellProps = column . onCell ( record , nextIndex ) ;
82
- if ( thisCellProps . rowSpan === 0 ) {
83
- const thisExpanded = expandedKeys . has ( rowKey ) ;
84
- if ( thisExpanded ) {
85
- _rowSpan = _rowSpan + 1 ;
86
- }
87
- // 继续往下找
88
- return addChildrenRowSpan ( _rowSpan , nextIndex ) ;
89
- }
90
- }
91
- // 找不到后返回
92
- return _rowSpan ;
93
- } ;
94
-
95
75
let additionalCellProps : React . TdHTMLAttributes < HTMLElement > ;
96
76
if ( column . onCell ) {
97
77
additionalCellProps = column . onCell ( record , index ) ;
98
78
// 开启 expanded 的增加下面逻辑
99
79
if ( expandable ) {
80
+ // 当前为合并单元格开始
100
81
if ( additionalCellProps . rowSpan > 0 ) {
101
82
// 本身展开 +1
102
83
if ( expanded ) {
103
84
additionalCellProps . rowSpan = additionalCellProps . rowSpan + 1 ;
104
85
}
86
+ // 下面如果是 0 的,增加 +1 逻辑
87
+ const addChildrenRowSpan = ( rowSpan : number , idx : number ) => {
88
+ const nextIndex = idx + 1 ;
89
+ const rowKey = rowKeys [ nextIndex ] ;
90
+ let _rowSpan = rowSpan ;
91
+ if ( rowKey !== undefined ) {
92
+ const thisCellProps = column . onCell ( record , nextIndex ) ;
93
+ if ( thisCellProps . rowSpan === 0 ) {
94
+ const thisExpanded = expandedKeys . has ( rowKey ) ;
95
+ if ( thisExpanded ) {
96
+ _rowSpan = _rowSpan + 1 ;
97
+ }
98
+ // 继续往下找
99
+ return addChildrenRowSpan ( _rowSpan , nextIndex ) ;
100
+ }
101
+ }
102
+ // 找不到后返回
103
+ return _rowSpan ;
104
+ } ;
105
105
additionalCellProps . rowSpan = addChildrenRowSpan ( additionalCellProps . rowSpan , index ) ;
106
106
}
107
107
}
0 commit comments