From 165f171dd51cff29ac3e02f046bf2966c4ad9aa0 Mon Sep 17 00:00:00 2001 From: Evgeniy Efimov Date: Fri, 1 Dec 2023 12:46:13 +0100 Subject: [PATCH] feat(module:breadcrumb): support standalone component (#8202) * feat(module:breadcrumb): support standalone component * feat(module:breadcrumb): support standalone component --- components/breadcrumb/breadcrumb-item.component.ts | 8 +++++++- .../breadcrumb/breadcrumb-separator.component.ts | 1 + components/breadcrumb/breadcrumb.component.ts | 4 ++++ components/breadcrumb/breadcrumb.module.ts | 13 ++----------- components/breadcrumb/doc/index.en-US.md | 2 +- components/breadcrumb/doc/index.zh-CN.md | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/components/breadcrumb/breadcrumb-item.component.ts b/components/breadcrumb/breadcrumb-item.component.ts index c7853bd9d7..231dc8a155 100644 --- a/components/breadcrumb/breadcrumb-item.component.ts +++ b/components/breadcrumb/breadcrumb-item.component.ts @@ -3,11 +3,15 @@ * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ +import { NgIf, NgTemplateOutlet } from '@angular/common'; import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; -import { NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; +import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; +import { NzDropdownMenuComponent, NzDropDownModule } from 'ng-zorro-antd/dropdown'; +import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzBreadcrumb } from './breadcrumb'; +import { NzBreadCrumbSeparatorComponent } from './breadcrumb-separator.component'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, @@ -15,6 +19,8 @@ import { NzBreadcrumb } from './breadcrumb'; selector: 'nz-breadcrumb-item', exportAs: 'nzBreadcrumbItem', preserveWhitespaces: false, + standalone: true, + imports: [NgIf, NgTemplateOutlet, NzBreadCrumbSeparatorComponent, NzDropDownModule, NzIconModule, NzOutletModule], template: ` diff --git a/components/breadcrumb/breadcrumb-separator.component.ts b/components/breadcrumb/breadcrumb-separator.component.ts index 8f84ea8fb5..a640e4e7c5 100644 --- a/components/breadcrumb/breadcrumb-separator.component.ts +++ b/components/breadcrumb/breadcrumb-separator.component.ts @@ -8,6 +8,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'nz-breadcrumb-separator', exportAs: 'nzBreadcrumbSeparator', + standalone: true, template: ``, host: { class: 'ant-breadcrumb-separator' diff --git a/components/breadcrumb/breadcrumb.component.ts b/components/breadcrumb/breadcrumb.component.ts index fda9881003..c3f37abce3 100644 --- a/components/breadcrumb/breadcrumb.component.ts +++ b/components/breadcrumb/breadcrumb.component.ts @@ -4,6 +4,7 @@ */ import { Direction, Directionality } from '@angular/cdk/bidi'; +import { NgFor, NgIf } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -27,6 +28,7 @@ import { BooleanInput } from 'ng-zorro-antd/core/types'; import { InputBoolean } from 'ng-zorro-antd/core/util'; import { NzBreadcrumb } from './breadcrumb'; +import { NzBreadCrumbItemComponent } from './breadcrumb-item.component'; export interface BreadcrumbOption { label: string; @@ -41,6 +43,8 @@ export interface BreadcrumbOption { exportAs: 'nzBreadcrumb', preserveWhitespaces: false, providers: [{ provide: NzBreadcrumb, useExisting: NzBreadCrumbComponent }], + standalone: true, + imports: [NgFor, NgIf, NzBreadCrumbItemComponent], template: ` diff --git a/components/breadcrumb/breadcrumb.module.ts b/components/breadcrumb/breadcrumb.module.ts index 71b4d3f809..e4588a3e1c 100644 --- a/components/breadcrumb/breadcrumb.module.ts +++ b/components/breadcrumb/breadcrumb.module.ts @@ -3,23 +3,14 @@ * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ -import { BidiModule } from '@angular/cdk/bidi'; -import { OverlayModule } from '@angular/cdk/overlay'; -import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; -import { NzOverlayModule } from 'ng-zorro-antd/core/overlay'; -import { NzDropDownModule } from 'ng-zorro-antd/dropdown'; -import { NzIconModule } from 'ng-zorro-antd/icon'; - import { NzBreadCrumbItemComponent } from './breadcrumb-item.component'; import { NzBreadCrumbSeparatorComponent } from './breadcrumb-separator.component'; import { NzBreadCrumbComponent } from './breadcrumb.component'; @NgModule({ - imports: [CommonModule, NzOutletModule, OverlayModule, NzOverlayModule, NzDropDownModule, NzIconModule], - declarations: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent], - exports: [BidiModule, NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent] + imports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent], + exports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent] }) export class NzBreadCrumbModule {} diff --git a/components/breadcrumb/doc/index.en-US.md b/components/breadcrumb/doc/index.en-US.md index 7120167818..a13c8f3797 100755 --- a/components/breadcrumb/doc/index.en-US.md +++ b/components/breadcrumb/doc/index.en-US.md @@ -20,7 +20,7 @@ import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb'; ## API -### nz-breadcrumb +### nz-breadcrumb:standalone | Property | Description | Type | Default | | -------- | ----------- | ---- | ------- | diff --git a/components/breadcrumb/doc/index.zh-CN.md b/components/breadcrumb/doc/index.zh-CN.md index bea39df99f..8c1c9e8286 100755 --- a/components/breadcrumb/doc/index.zh-CN.md +++ b/components/breadcrumb/doc/index.zh-CN.md @@ -20,7 +20,7 @@ import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb'; ## API -### nz-breadcrumb +### nz-breadcrumb:standalone | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- |