@yeeyoon/library 3.2.3 → 3.2.7
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.
@@ -0,0 +1,97 @@
|
|
1
|
+
import { Avatar, Popover } from 'antd';
|
2
|
+
import React from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import InfoCard from '../InfoCard';
|
5
|
+
import styles from './style.less';
|
6
|
+
|
7
|
+
const defaultHeadUrl =
|
8
|
+
'https://pro-yeeyoon-fm.oss-cn-zhangjiakou.aliyuncs.com/oidc/user_avatar3.png';
|
9
|
+
const defaultUserStyle = { border: '1px solid #fff' };
|
10
|
+
|
11
|
+
const AvatarInfo = ({
|
12
|
+
icon = defaultHeadUrl,
|
13
|
+
name,
|
14
|
+
placement = 'bottomRight',
|
15
|
+
showName = false,
|
16
|
+
shape,
|
17
|
+
style,
|
18
|
+
showInfo = true, // 是否展示信息卡片
|
19
|
+
size = 30,
|
20
|
+
...rest
|
21
|
+
}) => {
|
22
|
+
const CustomAvatar = (
|
23
|
+
<span>
|
24
|
+
<Avatar
|
25
|
+
size={size}
|
26
|
+
shape={shape}
|
27
|
+
className={styles['user-avatar-scale']}
|
28
|
+
src={icon}
|
29
|
+
style={{ ...defaultUserStyle, ...style }}
|
30
|
+
/>
|
31
|
+
{showName && (
|
32
|
+
<span className={styles['user-avatar-name']}>{name || '-'}</span>
|
33
|
+
)}
|
34
|
+
</span>
|
35
|
+
);
|
36
|
+
|
37
|
+
return showInfo ? (
|
38
|
+
<Popover
|
39
|
+
placement={placement}
|
40
|
+
content={
|
41
|
+
<InfoCard
|
42
|
+
baseMsg={{
|
43
|
+
icon,
|
44
|
+
name,
|
45
|
+
...rest,
|
46
|
+
}}
|
47
|
+
style={{ width: 334, height: 382 }} // 给定宽高 防止Popover第一次出现时闪跳
|
48
|
+
/>
|
49
|
+
}
|
50
|
+
>
|
51
|
+
{CustomAvatar}
|
52
|
+
</Popover>
|
53
|
+
) : (
|
54
|
+
CustomAvatar
|
55
|
+
);
|
56
|
+
};
|
57
|
+
|
58
|
+
// data: {name, id, phone, icon} 或 [{name, id, phone, icon}]
|
59
|
+
const AvatarPackaged = ({ data, maxCount = 5, maxStyle, ...rest }) => {
|
60
|
+
return Array.isArray(data) ? (
|
61
|
+
<Avatar.Group
|
62
|
+
maxCount={maxCount}
|
63
|
+
maxStyle={
|
64
|
+
maxStyle || {
|
65
|
+
color: '#5E5873',
|
66
|
+
backgroundColor: '#FFF',
|
67
|
+
marginBottom: '5px',
|
68
|
+
}
|
69
|
+
}
|
70
|
+
>
|
71
|
+
{data.map((x, i) => (
|
72
|
+
<AvatarInfo key={i} {...rest} {...x} />
|
73
|
+
))}
|
74
|
+
</Avatar.Group>
|
75
|
+
) : data ? (
|
76
|
+
<AvatarInfo {...rest} {...data} />
|
77
|
+
) : null;
|
78
|
+
};
|
79
|
+
|
80
|
+
AvatarInfo.propTypes = {
|
81
|
+
icon: PropTypes.string,
|
82
|
+
name: PropTypes.string,
|
83
|
+
showName: PropTypes.bool,
|
84
|
+
placement: PropTypes.string,
|
85
|
+
shape: PropTypes.string,
|
86
|
+
size: PropTypes.number,
|
87
|
+
style: PropTypes.object,
|
88
|
+
showInfo: PropTypes.bool,
|
89
|
+
};
|
90
|
+
|
91
|
+
AvatarPackaged.propTypes = {
|
92
|
+
data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
93
|
+
maxCount: PropTypes.number,
|
94
|
+
maxStyle: PropTypes.object,
|
95
|
+
};
|
96
|
+
|
97
|
+
export default AvatarPackaged;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.user-avatar-scale {
|
2
|
+
&:hover {
|
3
|
+
transform: scale(1.2);
|
4
|
+
}
|
5
|
+
}
|
6
|
+
.user-avatar-name {
|
7
|
+
color: #6e6b7b;
|
8
|
+
margin-left: 7px;
|
9
|
+
&:hover {
|
10
|
+
color: @primary-color;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
:global {
|
14
|
+
.ant-list:not(.ant-list-lg):not(.ant-list-sm) .ant-list-item {
|
15
|
+
padding: 12px 0px !important;
|
16
|
+
}
|
17
|
+
.ant-progress-text {
|
18
|
+
font-size: 0.7em;
|
19
|
+
}
|
20
|
+
}
|
@@ -7,7 +7,7 @@ import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
7
7
|
import { queryOidcUserCardData } from './service';
|
8
8
|
|
9
9
|
function InfoCart(props) {
|
10
|
-
const { baseMsg } = props;
|
10
|
+
const { baseMsg, ...rest } = props;
|
11
11
|
const reg = /^(\d{3})\d*(\d{4})$/;
|
12
12
|
const [cardData, setCardData] = useState({});
|
13
13
|
const [chartData, setChartData] = useState({});
|
@@ -70,7 +70,7 @@ function InfoCart(props) {
|
|
70
70
|
}
|
71
71
|
};
|
72
72
|
return (
|
73
|
-
<div className={styles['info-cart-content']}>
|
73
|
+
<div className={styles['info-cart-content']} {...rest}>
|
74
74
|
<div className={styles['info-cart-base']}>
|
75
75
|
<Image
|
76
76
|
width="50px"
|
@@ -120,7 +120,7 @@ function InfoCart(props) {
|
|
120
120
|
type="monotone"
|
121
121
|
dataKey="贡献数据数"
|
122
122
|
stroke="#7367F0"
|
123
|
-
strokeWidth="
|
123
|
+
strokeWidth="2"
|
124
124
|
dot={false}
|
125
125
|
/>
|
126
126
|
<Tooltip cursor={false} />
|
package/lib/utils/utils.js
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import UserAvatar from '../components/AvatarPackaged/';
|
3
|
+
|
1
4
|
export function mergeTableColumnCommonConfig(config) {
|
2
5
|
return config.map((item, index) => {
|
3
6
|
let commonConfig = [{ align: 'left' }, { ellipsis: true }];
|
@@ -68,6 +71,27 @@ export function mergeTableColumnCommonConfig(config) {
|
|
68
71
|
...[{ width: 300 }, { ellipsis: false }],
|
69
72
|
];
|
70
73
|
break;
|
74
|
+
case 'user':
|
75
|
+
commonConfig = [
|
76
|
+
...commonConfig,
|
77
|
+
...[
|
78
|
+
{ width: 150 },
|
79
|
+
{
|
80
|
+
// eslint-disable-next-line react/display-name
|
81
|
+
render: (_, record) => {
|
82
|
+
const key = item.dataIndex;
|
83
|
+
let data;
|
84
|
+
if (key === 'creator') {
|
85
|
+
data = record.creator;
|
86
|
+
} else if (key === 'updater') {
|
87
|
+
data = record.updater;
|
88
|
+
}
|
89
|
+
return <UserAvatar data={data} showName={true} />;
|
90
|
+
},
|
91
|
+
},
|
92
|
+
],
|
93
|
+
];
|
94
|
+
break;
|
71
95
|
}
|
72
96
|
commonConfig.forEach((value) => {
|
73
97
|
item = { ...item, ...value };
|
package/package.json
CHANGED
package/src/global.css
CHANGED
package/src/pages/index.js
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react';
|
2
2
|
import Header from '../../lib/components/Header/';
|
3
|
+
import TenantSelector from '../../lib/components/TenantSelector';
|
3
4
|
|
4
5
|
// eslint-disable-next-line react/display-name
|
5
6
|
export default function () {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
return (
|
8
|
+
<>
|
9
|
+
<Header productName="bpm" slot={<div>nasa</div>} />
|
10
|
+
<TenantSelector
|
11
|
+
tenantId="b7b0e19414927b878814094f33b43543"
|
12
|
+
appId="bbe5c8f0063711ecb0c00c42a1ff8370"
|
13
|
+
tenantIdChangeCb={() => {}}
|
14
|
+
/>
|
15
|
+
</>
|
16
|
+
);
|
14
17
|
}
|