@vahaha/treejs
Version:
build tree from array
59 lines (47 loc) • 1.82 kB
Markdown
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
- getAllNodes(): get all nodes of tree
- getNode(id): get a node by id
- update docs
- fromNodes function: build trees from array of nodes
- TreeJS object:
- getBranch(id): get branch (sub tree) from a node
- getNodesOfBranch(id): get all nodes are descendant of a node. Result include current node.
- TreeNode object:
- getPath(): get path direct to root
- getParent(): get parent of current node
- setParent(patent: TreeNode): set parent of current node. This action also adds current node to children list of parent.
- addChild(...children): add child/children to node.This action also sets current node as parent of added child/children
- inheritPath(): refresh path of current node by inherit from parent
- visitAncestors(): refresh path by visit all ancestors
- visitDescendants(): refresh path of all descendants
## [1.1.4] - 2021-10-19
### Added
- Sorting
## [1.1.3] - 2021-02-02
### Added
- Testing
### Changed
- Improve performance
## [1.1.2] - 2020-12-30
### Fixed
- Customize children's field name is not correct at tree deeper than 1 level.
## [1.1.0] - 2020-12-29
### Added
- Option object:
- childrenFieldName: (default: 'children') custome children's field name.
- cloneDeep: (default: false) if true, clone deep nodes.
## [1.0.0] - 2020-12-29
### Added
- Option object:
- childrenFieldName: (default: 'children') custome children's field name.
- cloneDeep: (default: false) if true, clone deep nodes.