tntd 1.4.20 → 1.4.21

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 (163) hide show
  1. package/components/Handle/README.md +0 -20
  2. package/components/Handle/index.js +27 -6
  3. package/components/locale.js +8 -2
  4. package/dist/1.tntd.js +1 -1
  5. package/dist/stats.json +23819 -24067
  6. package/dist/tntd.css +1 -1
  7. package/dist/tntd.js +13 -8
  8. package/es/ArrayInput/icon.js +5 -5
  9. package/es/ArrayInput/index.js +108 -76
  10. package/es/AuthContext.js +1 -1
  11. package/es/Columns/index.js +38 -31
  12. package/es/DevelopmentLogin/LoginModal.js +45 -32
  13. package/es/DevelopmentLogin/index.js +17 -13
  14. package/es/Ellipsis/Svg/CopySVG.js +13 -13
  15. package/es/Ellipsis/Svg/TickSVG.js +8 -8
  16. package/es/Ellipsis/index.js +69 -58
  17. package/es/Handle/README.md +0 -20
  18. package/es/Handle/index.js +67 -32
  19. package/es/Icon/fonts/iconfont.js +12 -7
  20. package/es/Icon/index.js +13 -10
  21. package/es/Img/Contain.js +29 -24
  22. package/es/Img/Cover.js +54 -40
  23. package/es/Img/index.js +45 -36
  24. package/es/Layout/ActionsContext.js +2 -3
  25. package/es/Layout/AppList.js +92 -37
  26. package/es/Layout/Application.js +72 -26
  27. package/es/Layout/Avatar.js +66 -29
  28. package/es/Layout/CompatibleLanguage.js +94 -39
  29. package/es/Layout/EnterpriseLayout/Avatar.js +76 -38
  30. package/es/Layout/EnterpriseLayout/Language.js +32 -14
  31. package/es/Layout/EnterpriseLayout/Theme.js +34 -16
  32. package/es/Layout/EnterpriseLayout/index.js +16 -14
  33. package/es/Layout/GlobalNavigation/NavigationPopup.js +170 -59
  34. package/es/Layout/GlobalNavigation/index.js +54 -20
  35. package/es/Layout/Header.js +46 -25
  36. package/es/Layout/HeaderActions.js +56 -42
  37. package/es/Layout/HeaderNavs.js +47 -20
  38. package/es/Layout/HeaderTabs.js +102 -49
  39. package/es/Layout/Iconfont.js +1 -1
  40. package/es/Layout/Language.js +32 -14
  41. package/es/Layout/Layout.js +108 -86
  42. package/es/Layout/Logo.js +32 -16
  43. package/es/Layout/OrgAppList.js +107 -62
  44. package/es/Layout/SideMenu.js +124 -63
  45. package/es/Layout/Theme.js +61 -23
  46. package/es/Layout/checkAuth.js +29 -0
  47. package/es/Layout/index.js +34 -26
  48. package/es/Layout/paaslayout/CompactSideMenu.js +74 -35
  49. package/es/Layout/paaslayout/Header.js +45 -22
  50. package/es/Layout/paaslayout/Logo.js +13 -3
  51. package/es/Layout/paaslayout/SideMenu.js +78 -39
  52. package/es/Layout/paaslayout/index.js +102 -75
  53. package/es/Layout/storage.js +9 -10
  54. package/es/Layout/utils.js +136 -0
  55. package/es/LoadingButton/index.js +24 -15
  56. package/es/Modal/index.js +46 -38
  57. package/es/Page/Box.js +41 -34
  58. package/es/Page/index.js +67 -52
  59. package/es/Page/utils.js +5 -0
  60. package/es/QueryForm/Field/Checkbox.js +9 -5
  61. package/es/QueryForm/Field/Select.js +41 -31
  62. package/es/QueryForm/Field/SelectInput.js +41 -26
  63. package/es/QueryForm/Field/fieldsMap.js +1 -0
  64. package/es/QueryForm/Field/index.js +71 -41
  65. package/es/QueryForm/createActions.js +7 -6
  66. package/es/QueryForm/index.js +135 -76
  67. package/es/QueryListScene/List.js +128 -74
  68. package/es/QueryListScene/QueryForm.js +81 -46
  69. package/es/QueryListScene/QueryListScene.js +40 -25
  70. package/es/QueryListScene/Title.js +3 -3
  71. package/es/QueryListScene/Toolbar.js +12 -11
  72. package/es/Select/DropDownWrap.js +50 -29
  73. package/es/Select/index.js +231 -135
  74. package/es/Table/ResizableTable/index.js +40 -26
  75. package/es/Table/index.js +16 -18
  76. package/es/Title/index.js +23 -21
  77. package/es/locale.js +11 -3
  78. package/es/utils/checkAuth.js +5 -3
  79. package/es/utils/findMenuInfoByPath.js +4 -0
  80. package/es/utils/index.js +23 -12
  81. package/lib/ArrayInput/icon.js +6 -6
  82. package/lib/ArrayInput/index.js +127 -78
  83. package/lib/AuthContext.js +4 -1
  84. package/lib/Columns/index.js +47 -31
  85. package/lib/DevelopmentLogin/LoginModal.js +58 -32
  86. package/lib/DevelopmentLogin/index.js +27 -16
  87. package/lib/Ellipsis/Svg/CopySVG.js +15 -13
  88. package/lib/Ellipsis/Svg/TickSVG.js +10 -8
  89. package/lib/Ellipsis/index.js +80 -57
  90. package/lib/Handle/README.md +0 -20
  91. package/lib/Handle/index.js +80 -32
  92. package/lib/Icon/fonts/iconfont.js +12 -7
  93. package/lib/Icon/index.js +20 -11
  94. package/lib/Img/Contain.js +34 -24
  95. package/lib/Img/Cover.js +65 -42
  96. package/lib/Img/index.js +51 -36
  97. package/lib/Layout/ActionsContext.js +4 -1
  98. package/lib/Layout/AppList.js +118 -40
  99. package/lib/Layout/Application.js +86 -26
  100. package/lib/Layout/Avatar.js +86 -32
  101. package/lib/Layout/CompatibleLanguage.js +110 -39
  102. package/lib/Layout/EnterpriseLayout/Avatar.js +100 -41
  103. package/lib/Layout/EnterpriseLayout/Header.js +113 -0
  104. package/lib/Layout/EnterpriseLayout/HeaderActions.js +104 -0
  105. package/lib/Layout/EnterpriseLayout/Language.js +48 -17
  106. package/lib/Layout/EnterpriseLayout/Theme.js +44 -16
  107. package/lib/Layout/EnterpriseLayout/index.js +23 -14
  108. package/lib/Layout/GlobalNavigation/NavigationPopup.js +186 -59
  109. package/lib/Layout/GlobalNavigation/index.js +74 -23
  110. package/lib/Layout/Header.js +63 -28
  111. package/lib/Layout/HeaderActions.js +74 -45
  112. package/lib/Layout/HeaderNavs.js +61 -23
  113. package/lib/Layout/HeaderTabs.js +118 -51
  114. package/lib/Layout/Iconfont.js +5 -1
  115. package/lib/Layout/Language.js +48 -17
  116. package/lib/Layout/Layout.js +128 -88
  117. package/lib/Layout/Logo.js +43 -19
  118. package/lib/Layout/OrgAppList.js +127 -64
  119. package/lib/Layout/SideMenu.js +143 -65
  120. package/lib/Layout/Theme.js +73 -23
  121. package/lib/Layout/checkAuth.js +39 -0
  122. package/lib/Layout/createActions.js +5 -0
  123. package/lib/Layout/images/index.js +28 -0
  124. package/lib/Layout/index.js +55 -30
  125. package/lib/Layout/paaslayout/CompactSideMenu.js +84 -35
  126. package/lib/Layout/paaslayout/Header.js +55 -22
  127. package/lib/Layout/paaslayout/Logo.js +19 -3
  128. package/lib/Layout/paaslayout/SideMenu.js +87 -39
  129. package/lib/Layout/paaslayout/index.js +122 -77
  130. package/lib/Layout/storage.js +40 -11
  131. package/lib/Layout/utils.js +166 -0
  132. package/lib/LoadingButton/index.js +29 -15
  133. package/lib/Modal/index.js +53 -38
  134. package/lib/Page/Box.js +45 -34
  135. package/lib/Page/index.js +77 -52
  136. package/lib/Page/utils.js +9 -1
  137. package/lib/QueryForm/Field/Checkbox.js +13 -5
  138. package/lib/QueryForm/Field/Select.js +53 -33
  139. package/lib/QueryForm/Field/SelectInput.js +56 -28
  140. package/lib/QueryForm/Field/fieldsMap.js +15 -1
  141. package/lib/QueryForm/Field/index.js +81 -43
  142. package/lib/QueryForm/createActions.js +12 -6
  143. package/lib/QueryForm/index.js +157 -78
  144. package/lib/QueryForm/useForm.js +5 -0
  145. package/lib/QueryListScene/List.js +140 -76
  146. package/lib/QueryListScene/QueryForm.js +86 -46
  147. package/lib/QueryListScene/QueryListScene.js +46 -25
  148. package/lib/QueryListScene/Title.js +7 -3
  149. package/lib/QueryListScene/Toolbar.js +16 -11
  150. package/lib/QueryListScene/createActions.js +5 -0
  151. package/lib/QueryListScene/index.js +10 -0
  152. package/lib/QueryListScene/useActions.js +5 -0
  153. package/lib/Select/DropDownWrap.js +56 -31
  154. package/lib/Select/index.js +241 -135
  155. package/lib/Table/ResizableTable/index.js +48 -26
  156. package/lib/Table/index.js +28 -17
  157. package/lib/Title/index.js +28 -21
  158. package/lib/index.js +56 -35
  159. package/lib/locale.js +19 -4
  160. package/lib/utils/checkAuth.js +9 -4
  161. package/lib/utils/findMenuInfoByPath.js +8 -1
  162. package/lib/utils/index.js +42 -15
  163. package/package.json +2 -2
