Socket
Socket
Sign inDemoInstall

rc-tree

Package Overview
Dependencies
Maintainers
2
Versions
306
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.16.2 to 0.17.0

19

lib/Tree.js

@@ -126,2 +126,3 @@ 'use strict';

prefixCls: props.prefixCls,
async: props.async,
showLine: props.showLine,

@@ -331,2 +332,4 @@ showIcon: props.showIcon,

value: function handleExpand(treeNode) {
var _this5 = this;
var thisProps = this.props;

@@ -349,6 +352,15 @@ var tnProps = treeNode.props;

expandedKeys.push(tnProps.eventKey);
if (thisProps.async && thisProps.onDataLoaded) {
return thisProps.onDataLoaded(treeNode).then(function () {
_this5.setState({
expandedKeys: expandedKeys
});
})['catch'](function () {
// console.error('Something went wrong', reason);
});
}
}
} else {
expandedKeys.splice(index, 1);
}
expandedKeys.splice(index, 1);
}
this.setState({

@@ -373,2 +385,3 @@ expandedKeys: expandedKeys

checkable: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.bool, _react2['default'].PropTypes.node]),
async: _react2['default'].PropTypes.bool,
showLine: _react2['default'].PropTypes.bool,

@@ -382,2 +395,3 @@ showIcon: _react2['default'].PropTypes.bool,

onSelect: _react2['default'].PropTypes.func,
onDataLoaded: _react2['default'].PropTypes.func,
openTransitionName: _react2['default'].PropTypes.string,

@@ -389,2 +403,3 @@ openAnimation: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.object])

prefixCls: 'rc-tree',
async: false,
multiple: false,

@@ -391,0 +406,0 @@ checkable: false,

@@ -49,2 +49,5 @@ 'use strict';

});
this.state = {
dataLoading: false
};
}

@@ -181,6 +184,5 @@

var iconEleCls = (_iconEleCls = {}, _defineProperty(_iconEleCls, prefixCls + '-iconEle', true), _defineProperty(_iconEleCls, prefixCls + '-icon__' + expandedState, true), _iconEleCls);
var iconEleCls = (_iconEleCls = {}, _defineProperty(_iconEleCls, prefixCls + '-iconEle', true), _defineProperty(_iconEleCls, prefixCls + '-icon_loading', this.state.dataLoading), _defineProperty(_iconEleCls, prefixCls + '-icon__' + expandedState, true), _iconEleCls);
var canRenderSwitcher = true;
// let content = props.title;
var content = props.title;

@@ -191,3 +193,5 @@ var newChildren = this.renderChildren(props);

newChildren = null;
canRenderSwitcher = false;
if (!props.async) {
canRenderSwitcher = false;
}
}

@@ -244,3 +248,20 @@

value: function handleExpand() {
this.props.root.handleExpand(this);
var _this3 = this;
var callbackPromise = this.props.root.handleExpand(this);
if (callbackPromise && typeof callbackPromise === 'object') {
(function () {
var setLoading = function setLoading(dataLoading) {
_this3.setState({
dataLoading: dataLoading
});
};
setLoading(true);
callbackPromise.then(function () {
setLoading(false);
}, function () {
setLoading(false);
});
})();
}
}

@@ -247,0 +268,0 @@

2

package.json
{
"name": "rc-tree",
"version": "0.16.2",
"version": "0.17.0",
"description": "tree ui component for react",

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

@@ -83,2 +83,4 @@ # rc-tree

|onSelect | click the treeNode to fire | function(e:{selected:bool,node,checkedKeys,event}) | - |
|async | whether load data asynchronously | bool | false |
|onDataLoaded | when enabled async setting, this will work, and the return value should be a promise | function(node) | - |

@@ -85,0 +87,0 @@ ### TreeNode props

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