File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,9 @@ Individual nodes within the `nodes` property can have the following structure:
110110
111111| Property | Type | Description |
112112| ----------- | ------ | ------------------------------- |
113- | ` label ` | string | ** Required** . The node's label. |
113+ | ` label ` | mixed | ** Required** . The node's label. |
114114| ` value ` | mixed | ** Required** . The node's value. |
115115| ` children ` | array | An array of child nodes. |
116116| ` className ` | string | A className to add to the node. |
117117| ` icon ` | mixed | A custom icon for the node. |
118+ | ` disabled ` | bool | Disable node. |
Original file line number Diff line number Diff line change 11import classNames from 'classnames' ;
2- import { isEqual } from 'lodash' ;
2+ import isEqual from 'lodash/isEqual ' ;
33import PropTypes from 'prop-types' ;
44import React from 'react' ;
55import shortid from 'shortid' ;
@@ -190,13 +190,14 @@ class CheckboxTree extends React.Component {
190190 const key = `${ node . value } ` ;
191191 const checked = this . getCheckState ( node , noCascade ) ;
192192 const children = this . renderChildNodes ( node ) ;
193+ const nodeDisabled = ! ! ( disabled || node . disabled ) ;
193194
194195 return (
195196 < TreeNode
196197 key = { key }
197198 checked = { checked }
198199 className = { node . className }
199- disabled = { disabled }
200+ disabled = { nodeDisabled }
200201 expandDisabled = { expandDisabled }
201202 expanded = { node . expanded }
202203 icon = { node . icon }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class TreeNode extends React.Component {
1010 disabled : PropTypes . bool . isRequired ,
1111 expandDisabled : PropTypes . bool . isRequired ,
1212 expanded : PropTypes . bool . isRequired ,
13- label : PropTypes . string . isRequired ,
13+ label : PropTypes . node . isRequired ,
1414 optimisticToggle : PropTypes . bool . isRequired ,
1515 showNodeIcon : PropTypes . bool . isRequired ,
1616 treeId : PropTypes . string . isRequired ,
@@ -145,6 +145,7 @@ class TreeNode extends React.Component {
145145 'rct-node' : true ,
146146 'rct-node-parent' : this . hasChildren ( ) ,
147147 'rct-node-leaf' : ! this . hasChildren ( ) ,
148+ 'rct-disabled' : disabled ,
148149 } , className ) ;
149150
150151 return (
Original file line number Diff line number Diff line change 11import PropTypes from 'prop-types' ;
22
33const nodeShape = {
4- label : PropTypes . string . isRequired ,
4+ label : PropTypes . node . isRequired ,
55 value : PropTypes . oneOfType ( [
66 PropTypes . string ,
77 PropTypes . number ,
You can’t perform that action at this time.
0 commit comments