fix: read pretty field for kanban

This commit is contained in:
chenos 2022-04-18 21:43:10 +08:00
parent 0c2b9741ed
commit 10dcc7fea0
2 changed files with 5 additions and 3 deletions

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(); const fields = useFormItemInitializerFields({ readPretty: true });
if (!designable) { if (!designable) {
return null; return null;
} }

View File

@ -87,10 +87,11 @@ export const useTableColumnInitializerFields = () => {
}); });
}; };
export const useFormItemInitializerFields = () => { 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 || {};
return fields return fields
?.filter((field) => field?.interface) ?.filter((field) => field?.interface)
?.map((field) => { ?.map((field) => {
@ -111,7 +112,7 @@ export const useFormItemInitializerFields = () => {
component: 'CollectionFieldInitializer', component: 'CollectionFieldInitializer',
remove: removeGridFormItem, remove: removeGridFormItem,
schemaInitialize: (s) => { schemaInitialize: (s) => {
interfaceConfig?.schemaInitialize?.(s, { field, block: 'Form', readPretty: form.readPretty }); interfaceConfig?.schemaInitialize?.(s, { field, block: 'Form', readPretty });
}, },
schema, schema,
} as SchemaInitializerItemOptions; } as SchemaInitializerItemOptions;
@ -641,6 +642,7 @@ export const createKanbanBlockSchema = (options) => {
properties: { properties: {
card: { card: {
type: 'void', type: 'void',
'x-read-pretty': true,
'x-decorator': 'BlockItem', 'x-decorator': 'BlockItem',
'x-component': 'KanbanV2.Card', 'x-component': 'KanbanV2.Card',
'x-designer': 'KanbanV2.Card.Designer', 'x-designer': 'KanbanV2.Card.Designer',