tntd 1.3.66 → 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 (167) hide show
  1. package/dist/0645cf743e4e44ca9da321d689897f07.png +0 -0
  2. package/dist/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
  3. package/dist/1.tntd.js +12 -0
  4. package/dist/1d0b52448de217857b270af807e9360d.png +0 -0
  5. package/dist/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
  6. package/dist/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
  7. package/dist/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
  8. package/dist/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
  9. package/dist/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
  10. package/dist/4abe481e130d7be0574e45573de8beb7.png +0 -0
  11. package/dist/95ee2260a509cd630d89c5367ed1973b.png +0 -0
  12. package/dist/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
  13. package/dist/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
  14. package/dist/stats.json +45855 -0
  15. package/dist/tntd.css +1 -0
  16. package/dist/tntd.js +15 -0
  17. package/es/ArrayInput/README.md +129 -0
  18. package/es/ArrayInput/icon.js +24 -0
  19. package/es/ArrayInput/index.js +282 -0
  20. package/es/ArrayInput/index.less +20 -0
  21. package/es/AuthContext.js +4 -0
  22. package/es/Columns/README.md +149 -0
  23. package/es/Columns/index.js +86 -0
  24. package/es/Columns/index.less +75 -0
  25. package/es/DevelopmentLogin/LoginModal.js +126 -0
  26. package/es/DevelopmentLogin/README.md +49 -0
  27. package/es/DevelopmentLogin/index.js +40 -0
  28. package/es/Ellipsis/README.md +104 -0
  29. package/es/Ellipsis/Svg/CopySVG.js +63 -0
  30. package/es/Ellipsis/Svg/TickSVG.js +41 -0
  31. package/es/Ellipsis/index.js +143 -0
  32. package/es/Ellipsis/index.less +56 -0
  33. package/es/Handle/README.md +104 -0
  34. package/es/Handle/index.js +92 -0
  35. package/es/Handle/index.less +9 -0
  36. package/es/Icon/README.md +119 -0
  37. package/es/Icon/fonts/demo.css +539 -0
  38. package/es/Icon/fonts/demo_index.html +3345 -0
  39. package/es/Icon/fonts/iconfont.css +569 -0
  40. package/es/Icon/fonts/iconfont.eot +0 -0
  41. package/es/Icon/fonts/iconfont.js +41 -0
  42. package/es/Icon/fonts/iconfont.json +975 -0
  43. package/es/Icon/fonts/iconfont.svg +440 -0
  44. package/es/Icon/fonts/iconfont.ttf +0 -0
  45. package/es/Icon/fonts/iconfont.woff +0 -0
  46. package/es/Icon/fonts/iconfont.woff2 +0 -0
  47. package/es/Icon/iconList.js +1 -0
  48. package/es/Icon/index.js +26 -0
  49. package/es/Icon/index.less +9 -0
  50. package/es/Img/Contain.js +69 -0
  51. package/es/Img/Cover.js +126 -0
  52. package/es/Img/README.md +131 -0
  53. package/es/Img/index.js +76 -0
  54. package/es/Layout/ActionsContext.js +3 -0
  55. package/es/Layout/AppList.js +233 -0
  56. package/es/Layout/Application.js +115 -0
  57. package/es/Layout/Avatar.js +116 -0
  58. package/es/Layout/CompatibleLanguage.js +179 -0
  59. package/es/Layout/EnterpriseLayout/Avatar.js +144 -0
  60. package/es/Layout/EnterpriseLayout/Language.js +81 -0
  61. package/es/Layout/EnterpriseLayout/Theme.js +77 -0
  62. package/es/Layout/EnterpriseLayout/index.js +31 -0
  63. package/es/Layout/GlobalNavigation/NavigationPopup.js +396 -0
  64. package/es/Layout/GlobalNavigation/index.js +137 -0
  65. package/es/Layout/Header.js +95 -0
  66. package/es/Layout/HeaderActions.js +107 -0
  67. package/es/Layout/HeaderNavs.js +93 -0
  68. package/es/Layout/HeaderTabs.js +264 -0
  69. package/es/Layout/Iconfont.js +4 -0
  70. package/es/Layout/Language.js +81 -0
  71. package/es/Layout/Layout.js +234 -0
  72. package/es/Layout/Logo.js +86 -0
  73. package/es/Layout/OrgAppList.js +310 -0
  74. package/es/Layout/README.md +783 -0
  75. package/es/Layout/SideMenu.js +340 -0
  76. package/es/Layout/Theme.js +107 -0
  77. package/es/Layout/checkAuth.js +29 -0
  78. package/es/Layout/createActions.js +39 -0
  79. package/es/Layout/images/avatar/empty.png +0 -0
  80. package/es/Layout/images/avatar/female1.png +0 -0
  81. package/es/Layout/images/avatar/female2.png +0 -0
  82. package/es/Layout/images/avatar/female3.png +0 -0
  83. package/es/Layout/images/avatar/female4.png +0 -0
  84. package/es/Layout/images/avatar/female5.png +0 -0
  85. package/es/Layout/images/avatar/female6.png +0 -0
  86. package/es/Layout/images/avatar/male1.png +0 -0
  87. package/es/Layout/images/avatar/male2.png +0 -0
  88. package/es/Layout/images/avatar/male3.png +0 -0
  89. package/es/Layout/images/avatar/male4.png +0 -0
  90. package/es/Layout/images/avatar/male5.png +0 -0
  91. package/es/Layout/images/avatar/male6.png +0 -0
  92. package/es/Layout/images/index.js +35 -0
  93. package/es/Layout/images/logo/baldur.svg +14 -0
  94. package/es/Layout/images/logo/bi.svg +14 -0
  95. package/es/Layout/images/logo/bridge.svg +15 -0
  96. package/es/Layout/images/logo/convert.svg +18 -0
  97. package/es/Layout/images/logo/dataocean.svg +31 -0
  98. package/es/Layout/images/logo/default.svg +19 -0
  99. package/es/Layout/images/logo/dispatch.svg +14 -0
  100. package/es/Layout/images/logo/graph.svg +26 -0
  101. package/es/Layout/images/logo/handle.svg +10 -0
  102. package/es/Layout/images/logo/indicator.svg +41 -0
  103. package/es/Layout/images/logo/kafka.svg +12 -0
  104. package/es/Layout/images/logo/logo-custom.svg +13 -0
  105. package/es/Layout/images/logo/model.svg +17 -0
  106. package/es/Layout/images/logo/mysql.svg +15 -0
  107. package/es/Layout/images/logo/orion.svg +24 -0
  108. package/es/Layout/images/logo/salaxy.svg +11 -0
  109. package/es/Layout/images/logo/storage.svg +16 -0
  110. package/es/Layout/images/logo/tnt_cli_identify.svg +19 -0
  111. package/es/Layout/images/logo/turing.svg +35 -0
  112. package/es/Layout/images/theme/theme1.svg +35 -0
  113. package/es/Layout/images/theme/theme2.svg +33 -0
  114. package/es/Layout/index.js +122 -0
  115. package/es/Layout/paaslayout/CompactSideMenu.js +167 -0
  116. package/es/Layout/paaslayout/Header.js +77 -0
  117. package/es/Layout/paaslayout/Logo.js +22 -0
  118. package/es/Layout/paaslayout/SideMenu.js +168 -0
  119. package/es/Layout/paaslayout/index.js +235 -0
  120. package/es/Layout/storage.js +47 -0
  121. package/es/Layout/utils.js +136 -0
  122. package/es/LoadingButton/README.md +75 -0
  123. package/es/LoadingButton/index.js +45 -0
  124. package/es/Modal/README.md +59 -0
  125. package/es/Modal/index.js +96 -0
  126. package/es/Modal/index.less +86 -0
  127. package/es/Page/Box.js +74 -0
  128. package/es/Page/README.md +180 -0
  129. package/es/Page/index.js +165 -0
  130. package/es/Page/index.less +144 -0
  131. package/es/Page/utils.js +23 -0
  132. package/es/QueryForm/Field/Checkbox.js +21 -0
  133. package/es/QueryForm/Field/Select.js +80 -0
  134. package/es/QueryForm/Field/SelectInput.js +92 -0
  135. package/es/QueryForm/Field/fieldsMap.js +32 -0
  136. package/es/QueryForm/Field/index.js +157 -0
  137. package/es/QueryForm/README.md +512 -0
  138. package/es/QueryForm/createActions.js +53 -0
  139. package/es/QueryForm/index.js +384 -0
  140. package/es/QueryForm/index.less +133 -0
  141. package/es/QueryForm/useForm.js +7 -0
  142. package/es/QueryListScene/List.js +378 -0
  143. package/es/QueryListScene/QueryForm.js +166 -0
  144. package/es/QueryListScene/QueryListScene.js +76 -0
  145. package/es/QueryListScene/README.md +790 -0
  146. package/es/QueryListScene/Title.js +12 -0
  147. package/es/QueryListScene/Toolbar.js +20 -0
  148. package/es/QueryListScene/createActions.js +72 -0
  149. package/es/QueryListScene/index.js +19 -0
  150. package/es/QueryListScene/index.less +97 -0
  151. package/es/QueryListScene/useActions.js +7 -0
  152. package/es/Select/DropDownWrap.js +116 -0
  153. package/es/Select/README.md +68 -0
  154. package/es/Select/index.js +622 -0
  155. package/es/Table/README.md +109 -0
  156. package/es/Table/ResizableTable/index.js +110 -0
  157. package/es/Table/ResizableTable/index.less +36 -0
  158. package/es/Table/index.js +35 -0
  159. package/es/Title/README.md +106 -0
  160. package/es/Title/index.js +40 -0
  161. package/es/Title/index.less +170 -0
  162. package/es/index.js +19 -0
  163. package/es/locale.js +60 -0
  164. package/package.json +1 -1
  165. package/doc-scripts.config.js +0 -37
  166. package/doc-scripts.renderer.js +0 -11
  167. package/docs/README.md +0 -1643
