tntd 1.3.64 → 1.4.0

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 (170) hide show
  1. package/.eslintignore +2 -1
  2. package/babel.config.js +12 -2
  3. package/dist/0645cf743e4e44ca9da321d689897f07.png +0 -0
  4. package/dist/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
  5. package/dist/1.tntd.js +12 -0
  6. package/dist/1d0b52448de217857b270af807e9360d.png +0 -0
  7. package/dist/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
  8. package/dist/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
  9. package/dist/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
  10. package/dist/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
  11. package/dist/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
  12. package/dist/4abe481e130d7be0574e45573de8beb7.png +0 -0
  13. package/dist/95ee2260a509cd630d89c5367ed1973b.png +0 -0
  14. package/dist/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
  15. package/dist/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
  16. package/dist/stats.json +45855 -0
  17. package/dist/tntd.css +1 -0
  18. package/dist/tntd.js +15 -0
  19. package/es/ArrayInput/README.md +129 -0
  20. package/es/ArrayInput/icon.js +24 -0
  21. package/es/ArrayInput/index.js +282 -0
  22. package/es/ArrayInput/index.less +20 -0
  23. package/es/AuthContext.js +4 -0
  24. package/es/Columns/README.md +149 -0
  25. package/es/Columns/index.js +86 -0
  26. package/es/Columns/index.less +75 -0
  27. package/es/DevelopmentLogin/LoginModal.js +126 -0
  28. package/es/DevelopmentLogin/README.md +49 -0
  29. package/es/DevelopmentLogin/index.js +40 -0
  30. package/es/Ellipsis/README.md +104 -0
  31. package/es/Ellipsis/Svg/CopySVG.js +63 -0
  32. package/es/Ellipsis/Svg/TickSVG.js +41 -0
  33. package/es/Ellipsis/index.js +143 -0
  34. package/es/Ellipsis/index.less +56 -0
  35. package/es/Handle/README.md +104 -0
  36. package/es/Handle/index.js +92 -0
  37. package/es/Handle/index.less +9 -0
  38. package/es/Icon/README.md +119 -0
  39. package/es/Icon/fonts/demo.css +539 -0
  40. package/es/Icon/fonts/demo_index.html +3345 -0
  41. package/es/Icon/fonts/iconfont.css +569 -0
  42. package/es/Icon/fonts/iconfont.eot +0 -0
  43. package/es/Icon/fonts/iconfont.js +41 -0
  44. package/es/Icon/fonts/iconfont.json +975 -0
  45. package/es/Icon/fonts/iconfont.svg +440 -0
  46. package/es/Icon/fonts/iconfont.ttf +0 -0
  47. package/es/Icon/fonts/iconfont.woff +0 -0
  48. package/es/Icon/fonts/iconfont.woff2 +0 -0
  49. package/es/Icon/iconList.js +1 -0
  50. package/es/Icon/index.js +26 -0
  51. package/es/Icon/index.less +9 -0
  52. package/es/Img/Contain.js +69 -0
  53. package/es/Img/Cover.js +126 -0
  54. package/es/Img/README.md +131 -0
  55. package/es/Img/index.js +76 -0
  56. package/es/Layout/ActionsContext.js +3 -0
  57. package/es/Layout/AppList.js +233 -0
  58. package/es/Layout/Application.js +115 -0
  59. package/es/Layout/Avatar.js +116 -0
  60. package/es/Layout/CompatibleLanguage.js +179 -0
  61. package/es/Layout/EnterpriseLayout/Avatar.js +144 -0
  62. package/es/Layout/EnterpriseLayout/Language.js +81 -0
  63. package/es/Layout/EnterpriseLayout/Theme.js +77 -0
  64. package/es/Layout/EnterpriseLayout/index.js +31 -0
  65. package/es/Layout/GlobalNavigation/NavigationPopup.js +396 -0
  66. package/es/Layout/GlobalNavigation/index.js +137 -0
  67. package/es/Layout/Header.js +95 -0
  68. package/es/Layout/HeaderActions.js +107 -0
  69. package/es/Layout/HeaderNavs.js +93 -0
  70. package/es/Layout/HeaderTabs.js +264 -0
  71. package/es/Layout/Iconfont.js +4 -0
  72. package/es/Layout/Language.js +81 -0
  73. package/es/Layout/Layout.js +234 -0
  74. package/es/Layout/Logo.js +86 -0
  75. package/es/Layout/OrgAppList.js +310 -0
  76. package/es/Layout/README.md +783 -0
  77. package/es/Layout/SideMenu.js +340 -0
  78. package/es/Layout/Theme.js +107 -0
  79. package/es/Layout/checkAuth.js +29 -0
  80. package/es/Layout/createActions.js +39 -0
  81. package/es/Layout/images/avatar/empty.png +0 -0
  82. package/es/Layout/images/avatar/female1.png +0 -0
  83. package/es/Layout/images/avatar/female2.png +0 -0
  84. package/es/Layout/images/avatar/female3.png +0 -0
  85. package/es/Layout/images/avatar/female4.png +0 -0
  86. package/es/Layout/images/avatar/female5.png +0 -0
  87. package/es/Layout/images/avatar/female6.png +0 -0
  88. package/es/Layout/images/avatar/male1.png +0 -0
  89. package/es/Layout/images/avatar/male2.png +0 -0
  90. package/es/Layout/images/avatar/male3.png +0 -0
  91. package/es/Layout/images/avatar/male4.png +0 -0
  92. package/es/Layout/images/avatar/male5.png +0 -0
  93. package/es/Layout/images/avatar/male6.png +0 -0
  94. package/es/Layout/images/index.js +35 -0
  95. package/es/Layout/images/logo/baldur.svg +14 -0
  96. package/es/Layout/images/logo/bi.svg +14 -0
  97. package/es/Layout/images/logo/bridge.svg +15 -0
  98. package/es/Layout/images/logo/convert.svg +18 -0
  99. package/es/Layout/images/logo/dataocean.svg +31 -0
  100. package/es/Layout/images/logo/default.svg +19 -0
  101. package/es/Layout/images/logo/dispatch.svg +14 -0
  102. package/es/Layout/images/logo/graph.svg +26 -0
  103. package/es/Layout/images/logo/handle.svg +10 -0
  104. package/es/Layout/images/logo/indicator.svg +41 -0
  105. package/es/Layout/images/logo/kafka.svg +12 -0
  106. package/es/Layout/images/logo/logo-custom.svg +13 -0
  107. package/es/Layout/images/logo/model.svg +17 -0
  108. package/es/Layout/images/logo/mysql.svg +15 -0
  109. package/es/Layout/images/logo/orion.svg +24 -0
  110. package/es/Layout/images/logo/salaxy.svg +11 -0
  111. package/es/Layout/images/logo/storage.svg +16 -0
  112. package/es/Layout/images/logo/tnt_cli_identify.svg +19 -0
  113. package/es/Layout/images/logo/turing.svg +35 -0
  114. package/es/Layout/images/theme/theme1.svg +35 -0
  115. package/es/Layout/images/theme/theme2.svg +33 -0
  116. package/es/Layout/index.js +122 -0
  117. package/es/Layout/paaslayout/CompactSideMenu.js +167 -0
  118. package/es/Layout/paaslayout/Header.js +77 -0
  119. package/es/Layout/paaslayout/Logo.js +22 -0
  120. package/es/Layout/paaslayout/SideMenu.js +168 -0
  121. package/es/Layout/paaslayout/index.js +235 -0
  122. package/es/Layout/storage.js +47 -0
  123. package/es/Layout/utils.js +136 -0
  124. package/es/LoadingButton/README.md +75 -0
  125. package/es/LoadingButton/index.js +45 -0
  126. package/es/Modal/README.md +59 -0
  127. package/es/Modal/index.js +96 -0
  128. package/es/Modal/index.less +86 -0
  129. package/es/Page/Box.js +74 -0
  130. package/es/Page/README.md +180 -0
  131. package/es/Page/index.js +165 -0
  132. package/es/Page/index.less +144 -0
  133. package/es/Page/utils.js +23 -0
  134. package/es/QueryForm/Field/Checkbox.js +21 -0
  135. package/es/QueryForm/Field/Select.js +80 -0
  136. package/es/QueryForm/Field/SelectInput.js +92 -0
  137. package/es/QueryForm/Field/fieldsMap.js +32 -0
  138. package/es/QueryForm/Field/index.js +157 -0
  139. package/es/QueryForm/README.md +512 -0
  140. package/es/QueryForm/createActions.js +53 -0
  141. package/es/QueryForm/index.js +384 -0
  142. package/es/QueryForm/index.less +133 -0
  143. package/es/QueryForm/useForm.js +7 -0
  144. package/es/QueryListScene/List.js +378 -0
  145. package/es/QueryListScene/QueryForm.js +166 -0
  146. package/es/QueryListScene/QueryListScene.js +76 -0
  147. package/es/QueryListScene/README.md +790 -0
  148. package/es/QueryListScene/Title.js +12 -0
  149. package/es/QueryListScene/Toolbar.js +20 -0
  150. package/es/QueryListScene/createActions.js +72 -0
  151. package/es/QueryListScene/index.js +19 -0
  152. package/es/QueryListScene/index.less +97 -0
  153. package/es/QueryListScene/useActions.js +7 -0
  154. package/es/Select/DropDownWrap.js +116 -0
  155. package/es/Select/README.md +68 -0
  156. package/es/Select/index.js +622 -0
  157. package/es/Table/README.md +109 -0
  158. package/es/Table/ResizableTable/index.js +110 -0
  159. package/es/Table/ResizableTable/index.less +36 -0
  160. package/es/Table/index.js +35 -0
  161. package/es/Title/README.md +106 -0
  162. package/es/Title/index.js +40 -0
  163. package/es/Title/index.less +170 -0
  164. package/es/index.js +19 -0
  165. package/es/locale.js +60 -0
  166. package/package.json +4 -1
  167. package/scripts/postbuild.sh +5 -0
  168. package/doc-scripts.config.js +0 -37
  169. package/doc-scripts.renderer.js +0 -11
  170. package/docs/README.md +0 -1643
