/** @format */

import * as React from 'react';
import {Input, InputNumber} from 'antd';
const InputGroup = Input.Group;
interface Iprops {
    value?: {min: number|undefined; max: number|undefined};
    onChange?:(value:{min: number|undefined; max: number|undefined})=>void
}
export default React.forwardRef((props: Iprops, ref) => {
    const {value,onChange} = props;

    return (
        <InputGroup compact>
            <InputNumber 
              onChange={(e)=>{
              onChange&& onChange({...value,min:e})
            }} 
            value={value?.min} 
            min={0} style={{width: 100, textAlign: 'center'}} placeholder="最小耗时" 
            />
            <Input
                style={{
                    width: 30,
                    borderLeft: 0,
                    pointerEvents: 'none',
                    backgroundColor: '#fff',
                }}
                placeholder="~"
                disabled
            />
            <InputNumber onChange={(e)=>{
              onChange&& onChange({...value,max:e})
            }} value={value?.max} min={0} style={{width: 100, textAlign: 'center', borderLeft: 0}} placeholder="最大耗时"
             />
        </InputGroup>
    );
});
