@@ -22,11 +22,6 @@ import {
22
22
23
23
const currentDrawer : Record < string , boolean > = { } ;
24
24
25
- // interface IState {
26
- // _self: DrawerChild;
27
- // prevProps?: IDrawerChildProps;
28
- // }
29
-
30
25
interface Point {
31
26
x : number ;
32
27
y : number ;
@@ -63,32 +58,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
63
58
...rest
64
59
} = props ;
65
60
const { autoFocus } = props ;
66
- // public static getDerivedStateFromProps(
67
- // props: IDrawerChildProps,
68
- // { prevProps, _self }: { prevProps: IDrawerChildProps; _self: DrawerChild },
69
- // ) {
70
- // const nextState = {
71
- // prevProps: props,
72
- // };
73
- // if (prevProps !== undefined) {
74
- // const { placement, level } = props;
75
- // if (placement !== prevProps.placement) {
76
- // // test 的 bug, 有动画过场,删除 dom
77
- // _self.contentDom = null;
78
- // }
79
- // if (level !== prevProps.level) {
80
- // _self.getLevelDom(props);
81
- // }
82
- // }
83
- // return nextState;
84
- // }
85
-
86
- // constructor(props: IDrawerChildProps) {
87
- // super(props);
88
- // this.state = {
89
- // _self: this,
90
- // };
91
- // }
92
61
const passive = useRef < { passive : boolean } | boolean > ( ) ;
93
62
const levelDom = useRef < HTMLElement [ ] > ( ) ;
94
63
const dom = useRef < HTMLDivElement > ( null ) ;
@@ -116,7 +85,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
116
85
} catch ( err ) { }
117
86
passive . current = passiveSupported ? { passive : false } : false ;
118
87
}
119
- // const { open, getContainer, showMask, autoFocus } = this.props;
120
88
const container = getParent ( getContainer ) ;
121
89
drawerId . current = `drawer_id_${ Number (
122
90
( Date . now ( ) + Math . random ( ) )
@@ -232,7 +200,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
232
200
} ;
233
201
234
202
const onWrapperTransitionEnd = ( e : React . TransitionEvent ) => {
235
- // const { open, afterVisibleChange } = this.props;
236
203
if (
237
204
e . target === contentWrapper . current &&
238
205
e . propertyName . match ( / t r a n s f o r m $ / )
@@ -252,7 +219,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
252
219
} ;
253
220
254
221
const openLevelTransition = ( ) => {
255
- // const { open, width, height } = this.props;
256
222
const { isHorizontal, placementName } = getHorizontalBoolAndPlacementName ( ) ;
257
223
const contentValue = contentDom . current
258
224
? contentDom . current . getBoundingClientRect ( ) [
@@ -269,7 +235,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
269
235
value ?: string | number ,
270
236
right ?: number ,
271
237
) => {
272
- // const { placement, levelMove, duration, ease, showMask } = this.props;
273
238
// router 切换时可能会导至页面失去滚动条,所以需要时时获取。
274
239
levelDom . current ?. forEach ( dom => {
275
240
dom . style . transition = `transform ${ duration } ${ ease } ` ;
@@ -298,7 +263,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
298
263
placementName ?: string ,
299
264
value ?: string | number ,
300
265
) => {
301
- // const { onChange } = this.props;
302
266
if ( ! windowIsUndefined ) {
303
267
const right =
304
268
document . body . scrollHeight >
@@ -315,7 +279,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
315
279
} ;
316
280
317
281
const toggleScrollingToDrawerAndBody = ( right : number ) => {
318
- // const { getContainer, showMask, open } = this.props;
319
282
const container = getParent ( getContainer ) ;
320
283
// 处理 body 滚动
321
284
if ( container && container . parentNode === document . body && showMask ) {
@@ -365,7 +328,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
365
328
} ;
366
329
367
330
const addScrollingEffect = ( right : number ) => {
368
- // const { placement, duration, ease } = this.props;
369
331
const widthTransition = `width ${ duration } ${ ease } ` ;
370
332
const transformTransition = `transform ${ duration } ${ ease } ` ;
371
333
dom . current . style . transition = 'none' ;
@@ -391,8 +353,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
391
353
} ;
392
354
393
355
const remScrollingEffect = ( right : number ) => {
394
- // const { placement, duration, ease } = this.props;
395
-
396
356
if ( transitionStr ) {
397
357
document . body . style . overflowX = 'hidden' ;
398
358
}
0 commit comments