cfel-base-components 2.6.6 → 2.6.7

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.6.6",
3
+ "version": "2.6.7",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -43,6 +43,10 @@ export interface LiosLayoutlProps {
43
43
  defaultOpenKeys?: string[]
44
44
  /** 自定义用户信息卡片内容(将完全替换内置的 UserCard) */
45
45
  userCard?: ReactNode
46
+ /** 自定义搜索输入占位文案,默认“搜索菜单...” */
47
+ searchPlaceholder?: string
48
+ /** 自定义“最近访问”标题文案,默认“最近访问” */
49
+ searchHistoryTitle?: string
46
50
  isHideHeader?: boolean //是否隐藏header
47
51
  onCollapse?: (value: boolean) => void
48
52
  type?: string
@@ -67,6 +71,8 @@ export default function LiosLayout(props: LiosLayoutlProps) {
67
71
  myWalletInfoAction,
68
72
  myLoginInfoAction,
69
73
  userCard,
74
+ searchPlaceholder,
75
+ searchHistoryTitle,
70
76
  isHideHeader,
71
77
  onCollapse,
72
78
  type,
@@ -276,7 +282,16 @@ export default function LiosLayout(props: LiosLayoutlProps) {
276
282
  {!collapsed && <div style={{ height: 24 }}></div>}
277
283
 
278
284
  <div style={{ width: '100%', padding: '0 16px' }}>
279
- <Search menuList={menuList} collapsed={collapsed} type={type || ''} umiHistory={umiHistory} setSelectKey={setSelectKey} findKeyPath={findKeyPath} />
285
+ <Search
286
+ menuList={menuList}
287
+ collapsed={collapsed}
288
+ type={type || ''}
289
+ umiHistory={umiHistory}
290
+ setSelectKey={setSelectKey}
291
+ findKeyPath={findKeyPath}
292
+ searchPlaceholder={searchPlaceholder}
293
+ searchHistoryTitle={searchHistoryTitle}
294
+ />
280
295
  </div>
281
296
 
282
297
  {!collapsed && <div style={{ height: 12 }}></div>}
@@ -568,8 +583,19 @@ type SearchProps = {
568
583
  umiHistory: any
569
584
  setSelectKey: any
570
585
  findKeyPath: (pathname: string) => string[]
586
+ searchPlaceholder?: string
587
+ searchHistoryTitle?: string
571
588
  }
572
- function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPath }: SearchProps) {
589
+ function Search({
590
+ menuList,
591
+ collapsed,
592
+ type,
593
+ umiHistory,
594
+ setSelectKey,
595
+ findKeyPath,
596
+ searchPlaceholder,
597
+ searchHistoryTitle,
598
+ }: SearchProps) {
573
599
  useEffect(() => {
574
600
  const handleKeyDown = (event: KeyboardEvent) => {
575
601
  if ((navigator.platform.toLowerCase().includes('mac') ? event.metaKey : event.ctrlKey) && event.key.toLowerCase() === 'k') {
@@ -688,7 +714,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
688
714
  value={searchTerm}
689
715
  onChange={(e) => handleSearch(e.target.value)}
690
716
  className="search-input"
691
- placeholder="搜索菜单..."
717
+ placeholder={searchPlaceholder ?? '搜索菜单...'}
692
718
  onFocus={() => setIsFocused(true)}
693
719
  />
694
720
  <div className="search-icon">
@@ -712,7 +738,7 @@ function Search({ menuList, collapsed, type, umiHistory, setSelectKey, findKeyPa
712
738
  <List
713
739
  split={false}
714
740
  className="lists"
715
- header="最近访问"
741
+ header={searchHistoryTitle ?? '最近访问'}
716
742
  size="small"
717
743
  bordered
718
744
  dataSource={searchHistory}
@@ -1,171 +1,133 @@
1
- import React from "react";
2
- import {
3
- SwapOutlined,
4
- FormOutlined,
5
- CopyOutlined,
6
- LogoutOutlined,
7
- } from "@ant-design/icons";
8
- import "./index.scss";
1
+ import React from 'react'
2
+ import { SwapOutlined, CopyOutlined, LogoutOutlined } from '@ant-design/icons'
3
+ import './index.scss'
9
4
 
10
5
  interface UserType {
11
- name: string;
12
- avatar: string;
13
- roleInfo: any[];
14
- id: string;
15
- account: string;
16
- isMaster: boolean;
17
- }
18
- interface CustomType {
19
- type: string;
20
- isCompleted: number;
21
- isAudited: number;
22
- hrefUrl: string;
23
- historyAction?: any;
6
+ name: string
7
+ avatar: string
8
+ roleInfo: any[]
9
+ id: string
10
+ account: string
11
+ isMaster: boolean
24
12
  }
13
+
25
14
  export interface MyWalletInfoType {
26
- availableCashAmount: string;
27
- availableAmount: string;
28
- currency: string;
15
+ availableCashAmount: string
16
+ availableAmount: string
17
+ currency: string
29
18
  }
30
19
  export interface MyLoginInfoType {
31
- isAdmin: any;
32
- }
33
- export interface AmountInfoType {
34
- residueNum: string;
35
- currencyCode: string;
20
+ isAdmin: any
36
21
  }
37
22
 
38
23
  export interface UserCardProps {
39
- myWalletInfo?: MyWalletInfoType;
40
- MyLoginInfo?: MyLoginInfoType;
41
- amountInfo?: AmountInfoType;
42
- customAction?: CustomType | any;
43
- isCopied?: Record<string, boolean>;
44
- copyTextToClipboard?: (value: string, key: string) => void;
24
+ myWalletInfo?: MyWalletInfoType
25
+ MyLoginInfo?: MyLoginInfoType
26
+ isCopied?: Record<string, boolean>
27
+ copyTextToClipboard?: (value: string, key: string) => void
45
28
  }
46
29
 
47
- const renderCurrency = (currency: string) => {
48
- switch (currency) {
49
- case "CNY":
50
- return "¥ ";
51
- case "USD":
52
- return "$ ";
53
- case "JPY":
54
- return "JP¥ ";
55
- default:
56
- return "¥ ";
57
- }
58
- };
59
-
60
- export default function UserCard({
61
- myWalletInfo,
62
- MyLoginInfo,
63
- amountInfo,
64
- customAction,
65
- isCopied,
66
- copyTextToClipboard,
67
- }: UserCardProps) {
68
- const { user, tenant, custom, switchTenantUrl, logoutUrl } = (window as any)
69
- ?.g_config;
70
-
71
- const { name, avatar, roleInfo, id, account, isMaster }: UserType =
72
- user || {};
73
-
74
- const { isCompleted, isAudited }: Partial<CustomType> = custom || {};
30
+ export default function UserCard({ MyLoginInfo, isCopied, copyTextToClipboard }: UserCardProps) {
31
+ const { user, tenant, switchTenantUrl, logoutUrl } = (window as any)?.g_config
75
32
 
76
- const { isAdmin }: MyLoginInfoType = (MyLoginInfo || {}) as MyLoginInfoType;
33
+ const { name, avatar, roleInfo, id, account }: UserType = user || {}
77
34
 
78
- const { residueNum, currencyCode }: AmountInfoType = (amountInfo || {}) as AmountInfoType;
35
+ const { isAdmin }: MyLoginInfoType = (MyLoginInfo || {}) as MyLoginInfoType
79
36
 
80
37
  const UserCard = () => {
81
38
  return (
82
- <div className="layout-user-card">
83
- <div className="user-info">
84
- <div className="user-avatarBox">
85
- <img className="user-avatar" src={avatar}/>
86
- <div className="user-mater">{isAdmin ? "主账号" : "子账号"}</div>
87
- </div>
88
- <div className="user-info-right">
89
- <span className="name">{name}</span>
90
- <div className="role-list">
91
- {roleInfo?.map((i) => (
92
- <span className="role-item" key={i}>
39
+ <div className="layout-user-card">
40
+ <div className="user-info">
41
+ <div className="user-avatarBox">
42
+ <img className="user-avatar" src={avatar} />
43
+ <div className="user-mater">{isAdmin ? '主账号' : '子账号'}</div>
44
+ </div>
45
+ <div className="user-info-right">
46
+ <span className="name">{name}</span>
47
+ <div className="role-list">
48
+ {roleInfo?.map((i) => (
49
+ <span className="role-item" key={i}>
93
50
  {i}
94
51
  </span>
95
- ))}
96
- </div>
52
+ ))}
97
53
  </div>
98
54
  </div>
99
- <div className="lios-userInfo">
100
- <div className="lios-li li-flex">
101
- <div className="lios-keyMare">账号ID</div>
102
- <div className="lios-valueMare" title={id}>{id}</div>
103
- <div
104
- className={isCopied?.['id'] ? "lios-iconDone" : "lios-icon"}
105
- onClick={() => {
106
- copyTextToClipboard && copyTextToClipboard(id, 'id');
107
- }}
108
- >
109
- {isCopied?.['id'] ? "已复制" : <CopyOutlined/>}
110
- </div>
55
+ </div>
56
+ <div className="lios-userInfo">
57
+ <div className="lios-li li-flex">
58
+ <div className="lios-keyMare">账号ID</div>
59
+ <div className="lios-valueMare" title={id}>
60
+ {id}
111
61
  </div>
112
- <div className="lios-li li-flex">
113
- <div className="lios-keyMare">账号</div>
114
- <div className="lios-valueMare" title={account}>
115
- {account}
116
- </div>
117
- <div
118
- className={isCopied?.['account'] ? "lios-iconDone" : "lios-icon"}
119
- onClick={() => {
120
- copyTextToClipboard && copyTextToClipboard(account, 'account');
121
- }}
122
- >
123
- {isCopied?.['account'] ? "已复制" : <CopyOutlined/>}
124
- </div>
62
+ <div
63
+ className={isCopied?.['id'] ? 'lios-iconDone' : 'lios-icon'}
64
+ onClick={() => {
65
+ copyTextToClipboard && copyTextToClipboard(id, 'id')
66
+ }}
67
+ >
68
+ {isCopied?.['id'] ? '已复制' : <CopyOutlined />}
125
69
  </div>
126
-
127
- <div className="lios-li li-flex">
128
- <div className="lios-keyMare">租户ID</div>
129
- <div className="lios-valueMare" title={tenant?.id}>{tenant?.id}</div>
130
- <div
131
- className={isCopied?.['tenantId'] ? "lios-iconDone" : "lios-icon"}
132
- onClick={() => {
133
- copyTextToClipboard && copyTextToClipboard(tenant?.id, 'tenantId');
134
- }}
135
- >
136
- {isCopied?.['tenantId'] ? "已复制" : <CopyOutlined/>}
137
- </div>
70
+ </div>
71
+ <div className="lios-li li-flex">
72
+ <div className="lios-keyMare">账号</div>
73
+ <div className="lios-valueMare" title={account}>
74
+ {account}
138
75
  </div>
139
- <div className="lios-li li-flex">
140
- <div className="lios-keyMare">租户</div>
141
- <div className="lios-valueMare" title={tenant?.name}>{tenant?.name}</div>
76
+ <div
77
+ className={isCopied?.['account'] ? 'lios-iconDone' : 'lios-icon'}
78
+ onClick={() => {
79
+ copyTextToClipboard && copyTextToClipboard(account, 'account')
80
+ }}
81
+ >
82
+ {isCopied?.['account'] ? '已复制' : <CopyOutlined />}
142
83
  </div>
143
84
  </div>
144
85
 
145
-
146
- <div className="lios-logoutBox">
147
- <div
148
- className="lios-logout"
149
- onClick={() => {
150
- location.href = switchTenantUrl;
151
- }}
152
- >
153
- <SwapOutlined className="logout-icon"/>
154
- 切换租户
86
+ <div className="lios-li li-flex">
87
+ <div className="lios-keyMare">租户ID</div>
88
+ <div className="lios-valueMare" title={tenant?.id}>
89
+ {tenant?.id}
155
90
  </div>
156
91
  <div
157
- className="lios-logout"
158
- onClick={() => {
159
- location.href = logoutUrl;
160
- }}
92
+ className={isCopied?.['tenantId'] ? 'lios-iconDone' : 'lios-icon'}
93
+ onClick={() => {
94
+ copyTextToClipboard && copyTextToClipboard(tenant?.id, 'tenantId')
95
+ }}
161
96
  >
162
- <LogoutOutlined className="logout-icon"/>
163
- 退出登录
97
+ {isCopied?.['tenantId'] ? '已复制' : <CopyOutlined />}
164
98
  </div>
165
99
  </div>
100
+ <div className="lios-li li-flex">
101
+ <div className="lios-keyMare">租户</div>
102
+ <div className="lios-valueMare" title={tenant?.name}>
103
+ {tenant?.name}
104
+ </div>
105
+ </div>
106
+ </div>
107
+
108
+ <div className="lios-logoutBox">
109
+ <div
110
+ className="lios-logout"
111
+ onClick={() => {
112
+ location.href = switchTenantUrl
113
+ }}
114
+ >
115
+ <SwapOutlined className="logout-icon" />
116
+ 切换租户
117
+ </div>
118
+ <div
119
+ className="lios-logout"
120
+ onClick={() => {
121
+ location.href = logoutUrl
122
+ }}
123
+ >
124
+ <LogoutOutlined className="logout-icon" />
125
+ 退出登录
126
+ </div>
166
127
  </div>
167
- );
168
- };
128
+ </div>
129
+ )
130
+ }
169
131
 
170
- return UserCard();
132
+ return UserCard()
171
133
  }
package/src/index.tsx CHANGED
@@ -1,5 +1,4 @@
1
1
  import LiosLayout, { LiosLayoutlProps } from './components/layout'
2
- import UserCard, { UserCardProps } from './components/layout/user-card'
3
2
  import PageContainer from './components/base-component/PageContainer'
4
3
  import CopyRight from './components/base-component/CopyRight'
5
4
  import QueryFilter from './components/base-component/QueryFilter'
@@ -21,8 +20,6 @@ import { getUrlParams, downloadFile, timeFormatter } from './utils/index'
21
20
  export {
22
21
  LiosLayout,
23
22
  LiosLayoutlProps,
24
- UserCard,
25
- UserCardProps,
26
23
  CopyRight,
27
24
  PageContainer,
28
25
  QueryFilter,