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(schematics): tree schematic #11739

Merged
merged 5 commits into from
Jul 18, 2018
Merged

Conversation

amcdnl
Copy link
Contributor

@amcdnl amcdnl commented Jun 10, 2018

This PR adds a new schematic for the Material Tree module.

See example here: https://material-tree.stackblitz.io

@amcdnl amcdnl self-assigned this Jun 10, 2018
@amcdnl amcdnl requested a review from jelbourn June 10, 2018 16:10
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 10, 2018
@jelbourn jelbourn requested a review from tinayuangao June 11, 2018 20:37
@@ -0,0 +1,22 @@
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle matTreeNodePadding>
<button mat-icon-button disabled></button>
Copy link
Member

Choose a reason for hiding this comment

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

Could we omit this (empty/nonfunctional) button completely and just capture the spacing with a different element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just copied what the docs examples did. Open to other ideas though. Just let me know.

Copy link
Member

Choose a reason for hiding this comment

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

cc @tinayuangao there's no reason this needs to be a button, right? It's just to take up space?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we should remove the button and use style to take up space.

return node.level;
}

/** Return whether the node is expanded or not. */
Copy link
Member

Choose a reason for hiding this comment

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

Return -> Get (for consistency with other methods)

import {buildComponent} from '../utils/devkit-utils/component';

/**
* Scaffolds a new navigation component.
Copy link
Member

Choose a reason for hiding this comment

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

"navigation" -> "tree" ?

<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle matTreeNodePadding>
<button mat-icon-button disabled></button>
<mat-icon class="type-icon" [attr.aria-label]="node.type + 'icon'">
{{ node.type ==='file' ? 'description' : 'folder' }}
Copy link
Contributor

@rafaelss95 rafaelss95 Jun 11, 2018

Choose a reason for hiding this comment

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

I think you always omit braces here, no (here and elsewhere)? Also, there's a missing whitespace before 'file' (here and elsewhere).

@@ -0,0 +1,113 @@
import { Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the !! necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its used in every component schematic

Copy link
Member

Choose a reason for hiding this comment

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

I commented on this in the other schematics too; I don't see a the need for it, and "because it was already like that" isn't a great reason for keeping it

}

@Component({
selector: '<%= selector %>',<% if(inlineTemplate) { %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing whitespace before ( (here and elsewhere)?

@jelbourn
Copy link
Member

Nudge @tinayuangao to take a look

@ngbot
Copy link

ngbot bot commented Jun 29, 2018

Hi @amcdnl! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@amcdnl
Copy link
Contributor Author

amcdnl commented Jul 15, 2018

Nudge @tinayuangao

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

Tina has actually moved to a different team, so LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jul 16, 2018
@josephperrott josephperrott merged commit 1540e2f into angular:master Jul 18, 2018
@amcdnl amcdnl deleted the tree-schematic branch July 22, 2018 14:02
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants