feat: compatible with old kanban (#553)

* feat: compatible with old kanban

* feat: replace KanbanV2 to Kanban
This commit is contained in:
金昶 2022-06-29 14:17:42 +08:00 committed by GitHub
parent dbcbe6aea7
commit 44f23ca920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -83,14 +83,17 @@ const useAssociationNames = (collection) => {
} }
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const kanbanSchema = fieldSchema.reduceProperties((buf, schema) => { const kanbanSchema = fieldSchema.reduceProperties((buf, schema) => {
if (schema['x-component'] === 'KanbanV2') { if (schema['x-component'].startsWith('Kanban')) {
return schema; return schema;
} }
return buf; return buf;
}, new Schema({})); }, new Schema({}));
const gridSchema: any = kanbanSchema?.properties?.card?.properties?.grid; const gridSchema: any = kanbanSchema?.properties?.card?.properties?.grid;
const appends = []; const appends = [];
if (gridSchema) {
recursiveProperties(gridSchema, 'CollectionField', associationFields, appends); recursiveProperties(gridSchema, 'CollectionField', associationFields, appends);
}
return uniq(appends); return uniq(appends);
}; };

View File

@ -99,7 +99,7 @@ export const KanbanCardDesigner = (props: any) => {
{ {
type: 'itemGroup', type: 'itemGroup',
title: t('Display association fields'), title: t('Display association fields'),
children: useAssociatedFormItemInitializerFields({readPretty: true, block: 'KanbanV2'}), children: useAssociatedFormItemInitializerFields({readPretty: true, block: 'Kanban'}),
}, },
]} ]}
component={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />} component={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />}