fix(client/block-select-collection): fix select collection menu view error (#889)

* fix(client/block-select-collection): fix too many collection menu view error

* fix(client/relate-collection-field-menu): fix relate collection field menu view too long error

(cherry picked from commit 6b897f585389ae07a7dcd74cb77705c0e45cacdb)
This commit is contained in:
lyf-coder 2022-10-11 22:43:11 +08:00 committed by chenos
parent 9d947a0fa5
commit d6d2e639ce
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import lessStyle from './style.less';
import { ISchema, observer } from '@formily/react'; import { ISchema, observer } from '@formily/react';
import { Button, Dropdown, Menu, Switch } from 'antd'; import { Button, Dropdown, Menu, Switch } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
@ -9,7 +10,7 @@ import {
SchemaInitializerButtonProps, SchemaInitializerButtonProps,
SchemaInitializerItemComponent, SchemaInitializerItemComponent,
SchemaInitializerItemOptions, SchemaInitializerItemOptions,
SchemaInitializerItemProps SchemaInitializerItemProps,
} from './types'; } from './types';
const defaultWrap = (s: ISchema) => s; const defaultWrap = (s: ISchema) => s;
@ -84,7 +85,11 @@ SchemaInitializer.Button = observer((props: SchemaInitializerButtonProps) => {
if (item.type === 'subMenu') { if (item.type === 'subMenu') {
return ( return (
!!item.children?.length && ( !!item.children?.length && (
<Menu.SubMenu key={item.key || `item-group-${indexA}`} title={compile(item.title)}> <Menu.SubMenu
key={item.key || `item-group-${indexA}`}
title={compile(item.title)}
popupClassName={lessStyle.menuItemGroup}
>
{renderItems(item.children)} {renderItems(item.children)}
</Menu.SubMenu> </Menu.SubMenu>
) )
@ -158,6 +163,7 @@ SchemaInitializer.Item = (props: SchemaInitializerItemProps) => {
eventKey={item.key || `item-group-${indexA}`} eventKey={item.key || `item-group-${indexA}`}
key={item.key || `item-group-${indexA}`} key={item.key || `item-group-${indexA}`}
title={compile(item.title)} title={compile(item.title)}
className={lessStyle.menuItemGroup}
> >
{renderMenuItem(item.children)} {renderMenuItem(item.children)}
</Menu.ItemGroup> </Menu.ItemGroup>

View File

@ -0,0 +1,4 @@
.menuItemGroup {
max-height: 60vh;
overflow: auto;
}