From 61c5f003d16f243d0aafdd764426050efff01c2b Mon Sep 17 00:00:00 2001 From: Nicolas Frizzarin Date: Thu, 4 Jan 2024 11:27:34 +0100 Subject: [PATCH] refactor(module:drawer): refactor control flow component (#8326) --- components/drawer/drawer.component.ts | 105 ++++++++++++++------------ 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/components/drawer/drawer.component.ts b/components/drawer/drawer.component.ts index cd3d534bd3d..aa18488303f 100644 --- a/components/drawer/drawer.component.ts +++ b/components/drawer/drawer.component.ts @@ -8,7 +8,7 @@ import { Direction, Directionality } from '@angular/cdk/bidi'; import { ESCAPE } from '@angular/cdk/keycodes'; import { Overlay, OverlayConfig, OverlayKeyboardDispatcher, OverlayRef } from '@angular/cdk/overlay'; import { CdkPortalOutlet, ComponentPortal, PortalModule, TemplatePortal } from '@angular/cdk/portal'; -import { DOCUMENT, NgIf, NgStyle, NgTemplateOutlet } from '@angular/common'; +import { DOCUMENT, NgStyle, NgTemplateOutlet } from '@angular/common'; import { AfterViewInit, ChangeDetectionStrategy, @@ -38,7 +38,7 @@ import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/con import { NzNoAnimationDirective } from 'ng-zorro-antd/core/no-animation'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { BooleanInput, NgStyleInterface, NzSafeAny } from 'ng-zorro-antd/core/types'; -import { InputBoolean, toCssPixel } from 'ng-zorro-antd/core/util'; +import { InputBoolean, isTemplateRef, toCssPixel } from 'ng-zorro-antd/core/util'; import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzDrawerContentDirective } from './drawer-content.directive'; @@ -75,7 +75,9 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'drawer'; [style.transition]="placementChanging ? 'none' : null" [style.zIndex]="nzZIndex" > -
+ @if (nzMask) { +
+ }
-
-
- -
- -
-
+ @if (nzTitle || nzClosable) { +
+
+ @if (nzClosable) { + + } + + @if (nzTitle) { +
+ +
+
+
+ }
+ @if (nzExtra) { +
+ +
+
+
+ }
-
- -
-
-
-
+ }
- - - - - - - - - - - -
- + @if (nzFooter) { + + }
@@ -140,7 +147,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'drawer'; `, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, - imports: [NzNoAnimationDirective, NgIf, NgStyle, NzOutletModule, NzIconModule, PortalModule, NgTemplateOutlet], + imports: [NzNoAnimationDirective, NgStyle, NzOutletModule, NzIconModule, PortalModule, NgTemplateOutlet], standalone: true }) export class NzDrawerComponent = NzSafeAny> @@ -276,8 +283,8 @@ export class NzDrawerComponent