fix: thumbnail image in kanban card (#338)

* fix: thumbnail image in kanban card

* Update attachment.ts

* Update Kanban.Card.Designer.tsx

Co-authored-by: chenos <chenlinxh@gmail.com>
This commit is contained in:
SemmyWong 2022-04-29 20:45:56 +08:00 committed by chenos
parent bca63298dc
commit 4612739021
3 changed files with 4 additions and 5 deletions

View File

@ -23,7 +23,7 @@ export const attachment: IField = {
}, },
}, },
schemaInitialize(schema: ISchema, { block }) { schemaInitialize(schema: ISchema, { block }) {
if (['Table', 'Kanban'].includes(block)) { if (['Table', 'KanbanV2'].includes(block)) {
schema['x-component-props'] = schema['x-component-props'] || {}; schema['x-component-props'] = schema['x-component-props'] || {};
schema['x-component-props']['size'] = 'small'; schema['x-component-props']['size'] = 'small';
} }

View File

@ -58,7 +58,7 @@ export const KanbanCardDesigner = (props: any) => {
const { refresh } = useDesignable(); const { refresh } = useDesignable();
const field = useField(); const field = useField();
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const fields = useFormItemInitializerFields({ readPretty: true }); const fields = useFormItemInitializerFields({ readPretty: true, block: 'KanbanV2' });
if (!designable) { if (!designable) {
return null; return null;
} }
@ -75,7 +75,6 @@ export const KanbanCardDesigner = (props: any) => {
} }
return buf; return buf;
}, null); }, null);
console.log('schema', gridSchema)
if (!gridSchema) { if (!gridSchema) {
return; return;
} }

View File

@ -91,7 +91,7 @@ export const useFormItemInitializerFields = (options?: any) => {
const { name, fields } = useCollection(); const { name, fields } = useCollection();
const { getInterface } = useCollectionManager(); const { getInterface } = useCollectionManager();
const form = useForm(); const form = useForm();
const { readPretty = form.readPretty } = options || {}; const { readPretty = form.readPretty, block = 'Form' } = options || {};
return fields return fields
?.filter((field) => field?.interface) ?.filter((field) => field?.interface)
?.map((field) => { ?.map((field) => {
@ -112,7 +112,7 @@ export const useFormItemInitializerFields = (options?: any) => {
component: 'CollectionFieldInitializer', component: 'CollectionFieldInitializer',
remove: removeGridFormItem, remove: removeGridFormItem,
schemaInitialize: (s) => { schemaInitialize: (s) => {
interfaceConfig?.schemaInitialize?.(s, { field, block: 'Form', readPretty }); interfaceConfig?.schemaInitialize?.(s, { field, block, readPretty });
}, },
schema, schema,
} as SchemaInitializerItemOptions; } as SchemaInitializerItemOptions;