react-numeral-input
Advanced tools
Comparing version 0.0.7 to 0.0.8
// Generated by CoffeeScript 1.9.3 | ||
/** @jsx React.DOM */; | ||
var NumeralInput, React, numeral; | ||
var NumeralInput, React, numeral, re; | ||
@@ -9,2 +9,4 @@ React = require('react'); | ||
re = /[^0-9km,]+/; | ||
NumeralInput = React.createClass({ | ||
@@ -32,15 +34,24 @@ displayName: 'NumeralInput', | ||
componentWillReceiveProps: function(nextProps) { | ||
var val; | ||
val = nextProps.value; | ||
if (!re.test(val)) { | ||
val = this.getNumeralValue(val); | ||
} | ||
return this.setState({ | ||
value: this.getNumeralValue(nextProps.value) | ||
value: val | ||
}); | ||
}, | ||
changeHandler: function() { | ||
var inputValue; | ||
inputValue = numeral(this.getDOMNode().value).value(); | ||
var reTest, val; | ||
val = this.getDOMNode().value; | ||
reTest = re.test(val); | ||
if (!reTest) { | ||
val = numeral(val).value(); | ||
} | ||
return this.setState({ | ||
value: inputValue | ||
value: val | ||
}, (function(_this) { | ||
return function() { | ||
if (_this.props.onChange) { | ||
return _this.props.onChange(inputValue); | ||
return _this.props.onChange(val); | ||
} | ||
@@ -47,0 +58,0 @@ }; |
{ | ||
"name": "react-numeral-input", | ||
"description": "numeral input", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"author": "Bingo Yang <blackbing@gmail.com>", | ||
@@ -6,0 +6,0 @@ "browserify": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
670050
18659