@@ -0,0 +1,396 @@
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 _templateObject7() {
10
+ var data = _taggedTemplateLiteral(["\n background: #fff;\n max-height: 320px;\n overflow-y: auto;\n margin: 0;\n padding: 6px 0;\n list-style: none;\n font-size: 13px;\n position: absolute;\n top: 29px;\n width: 100%;\n box-shadow: 0 3px 6px -4px rgba(0,0,0,.12), 0 6px 16px 0 rgba(0,0,0,.08), 0 9px 28px 8px rgba(0,0,0,.05);\n li {\n cursor: pointer;\n line-height: 32px;\n padding: 0 10px;\n color: ", ";\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n }\n"]);
11
+
12
+ _templateObject7 = function _templateObject7() {
13
+ return data;
14
+ };
15
+
16
+ return data;
17
+ }
18
+
19
+ function _templateObject6() {
20
+ var data = _taggedTemplateLiteral(["\n display: block;\n line-height: 30px;\n font-size: 12px;\n cursor: pointer;\n a {\n color: ", ";\n &:hover {\n color: ", " !important;\n }\n }\n &.active a {\n color: ", ";\n }\n"]);
21
+
22
+ _templateObject6 = function _templateObject6() {
23
+ return data;
24
+ };
25
+
26
+ return data;
27
+ }
28
+
29
+ function _templateObject5() {
30
+ var data = _taggedTemplateLiteral(["\n list-style: none;\n padding: 0;\n margin: 0;\n"]);
31
+
32
+ _templateObject5 = function _templateObject5() {
33
+ return data;
34
+ };
35
+
36
+ return data;
37
+ }
38
+
39
+ function _templateObject4() {
40
+ var data = _taggedTemplateLiteral(["\n margin-bottom: 20px;\n & > h5 {\n line-height: 20px;\n margin: 0;\n margin-bottom: 6px;\n }\n"]);
41
+
42
+ _templateObject4 = function _templateObject4() {
43
+ return data;
44
+ };
45
+
46
+ return data;
47
+ }
48
+
49
+ function _templateObject3() {
50
+ var data = _taggedTemplateLiteral(["\n height: ", ";\n overflow: auto;\n & > div {\n width: 200px;\n margin-right: 10px;\n display: inline-block;\n vertical-align: top;\n }\n"]);
51
+
52
+ _templateObject3 = function _templateObject3() {
53
+ return data;
54
+ };
55
+
56
+ return data;
57
+ }
58
+
59
+ function _templateObject2() {
60
+ var data = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n color: ", ";\n line-height: 32px;\n margin: 0 0 16px;\n padding: 0;\n display: inline-block;\n\n & > li {\n padding: 0 20px;\n display: inline-block;\n cursor: pointer;\n &:not(:last-child) {\n border-right: 1px solid ", ";\n }\n &.active {\n background-color: ", ";\n color: #fff;\n }\n }\n"]);
61
+
62
+ _templateObject2 = function _templateObject2() {
63
+ return data;
64
+ };
65
+
66
+ return data;
67
+ }
68
+
69
+ function _templateObject() {
70
+ var data = _taggedTemplateLiteral(["\n position: relative;\n font-size: 14px;\n margin-bottom: 20px;\n color: ", ";\n &.active {\n color: ", ";\n input {\n border-color: ", ";\n }\n }\n .tnt-icon {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n line-height: 1em;\n &[type=\"close\"] {\n right: 0;\n top: 0;\n font-size: 18px;\n cursor: pointer;\n }\n }\n input {\n border-width: 0 0 1px;\n border-style: solid;\n border-color: ", ";\n width: 100%;\n padding: 4px 20px;\n line-height: 20px;\n background-color: transparent;\n outline: none;\n }\n"]);
71
+
72
+ _templateObject = function _templateObject() {
73
+ return data;
74
+ };
75
+
76
+ return data;
77
+ }
78
+
79
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
80
+
81
+ import { useState, useEffect } from 'react';
82
+ import cn from 'classnames';
83
+ import styled from 'styled-components';
84
+ import { debounce } from 'lodash';
85
+ import { traverseTree, hasLevel3 } from '../utils';
86
+ import Icon from '../Iconfont';
87
+ import { getText } from '../../locale';
88
+ var SearchArea = styled.div(_templateObject(), function (props) {
89
+ return props.theme.secondaryTextColor;
90
+ }, function (props) {
91
+ return props.theme.primaryColor;
92
+ }, function (props) {
93
+ return props.theme.primaryColor;
94
+ }, function (props) {
95
+ return props.theme.borderColor;
96
+ });
97
+ var ApplicationTabs = styled.ul(_templateObject2(), function (props) {
98
+ return props.theme.borderColor;
99
+ }, function (props) {
100
+ return props.theme.primaryTextColor;
101
+ }, function (props) {
102
+ return props.theme.borderColor;
103
+ }, function (props) {
104
+ return props.theme.primaryColor;
105
+ });
106
+ var GroupMenus = styled.div(_templateObject3(), function (props) {
107
+ return props.isLevel3 ? 'calc(100% - 80px)' : 'calc(100% - 50px)';
108
+ });
109
+ var GroupMenuItem = styled.div(_templateObject4());
110
+ var MenuList = styled.ul(_templateObject5());
111
+ var MenuItem = styled.li(_templateObject6(), function (props) {
112
+ return props.theme.secondaryTextColor;
113
+ }, function (props) {
114
+ return props.theme.secondaryColor;
115
+ }, function (props) {
116
+ return props.theme.primaryColor;
117
+ });
118
+ var ListBox = styled.ul(_templateObject7(), function (props) {
119
+ return props.theme.primaryTextColor;
120
+ }, function (props) {
121
+ return props.theme.secondaryColor;
122
+ }, function (props) {
123
+ return props.theme.lightBgColor;
124
+ });
125
+
126
+ var SearchList = function SearchList(_ref) {
127
+ var items = _ref.items,
128
+ onSelectMenu = _ref.onSelectMenu,
129
+ theme = _ref.theme;
130
+ return React.createElement(ListBox, {
131
+ theme: theme
132
+ }, items == null ? void 0 : items.map(function (item) {
133
+ return React.createElement("li", {
134
+ onClick: function onClick() {
135
+ return onSelectMenu(item);
136
+ }
137
+ }, item == null ? void 0 : item.menuName);
138
+ }));
139
+ };
140
+
141
+ export default (function (_ref2) {
142
+ var theme = _ref2.theme,
143
+ _ref2$menus = _ref2.menus,
144
+ menus = _ref2$menus === void 0 ? [] : _ref2$menus,
145
+ close = _ref2.close,
146
+ actions = _ref2.actions,
147
+ popupRef = _ref2.popupRef,
148
+ containerRef = _ref2.containerRef;
149
+
150
+ var _useState = useState(false),
151
+ _useState2 = _slicedToArray(_useState, 2),
152
+ active = _useState2[0],
153
+ setActive = _useState2[1];
154
+
155
+ var _useState3 = useState(),
156
+ _useState4 = _slicedToArray(_useState3, 2),
157
+ searchValue = _useState4[0],
158
+ setSearchValue = _useState4[1];
159
+
160
+ var language = actions == null ? void 0 : actions.getLanguage();
161
+ var isLevel3 = hasLevel3(menus);
162
+
163
+ var _useState5 = useState(isLevel3 ? menus == null ? void 0 : menus[0] : null),
164
+ _useState6 = _slicedToArray(_useState5, 2),
165
+ activeTopMenu = _useState6[0],
166
+ setActiveTopMenu = _useState6[1];
167
+
168
+ var selectedMenuKey = actions.getSelectedMenuKey();
169
+
170
+ var calcGroupMenus = function calcGroupMenus(menus) {
171
+ var _menus, _menus2;
172
+
173
+ menus = (_menus = menus) == null ? void 0 : _menus.reduce(function (acc, cur) {
174
+ var _cur$children;
175
+
176
+ // 分组
177
+ if (cur == null ? void 0 : (_cur$children = cur.children) == null ? void 0 : _cur$children.length) {
178
+ acc.push(cur);
179
+ } else {
180
+ var defaultGroup = acc.find(function (_ref3) {
181
+ var isDefaultGroup = _ref3.isDefaultGroup;
182
+ return isDefaultGroup;
183
+ });
184
+
185
+ if (!defaultGroup) {
186
+ acc.unshift({
187
+ isDefaultGroup: true,
188
+ children: [cur]
189
+ });
190
+ } else {
191
+ defaultGroup.children.push(cur);
192
+ }
193
+ }
194
+
195
+ return acc;
196
+ }, []);
197
+ return (_menus2 = menus) == null ? void 0 : _menus2.reduce(function (acc, cur) {
198
+ var column = Math.max(1, ~~((containerRef.current.clientWidth - 32) / 210));
199
+
200
+ if (!acc.length) {
201
+ acc.push([cur]);
202
+ } else {
203
+ var calcGroupHeight = function calcGroupHeight(group) {
204
+ var _group$children;
205
+
206
+ return 46 + ((group == null ? void 0 : (_group$children = group.children) == null ? void 0 : _group$children.length) || 0) * 30;
207
+ };
208
+
209
+ var calcColumnHeight = function calcColumnHeight(columnGroups) {
210
+ return columnGroups == null ? void 0 : columnGroups.reduce(function (acc, cur) {
211
+ acc += calcGroupHeight(cur);
212
+ return acc;
213
+ }, 0);
214
+ };
215
+
216
+ var currentColumnHeight = calcColumnHeight(acc[acc.length - 1]);
217
+ var nextGroupHeight = calcGroupHeight(cur);
218
+
219
+ var findMinHeightGroup = function findMinHeightGroup(groups) {
220
+ var minHeight = Infinity;
221
+ var index = 0;
222
+
223
+ for (var i = 0; i < groups.length; i++) {
224
+ var height = calcColumnHeight(groups[i]);
225
+
226
+ if (height < minHeight) {
227
+ index = i;
228
+ minHeight = height;
229
+ }
230
+ }
231
+
232
+ return groups[index];
233
+ };
234
+
235
+ if (acc.length >= column) {
236
+ var minHeightGroup = findMinHeightGroup(acc);
237
+ minHeightGroup == null ? void 0 : minHeightGroup.push(cur);
238
+ } else {
239
+ if (currentColumnHeight + nextGroupHeight > 440) {
240
+ acc.push([cur]);
241
+ } else {
242
+ var _acc;
243
+
244
+ (_acc = acc[(acc == null ? void 0 : acc.length) - 1]) == null ? void 0 : _acc.push(cur);
245
+ }
246
+ }
247
+ }
248
+
249
+ return acc;
250
+ }, []);
251
+ };
252
+
253
+ var groupMenus = calcGroupMenus((activeTopMenu == null ? void 0 : activeTopMenu.children) || menus);
254
+
255
+ var _useState7 = useState([]),
256
+ _useState8 = _slicedToArray(_useState7, 2),
257
+ searchedMenus = _useState8[0],
258
+ setSearchedMenus = _useState8[1];
259
+
260
+ var onMenuClick = function onMenuClick(menu) {
261
+ actions.emit('menuSelect', {
262
+ key: menu.code,
263
+ data: menu
264
+ });
265
+ setSearchValue('');
266
+ setSearchedMenus([]);
267
+ close();
268
+ };
269
+
270
+ var debounceSearch = debounce(function (evt) {
271
+ var _evt$target$value;
272
+
273
+ var value = (_evt$target$value = evt.target.value) == null ? void 0 : _evt$target$value.trim();
274
+ var matchedMenus = [];
275
+
276
+ if (value) {
277
+ traverseTree(menus, function (node) {
278
+ var _node$menuName;
279
+
280
+ if (node.path && (node == null ? void 0 : (_node$menuName = node.menuName) == null ? void 0 : _node$menuName.includes(value))) {
281
+ matchedMenus.push(node);
282
+ }
283
+ });
284
+ }
285
+
286
+ setSearchedMenus(matchedMenus);
287
+ }, 100);
288
+
289
+ var onSearchChange = function onSearchChange(evt) {
290
+ evt.persist();
291
+ setSearchValue(evt.target.value);
292
+ debounceSearch(evt);
293
+ };
294
+
295
+ var onSelectAppTab = function onSelectAppTab(menu) {
296
+ setActiveTopMenu(menu);
297
+ };
298
+
299
+ useEffect(function () {
300
+ var clickOutside = function clickOutside(evt) {
301
+ var clientX = evt.clientX,
302
+ clientY = evt.clientY,
303
+ pageX = evt.pageX,
304
+ pageY = evt.pageY;
305
+
306
+ var isOutside = function isOutside(evt, popup) {
307
+ if (popup == null ? void 0 : popup.contains) {
308
+ return !(popup == null ? void 0 : popup.contains(evt.target));
309
+ }
310
+
311
+ var _popup$getBoundingCli = popup.getBoundingClientRect(),
312
+ x = _popup$getBoundingCli.x,
313
+ y = _popup$getBoundingCli.y,
314
+ height = _popup$getBoundingCli.height,
315
+ width = _popup$getBoundingCli.width;
316
+
317
+ console.log('clickOutside...', [x, y], [clientX, clientY], [pageX, pageY]);
318
+ x += window.scrollX;
319
+ y += window.scrollY;
320
+ return pageX < x || pageX > x + width || pageY < y || pageY > y + height;
321
+ };
322
+
323
+ if (isOutside(evt, popupRef.current)) {
324
+ setSearchValue('');
325
+ setSearchedMenus([]);
326
+ close();
327
+ }
328
+ };
329
+
330
+ document.addEventListener('click', clickOutside);
331
+ return function () {
332
+ return document.removeEventListener('click', clickOutside);
333
+ };
334
+ }, []);
335
+ return React.createElement(React.Fragment, null, React.createElement(SearchArea, {
336
+ theme: theme,
337
+ className: cn({
338
+ active: active
339
+ })
340
+ }, React.createElement(Icon, {
341
+ type: "search"
342
+ }), React.createElement("input", {
343
+ placeholder: actions == null ? void 0 : actions.getText('menuSearch'),
344
+ value: searchValue,
345
+ onChange: onSearchChange,
346
+ onFocus: function onFocus() {
347
+ return setActive(true);
348
+ },
349
+ onBlur: function onBlur() {
350
+ return setActive(false);
351
+ }
352
+ }), React.createElement(Icon, {
353
+ type: "close",
354
+ onClick: close
355
+ }), (searchedMenus == null ? void 0 : searchedMenus.length) > 0 && React.createElement(SearchList, {
356
+ items: searchedMenus,
357
+ theme: theme,
358
+ onSelectMenu: onMenuClick
359
+ })), isLevel3 && React.createElement(ApplicationTabs, {
360
+ theme: theme
361
+ }, menus == null ? void 0 : menus.map(function (menu) {
362
+ return React.createElement("li", {
363
+ className: cn({
364
+ active: menu.code === (activeTopMenu == null ? void 0 : activeTopMenu.code)
365
+ }),
366
+ onClick: function onClick() {
367
+ return onSelectAppTab(menu);
368
+ }
369
+ }, menu == null ? void 0 : menu[language === 'cn' ? 'groupName' : 'enName']);
370
+ })), React.createElement(GroupMenus, {
371
+ theme: theme,
372
+ isLevel3: isLevel3
373
+ }, groupMenus == null ? void 0 : groupMenus.map(function (groups) {
374
+ return React.createElement("div", null, groups == null ? void 0 : groups.map(function (group) {
375
+ return React.createElement(GroupMenuItem, {
376
+ theme: theme
377
+ }, React.createElement("h5", null, group == null ? void 0 : group[language === 'cn' ? 'groupName' : 'enName']), React.createElement(MenuList, null, (group.children || []).map(function (menu) {
378
+ return React.createElement(MenuItem, {
379
+ key: menu.code,
380
+ className: cn({
381
+ active: selectedMenuKey === menu.code
382
+ }),
383
+ theme: theme,
384
+ onClick: function onClick() {
385
+ return onMenuClick(menu);
386
+ }
387
+ }, React.createElement("a", {
388
+ href: menu.path,
389
+ onClick: function onClick(evt) {
390
+ return evt.preventDefault();
391
+ }
392
+ }, menu == null ? void 0 : menu[language === 'cn' ? 'menuName' : 'enName']));
393
+ })));
394
+ }));
395
+ })));
396
+ });
@@ -0,0 +1,137 @@
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
10
+
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
12
+
13
+ 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; }
14
+
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+
17
+ function _templateObject2() {
18
+ var data = _taggedTemplateLiteral(["\n .tnt-navigation-popup {\n position: absolute;\n left: 0;\n top: ", ";\n width: 100%;\n height: ", ";\n background: #FFF;\n box-shadow: 0 10px 10px -8px rgba(0,0,0,.1) inset,\n 0 10px 10px -8px rgba(0,0,0,.1);\n transition: all .15s ease-in-out;\n overflow: hidden;\n padding: 20px 16px;\n box-sizing: border-box;\n &.hide {\n height: 0;\n padding: 0;\n }\n }\n"]);
19
+
20
+ _templateObject2 = function _templateObject2() {
21
+ return data;
22
+ };
23
+
24
+ return data;
25
+ }
26
+
27
+ function _templateObject() {
28
+ var data = _taggedTemplateLiteral(["\n &.active {\n color: ", " !important;\n }\n font-size: ", ";\n .tnt-icon {\n font-size: ", ";\n margin-right: 4px;\n }\n span {\n position: relative;\n font-size: ", ";\n top: ", ";\n font-family: auto;\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n }\n .isInIframe & {\n display: none;\n }\n"]);
29
+
30
+ _templateObject = function _templateObject() {
31
+ return data;
32
+ };
33
+
34
+ return data;
35
+ }
36
+
37
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
38
+
39
+ import { useState, useEffect, useRef, useContext } from 'react';
40
+ import ReactDOM from 'react-dom';
41
+ import cn from 'classnames';
42
+ import styled, { createGlobalStyle, withTheme } from 'styled-components';
43
+ import { uniq } from 'lodash';
44
+ import ActionsContext from '../ActionsContext';
45
+ import { hasLevel3 } from '../utils';
46
+ import Icon from '../Iconfont';
47
+ import NavigationPopup from './NavigationPopup';
48
+ var Navigation = styled.li(_templateObject(), function (_ref) {
49
+ var theme = _ref.theme;
50
+ return theme.primaryColor;
51
+ }, function (_ref2) {
52
+ var size = _ref2.theme.size;
53
+ return size === 'large' ? '14px' : '12px';
54
+ }, function (_ref3) {
55
+ var size = _ref3.theme.size;
56
+ return size === 'large' ? '22px' : '18px';
57
+ }, function (_ref4) {
58
+ var size = _ref4.theme.size;
59
+ return size === 'large' ? '14px' : '12px';
60
+ }, function (_ref5) {
61
+ var size = _ref5.theme.size;
62
+ return size === 'large' ? '-3px' : '-2px';
63
+ });
64
+
65
+ var createPopupContainer = function createPopupContainer() {
66
+ var div = document.createElement('div');
67
+ div.setAttribute('class', 'tnt-navigation-popup');
68
+ return div;
69
+ };
70
+
71
+ var GlobalStyle = createGlobalStyle(_templateObject2(), function (props) {
72
+ return props.theme.size === 'large' ? '60px' : '50px';
73
+ }, function (props) {
74
+ return props.hasLevel3 ? '560px' : '530px';
75
+ });
76
+ export default withTheme(function (props) {
77
+ var actions = useContext(ActionsContext);
78
+ var getText = actions.getText;
79
+ var headerRef = props.headerRef,
80
+ menus = props.menus;
81
+
82
+ var _useState = useState(false),
83
+ _useState2 = _slicedToArray(_useState, 2),
84
+ visible = _useState2[0],
85
+ setVisible = _useState2[1];
86
+
87
+ var popupRef = useRef();
88
+ useEffect(function () {
89
+ var _headerRef$current;
90
+
91
+ popupRef.current = createPopupContainer();
92
+ headerRef == null ? void 0 : (_headerRef$current = headerRef.current) == null ? void 0 : _headerRef$current.appendChild(popupRef.current);
93
+ return function () {
94
+ var _headerRef$current2;
95
+
96
+ headerRef == null ? void 0 : (_headerRef$current2 = headerRef.current) == null ? void 0 : _headerRef$current2.removeChild(popupRef.current);
97
+ };
98
+ }, []);
99
+ useEffect(function () {
100
+ var classNames = popupRef.current.getAttribute('class').split(' ');
101
+
102
+ if (visible) {
103
+ ReactDOM.render(React.createElement(NavigationPopup, {
104
+ actions: actions,
105
+ theme: props.theme,
106
+ menus: menus,
107
+ containerRef: headerRef,
108
+ popupRef: popupRef,
109
+ close: function close() {
110
+ return setVisible(false);
111
+ }
112
+ }), popupRef.current);
113
+ popupRef.current.setAttribute('class', classNames.filter(function (item) {
114
+ return item !== 'hide';
115
+ }).join(' '));
116
+ } else {
117
+ popupRef.current.setAttribute('class', uniq([].concat(_toConsumableArray(classNames), ['hide'])).join(' '));
118
+ }
119
+ }, [visible]);
120
+ return React.createElement(Navigation, {
121
+ onClick: function onClick(evt) {
122
+ var _evt$nativeEvent, _evt$nativeEvent2;
123
+
124
+ evt.stopPropagation();
125
+ (_evt$nativeEvent = evt.nativeEvent) == null ? void 0 : _evt$nativeEvent.stopImmediatePropagation();
126
+ (_evt$nativeEvent2 = evt.nativeEvent) == null ? void 0 : _evt$nativeEvent2.stopPropagation();
127
+ setVisible(!visible);
128
+ },
129
+ className: cn({
130
+ active: visible
131
+ })
132
+ }, React.createElement(Icon, {
133
+ type: "unordered-list"
134
+ }), React.createElement("span", null, getText('globalNavigation')), React.createElement(GlobalStyle, {
135
+ hasLevel3: hasLevel3(menus)
136
+ }));
137
+ });
@@ -0,0 +1,95 @@
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 _templateObject2() {
4
+ var data = _taggedTemplateLiteral(["\n flex: 1;\n .isInIframe & {\n display: none;\n }\n"]);
5
+
6
+ _templateObject2 = function _templateObject2() {
7
+ return data;
8
+ };
9
+
10
+ return data;
11
+ }
12
+
13
+ function _templateObject() {
14
+ 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 .hasHeaderTabs & {\n // background: #191D29;\n background: #fff !important;\n box-shadow: 0px 1px 6px 0px rgba(0,0,0,0.18);\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"]);
15
+
16
+ _templateObject = function _templateObject() {
17
+ return data;
18
+ };
19
+
20
+ return data;
21
+ }
22
+
23
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
24
+
25
+ /**
26
+ * @file Layout header
27
+ * @author zhangyou
28
+ */
29
+ import { useRef } from 'react';
30
+ import styled, { withTheme } from 'styled-components';
31
+ import Icon from '../Icon';
32
+ import Actions from './HeaderActions';
33
+ import AppList from './AppList';
34
+ import OrgAppList from './OrgAppList';
35
+ var Header = styled.div(_templateObject(), function (props) {
36
+ return "".concat(props.theme.headerHeight, "px");
37
+ }, function (props) {
38
+ return "".concat(props.theme.blueBgColor, " !important");
39
+ }, function (props) {
40
+ return "".concat(props.theme.headerHeight, "px");
41
+ }, function (props) {
42
+ return "".concat(props.theme.headerHeight, "px");
43
+ }, function (props) {
44
+ return "".concat(props.theme.headerHeight, "px");
45
+ }, function (props) {
46
+ return "".concat(props.theme.primaryTextColor);
47
+ }, function (props) {
48
+ return "".concat(props.theme.primaryTextColor);
49
+ });
50
+ var Content = styled.div(_templateObject2());
51
+ export default withTheme(function (props) {
52
+ var collapsed = props.collapsed,
53
+ _props$collapseIconPl = props.collapseIconPlacement,
54
+ collapseIconPlacement = _props$collapseIconPl === void 0 ? 'right' : _props$collapseIconPl,
55
+ selectedAppKey = props.selectedAppKey,
56
+ appList = props.appList,
57
+ orgAppShow = props.orgAppShow,
58
+ orgAppList = props.orgAppList,
59
+ orgTreeConfig = props.orgTreeConfig,
60
+ selectedOrgKey = props.selectedOrgKey,
61
+ orgList = props.orgList,
62
+ headerTabs = props.headerTabs,
63
+ onAppChange = props.onAppChange,
64
+ onOrgChange = props.onOrgChange,
65
+ onCollapseChange = props.onCollapseChange,
66
+ extraActions = props.extraActions;
67
+ var headerRef = useRef();
68
+ return React.createElement(Header, {
69
+ className: "tnt-layout-header",
70
+ ref: headerRef
71
+ }, collapseIconPlacement === 'right' && React.createElement("div", {
72
+ className: "sidebar-collapsed-controller",
73
+ onClick: onCollapseChange
74
+ }, React.createElement(Icon, {
75
+ type: "menu-".concat(collapsed ? 'unfold' : 'fold')
76
+ })), headerTabs, orgList && React.createElement(OrgAppList, {
77
+ orgAppShow: orgAppShow,
78
+ selectedOrgKey: selectedOrgKey,
79
+ orgList: orgList,
80
+ selectedAppKey: selectedAppKey,
81
+ onOrgChange: onOrgChange,
82
+ orgTreeConfig: orgTreeConfig,
83
+ orgAppList: orgAppList,
84
+ onAppChange: onAppChange,
85
+ headerTabs: headerTabs
86
+ }), appList && !orgList && React.createElement(AppList, {
87
+ items: appList,
88
+ selectedKey: selectedAppKey,
89
+ onChange: onAppChange
90
+ }), React.createElement(Content, {
91
+ className: "tnt-layout-header-content"
92
+ }, props.children), React.createElement(Actions, _extends({}, props, {
93
+ headerRef: headerRef
94
+ }), extraActions));
95
+ });