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 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; }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
11
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
+
13
+ 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); } }
14
+
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
16
+
17
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
18
+
19
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
+
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
+
23
+ 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); }
24
+
25
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
26
+
27
+ import React, { createRef } from 'react';
28
+ import classnames from 'classnames';
29
+ import { debounce } from 'lodash';
30
+ import { Form, Button, Drawer, Badge } from 'antd';
31
+ import useForm from './useForm';
32
+ import createActions from './createActions';
33
+ import Icon from '../Icon';
34
+ import Field from './Field';
35
+ import { getText as _getText, getLanguage } from '../locale';
36
+ import './index.less';
37
+ var clsPrefix = 'tnt-queryform';
38
+
39
+ var QueryForm =
40
+ /*#__PURE__*/
41
+ function (_React$PureComponent) {
42
+ _inherits(QueryForm, _React$PureComponent);
43
+
44
+ function QueryForm(props) {
45
+ var _this;
46
+
47
+ _classCallCheck(this, QueryForm);
48
+
49
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
50
+ _this.onWindowResize = debounce(function () {
51
+ var current = _this.fieldsRef.current;
52
+
53
+ if (current) {
54
+ setTimeout(function () {
55
+ _this.setState({
56
+ showMore: _this.isFieldsWidthOverflow()
57
+ });
58
+ }, 25);
59
+ }
60
+ }, 50);
61
+
62
+ _this.search = function (params) {
63
+ _this.props.onSearch(_objectSpread({}, _this.form.getValues(), {}, params));
64
+ };
65
+
66
+ _this.onSearch = function () {
67
+ _this.props.onSearch == null ? void 0 : _this.props.onSearch(_this.form.getValues());
68
+ };
69
+
70
+ _this.onReset = function () {
71
+ var _this$props = _this.props,
72
+ initialValues = _this$props.initialValues,
73
+ onReset = _this$props.onReset;
74
+
75
+ _this.form.setValues(_objectSpread({}, initialValues));
76
+
77
+ _this.updateDrawerFieldsValueCount();
78
+
79
+ onReset == null ? void 0 : onReset(initialValues);
80
+ };
81
+
82
+ _this.onToggleExpand = function () {
83
+ _this.setState({
84
+ expanded: !_this.state.expanded
85
+ });
86
+
87
+ _this.props.onToggleExpand == null ? void 0 : _this.props.onToggleExpand(!_this.state.expanded);
88
+ };
89
+
90
+ _this.onShowDrawer = function () {
91
+ _this.setState({
92
+ drawerVisible: true
93
+ });
94
+ };
95
+
96
+ _this.onFieldChange = function (name, value) {
97
+ var values = _this.form.getValues();
98
+
99
+ var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
100
+
101
+ var changedInfo = {
102
+ name: name,
103
+ value: value,
104
+ preValue: values == null ? void 0 : values[name]
105
+ };
106
+ var onChange = _this.props.onChange;
107
+
108
+ _this.form.setData('values', newValues);
109
+
110
+ for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
111
+ rest[_key - 2] = arguments[_key];
112
+ }
113
+
114
+ onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
115
+
116
+ _this.updateDrawerFieldsValueCount(newValues);
117
+ };
118
+
119
+ _this.updateDrawerFieldsValueCount = function () {
120
+ var values = _this.form.getValues();
121
+
122
+ var _this$props2 = _this.props,
123
+ showFieldCount = _this$props2.showFieldCount,
124
+ children = _this$props2.children;
125
+
126
+ if (showFieldCount) {
127
+ var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
128
+ var _cur$props;
129
+
130
+ if (index >= showFieldCount && (values == null ? void 0 : values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name])) {
131
+ acc++;
132
+ }
133
+
134
+ return acc;
135
+ }, 0);
136
+
137
+ if (drawerFieldsValueCount !== _this.state.drawerFieldsValueCount) {
138
+ _this.setState({
139
+ drawerFieldsValueCount: drawerFieldsValueCount
140
+ });
141
+ }
142
+ }
143
+ };
144
+
145
+ var form = props.form,
146
+ _initialValues = props.initialValues,
147
+ _props$showExpand = props.showExpand,
148
+ showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
149
+ renderActions = props.renderActions,
150
+ defaultExpanded = props.defaultExpanded;
151
+ _this.state = {
152
+ showMore: false,
153
+ expanded: defaultExpanded || !showExpand || renderActions ? true : false,
154
+ drawerVisible: false,
155
+ drawerFieldsValueCount: 0
156
+ };
157
+ _this.fieldsRef = createRef();
158
+ _this.formBoxRef = createRef();
159
+ _this.form = form || createActions();
160
+
161
+ _this.form.setData('initialValues', _initialValues);
162
+
163
+ _this.form.setData('values', _objectSpread({}, _initialValues));
164
+
165
+ return _this;
166
+ }
167
+
168
+ _createClass(QueryForm, [{
169
+ key: "render",
170
+ value: function render() {
171
+ var _this2 = this;
172
+
173
+ var _this$props3 = this.props,
174
+ children = _this$props3.children,
175
+ _this$props3$classNam = _this$props3.className,
176
+ className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
177
+ _this$props3$initialV = _this$props3.initialValues,
178
+ initialValues = _this$props3$initialV === void 0 ? {} : _this$props3$initialV,
179
+ renderActions = _this$props3.renderActions,
180
+ _this$props3$showSear = _this$props3.showSearch,
181
+ showSearch = _this$props3$showSear === void 0 ? true : _this$props3$showSear,
182
+ _this$props3$showRese = _this$props3.showReset,
183
+ showReset = _this$props3$showRese === void 0 ? true : _this$props3$showRese,
184
+ showFieldCount = _this$props3.showFieldCount,
185
+ _this$props3$drawerPr = _this$props3.drawerProps,
186
+ drawerProps = _this$props3$drawerPr === void 0 ? {} : _this$props3$drawerPr,
187
+ size = _this$props3.size;
188
+ var extraActions = this.props.extraActions;
189
+ var _this$state = this.state,
190
+ expanded = _this$state.expanded,
191
+ showMore = _this$state.showMore,
192
+ drawerVisible = _this$state.drawerVisible,
193
+ drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
194
+
195
+ var renderFormActions = renderActions || function () {
196
+ return React.createElement(React.Fragment, null, showFieldCount && React.createElement(Badge, {
197
+ count: drawerFieldsValueCount
198
+ }, React.createElement(Button, {
199
+ onClick: _this2.onShowDrawer
200
+ }, React.createElement(Icon, {
201
+ type: "filter"
202
+ }), _this2.getText('moreFiltering'))), showSearch && React.createElement(Button, {
203
+ type: "primary",
204
+ onClick: _this2.onSearch
205
+ }, _this2.getText('search')), showReset && React.createElement(Button, {
206
+ onClick: _this2.onReset
207
+ }, _this2.getText('reset')), showMore && !showFieldCount && React.createElement(Button, {
208
+ className: "expand-link",
209
+ type: "link",
210
+ onClick: _this2.onToggleExpand
211
+ }, _this2.getText(expanded ? 'collapse' : 'expand')), React.Children.map(children, function (child) {
212
+ var _child$props;
213
+
214
+ return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && React.cloneElement(child);
215
+ }));
216
+ };
217
+
218
+ return React.createElement("div", {
219
+ ref: this.formBoxRef,
220
+ className: classnames(clsPrefix, _defineProperty({}, className, className))
221
+ }, React.createElement(Form, {
222
+ layout: "inline",
223
+ className: classnames({
224
+ expanded: !showMore || expanded,
225
+ showMore: showMore
226
+ })
227
+ }, React.createElement("div", {
228
+ ref: this.fieldsRef
229
+ }, React.Children.map(children, function (child, index) {
230
+ var _child$props2;
231
+
232
+ return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && React.cloneElement(child, {
233
+ form: _this2.form,
234
+ initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
235
+ onChange: _this2.onFieldChange
236
+ });
237
+ })), React.createElement("div", {
238
+ className: "".concat(clsPrefix, "-actions")
239
+ }, renderFormActions()), showFieldCount && React.createElement(Drawer, _extends({
240
+ title: this.getText('moreFiltering'),
241
+ visible: drawerVisible,
242
+ onClose: function onClose() {
243
+ return _this2.setState({
244
+ drawerVisible: false
245
+ });
246
+ },
247
+ width: 300,
248
+ size: size,
249
+ getContainer: false
250
+ }, drawerProps, {
251
+ className: classnames("".concat(clsPrefix, "-drawer"), _defineProperty({
252
+ 'large-size': size === 'large'
253
+ }, className, className))
254
+ }), React.Children.map(children, function (child, index) {
255
+ return child && index >= showFieldCount && React.cloneElement(child, {
256
+ form: _this2.form,
257
+ isFieldInDrawer: true,
258
+ initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
259
+ onChange: _this2.onFieldChange,
260
+ onSearch: _this2.onSearch
261
+ });
262
+ }), React.createElement(Button, {
263
+ type: "primary",
264
+ onClick: this.onSearch
265
+ }, this.getText('search')), React.createElement(Button, {
266
+ onClick: this.onReset
267
+ }, this.getText('reset')))), extraActions && React.createElement("div", {
268
+ className: "".concat(clsPrefix, "-extra")
269
+ }, extraActions));
270
+ }
271
+ }, {
272
+ key: "getText",
273
+ value: function getText(key) {
274
+ return _getText(key, this.props.language || getLanguage());
275
+ }
276
+ }, {
277
+ key: "isFieldsWidthOverflow",
278
+ value: function isFieldsWidthOverflow() {
279
+ var current = this.fieldsRef.current;
280
+
281
+ if (current) {
282
+ return current.offsetWidth < [].reduce.call(current.children, function (acc, cur) {
283
+ var marginArray = window.getComputedStyle(cur).margin.split(' ').map(function (str) {
284
+ return parseInt(str, 10);
285
+ });
286
+ acc += cur.offsetWidth + marginArray[1];
287
+ return acc;
288
+ }, 0);
289
+ }
290
+
291
+ return false;
292
+ }
293
+ }, {
294
+ key: "updateFieldHeight",
295
+ value: function updateFieldHeight() {
296
+ var _formBoxRef$current, _formBoxRef$current2, _fieldsRef$current;
297
+
298
+ var formBoxRef = this.formBoxRef,
299
+ fieldsRef = this.fieldsRef;
300
+
301
+ var getFieldHeight = function getFieldHeight() {
302
+ var _current$children;
303
+
304
+ var current = fieldsRef.current;
305
+ var height = '32px';
306
+
307
+ if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
308
+ height = window.getComputedStyle(current.children[0]).height;
309
+ }
310
+
311
+ return height;
312
+ };
313
+
314
+ var queryFormActionsDom = formBoxRef == null ? void 0 : (_formBoxRef$current = formBoxRef.current) == null ? void 0 : _formBoxRef$current.querySelector(".".concat(clsPrefix, "-actions"));
315
+ var queryFormExtraDom = formBoxRef == null ? void 0 : (_formBoxRef$current2 = formBoxRef.current) == null ? void 0 : _formBoxRef$current2.querySelector(".".concat(clsPrefix, "-extra"));
316
+ var formItemsDomList = fieldsRef == null ? void 0 : (_fieldsRef$current = fieldsRef.current) == null ? void 0 : _fieldsRef$current.querySelectorAll('.ant-form-item-control');
317
+ var fieldHeight = getFieldHeight();
318
+ fieldsRef.current.style.height = fieldHeight;
319
+ [queryFormActionsDom, queryFormExtraDom].forEach(function (item) {
320
+ item && Object.assign(item.style, {
321
+ height: fieldHeight,
322
+ lineHeight: fieldHeight
323
+ });
324
+ });
325
+ [].forEach.call(formItemsDomList, function (item) {
326
+ item.style.lineHeight = fieldHeight;
327
+ });
328
+ }
329
+ }, {
330
+ key: "componentDidMount",
331
+ value: function componentDidMount() {
332
+ var current = this.fieldsRef.current;
333
+ var _this$props4 = this.props,
334
+ showFieldCount = _this$props4.showFieldCount,
335
+ _this$props4$showExpa = _this$props4.showExpand,
336
+ showExpand = _this$props4$showExpa === void 0 ? true : _this$props4$showExpa,
337
+ renderActions = _this$props4.renderActions;
338
+ this.updateFieldHeight();
339
+ this.form.on('search', this.search); // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
340
+
341
+ if (!showFieldCount && !showExpand || renderActions) {
342
+ return;
343
+ }
344
+
345
+ if (!showFieldCount) {
346
+ if (current && this.isFieldsWidthOverflow()) {
347
+ this.setState({
348
+ showMore: true
349
+ });
350
+ }
351
+
352
+ window.addEventListener('resize', this.onWindowResize);
353
+ } else {
354
+ this.updateDrawerFieldsValueCount();
355
+ this.form.on('setValues', this.updateDrawerFieldsValueCount);
356
+ this.form.on('setValue', this.updateDrawerFieldsValueCount);
357
+ }
358
+ }
359
+ }, {
360
+ key: "componentWillUnmount",
361
+ value: function componentWillUnmount() {
362
+ window.removeEventListener('resize', this.onWindowResize);
363
+ this.form.off('setValues', this.updateDrawerFieldsValueCount);
364
+ this.form.off('setValue', this.updateDrawerFieldsValueCount);
365
+ this.form.off('search', this.search);
366
+ }
367
+ }]);
368
+
369
+ return QueryForm;
370
+ }(React.PureComponent);
371
+
372
+ ;
373
+ QueryForm.Field = Field;
374
+ QueryForm.useForm = useForm;
375
+ QueryForm.createForm = createActions;
376
+ export default QueryForm;
@@ -0,0 +1,133 @@
1
+ .tnt-queryform {
2
+ display: flex;
3
+
4
+ &-extra {
5
+ line-height: 32px;
6
+ margin-left: 12px;
7
+ & > * {
8
+ margin-left: 8px;
9
+ }
10
+ }
11
+
12
+ &-actions {
13
+ align-items: center;
14
+ display: inline-block;
15
+ height: 32px;
16
+ line-height: 32px;
17
+
18
+ & > *:not(.expand-link) {
19
+ margin-right: 10px;
20
+ }
21
+ & > .expand-link {
22
+ padding: 0;
23
+ margin-right: 0;
24
+ }
25
+ & > .ant-badge {
26
+ .tnt-icon {
27
+ margin-right: 8px;
28
+ }
29
+ }
30
+ }
31
+
32
+ .ant-form {
33
+ display: inline-block;
34
+ margin-bottom: 12px;
35
+ display: flex;
36
+ flex: 1;
37
+ &.ant-form-inline {
38
+ flex-wrap: unset;
39
+ }
40
+
41
+ & > div:nth-child(1) {
42
+ height: 32px;
43
+ overflow: hidden;
44
+ .ant-form-item-label {
45
+ label {
46
+ // bottom: 4px;
47
+ }
48
+ }
49
+ }
50
+
51
+ &.expanded {
52
+ & > div:nth-child(1) {
53
+ height: auto !important;
54
+ }
55
+ }
56
+
57
+ &.showMore {
58
+ & > div:nth-child(1) {
59
+ .ant-form-item {
60
+ margin-bottom: 12px;
61
+ }
62
+ }
63
+ }
64
+
65
+ & > div:nth-child(2) {
66
+ display: flex;
67
+ }
68
+
69
+ &.ant-form-inline .ant-form-item {
70
+ margin-right: 10px;
71
+ display: inline-block;
72
+ }
73
+
74
+ .ant-form-item-control {
75
+ // min-width: 160px;
76
+ line-height: unset;
77
+ .ant-calendar-picker-input {
78
+ padding: 0 11px;
79
+ }
80
+ .ant-form-item-children {
81
+ & > .ant-input,
82
+ & > .ant-input-affix-wrapper {
83
+ width: 160px;
84
+ // width: 200px;
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ &-drawer {
91
+ margin-top: 50px;
92
+ &.large-size {
93
+ margin-top: 60px;
94
+ }
95
+
96
+ &.ant-drawer.ant-drawer-open {
97
+ .ant-drawer-mask {
98
+ opacity: 0;
99
+ background: unset;
100
+ }
101
+ }
102
+ .ant-drawer-body {
103
+ .ant-form-item {
104
+ display: block;
105
+ margin-right: 0;
106
+ margin-bottom: 20px;
107
+ width: 100%;
108
+ }
109
+ .ant-form-item-label {
110
+ display: block;
111
+ text-align: left;
112
+ line-height: 22px;
113
+ margin-bottom: 10px;
114
+ }
115
+ .ant-form-item-control-wrapper,
116
+ .ant-form-item-control,
117
+ .ant-calendar-picker,
118
+ .ant-input {
119
+ min-width: 100%;
120
+ width: 100%;
121
+ }
122
+
123
+ & > .ant-btn {
124
+ display: block;
125
+ width: 100%;
126
+ margin-bottom: 10px;
127
+ &.ant-btn-primary {
128
+ margin-top: 20px;
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,7 @@
1
+ import { useRef } from 'react';
2
+ import createActions from './createActions';
3
+ export default function useForm() {
4
+ var form = useRef(createActions());
5
+ return [form.current];
6
+ }
7
+ ;