File tree Expand file tree Collapse file tree 4 files changed +16
-32
lines changed Expand file tree Collapse file tree 4 files changed +16
-32
lines changed Original file line number Diff line number Diff line change 58
58
transform : translateX (0 );
59
59
60
60
&-active {
61
- transform : translateX (-100% );
61
+ transform : translateX (-100% )!important ;
62
62
}
63
63
}
64
64
}
79
79
transform : translateX (0 );
80
80
81
81
&-active {
82
- transform : translateX (100% );
82
+ transform : translateX (100% )!important ;
83
83
}
84
84
}
85
85
}
Original file line number Diff line number Diff line change @@ -32,16 +32,7 @@ class Demo extends React.Component {
32
32
openChildren : ! this . state . openChildren ,
33
33
} ) ;
34
34
} ;
35
- public getLevelMove = ( e : {
36
- target : HTMLElement ;
37
- open : boolean ;
38
- } ) : number | [ number , number ] => {
39
- const target = e . target as HTMLElement ;
40
- if ( target . className . indexOf ( 'drawer1' ) >= 0 ) {
41
- return [ 200 , 100 ] ;
42
- }
43
- return 100 ;
44
- } ;
35
+
45
36
public render ( ) {
46
37
return (
47
38
< div >
@@ -59,35 +50,31 @@ class Demo extends React.Component {
59
50
</ div >
60
51
< Drawer
61
52
width = "20vw"
62
- handler = { false }
63
53
open = { this . state . open }
64
54
onClose = { this . onClick }
65
55
className = "drawer1"
66
56
placement = "right"
67
57
push = { { distance : 64 } }
58
+ // zIndex={99999}
68
59
{ ...motionProps }
69
60
>
70
61
< div >
71
62
< Button onClick = { this . onChildClick } > 打开子级</ Button >
72
63
< Drawer
73
- handler = { false }
74
64
open = { this . state . openChild }
75
65
onClose = { this . onChildClick }
76
66
className = "drawer2"
77
- level = ".drawer1"
78
67
placement = "right"
68
+ // zIndex={88888}
79
69
{ ...motionProps }
80
70
>
81
71
< div style = { { width : 200 } } >
82
72
二级抽屉
83
- < Button onClick = { this . onChildrenClick } > 打开子级 </ Button >
73
+ < Button onClick = { this . onChildrenClick } > 打开子子级 </ Button >
84
74
< Drawer
85
- handler = { false }
86
75
open = { this . state . openChildren }
87
76
onClose = { this . onChildrenClick }
88
- level = { [ '.drawer1' , '.drawer2' ] }
89
77
placement = "right"
90
- levelMove = { this . getLevelMove }
91
78
{ ...motionProps }
92
79
>
93
80
< div style = { { width : 200 } } > 三级抽屉</ div >
Original file line number Diff line number Diff line change @@ -206,12 +206,6 @@ export default function DrawerPopup(props: DrawerPopupProps) {
206
206
[ ] ,
207
207
) ;
208
208
209
- // =========================== zIndex ===========================
210
- const zIndexStyle : React . CSSProperties = { } ;
211
- if ( zIndex ) {
212
- zIndexStyle . zIndex = zIndex ;
213
- }
214
-
215
209
// ============================ Mask ============================
216
210
const maskNode : React . ReactNode = mask && (
217
211
< CSSMotion key = "mask" { ...maskMotion } visible = { open } >
@@ -229,7 +223,6 @@ export default function DrawerPopup(props: DrawerPopupProps) {
229
223
style = { {
230
224
...motionMaskStyle ,
231
225
...maskStyle ,
232
- ...zIndexStyle ,
233
226
} }
234
227
onClick = { maskClosable ? onClose : undefined }
235
228
ref = { maskRef }
@@ -294,7 +287,6 @@ export default function DrawerPopup(props: DrawerPopupProps) {
294
287
...wrapperStyle ,
295
288
...motionStyle ,
296
289
...contentWrapperStyle ,
297
- ...zIndexStyle ,
298
290
} }
299
291
>
300
292
< DrawerPanel
@@ -312,6 +304,14 @@ export default function DrawerPopup(props: DrawerPopupProps) {
312
304
) ;
313
305
314
306
// =========================== Render ===========================
307
+ const containerStyle : React . CSSProperties = {
308
+ ...rootStyle ,
309
+ } ;
310
+
311
+ if ( zIndex ) {
312
+ containerStyle . zIndex = zIndex ;
313
+ }
314
+
315
315
return (
316
316
< DrawerContext . Provider value = { mergedContext } >
317
317
< div
@@ -324,7 +324,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
324
324
[ `${ prefixCls } -inline` ] : inline ,
325
325
} ,
326
326
) }
327
- style = { rootStyle }
327
+ style = { containerStyle }
328
328
tabIndex = { - 1 }
329
329
ref = { panelRef }
330
330
onKeyDown = { onPanelKeyDown }
Original file line number Diff line number Diff line change @@ -305,10 +305,7 @@ describe('rc-drawer-menu', () => {
305
305
< Drawer zIndex = { 93 } open getContainer = { false } /> ,
306
306
) ;
307
307
308
- expect ( container . querySelector ( '.rc-drawer-mask' ) ) . toHaveStyle ( {
309
- zIndex : 93 ,
310
- } ) ;
311
- expect ( container . querySelector ( '.rc-drawer-content-wrapper' ) ) . toHaveStyle ( {
308
+ expect ( container . querySelector ( '.rc-drawer' ) ) . toHaveStyle ( {
312
309
zIndex : 93 ,
313
310
} ) ;
314
311
} ) ;
You can’t perform that action at this time.
0 commit comments