@antscorp/antsomi-ui 1.3.5-beta.370 → 1.3.5-beta.371
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/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +2 -1
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +17 -3
- package/es/components/organism/LeftMenu/utils/index.d.ts +1 -0
- package/es/components/organism/LeftMenu/utils/index.js +5 -5
- package/package.json +1 -1
|
@@ -74,7 +74,7 @@ export const ChildMenu = memo(props => {
|
|
|
74
74
|
setOpenKeys(prev => [...prev, parentKey]);
|
|
75
75
|
}
|
|
76
76
|
// Active App Item having code matching url
|
|
77
|
-
const matchAppCode = findActiveAppCodeByUrl({ menuItems, url, auth });
|
|
77
|
+
const matchAppCode = findActiveAppCodeByUrl({ menuItems, url, auth, env });
|
|
78
78
|
if (matchAppCode && matchAppCode !== activeAppCode) {
|
|
79
79
|
setLeftMenuState({ activeAppCode: matchAppCode });
|
|
80
80
|
}
|
|
@@ -92,6 +92,7 @@ export const ChildMenu = memo(props => {
|
|
|
92
92
|
isCustomized,
|
|
93
93
|
customActiveCurrentKey,
|
|
94
94
|
customItems,
|
|
95
|
+
env,
|
|
95
96
|
]);
|
|
96
97
|
const onClick = e => {
|
|
97
98
|
onMenuClick === null || onMenuClick === void 0 ? void 0 : onMenuClick(e.key, e.keyPath);
|
|
@@ -21,7 +21,7 @@ export const useLeftMenu = (props) => {
|
|
|
21
21
|
const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
|
|
22
22
|
const customActiveAppKey = useLeftMenuStore(store => store.state.customActiveAppKey);
|
|
23
23
|
const setLeftMenuState = useLeftMenuStore(store => store.setState);
|
|
24
|
-
const { auth } = appConfig || {};
|
|
24
|
+
const { auth, env } = appConfig || {};
|
|
25
25
|
const [state, setState] = useState(initialState);
|
|
26
26
|
const { mappingChildrenMenu, flattenMenuPermission, permissionMenu, activeItemPath } = usePermission();
|
|
27
27
|
useEffect(() => {
|
|
@@ -74,12 +74,26 @@ export const useLeftMenu = (props) => {
|
|
|
74
74
|
if (!isCustomized) {
|
|
75
75
|
const url = `${pathname}${hash}`;
|
|
76
76
|
// Active App Item having code matching url
|
|
77
|
-
const matchAppCode = findActiveAppCodeByUrl({
|
|
77
|
+
const matchAppCode = findActiveAppCodeByUrl({
|
|
78
|
+
url,
|
|
79
|
+
menuItems: mappingChildrenMenu,
|
|
80
|
+
auth,
|
|
81
|
+
env,
|
|
82
|
+
});
|
|
78
83
|
if (matchAppCode && matchAppCode !== activeAppCode) {
|
|
79
84
|
setLeftMenuState({ activeAppCode: matchAppCode });
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
|
-
}, [
|
|
87
|
+
}, [
|
|
88
|
+
activeAppCode,
|
|
89
|
+
auth,
|
|
90
|
+
env,
|
|
91
|
+
hash,
|
|
92
|
+
isCustomized,
|
|
93
|
+
mappingChildrenMenu,
|
|
94
|
+
pathname,
|
|
95
|
+
setLeftMenuState,
|
|
96
|
+
]);
|
|
83
97
|
useEffect(() => {
|
|
84
98
|
if (!isCustomized) {
|
|
85
99
|
// Callback function using at Layout when url change
|
|
@@ -215,13 +215,13 @@ export const getMappingAppChildren = (args) => {
|
|
|
215
215
|
*/
|
|
216
216
|
export const findActiveAppCodeByUrl = (args) => {
|
|
217
217
|
try {
|
|
218
|
-
const { url, menuItems, auth } = args;
|
|
218
|
+
const { url, menuItems, auth, env } = args;
|
|
219
219
|
let matchAppCode;
|
|
220
220
|
const recursiveCheckHasActiveChild = (items) => {
|
|
221
221
|
let matchAppCode = false;
|
|
222
222
|
for (const item of items) {
|
|
223
223
|
if (!!(item === null || item === void 0 ? void 0 : item.menu_item_path) &&
|
|
224
|
-
url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth)))) {
|
|
224
|
+
url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth), env))) {
|
|
225
225
|
matchAppCode = true;
|
|
226
226
|
break;
|
|
227
227
|
}
|
|
@@ -236,7 +236,7 @@ export const findActiveAppCodeByUrl = (args) => {
|
|
|
236
236
|
};
|
|
237
237
|
for (const menuItem of menuItems) {
|
|
238
238
|
if (!!(menuItem === null || menuItem === void 0 ? void 0 : menuItem.menu_item_path) &&
|
|
239
|
-
url.includes(getComparePath(getGeneratePath(menuItem.menu_item_path, auth)))) {
|
|
239
|
+
url.includes(getComparePath(getGeneratePath(menuItem.menu_item_path, auth), env))) {
|
|
240
240
|
matchAppCode = menuItem.menu_item_code;
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
@@ -258,12 +258,12 @@ export const findActiveAppCodeByUrl = (args) => {
|
|
|
258
258
|
};
|
|
259
259
|
export const findLastMatchedItemByUrl = (args) => {
|
|
260
260
|
try {
|
|
261
|
-
const { url, menuItems, auth } = args;
|
|
261
|
+
const { url, menuItems, auth, env } = args;
|
|
262
262
|
const matchedItems = [];
|
|
263
263
|
const recursiveFindActiveItem = (items, parentId) => {
|
|
264
264
|
for (const item of items) {
|
|
265
265
|
if ((item === null || item === void 0 ? void 0 : item.menu_item_path) &&
|
|
266
|
-
url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth))) &&
|
|
266
|
+
url.includes(getComparePath(getGeneratePath(item.menu_item_path, auth), env)) &&
|
|
267
267
|
(!parentId || item.menu_item_parent === parentId)) {
|
|
268
268
|
matchedItems.push(item);
|
|
269
269
|
}
|