1
- import type { StickyOffsets , FixedType , Direction } from '../interface' ;
1
+ import type { StickyOffsets , FixedType , Direction , ColumnType , ColumnGroupType } from '../interface' ;
2
2
3
3
export interface FixedInfo {
4
4
fixLeft : number | false ;
@@ -13,12 +13,13 @@ export interface FixedInfo {
13
13
isSticky : boolean ;
14
14
}
15
15
16
- export function getCellFixedInfo (
16
+ export function getCellFixedInfo < RecordType = any > (
17
17
colStart : number ,
18
18
colEnd : number ,
19
19
columns : readonly { fixed ?: FixedType } [ ] ,
20
20
stickyOffsets : StickyOffsets ,
21
21
direction : Direction ,
22
+ curColumns ?: ColumnType < RecordType > | ColumnGroupType < RecordType >
22
23
) : FixedInfo {
23
24
const startColumn = columns [ colStart ] || { } ;
24
25
const endColumn = columns [ colEnd ] || { } ;
@@ -41,20 +42,23 @@ export function getCellFixedInfo(
41
42
const nextColumn = columns [ colEnd + 1 ] ;
42
43
const prevColumn = columns [ colStart - 1 ] ;
43
44
45
+ // no children only
46
+ const canLastFix = ! ( curColumns as ColumnGroupType < RecordType > ) ?. children ;
47
+
44
48
if ( direction === 'rtl' ) {
45
49
if ( fixLeft !== undefined ) {
46
50
const prevFixLeft = prevColumn && prevColumn . fixed === 'left' ;
47
- firstFixLeft = ! prevFixLeft ;
51
+ firstFixLeft = ! prevFixLeft && canLastFix ;
48
52
} else if ( fixRight !== undefined ) {
49
53
const nextFixRight = nextColumn && nextColumn . fixed === 'right' ;
50
- lastFixRight = ! nextFixRight ;
54
+ lastFixRight = ! nextFixRight && canLastFix ;
51
55
}
52
56
} else if ( fixLeft !== undefined ) {
53
57
const nextFixLeft = nextColumn && nextColumn . fixed === 'left' ;
54
- lastFixLeft = ! nextFixLeft ;
58
+ lastFixLeft = ! nextFixLeft && canLastFix ;
55
59
} else if ( fixRight !== undefined ) {
56
60
const prevFixRight = prevColumn && prevColumn . fixed === 'right' ;
57
- firstFixRight = ! prevFixRight ;
61
+ firstFixRight = ! prevFixRight && canLastFix ;
58
62
}
59
63
60
64
return {
0 commit comments