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,378 @@
1
+ import "antd/es/spin/style";
2
+ import _Spin from "antd/es/spin";
3
+
4
+ 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); }
5
+
6
+ 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); }
7
+
8
+ 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; }
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+
14
+ 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; }
15
+
16
+ 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; }
17
+
18
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
+
20
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
+
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23
+
24
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
25
+
26
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
+
28
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
+
30
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
+
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
+
34
+ /**
35
+ * @file QueryList
36
+ * @author you.zhang
37
+ */
38
+ import React, { createRef } from 'react';
39
+ import { findDOMNode } from 'react-dom';
40
+ import cn from 'classnames';
41
+ import { get, pickBy, isEmpty, debounce, throttle } from 'lodash';
42
+ import Table from '../Table';
43
+ import { getText, getLanguage } from '../locale';
44
+
45
+ var QueryList =
46
+ /*#__PURE__*/
47
+ function (_React$PureComponent) {
48
+ _inherits(QueryList, _React$PureComponent);
49
+
50
+ function QueryList(props) {
51
+ var _props$scroll;
52
+
53
+ var _this;
54
+
55
+ _classCallCheck(this, QueryList);
56
+
57
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(QueryList).call(this, props));
58
+ _this.onWindowResize = debounce(function () {
59
+ var scroll = _this.state.scroll;
60
+
61
+ _this.setState({
62
+ scroll: _objectSpread({}, scroll, {
63
+ y: window.innerHeight - (_this.initialTop || _this.props.top || 200)
64
+ })
65
+ });
66
+ }, 50);
67
+
68
+ _this.fetchData = function () {
69
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
70
+
71
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
72
+ callback = _ref.callback,
73
+ _ref$showLoading = _ref.showLoading,
74
+ showLoading = _ref$showLoading === void 0 ? true : _ref$showLoading,
75
+ isInterval = _ref.isInterval;
76
+
77
+ var _this$props = _this.props,
78
+ query = _this$props.qlsProps.query,
79
+ defaultExpandAllRows = _this$props.defaultExpandAllRows,
80
+ rowKey = _this$props.rowKey,
81
+ actions = _this$props.actions;
82
+ var pagination = _this.state.pagination;
83
+ var hasPagination = _this.props.pagination !== false;
84
+
85
+ if (hasPagination) {
86
+ params = _objectSpread({
87
+ pageSize: pagination.pageSize,
88
+ current: pagination.current
89
+ }, params);
90
+ }
91
+
92
+ showLoading && _this.setState({
93
+ loading: true
94
+ }); // 当用户操作查询还未得到服务端响应前,不要执行轮询请求时序问题导致覆盖
95
+
96
+ if (!isInterval) {
97
+ _this.isFetching = true;
98
+ }
99
+
100
+ actions.setData('submittedFormData', params);
101
+ return query(pickBy(params, function (val) {
102
+ return val !== '' && val !== null && val !== undefined;
103
+ })).then(function (result) {
104
+ var dataSource = hasPagination ? result.data || [] : result;
105
+
106
+ _this.setState(_objectSpread({
107
+ loading: false,
108
+ dataSource: dataSource,
109
+ pagination: hasPagination ? {
110
+ pageSize: result.pageSize || pagination.pageSize || 10,
111
+ current: result.current || params.current || pagination.current || 1,
112
+ total: result.total || 0
113
+ } : null
114
+ }, defaultExpandAllRows ? {
115
+ expandedRowKeys: dataSource.map(function (row) {
116
+ return row[rowKey];
117
+ })
118
+ } : {}), function () {
119
+ actions.setData('pagination', _this.state.pagination);
120
+ actions.setData('dataSource', _this.state.dataSource);
121
+ });
122
+ })["finally"](function () {
123
+ _this.isFetching = false;
124
+ showLoading && _this.setState({
125
+ loading: false
126
+ });
127
+ callback && callback();
128
+ });
129
+ };
130
+
131
+ _this.updateDataSource = function (dataSource) {
132
+ _this.setState({
133
+ dataSource: dataSource
134
+ });
135
+
136
+ _this.props.actions.setData('dataSource', dataSource);
137
+ };
138
+
139
+ _this.updatePagination = function (pagination) {
140
+ _this.setState({
141
+ pagination: pagination
142
+ });
143
+
144
+ _this.props.actions.setData('pagination', pagination);
145
+ };
146
+
147
+ _this.onFormChange = function (values) {
148
+ _this.formData = pickBy(_objectSpread({}, values, {
149
+ sorter: get(_this.formData, 'sorter'),
150
+ filters: get(_this.formData, 'filters')
151
+ }), function (val) {
152
+ return val !== undefined;
153
+ });
154
+ };
155
+
156
+ _this.onSearch = function (values) {
157
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
158
+ callback = _ref2.callback,
159
+ _ref2$showLoading = _ref2.showLoading,
160
+ showLoading = _ref2$showLoading === void 0 ? true : _ref2$showLoading;
161
+
162
+ _this.formData = _objectSpread({}, _this.formData, {}, values); // this.props.actions.setData('formData', this.formData);
163
+
164
+ return _this.fetchData(_this.formData, {
165
+ callback: callback,
166
+ showLoading: showLoading
167
+ });
168
+ };
169
+
170
+ _this.onTableChange = function (pagination, filters, sorter) {
171
+ var _this$props2 = _this.props,
172
+ actions = _this$props2.actions,
173
+ localPagination = _this$props2.localPagination;
174
+ var tableParams = {
175
+ pageSize: pagination.pageSize,
176
+ current: pagination.current,
177
+ filters: isEmpty(filters) ? undefined : filters,
178
+ sorter: isEmpty(sorter) ? undefined : sorter
179
+ };
180
+ console.log('onTableChange...', actions.getSubmittedFormData(), _this.formData);
181
+ Object.assign(_this.formData, tableParams); // 排序变化暂时不处理,因为有时可能是前端sorter不需要走请求
182
+ // 所以暂时排序有使用者自己处理
183
+
184
+ if (!localPagination) {
185
+ _this.fetchData(_objectSpread({}, actions.getSubmittedFormData(), {}, tableParams));
186
+
187
+ return;
188
+ }
189
+
190
+ var dataSource = _this.state.dataSource; // 前端本地分页
191
+
192
+ if (localPagination) {
193
+ _this.setState({
194
+ dataSource: dataSource,
195
+ pagination: {
196
+ current: pagination.current,
197
+ pageSize: pagination.pageSize,
198
+ total: pagination.total
199
+ }
200
+ }, function () {
201
+ actions.setData('formData', _this.formData);
202
+ actions.setData('pagination', _this.state.pagination);
203
+ });
204
+ }
205
+ };
206
+
207
+ _this.onTableBodyScroll = throttle(function (evt) {
208
+ console.log('onTableBodyScroll', evt.target.scrollTop);
209
+
210
+ _this.updateIsScrollToBottom(evt.target);
211
+ }, 50);
212
+
213
+ _this.updateIsScrollToBottom = function (tableBody) {
214
+ var isScrollToBottom = function isScrollToBottom(tableBody) {
215
+ var scrollHeight = tableBody.scrollHeight,
216
+ scrollTop = tableBody.scrollTop,
217
+ offsetHeight = tableBody.offsetHeight;
218
+ return scrollHeight === scrollTop + offsetHeight;
219
+ };
220
+
221
+ _this.setState({
222
+ hasScrollToBottom: isScrollToBottom(tableBody)
223
+ });
224
+ };
225
+
226
+ _this.state = {
227
+ loading: false,
228
+ dataSource: [],
229
+ pagination: {
230
+ // pageSize: 20,
231
+ current: 1,
232
+ total: 0
233
+ },
234
+ scroll: props.scroll,
235
+ hasScrollToBottom: !((_props$scroll = props.scroll) == null ? void 0 : _props$scroll.y)
236
+ };
237
+ _this.tableRef = createRef();
238
+ var _actions = props.actions;
239
+
240
+ _actions.on('search', _this.onSearch);
241
+
242
+ _actions.on('setTableDataSource', _this.updateDataSource);
243
+
244
+ _actions.on('setPagination', _this.updatePagination);
245
+
246
+ _actions.on('setFormData', _this.onFormChange);
247
+
248
+ return _this;
249
+ }
250
+
251
+ _createClass(QueryList, [{
252
+ key: "render",
253
+ value: function render() {
254
+ var _this$props3 = this.props,
255
+ columns = _this$props3.columns,
256
+ children = _this$props3.children,
257
+ pagination = _this$props3.pagination,
258
+ _this$props3$localPag = _this$props3.localPagination,
259
+ localPagination = _this$props3$localPag === void 0 ? false : _this$props3$localPag,
260
+ _this$props3$paginati = _this$props3.paginationSticky,
261
+ paginationSticky = _this$props3$paginati === void 0 ? false : _this$props3$paginati,
262
+ _this$props3$classNam = _this$props3.className,
263
+ className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
264
+ qlsProps = _this$props3.qlsProps,
265
+ rest = _objectWithoutProperties(_this$props3, ["columns", "children", "pagination", "localPagination", "paginationSticky", "className", "qlsProps"]);
266
+
267
+ var _this$state = this.state,
268
+ dataSource = _this$state.dataSource,
269
+ loading = _this$state.loading,
270
+ _this$state$expandedR = _this$state.expandedRowKeys,
271
+ expandedRowKeys = _this$state$expandedR === void 0 ? [] : _this$state$expandedR,
272
+ scroll = _this$state.scroll,
273
+ hasScrollToBottom = _this$state.hasScrollToBottom;
274
+ var hasPagination = typeof pagination !== 'undefined' ? pagination : true;
275
+
276
+ var paginationInfo = _objectSpread({}, this.state.pagination, {
277
+ // size: 'small',
278
+ showQuickJumper: true,
279
+ showSizeChanger: true,
280
+ showTotal: function showTotal(total) {
281
+ return getText('totalRecords', getLanguage(), total);
282
+ }
283
+ }, pagination || {});
284
+
285
+ var expandProps = _objectSpread({}, rest.defaultExpandAllRows ? {
286
+ expandedRowKeys: expandedRowKeys,
287
+ onExpandedRowsChange: this.onExpandedRowsChange
288
+ } : {});
289
+
290
+ return React.createElement("div", {
291
+ className: cn("tnt-querylistscene-list ".concat(className), {
292
+ paginationSticky: paginationSticky,
293
+ hasScrollToBottom: hasScrollToBottom
294
+ })
295
+ }, React.createElement(_Spin, {
296
+ spinning: loading
297
+ }, React.createElement(Table, _extends({
298
+ ref: this.tableRef
299
+ }, expandProps, rest, columns ? {
300
+ columns: columns
301
+ } : {}, {
302
+ scroll: scroll,
303
+ dataSource: dataSource,
304
+ pagination: hasPagination ? paginationInfo : localPagination,
305
+ onChange: this.onTableChange
306
+ }), !columns && children)));
307
+ }
308
+ }, {
309
+ key: "componentDidMount",
310
+ value: function componentDidMount() {
311
+ var _this2 = this,
312
+ _this$state$scroll;
313
+
314
+ var _this$props4 = this.props,
315
+ qlsProps = _this$props4.qlsProps,
316
+ actions = _this$props4.actions;
317
+ this.formData = _objectSpread({}, actions.getFormData() || {}, {}, qlsProps.memory ? actions.getPagination() : {});
318
+
319
+ if (!qlsProps.initSearch) {
320
+ // 默认进来不请求
321
+ this.fetchData(this.formData)["finally"](function () {
322
+ // 轮询
323
+ if (qlsProps.interval && !_this2.isUnmounted) {
324
+ var doIntervalQuery = function doIntervalQuery(ms) {
325
+ // 组件unmounted后,不执行轮训逻辑
326
+ if (!_this2.isUnmounted) {
327
+ _this2.timmer = setTimeout(function () {
328
+ // 如果有查询请求还未结束,则该次轮询不执行,重新设置下次轮询
329
+ if (!_this2.isFetching) {
330
+ _this2.fetchData(actions.getSubmittedFormData(), {
331
+ isInterval: true,
332
+ showLoading: false
333
+ }).then(function () {
334
+ doIntervalQuery(ms);
335
+ });
336
+ } else {
337
+ doIntervalQuery(ms);
338
+ }
339
+ }, ms);
340
+ }
341
+ };
342
+
343
+ doIntervalQuery(qlsProps.interval);
344
+ }
345
+ });
346
+ }
347
+
348
+ if ((_this$state$scroll = this.state.scroll) == null ? void 0 : _this$state$scroll.y) {
349
+ window.addEventListener('resize', this.onWindowResize);
350
+
351
+ if (this.tableRef.current) {
352
+ // table内垂直滚动,需要动态设置分页组件上阴影样式
353
+ var tableBody = findDOMNode(this.tableRef.current).querySelector('.ant-table-body');
354
+ this.initialTop = window.innerHeight - this.state.scroll.y;
355
+ this.updateIsScrollToBottom(tableBody);
356
+ tableBody.addEventListener('scroll', this.onTableBodyScroll);
357
+ }
358
+ }
359
+ }
360
+ }, {
361
+ key: "componentWillUnmount",
362
+ value: function componentWillUnmount() {
363
+ var actions = this.props.actions;
364
+ this.isUnmounted = true;
365
+ actions.removeListener('search', this.onSearch);
366
+ actions.removeListener('setTableDataSource', this.updateDataSource);
367
+ actions.removeListener('setPagination', this.updatePagination);
368
+ actions.removeListener('setFormData', this.onFormChange);
369
+ window.removeEventListener('resize', this.onWindowResize);
370
+ this.timmer && clearTimeout(this.timmer);
371
+ }
372
+ }]);
373
+
374
+ return QueryList;
375
+ }(React.PureComponent);
376
+
377
+ export { QueryList as default };
378
+ ;
@@ -0,0 +1,166 @@
1
+ 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); }
2
+
3
+ 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); }
4
+
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+
13
+ 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; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
18
+
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
20
+
21
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
22
+
23
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
+
25
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
+
27
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
28
+
29
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
30
+
31
+ import React from 'react';
32
+ import classnames from 'classnames';
33
+ import Form from '../QueryForm';
34
+ var clsPrefix = 'tnt-querylistscene-queryform';
35
+
36
+ var QueryForm =
37
+ /*#__PURE__*/
38
+ function (_React$PureComponent) {
39
+ _inherits(QueryForm, _React$PureComponent);
40
+
41
+ function QueryForm(props) {
42
+ var _this;
43
+
44
+ _classCallCheck(this, QueryForm);
45
+
46
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
47
+
48
+ _this.onSearch = function () {
49
+ var _this$props = _this.props,
50
+ onSearch = _this$props.onSearch,
51
+ actions = _this$props.actions;
52
+ var values = actions.getFormData();
53
+
54
+ var params = _objectSpread({}, values, {
55
+ current: 1
56
+ });
57
+
58
+ actions.setData('formData', values);
59
+ onSearch && onSearch(params);
60
+ actions.emit('search', params);
61
+ };
62
+
63
+ _this.onReset = function () {
64
+ var _this$props2 = _this.props,
65
+ initialValues = _this$props2.initialValues,
66
+ onReset = _this$props2.onReset,
67
+ actions = _this$props2.actions;
68
+ actions.setFormData(initialValues, false);
69
+ onReset && onReset(initialValues);
70
+
71
+ _this.onSearch();
72
+ };
73
+
74
+ _this.onChange = function (newValues, changedInfo) {
75
+ var _this$props3 = _this.props,
76
+ onChange = _this$props3.onChange,
77
+ actions = _this$props3.actions;
78
+
79
+ for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
80
+ rest[_key - 2] = arguments[_key];
81
+ }
82
+
83
+ onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
84
+ actions.setFormData(newValues, false);
85
+ };
86
+
87
+ _this.setFormData = function (data, needSearch) {
88
+ var actions = _this.props.actions;
89
+ actions.setData('formData', data);
90
+
91
+ _this.form.setValues(data);
92
+
93
+ needSearch && _this.onSearch();
94
+ };
95
+
96
+ _this.resetFormData = function (needSearch) {
97
+ var _this$props4 = _this.props,
98
+ initialValues = _this$props4.initialValues,
99
+ actions = _this$props4.actions;
100
+ actions.setFormData(initialValues, needSearch);
101
+
102
+ _this.form.resetValues();
103
+ };
104
+
105
+ var _actions = props.actions,
106
+ form = props.form;
107
+ _this.form = form || Form.createForm();
108
+
109
+ _actions.on('setFormData', _this.setFormData);
110
+
111
+ _actions.on('resetFormData', _this.resetFormData);
112
+
113
+ return _this;
114
+ }
115
+
116
+ _createClass(QueryForm, [{
117
+ key: "render",
118
+ value: function render() {
119
+ var _this$props5 = this.props,
120
+ className = _this$props5.className,
121
+ actions = _this$props5.actions,
122
+ extraActions = _this$props5.extraActions,
123
+ extralActions = _this$props5.extralActions,
124
+ qlsProps = _this$props5.qlsProps,
125
+ props = _objectWithoutProperties(_this$props5, ["className", "actions", "extraActions", "extralActions", "qlsProps"]);
126
+
127
+ return React.createElement(Form, _extends({}, props, {
128
+ form: this.form,
129
+ className: classnames(clsPrefix, _defineProperty({}, className, className)) // 前期拼写错误,导致需要兼容错误的api
130
+ ,
131
+ extraActions: extraActions || extralActions,
132
+ onChange: this.onChange,
133
+ onSearch: this.onSearch,
134
+ onReset: this.onReset
135
+ }));
136
+ }
137
+ }, {
138
+ key: "componentDidMount",
139
+ value: function componentDidMount() {
140
+ var _this$props6 = this.props,
141
+ _this$props6$initialV = _this$props6.initialValues,
142
+ initialValues = _this$props6$initialV === void 0 ? {} : _this$props6$initialV,
143
+ actions = _this$props6.actions,
144
+ qlsProps = _this$props6.qlsProps;
145
+
146
+ if (qlsProps.memory) {
147
+ actions.setFormData(_objectSpread({}, initialValues, {}, actions.getFormData()), false);
148
+ } else {
149
+ actions.setData('formData', initialValues);
150
+ }
151
+ }
152
+ }, {
153
+ key: "componentWillUnmount",
154
+ value: function componentWillUnmount() {
155
+ var actions = this.props.actions;
156
+ actions.removeListener('setFormData', this.setFormData);
157
+ actions.removeListener('resetFormData', this.resetFormData);
158
+ }
159
+ }]);
160
+
161
+ return QueryForm;
162
+ }(React.PureComponent);
163
+
164
+ export { QueryForm as default };
165
+ ;
166
+ QueryForm.Field = Form.Field;
@@ -0,0 +1,76 @@
1
+ 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); }
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
+
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
+
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
12
+
13
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
+
15
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
+
17
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
18
+
19
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20
+
21
+ import React from 'react';
22
+ import cn from 'classnames';
23
+ import Title from './Title';
24
+ import Toolbar from './Toolbar';
25
+ import createActions from './createActions';
26
+
27
+ var QueryListScene =
28
+ /*#__PURE__*/
29
+ function (_React$Component) {
30
+ _inherits(QueryListScene, _React$Component);
31
+
32
+ function QueryListScene(props) {
33
+ var _this;
34
+
35
+ _classCallCheck(this, QueryListScene);
36
+
37
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(QueryListScene).call(this, props));
38
+ _this.actions = props.actions || createActions();
39
+ return _this;
40
+ }
41
+
42
+ _createClass(QueryListScene, [{
43
+ key: "render",
44
+ value: function render() {
45
+ var _cn,
46
+ _this2 = this;
47
+
48
+ var _this$props = this.props,
49
+ title = _this$props.title,
50
+ children = _this$props.children,
51
+ size = _this$props.size,
52
+ _this$props$className = _this$props.className,
53
+ className = _this$props$className === void 0 ? '' : _this$props$className;
54
+ var hasToolbar = [].some.call(children || [], function (child) {
55
+ return (child == null ? void 0 : child.type) === Toolbar;
56
+ });
57
+ return React.createElement("div", {
58
+ className: cn('tnt-querylistscene', (_cn = {}, _defineProperty(_cn, className, className), _defineProperty(_cn, 'large-size', size === 'large'), _defineProperty(_cn, "hasToolbar", hasToolbar), _cn))
59
+ }, title && React.createElement(Title, {
60
+ title: title,
61
+ size: size
62
+ }), React.createElement("div", {
63
+ className: "tnt-querylistscene-content"
64
+ }, React.Children.map(children, function (child) {
65
+ return child && React.cloneElement(child, {
66
+ qlsProps: _this2.props,
67
+ actions: _this2.actions
68
+ });
69
+ })));
70
+ }
71
+ }]);
72
+
73
+ return QueryListScene;
74
+ }(React.Component);
75
+
76
+ export { QueryListScene as default };