diff --git a/packages/core/client/src/schema-component/antd/grid-card/GridCard.Item.tsx b/packages/core/client/src/schema-component/antd/grid-card/GridCard.Item.tsx
index e3646e2a6..7bbf7f616 100644
--- a/packages/core/client/src/schema-component/antd/grid-card/GridCard.Item.tsx
+++ b/packages/core/client/src/schema-component/antd/grid-card/GridCard.Item.tsx
@@ -3,7 +3,7 @@ import { ObjectField } from '@formily/core';
import { useField } from '@formily/react';
import { Card } from 'antd';
import React from 'react';
-import { RecordSimpleProvider } from '../../../record-provider';
+import { RecordProvider } from '../../../record-provider';
const itemCss = css`
display: flex;
@@ -30,7 +30,7 @@ export const GridCardItem = (props) => {
`}
>
- {props.children}
+ {props.children}
);
diff --git a/packages/core/client/src/schema-component/antd/list/List.Item.tsx b/packages/core/client/src/schema-component/antd/list/List.Item.tsx
index 6a9820409..b36bed717 100644
--- a/packages/core/client/src/schema-component/antd/list/List.Item.tsx
+++ b/packages/core/client/src/schema-component/antd/list/List.Item.tsx
@@ -1,13 +1,13 @@
import { ObjectField } from '@formily/core';
import { useField } from '@formily/react';
import React from 'react';
-import { RecordSimpleProvider } from '../../../record-provider';
+import { RecordProvider } from '../../../record-provider';
export const ListItem = (props) => {
const field = useField();
return (
- {props.children}
+ {props.children}
);
};
diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx
index 8ac1767b9..b3c5647dd 100644
--- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx
+++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx
@@ -75,6 +75,20 @@ const useRelationFields = () => {
field,
component: 'RecordAssociationDetailsBlockInitializer',
},
+ {
+ key: `${field.name}_list`,
+ type: 'item',
+ title: '{{t("List")}}',
+ field,
+ component: 'RecordAssociationListBlockInitializer',
+ },
+ {
+ key: `${field.name}_grid_card`,
+ type: 'item',
+ title: '{{t("Grid Card")}}',
+ field,
+ component: 'RecordAssociationGridCardBlockInitializer',
+ },
{
key: `${field.name}_form`,
type: 'item',
diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx
new file mode 100644
index 000000000..b04d2ce41
--- /dev/null
+++ b/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx
@@ -0,0 +1,39 @@
+import React from 'react';
+import { TableOutlined } from '@ant-design/icons';
+
+import { useCollectionManager } from '../../collection-manager';
+import { useSchemaTemplateManager } from '../../schema-templates';
+import { SchemaInitializer } from '../SchemaInitializer';
+import { createGridCardBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
+
+export const RecordAssociationGridCardBlockInitializer = (props) => {
+ const { item, onCreateBlockSchema, componentType, createBlockSchema, insert, ...others } = props;
+ const { getTemplateSchemaByMode } = useSchemaTemplateManager();
+ const { getCollection } = useCollectionManager();
+ const field = item.field;
+ const collection = getCollection(field.target);
+ const resource = `${field.collectionName}.${field.name}`;
+
+ return (
+ }
+ {...others}
+ onClick={async ({ item }) => {
+ if (item.template) {
+ const s = await getTemplateSchemaByMode(item);
+ insert(s);
+ } else {
+ insert(
+ createGridCardBlockSchema({
+ rowKey: collection.filterTargetKey,
+ collection: field.target,
+ resource,
+ association: resource,
+ }),
+ );
+ }
+ }}
+ items={useRecordCollectionDataSourceItems('GridCard', item, field.target, resource)}
+ />
+ );
+};
diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx
new file mode 100644
index 000000000..9bfe13ecf
--- /dev/null
+++ b/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx
@@ -0,0 +1,39 @@
+import React from 'react';
+import { TableOutlined } from '@ant-design/icons';
+
+import { useCollectionManager } from '../../collection-manager';
+import { useSchemaTemplateManager } from '../../schema-templates';
+import { SchemaInitializer } from '../SchemaInitializer';
+import { createListBlockSchema, useRecordCollectionDataSourceItems } from '../utils';
+
+export const RecordAssociationListBlockInitializer = (props) => {
+ const { item, onCreateBlockSchema, componentType, createBlockSchema, insert, ...others } = props;
+ const { getTemplateSchemaByMode } = useSchemaTemplateManager();
+ const { getCollection } = useCollectionManager();
+ const field = item.field;
+ const collection = getCollection(field.target);
+ const resource = `${field.collectionName}.${field.name}`;
+
+ return (
+ }
+ {...others}
+ onClick={async ({ item }) => {
+ if (item.template) {
+ const s = await getTemplateSchemaByMode(item);
+ insert(s);
+ } else {
+ insert(
+ createListBlockSchema({
+ rowKey: collection.filterTargetKey,
+ collection: field.target,
+ resource,
+ association: resource,
+ }),
+ );
+ }
+ }}
+ items={useRecordCollectionDataSourceItems('List', item, field.target, resource)}
+ />
+ );
+};
diff --git a/packages/core/client/src/schema-initializer/items/index.tsx b/packages/core/client/src/schema-initializer/items/index.tsx
index fe0b4f558..98c28c90f 100644
--- a/packages/core/client/src/schema-initializer/items/index.tsx
+++ b/packages/core/client/src/schema-initializer/items/index.tsx
@@ -38,6 +38,8 @@ export * from './ListBlockInitializer';
export * from './MarkdownBlockInitializer';
export * from './PrintActionInitializer';
export * from './RecordAssociationBlockInitializer';
+export * from './RecordAssociationGridCardBlockInitializer';
+export * from './RecordAssociationListBlockInitializer';
export * from './RecordAssociationCalendarBlockInitializer';
export * from './RecordAssociationDetailsBlockInitializer';
export * from './RecordAssociationFormBlockInitializer';