2016-07-07 20:25:03 +08:00
|
|
|
import * as React from 'react';
|
2015-11-25 15:46:44 +08:00
|
|
|
import classNames from 'classnames';
|
2016-03-21 09:22:14 +08:00
|
|
|
import RcInputNumber from 'rc-input-number';
|
2016-06-22 13:18:43 +08:00
|
|
|
import splitObject from '../_util/splitObject';
|
2015-07-01 14:48:47 +08:00
|
|
|
|
2016-03-21 09:22:14 +08:00
|
|
|
export default class InputNumber extends React.Component {
|
2016-03-29 14:01:10 +08:00
|
|
|
static defaultProps = {
|
|
|
|
prefixCls: 'ant-input-number',
|
|
|
|
step: 1,
|
2016-07-13 11:14:24 +08:00
|
|
|
};
|
2016-03-29 14:01:10 +08:00
|
|
|
|
2015-07-01 14:48:47 +08:00
|
|
|
render() {
|
2016-07-13 11:14:24 +08:00
|
|
|
const [{ className, size }, others] = splitObject(this.props,
|
|
|
|
['size', 'className']);
|
2015-11-25 15:46:44 +08:00
|
|
|
const inputNumberClass = classNames({
|
2016-03-30 10:58:37 +08:00
|
|
|
[`${this.props.prefixCls}-lg`]: size === 'large',
|
|
|
|
[`${this.props.prefixCls}-sm`]: size === 'small',
|
2015-11-25 15:46:44 +08:00
|
|
|
[className]: !!className,
|
|
|
|
});
|
|
|
|
|
2016-06-22 13:18:43 +08:00
|
|
|
return <RcInputNumber className={inputNumberClass} {...others} />;
|
2015-07-01 14:48:47 +08:00
|
|
|
}
|
2016-03-21 09:22:14 +08:00
|
|
|
}
|