@zat-design/sisyphus-react 3.14.0-beta.1 → 3.14.0-beta.2
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.
|
@@ -47,8 +47,9 @@ export var transformMenu = (menuData, pathPrefix) => {
|
|
|
47
47
|
if (!Array.isArray(menuDeepItem) || !menuDeepItem.length) {
|
|
48
48
|
return [];
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
var _loop = function _loop() {
|
|
51
51
|
var _item$keyUrlPath, _item$keyIdPath, _item$children;
|
|
52
|
+
var item = menuDeepItem[i];
|
|
52
53
|
item.code = item.code || item.id;
|
|
53
54
|
item.url = `${pathPrefix}${item.url}`;
|
|
54
55
|
item.redirectUrl = item !== null && item !== void 0 && item.redirectUrl ? `${pathPrefix}${item.redirectUrl}` : '';
|
|
@@ -68,9 +69,8 @@ export var transformMenu = (menuData, pathPrefix) => {
|
|
|
68
69
|
item.keyIdPath = [item.id];
|
|
69
70
|
}
|
|
70
71
|
if (!['PAGE', 'MENU'].includes(item.type)) {
|
|
71
|
-
menuDeepItem.splice(
|
|
72
|
-
}
|
|
73
|
-
if (Array.isArray(item === null || item === void 0 ? void 0 : item.children) && item !== null && item !== void 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
72
|
+
menuDeepItem.splice(i, 1);
|
|
73
|
+
} else if (Array.isArray(item === null || item === void 0 ? void 0 : item.children) && item !== null && item !== void 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
74
74
|
// 给children注入keyUrlPath,keyIdPath
|
|
75
75
|
item.children.forEach(childrenItem => {
|
|
76
76
|
childrenItem.keyUrlPath = [...item.keyUrlPath];
|
|
@@ -78,7 +78,10 @@ export var transformMenu = (menuData, pathPrefix) => {
|
|
|
78
78
|
});
|
|
79
79
|
menuDeep(item.children);
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
};
|
|
82
|
+
for (var i = menuDeepItem.length - 1; i >= 0; i -= 1) {
|
|
83
|
+
_loop();
|
|
84
|
+
}
|
|
82
85
|
};
|
|
83
86
|
menuDeep(data);
|
|
84
87
|
return data;
|
|
@@ -58,8 +58,9 @@ var transformMenu = (menuData, pathPrefix) => {
|
|
|
58
58
|
if (!Array.isArray(menuDeepItem) || !menuDeepItem.length) {
|
|
59
59
|
return [];
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
var _loop = function _loop() {
|
|
62
62
|
var _item$keyUrlPath, _item$keyIdPath, _item$children;
|
|
63
|
+
var item = menuDeepItem[i];
|
|
63
64
|
item.code = item.code || item.id;
|
|
64
65
|
item.url = `${pathPrefix}${item.url}`;
|
|
65
66
|
item.redirectUrl = item !== null && item !== void 0 && item.redirectUrl ? `${pathPrefix}${item.redirectUrl}` : '';
|
|
@@ -79,9 +80,8 @@ var transformMenu = (menuData, pathPrefix) => {
|
|
|
79
80
|
item.keyIdPath = [item.id];
|
|
80
81
|
}
|
|
81
82
|
if (!['PAGE', 'MENU'].includes(item.type)) {
|
|
82
|
-
menuDeepItem.splice(
|
|
83
|
-
}
|
|
84
|
-
if (Array.isArray(item === null || item === void 0 ? void 0 : item.children) && item !== null && item !== void 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
83
|
+
menuDeepItem.splice(i, 1);
|
|
84
|
+
} else if (Array.isArray(item === null || item === void 0 ? void 0 : item.children) && item !== null && item !== void 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
85
85
|
// 给children注入keyUrlPath,keyIdPath
|
|
86
86
|
item.children.forEach(childrenItem => {
|
|
87
87
|
childrenItem.keyUrlPath = [...item.keyUrlPath];
|
|
@@ -89,7 +89,10 @@ var transformMenu = (menuData, pathPrefix) => {
|
|
|
89
89
|
});
|
|
90
90
|
menuDeep(item.children);
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
};
|
|
93
|
+
for (var i = menuDeepItem.length - 1; i >= 0; i -= 1) {
|
|
94
|
+
_loop();
|
|
95
|
+
}
|
|
93
96
|
};
|
|
94
97
|
menuDeep(data);
|
|
95
98
|
return data;
|