cfel-base-components 2.0.14 → 2.1.0

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.
@@ -12,45 +12,43 @@ import CpcRole from '../../src/components/universal-pages/cpcRole';
12
12
  // import RoleInfo from '../../src/components/universal-pages/roleInfo';
13
13
 
14
14
  const App = () => {
15
- return <PageContainer className={"aaa"}>
16
- <Layout
17
- productList={false}
18
- menuList={[
15
+ return <div >
16
+ <Layout
17
+ appName="控制台"
18
+ productList={false}
19
+ menuList={[
20
+ {
21
+ label: '设备中心',
22
+ key: 'device',
23
+ icon: <SwapOutlined />,
24
+ children: [
19
25
  {
20
- label: '设备中心',
21
- key: 'device',
22
- icon: <SwapOutlined />,
23
- children: [
24
- {
25
- label: '设备管理',
26
- key: 'device-list',
27
- },
28
- ],
26
+ label: '设备管理',
27
+ key: 'device-list',
29
28
  },
30
- ]}
31
- logoData={{
32
- type:'img',
33
- content:'运营平台'
34
- }}
35
- user={{
36
- name: (window)?.g_config?.user?.name,
37
- avatar: (window)?.g_config?.user?.avatar,
38
- tenantName: (window)?.g_config?.tenant?.name,
39
- role: (window)?.g_config?.user?.roleInfo,
40
- }}
41
- custom={{
42
- type:(window)?.g_config?.custom?.type,
43
- isCompleted:(window)?.g_config?.custom?.isCompleted,
44
- isAudited:(window)?.g_config?.custom?.isAudited,
45
- hrefUrl:'/web/user-info',
46
- historyAction:history
47
- }}
48
- logoutUrl={(window)?.g_config?.logoutUrl}
49
- switchTenantUrl={(window)?.g_config?.switchTenantUrl}
50
- >
51
- <CpcRole></CpcRole>
52
- </Layout>
53
- </PageContainer>
29
+ ],
30
+ },
31
+ ]}
32
+ logoUrl={"https://cdn.chengfengerlai.com/logo/company-logo/chengfengerlai-puhui.png"}
33
+ user={{
34
+ name: (window)?.g_config?.user?.name,
35
+ avatar: (window)?.g_config?.user?.avatar,
36
+ tenantName: (window)?.g_config?.tenant?.name,
37
+ role: (window)?.g_config?.user?.roleInfo,
38
+ }}
39
+ custom={{
40
+ type: (window)?.g_config?.custom?.type,
41
+ isCompleted: (window)?.g_config?.custom?.isCompleted,
42
+ isAudited: (window)?.g_config?.custom?.isAudited,
43
+ hrefUrl: '/web/user-info',
44
+ historyAction: history
45
+ }}
46
+ logoutUrl={(window)?.g_config?.logoutUrl}
47
+ switchTenantUrl={(window)?.g_config?.switchTenantUrl}
48
+ >
49
+ <CpcRole></CpcRole>
50
+ </Layout>
51
+ </div>
54
52
  }
55
53
  const container = document.getElementById('root');
56
54
  const root = createRoot(container);
@@ -2,6 +2,3 @@
2
2
  padding: 0px;
3
3
  margin: 0px;
4
4
  }
5
- .aaa {
6
- background: red;
7
- }
@@ -1,4 +0,0 @@
1
- .a {
2
- background: red;
3
- height: calc(100vh - 48px);
4
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "2.0.14",
3
+ "version": "2.1.0",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -11,11 +11,13 @@
11
11
  background: white;
12
12
  border-radius: 8px;
13
13
  flex: 1;
14
+ padding-bottom: 24px;
14
15
  }
15
16
 
16
17
  .foot-empower {
17
18
  text-align: center;
18
19
  color: #ccc;
19
20
  font-size: 12px;
20
- padding: 4px;
21
+ padding: 4px 0 8px;
22
+ letter-spacing: .2px;
21
23
  }
