Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-tree

Package Overview
Dependencies
Maintainers
2
Versions
308
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-tree - npm Package Compare versions

Comparing version 0.14.4 to 0.15.0

19

lib/Tree.js

@@ -84,2 +84,13 @@ 'use strict';

}, {
key: 'getOpenTransitionName',
value: function getOpenTransitionName() {
var props = this.props;
var transitionName = props.openTransitionName;
var animationName = props.openAnimation;
if (!transitionName && typeof animationName === 'string') {
transitionName = props.prefixCls + '-open-' + animationName;
}
return transitionName;
}
}, {
key: 'renderTreeNode',

@@ -104,3 +115,5 @@ value: function renderTreeNode(child, index) {

checked: this.checkedKeys.indexOf(key) !== -1,
checkPart: this.checkPartKeys.indexOf(key) !== -1
checkPart: this.checkPartKeys.indexOf(key) !== -1,
openTransitionName: this.getOpenTransitionName(),
openAnimation: props.openAnimation
};

@@ -337,3 +350,5 @@ return _react2['default'].cloneElement(child, cloneProps);

onCheck: _react2['default'].PropTypes.func,
onSelect: _react2['default'].PropTypes.func
onSelect: _react2['default'].PropTypes.func,
openTransitionName: _react2['default'].PropTypes.string,
openAnimation: _react2['default'].PropTypes.oneOfType(_react2['default'].PropTypes.string, _react2['default'].PropTypes.object)
};

@@ -340,0 +355,0 @@

49

lib/TreeNode.js

@@ -27,2 +27,8 @@ 'use strict';

var _rcAnimate = require('rc-animate');
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var defaultTitle = '---';
var TreeNode = (function (_React$Component) {

@@ -115,22 +121,33 @@ _inherits(TreeNode, _React$Component);

value: function renderChildren(props) {
var newChildren = null;
var children = props.children;
var newChildren = 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;
var _cls;
var cls = (_cls = {}, _defineProperty(_cls, props.prefixCls + '-child-tree', true), _defineProperty(_cls, props.prefixCls + '-child-tree-open', props.expanded), _cls);
if (props.showLine) {
cls[props.prefixCls + '-line'] = this.getPosition(props.pos).center;
}
var animProps = {};
if (props.openTransitionName) {
animProps.transitionName = props.openTransitionName;
} else if (typeof props.openAnimation === 'object') {
animProps.animation = props.openAnimation;
}
newChildren = this.newChildren = _react2['default'].createElement(
'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)
_rcAnimate2['default'],
_extends({}, animProps, {
showProp: 'expanded',
component: '',
animateMount: true }),
_react2['default'].createElement(
'ul',
{ className: (0, _rcUtil.classSet)(cls), expanded: props.expanded },
_react2['default'].Children.map(children, function (item, index) {
return props.root.renderTreeNode(item, index, props.pos);
}, props.root)
)
);
} else {
newChildren = children;
}

@@ -147,3 +164,2 @@ return newChildren;

var prefixCls = props.prefixCls;
// const expandedState = (props.defaultExpandAll || props.expanded) ? 'open' : 'close';
var expandedState = props.expanded ? 'open' : 'close';

@@ -153,7 +169,10 @@

var canRenderSwitcher = true;
// let content = props.title;
var content = props.title;
var newChildren = this.renderChildren(props);
if (newChildren === props.children) {
content = newChildren;
// content = newChildren;
newChildren = null;
canRenderSwitcher = false;
}

@@ -191,3 +210,3 @@

{ className: (0, _rcUtil.joinClasses)(props.className, props.disabled ? prefixCls + '-treenode-disabled' : '') },
this.renderSwitcher(props, expandedState),
canRenderSwitcher ? this.renderSwitcher(props, expandedState) : _react2['default'].createElement('span', { className: prefixCls + '-switcher-noop' }),
props.checkable ? this.renderCheckbox(props) : null,

@@ -232,3 +251,3 @@ selectHandle(),

TreeNode.defaultProps = {
title: '---'
title: defaultTitle
};

@@ -235,0 +254,0 @@

{
"name": "rc-tree",
"version": "0.14.4",
"version": "0.15.0",
"description": "tree ui component for react",

@@ -11,4 +11,7 @@ "keywords": [

],
"main":"lib/index",
"files":["assets/*.css","lib"],
"main": "lib/index",
"files": [
"assets/*.css",
"lib"
],
"homepage": "http://github.com/react-component/tree",

@@ -43,10 +46,12 @@ "author": "hualei5280@gmail.com",

"rc-tools": "4.x",
"react": "~0.13.0"
"react": "~0.13.0",
"velocity-animate": "^1.2.2"
},
"dependencies": {
"rc-animate": "^1.1.0",
"rc-util": "^2.0.2"
},
"precommit": [
"lint"
],
"dependencies": {
"rc-util": "^2.0.2"
}
]
}

@@ -79,4 +79,4 @@ # rc-tree

|defaultSelectedKeys | default selected treeNodes | String[] | [] |
|onCheck | click the treeNode to fire | function(e:{checked:bool,node,checkedKeys}) | - |
|onSelect | click the treeNode to fire | function(e:{checked:bool,node,checkedKeys}) | - |
|onCheck | click the treeNode/checkbox to fire | function(e:{checked:bool,node,checkedKeys,event}) | - |
|onSelect | click the treeNode to fire | function(e:{selected:bool,node,checkedKeys,event}) | - |

@@ -90,3 +90,3 @@ ### TreeNode props

|title | tree/subTree's title | String | '---' |
|key | it's used with tree props's defaultExpandedKeys or defaultCheckedKeys | String | treeNode's pos |
|key | it's used with tree props's defaultExpandedKeys/defaultCheckedKeys/defaultSelectedKeys | String | treeNode's position |

@@ -93,0 +93,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc