mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-30 03:08:31 +08:00
fix(client): sub table does not work
This commit is contained in:
parent
5164f85484
commit
4ce41cf7b2
@ -35,7 +35,7 @@ export const RemoteCollectionManagerProvider = (props: any) => {
|
||||
paginate: false,
|
||||
appends: ['fields', 'fields.uiSchema'],
|
||||
filter: {
|
||||
inherit: false,
|
||||
// inherit: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ import { CollectionFieldOptions } from '../types';
|
||||
export const useCollection = () => {
|
||||
const collection = useContext(CollectionContext);
|
||||
const api = useAPIClient();
|
||||
const resource = api?.resource(collection.name);
|
||||
const resource = api?.resource(collection?.name);
|
||||
return {
|
||||
...collection,
|
||||
resource,
|
||||
|
@ -255,7 +255,7 @@ export const DataSourceProvider = observer((props: any) => {
|
||||
},
|
||||
);
|
||||
return (
|
||||
<CollectionProvider name={collection}>
|
||||
<CollectionProvider collection={coll}>
|
||||
<DataSourceContext.Provider
|
||||
value={{
|
||||
rowKey,
|
||||
|
@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
||||
|
||||
export const TableArrayDesigner = () => {
|
||||
return (
|
||||
<GeneralSchemaDesigner>
|
||||
<SchemaSettings.Remove
|
||||
removeParentsIfNoChildren
|
||||
breakRemoveOn={{
|
||||
'x-component': 'Grid',
|
||||
}}
|
||||
/>
|
||||
</GeneralSchemaDesigner>
|
||||
);
|
||||
};
|
@ -1,4 +1,5 @@
|
||||
import { TableArray } from './Table.Array';
|
||||
import { TableArrayDesigner } from './Table.Array.Designer';
|
||||
import { TableColumn } from './Table.Column';
|
||||
import { TableColumnActionBar } from './Table.Column.ActionBar';
|
||||
import { TableColumnDecorator } from './Table.Column.Decorator';
|
||||
@ -23,3 +24,4 @@ Table.Column.Deigner = TableColumnDeigner;
|
||||
|
||||
Table.RowActionDesigner = TableRowActionDesigner;
|
||||
Table.Designer = TableDesigner;
|
||||
Table.Array.Designer = TableArrayDesigner;
|
||||
|
@ -167,13 +167,15 @@ export const CalendarBlockInitializer = (props) => {
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: t('Select data source'),
|
||||
children: collections?.map((item) => {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
title: item.title,
|
||||
};
|
||||
}),
|
||||
children: collections
|
||||
?.filter((item) => !item.inherit)
|
||||
?.map((item) => {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
title: item.title,
|
||||
};
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
@ -66,13 +66,15 @@ export const FormBlockInitializer = (props) => {
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: t('Select data source'),
|
||||
children: collections?.map((item) => {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
title: item.title,
|
||||
};
|
||||
}),
|
||||
children: collections
|
||||
?.filter((item) => !item.inherit)
|
||||
?.map((item) => {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
title: item.title,
|
||||
};
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
@ -91,13 +91,15 @@ export const TableBlockInitializer = (props) => {
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: t('Select data source'),
|
||||
children: collections?.map((item) => {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
title: item.title,
|
||||
};
|
||||
}),
|
||||
children: collections
|
||||
?.filter((item) => !item.inherit)
|
||||
?.map((item) => {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
title: item.title,
|
||||
};
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
@ -57,7 +57,7 @@ const findTableColumn = (schema: Schema, key: string, action: string, deepth: nu
|
||||
};
|
||||
|
||||
export const useTableColumnInitializerFields = () => {
|
||||
const { name, fields } = useCollection();
|
||||
const { name, fields = [] } = useCollection();
|
||||
return fields
|
||||
.filter((field) => field?.interface && field?.interface !== 'subTable')
|
||||
.map((field) => {
|
||||
@ -113,7 +113,7 @@ export const useFormItemInitializerFields = () => {
|
||||
schema: {
|
||||
type: 'void',
|
||||
name: field.name,
|
||||
'x-designer': 'FormItem.Designer',
|
||||
'x-designer': 'Table.Array.Designer',
|
||||
'x-component': 'div',
|
||||
'x-decorator': 'FormItem',
|
||||
'x-collection-field': `${name}.${field.name}`,
|
||||
|
Loading…
Reference in New Issue
Block a user