fix(plugin-formula): use read-pretty component in result (#1911)
This commit is contained in:
parent
518ca740f8
commit
920bdf8705
@ -1,5 +1,5 @@
|
||||
import { onFormValuesChange } from '@formily/core';
|
||||
import { useFieldSchema, useFormEffects } from '@formily/react';
|
||||
import { useFieldSchema, useFormEffects, useForm } from '@formily/react';
|
||||
import { Checkbox, DatePicker, InputNumber, Input as InputString, useCollection } from '@nocobase/client';
|
||||
import { Evaluator, evaluators } from '@nocobase/evaluators/client';
|
||||
import { Registry, toFixedByStep } from '@nocobase/utils/client';
|
||||
@ -46,4 +46,8 @@ export const Result = (props) => {
|
||||
return <Component {...others} value={dataType === 'double' ? toFixedByStep(value, props.step) : value} />;
|
||||
};
|
||||
|
||||
Result.ReadPretty = function ReadPretty(props) {
|
||||
return props.value ?? null;
|
||||
};
|
||||
|
||||
export default Result;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { connect } from '@formily/react';
|
||||
import { connect, mapReadPretty } from '@formily/react';
|
||||
|
||||
import Expression from './Expression';
|
||||
import Result from './Result';
|
||||
@ -6,6 +6,6 @@ import Result from './Result';
|
||||
export const Formula = () => null;
|
||||
|
||||
Formula.Expression = Expression;
|
||||
Formula.Result = connect(Result);
|
||||
Formula.Result = connect(Result, mapReadPretty(Result.ReadPretty));
|
||||
|
||||
export default Formula;
|
||||
|
Loading…
Reference in New Issue
Block a user