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')} {t('Add field')}
</Button> </Button>
</Dropdown> </Dropdown>
<SchemaComponent schema={schema} components={{ ArrayTable }} scope={{ useCreateCollectionField }} /> <SchemaComponent schema={schema} components={{ ArrayTable }} scope={{ createOnly: true, useCreateCollectionField }} />
</ActionContext.Provider> </ActionContext.Provider>
); );
}; };

View File

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

View File

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

View File

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