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