mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: error when editing fields in external data source (#6402)
This commit is contained in:
parent
1320b59b2f
commit
a8532e874a
@ -39,10 +39,36 @@ const getSchema = (schema: IField, record: any, compile) => {
|
|||||||
if (!schema) {
|
if (!schema) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const properties = schema.getConfigureFormProperties();
|
|
||||||
|
const properties = cloneDeep(schema.properties) as any;
|
||||||
if (properties?.foreignKey) {
|
if (properties?.foreignKey) {
|
||||||
properties.foreignKey['x-component'] = ForeignKey;
|
properties.foreignKey['x-component'] = ForeignKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (schema.hasDefaultValue === true) {
|
||||||
|
properties['defaultValue'] = cloneDeep(schema?.default?.uiSchema);
|
||||||
|
properties.defaultValue.required = false;
|
||||||
|
properties['defaultValue']['title'] = compile('{{ t("Default value") }}');
|
||||||
|
properties['defaultValue']['x-decorator'] = 'FormItem';
|
||||||
|
properties['defaultValue']['x-reactions'] = {
|
||||||
|
dependencies: [
|
||||||
|
'uiSchema.x-component-props.gmt',
|
||||||
|
'uiSchema.x-component-props.showTime',
|
||||||
|
'uiSchema.x-component-props.dateFormat',
|
||||||
|
'uiSchema.x-component-props.timeFormat',
|
||||||
|
],
|
||||||
|
fulfill: {
|
||||||
|
state: {
|
||||||
|
componentProps: {
|
||||||
|
gmt: '{{$deps[0]}}',
|
||||||
|
showTime: '{{$deps[1]}}',
|
||||||
|
dateFormat: '{{$deps[2]}}',
|
||||||
|
timeFormat: '{{$deps[3]}}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
const initialValue: any = {
|
const initialValue: any = {
|
||||||
name: `f_${uid()}`,
|
name: `f_${uid()}`,
|
||||||
...cloneDeep(schema.default),
|
...cloneDeep(schema.default),
|
||||||
|
@ -49,11 +49,36 @@ const getSchema = ({
|
|||||||
if (!schema) {
|
if (!schema) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const properties = schema.getConfigureFormProperties();
|
const properties = cloneDeep(schema.properties) as any;
|
||||||
|
|
||||||
if (properties?.name) {
|
if (properties?.name) {
|
||||||
properties.name['x-disabled'] = true;
|
properties.name['x-disabled'] = true;
|
||||||
}
|
}
|
||||||
|
if (schema.hasDefaultValue === true) {
|
||||||
|
properties['defaultValue'] = cloneDeep(schema.default.uiSchema) || {};
|
||||||
|
properties.defaultValue.required = false;
|
||||||
|
properties['defaultValue']['title'] = compile('{{ t("Default value") }}');
|
||||||
|
properties['defaultValue']['x-decorator'] = 'FormItem';
|
||||||
|
properties['defaultValue']['x-reactions'] = {
|
||||||
|
dependencies: [
|
||||||
|
'uiSchema.x-component-props.gmt',
|
||||||
|
'uiSchema.x-component-props.showTime',
|
||||||
|
'uiSchema.x-component-props.dateFormat',
|
||||||
|
'uiSchema.x-component-props.timeFormat',
|
||||||
|
],
|
||||||
|
fulfill: {
|
||||||
|
state: {
|
||||||
|
componentProps: {
|
||||||
|
gmt: '{{$deps[0]}}',
|
||||||
|
showTime: '{{$deps[1]}}',
|
||||||
|
dateFormat: '{{$deps[2]}}',
|
||||||
|
timeFormat: '{{$deps[3]}}',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
properties['defaultValue']['x-disabled'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user