cfel-base-components 2.5.69 → 2.5.71
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/package.json
CHANGED
|
@@ -432,7 +432,7 @@ ul {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
.menu-collapsed {
|
|
435
|
+
.menu-cloud-collapsed {
|
|
436
436
|
display: flex;
|
|
437
437
|
flex-direction: column;
|
|
438
438
|
align-items: center;
|
|
@@ -604,7 +604,7 @@ body {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
-
.layout-side-
|
|
607
|
+
.layout-side-mask1-cloud {
|
|
608
608
|
background: white;
|
|
609
609
|
position: absolute;
|
|
610
610
|
top: 0;
|
|
@@ -615,7 +615,7 @@ body {
|
|
|
615
615
|
z-index: 9;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
-
.layout-side-
|
|
618
|
+
.layout-side-mask2-cloud {
|
|
619
619
|
background: linear-gradient( 227deg, #F0FBF3 0%, #E5F6FA 100%);
|
|
620
620
|
position: absolute;
|
|
621
621
|
top: 0;
|
|
@@ -106,7 +106,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
106
106
|
const { name, avatar } = user || {}
|
|
107
107
|
|
|
108
108
|
// 初始化展开菜单
|
|
109
|
-
const [openKeys, setOpenKeys] = useState<
|
|
109
|
+
const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || [])
|
|
110
110
|
|
|
111
111
|
//处理搜索菜单后自动展开目录
|
|
112
112
|
const findParentMenu = (menuList: any[], pathname: string) => {
|
|
@@ -129,16 +129,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
129
129
|
return result
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// 初始化折叠状态
|
|
133
|
-
const [collapsed, setCollapsed] = useState(localStorage.getItem('layout_collapsed') === 'true')
|
|
134
|
-
const [isCopied, setIsCopied] = useState({
|
|
135
|
-
account: false,
|
|
136
|
-
id: false,
|
|
137
|
-
tenantName: false,
|
|
138
|
-
tenantId: false,
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
|
|
142
132
|
useEffect(() => {
|
|
143
133
|
//在这里找到当前菜单的上层目录
|
|
144
134
|
const paMenu = findParentMenu(menuList, '/' + location.pathname.split('/')[2])
|
|
@@ -155,6 +145,14 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
155
145
|
setSelectKey(selectedPath)
|
|
156
146
|
}, [location.pathname])
|
|
157
147
|
|
|
148
|
+
// 初始化折叠状态
|
|
149
|
+
const [collapsed, setCollapsed] = useState(localStorage.getItem('layout_collapsed') === 'true')
|
|
150
|
+
const [isCopied, setIsCopied] = useState({
|
|
151
|
+
account: false,
|
|
152
|
+
id: false,
|
|
153
|
+
tenantName: false,
|
|
154
|
+
tenantId: false,
|
|
155
|
+
})
|
|
158
156
|
|
|
159
157
|
const onOpenChange: MenuProps['onOpenChange'] = (keys) => {
|
|
160
158
|
// Find the last opened key
|
|
@@ -229,8 +227,8 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
229
227
|
setCollapsed(value)
|
|
230
228
|
}}
|
|
231
229
|
>
|
|
232
|
-
<div className="layout-side-
|
|
233
|
-
<div className="layout-side-
|
|
230
|
+
<div className="layout-side-mask1-cloud"></div>
|
|
231
|
+
<div className="layout-side-mask2-cloud"></div>
|
|
234
232
|
|
|
235
233
|
<div className="header-logo-cloud" style={{ justifyContent: collapsed ? 'center' : '', paddingLeft: collapsed ? '0' : '' }}>
|
|
236
234
|
<div
|
|
@@ -242,32 +240,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
242
240
|
{collapsed && <img className={`logo-sub`} src={subLogoUrl} />}
|
|
243
241
|
{/* {collapsed && <img className={`logo-base sub-logo`} src={logo || subLogoUrl} />} */}
|
|
244
242
|
</div>
|
|
245
|
-
{!collapsed && (
|
|
246
|
-
<div
|
|
247
|
-
className="trigger-cloud"
|
|
248
|
-
onClick={() => {
|
|
249
|
-
setCollapsed(true)
|
|
250
|
-
}}
|
|
251
|
-
>
|
|
252
|
-
<Arrow collapsed={true} type={type} />
|
|
253
|
-
</div>
|
|
254
|
-
)}
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
{collapsed && (
|
|
258
|
-
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
|
|
259
|
-
<div
|
|
260
|
-
className="close-trigger-cloud"
|
|
261
|
-
onClick={() => {
|
|
262
|
-
localStorage.setItem('layout_collapsed', 'false')
|
|
263
|
-
setCollapsed(false)
|
|
264
|
-
}}
|
|
265
|
-
>
|
|
266
|
-
<Arrow collapsed={false} type={type} />
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
)}
|
|
270
243
|
|
|
244
|
+
|
|
245
|
+
</div>
|
|
271
246
|
{!collapsed && <div style={{ height: 24 }}></div>}
|
|
272
247
|
|
|
273
248
|
<div style={{ width: '100%', padding: '0 16px' }}>
|
|
@@ -311,20 +286,18 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
311
286
|
content={
|
|
312
287
|
<div className="menu-popover">
|
|
313
288
|
{item.children.map((child: any) => {
|
|
314
|
-
const isSelected = selectKey.includes(child.key)
|
|
315
289
|
if (child.children) {
|
|
316
290
|
return (
|
|
317
291
|
<Popover
|
|
318
292
|
key={child.key}
|
|
319
293
|
align={{
|
|
320
|
-
offset: [
|
|
294
|
+
offset: [30, 0],
|
|
321
295
|
}}
|
|
322
296
|
placement="right"
|
|
323
297
|
arrow={false}
|
|
324
298
|
content={
|
|
325
299
|
<div className="menu-popover" style={{ width: '146px' }}>
|
|
326
300
|
{child.children.map((grandChild: any) => {
|
|
327
|
-
const isSelected = selectKey.includes(grandChild.key)
|
|
328
301
|
return (
|
|
329
302
|
<MenuItem
|
|
330
303
|
onClick={() => {
|
|
@@ -333,10 +306,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
333
306
|
}
|
|
334
307
|
}}
|
|
335
308
|
key={grandChild.key}
|
|
336
|
-
className=
|
|
309
|
+
className="grand-li"
|
|
337
310
|
>
|
|
338
|
-
<div
|
|
339
|
-
<span className=
|
|
311
|
+
<div className="menu-item-content">
|
|
312
|
+
<span className="menu-item-label">{grandChild.label}</span>
|
|
340
313
|
</div>
|
|
341
314
|
</MenuItem>
|
|
342
315
|
)
|
|
@@ -345,11 +318,11 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
345
318
|
}
|
|
346
319
|
>
|
|
347
320
|
<SubMenu
|
|
348
|
-
className=
|
|
321
|
+
className="menu-item-content sub-li"
|
|
349
322
|
key={child.key}
|
|
350
323
|
title={
|
|
351
324
|
<div className="sub-list">
|
|
352
|
-
<span className=
|
|
325
|
+
<span className="menu-item-label">{child.label}</span>
|
|
353
326
|
<RightOutlined />
|
|
354
327
|
</div>
|
|
355
328
|
}
|
|
@@ -365,7 +338,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
365
338
|
}
|
|
366
339
|
}}
|
|
367
340
|
key={child.key}
|
|
368
|
-
className={`sub-li ${isSelected ? 'sub-
|
|
341
|
+
className={`sub-li ${isSelected ? 'sub-selected' : ''}`}
|
|
369
342
|
>
|
|
370
343
|
<div className="menu-item-content sub-list">{child.label}</div>
|
|
371
344
|
</MenuItem>
|
|
@@ -375,7 +348,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
375
348
|
}
|
|
376
349
|
>
|
|
377
350
|
<SubMenu
|
|
378
|
-
className="menu-item-content
|
|
351
|
+
className="menu-item-content"
|
|
379
352
|
title={
|
|
380
353
|
<div className="sub-list">
|
|
381
354
|
<div>
|
|
@@ -448,19 +421,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
448
421
|
classNames += ' submenu-selected'
|
|
449
422
|
}
|
|
450
423
|
return (
|
|
451
|
-
<MenuItem
|
|
452
|
-
key={item.key}
|
|
453
|
-
onClick={() => {
|
|
454
|
-
if (onMenuClick && collapsed) {
|
|
455
|
-
onMenuClick(item)
|
|
456
|
-
}
|
|
457
|
-
}}
|
|
458
|
-
className="menu-item-content"
|
|
459
|
-
style={{
|
|
460
|
-
position: 'relative',
|
|
461
|
-
zIndex: 99,
|
|
462
|
-
}}
|
|
463
|
-
>
|
|
424
|
+
<MenuItem key={item.key} className="menu-item-content">
|
|
464
425
|
<div className="first-li">
|
|
465
426
|
<span className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}>{item.icon}</span>
|
|
466
427
|
{!collapsed && <span className={classNames}>{item.label}</span>}
|
|
@@ -522,7 +483,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
522
483
|
<span
|
|
523
484
|
style={{
|
|
524
485
|
display: 'inline-block',
|
|
525
|
-
marginLeft: '
|
|
486
|
+
marginLeft: '4px',
|
|
526
487
|
}}
|
|
527
488
|
className={`iconfont icon-zhankai ${infoOpen ? (infoOpen === 'up' ? 'up' : 'down') : ''}`}
|
|
528
489
|
></span>
|
|
@@ -540,7 +501,7 @@ function Arrow({ collapsed, type }: { collapsed?: boolean; type?: string }) {
|
|
|
540
501
|
return (
|
|
541
502
|
<svg style={{ transform: !collapsed ? 'rotate(180deg)' : 'rotate(0deg)' }} viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
|
|
542
503
|
<path
|
|
543
|
-
fill="#
|
|
504
|
+
fill="#FFFFFF"
|
|
544
505
|
d="M564.6336 775.168a41.5744 41.5744 0 0 0-13.312-28.672l-230.4-234.4448 229.9904-234.1888a42.0864 42.0864 0 0 0-26.3168-73.0112 42.0864 42.0864 0 0 0-30.6176 11.264L231.0656 481.024a41.984 41.984 0 0 0-2.4576 59.5968l1.9968 2.048 263.7824 265.6256a41.984 41.984 0 0 0 70.2464-33.0752z m254.5152 0a41.472 41.472 0 0 0-13.312-28.672L575.488 512l229.9904-234.1376a41.984 41.984 0 1 0-56.9344-61.7984L485.632 480.9728a42.0864 42.0864 0 0 0-2.4064 59.6992l0.8704 0.9216 0.8704 0.8192 0.4096 0.4096 263.5776 265.4208a41.984 41.984 0 0 0 70.1952-33.0752z"
|
|
545
506
|
></path>
|
|
546
507
|
</svg>
|
|
@@ -555,7 +516,17 @@ type SearchProps = {
|
|
|
555
516
|
setSelectKey: any
|
|
556
517
|
findKeyPath: (pathname: string) => string[]
|
|
557
518
|
}
|
|
519
|
+
|
|
520
|
+
type Router = { label: string; icon?: any; key: string; children?: Router[] }
|
|
521
|
+
|
|
558
522
|
function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPath }: SearchProps) {
|
|
523
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
524
|
+
const [searchHistory, setSearchHistory] = useState<Router[]>([])
|
|
525
|
+
const [searchResult, setSearchResult] = useState<Router[]>([])
|
|
526
|
+
const [isFocused, setIsFocused] = useState(false)
|
|
527
|
+
|
|
528
|
+
const name = (window as any).g_config.productCode
|
|
529
|
+
|
|
559
530
|
useEffect(() => {
|
|
560
531
|
const handleKeyDown = (event: KeyboardEvent) => {
|
|
561
532
|
if ((navigator.platform.toLowerCase().includes('mac') ? event.metaKey : event.ctrlKey) && event.key.toLowerCase() === 'k') {
|
|
@@ -568,7 +539,6 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
|
|
|
568
539
|
}
|
|
569
540
|
}
|
|
570
541
|
|
|
571
|
-
// Add click outside listener to close dropdown
|
|
572
542
|
const handleClickOutside = (event: MouseEvent) => {
|
|
573
543
|
const searchContainer = document.querySelector('.search-container')
|
|
574
544
|
if (searchContainer && !searchContainer.contains(event.target as Node)) {
|
|
@@ -585,15 +555,6 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
|
|
|
585
555
|
}
|
|
586
556
|
}, [])
|
|
587
557
|
|
|
588
|
-
type Router = { label: string; icon?: any; key: string; children?: Router[] }
|
|
589
|
-
|
|
590
|
-
const name = (window as any).g_config.productCode
|
|
591
|
-
|
|
592
|
-
const [searchTerm, setSearchTerm] = useState('')
|
|
593
|
-
const [searchHistory, setSearchHistory] = useState<Router[]>([])
|
|
594
|
-
const [searchResult, setSearchResult] = useState<Router[]>([])
|
|
595
|
-
const [isFocused, setIsFocused] = useState(false)
|
|
596
|
-
|
|
597
558
|
useEffect(() => {
|
|
598
559
|
const searchHistory = localStorage.getItem(name + 'searchHistory')
|
|
599
560
|
if (searchHistory) {
|
|
@@ -666,7 +627,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
|
|
|
666
627
|
<div className="search-container">
|
|
667
628
|
<div className="search-cloud">
|
|
668
629
|
<div className="search-bg-mask">
|
|
669
|
-
<img src="https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/base-component/menu-search-bg.png" />
|
|
630
|
+
<img src="https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/base-component/menu-search-bg-console.png" />
|
|
670
631
|
</div>
|
|
671
632
|
<input
|
|
672
633
|
autoComplete="off"
|
|
@@ -676,11 +637,16 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
|
|
|
676
637
|
className="search-input"
|
|
677
638
|
placeholder="搜索菜单..."
|
|
678
639
|
onFocus={() => setIsFocused(true)}
|
|
640
|
+
onBlur={(e) => {
|
|
641
|
+
if (!e.relatedTarget?.closest('.lists-cloud')) {
|
|
642
|
+
setIsFocused(false)
|
|
643
|
+
}
|
|
644
|
+
}}
|
|
679
645
|
/>
|
|
680
646
|
<div className="search-icon">
|
|
681
647
|
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
|
|
682
648
|
<path
|
|
683
|
-
fill=
|
|
649
|
+
fill="#C3CAEF"
|
|
684
650
|
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"
|
|
685
651
|
></path>
|
|
686
652
|
</svg>
|
|
@@ -688,14 +654,30 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
|
|
|
688
654
|
<div className="search-command" style={{ width: navigator.platform.toLowerCase().includes('mac') ? '' : '50px' }}>
|
|
689
655
|
{navigator.platform.toLowerCase().includes('mac') ? '⌘' : 'Ctrl+'}K
|
|
690
656
|
</div>
|
|
657
|
+
|
|
658
|
+
{/* <div
|
|
659
|
+
className='search-command'
|
|
660
|
+
style={{ width: '50px' }}
|
|
661
|
+
>
|
|
662
|
+
{'Ctrl+'}K
|
|
663
|
+
</div> */}
|
|
691
664
|
</div>
|
|
692
665
|
<div>
|
|
693
666
|
{isFocused && (
|
|
694
667
|
<>
|
|
695
668
|
{searchTerm ? (
|
|
696
|
-
<List
|
|
669
|
+
<List
|
|
670
|
+
tabIndex={-1}
|
|
671
|
+
split={false}
|
|
672
|
+
className="lists-cloud"
|
|
673
|
+
size="small"
|
|
674
|
+
bordered
|
|
675
|
+
dataSource={searchResult}
|
|
676
|
+
renderItem={(item) => <List.Item onClick={() => enter(item)}>{item.label}</List.Item>}
|
|
677
|
+
/>
|
|
697
678
|
) : (
|
|
698
679
|
<List
|
|
680
|
+
tabIndex={-1}
|
|
699
681
|
split={false}
|
|
700
682
|
className="lists-cloud"
|
|
701
683
|
header="最近访问"
|