cfel-base-components 2.3.5 → 2.4.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.
- package/.vscode/settings.json +0 -3
- package/demo/src/index.jsx +89 -60
- package/package.json +1 -1
- package/src/components/base-component/ProTable/index.tsx +33 -12
- package/src/components/layout/index.tsx +1 -4
- package/src/components/universal-pages/cpcAccountInfo/index.tsx +2 -2
- package/src/components/universal-pages/cpcRoleInfo/index.tsx +2 -2
- package/src/.umi/core/helmet.ts +0 -10
- package/src/.umi/core/helmetContext.ts +0 -4
package/.vscode/settings.json
CHANGED
package/demo/src/index.jsx
CHANGED
|
@@ -1,74 +1,103 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { createRoot } from
|
|
3
|
-
import style from
|
|
4
|
-
import { SwapOutlined
|
|
5
|
-
import { ConfigProvider } from "antd"
|
|
6
|
-
import
|
|
7
|
-
import PageContainer from
|
|
8
|
-
import Layout from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import style from "./index.module.less";
|
|
4
|
+
import { SwapOutlined } from "@ant-design/icons";
|
|
5
|
+
import { ConfigProvider } from "antd";
|
|
6
|
+
import "./index.scss";
|
|
7
|
+
import PageContainer from "../../src/components/base-component/PageContainer";
|
|
8
|
+
import Layout from "../../src/components/layout";
|
|
9
9
|
// import Account from '../../src/components/universal-pages/account';
|
|
10
10
|
// import AccountInfo from '../../src/components/universal-pages/accountInfo';
|
|
11
|
-
import CpcRole from
|
|
12
|
-
import CpcRoleInfo from
|
|
11
|
+
import CpcRole from "../../src/components/universal-pages/cpcRole";
|
|
12
|
+
import CpcRoleInfo from "../../src/components/universal-pages/cpcRoleInfo";
|
|
13
|
+
import ProTable from "../../src/components/base-component/ProTable";
|
|
13
14
|
|
|
14
15
|
const App = () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const columns = [
|
|
17
|
+
{
|
|
18
|
+
title: "名称",
|
|
19
|
+
dataIndex: "name",
|
|
20
|
+
key: "name",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "描述",
|
|
24
|
+
dataIndex: "description",
|
|
25
|
+
key: "description",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: "状态",
|
|
29
|
+
dataIndex: "status",
|
|
30
|
+
key: "status",
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ConfigProvider
|
|
36
|
+
theme={{
|
|
37
|
+
token: {
|
|
38
|
+
fontSize: 12,
|
|
26
39
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
label: '设备中心',
|
|
35
|
-
key: 'device',
|
|
36
|
-
icon: <SwapOutlined />,
|
|
37
|
-
children: [
|
|
38
|
-
{
|
|
39
|
-
label: '设备管理',
|
|
40
|
-
key: 'device-list',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
40
|
+
components: {
|
|
41
|
+
Form: {
|
|
42
|
+
itemMarginBottom: 12,
|
|
43
|
+
},
|
|
44
|
+
Descriptions: {
|
|
45
|
+
/* 这里是你的组件 token */
|
|
46
|
+
},
|
|
43
47
|
},
|
|
44
|
-
]}
|
|
45
|
-
logoUrl={"https://cdn.chengfengerlai.com/logo/company-logo/chengfengerlai-puhui.png"}
|
|
46
|
-
user={{
|
|
47
|
-
name: (window)?.g_config?.user?.name,
|
|
48
|
-
avatar: (window)?.g_config?.user?.avatar,
|
|
49
|
-
tenantName: (window)?.g_config?.tenant?.name,
|
|
50
|
-
role: (window)?.g_config?.user?.roleInfo,
|
|
51
48
|
}}
|
|
52
|
-
custom={{
|
|
53
|
-
type: (window)?.g_config?.custom?.type,
|
|
54
|
-
isCompleted: (window)?.g_config?.custom?.isCompleted,
|
|
55
|
-
isAudited: (window)?.g_config?.custom?.isAudited,
|
|
56
|
-
hrefUrl: '/web/user-info',
|
|
57
|
-
historyAction: history
|
|
58
|
-
}}
|
|
59
|
-
logoutUrl={(window)?.g_config?.logoutUrl}
|
|
60
|
-
switchTenantUrl={(window)?.g_config?.switchTenantUrl}
|
|
61
49
|
>
|
|
62
|
-
<
|
|
50
|
+
<Layout
|
|
51
|
+
appName="控制台"
|
|
52
|
+
productList={false}
|
|
53
|
+
menuList={[
|
|
54
|
+
{
|
|
55
|
+
label: "设备中心",
|
|
56
|
+
key: "device",
|
|
57
|
+
icon: <SwapOutlined />,
|
|
58
|
+
children: [
|
|
59
|
+
{
|
|
60
|
+
label: "设备管理",
|
|
61
|
+
key: "device-list",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
]}
|
|
66
|
+
logoUrl={
|
|
67
|
+
"https://cdn.chengfengerlai.com/logo/company-logo/chengfengerlai-puhui.png"
|
|
68
|
+
}
|
|
69
|
+
user={{
|
|
70
|
+
name: window?.g_config?.user?.name,
|
|
71
|
+
avatar: window?.g_config?.user?.avatar,
|
|
72
|
+
tenantName: window?.g_config?.tenant?.name,
|
|
73
|
+
role: window?.g_config?.user?.roleInfo,
|
|
74
|
+
}}
|
|
75
|
+
custom={{
|
|
76
|
+
type: window?.g_config?.custom?.type,
|
|
77
|
+
isCompleted: window?.g_config?.custom?.isCompleted,
|
|
78
|
+
isAudited: window?.g_config?.custom?.isAudited,
|
|
79
|
+
hrefUrl: "/web/user-info",
|
|
80
|
+
historyAction: history,
|
|
81
|
+
}}
|
|
82
|
+
logoutUrl={window?.g_config?.logoutUrl}
|
|
83
|
+
switchTenantUrl={window?.g_config?.switchTenantUrl}
|
|
84
|
+
>
|
|
85
|
+
{/* <CpcRoleInfo
|
|
63
86
|
isShowTab={{
|
|
64
87
|
main: true,
|
|
65
88
|
tableResource: true,
|
|
66
89
|
tableEmpower: true,
|
|
67
90
|
tableData: false,
|
|
68
|
-
}}></CpcRoleInfo>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
91
|
+
}}></CpcRoleInfo> */}
|
|
92
|
+
|
|
93
|
+
<ProTable
|
|
94
|
+
columns={columns}
|
|
95
|
+
dataSource={[{ name: "1", description: "1", status: "1" }]}
|
|
96
|
+
/>
|
|
97
|
+
</Layout>
|
|
98
|
+
</ConfigProvider>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
const container = document.getElementById("root");
|
|
73
102
|
const root = createRoot(container);
|
|
74
|
-
root.render(<App />);
|
|
103
|
+
root.render(<App />);
|
package/package.json
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from '@ant-design/pro-components';
|
|
6
|
-
import classnames from 'classnames/bind';
|
|
7
|
-
import styles from "./index.module.less"
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { ProTable, ProTableProps } from "@ant-design/pro-components";
|
|
3
|
+
import classnames from "classnames/bind";
|
|
4
|
+
import styles from "./index.module.less";
|
|
8
5
|
const cx = classnames.bind(styles);
|
|
9
6
|
|
|
10
7
|
export default function ProTableComponent({
|
|
11
8
|
className,
|
|
9
|
+
nameSpace,
|
|
12
10
|
...restFileds
|
|
13
11
|
}: ProTableProps<any, any> | any) {
|
|
12
|
+
const tableColumnsConfig = JSON.parse(
|
|
13
|
+
localStorage.getItem("TABLE_COLUMNS_CONFIG")!
|
|
14
|
+
);
|
|
15
|
+
const currentConfig = tableColumnsConfig?.[nameSpace];
|
|
16
|
+
const [columnsStateMap, setColumnsStateMap]: any = useState(
|
|
17
|
+
currentConfig || {}
|
|
18
|
+
);
|
|
19
|
+
|
|
14
20
|
return (
|
|
15
21
|
<ProTable
|
|
16
22
|
className={cx({
|
|
17
23
|
"pro-table": true,
|
|
18
|
-
[className]: true
|
|
24
|
+
[className]: true,
|
|
19
25
|
})}
|
|
20
26
|
search={false}
|
|
21
27
|
pagination={false}
|
|
22
28
|
scroll={{
|
|
23
|
-
x:
|
|
29
|
+
x: "max-content",
|
|
30
|
+
}}
|
|
31
|
+
columnsState={{
|
|
32
|
+
value: columnsStateMap,
|
|
33
|
+
onChange: (v) => {
|
|
34
|
+
setColumnsStateMap(v);
|
|
35
|
+
if (!nameSpace || typeof nameSpace !== "string") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
localStorage.setItem(
|
|
39
|
+
"TABLE_COLUMNS_CONFIG",
|
|
40
|
+
JSON.stringify({
|
|
41
|
+
...tableColumnsConfig,
|
|
42
|
+
[nameSpace]: v,
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
},
|
|
24
46
|
}}
|
|
25
47
|
{...restFileds}
|
|
26
48
|
/>
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -246,10 +246,6 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
246
246
|
!isHideHeader &&
|
|
247
247
|
<div className="layout-header">
|
|
248
248
|
|
|
249
|
-
<div className="background">
|
|
250
|
-
<img className="background-img" src="https://pic.imgdb.cn/item/64813de01ddac507cc192a6e.jpg" alt="" />
|
|
251
|
-
<div className="background-mask" />
|
|
252
|
-
</div>
|
|
253
249
|
|
|
254
250
|
<strong className="layout-header-logo">
|
|
255
251
|
{logoUrl && <img className="logo-img" src={logoUrl || ''} />}
|
|
@@ -300,6 +296,7 @@ export default function LiosLayout(props: LiosLayoutlProps) {
|
|
|
300
296
|
|
|
301
297
|
<Menu
|
|
302
298
|
mode="inline"
|
|
299
|
+
theme="dark"
|
|
303
300
|
openKeys={openKeys}
|
|
304
301
|
onOpenChange={onOpenChange}
|
|
305
302
|
items={menuList}
|
|
@@ -58,7 +58,7 @@ export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
|
58
58
|
]); //tab 数据
|
|
59
59
|
const TableResource: any = [
|
|
60
60
|
{
|
|
61
|
-
title: "
|
|
61
|
+
title: "菜单名称",
|
|
62
62
|
dataIndex: "name",
|
|
63
63
|
key: "name",
|
|
64
64
|
},
|
|
@@ -166,7 +166,7 @@ export default function AccountInfo({ isShowTab, getAuthTree }: RoleInfoProps) {
|
|
|
166
166
|
let data: any = [];
|
|
167
167
|
if (isShowTab?.tableResource) {
|
|
168
168
|
data.push({
|
|
169
|
-
label: "
|
|
169
|
+
label: "关联菜单",
|
|
170
170
|
key: "tableResource",
|
|
171
171
|
icon: <InteractionOutlined />,
|
|
172
172
|
});
|
|
@@ -147,7 +147,7 @@ export default function RoleInfo({ isShowTab, getAuthTree , empowerCom}: RoleInf
|
|
|
147
147
|
|
|
148
148
|
const TableResource: any = [
|
|
149
149
|
{
|
|
150
|
-
title: "
|
|
150
|
+
title: "菜单名称",
|
|
151
151
|
dataIndex: "name",
|
|
152
152
|
key: "name",
|
|
153
153
|
},
|
|
@@ -238,7 +238,7 @@ export default function RoleInfo({ isShowTab, getAuthTree , empowerCom}: RoleInf
|
|
|
238
238
|
let data: any = [];
|
|
239
239
|
if (isShowTab?.tableResource) {
|
|
240
240
|
data.push({
|
|
241
|
-
label: "
|
|
241
|
+
label: "关联菜单",
|
|
242
242
|
key: "tableResource",
|
|
243
243
|
icon: <InteractionOutlined />,
|
|
244
244
|
});
|
package/src/.umi/core/helmet.ts
DELETED
|
@@ -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
|
-
}
|