beer-assembly-biz 1.1.5 → 1.1.6
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/layout/AppLayout.d.ts +4 -0
- package/layout/AppLayout.js +24 -4
- package/package.json +1 -1
package/layout/AppLayout.d.ts
CHANGED
package/layout/AppLayout.js
CHANGED
|
@@ -25,6 +25,7 @@ export const AppLayout = (props) => {
|
|
|
25
25
|
const [isMobile, setIsMobile] = useState(false);
|
|
26
26
|
// 菜单的选择
|
|
27
27
|
const [pathKeys, setPathKeys] = useState([]);
|
|
28
|
+
const [openKeys, setOpenKeys] = useState([]);
|
|
28
29
|
// 获取参数参数
|
|
29
30
|
const [appParams, setAppParams] = useState();
|
|
30
31
|
// 菜单列表
|
|
@@ -50,6 +51,16 @@ export const AppLayout = (props) => {
|
|
|
50
51
|
return result;
|
|
51
52
|
};
|
|
52
53
|
// 基于路径刷新页面菜单
|
|
54
|
+
const getOpenKeys = (key) => {
|
|
55
|
+
if (key === undefined) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
const parent = menus?.find(it => it.children?.find(child => child.key === key) !== undefined);
|
|
59
|
+
if (parent === undefined || parent?.key === undefined || parent?.key === '') {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
return [parent.key];
|
|
63
|
+
};
|
|
53
64
|
const refreshPath = async () => {
|
|
54
65
|
if (menus === undefined || menus.length <= 0) {
|
|
55
66
|
return;
|
|
@@ -65,24 +76,31 @@ export const AppLayout = (props) => {
|
|
|
65
76
|
}) || [])])
|
|
66
77
|
.flat()
|
|
67
78
|
.filter(it => it !== undefined);
|
|
68
|
-
let
|
|
79
|
+
let { pathname } = window.location;
|
|
80
|
+
if (props?.basename !== undefined && props?.basename !== '' && pathname.startsWith(props.basename)) {
|
|
81
|
+
pathname = pathname.substring(props.basename.length);
|
|
82
|
+
}
|
|
83
|
+
let result = items.find(it => it.path === pathname);
|
|
69
84
|
if (result !== undefined) {
|
|
85
|
+
setOpenKeys(getOpenKeys(result.key));
|
|
70
86
|
setPathKeys(result.key === undefined ? [] : [result.key]);
|
|
71
87
|
return;
|
|
72
88
|
}
|
|
73
89
|
// 如果匹配到分割符号
|
|
74
|
-
const locationPath =
|
|
90
|
+
const locationPath = pathname.toUpperCase();
|
|
75
91
|
const partition = (props?.pathPartition || []).find(path => locationPath.indexOf(`/${path}/`) > -1);
|
|
76
92
|
if (partition !== undefined) {
|
|
77
93
|
const partitionPath = locationPath.split(`/${partition}/`)[0].toLowerCase();
|
|
78
94
|
result = items.find(it => it.path === partitionPath);
|
|
79
95
|
if (result !== undefined) {
|
|
96
|
+
setOpenKeys(getOpenKeys(result.key));
|
|
80
97
|
setPathKeys(result.key === undefined ? [] : [result.key]);
|
|
81
98
|
return;
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
result = items.find(it => it !== undefined && it.path !== undefined &&
|
|
101
|
+
result = items.find(it => it !== undefined && it.path !== undefined && pathname.startsWith(it.path));
|
|
85
102
|
if (result !== undefined) {
|
|
103
|
+
setOpenKeys(getOpenKeys(result.key));
|
|
86
104
|
setPathKeys(result.key === undefined ? [] : [result.key]);
|
|
87
105
|
}
|
|
88
106
|
};
|
|
@@ -164,7 +182,9 @@ export const AppLayout = (props) => {
|
|
|
164
182
|
}
|
|
165
183
|
`, style: {
|
|
166
184
|
minWidth: 1000
|
|
167
|
-
}, selectedKeys: pathKeys,
|
|
185
|
+
}, selectedKeys: pathKeys, openKeys: openKeys, onOpenChange: (menus) => {
|
|
186
|
+
setOpenKeys(menus);
|
|
187
|
+
}, locale: "zh-CN", navTheme: "light", fixSiderbar: true, layout: "mix", contentWidth: "Fluid", splitMenus: false, bgLayoutImgList: [
|
|
168
188
|
{
|
|
169
189
|
src: ImageLayout01,
|
|
170
190
|
left: 85,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beer-assembly-biz",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.6",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"pub-w": "tsc && copy package.json .\\dist\\package.json && npm publish ./dist",
|
|
7
7
|
"copy": "cp -a src/rich/AIEditor.css dist/rich/AIEditor.css && cp -a src/icon dist/icon && cp -a src/images dist/images",
|