cfel-base-components 2.5.52 → 2.5.53

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,9 +3,9 @@ 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 './index.scss'
7
6
  import Layout from '../../src/components/layout'
8
- import LayoutConsole from '../../src/components/layout-console'
7
+ //import Layout from '../../src/components/layout-console'
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';
11
11
  import CpcRole from '../../src/components/universal-pages/cpcRole'
@@ -13,24 +13,36 @@ import CpcRoleInfo from '../../src/components/universal-pages/cpcRoleInfo'
13
13
  import ProTable from '../../src/components/base-component/ProTable'
14
14
  import PageContainer from '../../src/components/base-component/PageContainer'
15
15
 
16
- const menu = [
16
+ const menuList = [
17
17
  {
18
18
  label: '云厂商',
19
- icon: <i className="iconfont icon-wangluo" />,
19
+ icon: <SwapOutlined />,
20
20
  key: 'cloud-list',
21
21
  },
22
22
  {
23
23
  label: '产品模型',
24
- icon: <i className="iconfont icon-jiqun" />,
24
+ icon: <SwapOutlined />,
25
25
  key: 'catalog',
26
26
  children: [
27
27
  {
28
28
  label: '产品模型',
29
29
  key: 'product-list',
30
+ children: [
31
+ {
32
+ label: '产品模型',
33
+ key: 'product-list',
34
+ },
35
+ ],
30
36
  },
31
37
  {
32
38
  label: '商品模型',
33
39
  key: 'commodity-list',
40
+ children: [
41
+ {
42
+ label: '产品模型',
43
+ key: 'product-list',
44
+ },
45
+ ],
34
46
  },
35
47
  {
36
48
  label: '定价项列表',
@@ -44,7 +56,7 @@ const menu = [
44
56
  },
45
57
  {
46
58
  label: '数据字典',
47
- icon: <i className="iconfont icon-shujuzidian" />,
59
+ icon: <SwapOutlined />,
48
60
  key: 'dictionary-list',
49
61
  },
50
62
  {
@@ -230,6 +242,7 @@ const App = () => {
230
242
  tableData: false,
231
243
  }}></CpcRoleInfo> */}
232
244
  <PageContainer>
245
+ <QuestionCircleTwoTone twoToneColor='orange' />
233
246
  <ProTable columns={columns} nameSpace="device" dataSource={[{ name: '1', description: '1', status: '1' }]} />
234
247
  </PageContainer>
235
248
  </Layout>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.5.52",
3
+ "version": "2.5.53",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -2,7 +2,7 @@
2
2
  // This file is generated by Umi automatically
3
3
  // DO NOT CHANGE IT MANUALLY!
4
4
  import React from 'react';
5
- import { HelmetProvider } from '/Users/lionaillen/Documents/workPlace/cfel/base-components/node_modules/.pnpm/@umijs+renderer-react@4.0.72_react-dom@18.1.0_react@18.1.0/node_modules/@umijs/renderer-react';
5
+ import { HelmetProvider } from '/Users/lionaillen/Documents/work/cfel/base-components/node_modules/.pnpm/@umijs+renderer-react@4.0.72_react-dom@18.1.0_react@18.1.0__react@18.1.0/node_modules/@umijs/renderer-react';
6
6
  import { context } from './helmetContext';
7
7
 
8
8
  export const innerProvider = (container) => {
@@ -92,6 +92,20 @@ ul {
92
92
 
93
93
 
94
94
  > li {
95
+ .first-li {
96
+ &:hover {
97
+ .menu-item-icon {
98
+ color: #185dff;
99
+ font-weight: 500;
100
+ }
101
+
102
+ .menu-item-label {
103
+ color: #185dff;
104
+ font-weight: 500;
105
+ }
106
+ }
107
+ }
108
+
95
109
  &:hover {
96
110
  > .menu-item-content {
97
111
  .menu-item-icon,
@@ -167,7 +181,6 @@ ul {
167
181
  &:hover {
168
182
  > .menu-item-content {
169
183
  .menu-item-icon,
170
- .iconfont,
171
184
  .menu-item-label {
172
185
  color: #185dff;
173
186
  font-weight: 500;
@@ -261,7 +274,6 @@ ul {
261
274
  &:hover {
262
275
  > .menu-item-content {
263
276
  .menu-item-icon,
264
- .iconfont,
265
277
  .menu-item-label {
266
278
  color: #185dff;
267
279
  font-weight: 500;
@@ -234,6 +234,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
234
234
  <div
235
235
  className="close-trigger"
236
236
  onClick={() => {
237
+ localStorage.setItem('layout_collapsed', 'false')
237
238
  setCollapsed(false)
238
239
  }}
239
240
  >
@@ -344,7 +345,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
344
345
  zIndex: 99,
345
346
  }}
346
347
  >
347
- <div>
348
+ <div className="first-li">
348
349
  <span className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}>{item.icon}</span>
349
350
  {!collapsed && <span className={classNames}>{item.label}</span>}
350
351
  </div>
@@ -423,7 +424,7 @@ function Arrow({ collapsed, type }: { collapsed?: boolean; type?: string }) {
423
424
  return (
424
425
  <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">
425
426
  <path
426
- fill={type === 'console' ? '#FFFFFF' : '#817F9B'}
427
+ fill="817F9B"
427
428
  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"
428
429
  ></path>
429
430
  </svg>
@@ -21,6 +21,8 @@ ul {
21
21
  margin: 0;
22
22
  list-style: none;
23
23
  cursor: pointer;
24
+ position: relative;
25
+ z-index: 90;
24
26
 
25
27
  .#{$menuPrefixCls}-submenu-arrow {
26
28
  display: inline-block;
@@ -89,6 +91,20 @@ ul {
89
91
 
90
92
 
91
93
  > li {
94
+ .first-li {
95
+ &:hover {
96
+ .menu-item-icon {
97
+ color: #fff;
98
+ font-weight: 500;
99
+ }
100
+
101
+ .menu-item-label {
102
+ color: #fff;
103
+ font-weight: 500;
104
+ }
105
+ }
106
+ }
107
+
92
108
  &:hover {
93
109
  > .menu-item-content {
94
110
  .menu-item-icon,
@@ -363,7 +379,6 @@ ul {
363
379
  &:hover {
364
380
  > .menu-item-content {
365
381
  .menu-item-icon,
366
- .iconfont,
367
382
  .menu-item-label {
368
383
  color: #fff;
369
384
  }
@@ -534,6 +549,7 @@ body {
534
549
  }
535
550
 
536
551
  .layout-side-mask2-console {
552
+ z-index: 10;
537
553
  background: linear-gradient(227deg, #7856e6 0%, #6a6ed2 0%, #0271c3 100%) !important;
538
554
  border: 2px solid #ffffff;
539
555
  position: absolute;
@@ -64,7 +64,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
64
64
  isHideHeader,
65
65
  onCollapse,
66
66
  type,
67
- umiHistory
67
+ umiHistory,
68
68
  } = props
69
69
 
70
70
  const findKeyPath = (pathname: string) => {
@@ -88,9 +88,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
88
88
  }
89
89
 
90
90
  // 初始化选中菜单
91
- const [selectKey, setSelectKey] = useState<any>(
92
- findKeyPath('/' + location.pathname.split('/')[2])
93
- )
91
+ const [selectKey, setSelectKey] = useState<any>(findKeyPath('/' + location.pathname.split('/')[2]))
94
92
 
95
93
  const [infoOpen, setInfoOpen] = useState<string | null>(null)
96
94
 
@@ -135,7 +133,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
135
133
  //在这里找到当前菜单的上层目录
136
134
  const paMenu = findParentMenu(menuList, '/' + location.pathname.split('/')[2])
137
135
  //去重
138
- const set = new Set(paMenu.map(item => item.key))
136
+ const set = new Set(paMenu.map((item) => item.key))
139
137
  openKeys.forEach((element: string) => {
140
138
  set.add(element)
141
139
  })
@@ -148,10 +146,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
148
146
  account: false,
149
147
  id: false,
150
148
  tenantName: false,
151
- tenantId: false
149
+ tenantId: false,
152
150
  })
153
151
 
154
- const onOpenChange: MenuProps['onOpenChange'] = keys => {
152
+ const onOpenChange: MenuProps['onOpenChange'] = (keys) => {
155
153
  setOpenKeys(keys)
156
154
  }
157
155
 
@@ -165,7 +163,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
165
163
  // 菜单动画
166
164
  const collapseNode = () => {
167
165
  return {
168
- height: 0
166
+ height: 0,
169
167
  }
170
168
  }
171
169
  const expandNode = (node: any) => {
@@ -179,26 +177,26 @@ export default function LiosLayout(props: LiosLayoutlProps) {
179
177
  onEnterStart: collapseNode,
180
178
  onEnterActive: expandNode,
181
179
  onLeaveStart: expandNode,
182
- onLeaveActive: collapseNode
180
+ onLeaveActive: collapseNode,
183
181
  }
184
182
 
185
183
  const verticalMotion = {
186
184
  motionName: 'rc-menu-open-zoom',
187
185
  motionAppear: true,
188
186
  motionEnter: true,
189
- motionLeave: true
187
+ motionLeave: true,
190
188
  }
191
189
 
192
190
  return (
193
- <Layout className='layout-warps-console'>
191
+ <Layout className="layout-warps-console">
194
192
  {Array.isArray(menuList) && menuList.length > 0 && (
195
193
  <Sider
196
- className='layout-side-console'
194
+ className="layout-side-console"
197
195
  collapsible
198
196
  trigger={null}
199
197
  collapsed={collapsed}
200
198
  width={260}
201
- onCollapse={value => {
199
+ onCollapse={(value) => {
202
200
  if (onCollapse) {
203
201
  onCollapse(value)
204
202
  }
@@ -206,12 +204,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
206
204
  setCollapsed(value)
207
205
  }}
208
206
  >
209
- <div className='layout-side-mask2-console'></div>
207
+ <div className="layout-side-mask2-console"></div>
210
208
 
211
- <div
212
- className='header-logo-console'
213
- style={{ justifyContent: collapsed ? 'center' : '', paddingLeft: collapsed ? '0' : '' }}
214
- >
209
+ <div className="header-logo-console" style={{ justifyContent: collapsed ? 'center' : '', paddingLeft: collapsed ? '0' : '' }}>
215
210
  <div
216
211
  onClick={() => {
217
212
  window.open('/home')
@@ -237,8 +232,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
237
232
  {collapsed && (
238
233
  <div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
239
234
  <div
240
- className='close-trigger-console'
235
+ className="close-trigger-console"
241
236
  onClick={() => {
237
+ localStorage.setItem('layout_collapsed', 'false')
242
238
  setCollapsed(false)
243
239
  }}
244
240
  >
@@ -250,19 +246,12 @@ export default function LiosLayout(props: LiosLayoutlProps) {
250
246
  <div style={{ height: 24 }}></div>
251
247
 
252
248
  <div style={{ width: '100%', padding: '0 16px' }}>
253
- <Search
254
- menuList={menuList}
255
- collapsed={collapsed}
256
- type={type || ''}
257
- umiHistory={umiHistory}
258
- setSelectKey={setSelectKey}
259
- findKeyPath={findKeyPath}
260
- />
249
+ <Search menuList={menuList} collapsed={collapsed} type={type || ''} umiHistory={umiHistory} setSelectKey={setSelectKey} findKeyPath={findKeyPath} />
261
250
  </div>
262
251
 
263
252
  {!collapsed && <div style={{ height: 12 }}></div>}
264
253
 
265
- <div className='layout-menu-console'>
254
+ <div className="layout-menu-console">
266
255
  <RcMenu
267
256
  mode={collapsed ? 'vertical' : 'inline'}
268
257
  className={`menu-console${collapsed ? '-collapsed' : ''}`}
@@ -276,7 +265,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
276
265
  onMenuClick(item)
277
266
  }
278
267
  }}
279
- triggerSubMenuAction='hover'
268
+ triggerSubMenuAction="hover"
280
269
  >
281
270
  {menuList.map((item: any) => {
282
271
  const isSelected = selectKey.includes(item.key)
@@ -287,17 +276,13 @@ export default function LiosLayout(props: LiosLayoutlProps) {
287
276
  }
288
277
  return (
289
278
  <SubMenu
290
- popupClassName='rc-menu-submenu-popup'
279
+ popupClassName="rc-menu-submenu-popup"
291
280
  key={item.key}
292
- className='menu-item-content'
281
+ className="menu-item-content"
293
282
  title={
294
- <div className='sub-list'>
295
- <div className='menu-item-inner'>
296
- <span
297
- className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}
298
- >
299
- {item.icon}
300
- </span>
283
+ <div className="sub-list">
284
+ <div className="menu-item-inner">
285
+ <span className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}>{item.icon}</span>
301
286
  {!collapsed && <span className={classNames}>{item.label}</span>}
302
287
  </div>
303
288
  </div>
@@ -314,20 +299,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
314
299
  if (child.children) {
315
300
  return (
316
301
  <SubMenu
317
- popupClassName='rc-menu-submenu-popup'
318
- className='menu-item-content sub-li'
302
+ popupClassName="rc-menu-submenu-popup"
303
+ className="menu-item-content sub-li"
319
304
  key={child.key}
320
- title={
321
- <div className='sub-list'>
322
- {!collapsed && (
323
- <span
324
- className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}
325
- >
326
- {child.label}
327
- </span>
328
- )}
329
- </div>
330
- }
305
+ title={<div className="sub-list">{!collapsed && <span className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}>{child.label}</span>}</div>}
331
306
  >
332
307
  {child.children.map((grandChild: any) => {
333
308
  const isSelected = selectKey.includes(grandChild.key)
@@ -338,16 +313,8 @@ export default function LiosLayout(props: LiosLayoutlProps) {
338
313
  }
339
314
  }
340
315
  return (
341
- <MenuItem key={grandChild.key} className='grand-li'>
342
- <div className='menu-item-content'>
343
- {!collapsed && (
344
- <span
345
- className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}
346
- >
347
- {grandChild.label}
348
- </span>
349
- )}
350
- </div>
316
+ <MenuItem key={grandChild.key} className="grand-li">
317
+ <div className="menu-item-content">{!collapsed && <span className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}>{grandChild.label}</span>}</div>
351
318
  </MenuItem>
352
319
  )
353
320
  })}
@@ -355,16 +322,8 @@ export default function LiosLayout(props: LiosLayoutlProps) {
355
322
  )
356
323
  }
357
324
  return (
358
- <MenuItem key={child.key} className='sub-li'>
359
- <div className='menu-item-content'>
360
- {!collapsed && (
361
- <span
362
- className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}
363
- >
364
- {child.label}
365
- </span>
366
- )}
367
- </div>
325
+ <MenuItem key={child.key} className="sub-li">
326
+ <div className="menu-item-content">{!collapsed && <span className={`menu-item-label ${isSelected ? 'submenu-selected' : ''}`}>{child.label}</span>}</div>
368
327
  </MenuItem>
369
328
  )
370
329
  })}
@@ -378,11 +337,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
378
337
  classNames += ' submenu-selected'
379
338
  }
380
339
  return (
381
- <MenuItem key={item.key} className='menu-item-content'>
382
- <div>
383
- <span className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}>
384
- {item.icon}
385
- </span>
340
+ <MenuItem key={item.key} className="menu-item-content">
341
+ <div className="first-li">
342
+ <span className={`menu-item-icon ${isSelected ? 'submenu-selected' : ''}`}>{item.icon}</span>
386
343
  {!collapsed && <span className={classNames}>{item.label}</span>}
387
344
  </div>
388
345
  </MenuItem>
@@ -394,21 +351,21 @@ export default function LiosLayout(props: LiosLayoutlProps) {
394
351
  </Sider>
395
352
  )}
396
353
 
397
- <div className='layout-main-console'>
354
+ <div className="layout-main-console">
398
355
  {!isHideHeader && (
399
- <div className='layout-header-console'>
356
+ <div className="layout-header-console">
400
357
  {appName && (
401
- <div className='app-name'>
358
+ <div className="app-name">
402
359
  <strong>{appName}</strong>
403
360
  </div>
404
361
  )}
405
362
 
406
- <div className='layout-header-fill-console' />
363
+ <div className="layout-header-fill-console" />
407
364
 
408
- <div className='layout-header-actions-console'>
365
+ <div className="layout-header-actions-console">
409
366
  {actions?.map((item, index) => {
410
367
  return (
411
- <div className='actions-item' key={index}>
368
+ <div className="actions-item" key={index}>
412
369
  {item}
413
370
  </div>
414
371
  )
@@ -416,40 +373,33 @@ export default function LiosLayout(props: LiosLayoutlProps) {
416
373
  </div>
417
374
 
418
375
  <Popover
419
- placement='bottom'
376
+ placement="bottom"
420
377
  content={
421
- <UserCard
422
- myWalletInfo={myWalletInfo}
423
- MyLoginInfo={MyLoginInfo}
424
- amountInfo={amountInfo}
425
- customAction={customAction}
426
- isCopied={isCopied}
427
- copyTextToClipboard={copyTextToClipboard}
428
- />
378
+ <UserCard myWalletInfo={myWalletInfo} MyLoginInfo={MyLoginInfo} amountInfo={amountInfo} customAction={customAction} isCopied={isCopied} copyTextToClipboard={copyTextToClipboard} />
429
379
  }
430
380
  arrow={false}
431
- trigger='click'
432
- onOpenChange={e => {
381
+ trigger="click"
382
+ onOpenChange={(e) => {
433
383
  setInfoOpen(e ? 'up' : 'down')
434
384
  if (!e) return
435
385
  setIsCopied({
436
386
  account: false,
437
387
  id: false,
438
388
  tenantName: false,
439
- tenantId: false
389
+ tenantId: false,
440
390
  })
441
391
  if (myLoginInfoAction) {
442
392
  myLoginInfoAction()
443
393
  }
444
394
  }}
445
395
  >
446
- <div className='layout-header-user-console'>
447
- <img className='avatar' src={avatar} />
448
- <div className='name'>{name}</div>
396
+ <div className="layout-header-user-console">
397
+ <img className="avatar" src={avatar} />
398
+ <div className="name">{name}</div>
449
399
  <span
450
400
  style={{
451
401
  display: 'inline-block',
452
- marginLeft: '4px'
402
+ marginLeft: '4px',
453
403
  }}
454
404
  className={`iconfont icon-zhankai ${infoOpen ? (infoOpen === 'up' ? 'up' : 'down') : ''}`}
455
405
  ></span>
@@ -457,7 +407,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
457
407
  </Popover>
458
408
  </div>
459
409
  )}
460
- <div className='layout-content-console'>{props.children}</div>
410
+ <div className="layout-content-console">{props.children}</div>
461
411
  </div>
462
412
  </Layout>
463
413
  )
@@ -465,17 +415,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
465
415
 
466
416
  function Arrow({ collapsed, type }: { collapsed?: boolean; type?: string }) {
467
417
  return (
468
- <svg
469
- style={{ transform: !collapsed ? 'rotate(180deg)' : 'rotate(0deg)' }}
470
- viewBox='0 0 1024 1024'
471
- version='1.1'
472
- xmlns='http://www.w3.org/2000/svg'
473
- width='20'
474
- height='20'
475
- >
418
+ <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">
476
419
  <path
477
- fill={type === 'console' ? '#FFFFFF' : '#817F9B'}
478
- 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'
420
+ fill="FFFFFF"
421
+ 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"
479
422
  ></path>
480
423
  </svg>
481
424
  )
@@ -502,10 +445,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
502
445
 
503
446
  useEffect(() => {
504
447
  const handleKeyDown = (event: KeyboardEvent) => {
505
- if (
506
- (navigator.platform.toLowerCase().includes('mac') ? event.metaKey : event.ctrlKey) &&
507
- event.key.toLowerCase() === 'k'
508
- ) {
448
+ if ((navigator.platform.toLowerCase().includes('mac') ? event.metaKey : event.ctrlKey) && event.key.toLowerCase() === 'k') {
509
449
  event.preventDefault()
510
450
  const searchInput = document.querySelector('#menu-input') as HTMLInputElement
511
451
  if (searchInput) {
@@ -544,7 +484,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
544
484
  search(menuList as Router[])
545
485
  setSearchResult(searchResults)
546
486
  function search(data: Router[]) {
547
- data.forEach(item => {
487
+ data.forEach((item) => {
548
488
  if (typeof item.label === 'string' && item.label.includes(value.toLocaleUpperCase())) {
549
489
  searchResults.push(item)
550
490
  }
@@ -558,7 +498,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
558
498
  const enter = (item: Router) => {
559
499
  setIsFocused(false)
560
500
  //如果搜索历史里面有这个item,就不再添加
561
- if (searchHistory.findIndex(i => i.key === item.key) === -1) {
501
+ if (searchHistory.findIndex((i) => i.key === item.key) === -1) {
562
502
  setSearchHistory([...searchHistory, item])
563
503
  }
564
504
  //如果是目录就找到目录下第一个菜单进入
@@ -585,65 +525,50 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
585
525
  }
586
526
 
587
527
  const deleteHistory = (item: Router) => {
588
- setSearchHistory(searchHistory.filter(i => i.key !== item.key))
528
+ setSearchHistory(searchHistory.filter((i) => i.key !== item.key))
589
529
  }
590
530
  return (
591
531
  <>
592
532
  {collapsed ? (
593
- <div className='search-mobile-console'>
594
- <div className='search-icon'>
595
- <svg
596
- viewBox='0 0 1024 1024'
597
- version='1.1'
598
- xmlns='http://www.w3.org/2000/svg'
599
- width='18'
600
- height='18'
601
- >
533
+ <div className="search-mobile-console">
534
+ <div className="search-icon">
535
+ <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
602
536
  <path
603
- fill='#C3CAEF'
604
- 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'
537
+ fill="#C3CAEF"
538
+ 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"
605
539
  ></path>
606
540
  </svg>
607
541
  </div>
608
542
  </div>
609
543
  ) : (
610
544
  <div>
611
- <div className='search-console'>
612
- <div className='search-bg-mask'>
613
- <img src='https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/base-component/menu-search-bg-console.png' />
545
+ <div className="search-console">
546
+ <div className="search-bg-mask">
547
+ <img src="https://cfel-front.oss-cn-hangzhou.aliyuncs.com/logo/base-component/menu-search-bg-console.png" />
614
548
  </div>
615
549
  <input
616
- autoComplete='off'
617
- id='menu-input'
550
+ autoComplete="off"
551
+ id="menu-input"
618
552
  value={searchTerm}
619
- onChange={e => handleSearch(e.target.value)}
620
- className='search-input'
621
- placeholder='搜索菜单...'
553
+ onChange={(e) => handleSearch(e.target.value)}
554
+ className="search-input"
555
+ placeholder="搜索菜单..."
622
556
  onFocus={() => setIsFocused(true)}
623
- onBlur={e => {
557
+ onBlur={(e) => {
624
558
  if (!e.relatedTarget?.closest('.lists-console')) {
625
559
  setIsFocused(false)
626
560
  }
627
561
  }}
628
562
  />
629
- <div className='search-icon'>
630
- <svg
631
- viewBox='0 0 1024 1024'
632
- version='1.1'
633
- xmlns='http://www.w3.org/2000/svg'
634
- width='18'
635
- height='18'
636
- >
563
+ <div className="search-icon">
564
+ <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
637
565
  <path
638
- fill='#C3CAEF'
639
- 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'
566
+ fill="#C3CAEF"
567
+ 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"
640
568
  ></path>
641
569
  </svg>
642
570
  </div>
643
- <div
644
- className='search-command'
645
- style={{ width: navigator.platform.toLowerCase().includes('mac') ? '' : '50px' }}
646
- >
571
+ <div className="search-command" style={{ width: navigator.platform.toLowerCase().includes('mac') ? '' : '50px' }}>
647
572
  {navigator.platform.toLowerCase().includes('mac') ? '⌘' : 'Ctrl+'}K
648
573
  </div>
649
574
 
@@ -661,31 +586,29 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
661
586
  <List
662
587
  tabIndex={-1}
663
588
  split={false}
664
- className='lists-console'
665
- size='small'
589
+ className="lists-console"
590
+ size="small"
666
591
  bordered
667
592
  dataSource={searchResult}
668
- renderItem={item => (
669
- <List.Item onClick={() => enter(item)}>{item.label}</List.Item>
670
- )}
593
+ renderItem={(item) => <List.Item onClick={() => enter(item)}>{item.label}</List.Item>}
671
594
  />
672
595
  ) : (
673
596
  <List
674
597
  tabIndex={-1}
675
598
  split={false}
676
- className='lists-console'
677
- header='最近访问'
678
- size='small'
599
+ className="lists-console"
600
+ header="最近访问"
601
+ size="small"
679
602
  bordered
680
603
  dataSource={searchHistory}
681
- renderItem={item => {
604
+ renderItem={(item) => {
682
605
  return (
683
606
  <div
684
607
  className={'search-item'}
685
608
  style={{
686
609
  display: 'flex',
687
610
  justifyContent: 'space-between',
688
- alignItems: 'center'
611
+ alignItems: 'center',
689
612
  }}
690
613
  >
691
614
  <List.Item onClick={() => enter(item)}>{item.label}</List.Item>
package/src/global.d.ts CHANGED
@@ -47,5 +47,3 @@ export interface Label {
47
47
  value: string
48
48
  children?: Label[]
49
49
  }
50
-
51
- declare module '*.scss'
File without changes