mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00

* perf: handle edge check * search model * feat: plugin input can render all input; fix: plugin default value * fix ts * feat: plugin input support required
37 lines
750 B
TypeScript
37 lines
750 B
TypeScript
import {
|
|
NumberInput,
|
|
NumberIncrementStepper,
|
|
NumberInputField,
|
|
NumberInputStepper,
|
|
NumberDecrementStepper,
|
|
NumberInputProps
|
|
} from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
type Props = Omit<NumberInputProps, 'onChange'> & {
|
|
onChange: (e: number | '') => any;
|
|
};
|
|
|
|
const MyNumberInput = (props: Props) => {
|
|
return (
|
|
<NumberInput
|
|
{...props}
|
|
onChange={(e) => {
|
|
if (isNaN(Number(e))) {
|
|
props?.onChange('');
|
|
} else {
|
|
props?.onChange(Number(e));
|
|
}
|
|
}}
|
|
>
|
|
<NumberInputField />
|
|
<NumberInputStepper>
|
|
<NumberIncrementStepper />
|
|
<NumberDecrementStepper />
|
|
</NumberInputStepper>
|
|
</NumberInput>
|
|
);
|
|
};
|
|
|
|
export default MyNumberInput;
|