cfel-base-components 2.5.55 → 2.5.56

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.
@@ -3,8 +3,8 @@ import { createRoot } from 'react-dom/client'
3
3
  import style from './index.module.less'
4
4
  import { SwapOutlined, QqOutlined, WeiboOutlined } from '@ant-design/icons'
5
5
  import { ConfigProvider } from 'antd'
6
- import Layout from '../../src/components/layout'
7
- // import Layout from '../../src/components/layout-console'
6
+ // import Layout from '../../src/components/layout'
7
+ import Layout from '../../src/components/layout-console'
8
8
  import { QuestionCircleTwoTone } from '@ant-design/icons'
9
9
  // import Account from '../../src/components/universal-pages/account';
10
10
  // import AccountInfo from '../../src/components/universal-pages/accountInfo';
@@ -51,7 +51,7 @@ const menuList = [
51
51
  <span>配额列表</span>
52
52
  <span className={style.quotaCount}>12</span>
53
53
  </>,
54
- key: 'product-list3',
54
+ key: 'product-list34',
55
55
  },
56
56
  ],
57
57
  },
@@ -100,7 +100,7 @@ const menuList = [
100
100
  <span>配额列表</span>
101
101
  <span className={style.quotaCount}>12</span>
102
102
  </>,
103
- key: 'product-list3',
103
+ key: 'product-list32',
104
104
  },
105
105
  ],
106
106
  },
@@ -109,7 +109,7 @@ const menuList = [
109
109
  <span>配额列表</span>
110
110
  <span className={style.quotaCount}>12</span>
111
111
  </>,
112
- key: 'entity-list',
112
+ key: 'entity-list22',
113
113
  },
114
114
  {
115
115
  label: '资源类型管理',
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.5.55",
3
+ "version": "2.5.56",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
7
7
  "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
8
  "dev": "webpack-dev-server --config config/webpack.dev.config.js",
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
10
  "build": "webpack --config config/webpack.prod.config.js"
11
11
  },
12
12
  "repository": {
@@ -107,7 +107,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
107
107
 
108
108
  // 初始化展开菜单
109
109
  const [openKeys, setOpenKeys] = useState<string[]>(defaultOpenKeys || [])
110
- const [activeThirdLevelMenu, setActiveThirdLevelMenu] = useState<string | null>(null)
111
110
 
112
111
  //处理搜索菜单后自动展开目录
113
112
  const findParentMenu = (menuList: any[], pathname: string) => {
@@ -135,10 +134,15 @@ export default function LiosLayout(props: LiosLayoutlProps) {
135
134
  const paMenu = findParentMenu(menuList, '/' + location.pathname.split('/')[2])
136
135
  //去重
137
136
  const set = new Set(paMenu.map((item) => item.key))
137
+
138
138
  openKeys.forEach((element: string) => {
139
139
  set.add(element)
140
140
  })
141
141
  setOpenKeys(Array.from(set))
142
+
143
+ // 设置选中的菜单项
144
+ const selectedPath = findKeyPath('/' + location.pathname.split('/')[2])
145
+ setSelectKey(selectedPath)
142
146
  }, [location.pathname])
143
147
 
144
148
  // 初始化折叠状态
@@ -206,13 +210,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
206
210
  motionLeave: true,
207
211
  }
208
212
 
