tntd 1.3.65 → 1.4.1

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 (169) hide show
  1. package/.eslintignore +2 -1
  2. package/babel.config.js +2 -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 +274 -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 +82 -0
  26. package/es/Columns/index.less +75 -0
  27. package/es/DevelopmentLogin/LoginModal.js +117 -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 +139 -0
  34. package/es/Ellipsis/index.less +56 -0
  35. package/es/Handle/README.md +104 -0
  36. package/es/Handle/index.js +86 -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 +223 -0
  58. package/es/Layout/Application.js +113 -0
  59. package/es/Layout/Avatar.js +112 -0
  60. package/es/Layout/CompatibleLanguage.js +177 -0
  61. package/es/Layout/EnterpriseLayout/Avatar.js +138 -0
  62. package/es/Layout/EnterpriseLayout/Language.js +81 -0
  63. package/es/Layout/EnterpriseLayout/Theme.js +75 -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 +105 -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 +232 -0
  74. package/es/Layout/Logo.js +86 -0
  75. package/es/Layout/OrgAppList.js +304 -0
  76. package/es/Layout/README.md +783 -0
  77. package/es/Layout/SideMenu.js +338 -0
  78. package/es/Layout/Theme.js +105 -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 +233 -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 +43 -0
  126. package/es/Modal/README.md +59 -0
  127. package/es/Modal/index.js +94 -0
  128. package/es/Modal/index.less +86 -0
  129. package/es/Page/Box.js +72 -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 +19 -0
  135. package/es/QueryForm/Field/Select.js +78 -0
  136. package/es/QueryForm/Field/SelectInput.js +88 -0
  137. package/es/QueryForm/Field/fieldsMap.js +27 -0
  138. package/es/QueryForm/Field/index.js +155 -0
  139. package/es/QueryForm/README.md +512 -0
  140. package/es/QueryForm/createActions.js +53 -0
  141. package/es/QueryForm/index.js +376 -0
  142. package/es/QueryForm/index.less +133 -0
  143. package/es/QueryForm/useForm.js +7 -0
  144. package/es/QueryListScene/List.js +376 -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 +618 -0
  157. package/es/Table/README.md +109 -0
  158. package/es/Table/ResizableTable/index.js +108 -0
  159. package/es/Table/ResizableTable/index.less +36 -0
  160. package/es/Table/index.js +33 -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 +1 -1
  167. package/doc-scripts.config.js +0 -37
  168. package/doc-scripts.renderer.js +0 -11
  169. package/docs/README.md +0 -1643
