fix: 修复日期类控件自动将 value 默认值运算并设置上的问题

Change-Id: Ie1393474a59455b991e09bfc3a84f574b6cdbff9
This commit is contained in:
2betop 2022-08-01 16:47:17 +08:00
parent 177b417f99
commit 94f5cb05c6

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, render, ResultBox} from 'amis'; import {FormItem, Button, InputBox, Icon, ResultBox} 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';
@ -321,7 +321,8 @@ export default class FormulaControl extends React.Component<
'suffix', 'suffix',
'unitOptions', 'unitOptions',
'keyboard', 'keyboard',
'kilobitSeparator' 'kilobitSeparator',
'value'
]; ];
// 当前组件要剔除的字段 // 当前组件要剔除的字段
@ -356,6 +357,7 @@ export default class FormulaControl extends React.Component<
// 设置popOverContainer // 设置popOverContainer
curRendererSchema.popOverContainer = window.document.body; curRendererSchema.popOverContainer = window.document.body;
} }
return curRendererSchema; return curRendererSchema;
} }
@ -390,6 +392,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper, rendererWrapper,
manager, manager,
useExternalFormData = false, useExternalFormData = false,
render,
...rest ...rest
} = this.props; } = this.props;
@ -445,21 +448,17 @@ export default class FormulaControl extends React.Component<
rendererWrapper ? 'border-wrapper' : '' rendererWrapper ? 'border-wrapper' : ''
)} )}
> >
{render( {render('left', this.filterCustomRendererProps(rendererSchema), {
this.filterCustomRendererProps(rendererSchema), inputOnly: true,
{ value: value,
data: useExternalFormData data: useExternalFormData
? { ? {
...this.props.data ...this.props.data
} }
: {}, : {},
onChange: this.handleSimpleInputChange, onChange: this.handleSimpleInputChange,
manager: manager manager: manager
}, })}
{
...(manager?.env || {})
}
)}
</div> </div>
)} )}
{!simple && isExpr && ( {!simple && isExpr && (