mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:46:13 +00:00
fix: subtable appends
This commit is contained in:
parent
dffef4f44b
commit
acb47252aa
@ -1057,7 +1057,7 @@ export const useAssociationNames = (collection) => {
|
||||
let kk = buf.concat();
|
||||
return getNesterAppends(s, kk);
|
||||
} else {
|
||||
return getAssociationAppends(s, buf);
|
||||
return s['x-component'] !== 'TableV2' && getAssociationAppends(s, buf);
|
||||
}
|
||||
}
|
||||
}, arr);
|
||||
@ -1067,7 +1067,7 @@ export const useAssociationNames = (collection) => {
|
||||
function flattenHelper(list, prefix) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (Array.isArray(list[i])) {
|
||||
flattenHelper(list[i], `${prefix}.${list[i][0]}`);
|
||||
`${prefix}` !== `${list[i][0]}` && flattenHelper(list[i], `${prefix}.${list[i][0]}`);
|
||||
} else {
|
||||
const str = prefix.replaceAll(`${list[i]}`, '').replace('..', '.').trim();
|
||||
!list.includes(str) && flattenedList.push(`${str}${list[i]}`);
|
||||
@ -1086,6 +1086,7 @@ export const useAssociationNames = (collection) => {
|
||||
}, data);
|
||||
return data.filter((g) => g.length);
|
||||
};
|
||||
console.log(formSchema.toJSON());
|
||||
const data = getAssociationAppends(formSchema);
|
||||
const associations = data.filter((g) => g.length);
|
||||
const appends = flattenNestedList(associations);
|
||||
|
@ -117,6 +117,7 @@ FormItem.Designer = function Designer() {
|
||||
: getCollectionFields(collectionField?.targetCollection) ?? [];
|
||||
const fieldModeOptions = useFieldModeOptions();
|
||||
const isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField?.type);
|
||||
const isTableField = fieldSchema['x-component'] === 'TableField';
|
||||
const isFileField = isFileCollection(targetCollection);
|
||||
const initialValue = {
|
||||
title: field.title === originalTitle ? undefined : field.title,
|
||||
@ -658,7 +659,7 @@ FormItem.Designer = function Designer() {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isAssociationField && fieldModeOptions && (
|
||||
{isAssociationField && fieldModeOptions && !isTableField && (
|
||||
<SchemaSettings.SelectItem
|
||||
key="field-mode"
|
||||
title={t('Field mode')}
|
||||
|
Loading…
Reference in New Issue
Block a user