mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:46:46 +00:00
fix(sub-table): inherited fields cannot be edited in a subtable (#2106)
* fix: inherit filed cant not edit in sub-table * fix: inherit filed cant not edit in sub-table
This commit is contained in:
parent
e3b84e855c
commit
2bbba7b7fa
@ -93,6 +93,7 @@ export const useTableColumnInitializerFields = () => {
|
|||||||
const isSubTable = fieldSchema['x-component'] === 'AssociationField.SubTable';
|
const isSubTable = fieldSchema['x-component'] === 'AssociationField.SubTable';
|
||||||
const form = useForm();
|
const form = useForm();
|
||||||
const isReadPretty = isSubTable ? form.readPretty : true;
|
const isReadPretty = isSubTable ? form.readPretty : true;
|
||||||
|
|
||||||
return currentFields
|
return currentFields
|
||||||
.filter(
|
.filter(
|
||||||
(field) => field?.interface && field?.interface !== 'subTable' && !field?.isForeignKey && !field?.treeChildren,
|
(field) => field?.interface && field?.interface !== 'subTable' && !field?.isForeignKey && !field?.treeChildren,
|
||||||
@ -203,6 +204,10 @@ export const useAssociatedTableColumnInitializerFields = () => {
|
|||||||
export const useInheritsTableColumnInitializerFields = () => {
|
export const useInheritsTableColumnInitializerFields = () => {
|
||||||
const { name } = useCollection();
|
const { name } = useCollection();
|
||||||
const { getInterface, getInheritCollections, getCollection, getParentCollectionFields } = useCollectionManager();
|
const { getInterface, getInheritCollections, getCollection, getParentCollectionFields } = useCollectionManager();
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
const isSubTable = fieldSchema['x-component'] === 'AssociationField.SubTable';
|
||||||
|
const form = useForm();
|
||||||
|
const isReadPretty = isSubTable ? form.readPretty : true;
|
||||||
const inherits = getInheritCollections(name);
|
const inherits = getInheritCollections(name);
|
||||||
return inherits?.map((v) => {
|
return inherits?.map((v) => {
|
||||||
const fields = getParentCollectionFields(v, name);
|
const fields = getParentCollectionFields(v, name);
|
||||||
@ -214,12 +219,30 @@ export const useInheritsTableColumnInitializerFields = () => {
|
|||||||
})
|
})
|
||||||
.map((k) => {
|
.map((k) => {
|
||||||
const interfaceConfig = getInterface(k.interface);
|
const interfaceConfig = getInterface(k.interface);
|
||||||
|
const isFileCollection = k?.target && getCollection(k?.target)?.template === 'file';
|
||||||
const schema = {
|
const schema = {
|
||||||
name: `${k.name}`,
|
name: `${k.name}`,
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-read-pretty': true,
|
'x-read-pretty': isReadPretty || k.uiSchema?.['x-read-pretty'],
|
||||||
'x-collection-field': `${name}.${k.name}`,
|
'x-collection-field': `${name}.${k.name}`,
|
||||||
'x-component-props': {},
|
'x-component-props': isFileCollection
|
||||||
|
? {
|
||||||
|
fieldNames: {
|
||||||
|
label: 'preview',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
'x-decorator': isSubTable
|
||||||
|
? quickEditField.includes(k.interface) || isFileCollection
|
||||||
|
? 'QuickEdit'
|
||||||
|
: 'FormItem'
|
||||||
|
: null,
|
||||||
|
'x-decorator-props': {
|
||||||
|
labelStyle: {
|
||||||
|
display: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
type: 'item',
|
type: 'item',
|
||||||
|
Loading…
Reference in New Issue
Block a user