fix: field in detail block should not allow config default value (#2858)

This commit is contained in:
katherinehhh 2023-10-18 10:50:25 +08:00 committed by GitHub
parent a4cccb4032
commit e920629a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,7 @@ const useIsAllowToSetDefaultValue = ({ form, fieldSchema, collectionField }: Pro
const { form: innerForm } = useFormBlockContext();
const innerFieldSchema = useFieldSchema();
const { type } = useFormBlockType();
console.log(type);
const { isAllowToSetDefaultValue = _isAllowToSetDefaultValue } = useContext(DefaultValueContext) || {};
const innerCollectionField =
@ -114,12 +115,10 @@ function _isAllowToSetDefaultValue({
) {
return false;
}
// 表单编辑状态下,不允许设置默认值
if (formBlockType === 'update') {
// 表单非新建状态下,不允许设置默认值
if (formBlockType !== 'create') {
return false;
}
return (
!form?.readPretty &&
!isPatternDisabled(fieldSchema) &&