@@ -8,7 +8,7 @@ import BodyComponent from './fixed/body';
8
8
import WrapperComponent from './fixed/wrapper' ;
9
9
import { statics } from './util' ;
10
10
11
- export default function fixed ( BaseComponent ) {
11
+ export default function fixed ( BaseComponent , stickyLock ) {
12
12
/** Table */
13
13
class FixedTable extends React . Component {
14
14
static FixedHeader = HeaderComponent ;
@@ -26,10 +26,7 @@ export default function fixed(BaseComponent) {
26
26
/**
27
27
* 最大内容区域的高度,在`fixedHeader`为`true`的时候,超过这个高度会出现滚动条
28
28
*/
29
- maxBodyHeight : PropTypes . oneOfType ( [
30
- PropTypes . number ,
31
- PropTypes . string ,
32
- ] ) ,
29
+ maxBodyHeight : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
33
30
...BaseComponent . propTypes ,
34
31
} ;
35
32
@@ -48,10 +45,7 @@ export default function fixed(BaseComponent) {
48
45
getNode : PropTypes . func ,
49
46
onFixedScrollSync : PropTypes . func ,
50
47
getTableInstanceForFixed : PropTypes . func ,
51
- maxBodyHeight : PropTypes . oneOfType ( [
52
- PropTypes . number ,
53
- PropTypes . string ,
54
- ] ) ,
48
+ maxBodyHeight : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
55
49
} ;
56
50
57
51
state = { } ;
@@ -78,9 +72,7 @@ export default function fixed(BaseComponent) {
78
72
}
79
73
80
74
getNode = ( type , node , lockType ) => {
81
- lockType = lockType
82
- ? lockType . charAt ( 0 ) . toUpperCase ( ) + lockType . substr ( 1 )
83
- : '' ;
75
+ lockType = lockType ? lockType . charAt ( 0 ) . toUpperCase ( ) + lockType . substr ( 1 ) : '' ;
84
76
this [ `${ type } ${ lockType } Node` ] = node ;
85
77
} ;
86
78
@@ -143,10 +135,13 @@ export default function fixed(BaseComponent) {
143
135
const hasVerScroll = body . scrollHeight > body . clientHeight ,
144
136
hasHozScroll = body . scrollWidth > body . clientWidth ;
145
137
const style = {
146
- [ paddingName ] : scrollBarSize ,
147
138
[ marginName ] : scrollBarSize ,
148
139
} ;
149
140
141
+ if ( ! stickyLock ) {
142
+ style [ paddingName ] = scrollBarSize ;
143
+ }
144
+
150
145
if ( ! hasVerScroll ) {
151
146
style [ paddingName ] = 0 ;
152
147
style [ marginName ] = 0 ;
0 commit comments