Socket
Socket
Sign inDemoInstall

rc-tree

Package Overview
Dependencies
4
Maintainers
2
Versions
305
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.13.1 to 0.14.0

269

lib/Tree.js

@@ -11,3 +11,3 @@ 'use strict';

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -26,10 +26,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

// import TreeNode from './TreeNode';
var id = 1;
var uuid = function uuid() {
return id++;
};
// ['0-0','0-1', '0-0-1', '0-1-1'] => ['0-0', '0-1']
// sorted array ['0-0','0-1', '0-0-1', '0-1-1'] => ['0-0', '0-1']
var filterMin = function filterMin(arr) {

@@ -48,16 +41,5 @@ var a = [];

var rootTrees = {};
var Tree = (function (_React$Component) {
_inherits(Tree, _React$Component);
_createClass(Tree, null, [{
key: 'statics',
value: function statics() {
return {
rootTrees: rootTrees
};
}
}]);
function Tree(props) {

@@ -69,58 +51,54 @@ var _this = this;

_get(Object.getPrototypeOf(Tree.prototype), 'constructor', this).call(this, props);
['handleKeyDown', 'handleChecked', 'handleSelect'].forEach(function (m) {
['handleKeyDown', 'handleChecked'].forEach(function (m) {
_this[m] = _this[m].bind(_this);
});
var expandedKeys = props.defaultExpandedKeys;
var checkedKeys = props.defaultCheckedKeys;
this.defaultExpandAll = props.defaultExpandAll;
this.state = {
expandedKeys: expandedKeys,
checkedKeys: checkedKeys
};
}
// get root tree, run one time
if (!props._childTreeNode && !props._childTree) {
// console.log('root tree', this);
this._rootTreeId = uuid();
var rootConfig = {
prefixCls: props.prefixCls,
showLine: props.showLine,
showIcon: props.showIcon,
expandAll: props.expandAll,
checkable: props.checkable,
defaultSelectedKeys: props.defaultSelectedKeys,
selectedKeys: props.selectedKeys,
onChecked: this.handleChecked,
onSelect: this.handleSelect
_createClass(Tree, [{
key: 'getCheckKeys',
value: function getCheckKeys() {
var _this2 = this;
var checkPartKeys = [];
var checkedKeys = [];
Object.keys(this.treeNodesChkStates).forEach(function (item) {
var itemObj = _this2.treeNodesChkStates[item];
if (itemObj.checked) {
checkedKeys.push(itemObj.key);
} else if (itemObj.checkPart) {
checkPartKeys.push(itemObj.key);
}
});
return {
checkPartKeys: checkPartKeys, checkedKeys: checkedKeys
};
rootTrees[this._rootTreeId] = {
_rootTree: this,
rootConfig: rootConfig,
treeNodesState: {},
trees: [],
selectedKeys: props.selectedKeys.length && props.selectedKeys || props.defaultSelectedKeys
};
}
// if (props._childTree) {
// console.log('child tree', this);
// }
}
_createClass(Tree, [{
}, {
key: 'renderTreeNode',
value: function renderTreeNode(child, index) {
var level = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
var key = child.key || level + '-' + index;
var state = this.state;
var props = this.props;
var pos = (props._pos || 0) + '-' + index;
var _rootTreeId = this._rootTreeId || props._rootTreeId;
var cloneProps = {
ref: 'treeNode',
_rootTreeId: _rootTreeId,
_key: child.key || pos,
_pos: pos,
_level: props._level || 0,
_index: index,
_len: this.childrenLength,
checked: child.props.checked || props.checked,
checkPart: props.checkPart
root: this,
eventKey: key,
pos: level + '-' + index,
prefixCls: props.prefixCls,
showLine: props.showLine,
showIcon: props.showIcon,
checkable: props.checkable,
expanded: this.defaultExpandAll || state.expandedKeys.indexOf(key) !== -1,
checked: this.checkedKeys.indexOf(key) !== -1,
checkPart: this.checkPartKeys.indexOf(key) !== -1
};
Object.keys(rootTrees[_rootTreeId].rootConfig).forEach(function (item) {
cloneProps[item] = rootTrees[_rootTreeId].rootConfig[item];
});
if (rootTrees[_rootTreeId].selectedKeys.indexOf(child.key) > -1) {
cloneProps.selected = true;
}
return _react2['default'].cloneElement(child, cloneProps);

@@ -131,29 +109,34 @@ }

value: function render() {
var _this3 = this;
var props = this.props;
var domProps = {
className: (0, _rcUtil.classSet)(props.className, props.prefixCls),
onKeyDown: this.handleKeyDown,
role: 'tree-node',
'aria-activedescendant': '',
'aria-labelledby': '',
'aria-expanded': props.expanded ? 'true' : 'false',
'aria-selected': props.selected ? 'true' : 'false',
'aria-level': ''
role: 'tree-node'
};
if (props._childTree) {
domProps.style = props.expanded ? { display: 'block' } : { display: 'none' };
if (props.focusable) {
domProps.tabIndex = '0';
domProps.onKeyDown = this.handleKeyDown;
}
if (!this._finishInit && !props._childTreeNode && !props._childTree) {
this.handleChildren(props.children, this._obj = {}, this._propsCheckedArray = []);
this._propsCheckedArray = filterMin(this._propsCheckedArray);
this.handleCheckState(this._obj, this._propsCheckedArray);
// console.log(this._obj);
rootTrees[this._rootTreeId].treeNodesState = this._obj;
this._finishInit = true;
}
this.childrenLength = _react2['default'].Children.count(props.children);
var checkedKeys = this.state.checkedKeys;
var checkedPos = [];
this.treeNodesChkStates = {};
this.loopAllChildren(props.children, function (item, index, pos) {
var key = item.key || pos;
var checked = false;
if (checkedKeys.indexOf(key) !== -1) {
checked = true;
checkedPos.push(pos);
}
_this3.treeNodesChkStates[pos] = {
key: key,
checked: checked,
checkPart: false
};
});
this.handleCheckState(this.treeNodesChkStates, filterMin(checkedPos.sort()));
var checkKeys = this.getCheckKeys();
this.checkPartKeys = checkKeys.checkPartKeys;
this.checkedKeys = checkKeys.checkedKeys;
this.newChildren = _react2['default'].Children.map(props.children, this.renderTreeNode, this);
return _react2['default'].createElement(

@@ -166,2 +149,17 @@ 'ul',

}, {
key: 'loopAllChildren',
value: function loopAllChildren(childs, callback) {
var loop = function loop(children, level) {
_react2['default'].Children.forEach(children, function (item, index) {
var pos = level + '-' + index;
var newChildren = item.props.children;
if (Array.isArray(newChildren)) {
loop(newChildren, pos);
}
callback(item, index, pos);
});
};
loop(childs, 0);
}
}, {
key: 'handleCheckState',

@@ -225,43 +223,57 @@ value: function handleCheckState(obj, checkedArr, unCheckEvent) {

}, {
key: 'handleChildren',
value: function handleChildren(children, _obj, _propsCheckedArray, level) {
var _this2 = this;
key: 'handleChecked',
value: function handleChecked(treeNode) {
var _this4 = this;
_react2['default'].Children.forEach(children, function (child, index) {
var pos = (level || 0) + '-' + index;
// console.log(child.props.checkbox);
var props = child.props;
if (child.props.checkbox) {
props = child.props.checkbox.props;
var tnProps = treeNode.props;
var checked = !tnProps.checked;
if (tnProps.checkPart) {
checked = true;
}
var pos = undefined;
Object.keys(this.treeNodesChkStates).forEach(function (item) {
var itemObj = _this4.treeNodesChkStates[item];
if (itemObj.key === (treeNode.key || tnProps.eventKey)) {
pos = item;
itemObj.checked = checked;
itemObj.checkPart = false;
}
_obj[pos] = {
checkPart: child.props.checkPart || false,
checked: props.checked || props.defaultChecked || false
};
if (_obj[pos].checked) {
_propsCheckedArray.push(pos);
}
var childChildren = child.props.children;
if (childChildren && typeof childChildren.type === 'function' && typeof childChildren.type.TreeNode === 'function') {
childChildren = [childChildren];
}
if (Array.isArray(childChildren)) {
return _this2.handleChildren(childChildren, _obj, _propsCheckedArray, pos);
}
return null;
});
}
}, {
key: 'handleChecked',
value: function handleChecked(isChk, c) {
if (this.props.onChecked) {
this.props.onChecked(isChk, c);
this.handleCheckState(this.treeNodesChkStates, [pos], !checked);
var checkKeys = this.getCheckKeys();
this.checkPartKeys = checkKeys.checkPartKeys;
this.setState({
checkedKeys: checkKeys.checkedKeys
});
if (this.props.onCheck) {
this.props.onCheck(checked, treeNode, checkKeys.checkedKeys);
}
}
}, {
key: 'handleSelect',
value: function handleSelect(isSel, c, selectedKeys) {
if (this.props.onSelect) {
this.props.onSelect(isSel, c, selectedKeys);
key: 'handleExpanded',
value: function handleExpanded(treeNode) {
var thisProps = this.props;
var tnProps = treeNode.props;
var expandedKeys = this.state.expandedKeys.concat([]);
var expanded = !tnProps.expanded;
if (this.defaultExpandAll) {
this.loopAllChildren(thisProps.children, function (item, index, pos) {
var key = item.key || pos;
if (expandedKeys.indexOf(key) === -1) {
expandedKeys.push(key);
}
});
this.defaultExpandAll = false;
}
var index = expandedKeys.indexOf(tnProps.eventKey);
if (expanded) {
if (index === -1) {
expandedKeys.push(tnProps.eventKey);
}
} else {
expandedKeys.splice(index, 1);
}
this.setState({
expandedKeys: expandedKeys
});
}

@@ -285,7 +297,6 @@

showIcon: _react2['default'].PropTypes.bool,
expandAll: _react2['default'].PropTypes.bool,
onChecked: _react2['default'].PropTypes.func,
onSelect: _react2['default'].PropTypes.func,
defaultSelectedKeys: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.string),
selectedKeys: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.string)
defaultExpandAll: _react2['default'].PropTypes.bool,
defaultExpandedKeys: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.string),
defaultCheckedKeys: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.string),
onCheck: _react2['default'].PropTypes.func
};

@@ -296,7 +307,7 @@

checkable: false,
showLine: true,
showLine: false,
showIcon: true,
expandAll: false,
defaultSelectedKeys: [],
selectedKeys: []
defaultExpandAll: false,
defaultExpandedKeys: [],
defaultCheckedKeys: []
};

@@ -303,0 +314,0 @@

@@ -7,2 +7,4 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

@@ -26,11 +28,5 @@

var _Tree2 = require('./Tree');
var TreeNode = (function (_React$Component) {
_inherits(TreeNode, _React$Component);
var _Tree3 = _interopRequireDefault(_Tree2);
var rootTrees = _Tree3['default'].statics().rootTrees;
var TreeNode = (function (_Tree) {
_inherits(TreeNode, _Tree);
function TreeNode(props) {

@@ -42,10 +38,3 @@ var _this = this;

_get(Object.getPrototypeOf(TreeNode.prototype), 'constructor', this).call(this, props);
var tnState = this.getTreeNodesState();
this.state = {
expanded: props.expandAll || props.expanded || props.defaultExpanded,
selected: props.selected || false,
checkPart: tnState.checkPart || false,
checked: tnState.checked || false
};
['handleExpandedState'].forEach(function (m) {
['handleExpanded', 'handleChecked'].forEach(function (m) {
_this[m] = _this[m].bind(_this);

@@ -56,20 +45,27 @@ });

_createClass(TreeNode, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps() {
var tnState = this.getTreeNodesState();
this.setState({
checkPart: tnState.checkPart,
checked: tnState.checked
key: 'getPosition',
value: function getPosition(pos) {
var obj = {
last: false,
center: false
};
var siblings = Object.keys(this.props.root.treeNodesChkStates).filter(function (item) {
var len = pos.length;
return len === item.length && pos.substring(0, len - 2) === item.substring(0, len - 2);
});
var sLen = siblings.length;
var posIndex = Number(pos.substr(-1, 1));
if (sLen === 1 || posIndex === sLen - 1) {
obj.last = true;
} else {
obj.center = true;
}
return obj;
}
}, {
key: 'getTreeNodesState',
value: function getTreeNodesState() {
return rootTrees[this.props._rootTreeId].treeNodesState[this.props._pos];
}
}, {
key: 'renderSwitcher',
value: function renderSwitcher(props, prefixCls, switchState) {
value: function renderSwitcher(props, expandedState) {
var _switcherCls;
var prefixCls = props.prefixCls;
var switcherCls = (_switcherCls = {}, _defineProperty(_switcherCls, prefixCls + '-button', true), _defineProperty(_switcherCls, prefixCls + '-switcher', true), _switcherCls);

@@ -81,25 +77,21 @@ if (props.disabled) {

var posObj = this.getPosition(props.pos);
if (!props.showLine) {
switcherCls[prefixCls + '-noline_' + switchState] = true;
} else if (props._isChildTree && props._index === 0) {
if (props._len !== 1) {
switcherCls[prefixCls + '-center_' + switchState] = true;
} else {
switcherCls[prefixCls + '-bottom_' + switchState] = true;
}
} else if (props._index === 0) {
switcherCls[prefixCls + '-roots_' + switchState] = true;
} else if (props._index === props._len - 1) {
switcherCls[prefixCls + '-bottom_' + switchState] = true;
switcherCls[prefixCls + '-noline_' + expandedState] = true;
} else if (props.pos === '0-0') {
switcherCls[prefixCls + '-roots_' + expandedState] = true;
} else {
switcherCls[prefixCls + '-center_' + switchState] = true;
switcherCls[prefixCls + '-center_' + expandedState] = posObj.center;
switcherCls[prefixCls + '-bottom_' + expandedState] = posObj.last;
}
return _react2['default'].createElement('span', { className: (0, _rcUtil.classSet)(switcherCls), onClick: this.handleExpandedState });
return _react2['default'].createElement('span', { className: (0, _rcUtil.classSet)(switcherCls), onClick: this.handleExpanded });
}
}, {
key: 'renderCheckbox',
value: function renderCheckbox(props, prefixCls, state) {
value: function renderCheckbox(props) {
var _checkboxCls;
var checkboxCls = (_checkboxCls = {}, _defineProperty(_checkboxCls, prefixCls + '-button', true), _defineProperty(_checkboxCls, prefixCls + '-chk', true), _checkboxCls);
var prefixCls = props.prefixCls;
var checkboxCls = (_checkboxCls = {}, _defineProperty(_checkboxCls, prefixCls + '-button', true), _defineProperty(_checkboxCls, prefixCls + '-checkbox', true), _checkboxCls);
if (!props.checkable) {

@@ -109,54 +101,31 @@ return null;

if (props.disabled) {
checkboxCls[prefixCls + '-chk-disabled'] = true;
return _react2['default'].createElement('span', { ref: 'checkbox', className: (0, _rcUtil.classSet)(checkboxCls) });
checkboxCls[prefixCls + '-checkbox-disabled'] = true;
}
if (state.checkPart) {
checkboxCls[prefixCls + '-checkbox_true_part'] = true;
} else if (state.checked) {
checkboxCls[prefixCls + '-checkbox_true_full'] = true;
} else {
checkboxCls[prefixCls + '-checkbox_false_full'] = true;
if (props.checkPart) {
checkboxCls[prefixCls + '-checkbox-indeterminate'] = true;
} else if (props.checked) {
checkboxCls[prefixCls + '-checkbox-checked'] = true;
}
// console.log(props.checkbox.props);
if (props.checkbox) {
checkboxCls[prefixCls + '-checkbox-custom'] = true;
_react2['default'].cloneElement(props.checkbox, {
checked: state.checked
});
// props.checkbox.props.checked = state.checked;
}
// defaultChecked: state.checked,
return _react2['default'].createElement(
'span',
{ ref: 'checkbox', className: (0, _rcUtil.classSet)(checkboxCls), onClick: this.handleChecked },
props.checkbox ? props.checkbox : null
);
return _react2['default'].createElement('span', { ref: 'checkbox', className: (0, _rcUtil.classSet)(checkboxCls) });
}
}, {
key: 'renderChildren',
value: function renderChildren(props, children) {
value: function renderChildren(props) {
var newChildren = null;
var children = props.children;
if (children.type === TreeNode || Array.isArray(children) && children.every(function (item) {
return item.type === TreeNode;
})) {
var style = props.expanded ? { display: 'block' } : { display: 'none' };
var cls = {};
cls[props.prefixCls + '-child-tree'] = true;
if (props.showLine && props._index !== props._len - 1) {
cls[props.prefixCls + '-line'] = true;
if (props.showLine) {
cls[props.prefixCls + '-line'] = this.getPosition(props.pos).center;
}
var treeProps = {
_rootTreeId: props._rootTreeId,
_pos: props._pos,
_level: props._level + 1,
_childTree: true,
checked: this.state.checked,
checkPart: this.state.checkPart,
className: (0, _rcUtil.classSet)(cls),
expanded: this.state.expanded
};
newChildren = this.newChildren = _react2['default'].createElement(
_Tree3['default'],
treeProps,
children
'ul',
{ className: (0, _rcUtil.classSet)(cls), style: style },
_react2['default'].Children.map(children, function (item, index) {
return props.root.renderTreeNode(item, index, props.pos);
}, props.root)
);

@@ -175,10 +144,10 @@ } else {

var props = this.props;
var state = this.state;
var prefixCls = props.prefixCls;
var switchState = state.expanded ? 'open' : 'close';
// const expandedState = (props.defaultExpandAll || props.expanded) ? 'open' : 'close';
var expandedState = props.expanded ? 'open' : 'close';
var iconEleCls = (_iconEleCls = {}, _defineProperty(_iconEleCls, prefixCls + '-button', true), _defineProperty(_iconEleCls, prefixCls + '-iconEle', true), _defineProperty(_iconEleCls, prefixCls + '-icon__' + switchState, true), _iconEleCls);
var iconEleCls = (_iconEleCls = {}, _defineProperty(_iconEleCls, prefixCls + '-button', true), _defineProperty(_iconEleCls, prefixCls + '-iconEle', true), _defineProperty(_iconEleCls, prefixCls + '-icon__' + expandedState, true), _iconEleCls);
var content = props.title;
var newChildren = this.renderChildren(props, props.children);
var newChildren = this.renderChildren(props);
if (newChildren === props.children) {

@@ -191,25 +160,17 @@ content = newChildren;

var icon = props.showIcon ? _react2['default'].createElement('span', { className: (0, _rcUtil.classSet)(iconEleCls) }) : null;
if (props.disabled) {
return _react2['default'].createElement(
'a',
{ ref: 'selectHandle', title: content },
icon,
_react2['default'].createElement(
'span',
{ className: 'title' },
content
)
);
var title = _react2['default'].createElement(
'span',
{ className: prefixCls + '-title' },
content
);
var domProps = {};
if (!props.disabled) {
domProps.onClick = _this2.handleChecked;
}
return _react2['default'].createElement(
'a',
{ ref: 'selectHandle', title: content,
className: state.selected ? prefixCls + '-selected' : '',
onClick: _this2.handleSelect },
_extends({ ref: 'selectHandle', title: content }, domProps),
_this2.renderCheckbox(props),
icon,
_react2['default'].createElement(
'span',
{ className: 'title' },
content
)
title
);

@@ -220,5 +181,4 @@ };

'li',
{ className: (0, _rcUtil.joinClasses)(props.className, 'level-' + props._level, 'pos-' + props._pos, props.disabled ? prefixCls + '-treenode-disabled' : '') },
this.renderSwitcher(props, prefixCls, switchState),
this.renderCheckbox(props, prefixCls, state),
{ className: (0, _rcUtil.joinClasses)(props.className, props.disabled ? prefixCls + '-treenode-disabled' : '') },
this.renderSwitcher(props, expandedState),
selectHandle(),

@@ -229,55 +189,10 @@ newChildren

}, {
key: 'handleExpandedState',
value: function handleExpandedState() {
this.setState({
expanded: !this.state.expanded
});
key: 'handleExpanded',
value: function handleExpanded() {
this.props.root.handleExpanded(this);
}
}, {
key: 'handleSelect',
value: function handleSelect() {
var selected = !this.state.selected;
var arr = rootTrees[this.props._rootTreeId].selectedKeys;
var index = arr.indexOf(this.props._key);
if (selected) {
if (index < 0) {
arr.push(this.props._key);
}
} else {
if (index > -1) {
arr.splice(index, 1);
}
}
this.setState({
selected: selected
});
if (this.props.onSelect) {
this.props.onSelect(selected, this, arr);
}
}
}, {
key: 'handleChecked',
value: function handleChecked() {
var props = this.props;
var checked = !this.state.checked;
if (this.state.checkPart) {
checked = true;
}
var nSt = {
checkPart: false,
checked: checked
};
rootTrees[props._rootTreeId].treeNodesState[props._pos] = nSt;
_get(Object.getPrototypeOf(TreeNode.prototype), 'handleCheckState', this).call(this, rootTrees[props._rootTreeId].treeNodesState, [props._pos], !checked);
// console.log(rootTrees[props._rootTreeId].treeNodesState);
// this.setState(nSt);
// 从rootTree更新
rootTrees[props._rootTreeId]._rootTree.forceUpdate();
if (props.onChecked) {
props.onChecked(checked, this);
}
this.props.root.handleChecked(this);
}

@@ -294,21 +209,12 @@

return TreeNode;
})(_Tree3['default']);
})(_react2['default'].Component);
TreeNode.propTypes = {
_rootTreeId: _react2['default'].PropTypes.number,
_pos: _react2['default'].PropTypes.string,
_index: _react2['default'].PropTypes.number,
_len: _react2['default'].PropTypes.number,
_level: _react2['default'].PropTypes.number,
_key: _react2['default'].PropTypes.string,
prefixCls: _react2['default'].PropTypes.string,
expanded: _react2['default'].PropTypes.bool,
selected: _react2['default'].PropTypes.bool,
root: _react2['default'].PropTypes.object,
onSelect: _react2['default'].PropTypes.func
};
TreeNode.defaultProps = {
_childTreeNode: true,
title: '---',
defaultExpanded: false,
expanded: false
title: '---'
};

@@ -315,0 +221,0 @@

{
"name": "rc-tree",
"version": "0.13.1",
"version": "0.14.0",
"description": "tree ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -74,7 +74,6 @@ # rc-tree

|checkable | whether support checked | bool | false |
|expandAll | expand all treeNodes | bool | false |
|onChecked | click the treeNode's checkbox to checked(auto switch checked state) | function | - |
|selectedKeys | selected treeNodes | String[] | [] |
|defaultSelectedKeys | default selected treeNodes | String[] | [] |
|onSelect | click the treeNode to fire(auto switch selected state) | function | - |
|defaultExpandAll | expand all treeNodes | bool | false |
|defaultExpandedKeys | expand specific treeNodes | String[] | false |
|defaultCheckedKeys | default checked treeNodes | String[] | [] |
|onCheck | click the treeNode to fire | function(e:{checked:bool,node,checkedKeys}) | - |

@@ -88,14 +87,5 @@ ### TreeNode props

|title | tree/subTree's title | String | '---' |
|defaultChecked | set checked state(require tree props checkable) | bool | false |
|checked | set checked state(require tree props checkable) | bool | false |
|checkbox | can use custom checkbox element(require tree props checkable) | element | - |
|defaultExpanded | whether default expand the treeNode | bool | false |
|expanded | whether expand the treeNode, it's controlled | bool | false |
|key | it's used with tree props's selectedKeys or defaultSelectedKeys | String | treeNode's pos |
|key | it's used with tree props's defaultExpandedKeys or defaultCheckedKeys | String | treeNode's pos |
### Keyboard
- KeyDown/KeyUp
## Development

@@ -102,0 +92,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc