30 lines
743 B
TypeScript
30 lines
743 B
TypeScript
import type { InputNumberProps as AntInputNumberProps } from 'antd';
|
|
import { Form, InputNumber as AntInputNumber } from 'antd';
|
|
import type { FC } from 'react';
|
|
import type { BaseElementProps } from './types';
|
|
|
|
const { Item: FormItem } = Form;
|
|
|
|
type InputNumberProps = AntInputNumberProps<number>;
|
|
|
|
export default (function InputNumber({
|
|
setValue,
|
|
status,
|
|
isValid,
|
|
help,
|
|
...props
|
|
}: BaseElementProps<number>) {
|
|
return (
|
|
<FormItem hasFeedback validateStatus={isValid === false ? 'error' : ''} help={help}>
|
|
<AntInputNumber
|
|
onChange={setValue}
|
|
disabled={status === 'Disabled'}
|
|
style={{
|
|
width: '100%',
|
|
}}
|
|
{...props}
|
|
/>
|
|
</FormItem>
|
|
);
|
|
} as FC<InputNumberProps>);
|