209
- useEffect(() => {
210
- return () => {
211
- setActiveThirdLevelMenu(null)
212
- setOpenKeys([])
213
- }
214
- }, [])
215
-
216
213
  return (
217
214
  <Layout className="layout-warps">
218
215
  {Array.isArray(menuList) && menuList.length > 0 && (
@@ -11,6 +11,45 @@ ul {
11
11
  margin: 0;
12
12
  }
13
13
 
14
+ .menu-popover {
15
+ width: 168px;
16
+ padding-left: 4px;
17
+ font-weight: 500;
18
+ font-size: 14px;
19
+ color: #04073b;
20
+ text-align: left;
21
+ font-style: normal;
22
+ cursor: pointer;
23
+
24
+ .menu-item-content {
25
+ width: 152px;
26
+ height: 32px;
27
+ overflow: hidden;
28
+ text-overflow: ellipsis;
29
+ margin-top: 4px;
30
+
31
+ &:hover {
32
+ color: #185dfe;
33
+ }
34
+ }
35
+
36
+ .sub-list {
37
+ width: 100%;
38
+ display: flex;
39
+ justify-content: space-between;
40
+ }
41
+
42
+ .sub-selected {
43
+ color: #185dfe;
44
+ }
45
+
46
+ .selected {
47
+ background: #e7eeff;
48
+ border-radius: 4px;
49
+ color: #185dfe;
50
+ }
51
+ }
52
+
14
53
  .layout-menu-console {
15
54
  border-radius: 16px;
16
55
  height: calc(100% - 107px);
@@ -37,7 +76,7 @@ ul {
37
76
  .ant-layout-sider-collapsed & {
38
77
  display: none;
39
78
  }
40
-
79
+
41
80
  &::before,
42
81
  &::after {
43
82
  position: absolute;
@@ -49,15 +88,15 @@ ul {
49
88
  transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
50
89
  content: '';
51
90
  }
52
-
91
+
53
92
  &::before {
54
93
  transform: rotate(-45deg) translateX(2.5px);
55
94
  }
56
-
95
+
57
96
  &::after {
58
97
  transform: rotate(45deg) translateX(-2.5px);
59
98
  }
60
-
99
+
61
100
  // RTL support
62
101
  &.#{$menuPrefixCls}-rtl,
63
102
  .#{$menuPrefixCls}-submenu-rtl & {
@@ -65,7 +104,7 @@ ul {
65
104
  left: 16px;
66
105
  }
67
106
  }
68
-
107
+
69
108
  .#{$menuPrefixCls}-submenu-open > .#{$menuPrefixCls}-submenu-title {
70
109
  .#{$menuPrefixCls}-submenu-arrow {
71
110
  transform: translateY(-3px);
@@ -77,7 +116,7 @@ ul {
77
116
  }
78
117
  }
79
118
  }
80
-
119
+
81
120
  .#{$menuPrefixCls}-submenu-selected {
82
121
  > .#{$menuPrefixCls}-submenu-title {
83
122
  .#{$menuPrefixCls}-submenu-arrow {
@@ -88,7 +127,6 @@ ul {
88
127
  }
89
128
  }
90
129
  }
91
-
92
130
 
93
131
  > li {
94
132
  .first-li {
@@ -97,7 +135,7 @@ ul {
97
135
  color: #fff;
98
136
  font-weight: 500;
99
137
  }
100
-
138
+
101
139
  .menu-item-label {
102
140
  color: #fff;
103
141
  font-weight: 500;
@@ -222,18 +260,17 @@ ul {
222
260
  line-height: 52px;
223
261
  width: 100%;
224
262
 
225
- .menu-item-content{
263
+ .menu-item-content {
226
264
  width: 100%;
227
265
  padding-right: 24px;
228
266
 
229
- .menu-item-label{
267
+ .menu-item-label {
230
268
  width: 100%;
231
269
  display: flex;
232
270
  align-items: center;
233
271
  justify-content: space-between;
234
272
  }
235
273
  }
236
-
237
274
 
238
275
  &::before {
239
276
  content: '';
@@ -309,7 +346,7 @@ ul {
309
346
  }
310
347
 
311
348
  .grand-li {
312
- background: #3568B7;
349
+ background: #3568b7;
313
350
  position: relative;
314
351
  z-index: 9;
315
352
  line-height: 52px;
@@ -404,6 +441,7 @@ ul {
404
441
  cursor: pointer;
405
442
  position: relative;
406
443
  z-index: 20;
444
+ color: #fff;
407
445
 
408
446
  .menu-item-content {
409
447
  font-weight: 400;
@@ -473,9 +511,7 @@ body {
473
511
  height: 40px;
474
512
  color: #fff;
475
513
  background: #5b6ecf;
476
- box-shadow:
477
- inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05),
478
- inset 0px -2px 0px 0px #ffffff22;
514
+ box-shadow: inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05), inset 0px -2px 0px 0px #ffffff22;
479
515
  border-radius: 10px;
480
516
  background-size: 50%;
481
517
  background-position-x: right;
@@ -551,9 +587,7 @@ body {
551
587
  width: 40px;
552
588
  height: 40px;
553
589
  background: #f8f8fb;
554
- box-shadow:
555
- inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05),
556
- inset 0px -2px 0px 0px #ffffff;
590
+ box-shadow: inset 0px 2px 1px 0px rgba(0, 0, 0, 0.05), inset 0px -2px 0px 0px #ffffff;
557
591
  border-radius: 10px;
558
592
  backdrop-filter: blur(10px);
559
593
  padding-top: 11px;
@@ -573,7 +607,6 @@ body {
573
607
  border-radius: 16px;
574
608
  }
575
609
 
576
-
577
610
  .layout-side-mask2-console {
578
611
  z-index: 10;
579
612
  background: linear-gradient(227deg, #7856e6 0%, #6a6ed2 0%, #0271c3 100%) !important;
@@ -602,7 +635,6 @@ body {
602
635
  height: 30px;
603
636
  position: relative;
604
637
  z-index: 11;
605
-
606
638
 
607
639
  .logo-sub {
608
640
  width: 31px;
@@ -617,7 +649,6 @@ body {
617
649
  }
618
650
 
619
651
  .layout-header-console {
620
-
621
652
  z-index: 1;
622
653
  height: $header-height;
623
654
  background: linear-gradient(223deg, #faf8ff 0%, #eeecfe 29%, #ffffff 100%);
@@ -676,28 +707,28 @@ body {
676
707
  transform: rotate(0deg);
677
708
  animation: downanimation 0.3s ease-in-out;
678
709
  }
679
-
710
+
680
711
  @keyframes downanimation {
681
712
  from {
682
713
  transform: rotate(180deg);
683
714
  }
684
-
715
+
685
716
  to {
686
717
  transform: rotate(0deg);
687
718
  }
688
719
  }
689
-
720
+
690
721
  //---
691
722
  &-up {
692
723
  transform: rotate(180deg);
693
724
  animation: upanimation 0.3s ease-in-out;
694
725
  }
695
-
726
+
696
727
  @keyframes upanimation {
697
728
  from {
698
729
  transform: rotate(0deg);
699
730
  }
700
-
731
+
701
732
  to {
702
733
  transform: rotate(180deg);
703
734
  }
@@ -748,9 +779,7 @@ body {
748
779
  background: linear-gradient(227deg, #556ec611 0%, #556ec6aa 100%);
749
780
  color: #fff;
750
781
  border-radius: 16px;
751
- box-shadow:
752
- 0 8px 20px rgba(0, 0, 0, 0.1),
753
- inset 0 1px 0 rgba(255, 255, 255, 0.1);
782
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
754
783
  backdrop-filter: blur(10px);
755
784
  padding: 16px;
756
785
  border: 1px solid rgba(255, 255, 255, 0.08);
@@ -824,7 +853,6 @@ body {
824
853
  }
825
854
  }
826
855
 
827
-
828
856
  .#{$menuPrefixCls} {
829
857
  &-zoom-enter,
830
858
  &-zoom-appear {
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
2
2
  import { Layout, List, Menu, MenuProps, Popover } from 'antd'
3
3
  import UserCard from './user-card'
4
4
  import RcMenu, { SubMenu, MenuItem } from 'rc-menu'
5
- import { CloseCircleOutlined } from '@ant-design/icons'
5
+ import { CloseCircleOutlined, RightOutlined } from '@ant-design/icons'
6
6
  const { Sider } = Layout
7
7
  import './index-console.scss'
8
8
 
@@ -134,10 +134,15 @@ export default function LiosLayout(props: LiosLayoutlProps) {
134
134
  const paMenu = findParentMenu(menuList, '/' + location.pathname.split('/')[2])
135
135
  //去重
136
136
  const set = new Set(paMenu.map((item) => item.key))
137
+
137
138
  openKeys.forEach((element: string) => {
138
139
  set.add(element)
139
140
  })
140
141
  setOpenKeys(Array.from(set))
142
+
143
+ // 设置选中的菜单项
144
+ const selectedPath = findKeyPath('/' + location.pathname.split('/')[2])
145
+ setSelectKey(selectedPath)
141
146
  }, [location.pathname])
142
147
 
143
148
  // 初始化折叠状态
@@ -236,9 +241,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
236
241
  {/* {collapsed && <img className={`logo-base sub-logo`} src={logo || subLogoUrl} />} */}
237
242
  </div>
238
243
 
239
- {!collapsed && (
244
+ {/* {!collapsed && (
240
245
  <div
241
- className="trigger-console"
246
+ className='trigger-console'
242
247
  onClick={() => {
243
248
  setCollapsed(true)
244
249
  }}
@@ -251,7 +256,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
251
256
  {collapsed && (
252
257
  <div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
253
258
  <div
254
- className="close-trigger-console"
259
+ className='close-trigger-console'
255
260
  onClick={() => {
256
261
  localStorage.setItem('layout_collapsed', 'false')
257
262
  setCollapsed(false)
@@ -259,10 +264,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
259
264
  >
260
265
  <Arrow collapsed={false} type={type} />
261
266
  </div>
262
- </div>
263
- )}
264
-
265
- <div style={{ height: 24 }}></div>
267
+
268
+ )} */}
269
+ </div>
270
+ {!collapsed && <div style={{ height: 24 }}></div>}
266
271
 
267
272
  <div style={{ width: '100%', padding: '0 16px' }}>
268
273
  <Search menuList={menuList} collapsed={collapsed} type={type || ''} umiHistory={umiHistory} setSelectKey={setSelectKey} findKeyPath={findKeyPath} />
@@ -279,12 +284,12 @@ export default function LiosLayout(props: LiosLayoutlProps) {
279
284
  onOpenChange={onOpenChange}
280
285
  selectedKeys={selectKey}
281
286
  onClick={(item: any) => {
287
+ if (collapsed) return
282
288
  setSelectKey(item.keyPath)
283
289
  if (onMenuClick) {
284
290
  onMenuClick(item)
285
291
  }
286
292
  }}
287
- triggerSubMenuAction="hover"
288
293
  >
289
294
  {menuList.map((item: any) => {
290
295
  const isSelected = selectKey.includes(item.key)
@@ -295,15 +300,83 @@ export default function LiosLayout(props: LiosLayoutlProps) {
295
300
  }
296
301
  if (collapsed) {
297
302
  return (
298
- <Popover placement="right" arrow={false} content={<div>123</div>} trigger="hover">
303
+ <Popover
304
+ key={item.key}
305
+ align={{
306
+ offset: [33, 0],
307
+ }}
308
+ placement="right"
309
+ arrow={false}
310
+ content={
311
+ <div className="menu-popover">
312
+ {item.children.map((child: any) => {
313
+ if (child.children) {
314
+ return (
315
+ <Popover
316
+ key={child.key}
317
+ align={{
318
+ offset: [30, 0],
319
+ }}
320
+ placement="right"
321
+ arrow={false}
322
+ content={
323
+ <div className="menu-popover" style={{ width: '146px' }}>
324
+ {child.children.map((grandChild: any) => {
325
+ return (
326
+ <MenuItem
327
+ onClick={() => {
328
+ if (onMenuClick) {
329
+ onMenuClick(grandChild)
330
+ }
331
+ }}
332
+ key={grandChild.key}
333
+ className="grand-li"
334
+ >
335
+ <div className="menu-item-content">
336
+ <span className="menu-item-label">{grandChild.label}</span>
337
+ </div>
338
+ </MenuItem>
339
+ )
340
+ })}
341
+ </div>
342
+ }
343
+ >
344
+ <SubMenu
345
+ className="menu-item-content sub-li"
346
+ key={child.key}
347
+ title={
348
+ <div className="sub-list">
349
+ <span className="menu-item-label">{child.label}</span>
350
+ <RightOutlined />
351
+ </div>
352
+ }
353
+ ></SubMenu>
354
+ </Popover>
355
+ )
356
+ }
357
+ return (
358
+ <MenuItem
359
+ onClick={() => {
360
+ if (onMenuClick) {
361
+ onMenuClick(child)
362
+ }
363
+ }}
364
+ key={child.key}
365
+ className={`sub-li ${isSelected ? 'sub-selected' : ''}`}
366
+ >
367
+ <div className="menu-item-content sub-list">{child.label}</div>
368
+ </MenuItem>
369
+ )
370
+ })}
371
+ </div>
372
+ }
373
+ >
299
374
  <SubMenu
300
- key={item.key}
301
375
  className="menu-item-content"
302
376
  title={
303
377
  <div className="sub-list">
304
- <div className="menu-item-inner">
378
+ <div>
305
379
  <span className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}>{item.icon}</span>
306
- {!collapsed && <span className={classNames}>{item.label}</span>}
307
380
  </div>
308
381
  </div>
309
382
  }
@@ -491,7 +564,6 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
491
564
  }
492
565
 
493
566
  const handleClickOutside = (event: MouseEvent) => {
494
- console.log(1)
495
567
  const searchContainer = document.querySelector('.search-container')
496
568
  if (searchContainer && !searchContainer.contains(event.target as Node)) {
497
569
  setIsFocused(false)
@@ -575,18 +647,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
575
647
  }
576
648
  return (
577
649
  <>
578
- {collapsed ? (
579
- <div className="search-mobile-console">
580
- <div className="search-icon">
581
- <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
582
- <path
583
- fill="#C3CAEF"
584
- d="M962.048 907.776l-229.0176-229.0176a384.3072 384.3072 0 1 0-54.272 54.272l229.0176 229.0176a38.4 38.4 0 0 0 54.272-54.272zM436.1216 743.0656a306.944 306.944 0 1 1 306.944-306.944 307.3024 307.3024 0 0 1-306.944 306.944z"
585
- ></path>
586
- </svg>
587
- </div>
588
- </div>
589
- ) : (
650
+ {!collapsed && (
590
651
  <div className="search-container">
591
652
  <div className="search-console">
592
653
  <div className="search-bg-mask">