cfel-base-components 0.0.9 → 0.0.11

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,28 +1,23 @@
1
1
  import React from "react"
2
2
  import { createRoot } from 'react-dom/client';
3
- import { WidthAutoLabel } from '../../src/index'; // 引入组件
4
3
  import './index.scss';
5
- // import WidthAutoLabel from 'text-width-auto-label';
4
+ import Layout from '../../src/components/layout';
6
5
 
7
6
  const App = () => {
8
7
  return (
9
- <div className="container">
10
- <div className="text">
11
- <p>示例文本:</p><p>文本宽度自适应标签组件</p>
12
- </div>
13
- <div className="normal">
14
- <p>宽度100px:</p><p>文本宽度自适应标签组件</p>
15
- </div>
16
- <div className="style1">
17
- <p>宽度100px:</p><p><WidthAutoLabel>文本宽度自适应标签组件</WidthAutoLabel></p>
18
- </div>
19
- <div className="style2">
20
- <p>宽度80px:</p><p><WidthAutoLabel>文本宽度自适应标签组件</WidthAutoLabel></p>
21
- </div>
22
- <div className="style3">
23
- <p>宽度50px:</p><p><WidthAutoLabel>文本宽度自适应标签组件</WidthAutoLabel></p>
24
- </div>
25
- </div>
8
+ < Layout appName="123123" productCode="lios-iot-wifi"
9
+ user={{
10
+ name: "\u5434\u6668\u61CB\uFF08\u592A\u4E00\uFF09",
11
+ avatar: "https:\/\/static-legacy.dingtalk.com\/media\/lQLPM5AkqOufBy7NAyDNAyCwJZ592czMOC4EeIgNJAAGAA_800_800.png",
12
+ tenantName: "\u8FDC\u822A\u8DE8\u56FD\u63A7\u80A1\u96C6\u56E2",
13
+ role:["超级管理员","超管","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123超级管理员123超级管理员123超级管理员123","子管理员"]
14
+ // role:["超级管理员"]
15
+ }}
16
+ >
17
+
18
+ </Layout >
19
+
20
+
26
21
  );
27
22
  }
28
23
  const container = document.getElementById('root');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -66,7 +66,7 @@ body {
66
66
  }
67
67
 
