Skip to content

Commit

Permalink
feat(module:breadcrumb): support standalone component (#8202)
Browse files Browse the repository at this point in the history
* feat(module:breadcrumb): support standalone component

* feat(module:breadcrumb): support standalone component
  • Loading branch information
evgeniyefimov authored Dec 1, 2023
1 parent 3d1427f commit 165f171
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
8 changes: 7 additions & 1 deletion components/breadcrumb/breadcrumb-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@
* 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,
encapsulation: ViewEncapsulation.None,
selector: 'nz-breadcrumb-item',
exportAs: 'nzBreadcrumbItem',
preserveWhitespaces: false,
standalone: true,
imports: [NgIf, NgTemplateOutlet, NzBreadCrumbSeparatorComponent, NzDropDownModule, NzIconModule, NzOutletModule],
template: `
<ng-container *ngIf="!!nzOverlay; else noMenuTpl">
<span class="ant-breadcrumb-overlay-link" nz-dropdown [nzDropdownMenu]="nzOverlay">
Expand Down
1 change: 1 addition & 0 deletions components/breadcrumb/breadcrumb-separator.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'nz-breadcrumb-separator',
exportAs: 'nzBreadcrumbSeparator',
standalone: true,
template: `<ng-content></ng-content>`,
host: {
class: 'ant-breadcrumb-separator'
Expand Down
4 changes: 4 additions & 0 deletions components/breadcrumb/breadcrumb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { Direction, Directionality } from '@angular/cdk/bidi';
import { NgFor, NgIf } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand All @@ -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;
Expand All @@ -41,6 +43,8 @@ export interface BreadcrumbOption {
exportAs: 'nzBreadcrumb',
preserveWhitespaces: false,
providers: [{ provide: NzBreadcrumb, useExisting: NzBreadCrumbComponent }],
standalone: true,
imports: [NgFor, NgIf, NzBreadCrumbItemComponent],
template: `
<ng-content></ng-content>
<ng-container *ngIf="nzAutoGenerate && breadcrumbs.length">
Expand Down
13 changes: 2 additions & 11 deletions components/breadcrumb/breadcrumb.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
2 changes: 1 addition & 1 deletion components/breadcrumb/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';

## API

### nz-breadcrumb
### nz-breadcrumb:standalone

| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion components/breadcrumb/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';

## API

### nz-breadcrumb
### nz-breadcrumb:standalone

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
Expand Down

0 comments on commit 165f171

Please sign in to comment.