@yeeyoon/library 3.2.6 → 3.3.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.
@@ -9,7 +9,8 @@ const defaultHeadUrl =
|
|
9
9
|
const defaultUserStyle = { border: '1px solid #fff' };
|
10
10
|
|
11
11
|
const AvatarInfo = ({
|
12
|
-
icon
|
12
|
+
icon,
|
13
|
+
id,
|
13
14
|
name,
|
14
15
|
placement = 'bottomRight',
|
15
16
|
showName = false,
|
@@ -21,26 +22,32 @@ const AvatarInfo = ({
|
|
21
22
|
}) => {
|
22
23
|
const CustomAvatar = (
|
23
24
|
<span>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
{icon || name || id ? (
|
26
|
+
<Avatar
|
27
|
+
size={size}
|
28
|
+
shape={shape}
|
29
|
+
className={styles['user-avatar-scale']}
|
30
|
+
src={icon || defaultHeadUrl}
|
31
|
+
style={{ ...defaultUserStyle, ...style }}
|
32
|
+
/>
|
33
|
+
) : null}
|
34
|
+
{showName &&
|
35
|
+
(icon || name || id ? (
|
36
|
+
<span className={styles['user-avatar-name']}>{name || '-'}</span>
|
37
|
+
) : (
|
38
|
+
'-'
|
39
|
+
))}
|
34
40
|
</span>
|
35
41
|
);
|
36
42
|
|
37
|
-
return showInfo ? (
|
43
|
+
return showInfo && id ? (
|
38
44
|
<Popover
|
39
45
|
placement={placement}
|
40
46
|
content={
|
41
47
|
<InfoCard
|
42
48
|
baseMsg={{
|
43
49
|
icon,
|
50
|
+
id,
|
44
51
|
name,
|
45
52
|
...rest,
|
46
53
|
}}
|
@@ -79,6 +86,7 @@ const AvatarPackaged = ({ data, maxCount = 5, maxStyle, ...rest }) => {
|
|
79
86
|
|
80
87
|
AvatarInfo.propTypes = {
|
81
88
|
icon: PropTypes.string,
|
89
|
+
id: PropTypes.string,
|
82
90
|
name: PropTypes.string,
|
83
91
|
showName: PropTypes.bool,
|
84
92
|
placement: PropTypes.string,
|
@@ -6,6 +6,8 @@ import PropTypes from 'prop-types';
|
|
6
6
|
import { QuestionCircleOutlined } from '@ant-design/icons';
|
7
7
|
import { queryOidcUserCardData } from './service';
|
8
8
|
|
9
|
+
const defaultHeadUrl =
|
10
|
+
'https://pro-yeeyoon-fm.oss-cn-zhangjiakou.aliyuncs.com/oidc/user_avatar3.png';
|
9
11
|
function InfoCart(props) {
|
10
12
|
const { baseMsg, ...rest } = props;
|
11
13
|
const reg = /^(\d{3})\d*(\d{4})$/;
|
@@ -77,7 +79,7 @@ function InfoCart(props) {
|
|
77
79
|
height="50px"
|
78
80
|
preview={false}
|
79
81
|
style={{ borderRadius: '5px' }}
|
80
|
-
src={baseMsg?.headUrl || baseMsg?.icon}
|
82
|
+
src={baseMsg?.headUrl || baseMsg?.icon || defaultHeadUrl}
|
81
83
|
/>
|
82
84
|
<div className={styles['info-cart-np']}>
|
83
85
|
<span>{baseMsg?.name}</span>
|
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 };
|