cfel-base-components 2.5.45 → 2.5.46

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.
@@ -188,6 +188,7 @@ const App = () => {
188
188
  appName="控制台"
189
189
  productList={false}
190
190
  menuList={menuList}
191
+ type=""
191
192
  customAction={()=>{
192
193
  history.push("/web/user-info")
193
194
  }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.5.45",
3
+ "version": "2.5.46",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -1,7 +1,6 @@
1
1
  .page-wraper {
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
- padding: 8px 8px;
5
4
  display: flex;
6
5
  flex-direction: column;
7
6
  }
@@ -12,4 +11,4 @@
12
11
  border-radius: 8px;
13
12
  padding-bottom: 24px;
14
13
  flex: 1;
15
- }
14
+ }
@@ -0,0 +1,601 @@
1
+ $menuPrefixCls: rc-menu;
2
+
3
+ ul {
4
+ list-style: none;
5
+ padding: 0;
6
+ margin: 0;
7
+ }
8
+
9
+ .layout-menu {
10
+ height: calc(100% - 120px);
11
+ overflow-y: scroll;
12
+
13
+ .menu {
14
+ padding: 0;
15
+ margin: 0;
16
+ list-style: none;
17
+ cursor: pointer;
18
+
19
+ .rc-menu-submenu-title {
20
+ position: relative;
21
+ }
22
+
23
+ .rc-menu-submenu {
24
+ position: relative;
25
+ }
26
+
27
+ .menu-item-content {
28
+ font-weight: 400;
29
+ font-size: 14px;
30
+ line-height: 52px;
31
+ text-align: left;
32
+ }
33
+
34
+ .sub-menu-item-label {
35
+ padding-left: 11px;
36
+ display: flex;
37
+ }
38
+ .menu-item-icon {
39
+ display: inline-block;
40
+ height: 22px;
41
+ width: 22px;
42
+ color: rgba(255, 255, 255, 0.85);
43
+ }
44
+
45
+ .menu-item-label {
46
+ display: inline-block;
47
+ padding-left: 12px;
48
+ color: #ffffffd9;
49
+ border: 1px solid transparent;
50
+ font-weight: 400;
51
+ }
52
+
53
+ .submenu-selected {
54
+ color: #fff !important;
55
+ font-weight: 500;
56
+ }
57
+
58
+ .sub-li {
59
+ background: #5b73deee;
60
+ position: relative;
61
+ z-index: 9;
62
+
63
+ &::before {
64
+ content: '';
65
+ position: absolute;
66
+ left: 31px;
67
+ top: 26px;
68
+ width: 5px;
69
+ height: 5px;
70
+ background: #8f9cec;
71
+ border-radius: 50%;
72
+ z-index: 1;
73
+ }
74
+
75
+ &::after {
76
+ content: '';
77
+ position: absolute;
78
+ left: 32.8px;
79
+ top: 0 !important;
80
+ width: 1px;
81
+ height: 100%;
82
+ background: rgba(255, 255, 255, 0.25);
83
+ z-index: 0;
84
+ }
85
+
86
+ &:only-child::after {
87
+ display: none;
88
+ }
89
+
90
+ &:last-child::after {
91
+ height: 50%;
92
+ }
93
+
94
+ &:first-child::after {
95
+ top: 26px !important;
96
+ }
97
+
98
+ &.rc-menu-submenu-selected {
99
+ &::before {
100
+ background: rgba(255, 255, 255);
101
+ }
102
+ }
103
+
104
+ &.rc-menu-item-selected {
105
+ &::before {
106
+ background: rgba(255, 255, 255);
107
+ }
108
+ }
109
+
110
+ &:not(.rc-menu-submenu) {
111
+ height: 52px;
112
+ display: flex;
113
+ align-items: center;
114
+ box-shadow: 0px 0px 30px 0px transparent;
115
+
116
+ &.rc-menu-item-selected {
117
+ .menu-item-label {
118
+ color: #fff;
119
+ font-weight: 500;
120
+ display: flex;
121
+ align-items: center;
122
+ padding-left: 12px;
123
+ width: 174px;
124
+ height: 40px;
125
+ background: rgba(255, 255, 255, 0.05);
126
+ box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.05);
127
+ border-radius: 10px;
128
+ border: 1px solid rgba(255, 255, 255, 0.1);
129
+ backdrop-filter: blur(10px);
130
+ transition: all 0.3s ease-in-out;
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ .grand-li {
137
+ background: #5b73de;
138
+ position: relative;
139
+ z-index: 9;
140
+ height: 52px;
141
+ display: flex;
142
+ align-items: center;
143
+
144
+ &::before {
145
+ content: '';
146
+ position: absolute;
147
+ left: 43px;
148
+ top: 48%;
149
+ width: 5px;
150
+ height: 5px;
151
+ background: #8f9cec;
152
+ border-radius: 50%;
153
+ transform: translateY(-50%);
154
+ z-index: 2;
155
+ }
156
+
157
+ &::after {
158
+ content: '';
159
+ position: absolute;
160
+ left: 45px;
161
+ top: 0;
162
+ width: 1px;
163
+ height: 100%;
164
+ background: rgba(255, 255, 255, 0.25);
165
+ z-index: 1;
166
+ }
167
+
168
+ &:only-child::after {
169
+ display: none;
170
+ }
171
+
172
+ &:last-child::after {
173
+ height: 50%;
174
+ }
175
+
176
+ &:first-child::after {
177
+ top: 26px !important;
178
+ }
179
+
180
+ &.rc-menu-item-selected {
181
+ .menu-item-label {
182
+ display: flex;
183
+ align-items: center;
184
+ padding-left: 12px;
185
+ width: 174px;
186
+ height: 40px;
187
+ background: rgba(255, 255, 255, 0.05);
188
+ box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.05);
189
+ border-radius: 10px;
190
+ border: 1px solid rgba(255, 255, 255, 0.1);
191
+ backdrop-filter: blur(10px);
192
+ transition: all 0.3s ease-in-out;
193
+ }
194
+
195
+ &::before {
196
+ background: rgba(255, 255, 255);
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ .menu-collapsed {
203
+ display: flex;
204
+ flex-direction: column;
205
+ align-items: center;
206
+ list-style: none;
207
+ cursor: pointer;
208
+
209
+ .menu-item-content {
210
+ font-weight: 400;
211
+ font-size: 14px;
212
+ margin-top: 30px;
213
+ line-height: 24px;
214
+ text-align: left;
215
+ }
216
+ }
217
+
218
+ .cpc-icon {
219
+ display: inline-block;
220
+ height: 22px;
221
+ width: 22px;
222
+ }
223
+ }
224
+
225
+ $header-height: 62px;
226
+ $header-height: 62px;
227
+ $base-color: #c6538c;
228
+
229
+ body {
230
+ overflow: hidden;
231
+ }
232
+
233
+ .layout-warps {
234
+ display: flex;
235
+ padding: 12px;
236
+ background-color: #f3f6fd;
237
+
238
+ ::-webkit-scrollbar {
239
+ display: none;
240
+ }
241
+
242
+ .trigger {
243
+ margin-left: 93px;
244
+ width: 30px;
245
+ height: 30px;
246
+ background: #f0f4fe;
247
+ box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.05);
248
+ border-radius: 4px;
249
+ border: 1px solid rgba(255, 255, 255, 0.55);
250
+ backdrop-filter: blur(10px);
251
+ display: flex;
252
+ justify-content: center;
253
+ align-items: center;
254
+ }
255
+
256
+ .close-trigger {
257
+ margin-top: 24px;
258
+ width: 30px;
259
+ height: 30px;
260
+ background: #f0f4fe;
261
+ box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.05);
262
+ border-radius: 4px;
263
+ border: 1px solid rgba(255, 255, 255, 0.55);
264
+ backdrop-filter: blur(10px);
265
+ display: flex;
266
+ justify-content: center;
267
+ align-items: center;
268
+ }
269
+
270
+ .search {
271
+ width: 228px;
272
+ height: 40px;
273
+ box-shadow:
274
+ inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05),
275
+ inset 0px -2px 0px 0px rgba(255, 255, 255, 0.1);
276
+ border-radius: 10px;
277
+ backdrop-filter: blur(10px);
278
+ background: url('https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/base-component/menu-search-bg-console.png')
279
+ no-repeat;
280
+ background-position-x: right;
281
+ position: relative;
282
+
283
+ .search-input {
284
+ width: 100%;
285
+ height: 100%;
286
+ background: transparent;
287
+ border: none;
288
+ outline: none;
289
+ padding-left: 45px;
290
+ line-height: 32px;
291
+ font-size: 14px;
292
+ color: #ffffff;
293
+
294
+ &::placeholder {
295
+ color: rgba(255, 255, 255, 0.45);
296
+ }
297
+
298
+ // 为了兼容不同浏览器
299
+ &::-webkit-input-placeholder {
300
+ color: rgba(255, 255, 255, 0.45);
301
+ }
302
+
303
+ &::-moz-placeholder {
304
+ color: rgba(255, 255, 255, 0.45);
305
+ }
306
+ }
307
+
308
+ .search-icon {
309
+ position: absolute;
310
+ left: 12px;
311
+ top: 55%;
312
+ transform: translateY(-50%);
313
+ }
314
+
315
+ .search-command {
316
+ position: absolute;
317
+ right: 4px;
318
+ top: 50%;
319
+ transform: translateY(-50%);
320
+ width: 40px;
321
+ height: 30px;
322
+ background: #826deb;
323
+ border-radius: 8px;
324
+ border: 1px solid #8e75f2;
325
+ backdrop-filter: blur(10px);
326
+ display: flex;
327
+ justify-content: center;
328
+ align-items: center;
329
+ font-size: 14px;
330
+ color: rgba(255, 255, 255, 0.65);
331
+ line-height: 17px;
332
+ }
333
+ }
334
+
335
+ .search-mobile {
336
+ width: 40px;
337
+ height: 40px;
338
+ background: #f8f8fb;
339
+ box-shadow:
340
+ inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05),
341
+ inset 0px -2px 0px 0px #ffffff;
342
+ border-radius: 10px;
343
+ backdrop-filter: blur(10px);
344
+ display: flex;
345
+ justify-content: center;
346
+ align-items: center;
347
+ cursor: pointer;
348
+ }
349
+ }
350
+
351
+ .layout-side {
352
+ background: linear-gradient(227deg, #805df5 0%, #757ef6 38%, #3d76ec 100%) !important;
353
+ height: calc(100vh - 24px) !important;
354
+ user-select: none;
355
+ border: 2px solid white;
356
+ border-radius: 16px;
357
+ padding-top: 24px;
358
+
359
+ .header-logo {
360
+ display: flex;
361
+ justify-content: center;
362
+ cursor: pointer;
363
+
364
+ .logo-base {
365
+ height: 40px;
366
+ }
367
+ }
368
+ }
369
+
370
+ .layout-header {
371
+ z-index: 1;
372
+ height: $header-height;
373
+ background: linear-gradient(223deg, #faf8ff 0%, #ecf2fe 29%, #ffffff 100%);
374
+ box-shadow: inset 0px -1px 0px 0px #edeefd;
375
+ border-radius: 16px;
376
+ border: 1px solid #ffffff;
377
+ position: relative;
378
+ display: flex;
379
+ justify-content: flex-start;
380
+ align-items: center;
381
+
382
+ .app-name {
383
+ margin-left: 24px;
384
+ font-weight: 500;
385
+ color: rgba(0, 0, 0, 0.65);
386
+ }
387
+
388
+ .layout-header-fill {
389
+ flex: 1;
390
+ }
391
+
392
+ .layout-header-actions {
393
+ display: flex;
394
+ justify-content: flex-start;
395
+ align-items: center;
396
+ height: 100%;
397
+ max-width: 400px;
398
+ z-index: 2;
399
+
400
+ .actions-item {
401
+ height: 36px;
402
+ border-radius: 6px;
403
+ transition: all 0.3s;
404
+ cursor: pointer;
405
+ margin: 0 4px;
406
+ padding: 0 4px;
407
+
408
+ display: flex;
409
+ justify-content: center;
410
+ align-items: center;
411
+
412
+ &:hover {
413
+ background: rgba(0, 0, 0, 0.06);
414
+ }
415
+ }
416
+ }
417
+
418
+ .layout-header-user {
419
+ height: 48px;
420
+ display: flex;
421
+ justify-content: flex-start;
422
+ align-items: center;
423
+ z-index: 2;
424
+ transition: all 0.3s;
425
+ padding: 4px 12px;
426
+ margin: 0 12px;
427
+ border-radius: 6px;
428
+ cursor: pointer;
429
+
430
+ &:hover {
431
+ background: rgba(0, 0, 0, 0.06);
432
+ }
433
+
434
+ .avatar {
435
+ width: 40px;
436
+ height: 40px;
437
+ border-radius: 50%;
438
+ margin-right: 12px;
439
+ }
440
+ }
441
+ }
442
+
443
+ .layout-main {
444
+ flex: 1;
445
+ height: 100%;
446
+ padding-left: 12px;
447
+ overflow: auto;
448
+ }
449
+
450
+ .layout-content {
451
+ width: 100%;
452
+ height: calc(100vh - #{$header-height});
453
+ overflow: auto;
454
+ margin-top: 12px;
455
+ border-radius: 16px;
456
+ }
457
+
458
+ .rc-menu-collapse {
459
+ overflow: hidden;
460
+ transition: height 0.3s ease-out;
461
+ }
462
+
463
+ .rc-menu-hidden {
464
+ height: 0;
465
+ overflow: hidden;
466
+ }
467
+
468
+ .lists {
469
+ left: 0;
470
+ position: absolute;
471
+ width: 100%;
472
+ background: white;
473
+ cursor: pointer;
474
+ z-index: 100;
475
+ }
476
+
477
+ .search-item:hover {
478
+ background-color: ghostwhite;
479
+ border-radius: 7px;
480
+ }
481
+
482
+ .#{$menuPrefixCls}-submenu-arrow {
483
+ display: inline-block;
484
+ position: absolute;
485
+ top: 52%;
486
+ right: 16px;
487
+ width: 10px;
488
+ height: 10px;
489
+ transform: translateY(0);
490
+ transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
491
+
492
+ // 当菜单收起时隐藏箭头
493
+ .ant-layout-sider-collapsed & {
494
+ display: none;
495
+ }
496
+
497
+ &::before,
498
+ &::after {
499
+ position: absolute;
500
+ width: 5.5px;
501
+ height: 1.5px;
502
+ background-color: white;
503
+ border-radius: 2px;
504
+ transition:
505
+ background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
506
+ transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
507
+ content: '';
508
+ }
509
+
510
+ &::before {
511
+ transform: rotate(-45deg) translateX(2.5px);
512
+ }
513
+
514
+ &::after {
515
+ transform: rotate(45deg) translateX(-2.5px);
516
+ }
517
+
518
+ // RTL support
519
+ &.#{$menuPrefixCls}-rtl,
520
+ .#{$menuPrefixCls}-submenu-rtl & {
521
+ right: auto;
522
+ left: 16px;
523
+ }
524
+ }
525
+
526
+ .#{$menuPrefixCls}-submenu-open > .#{$menuPrefixCls}-submenu-title {
527
+ .#{$menuPrefixCls}-submenu-arrow {
528
+ transform: translateY(-3px);
529
+ &::before {
530
+ transform: rotate(45deg) translateX(2.5px);
531
+ }
532
+ &::after {
533
+ transform: rotate(-45deg) translateX(-2.5px);
534
+ }
535
+ }
536
+ }
537
+
538
+ .#{$menuPrefixCls}-submenu-selected {
539
+ > .#{$menuPrefixCls}-submenu-title {
540
+ .#{$menuPrefixCls}-submenu-arrow {
541
+ &::before,
542
+ &::after {
543
+ background-color: rgba(255, 255, 255);
544
+ }
545
+ }
546
+ }
547
+ }
548
+
549
+ .#{$menuPrefixCls} {
550
+ &-zoom-enter,
551
+ &-zoom-appear {
552
+ opacity: 0;
553
+ animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
554
+ animation-play-state: paused;
555
+ }
556
+
557
+ &-zoom-leave {
558
+ animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
559
+ animation-play-state: paused;
560
+ }
561
+
562
+ &-zoom-enter#{&}-zoom-enter-active,
563
+ &-zoom-appear#{&}-zoom-appear-active {
564
+ animation-name: rcMenuOpenZoomIn;
565
+ animation-play-state: running;
566
+ }
567
+
568
+ &-zoom-leave#{&}-zoom-leave-active {
569
+ animation-name: rcMenuOpenZoomOut;
570
+ animation-play-state: running;
571
+ }
572
+
573
+ &-zoom-enter,
574
+ &-zoom-appear,
575
+ &-zoom-leave {
576
+ .#{$menuPrefixCls}-submenu-rtl & {
577
+ transform-origin: top right !important;
578
+ }
579
+ }
580
+
581
+ @keyframes rcMenuOpenZoomIn {
582
+ 0% {
583
+ opacity: 0;
584
+ transform: scale(0, 0);
585
+ }
586
+ 100% {
587
+ opacity: 1;
588
+ transform: scale(1, 1);
589
+ }
590
+ }
591
+
592
+ @keyframes rcMenuOpenZoomOut {
593
+ 0% {
594
+ transform: scale(1, 1);
595
+ }
596
+ 100% {
597
+ opacity: 0;
598
+ transform: scale(0, 0);
599
+ }
600
+ }
601
+ }
@@ -295,7 +295,7 @@ body {
295
295
  .search-icon{
296
296
  position: absolute;
297
297
  left: 12px;
298
- top: 50%;
298
+ top: 57%;
299
299
  transform: translateY(-50%);
300
300
  }
301
301
 
@@ -343,14 +343,13 @@ body {
343
343
  overflow: visible;
344
344
 
345
345
  .header-logo {
346
- padding-left: 16px;
347
346
  display: flex;
347
+ justify-content: center;
348
348
  cursor: pointer;
349
- height: 30px;
349
+ height: 40px;
350
350
 
351
351
  .logo-base {
352
- height: 30px;
353
- width: 105px;
352
+ height: 40px;
354
353
  }
355
354
  }
356
355
  }
@@ -1,10 +1,8 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { Layout, List, Menu, MenuProps, Popover } from 'antd'
3
3
  import UserCard from './user-card'
4
- import { useMemo } from 'react'
5
4
  import RcMenu, { SubMenu, MenuItem } from 'rc-menu'
6
5
  import { CloseCircleOutlined } from '@ant-design/icons'
7
- import './index.scss'
8
6
  const { Sider } = Layout
9
7
 
10
8
  export interface LiosLayoutlProps {
@@ -14,7 +12,7 @@ export interface LiosLayoutlProps {
14
12
  menuList: any
15
13
  onMenuClick: any
16
14
  selectedKeys: string[]
17
- setSelectKeys: (keys: string[]) => void
15
+ setSelectKeys: any
18
16
  customAction?: any
19
17
  actions?: any[]
20
18
  myWalletInfo?: {
@@ -60,6 +58,16 @@ export default function LiosLayout(props: LiosLayoutlProps) {
60
58
  type,
61
59
  } = props
62
60
 
61
+ const [selectKey, setSelectKey] = useState<any>([])
62
+
63
+ useEffect(() => {
64
+ if (type !== 'console') {
65
+ import('./index.scss')
66
+ } else {
67
+ import('./index-console.scss')
68
+ }
69
+ }, [type])
70
+
63
71
  const logoUrl =
64
72
  type === 'console'
65
73
  ? 'https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/company-logo/cfel-logo-white-compress.png'
@@ -130,21 +138,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
130
138
  } catch (err) {}
131
139
  }
132
140
 
133
- const style = useMemo(() => {
134
- if (collapsed) {
135
- return {
136
- style: {
137
- padding: '0',
138
- paddingTop: '24px',
139
- },
140
- }
141
- } else {
142
- return {
143
- style: {},
144
- }
145
- }
146
- }, [collapsed])
147
-
148
141
  const collapseNode = () => {
149
142
  return {
150
143
  height: 0,
@@ -224,12 +217,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
224
217
  </div>
225
218
  )} */}
226
219
 
227
- <div style={{ height: 24 }}></div>
228
-
229
- <div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
230
- <Search menuList={menuList} collapsed={collapsed} type={type || ''} />
231
- </div>
232
-
233
220
  {!collapsed && <div style={{ height: 24 }}></div>}
234
221
 
235
222
  <div className="layout-menu">
@@ -239,9 +226,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
239
226
  motion={collapsed ? verticalMotion : inlineMotion}
240
227
  openKeys={openKeys}
241
228
  onOpenChange={onOpenChange}
242
- selectedKeys={selectedKeys}
243
- onClick={(item): any => {
244
- setSelectKeys(item.keyPath)
229
+ selectedKeys={selectKey}
230
+ onClick={(item: any) => {
231
+ setSelectKey(item.keyPath)
245
232
  if (onMenuClick) {
246
233
  onMenuClick(item)
247
234
  }
@@ -249,7 +236,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
249
236
  triggerSubMenuAction="hover"
250
237
  >
251
238
  {menuList.map((item: any) => {
252
- const isSelected = selectedKeys.includes(item.key)
239
+ const isSelected = selectKey.includes(item.key)
253
240
  if (item.children) {
254
241
  let classNames = 'menu-item-label'
255
242
  if (isSelected) {
@@ -270,7 +257,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
270
257
  }
271
258
  >
272
259
  {item.children.map((child: any) => {
273
- const isSelected = selectedKeys.includes(child.key)
260
+ const isSelected = selectKey.includes(child.key)
274
261
  if (item.children) {
275
262
  let classNames = 'menu-item-label'
276
263
  if (isSelected) {
@@ -286,7 +273,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
286
273
  title={<div className="sub-list">{!collapsed && <span className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}>{child.label}</span>}</div>}
287
274
  >
288
275
  {child.children.map((grandChild: any) => {
289
- const isSelected = selectedKeys.includes(grandChild.key)
276
+ const isSelected = selectKey.includes(grandChild.key)
290
277
  if (item.children) {
291
278
  let classNames = 'menu-item-label'
292
279
  if (isSelected) {