mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +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 form = useForm();
|
||||
const isReadPretty = isSubTable ? form.readPretty : true;
|
||||
|
||||
return currentFields
|
||||
.filter(
|
||||
(field) => field?.interface && field?.interface !== 'subTable' && !field?.isForeignKey && !field?.treeChildren,
|
||||
@ -203,6 +204,10 @@ export const useAssociatedTableColumnInitializerFields = () => {
|
||||
export const useInheritsTableColumnInitializerFields = () => {
|
||||
const { name } = useCollection();
|
||||
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);
|
||||
return inherits?.map((v) => {
|
||||
const fields = getParentCollectionFields(v, name);
|
||||
@ -214,12 +219,30 @@ export const useInheritsTableColumnInitializerFields = () => {
|
||||
})
|
||||
.map((k) => {
|
||||
const interfaceConfig = getInterface(k.interface);
|
||||
const isFileCollection = k?.target && getCollection(k?.target)?.template === 'file';
|
||||
const schema = {
|
||||
name: `${k.name}`,
|
||||
'x-component': 'CollectionField',
|
||||
'x-read-pretty': true,
|
||||
'x-read-pretty': isReadPretty || k.uiSchema?.['x-read-pretty'],
|
||||
'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 {
|
||||
type: 'item',
|
||||
|
Loading…
Reference in New Issue
Block a user