@@ -21,7 +21,7 @@ export default function PageContainer({
21
21
  </div>
22
22
 
23
23
  <div className={cx("foot-empower")}>
24
- ©{new Date().getFullYear() || ''} 骋风而来{' '}
24
+ © {new Date().getFullYear() || ''} 骋风而来{' '}
25
25
  </div>
26
26
  </div >
27
27
  )
@@ -1,11 +1,13 @@
1
1
  body {
2
2
  margin: 0;
3
3
  }
4
- .layoutWarp{
4
+
5
+ .layout-warp {
5
6
  display: flex;
6
7
  flex-direction: column !important;
7
8
  }
8
- .lios-header {
9
+
10
+ .layout-header {
9
11
  height: 48px;
10
12
  background: white;
11
13
  z-index: 1;
@@ -39,12 +41,12 @@ body {
39
41
  }
40
42
  }
41
43
 
42
- .lios-header-fill {
44
+ .layout-header-fill {
43
45
  flex: 1;
44
46
  }
45
47
 
46
- .lios-logo {
47
- left: 48px;
48
+ .layout-header-logo {
49
+ left: 36px;
48
50
  height: 48px;
49
51
  top: 0;
50
52
  width: 255px;
@@ -53,29 +55,27 @@ body {
53
55
  display: inline-flex;
54
56
  align-items: center;
55
57
 
56
- .img {
58
+ .logo-img {
57
59
  line-height: 48px;
58
60
  font-family: Lucida Calligraphy, cursive, serif, sans-serif;
59
- margin-right: 12px;
60
61
  height: 40px;
61
62
  object-fit: cover;
62
63
  }
63
- .text{
64
- color: #1677ff;
65
- font-size: 20px;
66
- line-height: 48px;
67
- font-family:'Courier New', Courier, monospace;
68
- margin-right: 12px;
69
- }
70
64
 
71
65
  .interval {
72
- color: rgba(0, 0, 0, 0.1);
73
66
  width: 1px;
74
67
  height: 12px;
75
- background-color: rgba(0, 0, 0, 0.1);
76
- margin: 8px;
68
+ background-color: rgba(0, 0, 0, 0.45);
69
+ margin: 0 12px;
70
+ }
71
+
72
+ .app-name {
73
+ margin-left: 12px;
74
+ font-weight: 400;
75
+ color: rgba(0, 0, 0, .72);
77
76
  }
78
77
 
78
+
79
79
  .app-list {
80
80
  .app-list-currentlist {
81
81
  font-size: 12px;
@@ -91,7 +91,8 @@ body {
91
91
  color: rgba(0, 0, 0, 0.88);
92
92
  font-weight: 400;
93
93
  display: flex;
94
- img{
94
+
95
+ img {
95
96
  max-width: 32px;
96
97
  margin-right: 4px;
97
98
  }
@@ -100,6 +101,7 @@ body {
100
101
  .app-list-currentlist:hover {
101
102
  background: rgba(0, 0, 0, 0.1);
102
103
  }
104
+
103
105
  .app-list-current {
104
106
  font-size: 12px;
105
107
  height: 32px;
@@ -113,7 +115,8 @@ body {
113
115
  color: rgba(0, 0, 0, 0.88);
114
116
  font-weight: 400;
115
117
  display: flex;
116
- img{
118
+
119
+ img {
117
120
  max-width: 32px;
118
121
  margin-right: 4px;
119
122
  }
@@ -121,7 +124,7 @@ body {
121
124
  }
122
125
  }
123
126
 
124
- .lios-header-actions {
127
+ .layout-header-actions {
125
128
  display: flex;
126
129
  justify-content: flex-start;
127
130
  align-items: center;
@@ -148,7 +151,7 @@ body {
148
151
  }
149
152
 
150
153
 
151
- .lios-header-user {
154
+ .layout-header-user {
152
155
  height: 40px;
153
156
  display: flex;
154
157
  justify-content: flex-start;
@@ -178,28 +181,25 @@ body {
178
181
  }
179
182
  }
180
183
 
181
- .lios-main {
184
+ .layout-main {
182
185
  display: flex;
183
186
  height: 100%;
184
187
  }
185
188
 
186
- .lios-side {
189
+ .layout-side {
187
190
  height: calc(100vh - 96px);
188
- // background: white;
189
191
  user-select: none;
190
- // padding-top: 12px;
191
- // margin-bottom: 48px;
192
192
  overflow: auto;
193
193
  }
194
194
 
195
- .lios-content {
195
+ .layout-content {
196
196
  width: 100%;
197
197
  height: calc(100vh - 48px);
198
198
  overflow: auto;
199
199
  }
200
200
 
201
201
  //用户卡片
202
- .lios-user-card {
202
+ .user-card {
203
203
  min-width: 182px;
204
204
  max-width: 262px;
205
205
 
@@ -214,8 +214,8 @@ body {
214
214
  margin-right: 12px;
215
215
  }
216
216
 
217
- .user-info-right{
218
- flex: 1;
217
+ .user-info-right {
218
+ flex: 1;
219
219
  }
220
220
 
221
221
  .name {
@@ -227,6 +227,7 @@ body {
227
227
  font-size: 12px;
228
228
  line-height: 16px;
229
229
  margin-top: 4px;
230
+
230
231
  .role-item {
231
232
  background: rgba(204, 204, 204, .55);
232
233
  padding: 2px 8px;
@@ -242,18 +243,22 @@ body {
242
243
  padding: 5px 0px;
243
244
  margin: 5px 0px;
244
245
  border-top: 1px solid rgba(5, 5, 5, 0.06);
246
+
245
247
  .tenant-label {
246
248
  font-size: 12px;
247
249
  color: rgba(0, 0, 0, .5);
248
250
  }
249
- .tenant-switch{
251
+
252
+ .tenant-switch {
250
253
  display: flex;
254
+
251
255
  .tenant-value {
252
256
  flex: 1;
253
257
  font-size: 14px;
254
258
  color: rgba(0, 0, 0, .85);
255
259
  }
256
- .tenant-icon{
260
+
261
+ .tenant-icon {
257
262
  width: 40px;
258
263
  text-align: center;
259
264
  color: rgba(0, 0, 0, .45);
@@ -261,51 +266,61 @@ body {
261
266
  justify-content: center;
262
267
  align-items: center;
263
268
  }
264
- .tenant-icon:hover{
269
+
270
+ .tenant-icon:hover {
265
271
  cursor: pointer;
266
272
  color: rgba(0, 0, 0, .85);
267
273
  }
268
274
  }
269
-
275
+
270
276
 
271
277
  }
272
- .lios-userInfo{
278
+
279
+ .lios-userInfo {
273
280
  padding: 5px 0px;
274
281
  margin: 5px 0px;
275
282
  border-top: 1px solid rgba(5, 5, 5, 0.06);
276
- .li-flex{
283
+
284
+ .li-flex {
277
285
  display: flex;
278
- .lios-value{
286
+
287
+ .lios-value {
279
288
  flex: 1;
280
289
  }
281
290
  }
282
- .lios-li{
291
+
292
+ .lios-li {
283
293
  line-height: 22px;
284
- .lios-key{
294
+
295
+ .lios-key {
285
296
  font-size: 12px;
286
297
  color: rgba(0, 0, 0, .5);
287
298
  display: inline-block;
288
299
  }
289
- .lios-value{
300
+
301
+ .lios-value {
290
302
  padding-left: 8px;
291
303
  display: inline-block;
292
304
  font-size: 12px;
293
305
  color: rgba(0, 0, 0, .85);
294
- span{
306
+
307
+ span {
295
308
  padding-left: 5px;
296
- }
309
+ }
297
310
  }
298
- .lios-icon{
311
+
312
+ .lios-icon {
299
313
  width: 40px;
300
314
  text-align: center;
301
315
  color: rgba(0, 0, 0, .45);
302
316
  }
303
- .lios-icon:hover{
317
+
318
+ .lios-icon:hover {
304
319
  cursor: pointer;
305
320
  color: rgba(0, 0, 0, .85);
306
321
  }
307
322
  }
308
-
323
+
309
324
  }
310
325
 
311
326
 
@@ -362,4 +377,10 @@ body {
362
377
  .current-product {
363
378
  color: #1677FF !important;
364
379
  }
380
+ }
381
+
382
+ .ant-layout-sider-trigger {
383
+ &:hover {
384
+ background: rgba(0, 0, 0, .02) !important;
385
+ }
365
386
  }
@@ -34,16 +34,15 @@ export interface LiosLayoutlProps {
34
34
  switchTenantUrl?: string,
35
35
  defaultOpenKeys?: string[],
36
36
  productList?: any,
37
- logoData?: {
38
- type: string,
39
- content: string
40
- },
41
- isHideHeader?:boolean //是否隐藏header
37
+ logoUrl?: string,
38
+ isHideHeader?: boolean //是否隐藏header
42
39
  }
43
40
 
44
41
  export default function LiosLayout(props: LiosLayoutlProps) {
45
42
  const {
43
+ appName,
46
44
  productCode,
45
+ logoUrl,
47
46
  menuList,
48
47
  onMenuClick,
49
48
  selectedKeys,
@@ -54,7 +53,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
54
53
  switchTenantUrl,
55
54
  defaultOpenKeys,
56
55
  productList,
57
- logoData,
58
56
  myWalletInfo,
59
57
  myWalletInfoAction,
60
58
  isHideHeader
@@ -72,27 +70,31 @@ export default function LiosLayout(props: LiosLayoutlProps) {
72
70
  hrefUrl,
73
71
  historyAction
74
72
  } = custom || {}
73
+
75
74
  const {
76
75
  availableCashAmount,
77
76
  availableAmount,
78
77
  currency
79
78
  } = myWalletInfo || {}
79
+
80
80
  const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
81
- const [currentProduct, setCurrentProduct] = useState<any>({});
81
+ // const [currentProduct, setCurrentProduct] = useState<any>({});
82
82
 
83
83
  const { Sider } = Layout;
84
84
 
85
85
  const [collapsed, setCollapsed] = useState(false);
86
+
86
87
  const [currencyList, setCurrencyList] = useState([
87
88
  { value: 'JPY', label: '日元', icon: '¥' },
88
89
  { value: 'USD', label: '美元', icon: "$" },
89
90
  { value: 'CNY', label: '人民币', icon: '¥' }
90
91
  ])
91
- useEffect(() => {
92
- if (!productList) return
93
- let cp = productList?.filter((i: any) => i.productCode == productCode)[0]
94
- setCurrentProduct(cp)
95
- }, [productList])
92
+
93
+ // useEffect(() => {
94
+ // if (!productList) return
95
+ // let cp = productList?.filter((i: any) => i.productCode == productCode)[0]
96
+ // setCurrentProduct(cp)
97
+ // }, [productList])
96
98
 
97
99
  const onOpenChange: MenuProps['onOpenChange'] = (keys) => {
98
100
  setOpenKeys(keys);
@@ -108,7 +110,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
108
110
  }
109
111
 
110
112
  }
111
- const currencyText = (currencyText: string) => {
113
+ const currencyText = (currencyText: any) => {
112
114
  let text = ''
113
115
  currencyList.some((item: any) => {
114
116
  if (item.value == currencyText) {
@@ -118,8 +120,9 @@ export default function LiosLayout(props: LiosLayoutlProps) {
118
120
  })
119
121
  return text
120
122
  }
123
+
121
124
  const UserCard = () => {
122
- return <div className='lios-user-card'>
125
+ return <div className='user-card'>
123
126
  <div className='user-info'>
124
127
  <img
125
128
 
@@ -212,87 +215,68 @@ export default function LiosLayout(props: LiosLayoutlProps) {
212
215
  })}
213
216
  </div>
214
217
  }
218
+
215
219
  const MenuStyle = {
216
- width: collapsed ? 80 : 256
220
+ width: collapsed ? 80 : 240
217
221
  }
218
222
  return (
219
- <Layout className="layoutWarp">
223
+ <Layout className="layout-warp">
220
224
  {
221
- !isHideHeader &&
222
- <div className="lios-header">
225
+ !isHideHeader &&
226
+ <div className="layout-header">
223
227
 
224
- <div className="background">
225
- <img className="background-img" src="https://pic.imgdb.cn/item/64813de01ddac507cc192a6e.jpg" alt="" />
226
- <div className="background-mask" />
227
- </div>
228
+ <div className="background">
229
+ <img className="background-img" src="https://pic.imgdb.cn/item/64813de01ddac507cc192a6e.jpg" alt="" />
230
+ <div className="background-mask" />
231
+ </div>
228
232
 
229
- <strong className="lios-logo">
230
- {
231
- logoData?.type == "img" ?
232
- <img className="img" src={logoData?.content || ''} />
233
- :
234
- <div className="text">
235
- {logoData?.content || ''}
233
+ <strong className="layout-header-logo">
234
+ {logoUrl && <img className="logo-img" src={logoUrl || ''} />}
235
+ {logoUrl && appName && <div className="interval" />}
236
+ {appName && <div className="app-name">
237
+ {appName}
238
+ </div>}
239
+ </strong>
240
+
241
+ <div className='layout-header-fill' />
242
+
243
+ <div className='layout-header-actions'>
244
+ {actions?.map((item, index) => {
245
+ return <div className='actions-item' key={index}>
246
+ {item}
236
247
  </div>
237
- }
238
- <div className="interval" />
239
- <div className="app-list">
240
- {
241
- productList ?
242
- <Popover placement="bottom" content={<ProductListFunc />} arrow={false} trigger="click">
243
- <div className="app-list-currentlist">
244
- {currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
245
- <div>
246
- {currentProduct?.productName || "请选择应用"}
247
- </div>
248
- </div>
249
- </Popover> :
250
- <div className="app-list-current">
251
- {currentProduct?.logoUrl && <img src={currentProduct?.logoUrl || ""} alt="" />}
252
- <div>
253
- {currentProduct?.productName}
254
- </div>
255
- </div>
256
- }
248
+ })}
257
249
  </div>
258
- </strong>
259
- <div className='lios-header-fill' />
260
250
 
261
- <div className='lios-header-actions'>
262
- {actions?.map((item, index) => {
263
- return <div className='actions-item' key={index}>
264
- {item}
251
+ <Popover placement="bottom" content={<UserCard />} arrow={false} trigger="click"
252
+ onOpenChange={((e) => {
253
+ if (!e) return
254
+ myWalletInfoAction && myWalletInfoAction()
255
+ })}>
256
+ <div className="layout-header-user">
257
+ <img
258
+ className="author"
259
+ src={avatar}
260
+ />
261
+ <div className="name">
262
+ {name}
263
+ </div>
265
264
  </div>
266
- })}
265
+ </Popover>
267
266
  </div>
268
-
269
- <Popover placement="bottom" content={<UserCard />} arrow={false} trigger="click"
270
- onOpenChange={((e) => {
271
- if (!e) return
272
- myWalletInfoAction()
273
- })}>
274
- <div className="lios-header-user">
275
- <img
276
- className="author"
277
- src={avatar}
278
- />
279
- <div className="name">
280
- {name}
281
- </div>
282
- </div>
283
- </Popover>
284
- </div>
285
267
  }
286
- <div className="lios-main">
268
+ <div className="layout-main">
287
269
  {
288
- menuList &&
270
+ Array.isArray(menuList) &&
271
+ menuList.length > 0 &&
289
272
  <Sider
290
- className="lios-side"
273
+ className="layout-side"
291
274
  theme={"light"}
292
275
  collapsible
293
276
  collapsed={collapsed}
294
- width={collapsed ? 60 : 256}
277
+ width={240}
295
278
  onCollapse={(value) => setCollapsed(value)}>
279
+
296
280
  <Menu
297
281
  mode="inline"
298
282
  openKeys={openKeys}
@@ -306,7 +290,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
306
290
  />
307
291
  </Sider>
308
292
  }
309
- <div className="lios-content">
293
+ <div className="layout-content">
310
294
  {props.children}
311
295
  </div>
312
296
  </div>
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "node_modules/typescript/lib"
3
- }
@@ -1,10 +0,0 @@
1
- // @ts-nocheck
2
- // This file is generated by Umi automatically
3
- // DO NOT CHANGE IT MANUALLY!
4
- import React from 'react';
5
- import { HelmetProvider } from '/Users/wujingang/Desktop/workspace/base-components/node_modules/@umijs/renderer-react';
6
- import { context } from './helmetContext';
7
-
8
- export const innerProvider = (container) => {
9
- return React.createElement(HelmetProvider, { context }, container);
10
- }
@@ -1,4 +0,0 @@
1
- // @ts-nocheck
2
- // This file is generated by Umi automatically
3
- // DO NOT CHANGE IT MANUALLY!
4
- export const context = {};