forked from ModelEngine-Group/fit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJadePanelHeader.jsx
More file actions
60 lines (56 loc) · 2.08 KB
/
JadePanelHeader.jsx
File metadata and controls
60 lines (56 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
* This file is a part of the ModelEngine Project.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import PropTypes from 'prop-types';
import {Button, Popover} from 'antd';
import {PlusOutlined, QuestionCircleOutlined} from '@ant-design/icons';
import React from 'react';
import {useTranslation} from 'react-i18next';
/**
* panel的header.
*
* @param text 文本.
* @param tips 提示.
* @param shapeStatus 图形状态.
* @param onClick 点击事件.
* @param editable 是否可编辑.
* @return {JSX.Element}
* @constructor
*/
export const JadePanelHeader = ({text, tips, shapeStatus, onClick, editable = true}) => {
const {t} = useTranslation();
return (<>
<div className='panel-header'>
<span className='jade-panel-header-font'>{t(text)}</span>
{tips && <Popover
content={tips}
align={{offset: [0, 3]}}
overlayClassName={'jade-custom-popover'}
>
<QuestionCircleOutlined className="jade-panel-header-popover-content"/>
</Popover>
}
{
editable ? (<>
<Button disabled={shapeStatus.disabled}
type='text' className='icon-button jade-panel-header-icon-position'
onClick={(event) => {
onClick(event);
event.stopPropagation();
}}>
<PlusOutlined/>
</Button>
</>) : null
}
</div>
</>);
};
JadePanelHeader.propTypes = {
text: PropTypes.string.isRequired,
tips: PropTypes.object,
shapeStatus: PropTypes.object.isRequired,
onClick: PropTypes.func,
editable: PropTypes.bool,
};