-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Conversation
@@ -0,0 +1,22 @@ | |||
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl"> | |||
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle matTreeNodePadding> | |||
<button mat-icon-button disabled></button> |
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.
Could we omit this (empty/nonfunctional) button completely and just capture the spacing with a different element?
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.
I just copied what the docs examples did. Open to other ideas though. Just let me know.
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.
cc @tinayuangao there's no reason this needs to be a button, right? It's just to take up space?
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.
Yes, we should remove the button and use style to take up space.
return node.level; | ||
} | ||
|
||
/** Return whether the node is expanded or not. */ |
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.
Return
-> Get
(for consistency with other methods)
src/lib/schematics/tree/index.ts
Outdated
import {buildComponent} from '../utils/devkit-utils/component'; | ||
|
||
/** | ||
* Scaffolds a new navigation component. |
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.
"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' }} |
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.
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'; |
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.
Is the !!
necessary?
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.
Its used in every component schematic
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.
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) { %> |
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.
Missing whitespace before (
(here and elsewhere)?
Nudge @tinayuangao to take a look |
Hi @amcdnl! This PR has merge conflicts due to recent upstream merges. |
Nudge @tinayuangao |
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.
Tina has actually moved to a different team, so LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR adds a new schematic for the Material Tree module.
See example here: https://material-tree.stackblitz.io