tntd 1.4.10 → 1.4.12

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/Ellipsis/index.js +2 -1
  2. package/components/Layout/AppList.js +1 -1
  3. package/components/Layout/GlobalNavigation/NavigationPopup.js +8 -8
  4. package/components/Layout/GlobalNavigation/index.js +2 -2
  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 +9768 -9522
  16. package/dist/tntd.js +1 -1
  17. package/es/Ellipsis/index.js +1 -1
  18. package/es/Layout/AppList.js +1 -1
  19. package/es/Layout/GlobalNavigation/NavigationPopup.js +1 -1
  20. package/es/Layout/GlobalNavigation/index.js +1 -1
  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/Ellipsis/index.js +1 -1
  32. package/lib/Layout/AppList.js +1 -1
  33. package/lib/Layout/EnterpriseLayout/Header.js +113 -0
  34. package/lib/Layout/EnterpriseLayout/HeaderActions.js +104 -0
  35. package/lib/Layout/GlobalNavigation/NavigationPopup.js +1 -1
  36. package/lib/Layout/GlobalNavigation/index.js +1 -1
  37. package/lib/Layout/OrgAppList.js +5 -6
  38. package/lib/Layout/SideMenu.js +1 -1
  39. package/lib/Layout/index.js +6 -6
  40. package/lib/Layout/paaslayout/CompactSideMenu.js +1 -1
  41. package/lib/Layout/paaslayout/index.js +1 -1
  42. package/lib/Layout/storage.js +1 -1
  43. package/lib/index.js +34 -0
  44. package/lib/utils/checkAuth.js +41 -0
  45. package/lib/utils/findMenuInfoByPath.js +52 -0
  46. package/lib/utils/index.js +159 -0
  47. package/package.json +1 -1
@@ -32,7 +32,7 @@ import './index.less';
32
32
  var tolerance = 0; // In px. Depends on the font you are using
33
33
 
34
34
  var isEllipsisActive = function isEllipsisActive(e) {
35
- return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
35
+ return e.getBoundingClientRect().width + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight; // return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
36
36
  };
37
37
 
38
38
  export default (function (props) {
@@ -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
+ };
@@ -44,7 +44,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
44
44
  var tolerance = 0; // In px. Depends on the font you are using
45
45
 
46
46
  var isEllipsisActive = function isEllipsisActive(e) {
47
- return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
47
+ return e.getBoundingClientRect().width + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight; // return e.offsetWidth + tolerance < e.scrollWidth || e.offsetHeight < e.scrollHeight;
48
48
  };
49
49
 
50
50
  var _default = function _default(props) {
@@ -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
 
@@ -0,0 +1,113 @@
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;
@@ -0,0 +1,104 @@
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;
@@ -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