Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

wenqi73
Copy link
Member

@wenqi73 wenqi73 commented Aug 28, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

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?

[ ] Yes
[x] No

Other information

I add a new @Input nzTreeSelectTemplate in tree component to replace nzTreeTemplate, it seems not good, hope a better solution.

@codecov
Copy link

codecov bot commented Aug 28, 2018

Codecov Report

Merging #2055 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
components/tree-select/nz-tree-select.component.ts 98.3% <100%> (+0.02%) ⬆️
components/time-picker/time-holder.ts 96.93% <0%> (+1.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2000fa...d2d5305. Read the comment docs.

@hsuanxyz hsuanxyz self-requested a review August 29, 2018 01:56
Copy link
Member

@hsuanxyz hsuanxyz left a 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.

@@ -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>;
Copy link
Member

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.

Copy link
Member Author

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 ?

@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder why need setTimeout?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not realize this line, setTimeout is useless.

@wenqi73 wenqi73 changed the title feat(module:tree-select):customized icon feat(module:tree-select): support customized icon Jan 18, 2019
@netlify
Copy link

netlify bot commented Jan 18, 2019

Deploy preview for ng-zorro-master ready!

Built with commit d2d5305

https://deploy-preview-2055--ng-zorro-master.netlify.com

@wenqi73
Copy link
Member Author

wenqi73 commented Jan 18, 2019

Conflict is resolved, please check.

@simplejason
Copy link
Member

Sorry, we have merged another pr (#2933) to solve the same thing like yours, thk.

@wenqi73 wenqi73 deleted the tree-select-icon branch May 24, 2019 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants