-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(module:tree-select): support customized icon #2055
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2055 +/- ##
==========================================
+ Coverage 95.52% 95.53% +<.01%
==========================================
Files 517 517
Lines 12258 12261 +3
Branches 1691 1692 +1
==========================================
+ Hits 11710 11714 +4
Misses 189 189
+ Partials 359 358 -1
Continue to review full report at Codecov.
|
050e999
to
9b613ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR, please perfect this API docs.
components/tree/nz-tree.component.ts
Outdated
@@ -40,6 +40,7 @@ export class NzTreeComponent implements OnInit { | |||
@Input() nzDefaultExpandAll: boolean = false; | |||
@Input() nzDefaultExpandedKeys: string[] = []; | |||
@Input() nzDefaultSelectedKeys: string[] = []; | |||
@Input() nzTreeSelectTemplate: TemplateRef<{}>; | |||
@Input() nzBeforeDrop: (confirm: NzFormatBeforeDropEvent) => Observable<boolean>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add this input, you can use nzTreeTemplate
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nzTreeTemplate
can't deliver from tree-select
to tree
without using input :
nz-tree-select.component
<nz-tree #treeRef ...>
<ng-container [ngTemplateOutlet]="nzTreeSelectTemplate"></ng-container>
</nz-tree>
I tried but tree component
can't get its @ContentChild
, do you mean this ?
b1c992f
to
1b0a3c0
Compare
@@ -437,6 +440,9 @@ export class NzTreeSelectComponent implements ControlValueAccessor, OnInit, Afte | |||
|
|||
ngAfterViewInit(): void { | |||
this.attachOverlay(); | |||
if (this.nzTreeSelectTemplate) { | |||
setTimeout(() => this.treeRef.nzTreeTemplate = this.nzTreeSelectTemplate, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder why need setTimeout
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.cdr.detectChanges(); |
I did not realize this line, setTimeout
is useless.
1b0a3c0
to
4f793df
Compare
a08e149
to
8b3447e
Compare
8b3447e
to
d2d5305
Compare
Deploy preview for ng-zorro-master ready! Built with commit d2d5305 |
Conflict is resolved, please check. |
Sorry, we have merged another pr (#2933) to solve the same thing like yours, thk. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Support customized icon in tree-select
Does this PR introduce a breaking change?
Other information
I add a new
@Input nzTreeSelectTemplate
intree component
to replacenzTreeTemplate
, it seems not good, hope a better solution.