fix(组件默认值 amis-saas-6469): 修复默认值变动影响最大最小值

Change-Id: I381854ac091cf0cf309cb746bd1ecb7e487f51c9
This commit is contained in:
wibetter 2022-09-02 12:07:01 +08:00
parent 16d742f35c
commit cb08739533

View File

@ -13,7 +13,7 @@ import isString from 'lodash/isString';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
import cx from 'classnames'; import cx from 'classnames';
import {FormItem, Button, InputBox, Icon, ResultBox} from 'amis'; import {FormItem, Button, InputBox, Icon, ResultBox, render} from 'amis';
import {FormulaExec, isExpression} from 'amis'; import {FormulaExec, isExpression} from 'amis';
import {PickerContainer} from 'amis'; import {PickerContainer} from 'amis';
import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor'; import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor';
@ -288,7 +288,8 @@ export default class FormulaControl extends React.Component<
if (rendererSchema) { if (rendererSchema) {
curRendererSchema = Object.assign({}, rendererSchema, data, { curRendererSchema = Object.assign({}, rendererSchema, data, {
type: rendererSchema.type ?? data.type, type: rendererSchema.type ?? data.type,
value: this.props.value ?? rendererSchema.value ?? data.value // 说明: props.value 最后会同步到 rendererSchema.value 中
value: rendererSchema.value // this.props.value ?? rendererSchema.value ?? data.value
}); });
// 默认要剔除的字段 // 默认要剔除的字段
@ -322,7 +323,7 @@ export default class FormulaControl extends React.Component<
'unitOptions', 'unitOptions',
'keyboard', 'keyboard',
'kilobitSeparator', 'kilobitSeparator',
'value' // 'value'
]; ];
// 当前组件要剔除的字段 // 当前组件要剔除的字段
@ -394,7 +395,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper, rendererWrapper,
manager, manager,
useExternalFormData = false, useExternalFormData = false,
render, // render,
...rest ...rest
} = this.props; } = this.props;
@ -450,7 +451,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper ? 'border-wrapper' : '' rendererWrapper ? 'border-wrapper' : ''
)} )}
> >
{render('left', this.filterCustomRendererProps(rendererSchema), { {render(this.filterCustomRendererProps(rendererSchema), {
inputOnly: true, inputOnly: true,
value: value, value: value,
data: useExternalFormData data: useExternalFormData