This repository was archived by the owner on Mar 12, 2024. It is now read-only.
Open
Conversation
This removes the TreeNode mixin from the components, in favor of keeping the actual tree structure in a separate model. This removes our dependence on Ember's render process, which has changed quite a bit since this addon was first written. This also allows us to fix the deprecation warnings (and later errors) related to setting a property during `didInsertElement`.
The `ivy-tree` component now defines `groupComponent` and
`treeitemComponent` properties which can be set to a curried
`{{component}}` instance, or the name of a component to use as the group
and treeitem components, respectively.
In the spirit of Data Down, Actions Up, we now expose actions for collapsing and expanding a node. These actions are called with the node as an argument. In the simplest case, you should call `node.collapse()` or `node.expand()` from your action.
This means "activate" is now "activateNode", "collapse" is now "collapseNode", and "expand" is now "expandNode".
Previously, a POJO `model` property would be passed in to `{{ivy-tree}}`
and the component would then build an in-memory tree of nodes. Now the
responsibility for building the tree is pushed out to the caller, and a
`buildTree` function is exposed for this purpose. This is a bit nicer
since it makes the tree nodes accessible to the caller, in case they
want to, for instance, expand or collapse nodes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously we had been relying on Ember's rendering process to build up a tree of components for us. This proved brittle since there were cases where we needed to know about a node's children in order to render the node itself (see #5 and #7).
This PR moves the node logic into a separate
TreeNodeclass, sidestepping the problem.expandedin a way that's compatible with "Data Down, Actions Up"