68
68
  .app-list {
69
- .current {
69
+ .app-list-current {
70
70
  font-size: 12px;
71
71
  height: 24px;
72
72
  line-height: 24px;
@@ -81,9 +81,10 @@ body {
81
81
  font-weight: 400;
82
82
  }
83
83
 
84
- .current:hover {
84
+ .app-list-current:hover {
85
85
  background: rgba(0, 0, 0, 0.1);
86
86
  }
87
+
87
88
  }
88
89
  }
89
90
 
@@ -168,12 +169,12 @@ body {
168
169
 
169
170
  //用户卡片
170
171
  .lios-user-card {
171
- width: 182px;
172
+ min-width: 182px;
173
+ max-width: 262px;
172
174
 
173
175
  .user-info {
174
176
  display: flex;
175
- justify-content: flex-start;
176
- align-items: center;
177
+ // justify-content: flex-start;
177
178
  margin-bottom: 12px;
178
179
 
179
180
  .author {
@@ -183,10 +184,34 @@ body {
183
184
  background: rgba(255, 255, 255, 0.3);
184
185
  margin-right: 12px;
185
186
  }
186
-
187
+
188
+ .user-info-right{
189
+ flex: 1;
190
+ }
191
+
192
+ .name {
193
+ display: inline-block;
194
+ margin-top: 18px;
195
+ }
196
+
197
+ .role-list {
198
+ font-size: 12px;
199
+ line-height: 16px;
200
+ margin-top: 4px;
201
+ .role-item {
202
+ background: rgba(204, 204, 204, .55);
203
+ padding: 2px 8px;
204
+ border-radius: 8px;
205
+ display: inline-block;
206
+ margin-right: 4px;
207
+ margin-bottom: 4px;
208
+ }
209
+ }
187
210
  }
188
211
 
189
212
  .lios-tenant {
213
+ margin-bottom: 12px;
214
+
190
215
  .tenant-label {
191
216
  font-size: 12px;
192
217
  color: rgba(0, 0, 0, .65);
@@ -197,7 +222,6 @@ body {
197
222
  color: rgba(0, 0, 0, .85);
198
223
  }
199
224
 
200
- margin-bottom: 12px;
201
225
  }
202
226
 
203
227
 
@@ -221,4 +245,37 @@ body {
221
245
  margin-right: 8px;
222
246
  }
223
247
  }
248
+ }
249
+
250
+
251
+
252
+ .app-list-other {
253
+
254
+ .product-list-item {
255
+ display: flex;
256
+ justify-content: flex-start;
257
+ align-items: center;
258
+ margin: 8px 0;
259
+ padding: 6px 12px;
260
+ cursor: pointer;
261
+ border-radius: 4px;
262
+ transition: all .3s;
263
+ color: rgba(0, 0, 0, .65);
264
+
265
+
266
+ &:hover {
267
+ background: rgba(22, 119, 255, .08);
268
+ color: rgba(22, 119, 255, .8);
269
+ }
270
+
271
+ img {
272
+ width: 32px;
273
+ height: 32px;
274
+ margin-right: 12px;
275
+ }
276
+ }
277
+
278
+ .current-product {
279
+ color: #1677FF !important;
280
+ }
224
281
  }
@@ -4,6 +4,7 @@ import "./index.scss"
4
4
 
5
5
  export interface LiosLayoutlProps {
6
6
  appName: string;
7
+ productCode: string;
7
8
  children: any;
8
9
  menuList: any;
9
10
  onMenuClick: (item: any) => void;
@@ -12,28 +13,33 @@ export interface LiosLayoutlProps {
12
13
  user?: {
13
14
  name: string,
14
15
  avatar: string,
15
- tenantName: string
16
+ tenantName: string,
17
+ role: any[]
16
18
  };
17
19
  logoutUrl?: string
18
- defaultOpenKeys?: string[]
20
+ defaultOpenKeys?: string[],
21
+ productList?: any[],
19
22
  }
20
23
 
21
24
  export default function LiosLayout(props: LiosLayoutlProps) {
22
25
  const {
23
26
  appName,
27
+ productCode,
24
28
  menuList,
25
29
  onMenuClick,
26
30
  selectedKeys,
27
31
  actions,
28
32
  user,
29
33
  logoutUrl,
30
- defaultOpenKeys
34
+ defaultOpenKeys,
35
+ productList
31
36
  } = props
32
37
 
33
38
  const {
34
39
  name,
35
40
  avatar,
36
41
  tenantName,
42
+ role,
37
43
  } = user || {}
38
44
  const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
39
45
 
@@ -48,8 +54,13 @@ export default function LiosLayout(props: LiosLayoutlProps) {
48
54
  className="author"
49
55
  src={avatar}
50
56
  />
51
- <div className="name">
52
- {name}
57
+ <div className='user-info-right'>
58
+ <span className='name'>{name}</span>
59
+ <div className='role-list'>
60
+ {role?.map((i) => <span className='role-item' key={i}>
61
+ {i}
62
+ </span>)}
63
+ </div>
53
64
  </div>
54
65
  </div>
55
66
 
@@ -67,6 +78,23 @@ export default function LiosLayout(props: LiosLayoutlProps) {
67
78
  </div >
68
79
  }
69
80
 
81
+ const ProductList = () => {
82
+ return <div className='app-list-other'>
83
+ {productList?.map((item) => {
84
+ return <div
85
+ onClick={() => {
86
+ item.productCode != productCode && item?.portalUrl && window.open(item?.portalUrl)
87
+ }}
88
+ key={item.id}
89
+ className={`product-list-item ${item.productCode == productCode ? "current-product" : ""}`}
90
+ >
91
+ <img src={item?.logoUrl || "https://pic.imgdb.cn/item/64c760291ddac507cc68440a.png"} alt="" />
92
+ <div> {item?.productName}</div>
93
+ </div>
94
+ })}
95
+ </div>
96
+ }
97
+
70
98
  return (<Layout>
71
99
  <div className="lios-header">
72
100
 
@@ -81,9 +109,11 @@ export default function LiosLayout(props: LiosLayoutlProps) {
81
109
  </div>
82
110
  <div className="interval" />
83
111
  <div className="app-list">
84
- <div className="current">
85
- {appName}
86
- </div>
112
+ <Popover placement="bottom" content={<ProductList />} arrow={false} trigger="click">
113
+ <div className="app-list-current">
114
+ {appName}
115
+ </div>
116
+ </Popover>
87
117
  </div>
88
118
  </strong>
89
119
  <div className='lios-header-fill' />