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