-
Notifications
You must be signed in to change notification settings - Fork 66
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
Tree widget #1214
Comments
@xiaohulu We should decide on some requirements. Any one thing in particular that would be a deal-breaker if it were missing? FeaturesRequired
Nice to haveExamplesThemesMaterialDojoAPIexport interface TreeNode {
title: string | RenderResult;
icon?: IconType;
children?: TreeNode[] | boolean; // child nodes or `true` to indicate children should be loaded dynamically; `[]`, `undefined`, and `false` indicates leaf node
expanded?: boolean; // node is initially expanded
disabled?: boolean; // disables this node when tree allows selection
}
export interface TreeProperties {
nodes: TreeNode[];
allowSelection?: 'single' | 'multiple';
onLoad?(node: TreeNode): TreeNode[]; // dynamically load node children
onExpand?(node: TreeNode): void;
onCollapse?(node: TreeNode): void;
onSelect?(node: TreeNode): void;
} Simple example usage<Tree nodes={nodes} onLoad={loadChildren} /> Upcoming Widget Variations
|
I'm not very sure. edit node (with resources?) maybe not part of tree feature, because of data driven.
|
That's all good stuff. I may recommend we move all the editing to a separate widget? |
Maybe not. |
As discussed on a call / screenshare: I think that for this POC we need to work on getting the tree to have an api similar the list and to accept a flat array of data (from a resource) to display the tree contents. It would be beneficial if the tree could re-use the listItem / menuItem from the List widget as this would provide consistent styling / functionality . We should support keyboard navigation. Any content customisation should be provided via a child renderer, not via a property. Data display concerns such as onExpand / collapse etc callbacks should probably return an |
In addition to the above notes, we should ensure
An working example of a tree using a remote resource and fetching children via a query can be seen here: https://codesandbox.io/s/elegant-cartwright-sd0o0 |
From screenshare with @samends
|
Similar to
https://ant.design/components/tree/
https://github.com/react-component/tree/
The text was updated successfully, but these errors were encountered: