@@ -54,19 +54,37 @@ export class NzDrawerComponent<T = any, R = any, D = any> extends NzDrawerRef<R>
5454 drawerRef : this as NzDrawerRef < R >
5555 } ;
5656
57+ get offsetTransform ( ) : string {
58+ if ( ! this . isOpen || ( this . nzOffsetX + this . nzOffsetY ) === 0 ) {
59+ return null ;
60+ }
61+ switch ( this . nzPlacement ) {
62+ case 'left' :
63+ return `translateX(${ this . nzOffsetX } px)` ;
64+ case 'right' :
65+ return `translateX(-${ this . nzOffsetX } px)` ;
66+ case 'top' :
67+ return `translateY(${ this . nzOffsetY } px)` ;
68+ case 'bottom' :
69+ return `translateY(-${ this . nzOffsetY } px)` ;
70+ }
71+ }
72+
5773 get transform ( ) : string {
5874
75+ if ( this . isOpen ) {
76+ return null ;
77+ }
78+
5979 switch ( this . nzPlacement ) {
6080 case 'left' :
61- return this . isOpen ? `translateX(${ this . nzOffsetX } px)` : `translateX(- ${ this . width } )`;
81+ return `translateX(-100% )` ;
6282 case 'right' :
63- return this . isOpen ? `translateX(- ${ this . nzOffsetX } px)` : `translateX( ${ this . width } )`;
83+ return `translateX(100% )` ;
6484 case 'top' :
65- return this . isOpen ? `translateY(${ this . nzOffsetY } px)` : `translateY(- ${ this . height } )`;
85+ return `translateY(-100% )` ;
6686 case 'bottom' :
67- return this . isOpen ? `translateY(-${ this . nzOffsetY } px)` : `translateY(${ this . height } )` ;
68- default :
69- return '' ;
87+ return `translateY(100%)` ;
7088 }
7189 }
7290
@@ -221,9 +239,7 @@ export class NzDrawerComponent<T = any, R = any, D = any> extends NzDrawerRef<R>
221239 const childInjector = new PortalInjector ( this . injector , new WeakMap ( [ [ NzDrawerRef , this ] ] ) ) ;
222240 const componentPortal = new ComponentPortal < T > ( this . nzContent , null , childInjector ) ;
223241 const componentRef = this . bodyPortalOutlet . attachComponentPortal ( componentPortal ) ;
224- if ( this . nzContentParams ) {
225- Object . assign ( componentRef . instance , this . nzContentParams ) ;
226- }
242+ Object . assign ( componentRef . instance , this . nzContentParams ) ;
227243 componentRef . changeDetectorRef . detectChanges ( ) ;
228244 }
229245 }
0 commit comments