cfel-base-components 0.0.8 → 0.0.10
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/demo/src/index.jsx
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import { WidthAutoLabel } from '../../src/index'; // 引入组件
|
|
4
3
|
import './index.scss';
|
|
5
|
-
|
|
4
|
+
import Layout from '../../src/components/layout';
|
|
6
5
|
|
|
7
6
|
const App = () => {
|
|
8
7
|
return (
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<p>宽度100px:</p><p>文本宽度自适应标签组件</p>
|
|
15
|
-
</div>
|
|
16
|
-
<div className="style1">
|
|
17
|
-
<p>宽度100px:</p><p><WidthAutoLabel>文本宽度自适应标签组件</WidthAutoLabel></p>
|
|
18
|
-
</div>
|
|
19
|
-
<div className="style2">
|
|
20
|
-
<p>宽度80px:</p><p><WidthAutoLabel>文本宽度自适应标签组件</WidthAutoLabel></p>
|
|
21
|
-
</div>
|
|
22
|
-
<div className="style3">
|
|
23
|
-
<p>宽度50px:</p><p><WidthAutoLabel>文本宽度自适应标签组件</WidthAutoLabel></p>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
8
|
+
< Layout appName="123123" productCode="lios-iot-wifi">
|
|
9
|
+
|
|
10
|
+
</Layout >
|
|
11
|
+
|
|
12
|
+
|
|
26
13
|
);
|
|
27
14
|
}
|
|
28
15
|
const container = document.getElementById('root');
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@ body {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
.app-list {
|
|
69
|
-
.current {
|
|
69
|
+
.app-list-current {
|
|
70
70
|
font-size: 12px;
|
|
71
71
|
height: 24px;
|
|
72
72
|
line-height: 24px;
|
|
@@ -81,9 +81,10 @@ body {
|
|
|
81
81
|
font-weight: 400;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.current:hover {
|
|
84
|
+
.app-list-current:hover {
|
|
85
85
|
background: rgba(0, 0, 0, 0.1);
|
|
86
86
|
}
|
|
87
|
+
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -183,7 +184,7 @@ body {
|
|
|
183
184
|
background: rgba(255, 255, 255, 0.3);
|
|
184
185
|
margin-right: 12px;
|
|
185
186
|
}
|
|
186
|
-
|
|
187
|
+
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
.lios-tenant {
|
|
@@ -221,4 +222,36 @@ body {
|
|
|
221
222
|
margin-right: 8px;
|
|
222
223
|
}
|
|
223
224
|
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
.app-list-other {
|
|
230
|
+
|
|
231
|
+
.product-list-item {
|
|
232
|
+
display: flex;
|
|
233
|
+
justify-content: flex-start;
|
|
234
|
+
align-items: center;
|
|
235
|
+
margin: 8px 0;
|
|
236
|
+
padding: 6px 12px;
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
border-radius: 4px;
|
|
239
|
+
transition: all .3s;
|
|
240
|
+
color: rgba(0, 0, 0, .65);
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
&:hover {
|
|
244
|
+
background: rgba(22, 119, 255, .08);
|
|
245
|
+
color: rgba(22, 119, 255, .8);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
img {
|
|
249
|
+
width: 32px;
|
|
250
|
+
margin-right: 12px;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.current-product {
|
|
255
|
+
color: #1677FF !important;
|
|
256
|
+
}
|
|
224
257
|
}
|
|
@@ -4,6 +4,7 @@ import "./index.scss"
|
|
|
4
4
|
|
|
5
5
|
export interface LiosLayoutlProps {
|
|
6
6
|
appName: string;
|
|
7
|
+
productCode: string;
|
|
7
8
|
children: any;
|
|
8
9
|
menuList: any;
|
|
9
10
|
onMenuClick: (item: any) => void;
|
|
@@ -15,17 +16,22 @@ export interface LiosLayoutlProps {
|
|
|
15
16
|
tenantName: string
|
|
16
17
|
};
|
|
17
18
|
logoutUrl?: string
|
|
19
|
+
defaultOpenKeys?: string[],
|
|
20
|
+
productList?: any[],
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export default function LiosLayout(props: LiosLayoutlProps) {
|
|
21
24
|
const {
|
|
22
25
|
appName,
|
|
26
|
+
productCode,
|
|
23
27
|
menuList,
|
|
24
28
|
onMenuClick,
|
|
25
29
|
selectedKeys,
|
|
26
30
|
actions,
|
|
27
31
|
user,
|
|
28
|
-
logoutUrl
|
|
32
|
+
logoutUrl,
|
|
33
|
+
defaultOpenKeys,
|
|
34
|
+
productList
|
|
29
35
|
} = props
|
|
30
36
|
|
|
31
37
|
const {
|
|
@@ -33,7 +39,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
33
39
|
avatar,
|
|
34
40
|
tenantName,
|
|
35
41
|
} = user || {}
|
|
36
|
-
const [openKeys, setOpenKeys] = useState<any>([]);
|
|
42
|
+
const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
|
|
37
43
|
|
|
38
44
|
const onOpenChange: MenuProps['onOpenChange'] = (keys) => {
|
|
39
45
|
setOpenKeys(keys);
|
|
@@ -65,6 +71,23 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
65
71
|
</div >
|
|
66
72
|
}
|
|
67
73
|
|
|
74
|
+
const ProductList = () => {
|
|
75
|
+
return <div className='app-list-other'>
|
|
76
|
+
{productList?.map((item) => {
|
|
77
|
+
return <div
|
|
78
|
+
onClick={() => {
|
|
79
|
+
item.productCode != productCode && item?.portalUrl && window.open(item?.portalUrl)
|
|
80
|
+
}}
|
|
81
|
+
key={item.id}
|
|
82
|
+
className={`product-list-item ${item.productCode == productCode ? "current-product" : ""}`}
|
|
83
|
+
>
|
|
84
|
+
<img src={item?.logoUrl || "https://pic.imgdb.cn/item/64c760291ddac507cc68440a.png"} alt="" />
|
|
85
|
+
<div> {item?.productName}</div>
|
|
86
|
+
</div>
|
|
87
|
+
})}
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
90
|
+
|
|
68
91
|
return (<Layout>
|
|
69
92
|
<div className="lios-header">
|
|
70
93
|
|
|
@@ -79,9 +102,11 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
79
102
|
</div>
|
|
80
103
|
<div className="interval" />
|
|
81
104
|
<div className="app-list">
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
105
|
+
<Popover placement="bottom" content={<ProductList />} arrow={false} trigger="click">
|
|
106
|
+
<div className="app-list-current">
|
|
107
|
+
{appName}
|
|
108
|
+
</div>
|
|
109
|
+
</Popover>
|
|
85
110
|
</div>
|
|
86
111
|
</strong>
|
|
87
112
|
<div className='lios-header-fill' />
|