fix(formula): support integer and fix NaN error (#879)
* fix(formula): support integer and fix NaN error * style(formula-input): remove debugger (cherry picked from commit 86f24a35ec25d415b5319aba4de7b509774683fd)
This commit is contained in:
parent
72372f34e9
commit
7b371706ef
@ -33,7 +33,7 @@ export const formula: IField = {
|
||||
'x-component': 'Formula.Expression',
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component-props': {
|
||||
'supports': ['number', 'percent'],
|
||||
'supports': ['number', 'percent', 'integer'],
|
||||
'useCurrentFields': '{{ useCurrentFields }}'
|
||||
},
|
||||
},
|
||||
|
@ -20,22 +20,17 @@ const AntdCompute = (props) => {
|
||||
let result;
|
||||
try {
|
||||
result = math.evaluate(expression, scope);
|
||||
result = math.round(result, 9);
|
||||
} catch {}
|
||||
result = Number.isFinite(result) ? math.round(result, 9) : null;
|
||||
} catch{}
|
||||
if (onChange) {
|
||||
onChange(result);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
return (
|
||||
<InputNumber {...others} readOnly stringMode={true} />
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export const Compute = connect(
|
||||
AntdCompute,
|
||||
mapReadPretty(ReadPretty)
|
||||
);
|
||||
return <InputNumber {...others} readOnly stringMode={true} />;
|
||||
};
|
||||
|
||||
export default Compute;
|
||||
export const Compute = connect(AntdCompute, mapReadPretty(ReadPretty));
|
||||
|
||||
export default Compute;
|
||||
|
Loading…
Reference in New Issue
Block a user