@@ -0,0 +1,94 @@
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 _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; }
4
+
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
6
+
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
8
+
9
+ 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; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ 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; }
14
+
15
+ 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; }
16
+
17
+ import { useState, useEffect, Fragment } from 'react';
18
+ import cn from 'classnames';
19
+ import { Modal } from 'antd';
20
+ import Icon from '../Icon';
21
+ import './index.less';
22
+
23
+ var Title = function Title(_ref) {
24
+ var title = _ref.title,
25
+ logo = _ref.logo,
26
+ fullscreen = _ref.fullscreen,
27
+ _ref$supportFullscree = _ref.supportFullscreen,
28
+ supportFullscreen = _ref$supportFullscree === void 0 ? true : _ref$supportFullscree,
29
+ onToggleFullscreen = _ref.onToggleFullscreen,
30
+ onClose = _ref.onClose;
31
+ return React.createElement(Fragment, null, React.createElement("div", null, logo && React.createElement("img", {
32
+ src: logo
33
+ }), React.createElement("span", null, title)), React.createElement("div", {
34
+ className: "tnt-modal-header-actions"
35
+ }, supportFullscreen && React.createElement(Icon, {
36
+ className: "fullscreen",
37
+ type: fullscreen ? 'fullscreen-exit' : 'fullscreen',
38
+ onClick: onToggleFullscreen
39
+ }), React.createElement(Icon, {
40
+ className: "close",
41
+ type: "close",
42
+ onClick: onClose
43
+ })));
44
+ };
45
+
46
+ export default (function (props) {
47
+ var _cn;
48
+
49
+ var visible = props.visible,
50
+ children = props.children,
51
+ logo = props.logo,
52
+ title = props.title,
53
+ _props$height = props.height,
54
+ height = _props$height === void 0 ? '90vh' : _props$height,
55
+ _props$width = props.width,
56
+ width = _props$width === void 0 ? '85%' : _props$width,
57
+ className = props.className,
58
+ supportFullscreen = props.supportFullscreen,
59
+ _onToggleFullscreen = props.onToggleFullscreen,
60
+ onCancel = props.onCancel,
61
+ rest = _objectWithoutProperties(props, ["visible", "children", "logo", "title", "height", "width", "className", "supportFullscreen", "onToggleFullscreen", "onCancel"]);
62
+
63
+ var _useState = useState(rest.fullscreen || false),
64
+ _useState2 = _slicedToArray(_useState, 2),
65
+ fullscreen = _useState2[0],
66
+ setFullscreen = _useState2[1];
67
+
68
+ useEffect(function () {
69
+ setFullscreen(rest.fullscreen);
70
+ }, [rest.fullscreen, visible]);
71
+ return React.createElement(Modal, _extends({
72
+ visible: visible,
73
+ title: React.createElement(Title, {
74
+ logo: logo,
75
+ title: title,
76
+ fullscreen: fullscreen,
77
+ supportFullscreen: supportFullscreen,
78
+ onClose: onCancel,
79
+ onToggleFullscreen: function onToggleFullscreen() {
80
+ setFullscreen(!fullscreen);
81
+ _onToggleFullscreen && _onToggleFullscreen(!fullscreen);
82
+ }
83
+ }),
84
+ onCancel: onCancel,
85
+ destroyOnClose: true,
86
+ centered: true,
87
+ footer: null,
88
+ width: fullscreen ? '100%' : width,
89
+ style: {
90
+ height: fullscreen ? '100vh' : height
91
+ },
92
+ className: cn('tnt-modal', (_cn = {}, _defineProperty(_cn, className, className), _defineProperty(_cn, "fullscreen", fullscreen), _cn))
93
+ }, rest), children);
94
+ });
@@ -0,0 +1,86 @@
1
+ .tnt-modal {
2
+ &.ant-modal {
3
+ max-width: 100vw;
4
+ padding-bottom: 0;
5
+ }
6
+
7
+ .ant-modal-content {
8
+ height: 100%;
9
+ display: flex;
10
+ flex-direction: column;
11
+
12
+ .ant-modal-close {
13
+ display: none;
14
+ }
15
+ }
16
+
17
+ .ant-modal-header {
18
+ position: relative;
19
+ padding: 8px 20px;
20
+
21
+ .tnt-modal-header-actions {
22
+ position: absolute;
23
+ top: 0;
24
+ right: 0;
25
+ height: 40px;
26
+ line-height: 40px;
27
+
28
+ .tnt-icon {
29
+ width: 40px;
30
+ height: 40px;
31
+ line-height: 40px;
32
+ cursor: pointer;
33
+ text-align: center;
34
+ display: inline-block;
35
+ }
36
+
37
+ i.fullscreen:hover {
38
+ color: #2E81F7;
39
+ }
40
+
41
+ i.close:hover {
42
+ color: red;
43
+ }
44
+ }
45
+ }
46
+
47
+ .ant-modal-title {
48
+ .link {
49
+ margin-left: 10px;
50
+ font-size: 12px;
51
+ color: #999;
52
+
53
+ &:hover {
54
+ color: #2E81F7;
55
+ }
56
+ }
57
+
58
+ img {
59
+ position: relative;
60
+ width: 18px;
61
+ height: 18px;
62
+ margin-right: 8px;
63
+ vertical-align: text-top;
64
+ }
65
+ }
66
+
67
+ .ant-modal-body {
68
+ padding: 0;
69
+ // height: calc(100% - 39px);
70
+ flex: 1;
71
+ overflow: auto;
72
+ }
73
+
74
+ &.fullscreen {
75
+ .ant-modal-body {
76
+ height: calc(100vh - 39px);
77
+ background: #fff;
78
+ }
79
+ }
80
+
81
+ iframe {
82
+ border: none;
83
+ width: 100%;
84
+ height: 100%;
85
+ }
86
+ }
package/es/Page/Box.js ADDED
@@ -0,0 +1,72 @@
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 _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; }
10
+
11
+ 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; }
12
+
13
+ import React from 'react';
14
+ import { Card } from 'antd';
15
+ import { addUnitForValue } from './utils';
16
+
17
+ var Box = function Box(_ref) {
18
+ var inLayout = _ref.inLayout,
19
+ _ref$clsPrefix = _ref.clsPrefix,
20
+ clsPrefix = _ref$clsPrefix === void 0 ? 'tnt-page' : _ref$clsPrefix,
21
+ children = _ref.children,
22
+ _ref$noPadding = _ref.noPadding,
23
+ noPadding = _ref$noPadding === void 0 ? false : _ref$noPadding,
24
+ headerHeight = _ref.headerHeight,
25
+ _ref$bordered = _ref.bordered,
26
+ bordered = _ref$bordered === void 0 ? false : _ref$bordered,
27
+ _ref$bodyStyle = _ref.bodyStyle,
28
+ bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
29
+ _ref$headStyle = _ref.headStyle,
30
+ headStyle = _ref$headStyle === void 0 ? {} : _ref$headStyle,
31
+ height = _ref.height,
32
+ _ref$size = _ref.size,
33
+ size = _ref$size === void 0 ? 'small' : _ref$size,
34
+ _ref$contentTotalMarg = _ref.contentTotalMargin,
35
+ contentTotalMargin = _ref$contentTotalMarg === void 0 ? '0px' : _ref$contentTotalMarg,
36
+ restProps = _objectWithoutProperties(_ref, ["inLayout", "clsPrefix", "children", "noPadding", "headerHeight", "bordered", "bodyStyle", "headStyle", "height", "size", "contentTotalMargin"]);
37
+
38
+ var cardTitleHeight = 0;
39
+ console.log('inLayout', inLayout);
40
+ console.log('restProps', restProps);
41
+
42
+ if (restProps.title) {
43
+ // 根据Card的size,计算Card的title的高度值
44
+ cardTitleHeight = size === 'small' ? 40 : 60; // 如果Card的自定义高度,Card的title就使用此高度
45
+
46
+ if (headStyle.hasOwnProperty(height)) {
47
+ cardTitleHeight = headStyle.height;
48
+ }
49
+ } // 如果设置了noPadding,优先级最高
50
+
51
+
52
+ if (noPadding) {
53
+ bodyStyle.padding = 0;
54
+ headStyle.padding = 0;
55
+ } // 如果传入只有数字,需要默认加px
56
+
57
+
58
+ cardTitleHeight = addUnitForValue(cardTitleHeight);
59
+ var cardBodyHeight = "calc(".concat(height, " - ").concat(headerHeight, " - ").concat(contentTotalMargin, " - ").concat(cardTitleHeight, ")");
60
+ return React.createElement(Card, _extends({
61
+ className: "".concat(clsPrefix, "-box-card"),
62
+ bordered: bordered,
63
+ bodyStyle: _objectSpread({}, bodyStyle, {
64
+ // overflow: 'auto',
65
+ height: inLayout ? "calc(100% - ".concat(headerHeight, ")") : cardBodyHeight
66
+ }),
67
+ size: size,
68
+ headStyle: headStyle
69
+ }, restProps), children);
70
+ };
71
+
72
+ export default Box;
@@ -0,0 +1,180 @@
1
+ ## Page 组件
2
+
3
+ ### 代码演示
4
+
5
+ ```jsx
6
+ import React, { useState } from 'react';
7
+ import ReactDOM from 'react-dom';
8
+ import { Button, Divider, message, Breadcrumb } from 'antd';
9
+ import { Page, Layout } from 'tntd';
10
+ import styled from 'styled-components';
11
+ import 'antd/dist/antd.css';
12
+
13
+ const { Box } = Page
14
+
15
+ const left = <Breadcrumb>
16
+ <Breadcrumb.Item>Home</Breadcrumb.Item>
17
+ <Breadcrumb.Item>
18
+ <a href="">Application Center</a>
19
+ </Breadcrumb.Item>
20
+ <Breadcrumb.Item>
21
+ <a href="">Application List</a>
22
+ </Breadcrumb.Item>
23
+ <Breadcrumb.Item>An Application</Breadcrumb.Item>
24
+ </Breadcrumb>;
25
+ const center = '先灰再白后灰'
26
+ const right = (
27
+ <>
28
+ <Button>预览</Button>
29
+ <Button type="primary">保存</Button>
30
+ </>
31
+ )
32
+
33
+ const Demo = (props) => {
34
+ return (
35
+ <div>
36
+ <h3>第一种场景, 从灰色背景开始</h3>
37
+ <Page
38
+ className='etl-page'
39
+ title='ETL编辑器'
40
+ center={center}
41
+ extra={right}
42
+ goBackText='返回啊'
43
+ goBack={()=>{
44
+ message.info('hi,你点击了返回');
45
+ }}
46
+ >
47
+ <Box width="200" title="标题">第一列</Box>
48
+ <Box mode="white">第二列</Box>
49
+ <Box width="200">第三列</Box>
50
+ </Page>
51
+
52
+ <Divider dashed />
53
+ <h3>第二种场景,从白色背景开始</h3>
54
+
55
+ <Page
56
+ title={left}
57
+ center={center}
58
+ extra={right}
59
+ >
60
+ <Box width="200" mode="white">第一列</Box>
61
+ <Box>第二列</Box>
62
+ <Box width="200" mode="white">第三列</Box>
63
+ </Page>
64
+
65
+ <Divider dashed />
66
+
67
+ <h3>第三种场景, 无标题栏</h3>
68
+
69
+ <Page height="400px">
70
+ <Box title='分组列表' extra={<Button type="primary" size='small'>添加</Button>}>第一列</Box>
71
+ <Box mode="white" title='菜单列表' extra={<Button type="primary" size='small'>添加</Button>}>第二列</Box>
72
+ <Box title="系统列表">第三列</Box>
73
+ <Box title="功能注册">第四列</Box>
74
+ </Page>
75
+
76
+ <Divider dashed />
77
+ <Layout
78
+ // type="paas"
79
+ appKey="orion"
80
+ logo=""
81
+ name="私有云全家桶"
82
+ enName="Private Cloud"
83
+ >
84
+ <Page
85
+ title="风险大盘"
86
+ // extra={right}
87
+ inLayout
88
+ >
89
+ <Box
90
+ title="系统列表"
91
+ width={320}
92
+ mode='white'
93
+ >
94
+ 第三列
95
+ </Box>
96
+ <Box title="功能注册">
97
+ 第四列<br/>
98
+ 第四列<br/>
99
+ 第四列<br/>
100
+ 第四列<br/>
101
+ 第四列<br/>
102
+ 第四列<br/>
103
+ 第四列<br/>
104
+ 第四列<br/>
105
+ 第四列<br/>
106
+ 第四列<br/>
107
+ 第四列<br/>
108
+ 第四列<br/>
109
+ 第四列<br/>
110
+ 第四列<br/>
111
+ 第四列<br/>
112
+ 第四列<br/>
113
+ 第四列<br/>
114
+ 第四列<br/>
115
+ 第四列<br/>
116
+ 第四列<br/>
117
+ 第四列<br/>
118
+ 第四列<br/>
119
+ 第四列<br/>
120
+ 第四列<br/>
121
+ 第四列<br/>
122
+ 第四列<br/>
123
+ 第四列end
124
+ </Box>
125
+ <Box
126
+ title="系统列表"
127
+ width={200}
128
+ mode='white'
129
+ >
130
+ 第三列
131
+ </Box>
132
+ </Page>
133
+ </Layout>
134
+ <Divider dashed />
135
+
136
+ <h3>第四种场景, 有inLayout属性添加内边距padding="16px 20px",Page里是自定义的children</h3>
137
+ <div name="layout" style={{background:'#f0f2f3'}}>
138
+ <Page
139
+ title="风险大盘"
140
+ extra={right}
141
+ inLayout={true}
142
+ >
143
+ hi
144
+ <div style={{width: '100%', height: 200, background: '#ffffff'}}>自定义children</div>
145
+ </Page>
146
+ </div>
147
+ </div>
148
+ )
149
+ }
150
+
151
+ ReactDOM.render(<Demo />, document.getElementById('root'))
152
+ ```
153
+
154
+ ### API
155
+
156
+ #### Page
157
+
158
+ | 参数 | 说明 | 类型 | 默认值 | 是否必须 |
159
+ | :----------- | :--------- | :--------------------------------------------------- | :------ | :------ |
160
+ | title | 标题栏左侧内容 | ReactNode | - | 否 |
161
+ | center | 标题栏中间内容 | ReactNode |- |否 |
162
+ | extra | 标题栏右侧内容 | ReactNode | - |否 |
163
+ | headerHeight |标题栏的高度 | string/int | 50px |否 |
164
+ | height | 组件整体高度 |string/int| 100vh| 否 |
165
+ | size | 根据size尺寸调整标题栏的padding值,Page.Box组件也会继承size属性 |`default | small`| small| 否|
166
+ | inLayout | 代表组件是放在tntd的Layout中引用,增加内边距"16px 30px",标题栏无阴影 |boolean | false | 否|
167
+
168
+
169
+
170
+ #### Page.Box
171
+
172
+ 描述:Page.Box包裹了antd库中的Card组件,Box属性都会透传到Card组件。
173
+
174
+ | 参数 | 说明 | 类型 | 默认值 | 是否必须 |
175
+ | :---- | :--------- | :--------------------------------------------- | :------ | :------ |
176
+ | width | 30%代表占父容器的百分比, `30 | 30px`代表固定宽度30px | string/int | auto |否 |
177
+ | title | 列标题 | ReactNode | - |否 |
178
+ | mode | white是白色背景,gray为灰色背景 |`white| gray` | gray | 否 |
179
+ | noPadding | 如果为true,Box的padding为0 | boolean | false | 否 |
180
+
@@ -0,0 +1,165 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
10
+
11
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
12
+
13
+ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
14
+
15
+ 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; } }
16
+
17
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
18
+
19
+ 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; }
20
+
21
+ 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; }
22
+
23
+ import React from 'react';
24
+ import cn from 'classnames';
25
+ import Icon from '../Icon';
26
+ import { computeWidth, addUnitForValue } from './utils';
27
+ import Box from './Box';
28
+ import './index.less';
29
+ var clsPrefix = 'tnt-page';
30
+
31
+ var isPageBox = function isPageBox(child) {
32
+ var _child$props;
33
+
34
+ return (child == null ? void 0 : child.type) === Box || (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.pageBox);
35
+ };
36
+
37
+ var PageLayout = function PageLayout(_ref) {
38
+ var _childrenToArray, _childrenToArray$filt, _childrenToArray2, _cn;
39
+
40
+ var _ref$height = _ref.height,
41
+ height = _ref$height === void 0 ? '100vh' : _ref$height,
42
+ _ref$headerHeight = _ref.headerHeight,
43
+ headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
44
+ children = _ref.children,
45
+ title = _ref.title,
46
+ goBack = _ref.goBack,
47
+ goBackText = _ref.goBackText,
48
+ center = _ref.center,
49
+ extra = _ref.extra,
50
+ _ref$size = _ref.size,
51
+ size = _ref$size === void 0 ? 'small' : _ref$size,
52
+ _ref$inLayout = _ref.inLayout,
53
+ inLayout = _ref$inLayout === void 0 ? false : _ref$inLayout,
54
+ className = _ref.className,
55
+ restProps = _objectWithoutProperties(_ref, ["height", "headerHeight", "children", "title", "goBack", "goBackText", "center", "extra", "size", "inLayout", "className"]);
56
+
57
+ // 如果传入只有数字,需要默认加px
58
+ var computedHeaderHeight = addUnitForValue(headerHeight);
59
+ var computedHeight = addUnitForValue(height); // 判断是否有标题栏
60
+
61
+ if (!(title || extra || center)) {
62
+ computedHeaderHeight = '0px';
63
+ }
64
+
65
+ if (inLayout) {
66
+ computedHeaderHeight = '40px';
67
+ } // 计算中间的zIndex,灰色递减,白色递增
68
+
69
+
70
+ var whiteCols = 0;
71
+ var childrenToArray = []; // 计算children type是box的数量
72
+
73
+ var boxCount = 0; // 如果children是单个节点,统一转为数组处理计算层级
74
+
75
+ console.log('children', children);
76
+
77
+ if (_typeof(children) === 'object') {
78
+ childrenToArray = [children];
79
+ } else if (Array.isArray(children)) {
80
+ childrenToArray = _toConsumableArray(children);
81
+ }
82
+
83
+ console.log('React.Children', React.Children);
84
+ React.Children.map(children, function (child) {
85
+ if (isPageBox(child)) {
86
+ boxCount += 1;
87
+ }
88
+ });
89
+ console.log(boxCount);
90
+ whiteCols = (_childrenToArray = childrenToArray) == null ? void 0 : (_childrenToArray$filt = _childrenToArray.filter(function (_ref2) {
91
+ var props = _ref2.props;
92
+ return (props == null ? void 0 : props.mode) === 'white';
93
+ })) == null ? void 0 : _childrenToArray$filt.length;
94
+ var total = ((_childrenToArray2 = childrenToArray) == null ? void 0 : _childrenToArray2.length) + 5;
95
+ var startIndex = total - whiteCols - 1;
96
+ var endIndex = total - 2;
97
+ var headerStyle = {
98
+ height: computedHeaderHeight,
99
+ padding: "".concat(size === 'small' ? 20 : 24, "px"),
100
+ zIndex: inLayout ? 1 : total || 1
101
+ };
102
+ var contentStyle = {
103
+ display: boxCount > 0 ? 'flex' : 'block',
104
+ marginTop: computedHeaderHeight,
105
+ padding: inLayout ? '16px 20px' : '0px'
106
+ };
107
+ return React.createElement("section", _extends({
108
+ className: cn(clsPrefix, (_cn = {}, _defineProperty(_cn, className, className), _defineProperty(_cn, 'in-layout', inLayout), _defineProperty(_cn, 'not-in-layout', !inLayout), _cn))
109
+ }, restProps), (title || goBack || center || extra) && React.createElement("div", {
110
+ className: "".concat(clsPrefix, "-header"),
111
+ style: headerStyle
112
+ }, React.createElement("div", {
113
+ className: "".concat(clsPrefix, "-header-section")
114
+ }, goBack && React.createElement("div", {
115
+ className: "page-header-section-back",
116
+ onClick: function onClick() {
117
+ goBack();
118
+ }
119
+ }, React.createElement(Icon, {
120
+ type: "left"
121
+ }), React.createElement("span", null, goBackText ? goBackText : '返回')), title), [center, extra].map(function (item) {
122
+ return React.createElement("div", {
123
+ className: "".concat(clsPrefix, "-header-section")
124
+ }, item);
125
+ })), React.createElement("div", {
126
+ className: "".concat(clsPrefix, "-content"),
127
+ style: contentStyle
128
+ }, React.Children.map(children, function (child) {
129
+ // 如果children不是Box,就不需要多列布局
130
+ if (!child.type) {
131
+ // console.log("没有type");
132
+ return React.cloneElement(React.createElement("div", null, child));
133
+ }
134
+
135
+ var extraProps = _objectSpread({
136
+ headerHeight: computedHeaderHeight,
137
+ size: size,
138
+ height: computedHeight,
139
+ contentTotalMargin: inLayout ? '32px' : '0px',
140
+ inLayout: inLayout
141
+ }, child.props);
142
+
143
+ if (!isPageBox(child)) {
144
+ return React.cloneElement(child, extraProps);
145
+ }
146
+
147
+ var _child$props2 = child.props,
148
+ _child$props2$mode = _child$props2.mode,
149
+ mode = _child$props2$mode === void 0 ? 'gray' : _child$props2$mode,
150
+ width = _child$props2.width;
151
+ var style = {
152
+ flex: computeWidth(width),
153
+ // 设置cols层级关系
154
+ zIndex: mode === 'gray' ? endIndex-- : startIndex++
155
+ };
156
+ var className = cn("".concat(clsPrefix, "-box ").concat(clsPrefix, "-box-").concat(mode));
157
+ return React.createElement('div', {
158
+ className: className,
159
+ style: style
160
+ }, React.cloneElement(child, extraProps));
161
+ })));
162
+ };
163
+
164
+ PageLayout.Box = Box;
165
+ export default PageLayout;