Skip to content

docs(tree): add tree examples #9585

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

Merged
merged 1 commit into from
Feb 16, 2018
Merged

Conversation

tinayuangao
Copy link
Contributor

Add two tree overview example

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 25, 2018
@@ -0,0 +1,9 @@
.tree-demo-invisible {
Copy link
Member

Choose a reason for hiding this comment

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

Prefix with example-

(here and elsewhere)

display: none;
}

ul, li {
Copy link
Member

Choose a reason for hiding this comment

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

These should be gated by some css class

import {of} from 'rxjs/observable/of';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';

export class JsonNode {
Copy link
Member

Choose a reason for hiding this comment

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

Add description?

}

/** Flat node with expandable and level information */
export class JsonFlatNode {
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to make these more clearly examples specific to some use-case

}}`;

@Injectable()
export class JsonDatabase {
Copy link
Member

Choose a reason for hiding this comment

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

This could use more comments in general to explain what's going on

}

ul, li {
-webkit-margin-before: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Might add a comment about this.

</button>
{{node.key}}
</div>
<ul [class]="nestedTreeControl.isExpanded(node) ? '' : 'tree-demo-invisible'">
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this be better as ngClass:

[ngClass]="{ 'tree-demo-invisible': nestedTreeControl.isExpanded(node) }"

this.nestedTreeControl = new NestedTreeControl<JsonNode>(this._getChildren);
this.nestedDataSource = new MatTreeNestedDataSource();

database.dataChange.subscribe(data => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could omit {}

@tinayuangao
Copy link
Contributor Author

Comments addressed. Thanks for review!

@@ -24,8 +24,10 @@
"paths": {
"@angular/material/*": ["../../dist/packages/material/*"],
"@angular/material": ["../../dist/packages/material/public-api"],
"@angular/material-experimental/*": ["../../dist/packages/material-experimental/*"],
Copy link
Member

Choose a reason for hiding this comment

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

We should actually just move the tree into src/lib now that we're on for next major

@tinayuangao
Copy link
Contributor Author

Comments addressed. Please take a look. Thanks!

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.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release labels Feb 15, 2018
@tinayuangao tinayuangao merged commit 631397c into angular:tree Feb 16, 2018
@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 8, 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 target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants