Allow decimal values in new forms (#5881)

This commit is contained in:
Oliver 2023-11-08 20:45:09 +11:00 committed by GitHub
parent 907343c5db
commit 8c9bc4d1af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,6 +287,16 @@ export function ApiFormField({
id={fieldId}
value={numericalValue}
error={error}
formatter={(value) => {
let v: any = parseFloat(value);
if (Number.isNaN(v) || !Number.isFinite(v)) {
return value;
}
return `${1 * v.toFixed()}`;
}}
precision={definition.field_type == 'integer' ? 0 : 10}
onChange={(value: number) => onChange(value)}
/>
);