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

rc-tree-select

Package Overview
Dependencies
Maintainers
2
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-tree-select - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

32

lib/Select.js

@@ -39,2 +39,6 @@ 'use strict';

var _TreeNode2 = require('./TreeNode');
var _TreeNode3 = _interopRequireDefault(_TreeNode2);
function noop() {}

@@ -82,2 +86,3 @@

treeNodeFilterProp: _react.PropTypes.string,
treeData: _react.PropTypes.array,
loadData: _react.PropTypes.func

@@ -367,3 +372,3 @@ },

} else {
label = this.getLabelByValue(props.children, value);
label = this.getLabelByValue(this.renderTreeData() || props.children, value);
}

@@ -586,3 +591,27 @@ return label;

},
renderTreeData: function renderTreeData() {
var loop = function loop(data) {
var level = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
return data.map(function (item, index) {
var pos = level + '-' + index;
var props = {
title: item.label,
value: item.value,
key: item.key || item.value || pos
};
if (item.children) {
return _react2['default'].createElement(
_TreeNode3['default'],
props,
loop(item.children, pos)
);
}
return _react2['default'].createElement(_TreeNode3['default'], _extends({}, props, { isLeaf: item.isLeaf }));
});
};
if (this.props.treeData) {
return loop(this.props.treeData);
}
},
render: function render() {

@@ -616,2 +645,3 @@ var _rootCls;

treeNodes: props.children,
treeData: this.renderTreeData(props.treeData),
multiple: multiple,

@@ -618,0 +648,0 @@ disabled: disabled,

12

lib/SelectTrigger.js

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

renderTree: function renderTree(treeProps) {
renderTree: function renderTree(treeNodes, newTreeNodes, multiple) {
var props = this.props;

@@ -223,3 +223,3 @@

var trProps = {
multiple: treeProps.multiple,
multiple: multiple,
prefixCls: props.prefixCls + '-tree',

@@ -234,3 +234,3 @@ showIcon: props.treeIcon,

var keys = [];
(0, _util.loopAllChildren)(props.treeNodes, function (child) {
(0, _util.loopAllChildren)(treeNodes, function (child) {
if (vals.indexOf((0, _util.getValuePropValue)(child)) > -1) {

@@ -258,3 +258,3 @@ keys.push(child.key);

_extends({ ref: this.savePopupElement }, trProps),
loop(treeProps.treeNodes)
loop(newTreeNodes)
);

@@ -275,3 +275,3 @@ },

);
var treeNodes = this.renderFilterOptionsFromChildren(props.treeNodes);
var treeNodes = this.renderFilterOptionsFromChildren(props.treeData || props.treeNodes);
var notFoundContent = undefined;

@@ -294,3 +294,3 @@ if (!treeNodes.length) {

search,
notFoundContent ? notFoundContent : this.renderTree({ treeNodes: treeNodes, multiple: multiple })
notFoundContent ? notFoundContent : this.renderTree(props.treeData || props.treeNodes, treeNodes, multiple)
);

@@ -297,0 +297,0 @@

{
"name": "rc-tree-select",
"version": "1.0.1",
"version": "1.1.0",
"description": "tree-select ui component for react",

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

@@ -108,5 +108,7 @@ # rc-tree-select

|treeNodeLabelProp | which prop value of treeNode will render as content of select | String | 'value' |
|treeData | treeNodes Array, if set and you need not to construct children TreeNode. (if value is not unique of the whole array, you must provide `key` as unique id) | array<{value, label, children}> | [] |
|loadData | load data asynchronously | function(node) | - |
### TreeNode props
> note: if set `treeData`, you can omit TreeNode setting below.

@@ -116,3 +118,3 @@ | name | description | type | default |

|disabled | disable treeNode | bool | false |
|key | the unique key of treeNode, you must setting | String | - |
|key | the unique key of treeNode, you must set it | String | - |
|value | default as treeNodeFilterProp | String | '' |

@@ -119,0 +121,0 @@ |title | tree/subTree's title | String | '---' |

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