File tree 4 files changed +29
-13
lines changed 4 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 5
5
## Bug Fixes
6
6
7
7
* [ #22 ] : Remove expand-like behavior on nodes without children
8
+ * [ #23 ] : Fix issue where property validation was not occurring on node items
8
9
9
10
## [ v0.4.1] ( https://github.com/jakezatecky/react-checkbox-tree/compare/v0.4.0...v0.4.1 ) (2017-02-15)
10
11
Original file line number Diff line number Diff line change @@ -6,15 +6,7 @@ import nodeShape from './nodeShape';
6
6
7
7
class Tree extends React . Component {
8
8
static propTypes = {
9
- nodes : React . PropTypes . arrayOf (
10
- React . PropTypes . oneOfType ( [
11
- React . PropTypes . shape ( nodeShape ) ,
12
- React . PropTypes . shape ( {
13
- ...nodeShape ,
14
- children : React . PropTypes . arrayOf ( nodeShape ) ,
15
- } ) ,
16
- ] ) ,
17
- ) . isRequired ,
9
+ nodes : React . PropTypes . arrayOf ( nodeShape ) . isRequired ,
18
10
19
11
checked : React . PropTypes . arrayOf ( React . PropTypes . string ) ,
20
12
expanded : React . PropTypes . arrayOf ( React . PropTypes . string ) ,
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class TreeNode extends React.Component {
14
14
onExpand : React . PropTypes . func . isRequired ,
15
15
16
16
children : React . PropTypes . node ,
17
- rawChildren : React . PropTypes . arrayOf ( React . PropTypes . shape ( nodeShape ) ) ,
17
+ rawChildren : React . PropTypes . arrayOf ( nodeShape ) ,
18
18
} ;
19
19
20
20
static defaultProps = {
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
3
- export default {
3
+ const nodeShape = {
4
4
value : React . PropTypes . oneOfType ( [
5
5
React . PropTypes . string ,
6
6
React . PropTypes . number ,
7
- ] ) ,
8
- title : React . PropTypes . string ,
7
+ ] ) . isRequired ,
8
+ label : React . PropTypes . string . isRequired ,
9
9
} ;
10
+
11
+ const legacyShape = {
12
+ value : React . PropTypes . oneOfType ( [
13
+ React . PropTypes . string ,
14
+ React . PropTypes . number ,
15
+ ] ) . isRequired ,
16
+ title : React . PropTypes . string . isRequired ,
17
+ } ;
18
+
19
+ const nodeShapeWithChildren = React . PropTypes . oneOfType ( [
20
+ React . PropTypes . shape ( nodeShape ) ,
21
+ React . PropTypes . shape ( legacyShape ) ,
22
+ React . PropTypes . shape ( {
23
+ ...nodeShape ,
24
+ children : React . PropTypes . arrayOf ( nodeShape ) . isRequired ,
25
+ } ) ,
26
+ React . PropTypes . shape ( {
27
+ ...legacyShape ,
28
+ children : React . PropTypes . arrayOf ( nodeShape ) . isRequired ,
29
+ } ) ,
30
+ ] ) ;
31
+
32
+ export default nodeShapeWithChildren ;
You can’t perform that action at this time.
0 commit comments