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:
parent
bde1d5b896
commit
8cb2bea2d3
@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user