Skip to content

Commit

Permalink
feat(module:tag): support standalone component (#8212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ParsaArvanehPA authored Dec 1, 2023
1 parent fefcb68 commit 15af7c8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
18 changes: 9 additions & 9 deletions components/tag/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { NzTagModule } from 'ng-zorro-antd/tag';

## API

### nz-tag

| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| `[nzMode]` | Mode of tag | `'closeable' \| 'default' \| 'checkable'` | `'default'` |
| `[nzChecked]` | Checked status of Tag, double binding, only works when `nzMode="checkable"` | `boolean` | `false` |
| `[nzColor]` | Color of the Tag | `string` | - |
| `(nzOnClose)` | Callback executed when tag is closed, only works when `nzMode="closable"`| `EventEmitter<MouseEvent>` | - |
| `(nzCheckedChange)` | Checked status change call back, only works when `nzMode="checkable"` | `EventEmitter<boolean>` | - |
### nz-tag:standalone

| Property | Description | Type | Default |
| ------------------- | --------------------------------------------------------------------------- | ----------------------------------------- | ----------- |
| `[nzMode]` | Mode of tag | `'closeable' \| 'default' \| 'checkable'` | `'default'` |
| `[nzChecked]` | Checked status of Tag, double binding, only works when `nzMode="checkable"` | `boolean` | `false` |
| `[nzColor]` | Color of the Tag | `string` | - |
| `(nzOnClose)` | Callback executed when tag is closed, only works when `nzMode="closable"` | `EventEmitter<MouseEvent>` | - |
| `(nzCheckedChange)` | Checked status change call back, only works when `nzMode="checkable"` | `EventEmitter<boolean>` | - |
16 changes: 8 additions & 8 deletions components/tag/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { NzTagModule } from 'ng-zorro-antd/tag';

## API

### nz-tag
### nz-tag:standalone

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| `[nzMode]` | 设定标签工作的模式 | `'closeable' \| 'default' \| 'checkable'` | `'default'` |
| `[nzChecked]` | 设置标签的选中状态,可双向绑定,在 `nzMode="checkable"` 时可用 | `boolean` | `false` |
| `[nzColor]` | 标签色 | `string` | - |
| `(nzOnClose)` | 关闭时的回调,在 `nzMode="closable"` 时可用 | `EventEmitter<MouseEvent>` | - |
| `(nzCheckedChange)` | 设置标签的选中状态的回调,在 `nzMode="checkable"` 时可用 | `EventEmitter<void>` | - |
| 参数 | 说明 | 类型 | 默认值 |
| ------------------- | -------------------------------------------------------------- | ----------------------------------------- | ----------- |
| `[nzMode]` | 设定标签工作的模式 | `'closeable' \| 'default' \| 'checkable'` | `'default'` |
| `[nzChecked]` | 设置标签的选中状态,可双向绑定,在 `nzMode="checkable"` 时可用 | `boolean` | `false` |
| `[nzColor]` | 标签色 | `string` | - |
| `(nzOnClose)` | 关闭时的回调,在 `nzMode="closable"` 时可用 | `EventEmitter<MouseEvent>` | - |
| `(nzCheckedChange)` | 设置标签的选中状态的回调,在 `nzMode="checkable"` 时可用 | `EventEmitter<void>` | - |
6 changes: 5 additions & 1 deletion components/tag/tag.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 { NgIf } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand Down Expand Up @@ -33,6 +34,7 @@ import {
} from 'ng-zorro-antd/core/color';
import { BooleanInput } from 'ng-zorro-antd/core/types';
import { InputBoolean } from 'ng-zorro-antd/core/util';
import { NzIconModule } from 'ng-zorro-antd/icon';

@Component({
selector: 'nz-tag',
Expand All @@ -59,7 +61,9 @@ import { InputBoolean } from 'ng-zorro-antd/core/util';
'[class.ant-tag-checkable-checked]': `nzChecked`,
'[class.ant-tag-rtl]': `dir === 'rtl'`,
'(click)': 'updateCheckedStatus()'
}
},
imports: [NzIconModule, NgIf],
standalone: true
})
export class NzTagComponent implements OnChanges, OnDestroy, OnInit {
static ngAcceptInputType_nzChecked: BooleanInput;
Expand Down
8 changes: 1 addition & 7 deletions components/tag/tag.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/

import { BidiModule } from '@angular/cdk/bidi';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { NzIconModule } from 'ng-zorro-antd/icon';

import { NzTagComponent } from './tag.component';

@NgModule({
imports: [BidiModule, CommonModule, FormsModule, NzIconModule],
declarations: [NzTagComponent],
imports: [NzTagComponent],
exports: [NzTagComponent]
})
export class NzTagModule {}

0 comments on commit 15af7c8

Please sign in to comment.