fix: some field parameters should be disabled when editing

This commit is contained in:
chenos 2022-04-20 22:23:52 +08:00
parent b45a5d57ea
commit 0ab0d3ed46
4 changed files with 5 additions and 3 deletions

View File

@ -142,7 +142,7 @@ export const AddFieldAction = () => {
{t('Add field')}
</Button>
</Dropdown>
<SchemaComponent schema={schema} components={{ ArrayTable }} scope={{ useCreateCollectionField }} />
<SchemaComponent schema={schema} components={{ ArrayTable }} scope={{ createOnly: true, useCreateCollectionField }} />
</ActionContext.Provider>
);
};

View File

@ -134,7 +134,7 @@ export const AddSubFieldAction = () => {
</Button>
</Dropdown>
<RecordProvider record={{}}>
<SchemaComponent schema={schema} components={{ ArrayTable }} scope={{ useCreateSubField }} />
<SchemaComponent schema={schema} components={{ ArrayTable }} scope={{ createOnly: true, useCreateSubField }} />
</RecordProvider>
</ActionContext.Provider>
);

View File

@ -83,10 +83,12 @@ export const linkTo: IField = {
'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-disabled': '{{ !createOnly }}',
},
through: {
type: 'string',
title: '{{t("Junction collection")}}',
'x-disabled': '{{ !createOnly }}',
'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
'x-decorator': 'FormItem',
'x-component': 'Select',

View File

@ -192,7 +192,7 @@ export const defaultProps = {
type: 'string',
title: '{{t("Field name")}}',
required: true,
// 'x-disabled': true,
'x-disabled': '{{ !createOnly }}',
'x-decorator': 'FormItem',
'x-component': 'Input',
description: