UNPKG

tntd

Version:

tntd是基于 TNT Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。

42 lines (41 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findMenuInfoByPath = exports["default"] = void 0; var _ = require("."); var findMenuInfoByPath = exports.findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc) { var menu; var subMenu; var matchedSubMenu; var parentMenus; if (path) { (0, _.traverseTree)(menuTree, function (menu, pnode, pnodes) { if (!(0, _.isGroupMenu)(menu)) { if ((menu === null || menu === void 0 ? void 0 : menu.path) === path) { subMenu = menu; menu = pnode; parentMenus = pnodes; return false; } if (!matchedSubMenu && matchFunc && matchFunc(menu)) { matchedSubMenu = menu; menu = pnode; parentMenus = pnodes; } } }); return { subMenu: subMenu, matchedSubMenu: matchedSubMenu, menu: menu, parentMenus: parentMenus }; } return { subMenu: subMenu, menu: menu, parentMenus: parentMenus }; }; var _default = exports["default"] = findMenuInfoByPath;