fix: x-collection-field (#1134)
This commit is contained in:
parent
cbea13260e
commit
a8cabbab56
@ -73,7 +73,7 @@ export const findTableColumn = (schema: Schema, key: string, action: string, dee
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useTableColumnInitializerFields = () => {
|
export const useTableColumnInitializerFields = () => {
|
||||||
const { currentFields = [] } = useCollection();
|
const { name, currentFields = [] } = useCollection();
|
||||||
const { getInterface } = useCollectionManager();
|
const { getInterface } = useCollectionManager();
|
||||||
return currentFields
|
return currentFields
|
||||||
.filter((field) => field?.interface && field?.interface !== 'subTable' && !field?.isForeignKey)
|
.filter((field) => field?.interface && field?.interface !== 'subTable' && !field?.isForeignKey)
|
||||||
@ -81,7 +81,7 @@ export const useTableColumnInitializerFields = () => {
|
|||||||
const interfaceConfig = getInterface(field.interface);
|
const interfaceConfig = getInterface(field.interface);
|
||||||
const schema = {
|
const schema = {
|
||||||
name: field.name,
|
name: field.name,
|
||||||
'x-collection-field': `${field.name}`,
|
'x-collection-field': `${name}.${field.name}`,
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-read-pretty': true,
|
'x-read-pretty': true,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
@ -168,7 +168,7 @@ export const useInheritsTableColumnInitializerFields = () => {
|
|||||||
name: `${k.name}`,
|
name: `${k.name}`,
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-read-pretty': true,
|
'x-read-pretty': true,
|
||||||
'x-collection-field': `${k.name}`,
|
'x-collection-field': `${name}.${k.name}`,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
@ -206,7 +206,7 @@ export const useFormItemInitializerFields = (options?: any) => {
|
|||||||
'x-designer': 'FormItem.Designer',
|
'x-designer': 'FormItem.Designer',
|
||||||
'x-component': field.interface === 'o2m' ? 'TableField' : 'CollectionField',
|
'x-component': field.interface === 'o2m' ? 'TableField' : 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-collection-field': `${field.name}`,
|
'x-collection-field': `${name}.${field.name}`,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
'x-read-pretty': field?.uiSchema?.['x-read-pretty'],
|
'x-read-pretty': field?.uiSchema?.['x-read-pretty'],
|
||||||
};
|
};
|
||||||
@ -297,7 +297,7 @@ export const useInheritsFormItemInitializerFields = (options?) => {
|
|||||||
'x-designer': 'FormItem.Designer',
|
'x-designer': 'FormItem.Designer',
|
||||||
'x-component': field.interface === 'o2m' ? 'TableField' : 'CollectionField',
|
'x-component': field.interface === 'o2m' ? 'TableField' : 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-collection-field': `${field.name}`,
|
'x-collection-field': `${name}.${field.name}`,
|
||||||
'x-component-props': {},
|
'x-component-props': {},
|
||||||
'x-read-pretty': field?.uiSchema?.['x-read-pretty'],
|
'x-read-pretty': field?.uiSchema?.['x-read-pretty'],
|
||||||
};
|
};
|
||||||
@ -334,7 +334,7 @@ export const useCustomFormItemInitializerFields = (options?: any) => {
|
|||||||
'x-designer': 'FormItem.Designer',
|
'x-designer': 'FormItem.Designer',
|
||||||
'x-component': 'AssignedField',
|
'x-component': 'AssignedField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-collection-field': `${field.name}`,
|
'x-collection-field': `${name}.${field.name}`,
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
type: 'item',
|
type: 'item',
|
||||||
@ -368,7 +368,7 @@ export const useCustomBulkEditFormItemInitializerFields = (options?: any) => {
|
|||||||
'x-designer': 'FormItem.Designer',
|
'x-designer': 'FormItem.Designer',
|
||||||
'x-component': 'BulkEditField',
|
'x-component': 'BulkEditField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-collection-field': `${field.name}`,
|
'x-collection-field': `${name}.${field.name}`,
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
type: 'item',
|
type: 'item',
|
||||||
@ -419,7 +419,6 @@ export const useCurrentSchema = (action: string, key: string, find = findSchema,
|
|||||||
}
|
}
|
||||||
const { remove } = useDesignable();
|
const { remove } = useDesignable();
|
||||||
const schema = find(fieldSchema, key, action);
|
const schema = find(fieldSchema, key, action);
|
||||||
console.log(fieldSchema, key, action);
|
|
||||||
return {
|
return {
|
||||||
schema,
|
schema,
|
||||||
exists: !!schema,
|
exists: !!schema,
|
||||||
|
Loading…
Reference in New Issue
Block a user