@zjlab-fe/data-hub-ui 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type TagType = 'running' | 'failed' | 'success' | 'stopped' | 'pending';
|
|
3
|
+
type TagVariant = 'filled' | 'bordered' | 'dot';
|
|
3
4
|
interface IProps {
|
|
4
5
|
type?: TagType;
|
|
6
|
+
variant?: TagVariant;
|
|
7
|
+
className?: string;
|
|
5
8
|
children?: React.ReactNode;
|
|
6
9
|
}
|
|
7
10
|
export default function StatusTag(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,30 +1,42 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Tag } from 'antd';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import * as index_module from './index.module.scss.js';
|
|
5
|
+
import { statusDot, statusTag, dot } from './index.module.scss.js';
|
|
3
6
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const statusStyles = {
|
|
8
|
+
filled: {
|
|
9
|
+
running: { color: '#1775fe', backgroundColor: 'rgba(23, 117, 254, 0.1)' },
|
|
10
|
+
failed: { color: '#ff4d4f', backgroundColor: 'rgba(255, 77, 79, 0.1)' },
|
|
11
|
+
success: { color: '#52c41a', backgroundColor: 'rgba(82, 196, 26, 0.1)' },
|
|
12
|
+
stopped: { color: '#545b64', backgroundColor: '#edf2fc' },
|
|
13
|
+
pending: { color: '#fa8c16', backgroundColor: 'rgba(250, 140, 22, 0.1)' },
|
|
14
|
+
},
|
|
15
|
+
dot: {
|
|
16
|
+
running: { color: '#1775fe', dotColor: '#1775fe' },
|
|
17
|
+
failed: { color: '#ff4d4f', dotColor: '#ff4d4f' },
|
|
18
|
+
success: { color: '#52c41a', dotColor: '#52c41a' },
|
|
19
|
+
stopped: { color: 'rgba(0, 0, 0, 0.65)', dotColor: '#d9d9d9' },
|
|
20
|
+
pending: { color: '#fa8c16', dotColor: '#fa8c16' },
|
|
21
|
+
},
|
|
22
|
+
bordered: {
|
|
23
|
+
running: { color: '#1775fe', backgroundColor: '#ecf4ff', borderColor: '#b3d2ff' },
|
|
24
|
+
failed: { color: '#f5222d', backgroundColor: '#fff1f0', borderColor: '#ffa39e' },
|
|
25
|
+
success: { color: '#52c41a', backgroundColor: '#f6ffed', borderColor: '#b7eb8f' },
|
|
26
|
+
stopped: { color: 'rgba(0, 0, 0, 0.25)', backgroundColor: '#f5f5f5', borderColor: '#d9d9d9' },
|
|
27
|
+
pending: { color: '#fa8c16', backgroundColor: '#fff7e6', borderColor: '#fa8c16' },
|
|
28
|
+
},
|
|
10
29
|
};
|
|
11
30
|
function StatusTag(props) {
|
|
12
|
-
const { type = 'running', children } = props;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (jsx(Tag, { bordered: false, style: {
|
|
22
|
-
backgroundColor: `rgba(${hexToRgb(colors)},0.1)`,
|
|
23
|
-
borderRadius: '4px',
|
|
24
|
-
fontSize: '14px',
|
|
25
|
-
color: `${colors}`,
|
|
26
|
-
padding: '3px 8px',
|
|
27
|
-
fontFamily: 'AlibabaPuHuiTi-3-55-RegularL3',
|
|
31
|
+
const { type = 'running', variant = 'filled', className, children } = props;
|
|
32
|
+
const preset = statusStyles[variant][type];
|
|
33
|
+
if (variant === 'dot') {
|
|
34
|
+
return (jsxs("span", { className: classNames(statusTag, dot, className), children: [jsx("span", { className: statusDot, style: { backgroundColor: preset.dotColor } }), jsx("span", { style: { color: preset.color }, children: children })] }));
|
|
35
|
+
}
|
|
36
|
+
return (jsx(Tag, { bordered: variant === 'bordered', className: classNames(statusTag, index_module[variant], className), style: {
|
|
37
|
+
color: preset.color,
|
|
38
|
+
backgroundColor: preset.backgroundColor,
|
|
39
|
+
borderColor: preset.borderColor,
|
|
28
40
|
}, children: children }));
|
|
29
41
|
}
|
|
30
42
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var style = document.createElement('style');
|
|
2
|
+
style.textContent = `.index-module__statusTag___yRGEa {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
margin-inline-end: 0;
|
|
6
|
+
font-family: "AlibabaPuHuiTi-3-55-RegularL3", "PingFang SC", sans-serif;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.index-module__filled___SKjTo {
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
padding: 1px 8px;
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
line-height: 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.index-module__bordered___x7xGX {
|
|
18
|
+
border-radius: 2px;
|
|
19
|
+
padding: 0 8px;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
line-height: 20px;
|
|
22
|
+
border-width: 1px;
|
|
23
|
+
border-style: solid;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.index-module__dot___rbWrB {
|
|
27
|
+
gap: 8px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
line-height: 22px;
|
|
30
|
+
padding: 0;
|
|
31
|
+
background: transparent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.index-module__statusDot___yMpG3 {
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
width: 6px;
|
|
37
|
+
height: 6px;
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
}`;
|
|
40
|
+
document.head.appendChild(style);
|
|
41
|
+
|
|
42
|
+
var statusTag = "index-module__statusTag___yRGEa";var filled = "index-module__filled___SKjTo";var bordered = "index-module__bordered___x7xGX";var dot = "index-module__dot___rbWrB";var statusDot = "index-module__statusDot___yMpG3";
|
|
43
|
+
var styles = {"statusTag":"index-module__statusTag___yRGEa","filled":"index-module__filled___SKjTo","bordered":"index-module__bordered___x7xGX","dot":"index-module__dot___rbWrB","statusDot":"index-module__statusDot___yMpG3"};
|
|
44
|
+
|
|
45
|
+
export { bordered, styles as default, dot, filled, statusDot, statusTag };
|