cfel-base-components 1.0.12 → 2.0.1

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.
@@ -1,10 +1,11 @@
1
1
  import React from "react"
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import style from './index.module.less';
4
+ import { SwapOutlined, } from '@ant-design/icons';
4
5
 
5
6
  import './index.scss';
6
7
  import PageContainer from '../../src/components/base-component/PageContainer';
7
- // import Layout from '../../src/components/layout';
8
+ import Layout from '../../src/components/layout';
8
9
  // import Account from '../../src/components/universal-pages/account';
9
10
  // import AccountInfo from '../../src/components/universal-pages/accountInfo';
10
11
  // import Role from '../../src/components/universal-pages/role';
@@ -12,7 +13,140 @@ import PageContainer from '../../src/components/base-component/PageContainer';
12
13
 
13
14
  const App = () => {
14
15
  return <PageContainer className={"aaa"}>
15
- 123
16
+ <Layout
17
+ menuList={[
18
+ {
19
+ label: '设备中心',
20
+ key: 'device',
21
+ icon: <SwapOutlined />,
22
+ children: [
23
+ {
24
+ label: '设备管理',
25
+ key: 'device-list',
26
+ },
27
+ ],
28
+ },
29
+ {
30
+ label: '设备中心',
31
+ key: 'device',
32
+ icon: <SwapOutlined />,
33
+ children: [
34
+ {
35
+ label: '设备管理',
36
+ key: 'device-list',
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ label: '设备中心',
42
+ key: 'device',
43
+ icon: <SwapOutlined />,
44
+ children: [
45
+ {
46
+ label: '设备管理',
47
+ key: 'device-list',
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ label: '设备中心',
53
+ key: 'device',
54
+ icon: <SwapOutlined />,
55
+ children: [
56
+ {
57
+ label: '设备管理',
58
+ key: 'device-list',
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ label: '设备中心',
64
+ key: 'device',
65
+ icon: <SwapOutlined />,
66
+ children: [
67
+ {
68
+ label: '设备管理',
69
+ key: 'device-list',
70
+ },
71
+ ],
72
+ },
73
+ {
74
+ label: '设备中心',
75
+ key: 'device',
76
+ icon: <SwapOutlined />,
77
+ children: [
78
+ {
79
+ label: '设备管理',
80
+ key: 'device-list',
81
+ },
82
+ ],
83
+ },
84
+ {
85
+ label: '空间中心',
86
+ key: 'space',
87
+ icon: <SwapOutlined />,
88
+ children: [
89
+ {
90
+ label: '空间管理',
91
+ key: 'space-list',
92
+ },
93
+ {
94
+ label: '空间类型',
95
+ key: 'space-type',
96
+ },
97
+ ],
98
+ },
99
+ {
100
+ label: '应用中心',
101
+ key: 'packet',
102
+ icon: <SwapOutlined />,
103
+ children: [
104
+ {
105
+ label: 'OTA任务列表',
106
+ key: 'packet-list',
107
+ },
108
+ {
109
+ label: '桌牌推送',
110
+ key: 'card-push',
111
+ },
112
+ {
113
+ label: '会议室列表',
114
+ key: 'room-intelligence',
115
+ },
116
+ ],
117
+ },
118
+ {
119
+ label: '权限管理',
120
+ key: 'authority',
121
+ icon: <SwapOutlined />,
122
+ children: [
123
+ {
124
+ label: '账号列表',
125
+ key: 'account-list',
126
+ },
127
+ {
128
+ label: '角色列表',
129
+ key: 'role-list',
130
+ },
131
+ ],
132
+ },
133
+ {
134
+ label: '规则模板',
135
+ key: 'rule-template',
136
+ icon: <i className="iconfont icon-moban" />
137
+ },
138
+ {
139
+ label: '规则实例',
140
+ key: 'rule-instance',
141
+ icon: <i className="iconfont icon-guize" />
142
+ },
143
+
144
+ ]}
145
+ logoData={{
146
+ type:'img',
147
+ content:'运营平台'
148
+ }}
149
+ ></Layout>
16
150
  </PageContainer>
17
151
  }
18
152
  const container = document.getElementById('root');
@@ -1,3 +1,7 @@
1
+ *,body{
2
+ padding: 0px;
3
+ margin: 0px;
4
+ }
1
5
  .aaa {
2
6
  background: red;
3
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfel-base-components",
3
- "version": "1.0.12",
3
+ "version": "2.0.1",
4
4
  "description": "cfel-base-components",
5
5
  "main": "/src/index.tsx",
6
6
  "types": "src/index.d.ts",
@@ -1,7 +1,10 @@
1
1
  body {
2
2
  margin: 0;
3
3
  }
4
-
4
+ .layoutWarp{
5
+ display: flex;
6
+ flex-direction: column !important;
7
+ }
5
8
  .lios-header {
6
9
  height: 48px;
7
10
  background: white;
@@ -42,6 +45,7 @@ body {
42
45
 
43
46
  .lios-logo {
44
47
  left: 48px;
48
+ height: 48px;
45
49
  top: 0;
46
50
  width: 255px;
47
51
  position: absolute;
@@ -50,10 +54,17 @@ body {
50
54
  align-items: center;
51
55
 
52
56
  .img {
57
+ line-height: 48px;
58
+ font-family: Lucida Calligraphy, cursive, serif, sans-serif;
59
+ margin-right: 12px;
60
+ width: 100px;
61
+ height: 33px;
62
+ }
63
+ .text{
53
64
  color: #1677ff;
54
65
  font-size: 20px;
55
66
  line-height: 48px;
56
- font-family: Lucida Calligraphy, cursive, serif, sans-serif;
67
+ font-family:'Courier New', Courier, monospace;
57
68
  margin-right: 12px;
58
69
  }
59
70
 
@@ -156,11 +167,11 @@ body {
156
167
  }
157
168
 
158
169
  .lios-side {
159
- min-width: 255px;
160
- height: calc(100vh - 48px);
161
- background: white;
170
+ height: calc(100vh - 96px);
171
+ // background: white;
162
172
  user-select: none;
163
- padding-top: 12px;
173
+ // padding-top: 12px;
174
+ // margin-bottom: 48px;
164
175
  overflow: auto;
165
176
  }
166
177
 
@@ -21,6 +21,10 @@ export interface LiosLayoutlProps {
21
21
  switchTenantUrl?: string,
22
22
  defaultOpenKeys?: string[],
23
23
  productList?: any[],
24
+ logoData?:{
25
+ type:string,
26
+ content:string
27
+ }
24
28
  }
25
29
 
26
30
  export default function LiosLayout(props: LiosLayoutlProps) {
@@ -34,7 +38,8 @@ export default function LiosLayout(props: LiosLayoutlProps) {
34
38
  logoutUrl,
35
39
  switchTenantUrl,
36
40
  defaultOpenKeys,
37
- productList
41
+ productList,
42
+ logoData
38
43
  } = props
39
44
 
40
45
  const {
@@ -45,6 +50,10 @@ export default function LiosLayout(props: LiosLayoutlProps) {
45
50
  } = user || {}
46
51
  const [openKeys, setOpenKeys] = useState<any>(defaultOpenKeys || []);
47
52
  const [currentProduct, setCurrentProduct] = useState<any>({});
53
+
54
+ const { Sider } = Layout;
55
+
56
+ const [collapsed, setCollapsed] = useState(false);
48
57
 
49
58
  useEffect(() => {
50
59
  if(!productList)return
@@ -112,8 +121,11 @@ export default function LiosLayout(props: LiosLayoutlProps) {
112
121
  })}
113
122
  </div>
114
123
  }
115
-
116
- return (<Layout>
124
+ const MenuStyle={
125
+ width:collapsed?80:256
126
+ }
127
+ return (
128
+ <Layout className="layoutWarp">
117
129
  <div className="lios-header">
118
130
 
119
131
  <div className="background">
@@ -122,9 +134,14 @@ export default function LiosLayout(props: LiosLayoutlProps) {
122
134
  </div>
123
135
 
124
136
  <strong className="lios-logo">
125
- <div className="img">
126
- LiOS
127
- </div>
137
+ {
138
+ logoData?.type == "img" ?
139
+ <img className="img" src={logoData?.content || ''}/>
140
+ :
141
+ <div className="text">
142
+ {logoData?.content || ''}
143
+ </div>
144
+ }
128
145
  <div className="interval" />
129
146
  <div className="app-list">
130
147
  {
@@ -170,19 +187,25 @@ export default function LiosLayout(props: LiosLayoutlProps) {
170
187
  </div>
171
188
 
172
189
  <div className="lios-main">
173
- <div className="lios-side">
174
- <Menu
175
- mode="inline"
176
- openKeys={openKeys}
177
- onOpenChange={onOpenChange}
178
- style={{ width: 256 }}
179
- items={menuList}
180
- onClick={(item): any => {
181
- onMenuClick && onMenuClick(item)
182
- }}
183
- selectedKeys={selectedKeys}
184
- />
185
- </div>
190
+ <Sider
191
+ className="lios-side"
192
+ theme={"light"}
193
+ collapsible
194
+ collapsed={collapsed}
195
+ width={collapsed?60:256}
196
+ onCollapse={(value) => setCollapsed(value)}>
197
+ <Menu
198
+ mode="inline"
199
+ openKeys={openKeys}
200
+ onOpenChange={onOpenChange}
201
+ items={menuList}
202
+ style={MenuStyle}
203
+ onClick={(item): any => {
204
+ onMenuClick && onMenuClick(item)
205
+ }}
206
+ selectedKeys={selectedKeys}
207
+ />
208
+ </Sider>
186
209
  <div className="lios-content">
187
210
  {props.children}
188
211
  </div>