@yeeyoon/library 3.2.8 → 3.3.2

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 = defaultHeadUrl,
12
+ icon,
13
+ id,
13
14
  name,
14
15
  placement = 'bottomRight',
15
16
  showName = false,
@@ -17,30 +18,46 @@ const AvatarInfo = ({
17
18
  style,
18
19
  showInfo = true, // 是否展示信息卡片
19
20
  size = 30,
21
+ mode,
20
22
  ...rest
21
23
  }) => {
22
- const CustomAvatar = (
23
- <span>
24
+ const CustomAvatar =
25
+ mode === 'group' ? (
24
26
  <Avatar
25
27
  size={size}
26
28
  shape={shape}
27
29
  className={styles['user-avatar-scale']}
28
- src={icon}
30
+ src={icon || defaultHeadUrl}
29
31
  style={{ ...defaultUserStyle, ...style }}
30
32
  />
31
- {showName && (
32
- <span className={styles['user-avatar-name']}>{name || '-'}</span>
33
- )}
34
- </span>
35
- );
33
+ ) : (
34
+ <span>
35
+ {icon || name || id ? (
36
+ <Avatar
37
+ size={size}
38
+ shape={shape}
39
+ className={styles['user-avatar-scale']}
40
+ src={icon || defaultHeadUrl}
41
+ style={{ ...defaultUserStyle, ...style }}
42
+ />
43
+ ) : null}
44
+ {showName &&
45
+ (icon || name || id ? (
46
+ <span className={styles['user-avatar-name']}>{name || '-'}</span>
47
+ ) : (
48
+ '-'
49
+ ))}
50
+ </span>
51
+ );
36
52
 
37
- return showInfo ? (
53
+ return showInfo && id ? (
38
54
  <Popover
39
55
  placement={placement}
40
56
  content={
41
57
  <InfoCard
42
58
  baseMsg={{
43
59
  icon,
60
+ id,
44
61
  name,
45
62
  ...rest,
46
63
  }}
@@ -69,7 +86,7 @@ const AvatarPackaged = ({ data, maxCount = 5, maxStyle, ...rest }) => {
69
86
  }
70
87
  >
71
88
  {data.map((x, i) => (
72
- <AvatarInfo key={i} {...rest} {...x} />
89
+ <AvatarInfo key={i} {...rest} {...x} mode="group" />
73
90
  ))}
74
91
  </Avatar.Group>
75
92
  ) : data ? (
@@ -79,10 +96,12 @@ const AvatarPackaged = ({ data, maxCount = 5, maxStyle, ...rest }) => {
79
96
 
80
97
  AvatarInfo.propTypes = {
81
98
  icon: PropTypes.string,
99
+ id: PropTypes.string,
82
100
  name: PropTypes.string,
83
101
  showName: PropTypes.bool,
84
102
  placement: PropTypes.string,
85
103
  shape: PropTypes.string,
104
+ mode: PropTypes.string,
86
105
  size: PropTypes.number,
87
106
  style: PropTypes.object,
88
107
  showInfo: PropTypes.bool,
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "3.2.8",
3
+ "version": "3.3.2",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {
package/src/global.css CHANGED
@@ -4,7 +4,7 @@ html, body, #root {
4
4
 
5
5
  body {
6
6
  margin: 0;
7
- /* background-color: #000 !important; */
7
+ background-color: #000 !important;
8
8
  }
9
9
 
10
10
  body * {
@@ -1,17 +1,14 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import Header from '../../lib/components/Header/';
3
- import TenantSelector from '../../lib/components/TenantSelector';
4
3
 
5
4
  // eslint-disable-next-line react/display-name
6
5
  export default function () {
7
- return (
8
- <>
9
- <Header productName="bpm" slot={<div>nasa</div>} />
10
- <TenantSelector
11
- tenantId="b7b0e19414927b878814094f33b43543"
12
- appId="bbe5c8f0063711ecb0c00c42a1ff8370"
13
- tenantIdChangeCb={() => {}}
14
- />
15
- </>
16
- );
6
+ const [tenantId, setTenantId] = useState('');
7
+ useEffect(() => {
8
+ setTimeout(() => {
9
+ setTenantId('053a033a063711ecb0c00c42a1ff8370');
10
+ // setTenantId('f12a71b6063611ecb0c00c42a1ff8370');
11
+ }, 3000);
12
+ }, []);
13
+ return <Header productName="bpm" tenantId={tenantId} />;
17
14
  }