-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:select): select max tag count (#8371)
* feat(module:select): select max tag count * feat(module:select): select max tag count * feat(module:select): select max tag count
- Loading branch information
1 parent
a0b08be
commit 18b898e
Showing
6 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 26 | ||
title: | ||
zh-CN: 最大选中数量 | ||
en-US: Max Count | ||
--- | ||
|
||
## zh-CN | ||
|
||
你可以通过设置 `nzMaxMultipleCount` 约束最多可选中的数量,当超出限制时会变成禁止选中状态。 | ||
|
||
## en-US | ||
|
||
You can set the `nzMaxMultipleCount` prop to control the max number of items can be selected. When the limit is exceeded, the options will become disabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-select-max-count', | ||
template: ` | ||
<nz-select | ||
[nzMaxMultipleCount]="3" | ||
nzMode="multiple" | ||
nzPlaceHolder="Please select" | ||
nzAllowClear | ||
[nzShowArrow]="true" | ||
[(ngModel)]="listOfSelectedValue" | ||
> | ||
<nz-option *ngFor="let item of listOfOption" [nzLabel]="item" [nzValue]="item"></nz-option> | ||
</nz-select> | ||
`, | ||
styles: [ | ||
` | ||
nz-select { | ||
width: 100%; | ||
} | ||
` | ||
] | ||
}) | ||
export class NzDemoSelectMaxCountComponent implements OnInit { | ||
listOfOption: string[] = []; | ||
listOfSelectedValue = ['a10', 'c12']; | ||
|
||
ngOnInit(): void { | ||
const children: string[] = []; | ||
for (let i = 10; i < 36; i++) { | ||
children.push(`${i.toString(36)}${i}`); | ||
} | ||
this.listOfOption = children; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters