tntd 1.4.9 → 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 (47) 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/HeaderTabs.js +98 -73
  5. package/components/Layout/OrgAppList.js +14 -15
  6. package/components/Layout/SideMenu.js +2 -2
  7. package/components/Layout/index.js +4 -5
  8. package/components/Layout/paaslayout/CompactSideMenu.js +1 -1
  9. package/components/Layout/paaslayout/index.js +2 -2
  10. package/components/Layout/storage.js +1 -1
  11. package/components/index.js +1 -0
  12. package/components/{Layout → utils}/checkAuth.js +3 -1
  13. package/components/utils/findMenuInfoByPath.js +39 -0
  14. package/components/{Layout/utils.js → utils/index.js} +3 -35
  15. package/dist/stats.json +9824 -9578
  16. package/dist/tntd.js +1 -1
  17. package/es/Layout/AppList.js +1 -1
  18. package/es/Layout/GlobalNavigation/NavigationPopup.js +1 -1
  19. package/es/Layout/GlobalNavigation/index.js +1 -1
  20. package/es/Layout/HeaderTabs.js +19 -15
  21. package/es/Layout/OrgAppList.js +3 -4
  22. package/es/Layout/SideMenu.js +1 -1
  23. package/es/Layout/index.js +5 -4
  24. package/es/Layout/paaslayout/CompactSideMenu.js +1 -1
  25. package/es/Layout/paaslayout/index.js +1 -1
  26. package/es/Layout/storage.js +1 -1
  27. package/es/index.js +2 -1
  28. package/es/utils/checkAuth.js +30 -0
  29. package/es/utils/findMenuInfoByPath.js +41 -0
  30. package/es/utils/index.js +99 -0
  31. package/lib/Layout/AppList.js +1 -1
  32. package/lib/Layout/GlobalNavigation/NavigationPopup.js +1 -1
  33. package/lib/Layout/GlobalNavigation/index.js +1 -1
  34. package/lib/Layout/HeaderTabs.js +14 -10
  35. package/lib/Layout/OrgAppList.js +5 -6
  36. package/lib/Layout/SideMenu.js +1 -1
  37. package/lib/Layout/index.js +6 -6
  38. package/lib/Layout/paaslayout/CompactSideMenu.js +1 -1
  39. package/lib/Layout/paaslayout/index.js +1 -1
  40. package/lib/Layout/storage.js +1 -1
  41. package/lib/index.js +34 -0
  42. package/lib/utils/checkAuth.js +41 -0
  43. package/lib/utils/findMenuInfoByPath.js +52 -0
  44. package/lib/utils/index.js +159 -0
  45. package/package.json +1 -1
  46. package/lib/Layout/EnterpriseLayout/Header.js +0 -113
  47. package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
