tntd 1.4.10 → 1.4.11

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.
Files changed (42) hide show
  1. package/components/Layout/AppList.js +1 -1
  2. package/components/Layout/GlobalNavigation/NavigationPopup.js +8 -8
  3. package/components/Layout/GlobalNavigation/index.js +2 -2
  4. package/components/Layout/OrgAppList.js +14 -15
  5. package/components/Layout/SideMenu.js +2 -2
  6. package/components/Layout/index.js +4 -5
  7. package/components/Layout/paaslayout/CompactSideMenu.js +1 -1
  8. package/components/Layout/paaslayout/index.js +2 -2
  9. package/components/Layout/storage.js +1 -1
  10. package/components/index.js +1 -0
  11. package/components/{Layout → utils}/checkAuth.js +3 -1
  12. package/components/utils/findMenuInfoByPath.js +39 -0
  13. package/components/{Layout/utils.js → utils/index.js} +3 -35
  14. package/dist/stats.json +9760 -9514
  15. package/dist/tntd.js +1 -1
  16. package/es/Layout/AppList.js +1 -1
  17. package/es/Layout/GlobalNavigation/NavigationPopup.js +1 -1
  18. package/es/Layout/GlobalNavigation/index.js +1 -1
  19. package/es/Layout/OrgAppList.js +3 -4
  20. package/es/Layout/SideMenu.js +1 -1
  21. package/es/Layout/index.js +5 -4
  22. package/es/Layout/paaslayout/CompactSideMenu.js +1 -1
  23. package/es/Layout/paaslayout/index.js +1 -1
  24. package/es/Layout/storage.js +1 -1
  25. package/es/index.js +2 -1
  26. package/es/utils/checkAuth.js +30 -0
  27. package/es/utils/findMenuInfoByPath.js +41 -0
  28. package/es/utils/index.js +99 -0
  29. package/lib/Layout/AppList.js +1 -1
  30. package/lib/Layout/GlobalNavigation/NavigationPopup.js +1 -1
  31. package/lib/Layout/GlobalNavigation/index.js +1 -1
  32. package/lib/Layout/OrgAppList.js +5 -6
  33. package/lib/Layout/SideMenu.js +1 -1
  34. package/lib/Layout/index.js +6 -6
  35. package/lib/Layout/paaslayout/CompactSideMenu.js +1 -1
  36. package/lib/Layout/paaslayout/index.js +1 -1
  37. package/lib/Layout/storage.js +1 -1
  38. package/lib/index.js +34 -0
  39. package/lib/utils/checkAuth.js +41 -0
  40. package/lib/utils/findMenuInfoByPath.js +52 -0
  41. package/lib/utils/index.js +159 -0
  42. package/package.json +1 -1
@@ -66,7 +66,7 @@ import styled, { withTheme } from 'styled-components';
66
66
  import { get } from 'lodash';
67
67
  import Icon from '../Icon';
68
68
  import { getCurrentAppStore, setCurrentAppStore } from './storage';
69
- import { traverseTree } from './utils';
69
+ import { traverseTree } from '../utils';
70
70
  var Option = _Select.Option;
71
71
  var MenuList = styled(_Menu)(_templateObject()); // 新版UI
72
72
 
@@ -82,7 +82,7 @@ import { useState, useEffect } from 'react';
82
82
  import cn from 'classnames';
83
83
  import styled from 'styled-components';
84
84
  import { debounce } from 'lodash';
85
- import { traverseTree, hasLevel3 } from '../utils';
85
+ import { traverseTree, hasLevel3 } from '../../utils';
86
86
  import Icon from '../Iconfont';
87
87
  import { getText } from '../../locale';
