Fix InputNumberCal component to handle empty string input correctly and streamline value handling in the InputNumber component for improved data entry experience.

This commit is contained in:
Tom Butcher 2026-07-20 02:05:40 +01:00
parent bde1d5b896
commit 8cb2bea2d3

View File

@ -76,7 +76,7 @@ const InputNumberCal = ({
const next = e.target.value
setExprValue(next)
const num = parseFloat(next)
if (!next) {
if (next === '') {
onChange?.(null)
} else if (!next.match(/[+\-*/=]/) && !Number.isNaN(num)) {
onChange?.(num)
@ -142,11 +142,11 @@ const InputNumberCal = ({
return (
<InputNumber
value={value}
{...commonProps}
value={value != null ? value : null}
onChange={onChange}
onBlur={onBlur}
onKeyDown={handleNumberKeyDown}
{...commonProps}
/>
)
}