Fix:menu url style (#344)

* 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>

* fix: fix menu link url bug

Co-authored-by: chenos <chenlinxh@gmail.com>
This commit is contained in:
SemmyWong 2022-04-30 14:18:35 +08:00 committed by GitHub
parent 7677617329
commit 36e0b0a988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 28 deletions

View File

@ -223,12 +223,7 @@ export const MenuDesigner = () => {
});
});
};
return (
<GeneralSchemaDesigner>
<SchemaSettings.ModalItem
title={t('Edit')}
schema={
{
const schema = {
type: 'object',
title: t('Edit menu item'),
properties: {
@ -245,13 +240,26 @@ export const MenuDesigner = () => {
'x-decorator': 'FormItem',
},
},
} as ISchema
}
initialValues={{
};
const initialValues = {
title: field.title,
icon: field.componentProps.icon,
}}
onSubmit={({ title, icon }) => {
};
if (fieldSchema['x-component'] === 'Menu.URL') {
schema.properties['href'] = {
title: t('Link'),
'x-component': 'Input',
'x-decorator': 'FormItem',
};
initialValues['href'] = field.componentProps.href;
}
return (
<GeneralSchemaDesigner>
<SchemaSettings.ModalItem
title={t('Edit')}
schema={schema as ISchema}
initialValues={initialValues}
onSubmit={({ title, icon, href }) => {
const schema = {
['x-uid']: fieldSchema['x-uid'],
};
@ -262,9 +270,11 @@ export const MenuDesigner = () => {
refresh();
}
field.componentProps.icon = icon;
schema['x-component-props'] = { icon };
field.componentProps.href = href;
schema['x-component-props'] = { icon, href };
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
fieldSchema['x-component-props']['icon'] = icon;
fieldSchema['x-component-props']['href'] = href;
dn.emit('patch', {
schema,
});

View File

@ -5,7 +5,7 @@ import {
Schema,
SchemaExpressionScopeContext,
useField,
useFieldSchema
useFieldSchema,
} from '@formily/react';
import { Menu as AntdMenu } from 'antd';
import React, { createContext, useContext, useEffect, useState } from 'react';
@ -386,7 +386,17 @@ Menu.URL = observer((props) => {
>
<SortableItem className={designerCss}>
<Icon type={icon} />
<span
className={css`
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
width: 100%;
vertical-align: middle;
`}
>
{field.title}
</span>
<Designer />
</SortableItem>
</AntdMenu.Item>