cfel-base-components 2.0.15 → 2.1.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.
- package/demo/src/index.jsx +35 -37
- package/demo/src/index.module.less +0 -3
- package/demo/src/index.scss +0 -4
- package/package.json +1 -1
- package/src/components/base-component/PageContainer/index.module.less +1 -1
- package/src/components/layout/index.scss +66 -45
- package/src/components/layout/index.tsx +36 -52
package/demo/src/index.jsx
CHANGED
|
@@ -12,45 +12,43 @@ import CpcRole from '../../src/components/universal-pages/cpcRole';
|
|
|
12
12
|
// import RoleInfo from '../../src/components/universal-pages/roleInfo';
|
|
13
13
|
|
|
14
14
|
const App = () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
return <div >
|
|
16
|
+
<Layout
|
|
17
|
+
appName="控制台"
|
|
18
|
+
productList={false}
|
|
19
|
+
menuList={[
|
|
20
|
+
{
|
|
21
|
+
label: '设备中心',
|
|
22
|
+
key: 'device',
|
|
23
|
+
icon: <SwapOutlined />,
|
|
24
|
+
children: [
|
|
19
25
|
{
|
|
20
|
-
label: '
|
|
21
|
-
key: 'device',
|
|
22
|
-
icon: <SwapOutlined />,
|
|
23
|
-
children: [
|
|
24
|
-
{
|
|
25
|
-
label: '设备管理',
|
|
26
|
-
key: 'device-list',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
26
|
+
label: '设备管理',
|
|
27
|
+
key: 'device-list',
|
|
29
28
|
},
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</PageContainer>
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
]}
|
|
32
|
+
logoUrl={"https://cdn.chengfengerlai.com/logo/company-logo/chengfengerlai-puhui.png"}
|
|
33
|
+
user={{
|
|
34
|
+
name: (window)?.g_config?.user?.name,
|
|
35
|
+
avatar: (window)?.g_config?.user?.avatar,
|
|
36
|
+
tenantName: (window)?.g_config?.tenant?.name,
|
|
37
|
+
role: (window)?.g_config?.user?.roleInfo,
|
|
38
|
+
}}
|
|
39
|
+
custom={{
|
|
40
|
+
type: (window)?.g_config?.custom?.type,
|
|
41
|
+
isCompleted: (window)?.g_config?.custom?.isCompleted,
|
|
42
|
+
isAudited: (window)?.g_config?.custom?.isAudited,
|
|
43
|
+
hrefUrl: '/web/user-info',
|
|
44
|
+
historyAction: history
|
|
45
|
+
}}
|
|
46
|
+
logoutUrl={(window)?.g_config?.logoutUrl}
|
|
47
|
+
switchTenantUrl={(window)?.g_config?.switchTenantUrl}
|
|
48
|
+
>
|
|
49
|
+
<CpcRole></CpcRole>
|
|
50
|
+
</Layout>
|
|
51
|
+
</div>
|
|
54
52
|
}
|
|
55
53
|
const container = document.getElementById('root');
|
|
56
54
|
const root = createRoot(container);
|
package/demo/src/index.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
body {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
.layout-warp {
|
|
5
6
|
display: flex;
|
|
6
7
|
flex-direction: column !important;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
.layout-header {
|
|
9
11
|
height: 48px;
|
|
10
12
|
background: white;
|
|
11
13
|
z-index: 1;
|
|
@@ -39,12 +41,12 @@ body {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
.
|
|
44
|
+
.layout-header-fill {
|
|
43
45
|
flex: 1;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
.
|
|
47
|
-
left:
|
|
48
|
+
.layout-header-logo {
|
|
49
|
+
left: 36px;
|
|
48
50
|
height: 48px;
|
|
49
51
|
top: 0;
|
|
50
52
|
width: 255px;
|
|
@@ -53,29 +55,27 @@ body {
|
|
|
53
55
|
display: inline-flex;
|
|
54
56
|
align-items: center;
|
|
55
57
|
|
|
56
|
-
.img {
|
|
58
|
+
.logo-img {
|
|
57
59
|
line-height: 48px;
|
|
58
60
|
font-family: Lucida Calligraphy, cursive, serif, sans-serif;
|
|
59
|
-
margin-right: 12px;
|
|
60
61
|
height: 40px;
|
|
61
62
|
object-fit: cover;
|
|
62
63
|
}
|
|
63
|
-
.text{
|
|
64
|
-
color: #1677ff;
|
|
65
|
-
font-size: 20px;
|
|
66
|
-
line-height: 48px;
|
|
67
|
-
font-family:'Courier New', Courier, monospace;
|
|
68
|
-
margin-right: 12px;
|
|
69
|
-
}
|
|
70
64
|
|
|
71
65
|
.interval {
|
|
72
|
-
color: rgba(0, 0, 0, 0.1);
|
|
73
66
|
width: 1px;
|
|
74
67
|
height: 12px;
|
|
75
|
-
background-color: rgba(0, 0, 0, 0.
|
|
76
|
-
margin:
|
|
68
|
+
background-color: rgba(0, 0, 0, 0.45);
|
|
69
|
+
margin: 0 12px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.app-name {
|
|
73
|
+
margin-left: 12px;
|
|
74
|
+
font-weight: 400;
|
|
75
|
+
color: rgba(0, 0, 0, .72);
|
|
77
76
|
}
|
|
78
77
|
|
|
78
|
+
|
|
79
79
|
.app-list {
|
|
80
80
|
.app-list-currentlist {
|
|
81
81
|
font-size: 12px;
|
|
@@ -91,7 +91,8 @@ body {
|
|
|
91
91
|
color: rgba(0, 0, 0, 0.88);
|
|
92
92
|
font-weight: 400;
|
|
93
93
|
display: flex;
|
|
94
|
-
|
|
94
|
+
|
|
95
|
+
img {
|
|
95
96
|
max-width: 32px;
|
|
96
97
|
margin-right: 4px;
|
|
97
98
|
}
|
|
@@ -100,6 +101,7 @@ body {
|
|
|
100
101
|
.app-list-currentlist:hover {
|
|
101
102
|
background: rgba(0, 0, 0, 0.1);
|
|
102
103
|
}
|
|
104
|
+
|
|
103
105
|
.app-list-current {
|
|
104
106
|
font-size: 12px;
|
|
105
107
|
height: 32px;
|
|
@@ -113,7 +115,8 @@ body {
|
|
|
113
115
|
color: rgba(0, 0, 0, 0.88);
|
|
114
116
|
font-weight: 400;
|
|
115
117
|
display: flex;
|
|
116
|
-
|
|
118
|
+
|
|
119
|
+
img {
|
|
117
120
|
max-width: 32px;
|
|
118
121
|
margin-right: 4px;
|
|
119
122
|
}
|
|
@@ -121,7 +124,7 @@ body {
|
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
.
|
|
127
|
+
.layout-header-actions {
|
|
125
128
|
display: flex;
|
|
126
129
|
justify-content: flex-start;
|
|
127
130
|
align-items: center;
|
|
@@ -148,7 +151,7 @@ body {
|
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
|
|
151
|
-
.
|
|
154
|
+
.layout-header-user {
|
|
152
155
|
height: 40px;
|
|
153
156
|
display: flex;
|
|
154
157
|
justify-content: flex-start;
|
|
@@ -178,28 +181,25 @@ body {
|
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
183
|
|
|
181
|
-
.
|
|
184
|
+
.layout-main {
|
|
182
185
|
display: flex;
|
|
183
186
|
height: 100%;
|
|
184
187
|
}
|
|
185
188
|
|
|
186
|
-
.
|
|
189
|
+
.layout-side {
|
|
187
190
|
height: calc(100vh - 96px);
|
|
188
|
-
// background: white;
|
|
189
191
|
user-select: none;
|
|
190
|
-
// padding-top: 12px;
|
|
191
|
-
// margin-bottom: 48px;
|
|
192
192
|
overflow: auto;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
.
|
|
195
|
+
.layout-content {
|
|
196
196
|
width: 100%;
|
|
197
197
|
height: calc(100vh - 48px);
|
|
198
198
|
overflow: auto;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
//用户卡片
|
|
202
|
-
.
|
|
202
|
+
.user-card {
|
|
203
203
|
min-width: 182px;
|
|
204
204
|
max-width: 262px;
|
|
205
205
|
|
|
@@ -214,8 +214,8 @@ body {
|
|
|
214
214
|
margin-right: 12px;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
.user-info-right{
|
|
218
|
-
|
|
217
|
+
.user-info-right {
|
|
218
|
+
flex: 1;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
.name {
|
|
@@ -227,6 +227,7 @@ body {
|
|
|
227
227
|
font-size: 12px;
|
|
228
228
|
line-height: 16px;
|
|
229
229
|
margin-top: 4px;
|
|
230
|
+
|
|
230
231
|
.role-item {
|
|
231
232
|
background: rgba(204, 204, 204, .55);
|
|
232
233
|
padding: 2px 8px;
|
|
@@ -242,18 +243,22 @@ body {
|
|
|
242
243
|
padding: 5px 0px;
|
|
243
244
|
margin: 5px 0px;
|
|
244
245
|
border-top: 1px solid rgba(5, 5, 5, 0.06);
|
|
246
|
+
|
|
245
247
|
.tenant-label {
|
|
246
248
|
font-size: 12px;
|
|
247
249
|
color: rgba(0, 0, 0, .5);
|
|
248
250
|
}
|
|
249
|
-
|
|
251
|
+
|
|
252
|
+
.tenant-switch {
|
|
250
253
|
display: flex;
|
|
254
|
+
|
|
251
255
|
.tenant-value {
|
|
252
256
|
flex: 1;
|
|
253
257
|
font-size: 14px;
|
|
254
258
|
color: rgba(0, 0, 0, .85);
|
|
255
259
|
}
|
|
256
|
-
|
|
260
|
+
|
|
261
|
+
.tenant-icon {
|
|
257
262
|
width: 40px;
|
|
258
263
|
text-align: center;
|
|
259
264
|
color: rgba(0, 0, 0, .45);
|
|
@@ -261,51 +266,61 @@ body {
|
|
|
261
266
|
justify-content: center;
|
|
262
267
|
align-items: center;
|
|
263
268
|
}
|
|
264
|
-
|
|
269
|
+
|
|
270
|
+
.tenant-icon:hover {
|
|
265
271
|
cursor: pointer;
|
|
266
272
|
color: rgba(0, 0, 0, .85);
|
|
267
273
|
}
|
|
268
274
|
}
|
|
269
|
-
|
|
275
|
+
|
|
270
276
|
|
|
271
277
|
}
|
|
272
|
-
|
|
278
|
+
|
|
279
|
+
.lios-userInfo {
|
|
273
280
|
padding: 5px 0px;
|
|
274
281
|
margin: 5px 0px;
|
|
275
282
|
border-top: 1px solid rgba(5, 5, 5, 0.06);
|
|
276
|
-
|
|
283
|
+
|
|
284
|
+
.li-flex {
|
|
277
285
|
display: flex;
|
|
278
|
-
|
|
286
|
+
|
|
287
|
+
.lios-value {
|
|
279
288
|
flex: 1;
|
|
280
289
|
}
|
|
281
290
|
}
|
|
282
|
-
|
|
291
|
+
|
|
292
|
+
.lios-li {
|
|
283
293
|
line-height: 22px;
|
|
284
|
-
|
|
294
|
+
|
|
295
|
+
.lios-key {
|
|
285
296
|
font-size: 12px;
|
|
286
297
|
color: rgba(0, 0, 0, .5);
|
|
287
298
|
display: inline-block;
|
|
288
299
|
}
|
|
289
|
-
|
|
300
|
+
|
|
301
|
+
.lios-value {
|
|
290
302
|
padding-left: 8px;
|
|
291
303
|
display: inline-block;
|
|
292
304
|
font-size: 12px;
|
|
293
305
|
color: rgba(0, 0, 0, .85);
|
|
294
|
-
|
|
306
|
+
|
|
307
|
+
span {
|
|
295
308
|
padding-left: 5px;
|
|
296
|
-
|
|
309
|
+
}
|
|
297
310
|
}
|
|
298
|
-
|
|
311
|
+
|
|
312
|
+
.lios-icon {
|
|
299
313
|
width: 40px;
|
|
300
314
|
text-align: center;
|
|
301
315
|
color: rgba(0, 0, 0, .45);
|
|
302
316
|
}
|
|
303
|
-
|
|
317
|
+
|
|
318
|
+
.lios-icon:hover {
|
|
304
319
|
cursor: pointer;
|
|
305
320
|
color: rgba(0, 0, 0, .85);
|
|
306
321
|
}
|
|
307
322
|
}
|
|
308
|
-
|
|
323
|
+
|
|
309
324
|
}
|
|
310
325
|
|
|
311
326
|
|
|
@@ -362,4 +377,10 @@ body {
|
|
|
362
377
|
.current-product {
|
|
363
378
|
color: #1677FF !important;
|
|
364
379
|
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.ant-layout-sider-trigger {
|
|
383
|
+
&:hover {
|
|
384
|
+
background: rgba(0, 0, 0, .02) !important;
|
|
385
|
+
}
|
|
365
386
|
}
|
|
@@ -34,16 +34,15 @@ export interface LiosLayoutlProps {
|
|
|
34
34
|
switchTenantUrl?: string,
|
|
35
35
|
defaultOpenKeys?: string[],
|
|
36
36
|
productList?: any,
|
|
37
|
-
|
|
38
|
-
type: string,
|
|
39
|
-
content: string
|
|
40
|
-
},
|
|
37
|
+
logoUrl?: string,
|
|
41
38
|
isHideHeader?: boolean //是否隐藏header
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
export default function LiosLayout(props: LiosLayoutlProps) {
|
|
45
42
|
const {
|
|
43
|
+
appName,
|
|
46
44
|
productCode,
|
|
45
|
+
logoUrl,
|
|
47
46
|
menuList,
|
|
48
47
|
onMenuClick,
|
|
49
48
|
selectedKeys,
|
|
@@ -54,7 +53,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
54
53
|
switchTenantUrl,
|
|
55
54
|
defaultOpenKeys,
|
|
56
55
|
productList,
|
|
57
|
-
logoData,
|
|
58
56
|
myWalletInfo,
|
|
59
57
|
myWalletInfoAction,
|
|
60
58
|
isHideHeader
|
|
@@ -72,27 +70,31 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
72
70
|
hrefUrl,
|
|
73
71
|
historyAction
|
|
74
72
|
} = custom || {}
|
|
73
|
+
|
|
75
74
|
const {
|
|
76
75
|
availableCashAmount,
|
|
77
76
|
availableAmount,
|
|
78
77
|
currency
|
|
79
78
|
} = myWalletInfo || {}
|
|
79
|
+
|
|
80
80
|
const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
|
|
81
|
-
const [currentProduct, setCurrentProduct] = useState<any>({});
|
|
81
|
+
// const [currentProduct, setCurrentProduct] = useState<any>({});
|
|
82
82
|
|
|
83
83
|
const { Sider } = Layout;
|
|
84
84
|
|
|
85
85
|
const [collapsed, setCollapsed] = useState(false);
|
|
86
|
+
|
|
86
87
|
const [currencyList, setCurrencyList] = useState([
|
|
87
88
|
{ value: 'JPY', label: '日元', icon: '¥' },
|
|
88
89
|
{ value: 'USD', label: '美元', icon: "$" },
|
|
89
90
|
{ value: 'CNY', label: '人民币', icon: '¥' }
|
|
90
91
|
])
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
|
|
93
|
+
// useEffect(() => {
|
|
94
|
+
// if (!productList) return
|
|
95
|
+
// let cp = productList?.filter((i: any) => i.productCode == productCode)[0]
|
|
96
|
+
// setCurrentProduct(cp)
|
|
97
|
+
// }, [productList])
|
|
96
98
|
|
|
97
99
|
const onOpenChange: MenuProps['onOpenChange'] = (keys) => {
|
|
98
100
|
setOpenKeys(keys);
|
|
@@ -118,8 +120,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
118
120
|
})
|
|
119
121
|
return text
|
|
120
122
|
}
|
|
123
|
+
|
|
121
124
|
const UserCard = () => {
|
|
122
|
-
return <div className='
|
|
125
|
+
return <div className='user-card'>
|
|
123
126
|
<div className='user-info'>
|
|
124
127
|
<img
|
|
125
128
|
|
|
@@ -212,53 +215,32 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
212
215
|
})}
|
|
213
216
|
</div>
|
|
214
217
|
}
|
|
218
|
+
|
|
215
219
|
const MenuStyle = {
|
|
216
|
-
width: collapsed ? 80 :
|
|
220
|
+
width: collapsed ? 80 : 240
|
|
217
221
|
}
|
|
218
222
|
return (
|
|
219
|
-
<Layout className="
|
|
223
|
+
<Layout className="layout-warp">
|
|
220
224
|
{
|
|
221
225
|
!isHideHeader &&
|
|
222
|
-
<div className="
|
|
226
|
+
<div className="layout-header">
|
|
223
227
|
|
|
224
228
|
<div className="background">
|
|
225
229
|
<img className="background-img" src="https://pic.imgdb.cn/item/64813de01ddac507cc192a6e.jpg" alt="" />
|
|
226
230
|
<div className="background-mask" />
|
|
227
231
|
</div>
|
|
228
232
|
|
|
229
|
-
<strong className="
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
{logoData?.content || ''}
|
|
236
|
-
</div>
|
|
237
|
-
}
|
|
238
|
-
<div className="interval" />
|
|
239
|
-
<div className="app-list">
|
|
240
|
-
{
|
|
241
|
-
productList ?
|
|
242
|
-
<Popover placement="bottom" content={<ProductListFunc />} arrow={false} trigger="click">
|
|
243
|
-
<div className="app-list-currentlist">
|
|
244
|
-
{currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
|
|
245
|
-
<div>
|
|
246
|
-
{currentProduct?.productName || "请选择应用"}
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
</Popover> :
|
|
250
|
-
<div className="app-list-current">
|
|
251
|
-
{currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
|
|
252
|
-
<div>
|
|
253
|
-
{currentProduct?.productName}
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
}
|
|
257
|
-
</div>
|
|
233
|
+
<strong className="layout-header-logo">
|
|
234
|
+
{logoUrl && <img className="logo-img" src={logoUrl || ''} />}
|
|
235
|
+
{logoUrl && appName && <div className="interval" />}
|
|
236
|
+
{appName && <div className="app-name">
|
|
237
|
+
{appName}
|
|
238
|
+
</div>}
|
|
258
239
|
</strong>
|
|
259
|
-
<div className='lios-header-fill' />
|
|
260
240
|
|
|
261
|
-
<div className='
|
|
241
|
+
<div className='layout-header-fill' />
|
|
242
|
+
|
|
243
|
+
<div className='layout-header-actions'>
|
|
262
244
|
{actions?.map((item, index) => {
|
|
263
245
|
return <div className='actions-item' key={index}>
|
|
264
246
|
{item}
|
|
@@ -271,7 +253,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
271
253
|
if (!e) return
|
|
272
254
|
myWalletInfoAction && myWalletInfoAction()
|
|
273
255
|
})}>
|
|
274
|
-
<div className="
|
|
256
|
+
<div className="layout-header-user">
|
|
275
257
|
<img
|
|
276
258
|
className="author"
|
|
277
259
|
src={avatar}
|
|
@@ -283,16 +265,18 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
283
265
|
</Popover>
|
|
284
266
|
</div>
|
|
285
267
|
}
|
|
286
|
-
<div className="
|
|
268
|
+
<div className="layout-main">
|
|
287
269
|
{
|
|
288
|
-
menuList &&
|
|
270
|
+
Array.isArray(menuList) &&
|
|
271
|
+
menuList.length > 0 &&
|
|
289
272
|
<Sider
|
|
290
|
-
className="
|
|
273
|
+
className="layout-side"
|
|
291
274
|
theme={"light"}
|
|
292
275
|
collapsible
|
|
293
276
|
collapsed={collapsed}
|
|
294
|
-
width={
|
|
277
|
+
width={240}
|
|
295
278
|
onCollapse={(value) => setCollapsed(value)}>
|
|
279
|
+
|
|
296
280
|
<Menu
|
|
297
281
|
mode="inline"
|
|
298
282
|
openKeys={openKeys}
|
|
@@ -306,7 +290,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
306
290
|
/>
|
|
307
291
|
</Sider>
|
|
308
292
|
}
|
|
309
|
-
<div className="
|
|
293
|
+
<div className="layout-content">
|
|
310
294
|
{props.children}
|
|
311
295
|
</div>
|
|
312
296
|
</div>
|