88
88
  var SearchArea = styled.div(_templateObject(), function (props) {
@@ -42,7 +42,7 @@ import cn from 'classnames';
42
42
  import styled, { createGlobalStyle, withTheme } from 'styled-components';
43
43
  import { uniq } from 'lodash';
44
44
  import ActionsContext from '../ActionsContext';
45
- import { hasLevel3 } from '../utils';
45
+ import { hasLevel3 } from '../../utils';
46
46
  import Icon from '../Iconfont';
47
47
  import NavigationPopup from './NavigationPopup';
48
48
  var Navigation = styled.li(_templateObject(), function (_ref) {
@@ -1,7 +1,7 @@
1
- import "antd/lib/select/style";
2
- import _Select from "antd/lib/select";
3
1
  import "antd/lib/tree-select/style";
4
2
  import _TreeSelect from "antd/lib/tree-select";
3
+ import "antd/lib/select/style";
4
+ import _Select from "antd/lib/select";
5
5
  import "antd/lib/input/style";
6
6
  import _Input from "antd/lib/input";
7
7
 
@@ -57,9 +57,8 @@ import { useState, useEffect } from 'react';
57
57
  import styled, { withTheme, createGlobalStyle } from 'styled-components';
58
58
  import { get } from 'lodash';
59
59
  import { getCurrentAppStore, setCurrentAppStore, getCurrentOrgStore, setCurrentOrgStore, getCurrentOrgTreeStore, setCurrentOrgTreeStore } from './storage';
60
- import { traverseTree } from './utils';
60
+ import { traverseTree } from '../utils';
61
61
  var InputGroup = _Input.Group;
62
- var TreeNode = _TreeSelect.TreeNode;
63
62
  var Option = _Select.Option; // 机构+应用UI
64
63
 
65
64
  var OrgAppsInputGroup = styled(InputGroup)(_templateObject(), function (props) {
@@ -47,7 +47,7 @@ import { useState, useEffect, useContext } from 'react';
47
47
  import styled, { withTheme } from 'styled-components';
48
48
  import { get } from 'lodash';
49
49
  import ActionsContext from './ActionsContext';
50
- import { getSelectedMenuInfo, isGroupMenu, isNewTabMenu, openInNewTab, traverseTree } from './utils';
50
+ import { getSelectedMenuInfo, isGroupMenu, isNewTabMenu, openInNewTab, traverseTree } from '../utils';
51
51
  import { setSideMenuStore } from './storage';
52
52
  import Iconfont from './Iconfont';
53
53
  var color = 'rgba(255,255,255,.85)';
@@ -10,9 +10,8 @@ import EnterpriseLayout from './EnterpriseLayout';
10
10
  import PaasLayout from './paaslayout';
11
11
  import HeaderNavs from './HeaderNavs';
12
12
  import HeaderTabs from './HeaderTabs';
13
- import getCheckAuth from './checkAuth';
14
13
  import AuthContext from '../AuthContext';
15
- import { safeParseJSON, findMenuInfoByPath } from './utils';
14
+ import { safeParseJSON, findMenuInfoByPath, getCheckAuth } from '../utils';
16
15
  import ActionsContext from './ActionsContext';
17
16
  import createActions from './createActions';
18
17
  import { getLanguageStore } from './storage';
@@ -24,7 +23,9 @@ export * from './HeaderNavs';
24
23
  var TNTLayout = function TNTLayout(_ref) {
25
24
  var type = _ref.type,
26
25
  config = _ref.config,
27
- props = _objectWithoutProperties(_ref, ["type", "config"]);
26
+ _ref$showMenuInIframe = _ref.showMenuInIframe,
27
+ showMenuInIframe = _ref$showMenuInIframe === void 0 ? false : _ref$showMenuInIframe,
28
+ props = _objectWithoutProperties(_ref, ["type", "config", "showMenuInIframe"]);
28
29
 
29
30
  var headerHeight = props.size === 'large' ? 60 : 50;
30
31
  var theme = {
@@ -47,7 +48,7 @@ var TNTLayout = function TNTLayout(_ref) {
47
48
  blueBgColor: '#1D4295' // 默认的蓝色主题
48
49
 
49
50
  };
50
- var isInIframe = self !== top; // 前期拼写错误,导致需要兼容处理
51
+ var isInIframe = showMenuInIframe ? false : self !== top && !window.navigator.userAgent.includes('mo-fang-app'); // 前期拼写错误,导致需要兼容处理
51
52
 
52
53
  var extraHeaderActions = props.extraHeaderActions || props.extralHeaderActions;
53
54
  var extendMap = typeof props.extendMap === 'string' ? safeParseJSON(props.extendMap, {}) : props.extendMap;
@@ -31,7 +31,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
31
31
  import { useState, useEffect, Component } from 'react';
32
32
  import styled from 'styled-components';
33
33
  import cn from 'classnames';
34
- import { isNewTabMenu, openInNewTab } from '../utils';
34
+ import { isNewTabMenu, openInNewTab } from '../../utils';
35
35
  import Iconfont from '../Iconfont';
36
36
  var SideMenu = styled.ul(_templateObject());
37
37
  var SubMenu = styled.ul(_templateObject2());
@@ -31,7 +31,7 @@ import { useState, useEffect } from 'react';
31
31
  import styled, { withTheme } from 'styled-components';
32
32
  import cn from 'classnames';
33
33
  import { get, reduce, isUndefined } from 'lodash';
34
- import { getSelectedMenuInfo } from '../utils';
34
+ import { getSelectedMenuInfo } from '../../utils';
35
35
  import HeaderNavs from '../HeaderNavs';
36
36
  import Header from './Header';
37
37
  import SideMenu from './SideMenu';
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import { safeParseJSON } from './utils';
7
+ import { safeParseJSON } from '../utils';
8
8
  export var getSideMenuStore = function getSideMenuStore() {
9
9
  return safeParseJSON(localStorage.getItem('sideMenu'), {});
10
10
  };
package/es/index.js CHANGED
@@ -16,4 +16,5 @@ export { default as Select } from './Select';
16
16
  export { default as Img } from './Img';
17
17
  export { default as Title } from './Title';
18
18
  export { default as Ellipsis } from './Ellipsis';
19
- export { default as ArrayInput } from './ArrayInput';
19
+ export { default as ArrayInput } from './ArrayInput';
20
+ export * from './utils';
@@ -0,0 +1,30 @@
1
+ import { get } from 'lodash';
2
+ export var getCheckAuth = function getCheckAuth(menus) {
3
+ var getAuthMap = function getAuthMap() {
4
+ var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5
+ var authMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6
+ return menus.reduce(function (acc, _ref) {
7
+ var code = _ref.code,
8
+ groupName = _ref.groupName,
9
+ functionList = _ref.functionList,
10
+ children = _ref.children;
11
+
12
+ if (groupName) {
13
+ return getAuthMap(children, acc);
14
+ } else {
15
+ acc[code] = acc[code] || {};
16
+ acc[code] = (functionList || []).reduce(function (acc, curFunc) {
17
+ acc[curFunc.code] = curFunc.hasPermission;
18
+ return acc;
19
+ }, acc[code]);
20
+ return acc;
21
+ }
22
+ }, authMap);
23
+ };
24
+
25
+ var authMap = getAuthMap(menus);
26
+ return function (menuCode, funCode) {
27
+ return !!get(authMap, "".concat(menuCode).concat(funCode ? ".".concat(funCode) : ''));
28
+ };
29
+ };
30
+ export default getCheckAuth;
@@ -0,0 +1,41 @@
1
+ import { traverseTree, isGroupMenu } from '.';
2
+ export var findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc) {
3
+ var menu;
4
+ var subMenu;
5
+ var matchedSubMenu;
6
+ var parentMenus;
7
+
8
+ if (path) {
9
+ traverseTree(menuTree, function (menu, pnode, pnodes) {
10
+ if (!isGroupMenu(menu)) {
11
+ var _menu;
12
+
13
+ if (((_menu = menu) == null ? void 0 : _menu.path) === path) {
14
+ subMenu = menu;
15
+ menu = pnode;
16
+ parentMenus = pnodes;
17
+ return false;
18
+ }
19
+
20
+ if (!matchedSubMenu && matchFunc && matchFunc(menu)) {
21
+ matchedSubMenu = menu;
22
+ menu = pnode;
23
+ parentMenus = pnodes;
24
+ }
25
+ }
26
+ });
27
+ return {
28
+ subMenu: subMenu,
29
+ matchedSubMenu: matchedSubMenu,
30
+ menu: menu,
31
+ parentMenus: parentMenus
32
+ };
33
+ }
34
+
35
+ return {
36
+ subMenu: subMenu,
37
+ menu: menu,
38
+ parentMenus: parentMenus
39
+ };
40
+ };
41
+ export default findMenuInfoByPath;
@@ -0,0 +1,99 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
4
+
5
+ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
6
+
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
8
+
9
+ export * from './checkAuth';
10
+ export * from './findMenuInfoByPath';
11
+ export var isGroupMenu = function isGroupMenu(menu) {
12
+ return (menu == null ? void 0 : menu.children) && !(menu == null ? void 0 : menu.path);
13
+ };
14
+ export var getSelectedMenuInfo = function getSelectedMenuInfo(selectedKey) {
15
+ var menus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
16
+ var subMenu;
17
+ var menu;
18
+ var parentMenus = [];
19
+
20
+ if (selectedKey) {
21
+ traverseTree(menus, function (node, pnode, pnodes) {
22
+ if (!isGroupMenu(node) && node.code === selectedKey) {
23
+ subMenu = node;
24
+ menu = pnode;
25
+ parentMenus = pnodes;
26
+ return false;
27
+ }
28
+ });
29
+ } else {
30
+ // 默认找到第一个菜单项
31
+ traverseTree(menus, function (node, pnode, pnodes) {
32
+ if (!isGroupMenu(node)) {
33
+ subMenu = node;
34
+ menu = pnode;
35
+ parentMenus = pnodes;
36
+ return false;
37
+ }
38
+ });
39
+ }
40
+
41
+ return {
42
+ subMenu: subMenu,
43
+ menu: menu,
44
+ parentMenus: parentMenus
45
+ };
46
+ };
47
+ export var hasLevel3 = function hasLevel3(menus) {
48
+ return menus == null ? void 0 : menus.some(function (menu) {
49
+ var _menu$children;
50
+
51
+ return menu == null ? void 0 : (_menu$children = menu.children) == null ? void 0 : _menu$children.some(function (item) {
52
+ var _item$children;
53
+
54
+ return item == null ? void 0 : (_item$children = item.children) == null ? void 0 : _item$children.length;
55
+ });
56
+ });
57
+ };
58
+ export var isNewTabMenu = function isNewTabMenu(menu) {
59
+ var _ref = menu || {},
60
+ target = _ref.target,
61
+ path = _ref.path;
62
+
63
+ return target === '_blank' || /^http/i.test(path) && /blankType=newTarget/.test(path);
64
+ };
65
+ export var openInNewTab = function openInNewTab(path) {
66
+ window.open(path, '_blank');
67
+ };
68
+ export var traverseTree = function traverseTree(treeData, callback, pnode) {
69
+ var pnodes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
70
+ (treeData || []).every(function (node, index) {
71
+ var result;
72
+
73
+ if (callback) {
74
+ result = callback(node, pnode, (pnodes == null ? void 0 : pnodes.length) ? pnodes : [pnode].filter(function (item) {
75
+ return !!item;
76
+ }), index);
77
+ } // 回调函数返回false则终止遍历
78
+
79
+
80
+ if (result !== false) {
81
+ node && traverseTree(node.children || [], callback, node, [node].concat(_toConsumableArray(pnodes)));
82
+ }
83
+
84
+ return result !== false;
85
+ });
86
+ return treeData;
87
+ };
88
+ export var safeParseJSON = function safeParseJSON(str, defaultObj) {
89
+ var result;
90
+
91
+ try {
92
+ result = JSON.parse(str);
93
+ } catch (err) {
94
+ console.warn('json parse error:', err);
95
+ result = typeof defaultObj === 'undefined' ? str : defaultObj;
96
+ }
97
+
98
+ return result || defaultObj;
99
+ };
@@ -37,7 +37,7 @@ var _Icon = _interopRequireDefault(require("../Icon"));
37
37
 
38
38
  var _storage = require("./storage");
39
39
 
40
- var _utils = require("./utils");
40
+ var _utils = require("../utils");
41
41
 
42
42
  var _this = void 0;
43
43
 
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _lodash = require("lodash");
15
15
 
16
- var _utils = require("../utils");
16
+ var _utils = require("../../utils");
17
17
 
18
18
  var _Iconfont = _interopRequireDefault(require("../Iconfont"));
19
19
 
@@ -19,7 +19,7 @@ var _lodash = require("lodash");
19
19
 
20
20
  var _ActionsContext = _interopRequireDefault(require("../ActionsContext"));
21
21
 
22
- var _utils = require("../utils");
22
+ var _utils = require("../../utils");
23
23
 
24
24
  var _Iconfont = _interopRequireDefault(require("../Iconfont"));
25
25
 
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- require("antd/lib/select/style");
11
-
12
- var _select = _interopRequireDefault(require("antd/lib/select"));
13
-
14
10
  require("antd/lib/tree-select/style");
15
11
 
16
12
  var _treeSelect = _interopRequireDefault(require("antd/lib/tree-select"));
17
13
 
14
+ require("antd/lib/select/style");
15
+
16
+ var _select = _interopRequireDefault(require("antd/lib/select"));
17
+
18
18
  require("antd/lib/input/style");
19
19
 
20
20
  var _input = _interopRequireDefault(require("antd/lib/input"));
@@ -27,7 +27,7 @@ var _lodash = require("lodash");
27
27
 
28
28
  var _storage = require("./storage");
29
29
 
30
- var _utils = require("./utils");
30
+ var _utils = require("../utils");
31
31
 
32
32
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
33
33
 
@@ -84,7 +84,6 @@ function _templateObject() {
84
84
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
85
85
 
86
86
  var InputGroup = _input["default"].Group;
87
- var TreeNode = _treeSelect["default"].TreeNode;
88
87
  var Option = _select["default"].Option; // 机构+应用UI
89
88
 
90
89
  var OrgAppsInputGroup = (0, _styledComponents["default"])(InputGroup)(_templateObject(), function (props) {
@@ -19,7 +19,7 @@ var _lodash = require("lodash");
19
19
 
20
20
  var _ActionsContext = _interopRequireDefault(require("./ActionsContext"));
21
21
 
22
- var _utils = require("./utils");
22
+ var _utils = require("../utils");
23
23
 
24
24
  var _storage = require("./storage");
25
25
 
@@ -33,11 +33,9 @@ Object.keys(_HeaderNavs).forEach(function (key) {
33
33
 
34
34
  var _HeaderTabs = _interopRequireDefault(require("./HeaderTabs"));
35
35
 
36
- var _checkAuth = _interopRequireDefault(require("./checkAuth"));
37
-
38
36
  var _AuthContext = _interopRequireDefault(require("../AuthContext"));
39
37
 
40
- var _utils = require("./utils");
38
+ var _utils = require("../utils");
41
39
 
42
40
  var _ActionsContext = _interopRequireDefault(require("./ActionsContext"));
43
41
 
@@ -66,7 +64,9 @@ exports.HeaderActionItem = HeaderActionItem;
66
64
  var TNTLayout = function TNTLayout(_ref) {
67
65
  var type = _ref.type,
68
66
  config = _ref.config,
69
- props = _objectWithoutProperties(_ref, ["type", "config"]);
67
+ _ref$showMenuInIframe = _ref.showMenuInIframe,
68
+ showMenuInIframe = _ref$showMenuInIframe === void 0 ? false : _ref$showMenuInIframe,
69
+ props = _objectWithoutProperties(_ref, ["type", "config", "showMenuInIframe"]);
70
70
 
71
71
  var headerHeight = props.size === 'large' ? 60 : 50;
72
72
  var theme = {
@@ -89,7 +89,7 @@ var TNTLayout = function TNTLayout(_ref) {
89
89
  blueBgColor: '#1D4295' // 默认的蓝色主题
90
90
 
91
91
  };
92
- var isInIframe = self !== top; // 前期拼写错误,导致需要兼容处理
92
+ var isInIframe = showMenuInIframe ? false : self !== top && !window.navigator.userAgent.includes('mo-fang-app'); // 前期拼写错误,导致需要兼容处理
93
93
 
94
94
  var extraHeaderActions = props.extraHeaderActions || props.extralHeaderActions;
95
95
  var extendMap = typeof props.extendMap === 'string' ? (0, _utils.safeParseJSON)(props.extendMap, {}) : props.extendMap;
@@ -126,7 +126,7 @@ var TNTLayout = function TNTLayout(_ref) {
126
126
  return React.createElement(_styledComponents.ThemeProvider, {
127
127
  theme: theme
128
128
  }, React.createElement(_AuthContext["default"].Provider, {
129
- value: (0, _checkAuth["default"])(props.menus)
129
+ value: (0, _utils.getCheckAuth)(props.menus)
130
130
  }, React.createElement(_ActionsContext["default"].Provider, {
131
131
  value: actionsContextValue
132
132
  }, type === 'paas' && React.createElement(_paaslayout["default"], _extends({
@@ -11,7 +11,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
11
 
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
- var _utils = require("../utils");
14
+ var _utils = require("../../utils");
15
15
 
16
16
  var _Iconfont = _interopRequireDefault(require("../Iconfont"));
17
17
 
@@ -19,7 +19,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
19
19
 
20
20
  var _lodash = require("lodash");
21
21
 
22
- var _utils = require("../utils");
22
+ var _utils = require("../../utils");
23
23
 
24
24
  var _HeaderNavs = _interopRequireDefault(require("../HeaderNavs"));
25
25
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getThemeStore = exports.setThemeStore = exports.getLanguageStore = exports.setLanguageStore = exports.getCurrentOrgTreeStore = exports.setCurrentOrgTreeStore = exports.getCurrentOrgStore = exports.setCurrentOrgStore = exports.getCurrentAppStore = exports.setCurrentAppStore = exports.setSideMenuStore = exports.getSideMenuStore = void 0;
7
7
 
8
- var _utils = require("./utils");
8
+ var _utils = require("../utils");
9
9
 
10
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
11
11
 
package/lib/index.js CHANGED
@@ -3,6 +3,27 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ Layout: true,
8
+ AuthContext: true,
9
+ QueryForm: true,
10
+ Table: true,
11
+ ResizableTable: true,
12
+ QueryListScene: true,
13
+ Icon: true,
14
+ iconList: true,
15
+ Modal: true,
16
+ Columns: true,
17
+ DevelopmentLogin: true,
18
+ LoadingButton: true,
19
+ Handle: true,
20
+ Page: true,
21
+ Select: true,
22
+ Img: true,
23
+ Title: true,
24
+ Ellipsis: true,
25
+ ArrayInput: true
26
+ };
6
27
  Object.defineProperty(exports, "Layout", {
7
28
  enumerable: true,
8
29
  get: function get() {
@@ -156,4 +177,17 @@ var _Ellipsis = _interopRequireDefault(require("./Ellipsis"));
156
177
 
157
178
  var _ArrayInput = _interopRequireDefault(require("./ArrayInput"));
158
179
 
180
+ var _utils = require("./utils");
181
+
182
+ Object.keys(_utils).forEach(function (key) {
183
+ if (key === "default" || key === "__esModule") return;
184
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
185
+ Object.defineProperty(exports, key, {
186
+ enumerable: true,
187
+ get: function get() {
188
+ return _utils[key];
189
+ }
190
+ });
191
+ });
192
+
159
193
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.getCheckAuth = void 0;
7
+
8
+ var _lodash = require("lodash");
9
+
10
+ var getCheckAuth = function getCheckAuth(menus) {
11
+ var getAuthMap = function getAuthMap() {
12
+ var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13
+ var authMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14
+ return menus.reduce(function (acc, _ref) {
15
+ var code = _ref.code,
16
+ groupName = _ref.groupName,
17
+ functionList = _ref.functionList,
18
+ children = _ref.children;
19
+
20
+ if (groupName) {
21
+ return getAuthMap(children, acc);
22
+ } else {
23
+ acc[code] = acc[code] || {};
24
+ acc[code] = (functionList || []).reduce(function (acc, curFunc) {
25
+ acc[curFunc.code] = curFunc.hasPermission;
26
+ return acc;
27
+ }, acc[code]);
28
+ return acc;
29
+ }
30
+ }, authMap);
31
+ };
32
+
33
+ var authMap = getAuthMap(menus);
34
+ return function (menuCode, funCode) {
35
+ return !!(0, _lodash.get)(authMap, "".concat(menuCode).concat(funCode ? ".".concat(funCode) : ''));
36
+ };
37
+ };
38
+
39
+ exports.getCheckAuth = getCheckAuth;
40
+ var _default = getCheckAuth;
41
+ exports["default"] = _default;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.findMenuInfoByPath = void 0;
7
+
8
+ var _ = require(".");
9
+
10
+ var findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc) {
11
+ var menu;
12
+ var subMenu;
13
+ var matchedSubMenu;
14
+ var parentMenus;
15
+
16
+ if (path) {
17
+ (0, _.traverseTree)(menuTree, function (menu, pnode, pnodes) {
18
+ if (!(0, _.isGroupMenu)(menu)) {
19
+ var _menu;
20
+
21
+ if (((_menu = menu) == null ? void 0 : _menu.path) === path) {
22
+ subMenu = menu;
23
+ menu = pnode;
24
+ parentMenus = pnodes;
25
+ return false;
26
+ }
27
+
28
+ if (!matchedSubMenu && matchFunc && matchFunc(menu)) {
29
+ matchedSubMenu = menu;
30
+ menu = pnode;
31
+ parentMenus = pnodes;
32
+ }
33
+ }
34
+ });
35
+ return {
36
+ subMenu: subMenu,
37
+ matchedSubMenu: matchedSubMenu,
38
+ menu: menu,
39
+ parentMenus: parentMenus
40
+ };
41
+ }
42
+
43
+ return {
44
+ subMenu: subMenu,
45
+ menu: menu,
46
+ parentMenus: parentMenus
47
+ };
48
+ };
49
+
50
+ exports.findMenuInfoByPath = findMenuInfoByPath;
51
+ var _default = findMenuInfoByPath;
52
+ exports["default"] = _default;