tntd 1.3.64 → 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.
- package/.eslintignore +2 -1
- package/babel.config.js +12 -2
- package/dist/0645cf743e4e44ca9da321d689897f07.png +0 -0
- package/dist/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
- package/dist/1.tntd.js +12 -0
- package/dist/1d0b52448de217857b270af807e9360d.png +0 -0
- package/dist/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
- package/dist/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
- package/dist/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
- package/dist/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
- package/dist/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
- package/dist/4abe481e130d7be0574e45573de8beb7.png +0 -0
- package/dist/95ee2260a509cd630d89c5367ed1973b.png +0 -0
- package/dist/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
- package/dist/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
- package/dist/stats.json +45855 -0
- package/dist/tntd.css +1 -0
- package/dist/tntd.js +15 -0
- package/es/ArrayInput/README.md +129 -0
- package/es/ArrayInput/icon.js +24 -0
- package/es/ArrayInput/index.js +282 -0
- package/es/ArrayInput/index.less +20 -0
- package/es/AuthContext.js +4 -0
- package/es/Columns/README.md +149 -0
- package/es/Columns/index.js +86 -0
- package/es/Columns/index.less +75 -0
- package/es/DevelopmentLogin/LoginModal.js +126 -0
- package/es/DevelopmentLogin/README.md +49 -0
- package/es/DevelopmentLogin/index.js +40 -0
- package/es/Ellipsis/README.md +104 -0
- package/es/Ellipsis/Svg/CopySVG.js +63 -0
- package/es/Ellipsis/Svg/TickSVG.js +41 -0
- package/es/Ellipsis/index.js +143 -0
- package/es/Ellipsis/index.less +56 -0
- package/es/Handle/README.md +104 -0
- package/es/Handle/index.js +92 -0
- package/es/Handle/index.less +9 -0
- package/es/Icon/README.md +119 -0
- package/es/Icon/fonts/demo.css +539 -0
- package/es/Icon/fonts/demo_index.html +3345 -0
- package/es/Icon/fonts/iconfont.css +569 -0
- package/es/Icon/fonts/iconfont.eot +0 -0
- package/es/Icon/fonts/iconfont.js +41 -0
- package/es/Icon/fonts/iconfont.json +975 -0
- package/es/Icon/fonts/iconfont.svg +440 -0
- package/es/Icon/fonts/iconfont.ttf +0 -0
- package/es/Icon/fonts/iconfont.woff +0 -0
- package/es/Icon/fonts/iconfont.woff2 +0 -0
- package/es/Icon/iconList.js +1 -0
- package/es/Icon/index.js +26 -0
- package/es/Icon/index.less +9 -0
- package/es/Img/Contain.js +69 -0
- package/es/Img/Cover.js +126 -0
- package/es/Img/README.md +131 -0
- package/es/Img/index.js +76 -0
- package/es/Layout/ActionsContext.js +3 -0
- package/es/Layout/AppList.js +233 -0
- package/es/Layout/Application.js +115 -0
- package/es/Layout/Avatar.js +116 -0
- package/es/Layout/CompatibleLanguage.js +179 -0
- package/es/Layout/EnterpriseLayout/Avatar.js +144 -0
- package/es/Layout/EnterpriseLayout/Language.js +81 -0
- package/es/Layout/EnterpriseLayout/Theme.js +77 -0
- package/es/Layout/EnterpriseLayout/index.js +31 -0
- package/es/Layout/GlobalNavigation/NavigationPopup.js +396 -0
- package/es/Layout/GlobalNavigation/index.js +137 -0
- package/es/Layout/Header.js +95 -0
- package/es/Layout/HeaderActions.js +107 -0
- package/es/Layout/HeaderNavs.js +93 -0
- package/es/Layout/HeaderTabs.js +264 -0
- package/es/Layout/Iconfont.js +4 -0
- package/es/Layout/Language.js +81 -0
- package/es/Layout/Layout.js +234 -0
- package/es/Layout/Logo.js +86 -0
- package/es/Layout/OrgAppList.js +310 -0
- package/es/Layout/README.md +783 -0
- package/es/Layout/SideMenu.js +340 -0
- package/es/Layout/Theme.js +107 -0
- package/es/Layout/checkAuth.js +29 -0
- package/es/Layout/createActions.js +39 -0
- package/es/Layout/images/avatar/empty.png +0 -0
- package/es/Layout/images/avatar/female1.png +0 -0
- package/es/Layout/images/avatar/female2.png +0 -0
- package/es/Layout/images/avatar/female3.png +0 -0
- package/es/Layout/images/avatar/female4.png +0 -0
- package/es/Layout/images/avatar/female5.png +0 -0
- package/es/Layout/images/avatar/female6.png +0 -0
- package/es/Layout/images/avatar/male1.png +0 -0
- package/es/Layout/images/avatar/male2.png +0 -0
- package/es/Layout/images/avatar/male3.png +0 -0
- package/es/Layout/images/avatar/male4.png +0 -0
- package/es/Layout/images/avatar/male5.png +0 -0
- package/es/Layout/images/avatar/male6.png +0 -0
- package/es/Layout/images/index.js +35 -0
- package/es/Layout/images/logo/baldur.svg +14 -0
- package/es/Layout/images/logo/bi.svg +14 -0
- package/es/Layout/images/logo/bridge.svg +15 -0
- package/es/Layout/images/logo/convert.svg +18 -0
- package/es/Layout/images/logo/dataocean.svg +31 -0
- package/es/Layout/images/logo/default.svg +19 -0
- package/es/Layout/images/logo/dispatch.svg +14 -0
- package/es/Layout/images/logo/graph.svg +26 -0
- package/es/Layout/images/logo/handle.svg +10 -0
- package/es/Layout/images/logo/indicator.svg +41 -0
- package/es/Layout/images/logo/kafka.svg +12 -0
- package/es/Layout/images/logo/logo-custom.svg +13 -0
- package/es/Layout/images/logo/model.svg +17 -0
- package/es/Layout/images/logo/mysql.svg +15 -0
- package/es/Layout/images/logo/orion.svg +24 -0
- package/es/Layout/images/logo/salaxy.svg +11 -0
- package/es/Layout/images/logo/storage.svg +16 -0
- package/es/Layout/images/logo/tnt_cli_identify.svg +19 -0
- package/es/Layout/images/logo/turing.svg +35 -0
- package/es/Layout/images/theme/theme1.svg +35 -0
- package/es/Layout/images/theme/theme2.svg +33 -0
- package/es/Layout/index.js +122 -0
- package/es/Layout/paaslayout/CompactSideMenu.js +167 -0
- package/es/Layout/paaslayout/Header.js +77 -0
- package/es/Layout/paaslayout/Logo.js +22 -0
- package/es/Layout/paaslayout/SideMenu.js +168 -0
- package/es/Layout/paaslayout/index.js +235 -0
- package/es/Layout/storage.js +47 -0
- package/es/Layout/utils.js +136 -0
- package/es/LoadingButton/README.md +75 -0
- package/es/LoadingButton/index.js +45 -0
- package/es/Modal/README.md +59 -0
- package/es/Modal/index.js +96 -0
- package/es/Modal/index.less +86 -0
- package/es/Page/Box.js +74 -0
- package/es/Page/README.md +180 -0
- package/es/Page/index.js +165 -0
- package/es/Page/index.less +144 -0
- package/es/Page/utils.js +23 -0
- package/es/QueryForm/Field/Checkbox.js +21 -0
- package/es/QueryForm/Field/Select.js +80 -0
- package/es/QueryForm/Field/SelectInput.js +92 -0
- package/es/QueryForm/Field/fieldsMap.js +32 -0
- package/es/QueryForm/Field/index.js +157 -0
- package/es/QueryForm/README.md +512 -0
- package/es/QueryForm/createActions.js +53 -0
- package/es/QueryForm/index.js +384 -0
- package/es/QueryForm/index.less +133 -0
- package/es/QueryForm/useForm.js +7 -0
- package/es/QueryListScene/List.js +378 -0
- package/es/QueryListScene/QueryForm.js +166 -0
- package/es/QueryListScene/QueryListScene.js +76 -0
- package/es/QueryListScene/README.md +790 -0
- package/es/QueryListScene/Title.js +12 -0
- package/es/QueryListScene/Toolbar.js +20 -0
- package/es/QueryListScene/createActions.js +72 -0
- package/es/QueryListScene/index.js +19 -0
- package/es/QueryListScene/index.less +97 -0
- package/es/QueryListScene/useActions.js +7 -0
- package/es/Select/DropDownWrap.js +116 -0
- package/es/Select/README.md +68 -0
- package/es/Select/index.js +622 -0
- package/es/Table/README.md +109 -0
- package/es/Table/ResizableTable/index.js +110 -0
- package/es/Table/ResizableTable/index.less +36 -0
- package/es/Table/index.js +35 -0
- package/es/Title/README.md +106 -0
- package/es/Title/index.js +40 -0
- package/es/Title/index.less +170 -0
- package/es/index.js +19 -0
- package/es/locale.js +60 -0
- package/package.json +4 -1
- package/scripts/postbuild.sh +5 -0
- package/doc-scripts.config.js +0 -37
- package/doc-scripts.renderer.js +0 -11
- package/docs/README.md +0 -1643
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import "antd/es/form/style";
|
|
2
|
+
import _Form from "antd/es/form";
|
|
3
|
+
import "antd/es/drawer/style";
|
|
4
|
+
import _Drawer from "antd/es/drawer";
|
|
5
|
+
import "antd/es/badge/style";
|
|
6
|
+
import _Badge from "antd/es/badge";
|
|
7
|
+
import "antd/es/button/style";
|
|
8
|
+
import _Button from "antd/es/button";
|
|
9
|
+
|
|
10
|
+
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); }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
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); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
import React, { createRef } from 'react';
|
|
37
|
+
import classnames from 'classnames';
|
|
38
|
+
import { debounce } from 'lodash';
|
|
39
|
+
import useForm from './useForm';
|
|
40
|
+
import createActions from './createActions';
|
|
41
|
+
import Icon from '../Icon';
|
|
42
|
+
import Field from './Field';
|
|
43
|
+
import { getText as _getText, getLanguage } from '../locale';
|
|
44
|
+
import './index.less';
|
|
45
|
+
var clsPrefix = 'tnt-queryform';
|
|
46
|
+
|
|
47
|
+
var QueryForm =
|
|
48
|
+
/*#__PURE__*/
|
|
49
|
+
function (_React$PureComponent) {
|
|
50
|
+
_inherits(QueryForm, _React$PureComponent);
|
|
51
|
+
|
|
52
|
+
function QueryForm(props) {
|
|
53
|
+
var _this;
|
|
54
|
+
|
|
55
|
+
_classCallCheck(this, QueryForm);
|
|
56
|
+
|
|
57
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
|
|
58
|
+
_this.onWindowResize = debounce(function () {
|
|
59
|
+
var current = _this.fieldsRef.current;
|
|
60
|
+
|
|
61
|
+
if (current) {
|
|
62
|
+
setTimeout(function () {
|
|
63
|
+
_this.setState({
|
|
64
|
+
showMore: _this.isFieldsWidthOverflow()
|
|
65
|
+
});
|
|
66
|
+
}, 25);
|
|
67
|
+
}
|
|
68
|
+
}, 50);
|
|
69
|
+
|
|
70
|
+
_this.search = function (params) {
|
|
71
|
+
_this.props.onSearch(_objectSpread({}, _this.form.getValues(), {}, params));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
_this.onSearch = function () {
|
|
75
|
+
_this.props.onSearch == null ? void 0 : _this.props.onSearch(_this.form.getValues());
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
_this.onReset = function () {
|
|
79
|
+
var _this$props = _this.props,
|
|
80
|
+
initialValues = _this$props.initialValues,
|
|
81
|
+
onReset = _this$props.onReset;
|
|
82
|
+
|
|
83
|
+
_this.form.setValues(_objectSpread({}, initialValues));
|
|
84
|
+
|
|
85
|
+
_this.updateDrawerFieldsValueCount();
|
|
86
|
+
|
|
87
|
+
onReset == null ? void 0 : onReset(initialValues);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
_this.onToggleExpand = function () {
|
|
91
|
+
_this.setState({
|
|
92
|
+
expanded: !_this.state.expanded
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
_this.props.onToggleExpand == null ? void 0 : _this.props.onToggleExpand(!_this.state.expanded);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
_this.onShowDrawer = function () {
|
|
99
|
+
_this.setState({
|
|
100
|
+
drawerVisible: true
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
_this.onFieldChange = function (name, value) {
|
|
105
|
+
var values = _this.form.getValues();
|
|
106
|
+
|
|
107
|
+
var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
|
|
108
|
+
|
|
109
|
+
var changedInfo = {
|
|
110
|
+
name: name,
|
|
111
|
+
value: value,
|
|
112
|
+
preValue: values == null ? void 0 : values[name]
|
|
113
|
+
};
|
|
114
|
+
var onChange = _this.props.onChange;
|
|
115
|
+
|
|
116
|
+
_this.form.setData('values', newValues);
|
|
117
|
+
|
|
118
|
+
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
119
|
+
rest[_key - 2] = arguments[_key];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
|
|
123
|
+
|
|
124
|
+
_this.updateDrawerFieldsValueCount(newValues);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
_this.updateDrawerFieldsValueCount = function () {
|
|
128
|
+
var values = _this.form.getValues();
|
|
129
|
+
|
|
130
|
+
var _this$props2 = _this.props,
|
|
131
|
+
showFieldCount = _this$props2.showFieldCount,
|
|
132
|
+
children = _this$props2.children;
|
|
133
|
+
|
|
134
|
+
if (showFieldCount) {
|
|
135
|
+
var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
|
|
136
|
+
var _cur$props;
|
|
137
|
+
|
|
138
|
+
if (index >= showFieldCount && (values == null ? void 0 : values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name])) {
|
|
139
|
+
acc++;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return acc;
|
|
143
|
+
}, 0);
|
|
144
|
+
|
|
145
|
+
if (drawerFieldsValueCount !== _this.state.drawerFieldsValueCount) {
|
|
146
|
+
_this.setState({
|
|
147
|
+
drawerFieldsValueCount: drawerFieldsValueCount
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
var form = props.form,
|
|
154
|
+
_initialValues = props.initialValues,
|
|
155
|
+
_props$showExpand = props.showExpand,
|
|
156
|
+
showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
|
|
157
|
+
renderActions = props.renderActions,
|
|
158
|
+
defaultExpanded = props.defaultExpanded;
|
|
159
|
+
_this.state = {
|
|
160
|
+
showMore: false,
|
|
161
|
+
expanded: defaultExpanded || !showExpand || renderActions ? true : false,
|
|
162
|
+
drawerVisible: false,
|
|
163
|
+
drawerFieldsValueCount: 0
|
|
164
|
+
};
|
|
165
|
+
_this.fieldsRef = createRef();
|
|
166
|
+
_this.formBoxRef = createRef();
|
|
167
|
+
_this.form = form || createActions();
|
|
168
|
+
|
|
169
|
+
_this.form.setData('initialValues', _initialValues);
|
|
170
|
+
|
|
171
|
+
_this.form.setData('values', _objectSpread({}, _initialValues));
|
|
172
|
+
|
|
173
|
+
return _this;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
_createClass(QueryForm, [{
|
|
177
|
+
key: "render",
|
|
178
|
+
value: function render() {
|
|
179
|
+
var _this2 = this;
|
|
180
|
+
|
|
181
|
+
var _this$props3 = this.props,
|
|
182
|
+
children = _this$props3.children,
|
|
183
|
+
_this$props3$classNam = _this$props3.className,
|
|
184
|
+
className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
|
|
185
|
+
_this$props3$initialV = _this$props3.initialValues,
|
|
186
|
+
initialValues = _this$props3$initialV === void 0 ? {} : _this$props3$initialV,
|
|
187
|
+
renderActions = _this$props3.renderActions,
|
|
188
|
+
_this$props3$showSear = _this$props3.showSearch,
|
|
189
|
+
showSearch = _this$props3$showSear === void 0 ? true : _this$props3$showSear,
|
|
190
|
+
_this$props3$showRese = _this$props3.showReset,
|
|
191
|
+
showReset = _this$props3$showRese === void 0 ? true : _this$props3$showRese,
|
|
192
|
+
showFieldCount = _this$props3.showFieldCount,
|
|
193
|
+
_this$props3$drawerPr = _this$props3.drawerProps,
|
|
194
|
+
drawerProps = _this$props3$drawerPr === void 0 ? {} : _this$props3$drawerPr,
|
|
195
|
+
size = _this$props3.size;
|
|
196
|
+
var extraActions = this.props.extraActions;
|
|
197
|
+
var _this$state = this.state,
|
|
198
|
+
expanded = _this$state.expanded,
|
|
199
|
+
showMore = _this$state.showMore,
|
|
200
|
+
drawerVisible = _this$state.drawerVisible,
|
|
201
|
+
drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
|
|
202
|
+
|
|
203
|
+
var renderFormActions = renderActions || function () {
|
|
204
|
+
return React.createElement(React.Fragment, null, showFieldCount && React.createElement(_Badge, {
|
|
205
|
+
count: drawerFieldsValueCount
|
|
206
|
+
}, React.createElement(_Button, {
|
|
207
|
+
onClick: _this2.onShowDrawer
|
|
208
|
+
}, React.createElement(Icon, {
|
|
209
|
+
type: "filter"
|
|
210
|
+
}), _this2.getText('moreFiltering'))), showSearch && React.createElement(_Button, {
|
|
211
|
+
type: "primary",
|
|
212
|
+
onClick: _this2.onSearch
|
|
213
|
+
}, _this2.getText('search')), showReset && React.createElement(_Button, {
|
|
214
|
+
onClick: _this2.onReset
|
|
215
|
+
}, _this2.getText('reset')), showMore && !showFieldCount && React.createElement(_Button, {
|
|
216
|
+
className: "expand-link",
|
|
217
|
+
type: "link",
|
|
218
|
+
onClick: _this2.onToggleExpand
|
|
219
|
+
}, _this2.getText(expanded ? 'collapse' : 'expand')), React.Children.map(children, function (child) {
|
|
220
|
+
var _child$props;
|
|
221
|
+
|
|
222
|
+
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && React.cloneElement(child);
|
|
223
|
+
}));
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
return React.createElement("div", {
|
|
227
|
+
ref: this.formBoxRef,
|
|
228
|
+
className: classnames(clsPrefix, _defineProperty({}, className, className))
|
|
229
|
+
}, React.createElement(_Form, {
|
|
230
|
+
layout: "inline",
|
|
231
|
+
className: classnames({
|
|
232
|
+
expanded: !showMore || expanded,
|
|
233
|
+
showMore: showMore
|
|
234
|
+
})
|
|
235
|
+
}, React.createElement("div", {
|
|
236
|
+
ref: this.fieldsRef
|
|
237
|
+
}, React.Children.map(children, function (child, index) {
|
|
238
|
+
var _child$props2;
|
|
239
|
+
|
|
240
|
+
return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && React.cloneElement(child, {
|
|
241
|
+
form: _this2.form,
|
|
242
|
+
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
243
|
+
onChange: _this2.onFieldChange
|
|
244
|
+
});
|
|
245
|
+
})), React.createElement("div", {
|
|
246
|
+
className: "".concat(clsPrefix, "-actions")
|
|
247
|
+
}, renderFormActions()), showFieldCount && React.createElement(_Drawer, _extends({
|
|
248
|
+
title: this.getText('moreFiltering'),
|
|
249
|
+
visible: drawerVisible,
|
|
250
|
+
onClose: function onClose() {
|
|
251
|
+
return _this2.setState({
|
|
252
|
+
drawerVisible: false
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
width: 300,
|
|
256
|
+
size: size,
|
|
257
|
+
getContainer: false
|
|
258
|
+
}, drawerProps, {
|
|
259
|
+
className: classnames("".concat(clsPrefix, "-drawer"), _defineProperty({
|
|
260
|
+
'large-size': size === 'large'
|
|
261
|
+
}, className, className))
|
|
262
|
+
}), React.Children.map(children, function (child, index) {
|
|
263
|
+
return child && index >= showFieldCount && React.cloneElement(child, {
|
|
264
|
+
form: _this2.form,
|
|
265
|
+
isFieldInDrawer: true,
|
|
266
|
+
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
267
|
+
onChange: _this2.onFieldChange,
|
|
268
|
+
onSearch: _this2.onSearch
|
|
269
|
+
});
|
|
270
|
+
}), React.createElement(_Button, {
|
|
271
|
+
type: "primary",
|
|
272
|
+
onClick: this.onSearch
|
|
273
|
+
}, this.getText('search')), React.createElement(_Button, {
|
|
274
|
+
onClick: this.onReset
|
|
275
|
+
}, this.getText('reset')))), extraActions && React.createElement("div", {
|
|
276
|
+
className: "".concat(clsPrefix, "-extra")
|
|
277
|
+
}, extraActions));
|
|
278
|
+
}
|
|
279
|
+
}, {
|
|
280
|
+
key: "getText",
|
|
281
|
+
value: function getText(key) {
|
|
282
|
+
return _getText(key, this.props.language || getLanguage());
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
key: "isFieldsWidthOverflow",
|
|
286
|
+
value: function isFieldsWidthOverflow() {
|
|
287
|
+
var current = this.fieldsRef.current;
|
|
288
|
+
|
|
289
|
+
if (current) {
|
|
290
|
+
return current.offsetWidth < [].reduce.call(current.children, function (acc, cur) {
|
|
291
|
+
var marginArray = window.getComputedStyle(cur).margin.split(' ').map(function (str) {
|
|
292
|
+
return parseInt(str, 10);
|
|
293
|
+
});
|
|
294
|
+
acc += cur.offsetWidth + marginArray[1];
|
|
295
|
+
return acc;
|
|
296
|
+
}, 0);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: "updateFieldHeight",
|
|
303
|
+
value: function updateFieldHeight() {
|
|
304
|
+
var _formBoxRef$current, _formBoxRef$current2, _fieldsRef$current;
|
|
305
|
+
|
|
306
|
+
var formBoxRef = this.formBoxRef,
|
|
307
|
+
fieldsRef = this.fieldsRef;
|
|
308
|
+
|
|
309
|
+
var getFieldHeight = function getFieldHeight() {
|
|
310
|
+
var _current$children;
|
|
311
|
+
|
|
312
|
+
var current = fieldsRef.current;
|
|
313
|
+
var height = '32px';
|
|
314
|
+
|
|
315
|
+
if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
|
|
316
|
+
height = window.getComputedStyle(current.children[0]).height;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return height;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
var queryFormActionsDom = formBoxRef == null ? void 0 : (_formBoxRef$current = formBoxRef.current) == null ? void 0 : _formBoxRef$current.querySelector(".".concat(clsPrefix, "-actions"));
|
|
323
|
+
var queryFormExtraDom = formBoxRef == null ? void 0 : (_formBoxRef$current2 = formBoxRef.current) == null ? void 0 : _formBoxRef$current2.querySelector(".".concat(clsPrefix, "-extra"));
|
|
324
|
+
var formItemsDomList = fieldsRef == null ? void 0 : (_fieldsRef$current = fieldsRef.current) == null ? void 0 : _fieldsRef$current.querySelectorAll('.ant-form-item-control');
|
|
325
|
+
var fieldHeight = getFieldHeight();
|
|
326
|
+
fieldsRef.current.style.height = fieldHeight;
|
|
327
|
+
[queryFormActionsDom, queryFormExtraDom].forEach(function (item) {
|
|
328
|
+
item && Object.assign(item.style, {
|
|
329
|
+
height: fieldHeight,
|
|
330
|
+
lineHeight: fieldHeight
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
[].forEach.call(formItemsDomList, function (item) {
|
|
334
|
+
item.style.lineHeight = fieldHeight;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}, {
|
|
338
|
+
key: "componentDidMount",
|
|
339
|
+
value: function componentDidMount() {
|
|
340
|
+
var current = this.fieldsRef.current;
|
|
341
|
+
var _this$props4 = this.props,
|
|
342
|
+
showFieldCount = _this$props4.showFieldCount,
|
|
343
|
+
_this$props4$showExpa = _this$props4.showExpand,
|
|
344
|
+
showExpand = _this$props4$showExpa === void 0 ? true : _this$props4$showExpa,
|
|
345
|
+
renderActions = _this$props4.renderActions;
|
|
346
|
+
this.updateFieldHeight();
|
|
347
|
+
this.form.on('search', this.search); // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
|
|
348
|
+
|
|
349
|
+
if (!showFieldCount && !showExpand || renderActions) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (!showFieldCount) {
|
|
354
|
+
if (current && this.isFieldsWidthOverflow()) {
|
|
355
|
+
this.setState({
|
|
356
|
+
showMore: true
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
window.addEventListener('resize', this.onWindowResize);
|
|
361
|
+
} else {
|
|
362
|
+
this.updateDrawerFieldsValueCount();
|
|
363
|
+
this.form.on('setValues', this.updateDrawerFieldsValueCount);
|
|
364
|
+
this.form.on('setValue', this.updateDrawerFieldsValueCount);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
key: "componentWillUnmount",
|
|
369
|
+
value: function componentWillUnmount() {
|
|
370
|
+
window.removeEventListener('resize', this.onWindowResize);
|
|
371
|
+
this.form.off('setValues', this.updateDrawerFieldsValueCount);
|
|
372
|
+
this.form.off('setValue', this.updateDrawerFieldsValueCount);
|
|
373
|
+
this.form.off('search', this.search);
|
|
374
|
+
}
|
|
375
|
+
}]);
|
|
376
|
+
|
|
377
|
+
return QueryForm;
|
|
378
|
+
}(React.PureComponent);
|
|
379
|
+
|
|
380
|
+
;
|
|
381
|
+
QueryForm.Field = Field;
|
|
382
|
+
QueryForm.useForm = useForm;
|
|
383
|
+
QueryForm.createForm = createActions;
|
|
384
|
+
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
|
+
}
|