tntd 1.4.18 → 1.4.20

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 (171) hide show
  1. package/components/Ellipsis/index.js +1 -1
  2. package/components/Layout/Avatar.js +4 -4
  3. package/components/Layout/EnterpriseLayout/Avatar.js +10 -7
  4. package/components/Layout/EnterpriseLayout/Language.js +5 -3
  5. package/components/Layout/EnterpriseLayout/Theme.js +6 -7
  6. package/components/Layout/EnterpriseLayout/index.js +1 -1
  7. package/components/Layout/HeaderActions.js +13 -10
  8. package/components/Layout/HeaderTabs.js +13 -14
  9. package/components/Layout/Layout.js +2 -0
  10. package/components/Layout/index.js +2 -1
  11. package/components/Layout/storage.js +12 -2
  12. package/components/Page/index.js +2 -2
  13. package/components/locale.js +7 -2
  14. package/dist/1.tntd.js +1 -12
  15. package/dist/stats.json +28426 -28000
  16. package/dist/tntd.css +1 -1
  17. package/dist/tntd.js +13 -7
  18. package/es/ArrayInput/icon.js +5 -5
  19. package/es/ArrayInput/index.js +76 -108
  20. package/es/AuthContext.js +1 -1
  21. package/es/Columns/index.js +31 -38
  22. package/es/DevelopmentLogin/LoginModal.js +32 -45
  23. package/es/DevelopmentLogin/index.js +13 -17
  24. package/es/Ellipsis/Svg/CopySVG.js +13 -13
  25. package/es/Ellipsis/Svg/TickSVG.js +8 -8
  26. package/es/Ellipsis/index.js +59 -70
  27. package/es/Handle/index.js +25 -35
  28. package/es/Icon/fonts/iconfont.js +7 -12
  29. package/es/Icon/index.js +10 -13
  30. package/es/Img/Contain.js +24 -29
  31. package/es/Img/Cover.js +40 -54
  32. package/es/Img/index.js +36 -45
  33. package/es/Layout/ActionsContext.js +3 -2
  34. package/es/Layout/AppList.js +37 -92
  35. package/es/Layout/Application.js +26 -72
  36. package/es/Layout/Avatar.js +32 -69
  37. package/es/Layout/CompatibleLanguage.js +39 -94
  38. package/es/Layout/EnterpriseLayout/Avatar.js +49 -79
  39. package/es/Layout/EnterpriseLayout/Language.js +19 -34
  40. package/es/Layout/EnterpriseLayout/Theme.js +23 -37
  41. package/es/Layout/EnterpriseLayout/index.js +14 -16
  42. package/es/Layout/GlobalNavigation/NavigationPopup.js +59 -170
  43. package/es/Layout/GlobalNavigation/index.js +20 -54
  44. package/es/Layout/Header.js +25 -46
  45. package/es/Layout/HeaderActions.js +52 -63
  46. package/es/Layout/HeaderNavs.js +20 -47
  47. package/es/Layout/HeaderTabs.js +61 -115
  48. package/es/Layout/Iconfont.js +1 -1
  49. package/es/Layout/Language.js +14 -32
  50. package/es/Layout/Layout.js +88 -108
  51. package/es/Layout/Logo.js +16 -32
  52. package/es/Layout/OrgAppList.js +62 -107
  53. package/es/Layout/SideMenu.js +63 -124
  54. package/es/Layout/Theme.js +23 -61
  55. package/es/Layout/index.js +29 -36
  56. package/es/Layout/paaslayout/CompactSideMenu.js +35 -74
  57. package/es/Layout/paaslayout/Header.js +22 -45
  58. package/es/Layout/paaslayout/Logo.js +3 -13
  59. package/es/Layout/paaslayout/SideMenu.js +39 -78
  60. package/es/Layout/paaslayout/index.js +75 -102
  61. package/es/Layout/storage.js +26 -9
  62. package/es/LoadingButton/index.js +15 -24
  63. package/es/Modal/index.js +38 -46
  64. package/es/Page/Box.js +34 -41
  65. package/es/Page/index.js +54 -68
  66. package/es/Page/utils.js +0 -5
  67. package/es/QueryForm/Field/Checkbox.js +5 -9
  68. package/es/QueryForm/Field/Select.js +31 -41
  69. package/es/QueryForm/Field/SelectInput.js +26 -41
  70. package/es/QueryForm/Field/fieldsMap.js +0 -1
  71. package/es/QueryForm/Field/index.js +41 -71
  72. package/es/QueryForm/createActions.js +6 -7
  73. package/es/QueryForm/index.js +76 -135
  74. package/es/QueryListScene/List.js +74 -128
  75. package/es/QueryListScene/QueryForm.js +46 -81
  76. package/es/QueryListScene/QueryListScene.js +25 -40
  77. package/es/QueryListScene/Title.js +3 -3
  78. package/es/QueryListScene/Toolbar.js +11 -12
  79. package/es/Select/DropDownWrap.js +29 -50
  80. package/es/Select/index.js +135 -231
  81. package/es/Table/ResizableTable/index.js +26 -40
  82. package/es/Table/index.js +18 -16
  83. package/es/Title/index.js +21 -23
  84. package/es/locale.js +9 -7
  85. package/es/utils/checkAuth.js +3 -5
  86. package/es/utils/findMenuInfoByPath.js +0 -4
  87. package/es/utils/index.js +12 -23
  88. package/lib/ArrayInput/icon.js +6 -6
  89. package/lib/ArrayInput/index.js +78 -127
  90. package/lib/AuthContext.js +1 -4
  91. package/lib/Columns/index.js +31 -47
  92. package/lib/DevelopmentLogin/LoginModal.js +32 -58
  93. package/lib/DevelopmentLogin/index.js +16 -27
  94. package/lib/Ellipsis/Svg/CopySVG.js +13 -15
  95. package/lib/Ellipsis/Svg/TickSVG.js +8 -10
  96. package/lib/Ellipsis/index.js +58 -81
  97. package/lib/Handle/index.js +25 -47
  98. package/lib/Icon/fonts/iconfont.js +7 -12
  99. package/lib/Icon/index.js +11 -20
  100. package/lib/Img/Contain.js +24 -34
  101. package/lib/Img/Cover.js +42 -65
  102. package/lib/Img/index.js +36 -51
  103. package/lib/Layout/ActionsContext.js +1 -4
  104. package/lib/Layout/AppList.js +40 -118
  105. package/lib/Layout/Application.js +26 -86
  106. package/lib/Layout/Avatar.js +35 -89
  107. package/lib/Layout/CompatibleLanguage.js +39 -110
  108. package/lib/Layout/EnterpriseLayout/Avatar.js +52 -101
  109. package/lib/Layout/EnterpriseLayout/Language.js +21 -49
  110. package/lib/Layout/EnterpriseLayout/Theme.js +22 -46
  111. package/lib/Layout/EnterpriseLayout/index.js +14 -23
  112. package/lib/Layout/GlobalNavigation/NavigationPopup.js +59 -186
  113. package/lib/Layout/GlobalNavigation/index.js +23 -74
  114. package/lib/Layout/Header.js +28 -63
  115. package/lib/Layout/HeaderActions.js +48 -74
  116. package/lib/Layout/HeaderNavs.js +23 -61
  117. package/lib/Layout/HeaderTabs.js +58 -126
  118. package/lib/Layout/Iconfont.js +1 -5
  119. package/lib/Layout/Language.js +17 -48
  120. package/lib/Layout/Layout.js +90 -128
  121. package/lib/Layout/Logo.js +19 -43
  122. package/lib/Layout/OrgAppList.js +64 -127
  123. package/lib/Layout/SideMenu.js +65 -143
  124. package/lib/Layout/Theme.js +23 -73
  125. package/lib/Layout/createActions.js +0 -5
  126. package/lib/Layout/images/index.js +0 -28
  127. package/lib/Layout/index.js +33 -57
  128. package/lib/Layout/paaslayout/CompactSideMenu.js +35 -84
  129. package/lib/Layout/paaslayout/Header.js +22 -55
  130. package/lib/Layout/paaslayout/Logo.js +3 -19
  131. package/lib/Layout/paaslayout/SideMenu.js +39 -87
  132. package/lib/Layout/paaslayout/index.js +77 -122
  133. package/lib/Layout/storage.js +29 -35
  134. package/lib/LoadingButton/index.js +15 -29
  135. package/lib/Modal/index.js +38 -53
  136. package/lib/Page/Box.js +34 -45
  137. package/lib/Page/index.js +54 -78
  138. package/lib/Page/utils.js +1 -9
  139. package/lib/QueryForm/Field/Checkbox.js +5 -13
  140. package/lib/QueryForm/Field/Select.js +33 -53
  141. package/lib/QueryForm/Field/SelectInput.js +28 -56
  142. package/lib/QueryForm/Field/fieldsMap.js +1 -15
  143. package/lib/QueryForm/Field/index.js +43 -81
  144. package/lib/QueryForm/createActions.js +6 -12
  145. package/lib/QueryForm/index.js +78 -157
  146. package/lib/QueryForm/useForm.js +0 -5
  147. package/lib/QueryListScene/List.js +76 -140
  148. package/lib/QueryListScene/QueryForm.js +46 -86
  149. package/lib/QueryListScene/QueryListScene.js +25 -46
  150. package/lib/QueryListScene/Title.js +3 -7
  151. package/lib/QueryListScene/Toolbar.js +11 -16
  152. package/lib/QueryListScene/createActions.js +0 -5
  153. package/lib/QueryListScene/index.js +0 -10
  154. package/lib/QueryListScene/useActions.js +0 -5
  155. package/lib/Select/DropDownWrap.js +31 -56
  156. package/lib/Select/index.js +135 -241
  157. package/lib/Table/ResizableTable/index.js +26 -48
  158. package/lib/Table/index.js +17 -28
  159. package/lib/Title/index.js +21 -28
  160. package/lib/index.js +35 -56
  161. package/lib/locale.js +11 -12
  162. package/lib/utils/checkAuth.js +4 -9
  163. package/lib/utils/findMenuInfoByPath.js +1 -8
  164. package/lib/utils/index.js +15 -42
  165. package/package.json +2 -2
  166. package/es/Layout/checkAuth.js +0 -29
  167. package/es/Layout/utils.js +0 -136
  168. package/lib/Layout/EnterpriseLayout/Header.js +0 -113
  169. package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
  170. package/lib/Layout/checkAuth.js +0 -39
  171. package/lib/Layout/utils.js +0 -166
