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,
|
paginate: false,
|
||||||
appends: ['fields', 'fields.uiSchema'],
|
appends: ['fields', 'fields.uiSchema'],
|
||||||
filter: {
|
filter: {
|
||||||
inherit: false,
|
// inherit: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ import { CollectionFieldOptions } from '../types';
|
|||||||
export const useCollection = () => {
|
export const useCollection = () => {
|
||||||
const collection = useContext(CollectionContext);
|
const collection = useContext(CollectionContext);
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const resource = api?.resource(collection.name);
|
const resource = api?.resource(collection?.name);
|
||||||
return {
|
return {
|
||||||
...collection,
|
...collection,
|
||||||
resource,
|
resource,
|
||||||
|
@ -255,7 +255,7 @@ export const DataSourceProvider = observer((props: any) => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<CollectionProvider name={collection}>
|
<CollectionProvider collection={coll}>
|
||||||
<DataSourceContext.Provider
|
<DataSourceContext.Provider
|
||||||
value={{
|
value={{
|
||||||
rowKey,
|
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 { TableArray } from './Table.Array';
|
||||||
|
import { TableArrayDesigner } from './Table.Array.Designer';
|
||||||
import { TableColumn } from './Table.Column';
|
import { TableColumn } from './Table.Column';
|
||||||
import { TableColumnActionBar } from './Table.Column.ActionBar';
|
import { TableColumnActionBar } from './Table.Column.ActionBar';
|
||||||
import { TableColumnDecorator } from './Table.Column.Decorator';
|
import { TableColumnDecorator } from './Table.Column.Decorator';
|
||||||
@ -23,3 +24,4 @@ Table.Column.Deigner = TableColumnDeigner;
|
|||||||
|
|
||||||
Table.RowActionDesigner = TableRowActionDesigner;
|
Table.RowActionDesigner = TableRowActionDesigner;
|
||||||
Table.Designer = TableDesigner;
|
Table.Designer = TableDesigner;
|
||||||
|
Table.Array.Designer = TableArrayDesigner;
|
||||||
|
@ -167,7 +167,9 @@ export const CalendarBlockInitializer = (props) => {
|
|||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: t('Select data source'),
|
title: t('Select data source'),
|
||||||
children: collections?.map((item) => {
|
children: collections
|
||||||
|
?.filter((item) => !item.inherit)
|
||||||
|
?.map((item) => {
|
||||||
return {
|
return {
|
||||||
type: 'item',
|
type: 'item',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
@ -66,7 +66,9 @@ export const FormBlockInitializer = (props) => {
|
|||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: t('Select data source'),
|
title: t('Select data source'),
|
||||||
children: collections?.map((item) => {
|
children: collections
|
||||||
|
?.filter((item) => !item.inherit)
|
||||||
|
?.map((item) => {
|
||||||
return {
|
return {
|
||||||
type: 'item',
|
type: 'item',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
@ -91,7 +91,9 @@ export const TableBlockInitializer = (props) => {
|
|||||||
{
|
{
|
||||||
type: 'itemGroup',
|
type: 'itemGroup',
|
||||||
title: t('Select data source'),
|
title: t('Select data source'),
|
||||||
children: collections?.map((item) => {
|
children: collections
|
||||||
|
?.filter((item) => !item.inherit)
|
||||||
|
?.map((item) => {
|
||||||
return {
|
return {
|
||||||
type: 'item',
|
type: 'item',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
@ -57,7 +57,7 @@ const findTableColumn = (schema: Schema, key: string, action: string, deepth: nu
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useTableColumnInitializerFields = () => {
|
export const useTableColumnInitializerFields = () => {
|
||||||
const { name, fields } = useCollection();
|
const { name, fields = [] } = useCollection();
|
||||||
return fields
|
return fields
|
||||||
.filter((field) => field?.interface && field?.interface !== 'subTable')
|
.filter((field) => field?.interface && field?.interface !== 'subTable')
|
||||||
.map((field) => {
|
.map((field) => {
|
||||||
@ -113,7 +113,7 @@ export const useFormItemInitializerFields = () => {
|
|||||||
schema: {
|
schema: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
name: field.name,
|
name: field.name,
|
||||||
'x-designer': 'FormItem.Designer',
|
'x-designer': 'Table.Array.Designer',
|
||||||
'x-component': 'div',
|
'x-component': 'div',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-collection-field': `${name}.${field.name}`,
|
'x-collection-field': `${name}.${field.name}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user