@@ -33,6 +33,7 @@ var Select = React.createClass({
3333 filterOptions : React . PropTypes . func , // method to filter the options array: function([options], filterString, [values])
3434 matchPos : React . PropTypes . string , // (any|start) match the start or entire string when filtering
3535 matchProp : React . PropTypes . string , // (any|label|value) which option property to filter on
36+ ignoreCase : React . PropTypes . bool , // whether to perform case-insensitive filtering
3637 inputProps : React . PropTypes . object , // custom attributes for the Input (in the Select-control) e.g: {'data-foo': 'bar'}
3738 allowCreate : React . PropTypes . bool , // wether to allow creation of new entries
3839 /*
@@ -65,6 +66,7 @@ var Select = React.createClass({
6566 className : undefined ,
6667 matchPos : 'any' ,
6768 matchProp : 'any' ,
69+ ignoreCase : true ,
6870 inputProps : { } ,
6971 allowCreate : false ,
7072
@@ -525,12 +527,17 @@ var Select = React.createClass({
525527 if ( this . props . multi && exclude . indexOf ( op . value ) > - 1 ) return false ;
526528 if ( this . props . filterOption ) return this . props . filterOption . call ( this , op , filterValue ) ;
527529 var valueTest = String ( op . value ) , labelTest = String ( op . label ) ;
530+ if ( this . props . ignoreCase ) {
531+ valueTest = valueTest . toLowerCase ( ) ;
532+ labelTest = labelTest . toLowerCase ( ) ;
533+ filterValue = filterValue . toLowerCase ( ) ;
534+ }
528535 return ! filterValue || ( this . props . matchPos === 'start' ) ? (
529- ( this . props . matchProp !== 'label' && valueTest . toLowerCase ( ) . substr ( 0 , filterValue . length ) === filterValue ) ||
530- ( this . props . matchProp !== 'value' && labelTest . toLowerCase ( ) . substr ( 0 , filterValue . length ) === filterValue )
536+ ( this . props . matchProp !== 'label' && valueTest . substr ( 0 , filterValue . length ) === filterValue ) ||
537+ ( this . props . matchProp !== 'value' && labelTest . substr ( 0 , filterValue . length ) === filterValue )
531538 ) : (
532- ( this . props . matchProp !== 'label' && valueTest . toLowerCase ( ) . indexOf ( filterValue . toLowerCase ( ) ) >= 0 ) ||
533- ( this . props . matchProp !== 'value' && labelTest . toLowerCase ( ) . indexOf ( filterValue . toLowerCase ( ) ) >= 0 )
539+ ( this . props . matchProp !== 'label' && valueTest . indexOf ( filterValue ) >= 0 ) ||
540+ ( this . props . matchProp !== 'value' && labelTest . indexOf ( filterValue ) >= 0 )
534541 ) ;
535542 } ;
536543 return ( options || [ ] ) . filter ( filterOption , this ) ;
0 commit comments