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:
110
110
111
111
| Property | Type | Description |
112
112
| ----------- | ------ | ------------------------------- |
113
- | ` label ` | string | ** Required** . The node's label. |
113
+ | ` label ` | mixed | ** Required** . The node's label. |
114
114
| ` value ` | mixed | ** Required** . The node's value. |
115
115
| ` children ` | array | An array of child nodes. |
116
116
| ` className ` | string | A className to add to the node. |
117
+ | ` disabled ` | bool | Disable node. |
117
118
| ` icon ` | mixed | A custom icon for the node. |
Original file line number Diff line number Diff line change 1
1
import classNames from 'classnames' ;
2
- import { isEqual } from 'lodash' ;
2
+ import isEqual from 'lodash/isEqual ' ;
3
3
import PropTypes from 'prop-types' ;
4
4
import React from 'react' ;
5
5
import shortid from 'shortid' ;
@@ -190,13 +190,14 @@ class CheckboxTree extends React.Component {
190
190
const key = `${ node . value } ` ;
191
191
const checked = this . getCheckState ( node , noCascade ) ;
192
192
const children = this . renderChildNodes ( node ) ;
193
+ const nodeDisabled = ! ! ( disabled || node . disabled ) ;
193
194
194
195
return (
195
196
< TreeNode
196
197
key = { key }
197
198
checked = { checked }
198
199
className = { node . className }
199
- disabled = { disabled }
200
+ disabled = { nodeDisabled }
200
201
expandDisabled = { expandDisabled }
201
202
expanded = { node . expanded }
202
203
icon = { node . icon }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class TreeNode extends React.Component {
10
10
disabled : PropTypes . bool . isRequired ,
11
11
expandDisabled : PropTypes . bool . isRequired ,
12
12
expanded : PropTypes . bool . isRequired ,
13
- label : PropTypes . string . isRequired ,
13
+ label : PropTypes . node . isRequired ,
14
14
optimisticToggle : PropTypes . bool . isRequired ,
15
15
showNodeIcon : PropTypes . bool . isRequired ,
16
16
treeId : PropTypes . string . isRequired ,
@@ -145,6 +145,7 @@ class TreeNode extends React.Component {
145
145
'rct-node' : true ,
146
146
'rct-node-parent' : this . hasChildren ( ) ,
147
147
'rct-node-leaf' : ! this . hasChildren ( ) ,
148
+ 'rct-disabled' : disabled ,
148
149
} , className ) ;
149
150
150
151
return (
Original file line number Diff line number Diff line change 1
1
import PropTypes from 'prop-types' ;
2
2
3
3
const nodeShape = {
4
- label : PropTypes . string . isRequired ,
4
+ label : PropTypes . node . isRequired ,
5
5
value : PropTypes . oneOfType ( [
6
6
PropTypes . string ,
7
7
PropTypes . number ,
You can’t perform that action at this time.
0 commit comments