0.4.7-beta.2 • Published 4 years ago

uxcore-tree v0.4.7-beta.2

Weekly downloads
25
License
MIT
Repository
github
Last release
4 years ago

uxcore-tree


TL;DR

tree ui component for react, based on rc-tree

setup develop environment

$ git clone https://github.com/uxcore/uxcore-tree
$ cd uxcore-tree
$ npm install
$ gulp server

Usage

var Tree = require('uxcore-tree');
var TreeNode = Tree.TreeNode;
React.render(
  <Tree>
    <TreeNode>leaf </TreeNode>
    <TreeNode>leaf </TreeNode>
  <Tree/>, container);

demo

http://uxcore.github.io/uxcore/components/tree/

Props

Tree props

namedescriptiontypedefault
classNameadditional css class of root dom nodeString''
prefixClsprefix classString''
disabledwhether disabled the treeboolfalse
showLinewhether show linebooltrue
showIconwhether show iconbooltrue
selectablewhether can be selectedbooltrue
multiplewhether multiple selectboolfalse
checkablewhether support checkedbool/React Nodefalse
defaultExpandAllexpand all treeNodesboolfalse
defaultExpandedKeysexpand specific treeNodesString[]-
defaultExpandParentauto expand parent treeNodes when initboolTrue
expandedKeysControlled expand specific treeNodesString[]-
autoExpandParentwhether auto expand parent treeNodesbooltrue
checkedKeysControlled checked treeNodes(After setting, defaultCheckedKeys will not work). Note: parent and children nodes are associated, if the parent node's key exists, it all children node will be checked, and vice versa. When set checkable and checkStrictly, it should be an object, which contains checked array and halfChecked array.String[]/{checked:Array,halfChecked:Array}[]
defaultCheckedKeysdefault checked treeNodesString[][]
checkStrictlycheck node precisely, parent and children nodes are not associatedboolfalse
selectedKeysControlled selected treeNodes(After setting, defaultSelectedKeys will not work)String[][]
defaultSelectedKeysdefault selected treeNodesString[][]
iconcustomize icon. When you pass component, whose render will receive full TreeNode props as component propselement/Function(props)-
onExpandfire on treeNode expand or notfunction(expandedKeys, {expanded: bool, node})-
onCheckclick the treeNode/checkbox to firefunction(checkedKeys, e:{checked: bool, checkedNodes, node, event})-
onSelectclick the treeNode to firefunction(selectedKeys, e:{selected: bool, selectedNodes, node, event})-
filterTreeNodefilter some treeNodes as you need. it should return truefunction(node)-
loadDataload data asynchronously and the return value should be a promisefunction(node)-
onRightClickselect current treeNode and show customized contextmenufunction({event,node})-
onMouseEntercall when mouse enter a treeNodefunction({event,node})-
onMouseLeavecall when mouse leave a treeNodefunction({event,node})-
draggablewhether can drag treeNode. (drag events are not supported in Internet Explorer 8 and earlier versions or Safari 5.1 and earlier versions.)boolfalse
onDragStartit execs when fire the tree's dragstart eventfunction({event,node})-
onDragEnterit execs when fire the tree's dragenter eventfunction({event,node,expandedKeys})-
onDragOverit execs when fire the tree's dragover eventfunction({event,node})-
onDragLeaveit execs when fire the tree's dragleave eventfunction({event,node})-
onDragEndit execs when fire the tree's dragend eventfunction({event,node})-
onDropit execs when fire the tree's drop eventfunction({event, node, dragNode, dragNodesKeys})-

TreeNode props

note: if you have a lot of TreeNode, like more than 1000,
make the parent node is collapsed by default, will obvious effect, very fast.
Because the children hide TreeNode will not insert into dom.

namedescriptiontypedefault
classNameadditional class to treeNodeString''
disabledwhether disabled the treeNodeboolfalse
disableCheckboxwhether disable the treeNode' checkboxboolfalse
titletree/subTree's titleString/node'---'
keyit's used with tree props's (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys. you'd better to set it, and it must be unique in the tree's all treeNodesStringtreeNode's position
isLeafwhether it's leaf nodeboolfalse
iconcustomize icon. When you pass component, whose render will receive full TreeNode props as component propselement/Function(props)-

ActionTreeNode props

namedescriptiontypedefault
classNameadditional class to treeNodeString''
disabledwhether disabled the treeNodeboolfalse
disableCheckboxwhether disable the treeNode' checkboxboolfalse
titletree/subTree's titleString/node'---'
keyit's used with tree props's (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys. you'd better to set it, and it must be unique in the tree's all treeNodesStringtreeNode's position
isLeafwhether it's leaf nodeboolfalse
iconcustomize icon. When you pass component, whose render will receive full TreeNode props as component propselement/Function(props)-
actionAblewhether the node has actionsBoolFalse
actionIconthe uxcore item name for the dropdown menu trigger to show actionsString'shezhi'
actionsactions of current nodeArray/Object
0.4.7-beta.2

4 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.3.9

6 years ago

0.4.0

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5-beta.5

6 years ago

0.3.5-beta.4

6 years ago

0.3.5-beta.3

6 years ago

0.3.5-beta.2

6 years ago

0.3.5-beta.1

6 years ago

0.3.5-beta.0

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.1

6 years ago

0.2.19

6 years ago

0.3.0

6 years ago

0.2.18

6 years ago

0.2.17

6 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.8

8 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago