-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk/tree): allow use of nested node with flattened data, and vice versa #25899
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(cdk/tree): allow use of nested node with flattened data, and vice versa #25899
Conversation
|
|
||
| childrenAccessor = (dataNode: NestedFoodNode) => timer(100).pipe(mapTo(dataNode.children ?? [])); | ||
|
|
||
| dataSource = new ArrayDataSource(NESTED_DATA); |
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.
Nit: Can be readonly?
| export class CdkTreeNestedLevelAccessorExample { | ||
| levelAccessor = (dataNode: FlatFoodNode) => dataNode.level; | ||
|
|
||
| dataSource = new ArrayDataSource(FLAT_DATA); |
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.
Nit: can be readonly?
f471445 to
e875ce5
Compare
…nderNodeChanges` private
b379b80 to
7d0b6a2
Compare
| * | ||
| * This controls what selection of data the tree will render. | ||
| */ | ||
| // NB: we're unable to determine this ourselves; Angular's ContentChildren |
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.
"NB"?
| */ | ||
| // NB: we're unable to determine this ourselves; Angular's ContentChildren | ||
| // unfortunately does not pick up the necessary information. | ||
| @Input() nodeType?: 'flat' | 'nested'; |
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.
Why is this necessary at the node level? I would think that this is only needed at the entire tree level
| .pipe(takeUntil(this._onDestroy)) | ||
| .subscribe(data => this.renderNodeChanges(data)); | ||
| .pipe( | ||
| switchMap(data => this._convertChildren(data)), |
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 don't quite follow what's going on with this conversation here
| // The only situations where we have to convert children types is when | ||
| // they're mismatched; i.e. if the tree is using a childrenAccessor and the | ||
| // nodes are flat, or if the tree is using a levelAccessor and the nodes are | ||
| // nested. |
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 don't quite follow how this situation would come about- I would think we would only want to support either flat or nested for the entire free instance
7d0b6a2 to
19df7fb
Compare
565eb38 to
fbe321d
Compare
19df7fb to
79d0b69
Compare
79d0b69 to
f0e4ca6
Compare
f0e4ca6 to
bdbd7dd
Compare
|
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. |
Based on #25729. Followed by #26585.