tntd 1.4.20 → 1.4.22
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/components/Handle/README.md +0 -20
- package/components/Handle/index.js +44 -7
- package/components/locale.js +8 -2
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +24430 -24390
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +13 -8
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +108 -76
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +38 -31
- package/es/DevelopmentLogin/LoginModal.js +45 -32
- package/es/DevelopmentLogin/index.js +17 -13
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +69 -58
- package/es/Handle/README.md +0 -20
- package/es/Handle/index.js +100 -33
- package/es/Icon/fonts/iconfont.js +12 -7
- package/es/Icon/index.js +13 -10
- package/es/Img/Contain.js +29 -24
- package/es/Img/Cover.js +54 -40
- package/es/Img/index.js +45 -36
- package/es/Layout/ActionsContext.js +2 -3
- package/es/Layout/AppList.js +92 -37
- package/es/Layout/Application.js +72 -26
- package/es/Layout/Avatar.js +66 -29
- package/es/Layout/CompatibleLanguage.js +94 -39
- package/es/Layout/EnterpriseLayout/Avatar.js +76 -38
- package/es/Layout/EnterpriseLayout/Language.js +32 -14
- package/es/Layout/EnterpriseLayout/Theme.js +34 -16
- package/es/Layout/EnterpriseLayout/index.js +16 -14
- package/es/Layout/GlobalNavigation/NavigationPopup.js +170 -59
- package/es/Layout/GlobalNavigation/index.js +54 -20
- package/es/Layout/Header.js +46 -25
- package/es/Layout/HeaderActions.js +56 -42
- package/es/Layout/HeaderNavs.js +47 -20
- package/es/Layout/HeaderTabs.js +102 -49
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +32 -14
- package/es/Layout/Layout.js +108 -86
- package/es/Layout/Logo.js +32 -16
- package/es/Layout/OrgAppList.js +107 -62
- package/es/Layout/SideMenu.js +124 -63
- package/es/Layout/Theme.js +61 -23
- package/es/Layout/checkAuth.js +29 -0
- package/es/Layout/index.js +34 -26
- package/es/Layout/paaslayout/CompactSideMenu.js +74 -35
- package/es/Layout/paaslayout/Header.js +45 -22
- package/es/Layout/paaslayout/Logo.js +13 -3
- package/es/Layout/paaslayout/SideMenu.js +78 -39
- package/es/Layout/paaslayout/index.js +102 -75
- package/es/Layout/storage.js +9 -10
- package/es/Layout/utils.js +136 -0
- package/es/LoadingButton/index.js +24 -15
- package/es/Modal/index.js +46 -38
- package/es/Page/Box.js +41 -34
- package/es/Page/index.js +67 -52
- package/es/Page/utils.js +5 -0
- package/es/QueryForm/Field/Checkbox.js +9 -5
- package/es/QueryForm/Field/Select.js +41 -31
- package/es/QueryForm/Field/SelectInput.js +41 -26
- package/es/QueryForm/Field/fieldsMap.js +1 -0
- package/es/QueryForm/Field/index.js +71 -41
- package/es/QueryForm/createActions.js +7 -6
- package/es/QueryForm/index.js +135 -76
- package/es/QueryListScene/List.js +128 -74
- package/es/QueryListScene/QueryForm.js +81 -46
- package/es/QueryListScene/QueryListScene.js +40 -25
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +12 -11
- package/es/Select/DropDownWrap.js +50 -29
- package/es/Select/index.js +231 -135
- package/es/Table/ResizableTable/index.js +40 -26
- package/es/Table/index.js +16 -18
- package/es/Title/index.js +23 -21
- package/es/locale.js +11 -3
- package/es/utils/checkAuth.js +5 -3
- package/es/utils/findMenuInfoByPath.js +4 -0
- package/es/utils/index.js +23 -12
- package/lib/ArrayInput/icon.js +6 -6
- package/lib/ArrayInput/index.js +127 -78
- package/lib/AuthContext.js +4 -1
- package/lib/Columns/index.js +47 -31
- package/lib/DevelopmentLogin/LoginModal.js +58 -32
- package/lib/DevelopmentLogin/index.js +27 -16
- package/lib/Ellipsis/Svg/CopySVG.js +15 -13
- package/lib/Ellipsis/Svg/TickSVG.js +10 -8
- package/lib/Ellipsis/index.js +80 -57
- package/lib/Handle/README.md +0 -20
- package/lib/Handle/index.js +119 -33
- package/lib/Icon/fonts/iconfont.js +12 -7
- package/lib/Icon/index.js +20 -11
- package/lib/Img/Contain.js +34 -24
- package/lib/Img/Cover.js +65 -42
- package/lib/Img/index.js +51 -36
- package/lib/Layout/ActionsContext.js +4 -1
- package/lib/Layout/AppList.js +118 -40
- package/lib/Layout/Application.js +86 -26
- package/lib/Layout/Avatar.js +86 -32
- package/lib/Layout/CompatibleLanguage.js +110 -39
- package/lib/Layout/EnterpriseLayout/Avatar.js +100 -41
- package/lib/Layout/EnterpriseLayout/Header.js +113 -0
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +104 -0
- package/lib/Layout/EnterpriseLayout/Language.js +48 -17
- package/lib/Layout/EnterpriseLayout/Theme.js +44 -16
- package/lib/Layout/EnterpriseLayout/index.js +23 -14
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +186 -59
- package/lib/Layout/GlobalNavigation/index.js +74 -23
- package/lib/Layout/Header.js +63 -28
- package/lib/Layout/HeaderActions.js +74 -45
- package/lib/Layout/HeaderNavs.js +61 -23
- package/lib/Layout/HeaderTabs.js +118 -51
- package/lib/Layout/Iconfont.js +5 -1
- package/lib/Layout/Language.js +48 -17
- package/lib/Layout/Layout.js +128 -88
- package/lib/Layout/Logo.js +43 -19
- package/lib/Layout/OrgAppList.js +127 -64
- package/lib/Layout/SideMenu.js +143 -65
- package/lib/Layout/Theme.js +73 -23
- package/lib/Layout/checkAuth.js +39 -0
- package/lib/Layout/createActions.js +5 -0
- package/lib/Layout/images/index.js +28 -0
- package/lib/Layout/index.js +55 -30
- package/lib/Layout/paaslayout/CompactSideMenu.js +84 -35
- package/lib/Layout/paaslayout/Header.js +55 -22
- package/lib/Layout/paaslayout/Logo.js +19 -3
- package/lib/Layout/paaslayout/SideMenu.js +87 -39
- package/lib/Layout/paaslayout/index.js +122 -77
- package/lib/Layout/storage.js +40 -11
- package/lib/Layout/utils.js +166 -0
- package/lib/LoadingButton/index.js +29 -15
- package/lib/Modal/index.js +53 -38
- package/lib/Page/Box.js +45 -34
- package/lib/Page/index.js +77 -52
- package/lib/Page/utils.js +9 -1
- package/lib/QueryForm/Field/Checkbox.js +13 -5
- package/lib/QueryForm/Field/Select.js +53 -33
- package/lib/QueryForm/Field/SelectInput.js +56 -28
- package/lib/QueryForm/Field/fieldsMap.js +15 -1
- package/lib/QueryForm/Field/index.js +81 -43
- package/lib/QueryForm/createActions.js +12 -6
- package/lib/QueryForm/index.js +157 -78
- package/lib/QueryForm/useForm.js +5 -0
- package/lib/QueryListScene/List.js +140 -76
- package/lib/QueryListScene/QueryForm.js +86 -46
- package/lib/QueryListScene/QueryListScene.js +46 -25
- package/lib/QueryListScene/Title.js +7 -3
- package/lib/QueryListScene/Toolbar.js +16 -11
- package/lib/QueryListScene/createActions.js +5 -0
- package/lib/QueryListScene/index.js +10 -0
- package/lib/QueryListScene/useActions.js +5 -0
- package/lib/Select/DropDownWrap.js +56 -31
- package/lib/Select/index.js +241 -135
- package/lib/Table/ResizableTable/index.js +48 -26
- package/lib/Table/index.js +28 -17
- package/lib/Title/index.js +28 -21
- package/lib/index.js +56 -35
- package/lib/locale.js +19 -4
- package/lib/utils/checkAuth.js +9 -4
- package/lib/utils/findMenuInfoByPath.js +8 -1
- package/lib/utils/index.js +42 -15
- package/package.json +2 -2
package/es/QueryForm/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
1
|
import "antd/lib/form/style";
|
|
3
2
|
import _Form from "antd/lib/form";
|
|
4
3
|
import "antd/lib/drawer/style";
|
|
@@ -7,22 +6,33 @@ import "antd/lib/badge/style";
|
|
|
7
6
|
import _Badge from "antd/lib/badge";
|
|
8
7
|
import "antd/lib/button/style";
|
|
9
8
|
import _Button from "antd/lib/button";
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
function
|
|
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
|
+
|
|
14
20
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
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
|
+
|
|
23
28
|
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
|
|
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
|
+
|
|
26
36
|
import React, { createRef } from 'react';
|
|
27
37
|
import classnames from 'classnames';
|
|
28
38
|
import { debounce } from 'lodash';
|
|
@@ -33,15 +43,21 @@ import Field from './Field';
|
|
|
33
43
|
import { getText as _getText, getLanguage } from '../locale';
|
|
34
44
|
import './index.less';
|
|
35
45
|
var clsPrefix = 'tnt-queryform';
|
|
36
|
-
|
|
46
|
+
|
|
47
|
+
var QueryForm =
|
|
48
|
+
/*#__PURE__*/
|
|
49
|
+
function (_React$PureComponent) {
|
|
37
50
|
_inherits(QueryForm, _React$PureComponent);
|
|
38
|
-
|
|
51
|
+
|
|
39
52
|
function QueryForm(props) {
|
|
40
53
|
var _this;
|
|
54
|
+
|
|
41
55
|
_classCallCheck(this, QueryForm);
|
|
42
|
-
|
|
56
|
+
|
|
57
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
|
|
43
58
|
_this.onWindowResize = debounce(function () {
|
|
44
59
|
var current = _this.fieldsRef.current;
|
|
60
|
+
|
|
45
61
|
if (current) {
|
|
46
62
|
setTimeout(function () {
|
|
47
63
|
_this.setState({
|
|
@@ -50,60 +66,82 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
50
66
|
}, 25);
|
|
51
67
|
}
|
|
52
68
|
}, 50);
|
|
69
|
+
|
|
53
70
|
_this.search = function (params) {
|
|
54
|
-
_this.props.onSearch(_objectSpread(
|
|
71
|
+
_this.props.onSearch(_objectSpread({}, _this.form.getValues(), {}, params));
|
|
55
72
|
};
|
|
73
|
+
|
|
56
74
|
_this.onSearch = function () {
|
|
57
75
|
_this.props.onSearch == null ? void 0 : _this.props.onSearch(_this.form.getValues());
|
|
58
76
|
};
|
|
77
|
+
|
|
59
78
|
_this.onReset = function () {
|
|
60
79
|
var _this$props = _this.props,
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
initialValues = _this$props.initialValues,
|
|
81
|
+
onReset = _this$props.onReset;
|
|
82
|
+
|
|
63
83
|
_this.form.setValues(_objectSpread({}, initialValues));
|
|
84
|
+
|
|
64
85
|
_this.updateDrawerFieldsValueCount();
|
|
86
|
+
|
|
65
87
|
onReset == null ? void 0 : onReset(initialValues);
|
|
66
88
|
};
|
|
89
|
+
|
|
67
90
|
_this.onToggleExpand = function () {
|
|
68
91
|
_this.setState({
|
|
69
92
|
expanded: !_this.state.expanded
|
|
70
93
|
});
|
|
94
|
+
|
|
71
95
|
_this.props.onToggleExpand == null ? void 0 : _this.props.onToggleExpand(!_this.state.expanded);
|
|
72
96
|
};
|
|
97
|
+
|
|
73
98
|
_this.onShowDrawer = function () {
|
|
74
99
|
_this.setState({
|
|
75
100
|
drawerVisible: true
|
|
76
101
|
});
|
|
77
102
|
};
|
|
103
|
+
|
|
78
104
|
_this.onFieldChange = function (name, value) {
|
|
79
105
|
var values = _this.form.getValues();
|
|
80
|
-
|
|
106
|
+
|
|
107
|
+
var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
|
|
108
|
+
|
|
81
109
|
var changedInfo = {
|
|
82
110
|
name: name,
|
|
83
111
|
value: value,
|
|
84
112
|
preValue: values == null ? void 0 : values[name]
|
|
85
113
|
};
|
|
86
114
|
var onChange = _this.props.onChange;
|
|
115
|
+
|
|
87
116
|
_this.form.setData('values', newValues);
|
|
117
|
+
|
|
88
118
|
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
89
119
|
rest[_key - 2] = arguments[_key];
|
|
90
120
|
}
|
|
121
|
+
|
|
91
122
|
onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
|
|
123
|
+
|
|
92
124
|
_this.updateDrawerFieldsValueCount(newValues);
|
|
93
125
|
};
|
|
126
|
+
|
|
94
127
|
_this.updateDrawerFieldsValueCount = function () {
|
|
95
128
|
var values = _this.form.getValues();
|
|
129
|
+
|
|
96
130
|
var _this$props2 = _this.props,
|
|
97
|
-
|
|
98
|
-
|
|
131
|
+
showFieldCount = _this$props2.showFieldCount,
|
|
132
|
+
children = _this$props2.children;
|
|
133
|
+
|
|
99
134
|
if (showFieldCount) {
|
|
100
135
|
var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
|
|
101
136
|
var _cur$props;
|
|
102
|
-
|
|
137
|
+
|
|
138
|
+
if (index >= showFieldCount && (values == null ? void 0 : values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name])) {
|
|
103
139
|
acc++;
|
|
104
140
|
}
|
|
141
|
+
|
|
105
142
|
return acc;
|
|
106
143
|
}, 0);
|
|
144
|
+
|
|
107
145
|
if (drawerFieldsValueCount !== _this.state.drawerFieldsValueCount) {
|
|
108
146
|
_this.setState({
|
|
109
147
|
drawerFieldsValueCount: drawerFieldsValueCount
|
|
@@ -111,92 +149,102 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
111
149
|
}
|
|
112
150
|
}
|
|
113
151
|
};
|
|
152
|
+
|
|
114
153
|
var form = props.form,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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;
|
|
120
159
|
_this.state = {
|
|
121
160
|
showMore: false,
|
|
122
161
|
expanded: defaultExpanded || !showExpand || renderActions ? true : false,
|
|
123
162
|
drawerVisible: false,
|
|
124
163
|
drawerFieldsValueCount: 0
|
|
125
164
|
};
|
|
126
|
-
_this.fieldsRef =
|
|
127
|
-
_this.formBoxRef =
|
|
165
|
+
_this.fieldsRef = createRef();
|
|
166
|
+
_this.formBoxRef = createRef();
|
|
128
167
|
_this.form = form || createActions();
|
|
168
|
+
|
|
129
169
|
_this.form.setData('initialValues', _initialValues);
|
|
170
|
+
|
|
130
171
|
_this.form.setData('values', _objectSpread({}, _initialValues));
|
|
172
|
+
|
|
131
173
|
return _this;
|
|
132
174
|
}
|
|
175
|
+
|
|
133
176
|
_createClass(QueryForm, [{
|
|
134
177
|
key: "render",
|
|
135
178
|
value: function render() {
|
|
136
179
|
var _this2 = this;
|
|
180
|
+
|
|
137
181
|
var _this$props3 = this.props,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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;
|
|
152
196
|
var extraActions = this.props.extraActions;
|
|
153
197
|
var _this$state = this.state,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
198
|
+
expanded = _this$state.expanded,
|
|
199
|
+
showMore = _this$state.showMore,
|
|
200
|
+
drawerVisible = _this$state.drawerVisible,
|
|
201
|
+
drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
|
|
202
|
+
|
|
158
203
|
var renderFormActions = renderActions || function () {
|
|
159
|
-
return
|
|
204
|
+
return React.createElement(React.Fragment, null, showFieldCount && React.createElement(_Badge, {
|
|
160
205
|
count: drawerFieldsValueCount
|
|
161
|
-
},
|
|
206
|
+
}, React.createElement(_Button, {
|
|
162
207
|
onClick: _this2.onShowDrawer
|
|
163
|
-
},
|
|
208
|
+
}, React.createElement(Icon, {
|
|
164
209
|
type: "filter"
|
|
165
|
-
}), _this2.getText('moreFiltering'))), showSearch &&
|
|
210
|
+
}), _this2.getText('moreFiltering'))), showSearch && React.createElement(_Button, {
|
|
166
211
|
type: "primary",
|
|
167
212
|
onClick: _this2.onSearch
|
|
168
|
-
}, _this2.getText('search')), showReset &&
|
|
213
|
+
}, _this2.getText('search')), showReset && React.createElement(_Button, {
|
|
169
214
|
onClick: _this2.onReset
|
|
170
|
-
}, _this2.getText('reset')), showMore && !showFieldCount &&
|
|
215
|
+
}, _this2.getText('reset')), showMore && !showFieldCount && React.createElement(_Button, {
|
|
171
216
|
className: "expand-link",
|
|
172
217
|
type: "link",
|
|
173
218
|
onClick: _this2.onToggleExpand
|
|
174
219
|
}, _this2.getText(expanded ? 'collapse' : 'expand')), React.Children.map(children, function (child) {
|
|
175
220
|
var _child$props;
|
|
176
|
-
|
|
221
|
+
|
|
222
|
+
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && React.cloneElement(child);
|
|
177
223
|
}));
|
|
178
224
|
};
|
|
179
|
-
|
|
225
|
+
|
|
226
|
+
return React.createElement("div", {
|
|
180
227
|
ref: this.formBoxRef,
|
|
181
228
|
className: classnames(clsPrefix, _defineProperty({}, className, className))
|
|
182
|
-
},
|
|
229
|
+
}, React.createElement(_Form, {
|
|
183
230
|
layout: "inline",
|
|
184
231
|
className: classnames({
|
|
185
232
|
expanded: !showMore || expanded,
|
|
186
233
|
showMore: showMore
|
|
187
234
|
})
|
|
188
|
-
},
|
|
235
|
+
}, React.createElement("div", {
|
|
189
236
|
ref: this.fieldsRef
|
|
190
237
|
}, React.Children.map(children, function (child, index) {
|
|
191
238
|
var _child$props2;
|
|
192
|
-
|
|
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, {
|
|
193
241
|
form: _this2.form,
|
|
194
242
|
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
195
243
|
onChange: _this2.onFieldChange
|
|
196
244
|
});
|
|
197
|
-
})),
|
|
245
|
+
})), React.createElement("div", {
|
|
198
246
|
className: "".concat(clsPrefix, "-actions")
|
|
199
|
-
}, renderFormActions()), showFieldCount &&
|
|
247
|
+
}, renderFormActions()), showFieldCount && React.createElement(_Drawer, _extends({
|
|
200
248
|
title: this.getText('moreFiltering'),
|
|
201
249
|
visible: drawerVisible,
|
|
202
250
|
onClose: function onClose() {
|
|
@@ -212,19 +260,19 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
212
260
|
'large-size': size === 'large'
|
|
213
261
|
}, className, className))
|
|
214
262
|
}), React.Children.map(children, function (child, index) {
|
|
215
|
-
return child && index >= showFieldCount &&
|
|
263
|
+
return child && index >= showFieldCount && React.cloneElement(child, {
|
|
216
264
|
form: _this2.form,
|
|
217
265
|
isFieldInDrawer: true,
|
|
218
266
|
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
219
267
|
onChange: _this2.onFieldChange,
|
|
220
268
|
onSearch: _this2.onSearch
|
|
221
269
|
});
|
|
222
|
-
}),
|
|
270
|
+
}), React.createElement(_Button, {
|
|
223
271
|
type: "primary",
|
|
224
272
|
onClick: this.onSearch
|
|
225
|
-
}, this.getText('search')),
|
|
273
|
+
}, this.getText('search')), React.createElement(_Button, {
|
|
226
274
|
onClick: this.onReset
|
|
227
|
-
}, this.getText('reset')))), extraActions &&
|
|
275
|
+
}, this.getText('reset')))), extraActions && React.createElement("div", {
|
|
228
276
|
className: "".concat(clsPrefix, "-extra")
|
|
229
277
|
}, extraActions));
|
|
230
278
|
}
|
|
@@ -237,6 +285,7 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
237
285
|
key: "isFieldsWidthOverflow",
|
|
238
286
|
value: function isFieldsWidthOverflow() {
|
|
239
287
|
var current = this.fieldsRef.current;
|
|
288
|
+
|
|
240
289
|
if (current) {
|
|
241
290
|
return current.offsetWidth < [].reduce.call(current.children, function (acc, cur) {
|
|
242
291
|
var marginArray = window.getComputedStyle(cur).margin.split(' ').map(function (str) {
|
|
@@ -246,23 +295,30 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
246
295
|
return acc;
|
|
247
296
|
}, 0);
|
|
248
297
|
}
|
|
298
|
+
|
|
249
299
|
return false;
|
|
250
300
|
}
|
|
251
301
|
}, {
|
|
252
302
|
key: "updateFieldHeight",
|
|
253
303
|
value: function updateFieldHeight() {
|
|
254
304
|
var _formBoxRef$current, _formBoxRef$current2, _fieldsRef$current;
|
|
305
|
+
|
|
255
306
|
var formBoxRef = this.formBoxRef,
|
|
256
|
-
|
|
307
|
+
fieldsRef = this.fieldsRef;
|
|
308
|
+
|
|
257
309
|
var getFieldHeight = function getFieldHeight() {
|
|
258
310
|
var _current$children;
|
|
311
|
+
|
|
259
312
|
var current = fieldsRef.current;
|
|
260
313
|
var height = '32px';
|
|
261
|
-
|
|
314
|
+
|
|
315
|
+
if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
|
|
262
316
|
height = window.getComputedStyle(current.children[0]).height;
|
|
263
317
|
}
|
|
318
|
+
|
|
264
319
|
return height;
|
|
265
320
|
};
|
|
321
|
+
|
|
266
322
|
var queryFormActionsDom = formBoxRef == null ? void 0 : (_formBoxRef$current = formBoxRef.current) == null ? void 0 : _formBoxRef$current.querySelector(".".concat(clsPrefix, "-actions"));
|
|
267
323
|
var queryFormExtraDom = formBoxRef == null ? void 0 : (_formBoxRef$current2 = formBoxRef.current) == null ? void 0 : _formBoxRef$current2.querySelector(".".concat(clsPrefix, "-extra"));
|
|
268
324
|
var formItemsDomList = fieldsRef == null ? void 0 : (_fieldsRef$current = fieldsRef.current) == null ? void 0 : _fieldsRef$current.querySelectorAll('.ant-form-item-control');
|
|
@@ -283,24 +339,25 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
283
339
|
value: function componentDidMount() {
|
|
284
340
|
var current = this.fieldsRef.current;
|
|
285
341
|
var _this$props4 = this.props,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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;
|
|
290
346
|
this.updateFieldHeight();
|
|
291
|
-
this.form.on('search', this.search);
|
|
292
|
-
|
|
293
|
-
// 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
|
|
347
|
+
this.form.on('search', this.search); // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
|
|
294
348
|
// || renderActions
|
|
349
|
+
|
|
295
350
|
if (!showFieldCount && !showExpand) {
|
|
296
351
|
return;
|
|
297
352
|
}
|
|
353
|
+
|
|
298
354
|
if (!showFieldCount) {
|
|
299
355
|
if (current && this.isFieldsWidthOverflow()) {
|
|
300
356
|
this.setState({
|
|
301
357
|
showMore: true
|
|
302
358
|
});
|
|
303
359
|
}
|
|
360
|
+
|
|
304
361
|
window.addEventListener('resize', this.onWindowResize);
|
|
305
362
|
} else {
|
|
306
363
|
this.updateDrawerFieldsValueCount();
|
|
@@ -317,8 +374,10 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
317
374
|
this.form.off('search', this.search);
|
|
318
375
|
}
|
|
319
376
|
}]);
|
|
377
|
+
|
|
320
378
|
return QueryForm;
|
|
321
379
|
}(React.PureComponent);
|
|
380
|
+
|
|
322
381
|
;
|
|
323
382
|
QueryForm.Field = Field;
|
|
324
383
|
QueryForm.useForm = useForm;
|