Socket
Socket
Sign inDemoInstall

rc-input-number

Package Overview
Dependencies
Maintainers
2
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-input-number - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

lib/index.js

79

lib/InputNumber.js

@@ -1,6 +0,9 @@

/** @jsx React.DOM */
'use strict';
var React = require('react');
var rcUtil = require('rc-util');
var InputNumber = React.createClass({
getInitialState: function () {
displayName: 'InputNumber',
getInitialState: function getInitialState() {
return {

@@ -10,12 +13,9 @@ value: 0

},
componentDidMount: function () {
componentDidMount: function componentDidMount() {
if (this.props.value) {
this.setState({value: this.props.value || 0});
this.setState({ value: this.props.value || 0 });
}
},
componentWillUnmount: function () {
},
step: function (type, e) {
componentWillUnmount: function componentWillUnmount() {},
step: function step(type, e) {
e.preventDefault();

@@ -25,3 +25,4 @@ if (this.props.disabled) {

}
var stepNum = this.props.step || 1, val;
var stepNum = this.props.step || 1,
val;
if (type === 'down') {

@@ -37,19 +38,19 @@ val = Number(this.state.value) - Number(stepNum);

this.props.value = val;
this.setState({value: val});
this.setState({ value: val });
},
onChange: function (event) {
onChange: function onChange(event) {
var val = event.target.value;
if (!isNaN(parseFloat(val)) && isFinite(val)) {
this.setState({value: event.target.value});
this.setState({ value: event.target.value });
}
},
handleKeyDown: function (e) {
handleKeyDown: function handleKeyDown(e) {
if (e.keyCode === 38) {
this.step('up',e);
this.step('up', e);
}
if (e.keyCode === 40) {
this.step('down',e);
this.step('down', e);
}
},
render: function () {
render: function render() {
var classes = rcUtil.classSet({

@@ -59,26 +60,26 @@ 'rc-input-num': true,

});
return (
<div className={classes}>
<a href="#"
ref="down"
onClick={this.step.bind(this, 'down')}
className="rc-input-num-handler rc-input-num-handler-down"></a>
<input className="rc-input-num-input" type="text" autocomplete="off" ref="input" onKeyDown={this.handleKeyDown}
autofocus={this.props.autofocus}
required={this.props.required}
readonly={this.props.readonly}
disabled={this.props.disabled}
max={this.props.max}
min={this.props.min}
name={this.props.name}
onChange={this.onChange}
value={this.state.value} />
<a href="#"
ref="up"
onClick={this.step.bind(this, 'up')}
className="rc-input-num-handler rc-input-num-handler-up"></a>
</div>
return React.createElement(
'div',
{ className: classes },
React.createElement('a', { href: '#',
ref: 'down',
onClick: this.step.bind(this, 'down'),
className: 'rc-input-num-handler rc-input-num-handler-down' }),
React.createElement('input', { className: 'rc-input-num-input', type: 'text', autocomplete: 'off', ref: 'input', onKeyDown: this.handleKeyDown,
autofocus: this.props.autofocus,
required: this.props.required,
readonly: this.props.readonly,
disabled: this.props.disabled,
max: this.props.max,
min: this.props.min,
name: this.props.name,
onChange: this.onChange,
value: this.state.value }),
React.createElement('a', { href: '#',
ref: 'up',
onClick: this.step.bind(this, 'up'),
className: 'rc-input-num-handler rc-input-num-handler-up' })
);
}
});
module.exports = InputNumber;
module.exports = InputNumber;
{
"name": "rc-input-number",
"version": "1.0.0",
"version": "1.0.1",
"description": "input-number ui component for react",

@@ -11,2 +11,3 @@ "keywords": [

],
"main": "lib/index",
"homepage": "https://github.com/react-component/input-number",

@@ -22,7 +23,2 @@ "author": "tsjxyz@gmail.com",

"licenses": "MIT",
"spm": {
"dependencies": {
"react": "*"
}
},
"config": {

@@ -33,18 +29,19 @@ "port": 8000

"build": "rc-tools run build",
"precommit": "rc-tools run precommit",
"less": "rc-tools run less",
"gh-pages": "rc-tools run gh-pages",
"history": "rc-tools run history",
"start": "node-dev --harmony node_modules/.bin/rc-server",
"publish": "spm publish && rc-tools run tag",
"start": "node --harmony node_modules/.bin/rc-server",
"publish": "rc-tools run tag",
"lint": "rc-tools run lint",
"test": "",
"saucelabs": "rc-tools run saucelabs",
"browser-test": "rc-tools run browser-test",
"browser-test-cover": "rc-tools run browser-test-cover"
"saucelabs": "node --harmony node_modules/.bin/rc-tools run saucelabs",
"browser-test": "node --harmony node_modules/.bin/rc-tools run browser-test",
"browser-test-cover": "node --harmony node_modules/.bin/rc-tools run browser-test-cover"
},
"devDependencies": {
"expect.js": "~0.3.1",
"precommit-hook": "^1.0.7",
"rc-server": "~2.1.2",
"rc-tools": "2.x",
"rc-server": "3.x",
"rc-tools": "3.x",
"react": "~0.13.0",

@@ -57,5 +54,4 @@ "node-dev": "2.x"

"precommit": [
"lint",
"less"
"precommit"
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc