fix: menu auto fold

This commit is contained in:
Semmy 2022-03-26 00:21:12 +08:00
parent 1a40f1e365
commit 4620a42932
3 changed files with 61 additions and 58 deletions

View File

@ -13,7 +13,7 @@ import {
RemoteSchemaTemplateManagerProvider,
useDocumentTitle,
useRoute,
useSystemSettings
useSystemSettings,
} from '../../../';
const InternalAdminLayout = (props: any) => {

View File

@ -192,6 +192,14 @@ export const Menu: ComposedMenu = observer((props) => {
<DndContext>
<MenuItemDesignerContext.Provider value={Designer}>
<MenuModeContext.Provider value={mode}>
<div
style={{
width: 'calc(100% - 200px - 390px)',
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'center',
}}
>
<AntdMenu
{...others}
style={{
@ -241,10 +249,9 @@ export const Menu: ComposedMenu = observer((props) => {
mode={mode === 'mix' ? 'horizontal' : mode}
defaultOpenKeys={defaultOpenKeys}
defaultSelectedKeys={defaultSelectedKeys}
>
<RecursionField schema={schema} onlyRenderProperties />
{render({ style: { background: 'none', marginTop: 7, marginLeft: 8 } })}
</AntdMenu>
></AntdMenu>
{render({ style: { background: 'none' } })}
</div>
{loading
? null
: mode === 'mix' &&

View File

@ -13,7 +13,7 @@ import {
SchemaComponentOptions,
useActionContext,
useAPIClient,
useCollection
useCollection,
} from '..';
import { useSchemaTemplateManager } from '../schema-templates';
import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
@ -182,11 +182,11 @@ SchemaSettings.Template = (props) => {
};
SchemaSettings.Item = (props) => {
const { eventKey } = props;
let { eventKey } = props;
return (
<Menu.Item
key={eventKey}
eventKey={eventKey}
eventKey={eventKey as any}
{...props}
onClick={(info) => {
info.domEvent.preventDefault();
@ -200,10 +200,6 @@ SchemaSettings.Item = (props) => {
);
};
SchemaSettings.ItemGroup = (props) => {
return <Menu.ItemGroup {...props}>{props.children || props.title}</Menu.ItemGroup>;
};
SchemaSettings.SubMenu = (props) => {
return <Menu.SubMenu {...props} />;
};