@@ -3,28 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports.findMenuInfoByPath = void 0;
7
-
6
+ exports.findMenuInfoByPath = exports["default"] = void 0;
8
7
  var _ = require(".");
9
-
10
8
  var findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc) {
11
9
  var menu;
12
10
  var subMenu;
13
11
  var matchedSubMenu;
14
12
  var parentMenus;
15
-
16
13
  if (path) {
17
14
  (0, _.traverseTree)(menuTree, function (menu, pnode, pnodes) {
18
15
  if (!(0, _.isGroupMenu)(menu)) {
19
16
  var _menu;
20
-
21
17
  if (((_menu = menu) == null ? void 0 : _menu.path) === path) {
22
18
  subMenu = menu;
23
19
  menu = pnode;
24
20
  parentMenus = pnodes;
25
21
  return false;
26
22
  }
27
-
28
23
  if (!matchedSubMenu && matchFunc && matchFunc(menu)) {
29
24
  matchedSubMenu = menu;
30
25
  menu = pnode;
@@ -39,14 +34,12 @@ var findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc)
39
34
  parentMenus: parentMenus
40
35
  };
41
36
  }
42
-
43
37
  return {
44
38
  subMenu: subMenu,
45
39
  menu: menu,
46
40
  parentMenus: parentMenus
47
41
  };
48
42
  };
49
-
50
43
  exports.findMenuInfoByPath = findMenuInfoByPath;
51
44
  var _default = findMenuInfoByPath;
52
45
  exports["default"] = _default;
@@ -12,13 +12,12 @@ var _exportNames = {
12
12
  traverseTree: true,
13
13
  safeParseJSON: true
14
14
  };
15
- exports.safeParseJSON = exports.traverseTree = exports.openInNewTab = exports.isNewTabMenu = exports.hasLevel3 = exports.getSelectedMenuInfo = exports.isGroupMenu = void 0;
16
-
15
+ exports.traverseTree = exports.safeParseJSON = exports.openInNewTab = exports.isNewTabMenu = exports.isGroupMenu = exports.hasLevel3 = exports.getSelectedMenuInfo = void 0;
17
16
  var _checkAuth = require("./checkAuth");
18
-
19
17
  Object.keys(_checkAuth).forEach(function (key) {
20
18
  if (key === "default" || key === "__esModule") return;
21
19
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
+ if (key in exports && exports[key] === _checkAuth[key]) return;
22
21
  Object.defineProperty(exports, key, {
23
22
  enumerable: true,
24
23
  get: function get() {
@@ -26,12 +25,11 @@ Object.keys(_checkAuth).forEach(function (key) {
26
25
  }
27
26
  });
28
27
  });
29
-
30
28
  var _findMenuInfoByPath = require("./findMenuInfoByPath");
31
-
32
29
  Object.keys(_findMenuInfoByPath).forEach(function (key) {
33
30
  if (key === "default" || key === "__esModule") return;
34
31
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
32
+ if (key in exports && exports[key] === _findMenuInfoByPath[key]) return;
35
33
  Object.defineProperty(exports, key, {
36
34
  enumerable: true,
37
35
  get: function get() {
@@ -39,27 +37,21 @@ Object.keys(_findMenuInfoByPath).forEach(function (key) {
39
37
  }
40
38
  });
41
39
  });
42
-
43
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
44
-
45
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
46
-
47
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
48
-
49
- 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; } }
50
-
40
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
41
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
42
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
43
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
44
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
45
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
51
46
  var isGroupMenu = function isGroupMenu(menu) {
52
- return (menu == null ? void 0 : menu.children) && !(menu == null ? void 0 : menu.path);
47
+ return (menu == null ? void 0 : menu.children) && !(menu != null && menu.path);
53
48
  };
54
-
55
49
  exports.isGroupMenu = isGroupMenu;
56
-
57
50
  var getSelectedMenuInfo = function getSelectedMenuInfo(selectedKey) {
58
51
  var menus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
59
52
  var subMenu;
60
53
  var menu;
61
54
  var parentMenus = [];
62
-
63
55
  if (selectedKey) {
64
56
  traverseTree(menus, function (node, pnode, pnodes) {
65
57
  if (!isGroupMenu(node) && node.code === selectedKey) {
@@ -80,80 +72,61 @@ var getSelectedMenuInfo = function getSelectedMenuInfo(selectedKey) {
80
72
  }
81
73
  });
82
74
  }
83
-
84
75
  return {
85
76
  subMenu: subMenu,
86
77
  menu: menu,
87
78
  parentMenus: parentMenus
88
79
  };
89
80
  };
90
-
91
81
  exports.getSelectedMenuInfo = getSelectedMenuInfo;
92
-
93
82
  var hasLevel3 = function hasLevel3(menus) {
94
83
  return menus == null ? void 0 : menus.some(function (menu) {
95
84
  var _menu$children;
96
-
97
85
  return menu == null ? void 0 : (_menu$children = menu.children) == null ? void 0 : _menu$children.some(function (item) {
98
86
  var _item$children;
99
-
100
87
  return item == null ? void 0 : (_item$children = item.children) == null ? void 0 : _item$children.length;
101
88
  });
102
89
  });
103
90
  };
104
-
105
91
  exports.hasLevel3 = hasLevel3;
106
-
107
92
  var isNewTabMenu = function isNewTabMenu(menu) {
108
93
  var _ref = menu || {},
109
- target = _ref.target,
110
- path = _ref.path;
111
-
94
+ target = _ref.target,
95
+ path = _ref.path;
112
96
  return target === '_blank' || /^http/i.test(path) && /blankType=newTarget/.test(path);
113
97
  };
114
-
115
98
  exports.isNewTabMenu = isNewTabMenu;
116
-
117
99
  var openInNewTab = function openInNewTab(path) {
118
100
  window.open(path, '_blank');
119
101
  };
120
-
121
102
  exports.openInNewTab = openInNewTab;
122
-
123
103
  var traverseTree = function traverseTree(treeData, callback, pnode) {
124
104
  var pnodes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
125
105
  (treeData || []).every(function (node, index) {
126
106
  var result;
127
-
128
107
  if (callback) {
129
- result = callback(node, pnode, (pnodes == null ? void 0 : pnodes.length) ? pnodes : [pnode].filter(function (item) {
108
+ result = callback(node, pnode, pnodes != null && pnodes.length ? pnodes : [pnode].filter(function (item) {
130
109
  return !!item;
131
110
  }), index);
132
- } // 回调函数返回false则终止遍历
133
-
111
+ }
134
112
 
113
+ // 回调函数返回false则终止遍历
135
114
  if (result !== false) {
136
115
  node && traverseTree(node.children || [], callback, node, [node].concat(_toConsumableArray(pnodes)));
137
116
  }
138
-
139
117
  return result !== false;
140
118
  });
141
119
  return treeData;
142
120
  };
143
-
144
121
  exports.traverseTree = traverseTree;
145
-
146
122
  var safeParseJSON = function safeParseJSON(str, defaultObj) {
147
123
  var result;
148
-
149
124
  try {
150
125
  result = JSON.parse(str);
151
126
  } catch (err) {
152
127
  console.warn('json parse error:', err);
153
128
  result = typeof defaultObj === 'undefined' ? str : defaultObj;
154
129
  }
155
-
156
130
  return result || defaultObj;
157
131
  };
158
-
159
132
  exports.safeParseJSON = safeParseJSON;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tntd",
3
- "version": "1.4.18",
3
+ "version": "1.4.20",
4
4
  "description": "ued tnt design",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -73,4 +73,4 @@
73
73
  "react-resizable": "^1.11.1",
74
74
  "styled-components": "^5.3.0"
75
75
  }
76
- }
76
+ }
@@ -1,29 +0,0 @@
1
- import { get } from 'lodash';
2
- export default (function (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
- });
@@ -1,136 +0,0 @@
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 var isGroupMenu = function isGroupMenu(menu) {
10
- return (menu == null ? void 0 : menu.children) && !(menu == null ? void 0 : menu.path);
11
- };
12
- export var getSelectedMenuInfo = function getSelectedMenuInfo(selectedKey) {
13
- var menus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14
- var subMenu;
15
- var menu;
16
- var parentMenus = [];
17
-
18
- if (selectedKey) {
19
- traverseTree(menus, function (node, pnode, pnodes) {
20
- if (!isGroupMenu(node) && node.code === selectedKey) {
21
- subMenu = node;
22
- menu = pnode;
23
- parentMenus = pnodes;
24
- return false;
25
- }
26
- });
27
- } else {
28
- // 默认找到第一个菜单项
29
- traverseTree(menus, function (node, pnode, pnodes) {
30
- if (!isGroupMenu(node)) {
31
- subMenu = node;
32
- menu = pnode;
33
- parentMenus = pnodes;
34
- return false;
35
- }
36
- });
37
- }
38
-
39
- return {
40
- subMenu: subMenu,
41
- menu: menu,
42
- parentMenus: parentMenus
43
- };
44
- };
45
- export var findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc) {
46
- var menu;
47
- var subMenu;
48
- var matchedSubMenu;
49
- var parentMenus;
50
-
51
- if (path) {
52
- traverseTree(menuTree, function (menu, pnode, pnodes) {
53
- if (!isGroupMenu(menu)) {
54
- var _menu;
55
-
56
- if (((_menu = menu) == null ? void 0 : _menu.path) === path) {
57
- subMenu = menu;
58
- menu = pnode;
59
- parentMenus = pnodes;
60
- return false;
61
- }
62
-
63
- if (!matchedSubMenu && matchFunc && matchFunc(menu)) {
64
- matchedSubMenu = menu;
65
- menu = pnode;
66
- parentMenus = pnodes;
67
- }
68
- }
69
- });
70
- return {
71
- subMenu: subMenu,
72
- matchedSubMenu: matchedSubMenu,
73
- menu: menu,
74
- parentMenus: parentMenus
75
- };
76
- }
77
-
78
- return {
79
- subMenu: subMenu,
80
- menu: menu,
81
- parentMenus: parentMenus
82
- };
83
- };
84
- export var hasLevel3 = function hasLevel3(menus) {
85
- return menus == null ? void 0 : menus.some(function (menu) {
86
- var _menu$children;
87
-
88
- return menu == null ? void 0 : (_menu$children = menu.children) == null ? void 0 : _menu$children.some(function (item) {
89
- var _item$children;
90
-
91
- return item == null ? void 0 : (_item$children = item.children) == null ? void 0 : _item$children.length;
92
- });
93
- });
94
- };
95
- export var isNewTabMenu = function isNewTabMenu(menu) {
96
- var _ref = menu || {},
97
- target = _ref.target,
98
- path = _ref.path;
99
-
100
- return target === '_blank' || /^http/i.test(path) && /blankType=newTarget/.test(path);
101
- };
102
- export var openInNewTab = function openInNewTab(path) {
103
- window.open(path, '_blank');
104
- };
105
- export var traverseTree = function traverseTree(treeData, callback, pnode) {
106
- var pnodes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
107
- (treeData || []).every(function (node, index) {
108
- var result;
109
-
110
- if (callback) {
111
- result = callback(node, pnode, (pnodes == null ? void 0 : pnodes.length) ? pnodes : [pnode].filter(function (item) {
112
- return !!item;
113
- }), index);
114
- } // 回调函数返回false则终止遍历
115
-
116
-
117
- if (result !== false) {
118
- node && traverseTree(node.children || [], callback, node, [node].concat(_toConsumableArray(pnodes)));
119
- }
120
-
121
- return result !== false;
122
- });
123
- return treeData;
124
- };
125
- export var safeParseJSON = function safeParseJSON(str, defaultObj) {
126
- var result;
127
-
128
- try {
129
- result = JSON.parse(str);
130
- } catch (err) {
131
- console.warn('json parse error:', err);
132
- result = typeof defaultObj === 'undefined' ? str : defaultObj;
133
- }
134
-
135
- return result || defaultObj;
136
- };
@@ -1,113 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { 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); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = require("react");
11
-
12
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
13
-
14
- var _Icon = _interopRequireDefault(require("../../Icon"));
15
-
16
- var _AppList = _interopRequireDefault(require("../AppList"));
17
-
18
- var _OrgAppList = _interopRequireDefault(require("../OrgAppList"));
19
-
20
- var _HeaderActions = _interopRequireDefault(require("./HeaderActions"));
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
25
-
26
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
29
-
30
- function _templateObject2() {
31
- var data = _taggedTemplateLiteral(["\n flex: 1;\n .isInIframe & {\n display: none;\n }\n"]);
32
-
33
- _templateObject2 = function _templateObject2() {
34
- return data;
35
- };
36
-
37
- return data;
38
- }
39
-
40
- function _templateObject() {
41
- var data = _taggedTemplateLiteral(["\n position: relative;\n z-index: 201;\n height: ", ";\n display: flex;\n color: rgba(255,255,255,.85);\n background: #fff;\n\n .hasHeaderTabs & {\n background: #191D29;\n .tnt-layout-header-content {\n display: none;\n }\n }\n\n .tnt-themeS3.hasHeaderTabs &{\n background: ", "; //#1D4295 !important;\n }\n\n .isInIframe.noAppList &,\n .isEmptyLayout & {\n display: none;\n }\n .tnt-themeS1 & {\n background: #FFFFFF;\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.15);\n }\n .tnt-themeS1.compatible & {\n /* background: #323b4a; */\n }\n padding-right: 20px;\n background: #FFFFFF;\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.10);\n .compatible & {\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.10);\n }\n transition: box-shadow .2s cubic-bezier(.4,0,.2,1), -webkit-box-shadow .2s cubic-bezier(.4,0,.2,1);\n\n .sidebar-collapsed-controller {\n text-align: center;\n width: ", ";\n line-height: ", ";\n height: ", ";\n cursor: pointer;\n color: ", ";\n margin-right: 10px;\n\n & > .tnt-icon {\n font-size: 16px;\n .large-size & {\n font-size: 20px;\n }\n }\n\n i {\n position: relative;\n top: -1px;\n vertical-align: sub;\n }\n\n &:hover {\n background-color: rgba(0,0,0,.06);\n }\n\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n color: ", ";\n }\n .large-size & {\n font-size: 18px;\n }\n .isInIframe & {\n display: none;\n }\n }\n"]);
42
-
43
- _templateObject = function _templateObject() {
44
- return data;
45
- };
46
-
47
- return data;
48
- }
49
-
50
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
51
-
52
- var Header = _styledComponents["default"].div(_templateObject(), function (props) {
53
- return "".concat(props.theme.headerHeight, "px");
54
- }, function (props) {
55
- return "".concat(props.theme.blueBgColor, " !important");
56
- }, function (props) {
57
- return "".concat(props.theme.headerHeight, "px");
58
- }, function (props) {
59
- return "".concat(props.theme.headerHeight, "px");
60
- }, function (props) {
61
- return "".concat(props.theme.headerHeight, "px");
62
- }, function (props) {
63
- return "".concat(props.theme.primaryTextColor);
64
- }, function (props) {
65
- return "".concat(props.theme.primaryTextColor);
66
- });
67
-
68
- var Content = _styledComponents["default"].div(_templateObject2());
69
-
70
- var _default = (0, _styledComponents.withTheme)(function (props) {
71
- var collapsed = props.collapsed,
72
- _props$collapseIconPl = props.collapseIconPlacement,
73
- collapseIconPlacement = _props$collapseIconPl === void 0 ? 'right' : _props$collapseIconPl,
74
- selectedAppKey = props.selectedAppKey,
75
- appList = props.appList,
76
- orgAppShow = props.orgAppShow,
77
- orgAppList = props.orgAppList,
78
- selectedOrgKey = props.selectedOrgKey,
79
- orgList = props.orgList,
80
- headerTabs = props.headerTabs,
81
- onAppChange = props.onAppChange,
82
- onOrgChange = props.onOrgChange,
83
- onCollapseChange = props.onCollapseChange,
84
- extraActions = props.extraActions;
85
- var headerRef = (0, _react.useRef)();
86
- return React.createElement(Header, {
87
- className: "tnt-layout-header",
88
- ref: headerRef
89
- }, collapseIconPlacement === 'right' && React.createElement("div", {
90
- className: "sidebar-collapsed-controller",
91
- onClick: onCollapseChange
92
- }, React.createElement(_Icon["default"], {
93
- type: "menu-".concat(collapsed ? 'unfold' : 'fold')
94
- })), headerTabs, orgList && React.createElement(_OrgAppList["default"], {
95
- orgAppShow: orgAppShow,
96
- selectedOrgKey: selectedOrgKey,
97
- orgList: orgList,
98
- onOrgChange: onOrgChange,
99
- selectedAppKey: selectedAppKey,
100
- orgAppList: orgAppList,
101
- onAppChange: onAppChange
102
- }), appList && !orgList && React.createElement(_AppList["default"], {
103
- items: appList,
104
- selectedKey: selectedAppKey,
105
- onChange: onAppChange
106
- }), React.createElement(Content, {
107
- className: "tnt-layout-header-content"
108
- }, props.children), React.createElement(_HeaderActions["default"], _extends({}, props, {
109
- headerRef: headerRef
110
- }), extraActions));
111
- });
112
-
113
- exports["default"] = _default;
@@ -1,104 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { 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); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- require("antd/lib/divider/style");
11
-
12
- var _divider = _interopRequireDefault(require("antd/lib/divider"));
13
-
14
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
15
-
16
- var _GlobalNavigation = _interopRequireDefault(require("../GlobalNavigation"));
17
-
18
- var _Application = _interopRequireDefault(require("../Application"));
19
-
20
- var _Avatar = _interopRequireDefault(require("./Avatar"));
21
-
22
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
23
-
24
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
-
28
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
-
30
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
-
32
- function _templateObject() {
33
- var data = _taggedTemplateLiteral(["\n list-style: none;\n display: inline-block;\n line-height: ", ";\n margin: 0 0 0 20px;\n .hasHeaderTabs & {\n margin: 0;\n }\n padding: 0;\n white-space: nowrap;\n\n .isInIframe & {\n display: none;\n }\n\n & > li {\n height: 100%;\n display: inline-block;\n vertical-align: top;\n cursor: pointer;\n font-size: 20px;\n margin: 0 7.5px;\n color: ", ";\n .large-size & {\n margin: 0 10px;\n }\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n &:last-of-type {\n margin-right: 0;\n }\n .hasHeaderTabs:not(.tnt-themeS1) & {\n color: rgba(255,255,255,.8);\n }\n }\n"]);
34
-
35
- _templateObject = function _templateObject() {
36
- return data;
37
- };
38
-
39
- return data;
40
- }
41
-
42
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
43
-
44
- var Actions = _styledComponents["default"].ul(_templateObject(), function (props) {
45
- return "".concat(props.theme.headerHeight, "px");
46
- }, function (props) {
47
- return "".concat(props.theme.headerActionsColor);
48
- });
49
-
50
- var _default = (0, _styledComponents.withTheme)(function (props) {
51
- var _props$config = props.config;
52
- _props$config = _props$config === void 0 ? {} : _props$config;
53
-
54
- var _props$config$theme = _props$config.theme,
55
- theme = _props$config$theme === void 0 ? true : _props$config$theme,
56
- _props$config$avatar = _props$config.avatar,
57
- avatar = _props$config$avatar === void 0 ? true : _props$config$avatar,
58
- _props$config$languag = _props$config.language,
59
- language = _props$config$languag === void 0 ? true : _props$config$languag,
60
- _props$config$applica = _props$config.application,
61
- application = _props$config$applica === void 0 ? false : _props$config$applica,
62
- _props$config$globalN = _props$config.globalNavigation,
63
- globalNavigation = _props$config$globalN === void 0 ? false : _props$config$globalN,
64
- compatible = props.theme.compatible,
65
- _props$userInfo = props.userInfo,
66
- userInfo = _props$userInfo === void 0 ? {} : _props$userInfo,
67
- menus = props.menus,
68
- apps = props.apps,
69
- extraActions = props.extraActions,
70
- headerRef = props.headerRef,
71
- onLanguageChange = props.onLanguageChange,
72
- onThemeChange = props.onThemeChange,
73
- onApplicationChange = props.onApplicationChange,
74
- onAppChange = props.onAppChange,
75
- onCollapseChange = props.onCollapseChange,
76
- onPersonalSetting = props.onPersonalSetting,
77
- onChangePassword = props.onChangePassword,
78
- onLogout = props.onLogout,
79
- onLogoClick = props.onLogoClick,
80
- rest = _objectWithoutProperties(props, ["config", "theme", "userInfo", "menus", "apps", "extraActions", "headerRef", "onLanguageChange", "onThemeChange", "onApplicationChange", "onAppChange", "onCollapseChange", "onPersonalSetting", "onChangePassword", "onLogout", "onLogoClick"]);
81
-
82
- return React.createElement(Actions, rest, extraActions, globalNavigation && React.createElement(_GlobalNavigation["default"], {
83
- headerRef: headerRef,
84
- menus: menus
85
- }), application && React.createElement(_Application["default"], {
86
- language: userInfo.lang,
87
- apps: apps,
88
- onChange: onApplicationChange
89
- }), avatar && React.createElement(React.Fragment, null, React.createElement(_divider["default"], {
90
- type: "vertical"
91
- }), React.createElement(_Avatar["default"], {
92
- userInfo: userInfo,
93
- onThemeChange: onThemeChange,
94
- onPersonalSetting: onPersonalSetting,
95
- onChangePassword: onChangePassword,
96
- onLogout: onLogout,
97
- config: {
98
- theme: theme,
99
- language: language
100
- }
101
- })));
102
- });
103
-
104
- exports["default"] = _default;
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _lodash = require("lodash");
9
-
10
- var _default = function _default(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["default"] = _default;