mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:26:36 +00:00
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 86f24a35ec
)
This commit is contained in:
parent
72372f34e9
commit
7b371706ef
@ -33,7 +33,7 @@ export const formula: IField = {
|
|||||||
'x-component': 'Formula.Expression',
|
'x-component': 'Formula.Expression',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
'supports': ['number', 'percent'],
|
'supports': ['number', 'percent', 'integer'],
|
||||||
'useCurrentFields': '{{ useCurrentFields }}'
|
'useCurrentFields': '{{ useCurrentFields }}'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -20,22 +20,17 @@ const AntdCompute = (props) => {
|
|||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
result = math.evaluate(expression, scope);
|
result = math.evaluate(expression, scope);
|
||||||
result = math.round(result, 9);
|
result = Number.isFinite(result) ? math.round(result, 9) : null;
|
||||||
} catch {}
|
} catch{}
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(result);
|
onChange(result);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
return (
|
|
||||||
<InputNumber {...others} readOnly stringMode={true} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Compute = connect(
|
return <InputNumber {...others} readOnly stringMode={true} />;
|
||||||
AntdCompute,
|
};
|
||||||
mapReadPretty(ReadPretty)
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Compute;
|
export const Compute = connect(AntdCompute, mapReadPretty(ReadPretty));
|
||||||
|
|
||||||
|
export default Compute;
|
||||||
|
Loading…
Reference in New Issue
Block a user