@@ -3,21 +3,21 @@ import XEditable from './XEditable';
33
44export default class EditableSelect extends React . Component {
55 static defaultProps = {
6- name : null ,
6+ name : null
77 }
88 static propTypes = {
99 name : React . PropTypes . string . isRequired ,
1010 onUpdate : React . PropTypes . func . isRequired ,
1111 options : React . PropTypes . array . isRequired ,
12- defaultOptionText : React . PropTypes . string ,
12+ defaultOptionText : React . PropTypes . string
1313 }
1414 constructor ( props ) {
1515 super ( props ) ;
1616 this . setState = this . setState . bind ( this ) ;
1717
1818 const options = this . convertOptions ( this . props . options ) ;
1919 if ( this . props . defaultOptionText ) {
20- options . unshift ( { text : this . props . defaultOptionText , value : null } ) ;
20+ options . unshift ( { text : this . props . defaultOptionText , value : null } ) ;
2121 }
2222 const selected = options . find ( ( opt ) => {
2323 if ( opt . value === this . props . value ) {
@@ -36,7 +36,7 @@ export default class EditableSelect extends React.Component {
3636 isEditing : false ,
3737 options : options ,
3838 text : text ,
39- value : this . props . value ,
39+ value : this . props . value
4040 } ;
4141
4242 }
@@ -47,7 +47,7 @@ export default class EditableSelect extends React.Component {
4747 this . setState ( {
4848 isEditing : false ,
4949 text : this . refs . el . options [ this . refs . el . selectedIndex ] . text ,
50- value : this . refs . el . value ,
50+ value : this . refs . el . value
5151 } ) ;
5252 }
5353 cancel = ( ) => {
@@ -57,12 +57,10 @@ export default class EditableSelect extends React.Component {
5757 this . setState ( { isEditing : true } ) ;
5858 }
5959
60- convertOptions = ( options ) => {
60+ convertOptions = ( options ) => {
6161 return options . map ( ( opt ) => {
62- if ( typeof opt === 'string'
63- || typeof opt === 'number'
64- || typeof opt === 'boolean' ) {
65- return { text : opt , value : opt } ;
62+ if ( typeof opt === 'string' || typeof opt === 'number' || typeof opt === 'boolean' ) {
63+ return { text : opt , value : opt } ;
6664 }
6765 return { text : opt . text , value : opt . value } ;
6866 } ) ;
@@ -74,13 +72,13 @@ export default class EditableSelect extends React.Component {
7472 } ) ;
7573 return (
7674 < XEditable isLoading = { false } save = { this . save } cancel = { this . cancel } >
77- < select ref = 'el' className = 'form-control input-sm' name = { this . props . name } defaultValue = { this . state . value } >
75+ < select ref = 'el' className = 'form-control input-sm' name = { this . props . name } defaultValue = { this . state . value } >
7876 { options }
7977 </ select >
8078 </ XEditable >
8179 ) ;
8280 } else {
83- return < a href = 'javascript:;' className = 'editable editable-click' onClick = { this . handleLinkClick } > { this . state . text } </ a > ;
81+ return < a href = 'javascript:;' className = 'editable editable-click' onClick = { this . handleLinkClick } > { this . state . text } </ a > ;
8482 }
8583 }
8684}
0 commit comments