|
| 1 | +import { Typography } from 'antd'; |
| 2 | +import classNames from 'classnames'; |
1 | 3 | import React, { memo } from 'react'; |
2 | 4 | import IconView from '../IconView'; |
3 | | -import classNames from 'classnames'; |
4 | 5 | import './index.less'; |
5 | 6 |
|
| 7 | +const { Text, Paragraph } = Typography; |
| 8 | + |
6 | 9 | export default memo((props: any) => { |
7 | 10 | const { className, onClick, children, icon, title, desc, hideDesc } = props; |
8 | 11 |
|
9 | 12 | return ( |
10 | | - <div className={classNames('custom-node-container', { [className]: !!className })} onClick={onClick}> |
11 | | - <div className='node-title'> |
12 | | - <span className='icon-box' style={{ background: icon?.bgColor }}><IconView {...icon} /></span> |
13 | | - <span style={{ marginLeft: '8px' }}>{title}</span> |
| 13 | + <div |
| 14 | + className={classNames('custom-node-container', { |
| 15 | + [className]: !!className, |
| 16 | + })} |
| 17 | + onClick={onClick} |
| 18 | + > |
| 19 | + <div className="node-title"> |
| 20 | + <span className="icon-box" style={{ background: icon?.bgColor }}> |
| 21 | + <IconView {...icon} /> |
| 22 | + </span> |
| 23 | + {/* <span style={{ marginLeft: '8px' }}>{title}</span> */} |
| 24 | + <Text |
| 25 | + style={{ width: 188, marginLeft: '8px' }} |
| 26 | + ellipsis={{ tooltip: title }} |
| 27 | + > |
| 28 | + {title} |
| 29 | + </Text> |
14 | 30 | </div> |
15 | | - <div className='node-body'>{children}</div> |
16 | | - {(!hideDesc && !!desc) && ( |
17 | | - <div className='node-desc'> |
| 31 | + <div className="node-body">{children}</div> |
| 32 | + {/* {!hideDesc && !!desc && <div className="node-desc">{desc}</div>} */} |
| 33 | + {!hideDesc && !!desc && ( |
| 34 | + <Paragraph |
| 35 | + ellipsis={{ |
| 36 | + rows: 2, |
| 37 | + tooltip: { title: desc, placement: 'topRight' }, |
| 38 | + }} |
| 39 | + className="node-desc" |
| 40 | + > |
18 | 41 | {desc} |
19 | | - </div> |
| 42 | + </Paragraph> |
20 | 43 | )} |
| 44 | + {/* 在这里的节点下方添加一个自定义组件 */} |
21 | 45 | </div> |
22 | 46 | ); |
23 | | -}) |
24 | | - |
25 | | - |
| 47 | +}); |
0 commit comments