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