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 }) {
if (['Table', 'Kanban'].includes(block)) {
if (['Table', 'KanbanV2'].includes(block)) {
schema['x-component-props'] = schema['x-component-props'] || {};
schema['x-component-props']['size'] = 'small';
}

View File

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

View File

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