Skip to content

Commit 165f171

Browse files
feat(module:breadcrumb): support standalone component (#8202)
* feat(module:breadcrumb): support standalone component * feat(module:breadcrumb): support standalone component
1 parent 3d1427f commit 165f171

6 files changed

Lines changed: 16 additions & 14 deletions

File tree

‎components/breadcrumb/breadcrumb-item.component.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6+
import { NgIf, NgTemplateOutlet } from '@angular/common';
67
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
78

8-
import { NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
9+
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
10+
import { NzDropdownMenuComponent, NzDropDownModule } from 'ng-zorro-antd/dropdown';
11+
import { NzIconModule } from 'ng-zorro-antd/icon';
912

1013
import { NzBreadcrumb } from './breadcrumb';
14+
import { NzBreadCrumbSeparatorComponent } from './breadcrumb-separator.component';
1115

1216
@Component({
1317
changeDetection: ChangeDetectionStrategy.OnPush,
1418
encapsulation: ViewEncapsulation.None,
1519
selector: 'nz-breadcrumb-item',
1620
exportAs: 'nzBreadcrumbItem',
1721
preserveWhitespaces: false,
22+
standalone: true,
23+
imports: [NgIf, NgTemplateOutlet, NzBreadCrumbSeparatorComponent, NzDropDownModule, NzIconModule, NzOutletModule],
1824
template: `
1925
<ng-container *ngIf="!!nzOverlay; else noMenuTpl">
2026
<span class="ant-breadcrumb-overlay-link" nz-dropdown [nzDropdownMenu]="nzOverlay">

‎components/breadcrumb/breadcrumb-separator.component.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Component } from '@angular/core';
88
@Component({
99
selector: 'nz-breadcrumb-separator',
1010
exportAs: 'nzBreadcrumbSeparator',
11+
standalone: true,
1112
template: `<ng-content></ng-content>`,
1213
host: {
1314
class: 'ant-breadcrumb-separator'

‎components/breadcrumb/breadcrumb.component.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { Direction, Directionality } from '@angular/cdk/bidi';
7+
import { NgFor, NgIf } from '@angular/common';
78
import {
89
ChangeDetectionStrategy,
910
ChangeDetectorRef,
@@ -27,6 +28,7 @@ import { BooleanInput } from 'ng-zorro-antd/core/types';
2728
import { InputBoolean } from 'ng-zorro-antd/core/util';
2829

2930
import { NzBreadcrumb } from './breadcrumb';
31+
import { NzBreadCrumbItemComponent } from './breadcrumb-item.component';
3032

3133
export interface BreadcrumbOption {
3234
label: string;
@@ -41,6 +43,8 @@ export interface BreadcrumbOption {
4143
exportAs: 'nzBreadcrumb',
4244
preserveWhitespaces: false,
4345
providers: [{ provide: NzBreadcrumb, useExisting: NzBreadCrumbComponent }],
46+
standalone: true,
47+
imports: [NgFor, NgIf, NzBreadCrumbItemComponent],
4448
template: `
4549
<ng-content></ng-content>
4650
<ng-container *ngIf="nzAutoGenerate && breadcrumbs.length">

‎components/breadcrumb/breadcrumb.module.ts‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,14 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6-
import { BidiModule } from '@angular/cdk/bidi';
7-
import { OverlayModule } from '@angular/cdk/overlay';
8-
import { CommonModule } from '@angular/common';
96
import { NgModule } from '@angular/core';
107

11-
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
12-
import { NzOverlayModule } from 'ng-zorro-antd/core/overlay';
13-
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
14-
import { NzIconModule } from 'ng-zorro-antd/icon';
15-
168
import { NzBreadCrumbItemComponent } from './breadcrumb-item.component';
179
import { NzBreadCrumbSeparatorComponent } from './breadcrumb-separator.component';
1810
import { NzBreadCrumbComponent } from './breadcrumb.component';
1911

2012
@NgModule({
21-
imports: [CommonModule, NzOutletModule, OverlayModule, NzOverlayModule, NzDropDownModule, NzIconModule],
22-
declarations: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent],
23-
exports: [BidiModule, NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent]
13+
imports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent],
14+
exports: [NzBreadCrumbComponent, NzBreadCrumbItemComponent, NzBreadCrumbSeparatorComponent]
2415
})
2516
export class NzBreadCrumbModule {}

‎components/breadcrumb/doc/index.en-US.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
2020

2121
## API
2222

23-
### nz-breadcrumb
23+
### nz-breadcrumb:standalone
2424

2525
| Property | Description | Type | Default |
2626
| -------- | ----------- | ---- | ------- |

‎components/breadcrumb/doc/index.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
2020

2121
## API
2222

23-
### nz-breadcrumb
23+
### nz-breadcrumb:standalone
2424

2525
| 参数 | 说明 | 类型 | 默认值 |
2626
| --- | --- | --- | --- |

0 commit comments

Comments
 (0)