@@ -1,7 +1,9 @@
1
- var _excluded = ["type", "config", "showMenuInIframe"];
2
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
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
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
+
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
+
5
7
  import { ThemeProvider } from 'styled-components';
6
8
  import Layout from './Layout';
7
9
  import EnterpriseLayout from './EnterpriseLayout';
@@ -14,15 +16,17 @@ import ActionsContext from './ActionsContext';
14
16
  import createActions from './createActions';
15
17
  import { getLanguageStore } from './storage';
16
18
  export var HeaderActionItem = function HeaderActionItem(props) {
17
- return /*#__PURE__*/React.createElement("li", props, props.children);
19
+ return React.createElement("li", props, props.children);
18
20
  };
19
21
  export * from './HeaderNavs';
22
+
20
23
  var TNTLayout = function TNTLayout(_ref) {
21
24
  var type = _ref.type,
22
- config = _ref.config,
23
- _ref$showMenuInIframe = _ref.showMenuInIframe,
24
- showMenuInIframe = _ref$showMenuInIframe === void 0 ? false : _ref$showMenuInIframe,
25
- props = _objectWithoutProperties(_ref, _excluded);
25
+ config = _ref.config,
26
+ _ref$showMenuInIframe = _ref.showMenuInIframe,
27
+ showMenuInIframe = _ref$showMenuInIframe === void 0 ? false : _ref$showMenuInIframe,
28
+ props = _objectWithoutProperties(_ref, ["type", "config", "showMenuInIframe"]);
29
+
26
30
  var headerHeight = props.size === 'large' ? 60 : 50;
27
31
  var theme = {
28
32
  size: props.size,
@@ -42,32 +46,35 @@ var TNTLayout = function TNTLayout(_ref) {
42
46
  dividerColor: '#E1E6EE',
43
47
  lightBgColor: '#F1F2F5',
44
48
  blueBgColor: '#1D4295' // 默认的蓝色主题
49
+
45
50
  };
51
+ var isInIframe = showMenuInIframe ? false : self !== top && !window.navigator.userAgent.includes('mo-fang-app'); // 前期拼写错误,导致需要兼容处理
46
52
 
47
- var isInIframe = showMenuInIframe ? false : self !== top && !window.navigator.userAgent.includes('mo-fang-app');
48
- // 前期拼写错误,导致需要兼容处理
49
53
  var extraHeaderActions = props.extraHeaderActions || props.extralHeaderActions;
50
54
  var extendMap = typeof props.extendMap === 'string' ? safeParseJSON(props.extendMap, {}) : props.extendMap;
55
+
51
56
  var _ref2 = extendMap || {},
52
- _ref2$displayType = _ref2.displayType,
53
- displayType = _ref2$displayType === void 0 ? 'default' : _ref2$displayType,
54
- menuAlignMode = _ref2.menuAlignMode,
55
- _ref2$globalNavigatio = _ref2.globalNavigation,
56
- globalNavigation = _ref2$globalNavigatio === void 0 ? false : _ref2$globalNavigatio,
57
- _ref2$language = _ref2.language,
58
- language = _ref2$language === void 0 ? ['cn'] : _ref2$language,
59
- _ref2$themeSwitch = _ref2.themeSwitch,
60
- themeSwitch = _ref2$themeSwitch === void 0 ? true : _ref2$themeSwitch;
57
+ _ref2$displayType = _ref2.displayType,
58
+ displayType = _ref2$displayType === void 0 ? 'default' : _ref2$displayType,
59
+ menuAlignMode = _ref2.menuAlignMode,
60
+ _ref2$globalNavigatio = _ref2.globalNavigation,
61
+ globalNavigation = _ref2$globalNavigatio === void 0 ? false : _ref2$globalNavigatio,
62
+ _ref2$language = _ref2.language,
63
+ language = _ref2$language === void 0 ? ['cn'] : _ref2$language,
64
+ _ref2$themeSwitch = _ref2.themeSwitch,
65
+ themeSwitch = _ref2$themeSwitch === void 0 ? true : _ref2$themeSwitch;
66
+
61
67
  var userInfo = props.userInfo || {};
62
68
  var actionsContextValue = createActions({
63
69
  language: getLanguageStore() || userInfo.lang || 'cn'
64
70
  });
71
+
65
72
  var onLanguageChange = function onLanguageChange(language) {
66
73
  actionsContextValue.setLanguage(language);
67
74
  props.onLanguageChange && props.onLanguageChange(language);
68
- };
75
+ }; // layout上的指定的属性优先级会高于extendMap中的属性
76
+
69
77
 
70
- // layout上的指定的属性优先级会高于extendMap中的属性
71
78
  type = type || displayType;
72
79
  config = Object.assign({
73
80
  language: (language == null ? void 0 : language.length) > 1,
@@ -75,13 +82,13 @@ var TNTLayout = function TNTLayout(_ref) {
75
82
  avatar: true,
76
83
  globalNavigation: globalNavigation
77
84
  }, config);
78
- return /*#__PURE__*/React.createElement(ThemeProvider, {
85
+ return React.createElement(ThemeProvider, {
79
86
  theme: theme
80
- }, /*#__PURE__*/React.createElement(AuthContext.Provider, {
87
+ }, React.createElement(AuthContext.Provider, {
81
88
  value: getCheckAuth(props.menus)
82
- }, /*#__PURE__*/React.createElement(ActionsContext.Provider, {
89
+ }, React.createElement(ActionsContext.Provider, {
83
90
  value: actionsContextValue
84
- }, type === 'paas' && /*#__PURE__*/React.createElement(PaasLayout, _extends({
91
+ }, type === 'paas' && React.createElement(PaasLayout, _extends({
85
92
  menuAlignMode: menuAlignMode,
86
93
  config: config
87
94
  }, props, {
@@ -89,7 +96,7 @@ var TNTLayout = function TNTLayout(_ref) {
89
96
  isInIframe: isInIframe,
90
97
  userInfo: userInfo,
91
98
  onLanguageChange: onLanguageChange
92
- })), type === 'enterprise' && /*#__PURE__*/React.createElement(EnterpriseLayout, _extends({
99
+ })), type === 'enterprise' && React.createElement(EnterpriseLayout, _extends({
93
100
  menuAlignMode: menuAlignMode,
94
101
  config: config
95
102
  }, props, {
@@ -98,7 +105,7 @@ var TNTLayout = function TNTLayout(_ref) {
98
105
  userInfo: userInfo,
99
106
  onLanguageChange: onLanguageChange,
100
107
  type: type
101
- })), (!type || !['paas', 'enterprise'].includes(type)) && /*#__PURE__*/React.createElement(Layout, _extends({
108
+ })), (!type || !['paas', 'enterprise'].includes(type)) && React.createElement(Layout, _extends({
102
109
  menuAlignMode: menuAlignMode,
103
110
  config: config
104
111
  }, props, {
@@ -108,6 +115,7 @@ var TNTLayout = function TNTLayout(_ref) {
108
115
  onLanguageChange: onLanguageChange
109
116
  })))));
110
117
  };
118
+
111
119
  TNTLayout.HeaderActionItem = HeaderActionItem;
112
120
  TNTLayout.HeaderNavs = HeaderNavs;
113
121
  TNTLayout.HeaderTabs = HeaderTabs;
@@ -1,48 +1,79 @@
1
- var _templateObject, _templateObject2;
2
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
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
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
+
8
29
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
30
+
9
31
  import { useState, useEffect, Component } from 'react';
10
32
  import styled from 'styled-components';
11
33
  import cn from 'classnames';
12
34
  import { isNewTabMenu, openInNewTab } from '../../utils';
13
35
  import Iconfont from '../Iconfont';
14
- var SideMenu = styled.ul(_templateObject || (_templateObject = _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"])));
15
- var SubMenu = styled.ul(_templateObject2 || (_templateObject2 = _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"])));
36
+ var SideMenu = styled.ul(_templateObject());
37
+ var SubMenu = styled.ul(_templateObject2());
16
38
  export default (function (props) {
17
39
  var language = props.language,
18
- _props$menus = props.menus,
19
- menus = _props$menus === void 0 ? [] : _props$menus,
20
- formatMenuPath = props.formatMenuPath,
21
- selectedKey = props.selectedKey,
22
- onBeforeChange = props.onBeforeChange,
23
- onChange = props.onChange,
24
- onSelect = props.onSelect;
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
+
25
48
  var _useState = useState(selectedKey),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- activeMenu = _useState2[0],
28
- setActiveMenu = _useState2[1];
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ activeMenu = _useState2[0],
51
+ setActiveMenu = _useState2[1];
52
+
29
53
  var defaultBeforeChange = function defaultBeforeChange(_ref) {
30
54
  var data = _ref.data;
31
55
  return !isNewTabMenu(data);
32
56
  };
57
+
33
58
  var defaultSelect = function defaultSelect(_ref2) {
34
59
  var _window$location$path;
60
+
35
61
  var data = _ref2.data;
62
+
36
63
  var _ref3 = data || {},
37
- path = _ref3.path;
64
+ path = _ref3.path;
65
+
38
66
  var formatPath = formatMenuPath || function (path) {
39
67
  return path;
40
68
  };
69
+
41
70
  if (isNewTabMenu(data)) {
42
71
  openInNewTab(formatPath(data == null ? void 0 : data.path, data));
43
72
  return;
44
73
  }
74
+
45
75
  var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
76
+
46
77
  if (window.location.pathname.startsWith(routerPrefix)) {
47
78
  var forwardPath = formatPath(path, data);
48
79
  changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
@@ -50,32 +81,37 @@ export default (function (props) {
50
81
  window.location.href = formatPath(path, data);
51
82
  }
52
83
  };
84
+
53
85
  var selectMenu = function selectMenu() {
54
86
  var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
55
87
  var finalBeforeChange = onBeforeChange || defaultBeforeChange;
56
88
  var finalSelect = onSelect || defaultSelect;
89
+
57
90
  if (param.key !== activeMenu) {
58
91
  if (finalBeforeChange(param, activeMenu)) {
59
92
  setActiveMenu(param.key);
60
93
  onChange && onChange(param);
61
94
  }
62
95
  }
96
+
63
97
  finalSelect(param);
64
98
  };
99
+
65
100
  var MenuItem = function MenuItem(_ref4) {
66
101
  var item = _ref4.item;
67
102
  var code = item.code,
68
- groupName = item.groupName,
69
- enName = item.enName,
70
- _item$children = item.children,
71
- children = _item$children === void 0 ? [] : _item$children;
103
+ groupName = item.groupName,
104
+ enName = item.enName,
105
+ _item$children = item.children,
106
+ children = _item$children === void 0 ? [] : _item$children;
107
+
72
108
  var SubMenuItem = function SubMenuItem(_ref5) {
73
109
  var menu = _ref5.menu;
74
110
  var code = menu.code,
75
- menuName = menu.menuName,
76
- enName = menu.enName,
77
- icon = menu.icon;
78
- return /*#__PURE__*/React.createElement("li", {
111
+ menuName = menu.menuName,
112
+ enName = menu.enName,
113
+ icon = menu.icon;
114
+ return React.createElement("li", {
79
115
  key: code,
80
116
  onClick: function onClick(evt) {
81
117
  return selectMenu({
@@ -87,40 +123,43 @@ export default (function (props) {
87
123
  className: cn({
88
124
  active: code === activeMenu
89
125
  })
90
- }, /*#__PURE__*/React.createElement("span", null, typeof (icon || '') === 'string' ? /*#__PURE__*/React.createElement(Iconfont, {
126
+ }, React.createElement("span", null, typeof (icon || '') === 'string' ? React.createElement(Iconfont, {
91
127
  type: icon
92
128
  }) : icon, {
93
129
  cn: menuName,
94
130
  en: enName
95
131
  }[language]));
96
132
  };
133
+
97
134
  if (groupName && children.length) {
98
- return /*#__PURE__*/React.createElement("li", {
135
+ return React.createElement("li", {
99
136
  key: code,
100
137
  className: "group-menu-item"
101
- }, /*#__PURE__*/React.createElement("span", null, icon instanceof Component ? icon : /*#__PURE__*/React.createElement(Iconfont, {
138
+ }, React.createElement("span", null, icon instanceof Component ? icon : React.createElement(Iconfont, {
102
139
  type: icon
103
140
  }), {
104
141
  cn: groupName,
105
142
  en: enName
106
- }[language]), /*#__PURE__*/React.createElement(SubMenu, null, children.map(function (subItem) {
107
- return /*#__PURE__*/React.createElement(SubMenuItem, {
143
+ }[language]), React.createElement(SubMenu, null, children.map(function (subItem) {
144
+ return React.createElement(SubMenuItem, {
108
145
  menu: subItem,
109
146
  key: subItem == null ? void 0 : subItem.code
110
147
  });
111
148
  })));
112
149
  }
113
- return /*#__PURE__*/React.createElement(SubMenuItem, {
150
+
151
+ return React.createElement(SubMenuItem, {
114
152
  menu: item
115
153
  });
116
154
  };
155
+
117
156
  useEffect(function () {
118
157
  setActiveMenu(selectedKey);
119
158
  }, [selectedKey]);
120
- return /*#__PURE__*/React.createElement(SideMenu, {
159
+ return React.createElement(SideMenu, {
121
160
  className: "tnt-compact-sidemenu"
122
161
  }, menus.map(function (menu) {
123
- return /*#__PURE__*/React.createElement(MenuItem, {
162
+ return React.createElement(MenuItem, {
124
163
  item: menu,
125
164
  key: menu.code
126
165
  });
@@ -1,12 +1,33 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _templateObject, _templateObject2;
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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
+
9
29
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
30
+
10
31
  /**
11
32
  * @file Layout header
12
33
  * @author zhangyou
@@ -16,37 +37,39 @@ import styled from 'styled-components';
16
37
  import Actions from '../HeaderActions';
17
38
  import AppList from '../AppList';
18
39
  import Logo from './Logo';
19
- var Header = styled.div(_templateObject || (_templateObject = _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"])), function (props) {
40
+ var Header = styled.div(_templateObject(), function (props) {
20
41
  return "".concat(props.theme.headerHeight, "px");
21
42
  });
22
- var Content = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1;\n .isInIframe & {\n display: none;\n }\n"])));
43
+ var Content = styled.div(_templateObject2());
23
44
  export default (function (props) {
24
45
  var logo = props.logo,
25
- name = props.name,
26
- enName = props.enName,
27
- language = props.language,
28
- selectedAppKey = props.selectedAppKey,
29
- appList = props.appList,
30
- onLogoClick = props.onLogoClick,
31
- onAppChange = props.onAppChange,
32
- extraActions = props.extraActions;
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
+
33
55
  var config = _objectSpread({
34
56
  application: true
35
57
  }, props.config);
58
+
36
59
  var headerRef = useRef();
37
- return /*#__PURE__*/React.createElement(Header, {
60
+ return React.createElement(Header, {
38
61
  ref: headerRef
39
- }, /*#__PURE__*/React.createElement(Logo, {
62
+ }, React.createElement(Logo, {
40
63
  language: language,
41
64
  logo: logo,
42
65
  name: name,
43
66
  enName: enName,
44
67
  onClick: onLogoClick
45
- }), appList && /*#__PURE__*/React.createElement(AppList, {
68
+ }), appList && React.createElement(AppList, {
46
69
  items: appList,
47
70
  selectedKey: selectedAppKey,
48
71
  onChange: onAppChange
49
- }), /*#__PURE__*/React.createElement(Content, null, props.children), /*#__PURE__*/React.createElement(Actions, _extends({}, props, {
72
+ }), React.createElement(Content, null, props.children), React.createElement(Actions, _extends({}, props, {
50
73
  config: config,
51
74
  headerRef: headerRef,
52
75
  className: "paas-header-actions"
@@ -1,12 +1,22 @@
1
- var _templateObject;
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
+
2
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
+
3
13
  /**
4
14
  * @file Logo
5
15
  * @author zhangyou
6
16
  */
7
17
  import styled from 'styled-components';
8
18
  import Logo from '../Logo';
9
- var LogoWrapper = styled(Logo)(_templateObject || (_templateObject = _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"])));
19
+ var LogoWrapper = styled(Logo)(_templateObject());
10
20
  export default (function (props) {
11
- return /*#__PURE__*/React.createElement(LogoWrapper, props);
21
+ return React.createElement(LogoWrapper, props);
12
22
  });