fix: field in detail block should not allow config default value (#2858)
This commit is contained in:
parent
a4cccb4032
commit
e920629a91
@ -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) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user