feat: update input-number
parent
0566ae23e1
commit
b14988d769
|
@ -3,6 +3,7 @@ import { initDefaultProps, getOptionProps } from '../_util/props-util';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
import VcInputNumber from '../vc-input-number/src';
|
import VcInputNumber from '../vc-input-number/src';
|
||||||
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
|
|
||||||
export const InputNumberProps = {
|
export const InputNumberProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
|
@ -31,9 +32,11 @@ const InputNumber = {
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
props: initDefaultProps(InputNumberProps, {
|
props: initDefaultProps(InputNumberProps, {
|
||||||
prefixCls: 'ant-input-number',
|
|
||||||
step: 1,
|
step: 1,
|
||||||
}),
|
}),
|
||||||
|
inject: {
|
||||||
|
configProvider: { default: () => ({}) },
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
focus() {
|
focus() {
|
||||||
this.$refs.inputNumberRef.focus();
|
this.$refs.inputNumberRef.focus();
|
||||||
|
@ -44,16 +47,20 @@ const InputNumber = {
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { size, ...others } = getOptionProps(this);
|
const { prefixCls: customizePrefixCls, size, ...others } = getOptionProps(this);
|
||||||
|
const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls;
|
||||||
|
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
|
||||||
|
|
||||||
const inputNumberClass = classNames({
|
const inputNumberClass = classNames({
|
||||||
[`${this.prefixCls}-lg`]: size === 'large',
|
[`${prefixCls}-lg`]: size === 'large',
|
||||||
[`${this.prefixCls}-sm`]: size === 'small',
|
[`${prefixCls}-sm`]: size === 'small',
|
||||||
});
|
});
|
||||||
const upIcon = <Icon type="up" class={`${this.prefixCls}-handler-up-inner`} />;
|
const upIcon = <Icon type="up" class={`${prefixCls}-handler-up-inner`} />;
|
||||||
const downIcon = <Icon type="down" class={`${this.prefixCls}-handler-down-inner`} />;
|
const downIcon = <Icon type="down" class={`${prefixCls}-handler-down-inner`} />;
|
||||||
|
|
||||||
const vcInputNumberprops = {
|
const vcInputNumberprops = {
|
||||||
props: {
|
props: {
|
||||||
|
prefixCls,
|
||||||
upHandler: upIcon,
|
upHandler: upIcon,
|
||||||
downHandler: downIcon,
|
downHandler: downIcon,
|
||||||
...others,
|
...others,
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default {
|
||||||
},
|
},
|
||||||
mixins: [BaseMixin],
|
mixins: [BaseMixin],
|
||||||
methods: {
|
methods: {
|
||||||
onChange(e) {
|
onChange() {
|
||||||
this.setState({
|
this.setState({
|
||||||
visible: !this.visible,
|
visible: !this.visible,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue