react-numeric
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "react-numeric", | ||
"description": "A React component for choosing dates and date ranges.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": { | ||
@@ -40,2 +40,5 @@ "type": "git", | ||
"css-loader": "^0.28.10", | ||
"eslint": "^4.19.1", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-prettier": "^2.6.0", | ||
"eslint-plugin-react": "^7.7.0", | ||
@@ -59,7 +62,7 @@ "prettier": "^1.11.1", | ||
"clear": "rm -rf dist docs/dist", | ||
"prebuild": "yarn clear", | ||
"prebuild": "yarn clear && yarn lint", | ||
"dev": "webpack-dev-server --hot --mode 'development'", | ||
"lint": "eslint 'src/**/*.js'", | ||
"prettier": "prettier src/*.js docs/src/*.js --write" | ||
"prettier": "prettier src/**/*.js docs/src/**/*.js --write" | ||
} | ||
} |
@@ -16,3 +16,3 @@ import React from "react"; | ||
onChange: undefined, | ||
watchExternalChanges: false | ||
watchExternalChanges: false, | ||
}); | ||
@@ -22,6 +22,3 @@ } | ||
componentWillReceiveProps(newProps) { | ||
if ( | ||
this.props.value !== newProps.value && | ||
this.getValue() !== newProps.value | ||
) | ||
if (this.props.value !== newProps.value && this.getValue() !== newProps.value) | ||
this.autonumeric.set(newProps.value); | ||
@@ -33,12 +30,11 @@ } | ||
string: numeric => numeric.getNumericString(), | ||
number: numeric => numeric.getNumber() | ||
number: numeric => numeric.getNumber(), | ||
}; | ||
return valueMapper[this.props.outputFormat](this.autonumeric); | ||
} | ||
callEventHandler(event, eventName){ | ||
if(!this.props[eventName]) return; | ||
callEventHandler(event, eventName) { | ||
if (!this.props[eventName]) return; | ||
this.props[eventName](event, this.getValue()); | ||
} | ||
render() { | ||
const {onChange, onBlur, onKeyPress, onKeyUp, onKeyDown} = this.props; | ||
return ( | ||
@@ -48,7 +44,8 @@ <input | ||
type={this.props.type} | ||
onChange={e => this.callEventHandler(e, 'onChange')} | ||
onBlur={e => this.callEventHandler(e, 'onBlur')} | ||
onKeyPress={e => this.callEventHandler(e, 'onKeyPress')} | ||
onKeyUp={e => this.callEventHandler(e, 'onKeyUp')} | ||
onKeyDown={e => this.callEventHandler(e, 'onKeyDown')} | ||
onChange={e => this.callEventHandler(e, "onChange")} | ||
onFocus={e => this.callEventHandler(e, "onFocus")} | ||
onBlur={e => this.callEventHandler(e, "onBlur")} | ||
onKeyPress={e => this.callEventHandler(e, "onKeyPress")} | ||
onKeyUp={e => this.callEventHandler(e, "onKeyUp")} | ||
onKeyDown={e => this.callEventHandler(e, "onKeyDown")} | ||
className={this.props.className} | ||
@@ -65,2 +62,9 @@ style={this.props.style} | ||
style: PropTypes.object, | ||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
onChange: PropTypes.func, | ||
onFocus: PropTypes.func, | ||
onBlur: PropTypes.func, | ||
onKeyPress: PropTypes.func, | ||
onKeyUp: PropTypes.func, | ||
onKeyDown: PropTypes.func, | ||
allowDecimalPadding: PropTypes.bool, | ||
@@ -81,9 +85,3 @@ caretPositionOnFocus: PropTypes.number, | ||
divisorWhenUnfocused: PropTypes.number, | ||
emptyInputBehavior: PropTypes.oneOf([ | ||
"null", | ||
"focus", | ||
"press", | ||
"always", | ||
"zero" | ||
]), | ||
emptyInputBehavior: PropTypes.oneOf(["null", "focus", "press", "always", "zero"]), | ||
eventBubbles: PropTypes.bool, | ||
@@ -103,9 +101,3 @@ eventIsCancelable: PropTypes.bool, | ||
noEventListeners: PropTypes.bool, | ||
onInvalidPaste: PropTypes.oneOf([ | ||
"error", | ||
"ignore", | ||
"clamp", | ||
"truncate", | ||
"replace" | ||
]), | ||
onInvalidPaste: PropTypes.oneOf(["error", "ignore", "clamp", "truncate", "replace"]), | ||
outputFormat: PropTypes.oneOf(["string", "number"]), | ||
@@ -132,3 +124,3 @@ overrideMinMaxLimits: PropTypes.oneOf(["ceiling", "floor", "ignore"]), | ||
wheelStep: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), | ||
preDefined: PropTypes.object | ||
preDefined: PropTypes.object, | ||
}; | ||
@@ -139,5 +131,5 @@ | ||
outputFormat: "number", | ||
preDefined: {} | ||
preDefined: {}, | ||
}; | ||
export const predefinedOptions = AutoNumeric.getPredefinedOptions(); |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
280564
20
128
1