cfel-base-components 0.0.10 → 0.0.12

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.
@@ -5,7 +5,16 @@ import Layout from '../../src/components/layout';
5
5
 
6
6
  const App = () => {
7
7
  return (
8
- < Layout appName="123123" productCode="lios-iot-wifi">
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
+ switchTenantUrl: "https:\/\/cfel-sso-daily.chengfengerlai.com\/tenant\/switch?fakeAccountId=1676424765496406018\u0026redirect=http:\/\/lios-iot-obee-daily.chengfengerlai.com\/sso\/login?back=http%3A%2F%2Flios-iot-obee-daily.chengfengerlai.com%2Fweb",
14
+ // role:["超级管理员","超管","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123","子管理员","超级管理员","超级管理员123超级管理员123超级管理员123超级管理员123","子管理员"]
15
+ // role:["超级管理员"]
16
+ }}
17
+ >
9
18
 
10
19
  </Layout >
11
20
 
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r="object"==typeof exports?t(require("react")):t(e.React);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(self,(e=>(()=>{"use strict";var t={787:t=>{t.exports=e}},r={};var o={};return function e(o){var f=r[o];if(void 0!==f)return f.exports;var p=r[o]={exports:{}};return t[o](p,p.exports,e),p.exports}(787),o.default})()));
@@ -0,0 +1,2 @@
1
+ body{margin:0}.lios-header{height:48px;background:white;z-index:1;box-shadow:1px 0px 5px #ccc;position:relative;display:flex;justify-content:flex-start;align-items:center}.lios-header .background{width:800px;height:100%;position:absolute;top:0;right:0;overflow:hidden}.lios-header .background .background-img{width:800px;position:absolute;top:-65px}.lios-header .background .background-mask{position:absolute;left:0;top:0;width:100%;height:100%;background:linear-gradient(to right, #fff, rgba(255,255,255,0))}.lios-header .lios-header-fill{flex:1}.lios-header .lios-logo{left:48px;top:0;width:255px;position:absolute;z-index:1;display:inline-flex;align-items:center}.lios-header .lios-logo .img{color:#1677ff;font-size:20px;line-height:48px;font-family:Lucida Calligraphy, cursive, serif, sans-serif;margin-right:12px}.lios-header .lios-logo .interval{color:rgba(0,0,0,0.1);width:1px;height:12px;background-color:rgba(0,0,0,0.1);margin:8px}.lios-header .lios-logo .app-list .app-list-current{font-size:12px;height:24px;line-height:24px;padding:0 12px;border-radius:6px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';cursor:pointer;transition:all 0.3s;color:rgba(0,0,0,0.88);font-weight:400}.lios-header .lios-logo .app-list .app-list-current:hover{background:rgba(0,0,0,0.1)}.lios-header .lios-header-actions{display:flex;justify-content:flex-start;align-items:center;height:100%;max-width:300px;z-index:2}.lios-header .lios-header-actions .actions-item{height:36px;border-radius:6px;transition:all .3s;cursor:pointer;margin:0 4px;padding:0 12px;display:flex;justify-content:center;align-items:center}.lios-header .lios-header-actions .actions-item:hover{background:rgba(255,255,255,0.15)}.lios-header .lios-header-user{height:40px;display:flex;justify-content:flex-start;align-items:center;z-index:2;transition:all .3s;padding:0 12px;margin:0 12px;border-radius:6px;cursor:pointer}.lios-header .lios-header-user:hover{background:rgba(255,255,255,0.15)}.lios-header .lios-header-user .author{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,0.3);margin-right:12px}.lios-header .lios-header-user .name{color:white}.lios-main{display:flex;height:100%}.lios-side{max-width:255px;height:calc(100vh - 48px);background:white;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding-top:12px}.lios-content{width:100%;height:calc(100vh - 48px);overflow-y:auto;padding:16px 16px 5px;display:flex;flex-direction:column}.lios-user-card{min-width:182px;max-width:262px}.lios-user-card .user-info{display:flex;margin-bottom:12px}.lios-user-card .user-info .author{width:72px;height:72px;border-radius:50%;background:rgba(255,255,255,0.3);margin-right:12px}.lios-user-card .user-info .user-info-right{flex:1}.lios-user-card .user-info .name{display:inline-block;margin-top:18px}.lios-user-card .user-info .role-list{font-size:12px;line-height:16px;margin-top:4px}.lios-user-card .user-info .role-list .role-item{background:rgba(204,204,204,0.55);padding:2px 8px;border-radius:8px;display:inline-block;margin-right:4px;margin-bottom:4px}.lios-user-card .lios-tenant{margin-bottom:12px}.lios-user-card .lios-tenant .tenant-label{font-size:12px;color:rgba(0,0,0,0.65)}.lios-user-card .lios-tenant .tenant-switch{display:flex}.lios-user-card .lios-tenant .tenant-switch .tenant-value{flex:1;font-size:14px;color:rgba(0,0,0,0.85)}.lios-user-card .lios-tenant .tenant-switch .tenant-icon{width:40px;text-align:center;color:rgba(0,0,0,0.45);display:flex;justify-content:center;align-items:center}.lios-user-card .lios-tenant .tenant-switch .tenant-icon:hover{cursor:pointer;color:rgba(0,0,0,0.85)}.lios-user-card .lios-logout{cursor:pointer;display:flex;justify-content:center;align-items:center;color:rgba(0,0,0,0.45);border-radius:4px;transition:background .3s;padding:4px}.lios-user-card .lios-logout:hover{background:rgba(0,0,0,0.08)}.lios-user-card .lios-logout .logout-icon{width:16px;height:16px;margin-right:8px}.app-list-other .product-list-item{display:flex;justify-content:flex-start;align-items:center;margin:8px 0;padding:6px 12px;cursor:pointer;border-radius:4px;transition:all .3s;color:rgba(0,0,0,0.65)}.app-list-other .product-list-item:hover{background:rgba(22,119,255,0.08);color:rgba(22,119,255,0.8)}.app-list-other .product-list-item img{width:32px;height:32px;margin-right:12px}.app-list-other .current-product{color:#1677FF !important}
2
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -0,0 +1,10 @@
1
+ // @ts-nocheck
2
+ // This file is generated by Umi automatically
3
+ // DO NOT CHANGE IT MANUALLY!
4
+ import React from 'react';
5
+ import { HelmetProvider } from '/Users/wujingang/Desktop/workspace/base-components/node_modules/@umijs/renderer-react';
6
+ import { context } from './helmetContext';
7
+
8
+ export const innerProvider = (container) => {
9
+ return React.createElement(HelmetProvider, { context }, container);
10
+ }
@@ -0,0 +1,4 @@
1
+ // @ts-nocheck
2
+ // This file is generated by Umi automatically
3
+ // DO NOT CHANGE IT MANUALLY!
4
+ export const context = {};
@@ -169,12 +169,12 @@ body {
169
169
 
170
170
  //用户卡片
171
171
  .lios-user-card {
172
- width: 182px;
172
+ min-width: 182px;
173
+ max-width: 262px;
173
174
 
174
175
  .user-info {
175
176
  display: flex;
176
- justify-content: flex-start;
177
- align-items: center;
177
+ // justify-content: flex-start;
178
178
  margin-bottom: 12px;
179
179
 
180
180
  .author {
@@ -185,20 +185,59 @@ body {
185
185
  margin-right: 12px;
186
186
  }
187
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
+ }
188
210
  }
189
211
 
190
212
  .lios-tenant {
213
+ margin-bottom: 12px;
214
+
191
215
  .tenant-label {
192
216
  font-size: 12px;
193
217
  color: rgba(0, 0, 0, .65);
194
218
  }
195
-
196
- .tenant-value {
197
- font-size: 14px;
198
- color: rgba(0, 0, 0, .85);
219
+ .tenant-switch{
220
+ display: flex;
221
+ .tenant-value {
222
+ flex: 1;
223
+ font-size: 14px;
224
+ color: rgba(0, 0, 0, .85);
225
+ }
226
+ .tenant-icon{
227
+ width: 40px;
228
+ text-align: center;
229
+ color: rgba(0, 0, 0, .45);
230
+ display: flex;
231
+ justify-content: center;
232
+ align-items: center;
233
+ }
234
+ .tenant-icon:hover{
235
+ cursor: pointer;
236
+ color: rgba(0, 0, 0, .85);
237
+ }
199
238
  }
239
+
200
240
 
201
- margin-bottom: 12px;
202
241
  }
203
242
 
204
243
 
@@ -247,6 +286,7 @@ body {
247
286
 
248
287
  img {
249
288
  width: 32px;
289
+ height: 32px;
250
290
  margin-right: 12px;
251
291
  }
252
292
  }
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from 'react'
2
2
  import { Layout, Menu, MenuProps, Popover } from 'antd';
3
+ import { SwapOutlined, } from '@ant-design/icons';
3
4
  import "./index.scss"
4
5
 
5
6
  export interface LiosLayoutlProps {
@@ -13,9 +14,11 @@ export interface LiosLayoutlProps {
13
14
  user?: {
14
15
  name: string,
15
16
  avatar: string,
16
- tenantName: string
17
+ tenantName: string,
18
+ role: any[]
17
19
  };
18
- logoutUrl?: string
20
+ logoutUrl?: string,
21
+ switchTenantUrl?: string,
19
22
  defaultOpenKeys?: string[],
20
23
  productList?: any[],
21
24
  }
@@ -30,6 +33,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
30
33
  actions,
31
34
  user,
32
35
  logoutUrl,
36
+ switchTenantUrl,
33
37
  defaultOpenKeys,
34
38
  productList
35
39
  } = props
@@ -38,6 +42,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
38
42
  name,
39
43
  avatar,
40
44
  tenantName,
45
+ role,
41
46
  } = user || {}
42
47
  const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
43
48
 
@@ -52,14 +57,28 @@ export default function LiosLayout(props: LiosLayoutlProps) {
52
57
  className="author"
53
58
  src={avatar}
54
59
  />
55
- <div className="name">
56
- {name}
60
+ <div className='user-info-right'>
61
+ <span className='name'>{name}</span>
62
+ <div className='role-list'>
63
+ {role?.map((i) => <span className='role-item' key={i}>
64
+ {i}
65
+ </span>)}
66
+ </div>
57
67
  </div>
58
68
  </div>
59
69
 
60
70
  {tenantName && <div className='lios-tenant'>
61
71
  <div className='tenant-label'>租户</div>
62
- <div className='tenant-value'>{tenantName}</div>
72
+ <div className='tenant-switch'>
73
+ <div className='tenant-value'>{tenantName}</div>
74
+ {
75
+ switchTenantUrl && <div className='tenant-icon' onClick={() => {
76
+ location.href = switchTenantUrl;
77
+ }}>
78
+ <SwapOutlined />
79
+ </div>
80
+ }
81
+ </div>
63
82
  </div>}
64
83
 
65
84
  {logoutUrl && <div className='lios-logout' onClick={() => {