ant-design/components/input-number/index.tsx

24 lines
683 B
TypeScript
Raw Normal View History

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