diff --git a/src/client/types/number.type-renderer.jsx b/src/client/types/number.type-renderer.jsx index a3d60d5..9ce9921 100644 --- a/src/client/types/number.type-renderer.jsx +++ b/src/client/types/number.type-renderer.jsx @@ -14,6 +14,7 @@ const Number = ({ options, value, }) => { + const [whole, fraction = 0] = `${value}`.split('.'); const inputRef = useRef(null); return ( @@ -32,24 +33,30 @@ const Number = ({ onChange={(event) => { const {value: number} = event.target; // eslint-disable-next-line no-restricted-globals - if (!isNaN(number)) { - onChange('' === number ? 0 : parseInt(number, 10), event); + if (number.match(/^(?:[0-9]+)?\.?(?:[0-9]+)?$/)) { + onChange('' === number ? 0 : parseFloat(number), event); } }} // onWheel={(e) => (e.preventDefault(), false)} ref={inputRef} type="text" - value={value} + value={`${whole}.${fraction}`} />