From 44f23ca9207300bce6dbcd9834565b17111e6ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E6=98=B6?= Date: Wed, 29 Jun 2022 14:17:42 +0800 Subject: [PATCH] feat: compatible with old kanban (#553) * feat: compatible with old kanban * feat: replace KanbanV2 to Kanban --- .../core/client/src/block-provider/KanbanBlockProvider.tsx | 7 +++++-- .../schema-component/antd/kanban/Kanban.Card.Designer.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/block-provider/KanbanBlockProvider.tsx b/packages/core/client/src/block-provider/KanbanBlockProvider.tsx index 568e7bd5c..17947fd52 100644 --- a/packages/core/client/src/block-provider/KanbanBlockProvider.tsx +++ b/packages/core/client/src/block-provider/KanbanBlockProvider.tsx @@ -83,14 +83,17 @@ const useAssociationNames = (collection) => { } const fieldSchema = useFieldSchema(); const kanbanSchema = fieldSchema.reduceProperties((buf, schema) => { - if (schema['x-component'] === 'KanbanV2') { + if (schema['x-component'].startsWith('Kanban')) { return schema; } return buf; }, new Schema({})); const gridSchema: any = kanbanSchema?.properties?.card?.properties?.grid; const appends = []; - recursiveProperties(gridSchema, 'CollectionField', associationFields, appends); + if (gridSchema) { + recursiveProperties(gridSchema, 'CollectionField', associationFields, appends); + } + return uniq(appends); }; diff --git a/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx b/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx index 5a0b0fb74..714aa38ad 100644 --- a/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/kanban/Kanban.Card.Designer.tsx @@ -99,7 +99,7 @@ export const KanbanCardDesigner = (props: any) => { { type: 'itemGroup', title: t('Display association fields'), - children: useAssociatedFormItemInitializerFields({readPretty: true, block: 'KanbanV2'}), + children: useAssociatedFormItemInitializerFields({readPretty: true, block: 'Kanban'}), }, ]} component={}