import React from 'react';
import { InputNumber } from 'antd';
import styles from './styles.less';
import { ApolloNumberProps } from '../editInterface';
import { antiAssign } from '../../../../utils/utils';

export const ApolloNumber = (props: ApolloNumberProps) => {
    const { onChange, origin }: any = props;
    const selfProps = antiAssign(props, ['columnConfig', 'onChange']);
    const changeValue = (newValue: any) => {
        if (typeof onChange === 'function') {
            onChange(newValue);
        }
    };
    const { onEmitChange, ...o } = selfProps;
    const style: any = {};
    if (origin === 'editForm') {
        style.height = '32px';
    }
    return <InputNumber className={styles.number} style={style} {...o} onChange={changeValue} />;
};