@@ -0,0 +1,122 @@
1
+ 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); }
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ import { ThemeProvider } from 'styled-components';
8
+ import Layout from './Layout';
9
+ import EnterpriseLayout from './EnterpriseLayout';
10
+ import PaasLayout from './paaslayout';
11
+ import HeaderNavs from './HeaderNavs';
12
+ import HeaderTabs from './HeaderTabs';
13
+ import getCheckAuth from './checkAuth';
14
+ import AuthContext from '../AuthContext';
15
+ import { safeParseJSON, findMenuInfoByPath } from './utils';
16
+ import ActionsContext from './ActionsContext';
17
+ import createActions from './createActions';
18
+ import { getLanguageStore } from './storage';
19
+ export var HeaderActionItem = function HeaderActionItem(props) {
20
+ return React.createElement("li", props, props.children);
21
+ };
22
+ export * from './HeaderNavs';
23
+
24
+ var TNTLayout = function TNTLayout(_ref) {
25
+ var type = _ref.type,
26
+ config = _ref.config,
27
+ props = _objectWithoutProperties(_ref, ["type", "config"]);
28
+
29
+ var headerHeight = props.size === 'large' ? 60 : 50;
30
+ var theme = {
31
+ size: props.size,
32
+ compatible: props.compatible,
33
+ headerHeight: headerHeight,
34
+ primaryColor: '#126BFB',
35
+ secondaryColor: '#005df4',
36
+ primaryTextColor: '#17233D',
37
+ // 1
38
+ secondaryTextColor: 'rgba(23,35,61,.8)',
39
+ // .8
40
+ lightIconColor: 'rgba(23,35,61,.7)',
41
+ // .7
42
+ headerActionsColor: 'rgba(23,35,61,.6)',
43
+ // .6
44
+ borderColor: '#B2BECD',
45
+ dividerColor: '#E1E6EE',
46
+ lightBgColor: '#F1F2F5',
47
+ blueBgColor: '#1D4295' // 默认的蓝色主题
48
+
49
+ };
50
+ var isInIframe = self !== top; // 前期拼写错误,导致需要兼容处理
51
+
52
+ var extraHeaderActions = props.extraHeaderActions || props.extralHeaderActions;
53
+ var extendMap = typeof props.extendMap === 'string' ? safeParseJSON(props.extendMap, {}) : props.extendMap;
54
+
55
+ var _ref2 = extendMap || {},
56
+ _ref2$displayType = _ref2.displayType,
57
+ displayType = _ref2$displayType === void 0 ? 'default' : _ref2$displayType,
58
+ menuAlignMode = _ref2.menuAlignMode,
59
+ _ref2$globalNavigatio = _ref2.globalNavigation,
60
+ globalNavigation = _ref2$globalNavigatio === void 0 ? false : _ref2$globalNavigatio,
61
+ _ref2$language = _ref2.language,
62
+ language = _ref2$language === void 0 ? ['cn'] : _ref2$language,
63
+ _ref2$themeSwitch = _ref2.themeSwitch,
64
+ themeSwitch = _ref2$themeSwitch === void 0 ? true : _ref2$themeSwitch;
65
+
66
+ var userInfo = props.userInfo || {};
67
+ var actionsContextValue = createActions({
68
+ language: getLanguageStore() || userInfo.lang || 'cn'
69
+ });
70
+
71
+ var onLanguageChange = function onLanguageChange(language) {
72
+ actionsContextValue.setLanguage(language);
73
+ props == null ? void 0 : props.onLanguageChange(language);
74
+ }; // layout上的指定的属性优先级会高于extendMap中的属性
75
+
76
+
77
+ type = type || displayType;
78
+ config = Object.assign({
79
+ language: (language == null ? void 0 : language.length) > 1,
80
+ theme: themeSwitch,
81
+ avatar: true,
82
+ globalNavigation: globalNavigation
83
+ }, config);
84
+ return React.createElement(ThemeProvider, {
85
+ theme: theme
86
+ }, React.createElement(AuthContext.Provider, {
87
+ value: getCheckAuth(props.menus)
88
+ }, React.createElement(ActionsContext.Provider, {
89
+ value: actionsContextValue
90
+ }, type === 'paas' && React.createElement(PaasLayout, _extends({
91
+ menuAlignMode: menuAlignMode,
92
+ config: config
93
+ }, props, {
94
+ extraHeaderActions: extraHeaderActions,
95
+ isInIframe: isInIframe,
96
+ userInfo: userInfo,
97
+ onLanguageChange: onLanguageChange
98
+ })), type === 'enterprise' && React.createElement(EnterpriseLayout, _extends({
99
+ menuAlignMode: menuAlignMode,
100
+ config: config
101
+ }, props, {
102
+ extraHeaderActions: extraHeaderActions,
103
+ isInIframe: isInIframe,
104
+ userInfo: userInfo,
105
+ onLanguageChange: onLanguageChange
106
+ })), (!type || !['paas', 'enterprise'].includes(type)) && React.createElement(Layout, _extends({
107
+ menuAlignMode: menuAlignMode,
108
+ config: config
109
+ }, props, {
110
+ extraHeaderActions: extraHeaderActions,
111
+ isInIframe: isInIframe,
112
+ userInfo: userInfo,
113
+ onLanguageChange: onLanguageChange
114
+ })))));
115
+ };
116
+
117
+ TNTLayout.HeaderActionItem = HeaderActionItem;
118
+ TNTLayout.HeaderNavs = HeaderNavs;
119
+ TNTLayout.HeaderTabs = HeaderTabs;
120
+ TNTLayout.AuthContext = AuthContext;
121
+ TNTLayout.findMenuInfoByPath = findMenuInfoByPath;
122
+ export default TNTLayout;
@@ -0,0 +1,167 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
4
+
5
+ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
6
+
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+
9
+ function _templateObject2() {
10
+ var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n font-size: 14px;\n color: #17233D;\n margin: 10px 0 0;\n padding: 0;\n li {\n position: relative;\n line-height: 38px;\n cursor: pointer;\n padding-left: 20px;\n & > a {\n color: #17233D;\n & > span {\n padding-left: 10px;\n }\n }\n &.active {\n background: #EAEDF8;\n &:before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n width: 4px;\n height: 100%;\n background-color: #4C79FF;\n }\n }\n }\n"]);
11
+
12
+ _templateObject2 = function _templateObject2() {
13
+ return data;
14
+ };
15
+
16
+ return data;
17
+ }
18
+
19
+ function _templateObject() {
20
+ var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n margin: 0;\n padding: 30px 0 20px;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n .isInIframe & {\n display: none;\n }\n \n & > li {\n position: relative;\n cursor: pointer;\n line-height: 38px;\n font-size: 14px;\n color: #17233D;\n letter-spacing: 0;\n\n &.group-menu-item {\n & > span {\n opacity: 0.4;\n }\n }\n\n &.active {\n &:before {\n position: absolute;\n content: \"\";\n left: 0;\n top: 0;\n width: 3px;\n height: 100%;\n background: #126bfb;\n }\n\n span {\n background: rgba(18,107,251,0.10);\n color: #126bfb;\n opacity: 1;\n }\n }\n\n & > span {\n display: inline-block;\n width: 100%;\n color: #17233D;\n padding-left: 20px;\n\n &:hover {\n color: #323232;\n background: #f5f5f5;\n }\n\n & > .tnt-icon {\n margin-right: 7px;\n }\n }\n }\n"]);
21
+
22
+ _templateObject = function _templateObject() {
23
+ return data;
24
+ };
25
+
26
+ return data;
27
+ }
28
+
29
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
30
+
31
+ import { useState, useEffect, Component } from 'react';
32
+ import styled from 'styled-components';
33
+ import cn from 'classnames';
34
+ import { isNewTabMenu, openInNewTab } from '../utils';
35
+ import Iconfont from '../Iconfont';
36
+ var SideMenu = styled.ul(_templateObject());
37
+ var SubMenu = styled.ul(_templateObject2());
38
+ export default (function (props) {
39
+ var language = props.language,
40
+ _props$menus = props.menus,
41
+ menus = _props$menus === void 0 ? [] : _props$menus,
42
+ formatMenuPath = props.formatMenuPath,
43
+ selectedKey = props.selectedKey,
44
+ onBeforeChange = props.onBeforeChange,
45
+ onChange = props.onChange,
46
+ onSelect = props.onSelect;
47
+
48
+ var _useState = useState(selectedKey),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ activeMenu = _useState2[0],
51
+ setActiveMenu = _useState2[1];
52
+
53
+ var defaultBeforeChange = function defaultBeforeChange(_ref) {
54
+ var data = _ref.data;
55
+ return !isNewTabMenu(data);
56
+ };
57
+
58
+ var defaultSelect = function defaultSelect(_ref2) {
59
+ var _window$location$path;
60
+
61
+ var data = _ref2.data;
62
+
63
+ var _ref3 = data || {},
64
+ path = _ref3.path;
65
+
66
+ var formatPath = formatMenuPath || function (path) {
67
+ return path;
68
+ };
69
+
70
+ if (isNewTabMenu(data)) {
71
+ openInNewTab(formatPath(data == null ? void 0 : data.path, data));
72
+ return;
73
+ }
74
+
75
+ var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
76
+
77
+ if (window.location.pathname.startsWith(routerPrefix)) {
78
+ var forwardPath = formatPath(path, data);
79
+ changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
80
+ } else {
81
+ window.location.href = formatPath(path, data);
82
+ }
83
+ };
84
+
85
+ var selectMenu = function selectMenu() {
86
+ var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87
+ var finalBeforeChange = onBeforeChange || defaultBeforeChange;
88
+ var finalSelect = onSelect || defaultSelect;
89
+
90
+ if (param.key !== activeMenu) {
91
+ if (finalBeforeChange(param, activeMenu)) {
92
+ setActiveMenu(param.key);
93
+ onChange && onChange(param);
94
+ }
95
+ }
96
+
97
+ finalSelect(param);
98
+ };
99
+
100
+ var MenuItem = function MenuItem(_ref4) {
101
+ var item = _ref4.item;
102
+ var code = item.code,
103
+ groupName = item.groupName,
104
+ enName = item.enName,
105
+ _item$children = item.children,
106
+ children = _item$children === void 0 ? [] : _item$children;
107
+
108
+ var SubMenuItem = function SubMenuItem(_ref5) {
109
+ var menu = _ref5.menu;
110
+ var code = menu.code,
111
+ menuName = menu.menuName,
112
+ enName = menu.enName,
113
+ icon = menu.icon;
114
+ return React.createElement("li", {
115
+ key: code,
116
+ onClick: function onClick(evt) {
117
+ return selectMenu({
118
+ key: code,
119
+ data: menu,
120
+ domEvent: evt
121
+ });
122
+ },
123
+ className: cn({
124
+ active: code === activeMenu
125
+ })
126
+ }, React.createElement("span", null, typeof (icon || '') === 'string' ? React.createElement(Iconfont, {
127
+ type: icon
128
+ }) : icon, {
129
+ cn: menuName,
130
+ en: enName
131
+ }[language]));
132
+ };
133
+
134
+ if (groupName && children.length) {
135
+ return React.createElement("li", {
136
+ key: code,
137
+ className: "group-menu-item"
138
+ }, React.createElement("span", null, icon instanceof Component ? icon : React.createElement(Iconfont, {
139
+ type: icon
140
+ }), {
141
+ cn: groupName,
142
+ en: enName
143
+ }[language]), React.createElement(SubMenu, null, children.map(function (subItem) {
144
+ return React.createElement(SubMenuItem, {
145
+ menu: subItem,
146
+ key: subItem == null ? void 0 : subItem.code
147
+ });
148
+ })));
149
+ }
150
+
151
+ return React.createElement(SubMenuItem, {
152
+ menu: item
153
+ });
154
+ };
155
+
156
+ useEffect(function () {
157
+ setActiveMenu(selectedKey);
158
+ }, [selectedKey]);
159
+ return React.createElement(SideMenu, {
160
+ className: "tnt-compact-sidemenu"
161
+ }, menus.map(function (menu) {
162
+ return React.createElement(MenuItem, {
163
+ item: menu,
164
+ key: menu.code
165
+ });
166
+ }));
167
+ });
@@ -0,0 +1,77 @@
1
+ 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); }
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+
7
+ 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; }
8
+
9
+ function _templateObject2() {
10
+ var data = _taggedTemplateLiteral(["\n flex: 1;\n .isInIframe & {\n display: none;\n }\n"]);
11
+
12
+ _templateObject2 = function _templateObject2() {
13
+ return data;
14
+ };
15
+
16
+ return data;
17
+ }
18
+
19
+ function _templateObject() {
20
+ var data = _taggedTemplateLiteral(["\n position: sticky;\n top: 0;\n height: ", ";\n display: flex;\n color: #fff;\n background: #fff;\n z-index: 201;\n .isInIframe.noAppList &,\n .isEmptyLayout & {\n display: none;\n }\n .tnt-themeS1 & {\n background: #323b4a;\n }\n padding-right: 20px;\n box-shadow: 0 1px 10px 0 rgba(0,0,0,0.1);\n transition: box-shadow .2s cubic-bezier(.4,0,.2,1), -webkit-box-shadow .2s cubic-bezier(.4,0,.2,1);\n\n .paas-header-actions {\n li {\n .tnt-themeS1 & {\n color: rgba(255,255,255,.85);\n }\n }\n }\n"]);
21
+
22
+ _templateObject = function _templateObject() {
23
+ return data;
24
+ };
25
+
26
+ return data;
27
+ }
28
+
29
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
30
+
31
+ /**
32
+ * @file Layout header
33
+ * @author zhangyou
34
+ */
35
+ import { useRef } from 'react';
36
+ import styled from 'styled-components';
37
+ import Actions from '../HeaderActions';
38
+ import AppList from '../AppList';
39
+ import Logo from './Logo';
40
+ var Header = styled.div(_templateObject(), function (props) {
41
+ return "".concat(props.theme.headerHeight, "px");
42
+ });
43
+ var Content = styled.div(_templateObject2());
44
+ export default (function (props) {
45
+ var logo = props.logo,
46
+ name = props.name,
47
+ enName = props.enName,
48
+ language = props.language,
49
+ selectedAppKey = props.selectedAppKey,
50
+ appList = props.appList,
51
+ onLogoClick = props.onLogoClick,
52
+ onAppChange = props.onAppChange,
53
+ extraActions = props.extraActions;
54
+
55
+ var config = _objectSpread({
56
+ application: true
57
+ }, props.config);
58
+
59
+ var headerRef = useRef();
60
+ return React.createElement(Header, {
61
+ ref: headerRef
62
+ }, React.createElement(Logo, {
63
+ language: language,
64
+ logo: logo,
65
+ name: name,
66
+ enName: enName,
67
+ onClick: onLogoClick
68
+ }), appList && React.createElement(AppList, {
69
+ items: appList,
70
+ selectedKey: selectedAppKey,
71
+ onChange: onAppChange
72
+ }), React.createElement(Content, null, props.children), React.createElement(Actions, _extends({}, props, {
73
+ config: config,
74
+ headerRef: headerRef,
75
+ className: "paas-header-actions"
76
+ }), extraActions));
77
+ });
@@ -0,0 +1,22 @@
1
+ function _templateObject() {
2
+ var data = _taggedTemplateLiteral(["\n color: #17233d !important;\n letter-spacing: 0;\n background: #fff !important;\n box-shadow: none !important;\n .isInIframe & {\n display: none;\n }\n\n &:after {\n display: none;\n }\n\n .tnt-themeS1 & {\n color: rgba(255,255,255,.85) !important;\n background: #323b4a !important;\n }\n"]);
3
+
4
+ _templateObject = function _templateObject() {
5
+ return data;
6
+ };
7
+
8
+ return data;
9
+ }
10
+
11
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
+
13
+ /**
14
+ * @file Logo
15
+ * @author zhangyou
16
+ */
17
+ import styled from 'styled-components';
18
+ import Logo from '../Logo';
19
+ var LogoWrapper = styled(Logo)(_templateObject());
20
+ export default (function (props) {
21
+ return React.createElement(LogoWrapper, props);
22
+ });
@@ -0,0 +1,168 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
4
+
5
+ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
6
+
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+
9
+ function _templateObject2() {
10
+ var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n font-size: 14px;\n color: #17233D;\n margin: 10px 0 0;\n padding: 0;\n li {\n position: relative;\n line-height: 38px;\n cursor: pointer;\n padding-left: 20px;\n & > a {\n color: #17233D;\n & > span {\n padding-left: 10px;\n }\n }\n &.active {\n background: #EAEDF8;\n &:before {\n position: absolute;\n left: 0;\n top: 0;\n content: '';\n width: 4px;\n height: 100%;\n background-color: #4C79FF;\n }\n }\n }\n"]);
11
+
12
+ _templateObject2 = function _templateObject2() {
13
+ return data;
14
+ };
15
+
16
+ return data;
17
+ }
18
+
19
+ function _templateObject() {
20
+ var data = _taggedTemplateLiteral(["\n background: #fff;\n list-style: none;\n margin: 0;\n padding: 0;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n .isInIframe & {\n display: none;\n }\n \n & > li {\n font-size: 14px;\n letter-spacing: 0;\n margin-top: 20px;\n &:first-child {\n margin-top: 30px;\n }\n & > span {\n line-height: 38px;\n opacity: 0.4;\n display: inline-block;\n width: calc(100% - 20px);\n color: #17233D;\n border-bottom: 1px solid #B2BECD;\n margin-left: 20px;\n }\n }\n"]);
21
+
22
+ _templateObject = function _templateObject() {
23
+ return data;
24
+ };
25
+
26
+ return data;
27
+ }
28
+
29
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
30
+
31
+ import { useState, useEffect, Component } from 'react';
32
+ import styled from 'styled-components';
33
+ import cn from 'classnames';
34
+ import Iconfont from '../Iconfont';
35
+ var SideMenu = styled.ul(_templateObject());
36
+ var SubMenu = styled.ul(_templateObject2());
37
+ export default (function (props) {
38
+ var language = props.language,
39
+ _props$menus = props.menus,
40
+ menus = _props$menus === void 0 ? [] : _props$menus,
41
+ formatMenuPath = props.formatMenuPath,
42
+ changeRouter = props.changeRouter,
43
+ selectedKey = props.selectedKey,
44
+ onBeforeChange = props.onBeforeChange,
45
+ onChange = props.onChange,
46
+ onSelect = props.onSelect;
47
+
48
+ var _useState = useState(selectedKey),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ activeMenu = _useState2[0],
51
+ setActiveMenu = _useState2[1];
52
+
53
+ var defaultBeforeChange = function defaultBeforeChange(_ref) {
54
+ var data = _ref.data;
55
+ return !isNewTabMenu(data);
56
+ };
57
+
58
+ var defaultSelect = function defaultSelect(_ref2) {
59
+ var _window$location$path;
60
+
61
+ var data = _ref2.data;
62
+
63
+ var _ref3 = data || {},
64
+ path = _ref3.path;
65
+
66
+ var formatPath = formatMenuPath || function (path) {
67
+ return path;
68
+ };
69
+
70
+ if (isNewTabMenu(data)) {
71
+ openInNewTab(formatPath(data == null ? void 0 : data.path, data));
72
+ return;
73
+ }
74
+
75
+ var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
76
+
77
+ if (window.location.pathname.startsWith(routerPrefix)) {
78
+ var forwardPath = formatPath(path, data);
79
+ changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
80
+ } else {
81
+ window.location.href = formatPath(path, data);
82
+ }
83
+ };
84
+
85
+ var selectMenu = function selectMenu() {
86
+ var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87
+ var finalBeforeChange = onBeforeChange || defaultBeforeChange;
88
+ var finalSelect = onSelect || defaultSelect;
89
+
90
+ if (param.key !== activeMenu) {
91
+ if (finalBeforeChange(param, activeMenu)) {
92
+ setActiveMenu(param.key);
93
+ onChange && onChange(param);
94
+ }
95
+ }
96
+
97
+ finalSelect(param);
98
+ };
99
+
100
+ var MenuItem = function MenuItem(_ref4) {
101
+ var item = _ref4.item;
102
+ var code = item.code,
103
+ groupName = item.groupName,
104
+ enName = item.enName,
105
+ _item$children = item.children,
106
+ children = _item$children === void 0 ? [] : _item$children;
107
+
108
+ var SubMenuItem = function SubMenuItem(_ref5) {
109
+ var menu = _ref5.menu;
110
+ var code = menu.code,
111
+ menuName = menu.menuName,
112
+ enName = menu.enName,
113
+ icon = menu.icon,
114
+ path = menu.path;
115
+ return React.createElement("li", {
116
+ key: code,
117
+ onClick: function onClick(evt) {
118
+ return selectMenu({
119
+ key: code,
120
+ data: menu,
121
+ domEvent: evt
122
+ });
123
+ },
124
+ className: cn({
125
+ active: code === activeMenu
126
+ })
127
+ }, React.createElement("a", {
128
+ href: path,
129
+ onClick: function onClick(evt) {
130
+ return evt.preventDefault();
131
+ }
132
+ }, icon instanceof Component ? icon : React.createElement(Iconfont, {
133
+ type: icon
134
+ }), React.createElement("span", null, {
135
+ cn: menuName,
136
+ en: enName
137
+ }[language])));
138
+ };
139
+
140
+ if (groupName && children.length) {
141
+ return React.createElement("li", {
142
+ key: code
143
+ }, React.createElement("span", null, {
144
+ cn: groupName,
145
+ en: enName
146
+ }[language]), React.createElement(SubMenu, null, children.map(function (subItem) {
147
+ return React.createElement(SubMenuItem, {
148
+ menu: subItem,
149
+ key: subItem == null ? void 0 : subItem.code
150
+ });
151
+ })));
152
+ }
153
+
154
+ return React.createElement(SubMenuItem, {
155
+ menu: item
156
+ });
157
+ };
158
+
159
+ useEffect(function () {
160
+ setActiveMenu(selectedKey);
161
+ }, [selectedKey]);
162
+ return React.createElement(SideMenu, null, menus.map(function (menu) {
163
+ return React.createElement(MenuItem, {
164
+ item: menu,
165
+ key: menu.code
166
+ });
167
+ }));
168
+ });