@@ -8,10 +8,10 @@ class Table extends React.Component {
88 className : React . PropTypes . string ,
99 heading : React . PropTypes . bool ,
1010 model : React . PropTypes . object ,
11+ multiSelectable : React . PropTypes . bool ,
1112 onChange : React . PropTypes . func ,
1213 onSelect : React . PropTypes . func ,
1314 selectable : React . PropTypes . bool ,
14- multiSelectable : React . PropTypes . bool ,
1515 selected : React . PropTypes . array ,
1616 source : React . PropTypes . array
1717 } ;
@@ -37,11 +37,8 @@ class Table extends React.Component {
3737 if ( this . props . onSelect ) {
3838 const position = this . props . selected . indexOf ( index ) ;
3939 let newSelected = [ ...this . props . selected ] ;
40-
41- if ( position !== - 1 ) {
42- newSelected . splice ( position , 1 ) ;
43- }
44- else if ( this . props . multiSelectable ) {
40+ if ( position !== - 1 ) { newSelected . splice ( position , 1 ) ; }
41+ if ( position !== - 1 && this . props . multiSelectable ) {
4542 newSelected . push ( index ) ;
4643 } else {
4744 newSelected = [ index ] ;
@@ -56,7 +53,7 @@ class Table extends React.Component {
5653 }
5754 } ;
5855
59- renderHead ( ) {
56+ renderHead ( ) {
6057 if ( this . props . heading ) {
6158 const { model, selected, source, selectable, multiSelectable} = this . props ;
6259 const isSelected = selected . length === source . length ;
@@ -72,7 +69,7 @@ class Table extends React.Component {
7269 }
7370 }
7471
75- renderBody ( ) {
72+ renderBody ( ) {
7673 const rows = this . props . source . map ( ( data , index ) => {
7774 return (
7875 < TableRow
@@ -91,7 +88,7 @@ class Table extends React.Component {
9188 return < tbody > { rows } </ tbody > ;
9289 }
9390
94- render ( ) {
91+ render ( ) {
9592 let className = style . root ;
9693 if ( this . props . className ) className += ` ${ this . props . className } ` ;
9794 return (
0 commit comments