@@ -20,7 +20,9 @@ const CurrencyInput = React.createClass({
2020 thousandSeparator : PropTypes . string ,
2121 precision : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
2222 inputType : PropTypes . string ,
23- allowNegative : PropTypes . bool
23+ allowNegative : PropTypes . bool ,
24+ prefix : PropTypes . string ,
25+ suffix : PropTypes . string
2426 } ,
2527
2628
@@ -40,7 +42,9 @@ const CurrencyInput = React.createClass({
4042 thousandSeparator : "," ,
4143 precision : "2" ,
4244 inputType : "text" ,
43- allowNegative : false
45+ allowNegative : false ,
46+ prefix : '' ,
47+ suffix : ''
4448 }
4549 } ,
4650
@@ -61,8 +65,18 @@ const CurrencyInput = React.createClass({
6165 delete customProps . precision ;
6266 delete customProps . inputType ;
6367 delete customProps . allowNegative ;
68+ delete customProps . prefix ;
69+ delete customProps . suffix ;
6470 return {
65- maskedValue : mask ( this . props . value , this . props . precision , this . props . decimalSeparator , this . props . thousandSeparator , this . props . allowNegative ) ,
71+ maskedValue : mask (
72+ this . props . value ,
73+ this . props . precision ,
74+ this . props . decimalSeparator ,
75+ this . props . thousandSeparator ,
76+ this . props . allowNegative ,
77+ this . props . prefix ,
78+ this . props . suffix
79+ ) ,
6680 customProps : customProps
6781 }
6882 } ,
@@ -85,7 +99,15 @@ const CurrencyInput = React.createClass({
8599 delete customProps . inputType ;
86100 delete customProps . allowNegative ;
87101 this . setState ( {
88- maskedValue : mask ( nextProps . value , nextProps . precision , nextProps . decimalSeparator , nextProps . thousandSeparator , nextProps . allowNegative ) ,
102+ maskedValue : mask (
103+ nextProps . value ,
104+ nextProps . precision ,
105+ nextProps . decimalSeparator ,
106+ nextProps . thousandSeparator ,
107+ nextProps . allowNegative ,
108+ nextProps . prefix ,
109+ nextProps . suffix
110+ ) ,
89111 customProps : customProps
90112 } ) ;
91113 } ,
@@ -107,7 +129,15 @@ const CurrencyInput = React.createClass({
107129 */
108130 handleChange ( event ) {
109131 event . preventDefault ( ) ;
110- let maskedValue = mask ( event . target . value , this . props . precision , this . props . decimalSeparator , this . props . thousandSeparator , this . props . allowNegative ) ;
132+ let maskedValue = mask (
133+ event . target . value ,
134+ this . props . precision ,
135+ this . props . decimalSeparator ,
136+ this . props . thousandSeparator ,
137+ this . props . allowNegative ,
138+ this . props . prefix ,
139+ this . props . suffix
140+ ) ;
111141 this . setState ( { maskedValue : maskedValue } ) ;
112142 this . props . onChange ( maskedValue ) ;
113143 } ,
0 commit comments