Skip to content

Commit 523afed

Browse files
author
昔梦
committed
菜单描述气泡优化
1 parent 31fa72c commit 523afed

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

packages/x-flow/src/components/NodeContainer/index.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Popover, Tooltip, Typography } from 'antd';
1+
import { Popover, Typography } from 'antd';
22
import classNames from 'classnames';
33
import React, { memo, useMemo } from 'react';
44
import createIconFont from '../../utils/createIconFont';
@@ -18,7 +18,7 @@ export default memo((props: any) => {
1818
hideDesc,
1919
NodeWidget,
2020
iconFontUrl,
21-
iconSvg
21+
iconSvg,
2222
} = props;
2323
const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]);
2424
return (
@@ -28,14 +28,16 @@ export default memo((props: any) => {
2828
})}
2929
onClick={onClick}
3030
>
31-
<div className='node-title'>
31+
<div className="node-title">
3232
<Popover
33-
title={<MenuTooltip {...props} />}
34-
placement='bottomLeft'
35-
trigger='click'
36-
getPopupContainer={() => document.getElementById('xflow-container') as HTMLElement}
33+
content={<MenuTooltip {...props} />}
34+
placement="bottomLeft"
35+
trigger="hover"
36+
getPopupContainer={() =>
37+
document.getElementById('xflow-container') as HTMLElement
38+
}
3739
>
38-
<Tooltip
40+
{/* <Tooltip
3941
title='点击图标查看节点信息'
4042
arrow={false}
4143
placement='topLeft'
@@ -45,11 +47,11 @@ export default memo((props: any) => {
4547
fontSize: '12px',
4648
}}
4749
getPopupContainer={() => document.getElementById('xflow-container') as HTMLElement}
48-
>
49-
<span className='icon-box' style={{ background: icon?.bgColor }}>
50-
{iconSvg ? iconSvg : <IconBox {...icon} /> }
51-
</span>
52-
</Tooltip>
50+
> */}
51+
<span className="icon-box" style={{ background: icon?.bgColor }}>
52+
{iconSvg ? iconSvg : <IconBox {...icon} />}
53+
</span>
54+
{/* </Tooltip> */}
5355
</Popover>
5456
<Text
5557
style={{ width: 188, marginLeft: '8px' }}
@@ -62,16 +64,17 @@ export default memo((props: any) => {
6264
color: '#354052',
6365
fontSize: '12px',
6466
},
65-
getPopupContainer:() => document.getElementById('xflow-container') as HTMLElement
67+
getPopupContainer: () =>
68+
document.getElementById('xflow-container') as HTMLElement,
6669
},
6770
}}
6871
>
6972
{title}
7073
</Text>
7174
</div>
7275

73-
<div className='node-body'>{children}</div>
74-
{NodeWidget && <div className='node-widget'>{NodeWidget}</div>}
76+
<div className="node-body">{children}</div>
77+
{NodeWidget && <div className="node-widget">{NodeWidget}</div>}
7578
{!hideDesc && !!desc && (
7679
<Paragraph
7780
ellipsis={{
@@ -84,10 +87,11 @@ export default memo((props: any) => {
8487
color: '#354052',
8588
fontSize: '12px',
8689
},
87-
getPopupContainer: () => document.getElementById('xflow-container') as HTMLElement
90+
getPopupContainer: () =>
91+
document.getElementById('xflow-container') as HTMLElement,
8892
},
8993
}}
90-
className='node-desc'
94+
className="node-desc"
9195
>
9296
{desc}
9397
</Paragraph>

packages/x-flow/src/components/NodesMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const MenuItem = (props: any) => {
6363
return (
6464
<Popover
6565
key={type}
66-
title={<MenuTooltip {...props} />}
66+
content={<MenuTooltip {...props} />}
6767
placement='right'
6868
arrow={false}
6969
getPopupContainer={() => document.getElementById('xflow-container') as HTMLElement}

0 commit comments

Comments
 (0)