mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:46:13 +00:00
refactor: association field support sub-table
This commit is contained in:
parent
e6efc8dc57
commit
7a4943405c
@ -35,12 +35,12 @@ export const useFieldModeOptions = () => {
|
||||
return isReadPretty
|
||||
? [
|
||||
{ label: t('Title'), value: 'Select' },
|
||||
// { label: t('Subtable'), value: 'SubTable' },
|
||||
{ label: t('Subtable'), value: 'SubTable' },
|
||||
{ label: t('Sub-details'), value: 'Nester' },
|
||||
]
|
||||
: [
|
||||
{ label: t('Record picker'), value: 'Picker' },
|
||||
// { label: t('Subtable'), value: 'SubTable' },
|
||||
{ label: t('Subtable'), value: 'SubTable' },
|
||||
{ label: t('Select'), value: 'Select' },
|
||||
{ label: t('Subform'), value: 'Nester' },
|
||||
];
|
||||
|
@ -76,6 +76,10 @@ export const findTableColumn = (schema: Schema, key: string, action: string, dee
|
||||
export const useTableColumnInitializerFields = () => {
|
||||
const { name, currentFields = [] } = useCollection();
|
||||
const { getInterface, getCollection } = useCollectionManager();
|
||||
const fieldSchema = useFieldSchema();
|
||||
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,
|
||||
@ -86,7 +90,7 @@ export const useTableColumnInitializerFields = () => {
|
||||
name: field.name,
|
||||
'x-collection-field': `${name}.${field.name}`,
|
||||
'x-component': 'CollectionField',
|
||||
'x-read-pretty': true,
|
||||
'x-read-pretty': isReadPretty,
|
||||
'x-component-props': {},
|
||||
};
|
||||
// interfaceConfig?.schemaInitialize?.(schema, { field, readPretty: true, block: 'Table' });
|
||||
@ -99,7 +103,7 @@ export const useTableColumnInitializerFields = () => {
|
||||
schemaInitialize: (s) => {
|
||||
interfaceConfig?.schemaInitialize?.(s, {
|
||||
field,
|
||||
readPretty: true,
|
||||
readPretty: isReadPretty,
|
||||
block: 'Table',
|
||||
targetCollection: getCollection(field.target),
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user