-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:tree-select): support customized icon (#3395)
* feat(module:tree-select): support customized icon * feat: support nzTreeTemplate to customize icon fix: change tree template type * feat: support tree template as @input and @ContentChild
- Loading branch information
Showing
9 changed files
with
117 additions
and
6 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,15 @@ | ||
--- | ||
order: 4 | ||
debug: true | ||
title: | ||
zh-CN: 自定义图标 | ||
en-US: Customize Icon | ||
--- | ||
|
||
## zh-CN | ||
|
||
可以针对不同节点采用样式覆盖的方式定制图标。 | ||
|
||
## en-US | ||
|
||
You can customize icons for different nodes. |
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,37 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-tree-select-customized-icon', | ||
template: ` | ||
<nz-tree-select style="width: 250px" [nzNodes]="nodes" [(ngModel)]="value" nzPlaceHolder="Please select" nzShowIcon> | ||
</nz-tree-select> | ||
<nz-tree-select | ||
style="width: 250px; margin-top: 20px;" | ||
[nzNodes]="nodes" | ||
[(ngModel)]="value" | ||
nzPlaceHolder="Please select" | ||
> | ||
<ng-template #nzTreeTemplate let-node> | ||
<span class="ant-tree-node-content-wrapper" [class.ant-tree-node-selected]="node.isSelected"> | ||
<span> <i nz-icon [type]="node.isExpanded ? 'folder-open' : 'folder'"></i> {{ node.title }} </span> | ||
</span> | ||
</ng-template> | ||
</nz-tree-select> | ||
` | ||
}) | ||
export class NzDemoTreeSelectCustomizedIconComponent { | ||
value: string; | ||
nodes = [ | ||
{ | ||
title: 'parent 1', | ||
key: '100', | ||
expanded: true, | ||
icon: 'anticon anticon-smile-o', | ||
children: [ | ||
{ title: 'leaf 1-0-0', key: '10010', icon: 'anticon anticon-meh-o', isLeaf: true }, | ||
{ title: 'leaf 1-0-1', key: '10011', icon: 'anticon anticon-frown-o', isLeaf: true } | ||
] | ||
} | ||
]; | ||
} |
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
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