tntd 1.4.27 → 1.4.29
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/babel.config.js +20 -20
- package/components/Handle/index.js +12 -5
- package/dist/stats.json +5278 -5260
- package/dist/tntd.js +1 -1
- package/es/ArrayInput/icon.js +3 -11
- package/es/ArrayInput/index.js +57 -67
- package/es/AuthContext.js +3 -13
- package/es/Columns/index.js +12 -24
- package/es/DevelopmentLogin/LoginModal.js +22 -29
- package/es/DevelopmentLogin/index.js +13 -29
- package/es/Ellipsis/Svg/CopySVG.js +2 -11
- package/es/Ellipsis/Svg/TickSVG.js +2 -11
- package/es/Ellipsis/index.js +25 -33
- package/es/Handle/index.js +41 -51
- package/es/Icon/fonts/iconfont.js +0 -2
- package/es/Icon/iconList.js +1 -8
- package/es/Icon/index.js +5 -25
- package/es/Img/Contain.js +8 -21
- package/es/Img/Cover.js +11 -29
- package/es/Img/index.js +8 -22
- package/es/Layout/ActionsContext.js +2 -12
- package/es/Layout/AppList.js +42 -58
- package/es/Layout/Application.js +24 -44
- package/es/Layout/Avatar.js +23 -45
- package/es/Layout/CompatibleLanguage.js +29 -51
- package/es/Layout/EnterpriseLayout/Avatar.js +32 -54
- package/es/Layout/EnterpriseLayout/Language.js +15 -39
- package/es/Layout/EnterpriseLayout/Theme.js +15 -31
- package/es/Layout/EnterpriseLayout/index.js +9 -24
- package/es/Layout/GlobalNavigation/NavigationPopup.js +29 -53
- package/es/Layout/GlobalNavigation/index.js +23 -51
- package/es/Layout/Header.js +19 -40
- package/es/Layout/HeaderActions.js +19 -43
- package/es/Layout/HeaderNavs.js +12 -35
- package/es/Layout/HeaderTabs.js +25 -50
- package/es/Layout/Iconfont.js +4 -16
- package/es/Layout/Language.js +14 -38
- package/es/Layout/Layout.js +32 -58
- package/es/Layout/Logo.js +12 -26
- package/es/Layout/OrgAppList.js +36 -52
- package/es/Layout/SideMenu.js +32 -57
- package/es/Layout/Theme.js +21 -39
- package/es/Layout/createActions.js +6 -19
- package/es/Layout/images/index.js +58 -95
- package/es/Layout/index.js +28 -70
- package/es/Layout/paaslayout/CompactSideMenu.js +17 -35
- package/es/Layout/paaslayout/Header.js +17 -31
- package/es/Layout/paaslayout/Logo.js +9 -19
- package/es/Layout/paaslayout/SideMenu.js +12 -29
- package/es/Layout/paaslayout/index.js +32 -58
- package/es/Layout/storage.js +21 -71
- package/es/LoadingButton/index.js +8 -17
- package/es/Modal/index.js +16 -29
- package/es/Page/Box.js +8 -18
- package/es/Page/index.js +29 -47
- package/es/Page/utils.js +1 -12
- package/es/QueryForm/Field/Checkbox.js +5 -13
- package/es/QueryForm/Field/Select.js +12 -28
- package/es/QueryForm/Field/SelectInput.js +18 -33
- package/es/QueryForm/Field/fieldsMap.js +23 -36
- package/es/QueryForm/Field/index.js +12 -25
- package/es/QueryForm/createActions.js +7 -20
- package/es/QueryForm/index.js +50 -66
- package/es/QueryForm/useForm.js +4 -16
- package/es/QueryListScene/List.js +30 -43
- package/es/QueryListScene/QueryForm.js +9 -21
- package/es/QueryListScene/QueryListScene.js +16 -29
- package/es/QueryListScene/Title.js +5 -17
- package/es/QueryListScene/Toolbar.js +4 -16
- package/es/QueryListScene/createActions.js +13 -26
- package/es/QueryListScene/index.js +19 -40
- package/es/QueryListScene/useActions.js +4 -16
- package/es/Select/DropDownWrap.js +6 -18
- package/es/Select/index.js +15 -28
- package/es/Table/ResizableTable/index.js +18 -32
- package/es/Table/index.js +11 -30
- package/es/Title/index.js +5 -18
- package/es/index.js +20 -193
- package/es/locale.js +8 -27
- package/es/utils/checkAuth.js +4 -15
- package/es/utils/findMenuInfoByPath.js +5 -16
- package/es/utils/index.js +10 -70
- package/lib/ArrayInput/index.js +28 -12
- package/lib/Columns/index.js +10 -4
- package/lib/DevelopmentLogin/LoginModal.js +23 -9
- package/lib/Ellipsis/index.js +10 -4
- package/lib/Handle/index.js +32 -15
- package/lib/Layout/AppList.js +30 -12
- package/lib/Layout/Application.js +5 -3
- package/lib/Layout/Avatar.js +12 -6
- package/lib/Layout/CompatibleLanguage.js +5 -3
- package/lib/Layout/EnterpriseLayout/Avatar.js +18 -8
- package/lib/Layout/EnterpriseLayout/Theme.js +5 -3
- package/lib/Layout/HeaderActions.js +7 -5
- package/lib/Layout/Layout.js +9 -7
- package/lib/Layout/OrgAppList.js +19 -7
- package/lib/Layout/SideMenu.js +9 -7
- package/lib/Layout/Theme.js +5 -3
- package/lib/Layout/paaslayout/index.js +10 -8
- package/lib/LoadingButton/index.js +6 -2
- package/lib/Modal/index.js +5 -3
- package/lib/Page/Box.js +5 -3
- package/lib/QueryForm/Field/Checkbox.js +6 -2
- package/lib/QueryForm/Field/Select.js +8 -4
- package/lib/QueryForm/Field/SelectInput.js +13 -5
- package/lib/QueryForm/Field/fieldsMap.js +18 -8
- package/lib/QueryForm/Field/index.js +7 -3
- package/lib/QueryForm/index.js +27 -13
- package/lib/QueryListScene/List.js +7 -5
- package/lib/Select/index.js +14 -8
- package/lib/Table/ResizableTable/index.js +5 -3
- package/lib/Table/index.js +7 -5
- package/package.json +1 -1
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _antd = require("antd");
|
|
11
|
-
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
var _fieldsMap = _interopRequireWildcard(require("./fieldsMap"));
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import "antd/lib/form/style";
|
|
2
|
+
import _Form from "antd/lib/form";
|
|
19
3
|
|
|
20
4
|
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); }
|
|
21
5
|
|
|
@@ -43,7 +27,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
43
27
|
|
|
44
28
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
29
|
|
|
46
|
-
|
|
30
|
+
import { PureComponent } from 'react';
|
|
31
|
+
import { get } from 'lodash';
|
|
32
|
+
import fieldsMap, { getFieldWidth } from './fieldsMap';
|
|
33
|
+
var FormItem = _Form.Item;
|
|
47
34
|
|
|
48
35
|
var isInput = function isInput(type) {
|
|
49
36
|
return ['input', 'string', 'search'].includes(type);
|
|
@@ -89,7 +76,7 @@ function (_PureComponent) {
|
|
|
89
76
|
onChange && onChange.apply(void 0, args); // Input onChange第一个参数为Event对象,取值特殊处理
|
|
90
77
|
|
|
91
78
|
if (!component && isInput(type)) {
|
|
92
|
-
args[0] =
|
|
79
|
+
args[0] = get(args[0], 'target.value');
|
|
93
80
|
}
|
|
94
81
|
|
|
95
82
|
_this.setState({
|
|
@@ -101,7 +88,7 @@ function (_PureComponent) {
|
|
|
101
88
|
|
|
102
89
|
_this.onFormChange = function (formData) {
|
|
103
90
|
_this.setState({
|
|
104
|
-
value:
|
|
91
|
+
value: get(formData, _this.props.name)
|
|
105
92
|
});
|
|
106
93
|
};
|
|
107
94
|
|
|
@@ -129,7 +116,7 @@ function (_PureComponent) {
|
|
|
129
116
|
form = _this$props2.form,
|
|
130
117
|
fieldProps = _this$props2.props;
|
|
131
118
|
var value = this.state.value;
|
|
132
|
-
var Field = component ||
|
|
119
|
+
var Field = component || fieldsMap[type];
|
|
133
120
|
return React.createElement(FormItem, {
|
|
134
121
|
label: title,
|
|
135
122
|
className: className
|
|
@@ -143,7 +130,7 @@ function (_PureComponent) {
|
|
|
143
130
|
}
|
|
144
131
|
} : {}, fieldProps, {
|
|
145
132
|
style: _objectSpread({}, fieldProps == null ? void 0 : fieldProps.style, {
|
|
146
|
-
width: isFieldInDrawer ? '100%' : (fieldProps == null ? void 0 : (_fieldProps$style = fieldProps.style) == null ? void 0 : _fieldProps$style.width) ||
|
|
133
|
+
width: isFieldInDrawer ? '100%' : (fieldProps == null ? void 0 : (_fieldProps$style = fieldProps.style) == null ? void 0 : _fieldProps$style.width) || getFieldWidth(type)
|
|
147
134
|
}),
|
|
148
135
|
onChange: this.onChange
|
|
149
136
|
})));
|
|
@@ -165,6 +152,6 @@ function (_PureComponent) {
|
|
|
165
152
|
}]);
|
|
166
153
|
|
|
167
154
|
return Field;
|
|
168
|
-
}(
|
|
155
|
+
}(PureComponent);
|
|
169
156
|
|
|
170
|
-
|
|
157
|
+
export { Field as default };
|
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
|
9
|
-
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
1
|
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
2
|
|
|
16
3
|
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
4
|
|
|
18
5
|
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
6
|
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
import EventEmitter from 'eventemitter3';
|
|
8
|
+
import { get, set } from 'lodash';
|
|
9
|
+
export default (function () {
|
|
10
|
+
var eventEmitter = new EventEmitter();
|
|
22
11
|
var data = {
|
|
23
12
|
initialValues: {},
|
|
24
13
|
values: {}
|
|
25
14
|
};
|
|
26
15
|
return {
|
|
27
16
|
setData: function setData(key, value) {
|
|
28
|
-
|
|
17
|
+
set(data, key, value);
|
|
29
18
|
},
|
|
30
19
|
getData: function getData(key) {
|
|
31
|
-
|
|
20
|
+
get(data, key);
|
|
32
21
|
},
|
|
33
22
|
setValues: function setValues(values) {
|
|
34
23
|
data.values = values;
|
|
@@ -61,6 +50,4 @@ var _default = function _default() {
|
|
|
61
50
|
eventEmitter.removeListener.apply(eventEmitter, arguments);
|
|
62
51
|
}
|
|
63
52
|
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
exports["default"] = _default;
|
|
53
|
+
});
|
package/es/QueryForm/index.js
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
var _antd = require("antd");
|
|
15
|
-
|
|
16
|
-
var _useForm = _interopRequireDefault(require("./useForm"));
|
|
17
|
-
|
|
18
|
-
var _createActions = _interopRequireDefault(require("./createActions"));
|
|
19
|
-
|
|
20
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
21
|
-
|
|
22
|
-
var _Field = _interopRequireDefault(require("./Field"));
|
|
23
|
-
|
|
24
|
-
var _locale = require("../locale");
|
|
25
|
-
|
|
26
|
-
require("./index.less");
|
|
27
|
-
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import "antd/lib/form/style";
|
|
2
|
+
import _Form from "antd/lib/form";
|
|
3
|
+
import "antd/lib/drawer/style";
|
|
4
|
+
import _Drawer from "antd/lib/drawer";
|
|
5
|
+
import "antd/lib/badge/style";
|
|
6
|
+
import _Badge from "antd/lib/badge";
|
|
7
|
+
import "antd/lib/button/style";
|
|
8
|
+
import _Button from "antd/lib/button";
|
|
33
9
|
|
|
34
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); }
|
|
35
11
|
|
|
@@ -57,6 +33,15 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
57
33
|
|
|
58
34
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
59
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';
|
|
60
45
|
var clsPrefix = 'tnt-queryform';
|
|
61
46
|
|
|
62
47
|
var QueryForm =
|
|
@@ -70,7 +55,7 @@ function (_React$PureComponent) {
|
|
|
70
55
|
_classCallCheck(this, QueryForm);
|
|
71
56
|
|
|
72
57
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
|
|
73
|
-
_this.onWindowResize =
|
|
58
|
+
_this.onWindowResize = debounce(function () {
|
|
74
59
|
var current = _this.fieldsRef.current;
|
|
75
60
|
|
|
76
61
|
if (current) {
|
|
@@ -177,9 +162,9 @@ function (_React$PureComponent) {
|
|
|
177
162
|
drawerVisible: false,
|
|
178
163
|
drawerFieldsValueCount: 0
|
|
179
164
|
};
|
|
180
|
-
_this.fieldsRef =
|
|
181
|
-
_this.formBoxRef =
|
|
182
|
-
_this.form = form || (
|
|
165
|
+
_this.fieldsRef = createRef();
|
|
166
|
+
_this.formBoxRef = createRef();
|
|
167
|
+
_this.form = form || createActions();
|
|
183
168
|
|
|
184
169
|
_this.form.setData('initialValues', _initialValues);
|
|
185
170
|
|
|
@@ -216,50 +201,50 @@ function (_React$PureComponent) {
|
|
|
216
201
|
drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
|
|
217
202
|
|
|
218
203
|
var renderFormActions = renderActions || function () {
|
|
219
|
-
return
|
|
204
|
+
return React.createElement(React.Fragment, null, showFieldCount && React.createElement(_Badge, {
|
|
220
205
|
count: drawerFieldsValueCount
|
|
221
|
-
},
|
|
206
|
+
}, React.createElement(_Button, {
|
|
222
207
|
onClick: _this2.onShowDrawer
|
|
223
|
-
},
|
|
208
|
+
}, React.createElement(Icon, {
|
|
224
209
|
type: "filter"
|
|
225
|
-
}), _this2.getText('moreFiltering'))), showSearch &&
|
|
210
|
+
}), _this2.getText('moreFiltering'))), showSearch && React.createElement(_Button, {
|
|
226
211
|
type: "primary",
|
|
227
212
|
onClick: _this2.onSearch
|
|
228
|
-
}, _this2.getText('search')), showReset &&
|
|
213
|
+
}, _this2.getText('search')), showReset && React.createElement(_Button, {
|
|
229
214
|
onClick: _this2.onReset
|
|
230
|
-
}, _this2.getText('reset')), showMore && !showFieldCount &&
|
|
215
|
+
}, _this2.getText('reset')), showMore && !showFieldCount && React.createElement(_Button, {
|
|
231
216
|
className: "expand-link",
|
|
232
217
|
type: "link",
|
|
233
218
|
onClick: _this2.onToggleExpand
|
|
234
|
-
}, _this2.getText(expanded ? 'collapse' : 'expand')),
|
|
219
|
+
}, _this2.getText(expanded ? 'collapse' : 'expand')), React.Children.map(children, function (child) {
|
|
235
220
|
var _child$props;
|
|
236
221
|
|
|
237
|
-
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' &&
|
|
222
|
+
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && React.cloneElement(child);
|
|
238
223
|
}));
|
|
239
224
|
};
|
|
240
225
|
|
|
241
|
-
return
|
|
226
|
+
return React.createElement("div", {
|
|
242
227
|
ref: this.formBoxRef,
|
|
243
|
-
className: (
|
|
244
|
-
},
|
|
228
|
+
className: classnames(clsPrefix, _defineProperty({}, className, className))
|
|
229
|
+
}, React.createElement(_Form, {
|
|
245
230
|
layout: "inline",
|
|
246
|
-
className: (
|
|
231
|
+
className: classnames({
|
|
247
232
|
expanded: !showMore || expanded,
|
|
248
233
|
showMore: showMore
|
|
249
234
|
})
|
|
250
|
-
},
|
|
235
|
+
}, React.createElement("div", {
|
|
251
236
|
ref: this.fieldsRef
|
|
252
|
-
},
|
|
237
|
+
}, React.Children.map(children, function (child, index) {
|
|
253
238
|
var _child$props2;
|
|
254
239
|
|
|
255
|
-
return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) &&
|
|
240
|
+
return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && React.cloneElement(child, {
|
|
256
241
|
form: _this2.form,
|
|
257
242
|
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
258
243
|
onChange: _this2.onFieldChange
|
|
259
244
|
});
|
|
260
|
-
})),
|
|
245
|
+
})), React.createElement("div", {
|
|
261
246
|
className: "".concat(clsPrefix, "-actions")
|
|
262
|
-
}, renderFormActions()), showFieldCount &&
|
|
247
|
+
}, renderFormActions()), showFieldCount && React.createElement(_Drawer, _extends({
|
|
263
248
|
title: this.getText('moreFiltering'),
|
|
264
249
|
visible: drawerVisible,
|
|
265
250
|
onClose: function onClose() {
|
|
@@ -271,30 +256,30 @@ function (_React$PureComponent) {
|
|
|
271
256
|
size: size,
|
|
272
257
|
getContainer: false
|
|
273
258
|
}, drawerProps, {
|
|
274
|
-
className: (
|
|
259
|
+
className: classnames("".concat(clsPrefix, "-drawer"), _defineProperty({
|
|
275
260
|
'large-size': size === 'large'
|
|
276
261
|
}, className, className))
|
|
277
|
-
}),
|
|
278
|
-
return child && index >= showFieldCount &&
|
|
262
|
+
}), React.Children.map(children, function (child, index) {
|
|
263
|
+
return child && index >= showFieldCount && React.cloneElement(child, {
|
|
279
264
|
form: _this2.form,
|
|
280
265
|
isFieldInDrawer: true,
|
|
281
266
|
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
282
267
|
onChange: _this2.onFieldChange,
|
|
283
268
|
onSearch: _this2.onSearch
|
|
284
269
|
});
|
|
285
|
-
}),
|
|
270
|
+
}), React.createElement(_Button, {
|
|
286
271
|
type: "primary",
|
|
287
272
|
onClick: this.onSearch
|
|
288
|
-
}, this.getText('search')),
|
|
273
|
+
}, this.getText('search')), React.createElement(_Button, {
|
|
289
274
|
onClick: this.onReset
|
|
290
|
-
}, this.getText('reset')))), extraActions &&
|
|
275
|
+
}, this.getText('reset')))), extraActions && React.createElement("div", {
|
|
291
276
|
className: "".concat(clsPrefix, "-extra")
|
|
292
277
|
}, extraActions));
|
|
293
278
|
}
|
|
294
279
|
}, {
|
|
295
280
|
key: "getText",
|
|
296
281
|
value: function getText(key) {
|
|
297
|
-
return (
|
|
282
|
+
return _getText(key, this.props.language || getLanguage());
|
|
298
283
|
}
|
|
299
284
|
}, {
|
|
300
285
|
key: "isFieldsWidthOverflow",
|
|
@@ -391,11 +376,10 @@ function (_React$PureComponent) {
|
|
|
391
376
|
}]);
|
|
392
377
|
|
|
393
378
|
return QueryForm;
|
|
394
|
-
}(
|
|
379
|
+
}(React.PureComponent);
|
|
395
380
|
|
|
396
381
|
;
|
|
397
|
-
QueryForm.Field =
|
|
398
|
-
QueryForm.useForm =
|
|
399
|
-
QueryForm.createForm =
|
|
400
|
-
|
|
401
|
-
exports["default"] = _default;
|
|
382
|
+
QueryForm.Field = Field;
|
|
383
|
+
QueryForm.useForm = useForm;
|
|
384
|
+
QueryForm.createForm = createActions;
|
|
385
|
+
export default QueryForm;
|
package/es/QueryForm/useForm.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = useForm;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _createActions = _interopRequireDefault(require("./createActions"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function useForm() {
|
|
15
|
-
var form = (0, _react.useRef)((0, _createActions["default"])());
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import createActions from './createActions';
|
|
3
|
+
export default function useForm() {
|
|
4
|
+
var form = useRef(createActions());
|
|
16
5
|
return [form.current];
|
|
17
6
|
}
|
|
18
|
-
|
|
19
7
|
;
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactDom = require("react-dom");
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
|
-
var _antd = require("antd");
|
|
17
|
-
|
|
18
|
-
var _Table = _interopRequireDefault(require("../Table"));
|
|
19
|
-
|
|
20
|
-
var _locale = require("../locale");
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
25
|
-
|
|
26
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import "antd/lib/spin/style";
|
|
2
|
+
import _Spin from "antd/lib/spin";
|
|
27
3
|
|
|
28
4
|
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); }
|
|
29
5
|
|
|
@@ -55,6 +31,17 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
55
31
|
|
|
56
32
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
57
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @file QueryList
|
|
36
|
+
* @author you.zhang
|
|
37
|
+
*/
|
|
38
|
+
import React, { createRef } from 'react';
|
|
39
|
+
import { findDOMNode } from 'react-dom';
|
|
40
|
+
import cn from 'classnames';
|
|
41
|
+
import { get, pickBy, isEmpty, debounce, throttle } from 'lodash';
|
|
42
|
+
import Table from '../Table';
|
|
43
|
+
import { getText, getLanguage } from '../locale';
|
|
44
|
+
|
|
58
45
|
var QueryList =
|
|
59
46
|
/*#__PURE__*/
|
|
60
47
|
function (_React$PureComponent) {
|
|
@@ -68,7 +55,7 @@ function (_React$PureComponent) {
|
|
|
68
55
|
_classCallCheck(this, QueryList);
|
|
69
56
|
|
|
70
57
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryList).call(this, props));
|
|
71
|
-
_this.onWindowResize =
|
|
58
|
+
_this.onWindowResize = debounce(function () {
|
|
72
59
|
var scroll = _this.state.scroll;
|
|
73
60
|
|
|
74
61
|
_this.setState({
|
|
@@ -111,7 +98,7 @@ function (_React$PureComponent) {
|
|
|
111
98
|
}
|
|
112
99
|
|
|
113
100
|
actions.setData('submittedFormData', params);
|
|
114
|
-
return query(
|
|
101
|
+
return query(pickBy(params, function (val) {
|
|
115
102
|
return val !== '' && val !== null && val !== undefined;
|
|
116
103
|
})).then(function (result) {
|
|
117
104
|
var dataSource = hasPagination ? result.data || [] : result;
|
|
@@ -158,9 +145,9 @@ function (_React$PureComponent) {
|
|
|
158
145
|
};
|
|
159
146
|
|
|
160
147
|
_this.onFormChange = function (values) {
|
|
161
|
-
_this.formData =
|
|
162
|
-
sorter:
|
|
163
|
-
filters:
|
|
148
|
+
_this.formData = pickBy(_objectSpread({}, values, {
|
|
149
|
+
sorter: get(_this.formData, 'sorter'),
|
|
150
|
+
filters: get(_this.formData, 'filters')
|
|
164
151
|
}), function (val) {
|
|
165
152
|
return val !== undefined;
|
|
166
153
|
});
|
|
@@ -187,8 +174,8 @@ function (_React$PureComponent) {
|
|
|
187
174
|
var tableParams = {
|
|
188
175
|
pageSize: pagination.pageSize,
|
|
189
176
|
current: pagination.current,
|
|
190
|
-
filters:
|
|
191
|
-
sorter:
|
|
177
|
+
filters: isEmpty(filters) ? undefined : filters,
|
|
178
|
+
sorter: isEmpty(sorter) ? undefined : sorter
|
|
192
179
|
};
|
|
193
180
|
console.log('onTableChange...', actions.getSubmittedFormData(), _this.formData);
|
|
194
181
|
Object.assign(_this.formData, tableParams); // 排序变化暂时不处理,因为有时可能是前端sorter不需要走请求
|
|
@@ -217,7 +204,7 @@ function (_React$PureComponent) {
|
|
|
217
204
|
}
|
|
218
205
|
};
|
|
219
206
|
|
|
220
|
-
_this.onTableBodyScroll =
|
|
207
|
+
_this.onTableBodyScroll = throttle(function (evt) {
|
|
221
208
|
console.log('onTableBodyScroll', evt.target.scrollTop);
|
|
222
209
|
|
|
223
210
|
_this.updateIsScrollToBottom(evt.target);
|
|
@@ -247,7 +234,7 @@ function (_React$PureComponent) {
|
|
|
247
234
|
scroll: props.scroll,
|
|
248
235
|
hasScrollToBottom: !((_props$scroll = props.scroll) == null ? void 0 : _props$scroll.y)
|
|
249
236
|
};
|
|
250
|
-
_this.tableRef =
|
|
237
|
+
_this.tableRef = createRef();
|
|
251
238
|
var _actions = props.actions;
|
|
252
239
|
|
|
253
240
|
_actions.on('search', _this.onSearch);
|
|
@@ -291,7 +278,7 @@ function (_React$PureComponent) {
|
|
|
291
278
|
showQuickJumper: true,
|
|
292
279
|
showSizeChanger: true,
|
|
293
280
|
showTotal: function showTotal(total) {
|
|
294
|
-
return
|
|
281
|
+
return getText('totalRecords', getLanguage(), total);
|
|
295
282
|
}
|
|
296
283
|
}, pagination || {});
|
|
297
284
|
|
|
@@ -300,14 +287,14 @@ function (_React$PureComponent) {
|
|
|
300
287
|
onExpandedRowsChange: this.onExpandedRowsChange
|
|
301
288
|
} : {});
|
|
302
289
|
|
|
303
|
-
return
|
|
304
|
-
className: (
|
|
290
|
+
return React.createElement("div", {
|
|
291
|
+
className: cn("tnt-querylistscene-list ".concat(className), {
|
|
305
292
|
paginationSticky: paginationSticky,
|
|
306
293
|
hasScrollToBottom: hasScrollToBottom
|
|
307
294
|
})
|
|
308
|
-
},
|
|
295
|
+
}, React.createElement(_Spin, {
|
|
309
296
|
spinning: loading
|
|
310
|
-
},
|
|
297
|
+
}, React.createElement(Table, _extends({
|
|
311
298
|
ref: this.tableRef
|
|
312
299
|
}, expandProps, rest, columns ? {
|
|
313
300
|
columns: columns
|
|
@@ -363,7 +350,7 @@ function (_React$PureComponent) {
|
|
|
363
350
|
|
|
364
351
|
if (this.tableRef.current) {
|
|
365
352
|
// table内垂直滚动,需要动态设置分页组件上阴影样式
|
|
366
|
-
var tableBody =
|
|
353
|
+
var tableBody = findDOMNode(this.tableRef.current).querySelector('.ant-table-body');
|
|
367
354
|
this.initialTop = window.innerHeight - this.state.scroll.y;
|
|
368
355
|
this.updateIsScrollToBottom(tableBody);
|
|
369
356
|
tableBody.addEventListener('scroll', this.onTableBodyScroll);
|
|
@@ -385,7 +372,7 @@ function (_React$PureComponent) {
|
|
|
385
372
|
}]);
|
|
386
373
|
|
|
387
374
|
return QueryList;
|
|
388
|
-
}(
|
|
375
|
+
}(React.PureComponent);
|
|
389
376
|
|
|
390
|
-
|
|
377
|
+
export { QueryList as default };
|
|
391
378
|
;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _QueryForm = _interopRequireDefault(require("../QueryForm"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
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); }
|
|
17
2
|
|
|
18
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); }
|
|
@@ -43,6 +28,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
43
28
|
|
|
44
29
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
30
|
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import classnames from 'classnames';
|
|
33
|
+
import Form from '../QueryForm';
|
|
46
34
|
var clsPrefix = 'tnt-querylistscene-queryform';
|
|
47
35
|
|
|
48
36
|
var QueryForm =
|
|
@@ -119,7 +107,7 @@ function (_React$PureComponent) {
|
|
|
119
107
|
|
|
120
108
|
var _actions = props.actions,
|
|
121
109
|
form = props.form;
|
|
122
|
-
_this.form = form ||
|
|
110
|
+
_this.form = form || Form.createForm();
|
|
123
111
|
|
|
124
112
|
_actions.on('setFormData', _this.setFormData);
|
|
125
113
|
|
|
@@ -139,9 +127,9 @@ function (_React$PureComponent) {
|
|
|
139
127
|
qlsProps = _this$props5.qlsProps,
|
|
140
128
|
props = _objectWithoutProperties(_this$props5, ["className", "actions", "extraActions", "extralActions", "qlsProps"]);
|
|
141
129
|
|
|
142
|
-
return
|
|
130
|
+
return React.createElement(Form, _extends({}, props, {
|
|
143
131
|
form: this.form,
|
|
144
|
-
className: (
|
|
132
|
+
className: classnames(clsPrefix, _defineProperty({}, className, className)) // 前期拼写错误,导致需要兼容错误的api
|
|
145
133
|
,
|
|
146
134
|
extraActions: extraActions || extralActions,
|
|
147
135
|
onChange: this.onChange,
|
|
@@ -174,8 +162,8 @@ function (_React$PureComponent) {
|
|
|
174
162
|
}]);
|
|
175
163
|
|
|
176
164
|
return QueryForm;
|
|
177
|
-
}(
|
|
165
|
+
}(React.PureComponent);
|
|
178
166
|
|
|
179
|
-
|
|
167
|
+
export { QueryForm as default };
|
|
180
168
|
;
|
|
181
|
-
QueryForm.Field =
|
|
169
|
+
QueryForm.Field = Form.Field;
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _Title = _interopRequireDefault(require("./Title"));
|
|
13
|
-
|
|
14
|
-
var _Toolbar = _interopRequireDefault(require("./Toolbar"));
|
|
15
|
-
|
|
16
|
-
var _createActions = _interopRequireDefault(require("./createActions"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
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); }
|
|
21
2
|
|
|
22
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -37,6 +18,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
37
18
|
|
|
38
19
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
20
|
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import cn from 'classnames';
|
|
23
|
+
import Title from './Title';
|
|
24
|
+
import Toolbar from './Toolbar';
|
|
25
|
+
import createActions from './createActions';
|
|
26
|
+
|
|
40
27
|
var QueryListScene =
|
|
41
28
|
/*#__PURE__*/
|
|
42
29
|
function (_React$Component) {
|
|
@@ -48,7 +35,7 @@ function (_React$Component) {
|
|
|
48
35
|
_classCallCheck(this, QueryListScene);
|
|
49
36
|
|
|
50
37
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryListScene).call(this, props));
|
|
51
|
-
_this.actions = props.actions || (
|
|
38
|
+
_this.actions = props.actions || createActions();
|
|
52
39
|
return _this;
|
|
53
40
|
}
|
|
54
41
|
|
|
@@ -65,17 +52,17 @@ function (_React$Component) {
|
|
|
65
52
|
_this$props$className = _this$props.className,
|
|
66
53
|
className = _this$props$className === void 0 ? '' : _this$props$className;
|
|
67
54
|
var hasToolbar = [].some.call(children || [], function (child) {
|
|
68
|
-
return (child == null ? void 0 : child.type) ===
|
|
55
|
+
return (child == null ? void 0 : child.type) === Toolbar;
|
|
69
56
|
});
|
|
70
|
-
return
|
|
71
|
-
className: (
|
|
72
|
-
}, title &&
|
|
57
|
+
return React.createElement("div", {
|
|
58
|
+
className: cn('tnt-querylistscene', (_cn = {}, _defineProperty(_cn, className, className), _defineProperty(_cn, 'large-size', size === 'large'), _defineProperty(_cn, "hasToolbar", hasToolbar), _cn))
|
|
59
|
+
}, title && React.createElement(Title, {
|
|
73
60
|
title: title,
|
|
74
61
|
size: size
|
|
75
|
-
}),
|
|
62
|
+
}), React.createElement("div", {
|
|
76
63
|
className: "tnt-querylistscene-content"
|
|
77
|
-
},
|
|
78
|
-
return child &&
|
|
64
|
+
}, React.Children.map(children, function (child) {
|
|
65
|
+
return child && React.cloneElement(child, {
|
|
79
66
|
qlsProps: _this2.props,
|
|
80
67
|
actions: _this2.actions
|
|
81
68
|
});
|
|
@@ -84,6 +71,6 @@ function (_React$Component) {
|
|
|
84
71
|
}]);
|
|
85
72
|
|
|
86
73
|
return QueryListScene;
|
|
87
|
-
}(
|
|
74
|
+
}(React.Component);
|
|
88
75
|
|
|
89
|
-
|
|
76
|
+
export { QueryListScene as default };
|