@umijs/route-utils
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -138,3 +138,3 @@ import isEqual from 'lodash.isequal'; | ||
} | ||
if (item?.menu?.name || item?.menu?.flatMenu) { | ||
if (item?.menu?.name || item?.flatMenu || item?.menu?.flatMenu) { | ||
return true; | ||
@@ -164,3 +164,3 @@ } | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
pro_layout_parentKeys = [], children, icon, ...restParent } = parent; | ||
pro_layout_parentKeys = [], children, icon, flatMenu, ...restParent } = parent; | ||
const finallyItem = { | ||
@@ -200,3 +200,3 @@ ...restParent, | ||
return bigfishCompatibleConversions(finallyItem, props); | ||
}); | ||
}).flat(1); | ||
} | ||
@@ -203,0 +203,0 @@ const memoizeOneFormatter = memoizeOne(formatter, isEqual); |
@@ -234,2 +234,168 @@ import transformRoute from './transformRoute'; | ||
}); | ||
const flatMenu = [ | ||
{ | ||
exact: false, | ||
key: 'qixian', | ||
flatMenu: true, | ||
path: '/', | ||
routes: [ | ||
{ | ||
path: '_webapp' /** 添加重定向 参考:https://bigfish.antfin-inc.com/doc/deploy-assets */, | ||
redirect: '/', | ||
}, | ||
{ path: '/', redirect: '/dashboard/disaster-dashboard' }, | ||
{ path: 'index', component: './Welcome' }, | ||
{ | ||
name: 'Dashboard', | ||
path: '/dashboard', | ||
icon: 'dashboard', | ||
routes: [ | ||
{ | ||
name: '容灾数据大盘', | ||
path: 'disaster-dashboard', | ||
component: './Welcome', | ||
}, | ||
{ | ||
name: '全站演练大盘', | ||
path: 'drill-dashboard', | ||
component: './Welcome', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: '容灾演练管理', | ||
path: '/dr-capacity', | ||
icon: 'global', | ||
routes: [ | ||
// 老的容灾日历 | ||
// { | ||
// name: '容灾日历', | ||
// path: 'drill-calendar', | ||
// component: './DrCapacity/DrillCalendar', | ||
// }, | ||
{ | ||
name: '容灾日历', | ||
path: 'drill/calendar', | ||
component: './Welcome', | ||
}, | ||
{ | ||
name: '演练场景', | ||
path: 'drill', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'drill/list', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'drill/edit', | ||
component: './Welcome', | ||
exact: true, | ||
}, | ||
{ | ||
path: 'drill/new', | ||
component: './Welcome', | ||
exact: true, | ||
}, | ||
{ | ||
path: 'drill/detail', | ||
component: './Welcome', | ||
exact: true, | ||
}, | ||
{ | ||
path: 'drill/:id', | ||
component: './Welcome', | ||
exact: true, | ||
}, | ||
{ | ||
path: 'drill/edit/:id', | ||
component: './Welcome', | ||
exact: true, | ||
}, | ||
{ | ||
name: '容灾恢复分析', | ||
path: 'analysis', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'analysis/:id', | ||
component: './Welcome', | ||
}, | ||
// 老的演练场景 | ||
{ | ||
name: '演练场景(老)', | ||
path: 'drill-list', | ||
component: './Welcome', | ||
}, | ||
{ | ||
name: '采集指标', | ||
path: 'indicator-config-list', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-config/new', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-config/edit/:id', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-config/import', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-config/:id', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-config/history/:id', | ||
component: './Welcome', | ||
}, | ||
{ | ||
name: '采集记录', | ||
path: 'indicator-record-list', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-record/edit/:id', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'indicator-record/:id', | ||
component: './Welcome', | ||
}, | ||
{ | ||
name: '演练问题', | ||
path: 'issue-list', | ||
component: './Welcome', | ||
}, | ||
{ | ||
name: '演练 Action', | ||
path: 'drill-action-list', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'drill-report/manage/:id', | ||
component: './Welcome', | ||
}, | ||
{ | ||
path: 'drill-report/display/:id', | ||
component: './Welcome', | ||
}, | ||
], | ||
}, | ||
{ | ||
// 其它路由情况, 用于兜底 | ||
path: '/*', | ||
redirect: './Exception/404', | ||
}, | ||
], | ||
}, | ||
]; | ||
test('layout flatMenu', () => { | ||
const { menuData: userMenuData, breadcrumb } = transformRoute(flatMenu, false); | ||
expect(userMenuData).toMatchSnapshot(); | ||
expect(breadcrumb).toMatchSnapshot(); | ||
}); | ||
//# sourceMappingURL=transformRoute.test.js.map |
@@ -233,3 +233,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
if ((item === null || item === void 0 ? void 0 : (_item$menu = item.menu) === null || _item$menu === void 0 ? void 0 : _item$menu.name) || (item === null || item === void 0 ? void 0 : (_item$menu2 = item.menu) === null || _item$menu2 === void 0 ? void 0 : _item$menu2.flatMenu)) { | ||
if ((item === null || item === void 0 ? void 0 : (_item$menu = item.menu) === null || _item$menu === void 0 ? void 0 : _item$menu.name) || (item === null || item === void 0 ? void 0 : item.flatMenu) || (item === null || item === void 0 ? void 0 : (_item$menu2 = item.menu) === null || _item$menu2 === void 0 ? void 0 : _item$menu2.flatMenu)) { | ||
return true; | ||
@@ -268,3 +268,4 @@ } // 兼容性,bigfish的兼容 | ||
icon = parent.icon, | ||
restParent = _objectWithoutProperties(parent, ["pro_layout_parentKeys", "children", "icon"]); | ||
flatMenu = parent.flatMenu, | ||
restParent = _objectWithoutProperties(parent, ["pro_layout_parentKeys", "children", "icon", "flatMenu"]); | ||
@@ -303,3 +304,3 @@ var finallyItem = _objectSpread(_objectSpread(_objectSpread({}, restParent), item), {}, { | ||
return bigfishCompatibleConversions(finallyItem, props); | ||
}); | ||
}).flat(1); | ||
} | ||
@@ -306,0 +307,0 @@ |
@@ -254,3 +254,3 @@ "use strict"; | ||
if ((item === null || item === void 0 ? void 0 : (_item$menu = item.menu) === null || _item$menu === void 0 ? void 0 : _item$menu.name) || (item === null || item === void 0 ? void 0 : (_item$menu2 = item.menu) === null || _item$menu2 === void 0 ? void 0 : _item$menu2.flatMenu)) { | ||
if ((item === null || item === void 0 ? void 0 : (_item$menu = item.menu) === null || _item$menu === void 0 ? void 0 : _item$menu.name) || (item === null || item === void 0 ? void 0 : item.flatMenu) || (item === null || item === void 0 ? void 0 : (_item$menu2 = item.menu) === null || _item$menu2 === void 0 ? void 0 : _item$menu2.flatMenu)) { | ||
return true; | ||
@@ -289,3 +289,4 @@ } // 兼容性,bigfish的兼容 | ||
icon = parent.icon, | ||
restParent = _objectWithoutProperties(parent, ["pro_layout_parentKeys", "children", "icon"]); | ||
flatMenu = parent.flatMenu, | ||
restParent = _objectWithoutProperties(parent, ["pro_layout_parentKeys", "children", "icon", "flatMenu"]); | ||
@@ -324,3 +325,3 @@ var finallyItem = _objectSpread(_objectSpread(_objectSpread({}, restParent), item), {}, { | ||
return bigfishCompatibleConversions(finallyItem, props); | ||
}); | ||
}).flat(1); | ||
} | ||
@@ -327,0 +328,0 @@ |
{ | ||
"name": "@umijs/route-utils", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "Quickly process the routing of umi", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
287852
3657