@@ -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) {
@@ -25,7 +25,7 @@ function _templateObject3() {
25
25
  }
26
26
 
27
27
  function _templateObject2() {
28
- var data = _taggedTemplateLiteral(["\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n text-align: left;\n height: 36px;\n line-height: 36px;\n flex: 1;\n white-space: nowrap;\n padding-right: 40px;\n transition: transform .25s linear;\n position:absolute;\n"]);
28
+ var data = _taggedTemplateLiteral(["\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n text-align: left;\n height: 36px;\n line-height: 36px;\n flex: 1;\n white-space: nowrap;\n padding-right: 40px;\n transition: transform 0.25s linear;\n position: absolute;\n"]);
29
29
 
30
30
  _templateObject2 = function _templateObject2() {
31
31
  return data;
@@ -46,17 +46,17 @@ function _templateObject() {
46
46
 
47
47
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
48
48
 
49
- import { useState, useEffect, useRef } from 'react';
50
- import styled, { withTheme } from 'styled-components';
51
- import cn from 'classnames';
52
- import { get } from 'lodash';
53
- import Icon from '../Icon';
49
+ import { useState, useEffect, useRef } from "react";
50
+ import styled, { withTheme } from "styled-components";
51
+ import cn from "classnames";
52
+ import { get } from "lodash";
53
+ import Icon from "../Icon";
54
54
  var TabsContainer = styled.div(_templateObject(), function (props) {
55
55
  return "".concat(props.theme.blueBgColor);
56
56
  });
57
57
  var Tabs = styled.ul(_templateObject2());
58
58
  var TabItem = styled.li(_templateObject3(), function (props) {
59
- return props.theme.size === 'large' ? '46px' : '36px';
59
+ return props.theme.size === "large" ? "46px" : "36px";
60
60
  }, function (props) {
61
61
  return props.theme.headerActionsColor;
62
62
  }, function (props) {
@@ -77,9 +77,10 @@ export var HeaderTabs = withTheme(function (_ref) {
77
77
  appListVisible = _ref.appListVisible,
78
78
  orgListVisible = _ref.orgListVisible,
79
79
  orgAppListVisible = _ref.orgAppListVisible,
80
- props = _objectWithoutProperties(_ref, ["theme", "className", "tabs", "onTabChange", "onTabSelect", "onTabClose", "appListVisible", "orgListVisible", "orgAppListVisible"]);
80
+ language = _ref.language,
81
+ props = _objectWithoutProperties(_ref, ["theme", "className", "tabs", "onTabChange", "onTabSelect", "onTabClose", "appListVisible", "orgListVisible", "orgAppListVisible", "language"]);
81
82
 
82
- var _useState = useState(props.selectedKey || get(tabs, '0.key')),
83
+ var _useState = useState(props.selectedKey || get(tabs, "0.key")),
83
84
  _useState2 = _slicedToArray(_useState, 2),
84
85
  selectedKey = _useState2[0],
85
86
  setSelectedKey = _useState2[1];
@@ -143,7 +144,7 @@ export var HeaderTabs = withTheme(function (_ref) {
143
144
  var tabsDom = getTabsDom();
144
145
  var parentBBox = tabsDom.parentNode.getBoundingClientRect();
145
146
  var parentWidth = parentBBox.width - 32;
146
- var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
147
+ var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ""));
147
148
  var index = Math.ceil(x / 130);
148
149
  var trueX = index * 130;
149
150
  var newX = Math.min(0, -(trueX - parentWidth));
@@ -160,7 +161,7 @@ export var HeaderTabs = withTheme(function (_ref) {
160
161
  var parentBBox = tabsDom.parentNode.getBoundingClientRect();
161
162
  var parentWidth = parentBBox.width - 32;
162
163
  var width = tabItems.length * 130;
163
- var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
164
+ var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ""));
164
165
  var index = Math.floor(x / 130);
165
166
  var trueX = index * 130;
166
167
  var newX = Math.max(-(width - parentWidth), -(trueX + parentWidth));
@@ -179,7 +180,7 @@ export var HeaderTabs = withTheme(function (_ref) {
179
180
  }));
180
181
  if (index === -1) return;
181
182
  var tabsDom = getTabsDom();
182
- var x = -+tabsDom.style.transform.replace(/[^\d.-]/g, '');
183
+ var x = -+tabsDom.style.transform.replace(/[^\d.-]/g, "");
183
184
  var bbox = {
184
185
  left: index * 130,
185
186
  right: (index + 1) * 130
@@ -210,7 +211,7 @@ export var HeaderTabs = withTheme(function (_ref) {
210
211
  };
211
212
 
212
213
  useEffect(function () {
213
- setSelectedKey(props.selectedKey || get(tabs, '0.key')); // const t = [{'code':'tagdata','enName':'tagdata','icon':'layer-color','menuName':'打标数据管理打标数据管理打标数据管理','path':'/orion/tag/datalist','key':'tagdata','name':'打标数据管理打标数据管理打标数据管理'},{'code':'taglist','enName':'taglist','icon':'home','menuName':'标签管理','path':'http://baidu.com/orion/tag/list','key':'taglist','name':'标签管理'},{'code':'relation1','enName':'dadicasesearch1','icon':'home','menuName':'案件检索1','path':'/orion/case/relation1','key':'relation1','name':'案件检索1'},{'code':'dadicasesearch-0','enName':'dadicasesearch','icon':'home','menuName':'案件检索-0','path':'/orion/case/relation0','key':'dadicasesearch-0','name':'案件检索-0'},{'code':'dadicasesearch-1','enName':'dadicasesearch','icon':'home','menuName':'案件检索-1','path':'/orion/case/relation1','key':'dadicasesearch-1','name':'案件检索-1'},{'code':'dadicasesearch-2','enName':'dadicasesearch','icon':'home','menuName':'案件检索-2','path':'/orion/case/relation2','key':'dadicasesearch-2','name':'案件检索-2'},{'code':'dadicasesearch-3','enName':'dadicasesearch','icon':'home','menuName':'案件检索-3','path':'/orion/case/relation3','key':'dadicasesearch-3','name':'案件检索-3'},{'code':'dadicasesearch-4','enName':'dadicasesearch','icon':'home','menuName':'案件检索-4','path':'/orion/case/relation4','key':'dadicasesearch-4','name':'案件检索-4'},{'code':'dadicasesearch-5','enName':'dadicasesearch','icon':'home','menuName':'案件检索-5','path':'/orion/case/relation5','key':'dadicasesearch-5','name':'案件检索-5'},{'code':'dadicasesearch-6','enName':'dadicasesearch','icon':'home','menuName':'案件检索-6','path':'/orion/case/relation6','key':'dadicasesearch-6','name':'案件检索-6'},{'code':'dadicasesearch-7','enName':'dadicasesearch','icon':'home','menuName':'案件检索-7','path':'/orion/case/relation7','key':'dadicasesearch-7','name':'案件检索-7'},{'code':'dadicasesearch-8','enName':'dadicasesearch','icon':'home','menuName':'案件检索-8','path':'/orion/case/relation8','key':'dadicasesearch-8','name':'案件检索-8'}] ;
214
+ setSelectedKey(props.selectedKey || get(tabs, "0.key")); // const t = [{'code':'tagdata','enName':'tagdata','icon':'layer-color','menuName':'打标数据管理打标数据管理打标数据管理','path':'/orion/tag/datalist','key':'tagdata','name':'打标数据管理打标数据管理打标数据管理'},{'code':'taglist','enName':'taglist','icon':'home','menuName':'标签管理','path':'http://baidu.com/orion/tag/list','key':'taglist','name':'标签管理'},{'code':'relation1','enName':'dadicasesearch1','icon':'home','menuName':'案件检索1','path':'/orion/case/relation1','key':'relation1','name':'案件检索1'},{'code':'dadicasesearch-0','enName':'dadicasesearch','icon':'home','menuName':'案件检索-0','path':'/orion/case/relation0','key':'dadicasesearch-0','name':'案件检索-0'},{'code':'dadicasesearch-1','enName':'dadicasesearch','icon':'home','menuName':'案件检索-1','path':'/orion/case/relation1','key':'dadicasesearch-1','name':'案件检索-1'},{'code':'dadicasesearch-2','enName':'dadicasesearch','icon':'home','menuName':'案件检索-2','path':'/orion/case/relation2','key':'dadicasesearch-2','name':'案件检索-2'},{'code':'dadicasesearch-3','enName':'dadicasesearch','icon':'home','menuName':'案件检索-3','path':'/orion/case/relation3','key':'dadicasesearch-3','name':'案件检索-3'},{'code':'dadicasesearch-4','enName':'dadicasesearch','icon':'home','menuName':'案件检索-4','path':'/orion/case/relation4','key':'dadicasesearch-4','name':'案件检索-4'},{'code':'dadicasesearch-5','enName':'dadicasesearch','icon':'home','menuName':'案件检索-5','path':'/orion/case/relation5','key':'dadicasesearch-5','name':'案件检索-5'},{'code':'dadicasesearch-6','enName':'dadicasesearch','icon':'home','menuName':'案件检索-6','path':'/orion/case/relation6','key':'dadicasesearch-6','name':'案件检索-6'},{'code':'dadicasesearch-7','enName':'dadicasesearch','icon':'home','menuName':'案件检索-7','path':'/orion/case/relation7','key':'dadicasesearch-7','name':'案件检索-7'},{'code':'dadicasesearch-8','enName':'dadicasesearch','icon':'home','menuName':'案件检索-8','path':'/orion/case/relation8','key':'dadicasesearch-8','name':'案件检索-8'}] ;
214
215
 
215
216
  setTabItems(tabs);
216
217
  }, [tabs, props.selectedKey]);
@@ -223,7 +224,7 @@ export var HeaderTabs = withTheme(function (_ref) {
223
224
  translateTabsDom(tabItems, selectedKey);
224
225
  }, [tabItems, selectedKey, appListVisible, orgListVisible, orgAppListVisible]);
225
226
  return React.createElement(TabsContainer, _extends({}, props, {
226
- className: cn('tnt-layout-header-tabs', _defineProperty({}, className, className))
227
+ className: cn("tnt-layout-header-tabs", _defineProperty({}, className, className))
227
228
  }), React.createElement(Tabs, {
228
229
  className: "tnt-layout-header-tabs-content",
229
230
  ref: tabsRef
@@ -245,7 +246,10 @@ export var HeaderTabs = withTheme(function (_ref) {
245
246
  onClick: function onClick(evt) {
246
247
  return evt.preventDefault();
247
248
  }
248
- }, tab.name), tabItems.length > 1 && React.createElement(Icon, {
249
+ }, {
250
+ cn: tab.name,
251
+ en: tab.enName || tab.name
252
+ }[language || "cn"]), tab.closable !== false && tabItems.length > 1 && React.createElement(Icon, {
249
253
  type: "close",
250
254
  onClick: closeTabHandle.bind(null, tab, index)
251
255
  }));
@@ -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
 
@@ -50,7 +50,7 @@ function _templateObject3() {
50
50
  }
51
51
 
52
52
  function _templateObject2() {
53
- var data = _taggedTemplateLiteral(["\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n text-align: left;\n height: 36px;\n line-height: 36px;\n flex: 1;\n white-space: nowrap;\n padding-right: 40px;\n transition: transform .25s linear;\n position:absolute;\n"]);
53
+ var data = _taggedTemplateLiteral(["\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n text-align: left;\n height: 36px;\n line-height: 36px;\n flex: 1;\n white-space: nowrap;\n padding-right: 40px;\n transition: transform 0.25s linear;\n position: absolute;\n"]);
54
54
 
55
55
  _templateObject2 = function _templateObject2() {
56
56
  return data;
@@ -78,7 +78,7 @@ var TabsContainer = _styledComponents["default"].div(_templateObject(), function
78
78
  var Tabs = _styledComponents["default"].ul(_templateObject2());
79
79
 
80
80
  var TabItem = _styledComponents["default"].li(_templateObject3(), function (props) {
81
- return props.theme.size === 'large' ? '46px' : '36px';
81
+ return props.theme.size === "large" ? "46px" : "36px";
82
82
  }, function (props) {
83
83
  return props.theme.headerActionsColor;
84
84
  }, function (props) {
@@ -100,9 +100,10 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
100
100
  appListVisible = _ref.appListVisible,
101
101
  orgListVisible = _ref.orgListVisible,
102
102
  orgAppListVisible = _ref.orgAppListVisible,
103
- props = _objectWithoutProperties(_ref, ["theme", "className", "tabs", "onTabChange", "onTabSelect", "onTabClose", "appListVisible", "orgListVisible", "orgAppListVisible"]);
103
+ language = _ref.language,
104
+ props = _objectWithoutProperties(_ref, ["theme", "className", "tabs", "onTabChange", "onTabSelect", "onTabClose", "appListVisible", "orgListVisible", "orgAppListVisible", "language"]);
104
105
 
105
- var _useState = (0, _react.useState)(props.selectedKey || (0, _lodash.get)(tabs, '0.key')),
106
+ var _useState = (0, _react.useState)(props.selectedKey || (0, _lodash.get)(tabs, "0.key")),
106
107
  _useState2 = _slicedToArray(_useState, 2),
107
108
  selectedKey = _useState2[0],
108
109
  setSelectedKey = _useState2[1];
@@ -166,7 +167,7 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
166
167
  var tabsDom = getTabsDom();
167
168
  var parentBBox = tabsDom.parentNode.getBoundingClientRect();
168
169
  var parentWidth = parentBBox.width - 32;
169
- var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
170
+ var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ""));
170
171
  var index = Math.ceil(x / 130);
171
172
  var trueX = index * 130;
172
173
  var newX = Math.min(0, -(trueX - parentWidth));
@@ -183,7 +184,7 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
183
184
  var parentBBox = tabsDom.parentNode.getBoundingClientRect();
184
185
  var parentWidth = parentBBox.width - 32;
185
186
  var width = tabItems.length * 130;
186
- var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
187
+ var x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ""));
187
188
  var index = Math.floor(x / 130);
188
189
  var trueX = index * 130;
189
190
  var newX = Math.max(-(width - parentWidth), -(trueX + parentWidth));
@@ -202,7 +203,7 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
202
203
  }));
203
204
  if (index === -1) return;
204
205
  var tabsDom = getTabsDom();
205
- var x = -+tabsDom.style.transform.replace(/[^\d.-]/g, '');
206
+ var x = -+tabsDom.style.transform.replace(/[^\d.-]/g, "");
206
207
  var bbox = {
207
208
  left: index * 130,
208
209
  right: (index + 1) * 130
@@ -233,7 +234,7 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
233
234
  };
234
235
 
235
236
  (0, _react.useEffect)(function () {
236
- setSelectedKey(props.selectedKey || (0, _lodash.get)(tabs, '0.key')); // const t = [{'code':'tagdata','enName':'tagdata','icon':'layer-color','menuName':'打标数据管理打标数据管理打标数据管理','path':'/orion/tag/datalist','key':'tagdata','name':'打标数据管理打标数据管理打标数据管理'},{'code':'taglist','enName':'taglist','icon':'home','menuName':'标签管理','path':'http://baidu.com/orion/tag/list','key':'taglist','name':'标签管理'},{'code':'relation1','enName':'dadicasesearch1','icon':'home','menuName':'案件检索1','path':'/orion/case/relation1','key':'relation1','name':'案件检索1'},{'code':'dadicasesearch-0','enName':'dadicasesearch','icon':'home','menuName':'案件检索-0','path':'/orion/case/relation0','key':'dadicasesearch-0','name':'案件检索-0'},{'code':'dadicasesearch-1','enName':'dadicasesearch','icon':'home','menuName':'案件检索-1','path':'/orion/case/relation1','key':'dadicasesearch-1','name':'案件检索-1'},{'code':'dadicasesearch-2','enName':'dadicasesearch','icon':'home','menuName':'案件检索-2','path':'/orion/case/relation2','key':'dadicasesearch-2','name':'案件检索-2'},{'code':'dadicasesearch-3','enName':'dadicasesearch','icon':'home','menuName':'案件检索-3','path':'/orion/case/relation3','key':'dadicasesearch-3','name':'案件检索-3'},{'code':'dadicasesearch-4','enName':'dadicasesearch','icon':'home','menuName':'案件检索-4','path':'/orion/case/relation4','key':'dadicasesearch-4','name':'案件检索-4'},{'code':'dadicasesearch-5','enName':'dadicasesearch','icon':'home','menuName':'案件检索-5','path':'/orion/case/relation5','key':'dadicasesearch-5','name':'案件检索-5'},{'code':'dadicasesearch-6','enName':'dadicasesearch','icon':'home','menuName':'案件检索-6','path':'/orion/case/relation6','key':'dadicasesearch-6','name':'案件检索-6'},{'code':'dadicasesearch-7','enName':'dadicasesearch','icon':'home','menuName':'案件检索-7','path':'/orion/case/relation7','key':'dadicasesearch-7','name':'案件检索-7'},{'code':'dadicasesearch-8','enName':'dadicasesearch','icon':'home','menuName':'案件检索-8','path':'/orion/case/relation8','key':'dadicasesearch-8','name':'案件检索-8'}] ;
237
+ setSelectedKey(props.selectedKey || (0, _lodash.get)(tabs, "0.key")); // const t = [{'code':'tagdata','enName':'tagdata','icon':'layer-color','menuName':'打标数据管理打标数据管理打标数据管理','path':'/orion/tag/datalist','key':'tagdata','name':'打标数据管理打标数据管理打标数据管理'},{'code':'taglist','enName':'taglist','icon':'home','menuName':'标签管理','path':'http://baidu.com/orion/tag/list','key':'taglist','name':'标签管理'},{'code':'relation1','enName':'dadicasesearch1','icon':'home','menuName':'案件检索1','path':'/orion/case/relation1','key':'relation1','name':'案件检索1'},{'code':'dadicasesearch-0','enName':'dadicasesearch','icon':'home','menuName':'案件检索-0','path':'/orion/case/relation0','key':'dadicasesearch-0','name':'案件检索-0'},{'code':'dadicasesearch-1','enName':'dadicasesearch','icon':'home','menuName':'案件检索-1','path':'/orion/case/relation1','key':'dadicasesearch-1','name':'案件检索-1'},{'code':'dadicasesearch-2','enName':'dadicasesearch','icon':'home','menuName':'案件检索-2','path':'/orion/case/relation2','key':'dadicasesearch-2','name':'案件检索-2'},{'code':'dadicasesearch-3','enName':'dadicasesearch','icon':'home','menuName':'案件检索-3','path':'/orion/case/relation3','key':'dadicasesearch-3','name':'案件检索-3'},{'code':'dadicasesearch-4','enName':'dadicasesearch','icon':'home','menuName':'案件检索-4','path':'/orion/case/relation4','key':'dadicasesearch-4','name':'案件检索-4'},{'code':'dadicasesearch-5','enName':'dadicasesearch','icon':'home','menuName':'案件检索-5','path':'/orion/case/relation5','key':'dadicasesearch-5','name':'案件检索-5'},{'code':'dadicasesearch-6','enName':'dadicasesearch','icon':'home','menuName':'案件检索-6','path':'/orion/case/relation6','key':'dadicasesearch-6','name':'案件检索-6'},{'code':'dadicasesearch-7','enName':'dadicasesearch','icon':'home','menuName':'案件检索-7','path':'/orion/case/relation7','key':'dadicasesearch-7','name':'案件检索-7'},{'code':'dadicasesearch-8','enName':'dadicasesearch','icon':'home','menuName':'案件检索-8','path':'/orion/case/relation8','key':'dadicasesearch-8','name':'案件检索-8'}] ;
237
238
 
238
239
  setTabItems(tabs);
239
240
  }, [tabs, props.selectedKey]);
@@ -246,7 +247,7 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
246
247
  translateTabsDom(tabItems, selectedKey);
247
248
  }, [tabItems, selectedKey, appListVisible, orgListVisible, orgAppListVisible]);
248
249
  return React.createElement(TabsContainer, _extends({}, props, {
249
- className: (0, _classnames["default"])('tnt-layout-header-tabs', _defineProperty({}, className, className))
250
+ className: (0, _classnames["default"])("tnt-layout-header-tabs", _defineProperty({}, className, className))
250
251
  }), React.createElement(Tabs, {
251
252
  className: "tnt-layout-header-tabs-content",
252
253
  ref: tabsRef
@@ -268,7 +269,10 @@ var HeaderTabs = (0, _styledComponents.withTheme)(function (_ref) {
268
269
  onClick: function onClick(evt) {
269
270
  return evt.preventDefault();
270
271
  }
271
- }, tab.name), tabItems.length > 1 && React.createElement(_Icon["default"], {
272
+ }, {
273
+ cn: tab.name,
274
+ en: tab.enName || tab.name
275
+ }[language || "cn"]), tab.closable !== false && tabItems.length > 1 && React.createElement(_Icon["default"], {
272
276
  type: "close",
273
277
  onClick: closeTabHandle.bind(null, tab, index)
274
278
  }));
@@ -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({