File tree Expand file tree Collapse file tree 4 files changed +29
-13
lines changed Expand file tree Collapse file tree 4 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 55## Bug Fixes
66
77* [ #22 ] : Remove expand-like behavior on nodes without children
8+ * [ #23 ] : Fix issue where property validation was not occurring on node items
89
910## [ v0.4.1] ( https://github.com/jakezatecky/react-checkbox-tree/compare/v0.4.0...v0.4.1 ) (2017-02-15)
1011
Original file line number Diff line number Diff line change @@ -6,15 +6,7 @@ import nodeShape from './nodeShape';
66
77class Tree extends React . Component {
88 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 ,
1810
1911 checked : React . PropTypes . arrayOf ( React . PropTypes . string ) ,
2012 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 {
1414 onExpand : React . PropTypes . func . isRequired ,
1515
1616 children : React . PropTypes . node ,
17- rawChildren : React . PropTypes . arrayOf ( React . PropTypes . shape ( nodeShape ) ) ,
17+ rawChildren : React . PropTypes . arrayOf ( nodeShape ) ,
1818 } ;
1919
2020 static defaultProps = {
Original file line number Diff line number Diff line change 11import React from 'react' ;
22
3- export default {
3+ const nodeShape = {
44 value : React . PropTypes . oneOfType ( [
55 React . PropTypes . string ,
66 React . PropTypes . number ,
7- ] ) ,
8- title : React . PropTypes . string ,
7+ ] ) . isRequired ,
8+ label : React . PropTypes . string . isRequired ,
99} ;
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