tntd 1.3.51 → 1.3.55
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 +6 -3
- package/components/Layout/GlobalNavigation/NavigationPopup.js +6 -4
- package/components/Layout/GlobalNavigation/index.js +2 -1
- package/components/Layout/HeaderActions.js +1 -0
- package/components/Layout/README.md +2 -1
- package/components/Layout/createActions.js +10 -2
- package/components/Layout/index.js +10 -1
- package/components/Page/Box.js +3 -3
- package/components/Page/README.md +17 -5
- package/components/Page/index.js +4 -4
- package/components/Page/index.less +31 -7
- package/components/QueryForm/index.js +12 -8
- package/components/QueryListScene/List.js +2 -1
- package/components/locale.js +60 -0
- package/lib/Layout/Avatar.js +11 -3
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +7 -4
- package/lib/Layout/GlobalNavigation/index.js +2 -1
- package/lib/Layout/README.md +2 -1
- package/lib/Layout/createActions.js +14 -1
- package/lib/Layout/index.js +19 -5
- package/lib/Page/Box.js +4 -3
- package/lib/Page/README.md +17 -5
- package/lib/Page/demo.js +302 -0
- package/lib/Page/index.js +4 -4
- package/lib/Page/index.less +31 -7
- package/lib/QueryForm/index.js +14 -11
- package/lib/QueryListScene/Field/SelectInput.js +2 -10
- package/lib/QueryListScene/Field/fieldsMap.js +1 -16
- package/lib/QueryListScene/Field/index.js +47 -131
- package/lib/QueryListScene/List.js +3 -1
- package/lib/QueryListScene/QueryForm/index.js +89 -93
- package/lib/QueryListScene/QueryForm/index.less +3 -17
- package/lib/locale.js +75 -0
- package/package.json +1 -1
- package/lib/0645cf743e4e44ca9da321d689897f07.png +0 -0
- package/lib/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
- package/lib/1d0b52448de217857b270af807e9360d.png +0 -0
- package/lib/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
- package/lib/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
- package/lib/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
- package/lib/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
- package/lib/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
- package/lib/4abe481e130d7be0574e45573de8beb7.png +0 -0
- package/lib/95ee2260a509cd630d89c5367ed1973b.png +0 -0
- package/lib/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
- package/lib/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
- package/lib/index.html +0 -6
- package/lib/main.css +0 -16420
- package/lib/tntd.js +0 -2
- package/lib/tntd.js.LICENSE.txt +0 -36
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] =
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
require("antd/lib/date-picker/style");
|
|
9
9
|
|
|
@@ -23,21 +23,6 @@ var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
25
|
|
|
26
|
-
var defaultFieldWidth = '200px';
|
|
27
|
-
exports.defaultFieldWidth = defaultFieldWidth;
|
|
28
|
-
|
|
29
|
-
var getFieldWidth = function getFieldWidth(type) {
|
|
30
|
-
if (type === 'dateRange') {
|
|
31
|
-
return '340px';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
dateRange: '340px',
|
|
36
|
-
selectInput: '320px'
|
|
37
|
-
}[type] || defaultFieldWidth;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.getFieldWidth = getFieldWidth;
|
|
41
26
|
var _default = {
|
|
42
27
|
string: _input["default"],
|
|
43
28
|
input: _input["default"],
|
|
@@ -9,151 +9,67 @@ require("antd/lib/form/style");
|
|
|
9
9
|
|
|
10
10
|
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _fieldsMap = _interopRequireWildcard(require("./fieldsMap"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
var _lodash = require("lodash");
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
var _fieldsMap = _interopRequireDefault(require("./fieldsMap"));
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
19
|
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
20
|
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); }
|
|
25
21
|
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
22
|
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; }
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
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); } }
|
|
35
|
-
|
|
36
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
37
|
-
|
|
38
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
39
|
-
|
|
40
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
+
var FormItem = _form["default"].Item;
|
|
41
25
|
|
|
42
|
-
|
|
26
|
+
var _default = function _default(props) {
|
|
27
|
+
var _props$type = props.type,
|
|
28
|
+
type = _props$type === void 0 ? 'input' : _props$type,
|
|
29
|
+
title = props.title,
|
|
30
|
+
name = props.name,
|
|
31
|
+
initialValue = props.initialValue,
|
|
32
|
+
form = props.form,
|
|
33
|
+
actions = props.actions,
|
|
34
|
+
_props$className = props.className,
|
|
35
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
36
|
+
component = props.component,
|
|
37
|
+
fieldProps = props.props;
|
|
38
|
+
var getFieldDecorator = form.getFieldDecorator;
|
|
39
|
+
var Field = component || _fieldsMap["default"][type];
|
|
40
|
+
var isInput = ['input', 'string'].includes(type);
|
|
41
|
+
|
|
42
|
+
var onFieldChange = function onFieldChange() {
|
|
43
|
+
var _ref = fieldProps || {},
|
|
44
|
+
onChange = _ref.onChange;
|
|
45
|
+
|
|
46
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
|
+
args[_key] = arguments[_key];
|
|
48
|
+
}
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
onChange && onChange.apply(void 0, args); // Input onChange第一个参数为Event对象,取值特殊处理
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
if (!component && isInput) {
|
|
53
|
+
args[0] = (0, _lodash.get)(args[0], 'target.value');
|
|
54
|
+
}
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
actions.emit.apply(actions, ['fieldChange', name].concat(args));
|
|
57
|
+
};
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
return _react["default"].createElement(FormItem, {
|
|
60
|
+
label: title,
|
|
61
|
+
className: className
|
|
62
|
+
}, getFieldDecorator(name, {
|
|
63
|
+
initialValue: initialValue
|
|
64
|
+
})(_react["default"].createElement(Field, _extends({}, isInput ? {
|
|
65
|
+
onPressEnter: function onPressEnter(evt) {
|
|
66
|
+
var _actions$search;
|
|
53
67
|
|
|
54
|
-
|
|
55
|
-
/*#__PURE__*/
|
|
56
|
-
function (_React$PureComponent) {
|
|
57
|
-
_inherits(Field, _React$PureComponent);
|
|
58
|
-
|
|
59
|
-
function Field(props) {
|
|
60
|
-
var _this;
|
|
61
|
-
|
|
62
|
-
_classCallCheck(this, Field);
|
|
63
|
-
|
|
64
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(Field).call(this, props));
|
|
65
|
-
|
|
66
|
-
_this.onChange = function () {
|
|
67
|
-
var _this$props = _this.props,
|
|
68
|
-
actions = _this$props.actions,
|
|
69
|
-
name = _this$props.name,
|
|
70
|
-
_this$props$type = _this$props.type,
|
|
71
|
-
type = _this$props$type === void 0 ? 'input' : _this$props$type,
|
|
72
|
-
component = _this$props.component,
|
|
73
|
-
fieldProps = _this$props.props;
|
|
74
|
-
|
|
75
|
-
var _ref = fieldProps || {},
|
|
76
|
-
onChange = _ref.onChange;
|
|
77
|
-
|
|
78
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
79
|
-
args[_key] = arguments[_key];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
onChange && onChange.apply(void 0, args); // Input onChange第一个参数为Event对象,取值特殊处理
|
|
83
|
-
|
|
84
|
-
if (!component && isInput(type)) {
|
|
85
|
-
args[0] = (0, _lodash.get)(args[0], 'target.value');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
_this.setState({
|
|
89
|
-
value: args[0]
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
actions.emit.apply(actions, ['fieldChange', name].concat(args));
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
_this.onFormChange = function (formData) {
|
|
96
|
-
_this.setState({
|
|
97
|
-
value: (0, _lodash.get)(formData, _this.props.name)
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
_this.state = {
|
|
102
|
-
value: props.initialValue
|
|
103
|
-
};
|
|
104
|
-
return _this;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
_createClass(Field, [{
|
|
108
|
-
key: "render",
|
|
109
|
-
value: function render() {
|
|
110
|
-
var _fieldProps$style;
|
|
111
|
-
|
|
112
|
-
var _this$props2 = this.props,
|
|
113
|
-
_this$props2$type = _this$props2.type,
|
|
114
|
-
type = _this$props2$type === void 0 ? 'input' : _this$props2$type,
|
|
115
|
-
title = _this$props2.title,
|
|
116
|
-
name = _this$props2.name,
|
|
117
|
-
actions = _this$props2.actions,
|
|
118
|
-
_this$props2$isFieldI = _this$props2.isFieldInDrawer,
|
|
119
|
-
isFieldInDrawer = _this$props2$isFieldI === void 0 ? false : _this$props2$isFieldI,
|
|
120
|
-
_this$props2$classNam = _this$props2.className,
|
|
121
|
-
className = _this$props2$classNam === void 0 ? '' : _this$props2$classNam,
|
|
122
|
-
component = _this$props2.component,
|
|
123
|
-
fieldProps = _this$props2.props;
|
|
124
|
-
var value = this.state.value;
|
|
125
|
-
var Field = component || _fieldsMap["default"][type];
|
|
126
|
-
return React.createElement(FormItem, {
|
|
127
|
-
label: title,
|
|
128
|
-
className: className
|
|
129
|
-
}, React.createElement(Field, _extends({
|
|
130
|
-
value: value
|
|
131
|
-
}, isInput(type) ? {
|
|
132
|
-
onPressEnter: function onPressEnter(evt) {
|
|
133
|
-
var _actions$search;
|
|
134
|
-
|
|
135
|
-
return actions.search((_actions$search = {}, _defineProperty(_actions$search, name, evt.target.value), _defineProperty(_actions$search, "current", 1), _actions$search));
|
|
136
|
-
}
|
|
137
|
-
} : {}, fieldProps, {
|
|
138
|
-
style: _objectSpread({}, fieldProps == null ? void 0 : fieldProps.style, {
|
|
139
|
-
width: isFieldInDrawer ? '100%' : (fieldProps == null ? void 0 : (_fieldProps$style = fieldProps.style) == null ? void 0 : _fieldProps$style.width) || (0, _fieldsMap.getFieldWidth)(type)
|
|
140
|
-
}),
|
|
141
|
-
onChange: this.onChange
|
|
142
|
-
})));
|
|
68
|
+
return actions.search((_actions$search = {}, _defineProperty(_actions$search, name, evt.target.value), _defineProperty(_actions$search, "current", 1), _actions$search));
|
|
143
69
|
}
|
|
144
|
-
}, {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "componentWillUnmount",
|
|
151
|
-
value: function componentWillUnmount() {
|
|
152
|
-
this.props.actions.off('setFormData', this.onFormChange);
|
|
153
|
-
}
|
|
154
|
-
}]);
|
|
155
|
-
|
|
156
|
-
return Field;
|
|
157
|
-
}(React.PureComponent);
|
|
70
|
+
} : {}, fieldProps, {
|
|
71
|
+
onChange: onFieldChange
|
|
72
|
+
}))));
|
|
73
|
+
};
|
|
158
74
|
|
|
159
|
-
exports["default"] =
|
|
75
|
+
exports["default"] = _default;
|
|
@@ -19,6 +19,8 @@ var _lodash = require("lodash");
|
|
|
19
19
|
|
|
20
20
|
var _Table = _interopRequireDefault(require("../Table"));
|
|
21
21
|
|
|
22
|
+
var _locale = require("../locale");
|
|
23
|
+
|
|
22
24
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
23
25
|
|
|
24
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; }
|
|
@@ -289,7 +291,7 @@ function (_React$PureComponent) {
|
|
|
289
291
|
showQuickJumper: true,
|
|
290
292
|
showSizeChanger: true,
|
|
291
293
|
showTotal: function showTotal(total) {
|
|
292
|
-
return
|
|
294
|
+
return (0, _locale.getText)('totalRecords', (0, _locale.getLanguage)(), total);
|
|
293
295
|
}
|
|
294
296
|
}, pagination || {});
|
|
295
297
|
|
|
@@ -5,10 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
-
require("antd/lib/form/style");
|
|
9
|
-
|
|
10
|
-
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
11
|
-
|
|
12
8
|
require("antd/lib/drawer/style");
|
|
13
9
|
|
|
14
10
|
var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
@@ -21,16 +17,20 @@ require("antd/lib/button/style");
|
|
|
21
17
|
|
|
22
18
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
23
19
|
|
|
20
|
+
require("antd/lib/form/style");
|
|
21
|
+
|
|
22
|
+
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
23
|
+
|
|
24
24
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
25
|
|
|
26
26
|
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
27
27
|
|
|
28
28
|
var _lodash = require("lodash");
|
|
29
29
|
|
|
30
|
-
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
31
|
-
|
|
32
30
|
require("./index.less");
|
|
33
31
|
|
|
32
|
+
var _dec, _class, _temp;
|
|
33
|
+
|
|
34
34
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
35
35
|
|
|
36
36
|
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; }
|
|
@@ -63,12 +63,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
63
63
|
|
|
64
64
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
65
65
|
|
|
66
|
-
var clsPrefix =
|
|
67
|
-
|
|
68
|
-
var QueryForm =
|
|
66
|
+
var clsPrefix = "tnt-querylistscene-queryform";
|
|
67
|
+
var QueryForm = (_dec = _form["default"].create(), _dec(_class = (_temp =
|
|
69
68
|
/*#__PURE__*/
|
|
70
|
-
function (_React$
|
|
71
|
-
_inherits(QueryForm, _React$
|
|
69
|
+
function (_React$Component) {
|
|
70
|
+
_inherits(QueryForm, _React$Component);
|
|
72
71
|
|
|
73
72
|
function QueryForm(props) {
|
|
74
73
|
var _this;
|
|
@@ -90,9 +89,10 @@ function (_React$PureComponent) {
|
|
|
90
89
|
|
|
91
90
|
_this.onSubmit = function () {
|
|
92
91
|
var _this$props = _this.props,
|
|
92
|
+
form = _this$props.form,
|
|
93
93
|
onSubmit = _this$props.onSubmit,
|
|
94
94
|
actions = _this$props.actions;
|
|
95
|
-
var values =
|
|
95
|
+
var values = form.getFieldsValue();
|
|
96
96
|
|
|
97
97
|
var params = _objectSpread({}, values, {
|
|
98
98
|
current: 1
|
|
@@ -105,21 +105,18 @@ function (_React$PureComponent) {
|
|
|
105
105
|
|
|
106
106
|
_this.onReset = function () {
|
|
107
107
|
var _this$props2 = _this.props,
|
|
108
|
-
|
|
109
|
-
onReset = _this$props2.onReset
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
onReset && onReset(
|
|
108
|
+
form = _this$props2.form,
|
|
109
|
+
onReset = _this$props2.onReset;
|
|
110
|
+
form.resetFields();
|
|
111
|
+
var values = form.getFieldsValue();
|
|
112
|
+
onReset && onReset(values);
|
|
113
113
|
|
|
114
|
-
_this.updateDrawerFieldsValueCount(
|
|
114
|
+
_this.updateDrawerFieldsValueCount(values);
|
|
115
115
|
|
|
116
116
|
_this.onSubmit();
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
_this.onToggleExpand = function () {
|
|
120
|
-
var onToggleExpand = _this.props.onToggleExpand;
|
|
121
|
-
onToggleExpand && onToggleExpand(!_this.state.expanded);
|
|
122
|
-
|
|
123
120
|
_this.setState({
|
|
124
121
|
expanded: !_this.state.expanded
|
|
125
122
|
});
|
|
@@ -133,9 +130,10 @@ function (_React$PureComponent) {
|
|
|
133
130
|
|
|
134
131
|
_this.onFieldChange = function (name, value) {
|
|
135
132
|
var _this$props3 = _this.props,
|
|
133
|
+
form = _this$props3.form,
|
|
136
134
|
onChange = _this$props3.onChange,
|
|
137
135
|
actions = _this$props3.actions;
|
|
138
|
-
var values =
|
|
136
|
+
var values = form.getFieldsValue();
|
|
139
137
|
|
|
140
138
|
var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
|
|
141
139
|
|
|
@@ -150,52 +148,54 @@ function (_React$PureComponent) {
|
|
|
150
148
|
}
|
|
151
149
|
|
|
152
150
|
onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
|
|
153
|
-
actions.
|
|
151
|
+
actions.setData('formData', newValues);
|
|
152
|
+
actions.emit('formChange', newValues, changedInfo);
|
|
154
153
|
|
|
155
154
|
_this.updateDrawerFieldsValueCount(newValues);
|
|
156
155
|
};
|
|
157
156
|
|
|
158
157
|
_this.updateDrawerFieldsValueCount = function (values) {
|
|
159
158
|
var _this$props4 = _this.props,
|
|
160
|
-
|
|
159
|
+
form = _this$props4.form,
|
|
161
160
|
showFieldCount = _this$props4.showFieldCount,
|
|
162
161
|
children = _this$props4.children;
|
|
163
162
|
|
|
164
163
|
if (showFieldCount) {
|
|
165
|
-
values = values ||
|
|
166
|
-
var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
|
|
167
|
-
if (index >= showFieldCount && values[(0, _lodash.get)(cur, 'props.name')]) {
|
|
168
|
-
acc++;
|
|
169
|
-
}
|
|
164
|
+
values = values || form.getFieldsValue();
|
|
170
165
|
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
_this.setState({
|
|
167
|
+
drawerFieldsValueCount: children.reduce(function (acc, cur, index) {
|
|
168
|
+
if (index >= showFieldCount && values[(0, _lodash.get)(cur, 'props.name')]) {
|
|
169
|
+
acc++;
|
|
170
|
+
}
|
|
173
171
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
});
|
|
178
|
-
}
|
|
172
|
+
return acc;
|
|
173
|
+
}, 0)
|
|
174
|
+
});
|
|
179
175
|
}
|
|
180
176
|
};
|
|
181
177
|
|
|
182
178
|
_this.setFormData = function (data, needSearch) {
|
|
183
|
-
var
|
|
179
|
+
var _this$props5 = _this.props,
|
|
180
|
+
form = _this$props5.form,
|
|
181
|
+
actions = _this$props5.actions;
|
|
182
|
+
form.setFieldsValue(data);
|
|
184
183
|
actions.setData('formData', data);
|
|
185
184
|
needSearch && _this.onSubmit();
|
|
186
185
|
};
|
|
187
186
|
|
|
188
187
|
_this.resetFormData = function (needSearch) {
|
|
189
|
-
var _this$
|
|
190
|
-
|
|
191
|
-
actions = _this$
|
|
192
|
-
|
|
188
|
+
var _this$props6 = _this.props,
|
|
189
|
+
form = _this$props6.form,
|
|
190
|
+
actions = _this$props6.actions;
|
|
191
|
+
form.resetFieldsValue();
|
|
192
|
+
actions.setData('formData', data);
|
|
193
|
+
needSearch && _this.onSubmit();
|
|
193
194
|
};
|
|
194
195
|
|
|
195
196
|
var _props$showExpand = props.showExpand,
|
|
196
197
|
showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
|
|
197
|
-
renderActions = props.renderActions
|
|
198
|
-
_actions = props.actions;
|
|
198
|
+
renderActions = props.renderActions;
|
|
199
199
|
_this.state = {
|
|
200
200
|
showMore: false,
|
|
201
201
|
expanded: !showExpand || renderActions ? true : false,
|
|
@@ -204,13 +204,9 @@ function (_React$PureComponent) {
|
|
|
204
204
|
};
|
|
205
205
|
_this.fieldsRef = (0, _react.createRef)();
|
|
206
206
|
_this.formBoxRef = (0, _react.createRef)();
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
_actions.on('resetFormData', _this.resetFormData);
|
|
211
|
-
|
|
212
|
-
_actions.on('fieldChange', _this.onFieldChange);
|
|
213
|
-
|
|
207
|
+
props.actions.on('setFormData', _this.setFormData);
|
|
208
|
+
props.actions.on('resetFormData', _this.resetFormData);
|
|
209
|
+
props.actions.on('fieldChange', _this.onFieldChange);
|
|
214
210
|
return _this;
|
|
215
211
|
}
|
|
216
212
|
|
|
@@ -219,23 +215,24 @@ function (_React$PureComponent) {
|
|
|
219
215
|
value: function render() {
|
|
220
216
|
var _this2 = this;
|
|
221
217
|
|
|
222
|
-
var _this$
|
|
223
|
-
title = _this$
|
|
224
|
-
children = _this$
|
|
225
|
-
_this$
|
|
226
|
-
className = _this$
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
_this$
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
218
|
+
var _this$props7 = this.props,
|
|
219
|
+
title = _this$props7.title,
|
|
220
|
+
children = _this$props7.children,
|
|
221
|
+
_this$props7$classNam = _this$props7.className,
|
|
222
|
+
className = _this$props7$classNam === void 0 ? '' : _this$props7$classNam,
|
|
223
|
+
form = _this$props7.form,
|
|
224
|
+
actions = _this$props7.actions,
|
|
225
|
+
_this$props7$initialV = _this$props7.initialValues,
|
|
226
|
+
initialValues = _this$props7$initialV === void 0 ? {} : _this$props7$initialV,
|
|
227
|
+
renderActions = _this$props7.renderActions,
|
|
228
|
+
_this$props7$showSear = _this$props7.showSearch,
|
|
229
|
+
showSearch = _this$props7$showSear === void 0 ? true : _this$props7$showSear,
|
|
230
|
+
_this$props7$showRese = _this$props7.showReset,
|
|
231
|
+
showReset = _this$props7$showRese === void 0 ? true : _this$props7$showRese,
|
|
232
|
+
showFieldCount = _this$props7.showFieldCount,
|
|
233
|
+
_this$props7$drawerPr = _this$props7.drawerProps,
|
|
234
|
+
drawerProps = _this$props7$drawerPr === void 0 ? {} : _this$props7$drawerPr,
|
|
235
|
+
size = _this$props7.size; // 前期拼写错误,导致需要兼容错误的api
|
|
239
236
|
|
|
240
237
|
var extraActions = this.props.extraActions || this.props.extralActions;
|
|
241
238
|
var _this$state = this.state,
|
|
@@ -245,13 +242,7 @@ function (_React$PureComponent) {
|
|
|
245
242
|
drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
|
|
246
243
|
|
|
247
244
|
var renderFormActions = renderActions || function () {
|
|
248
|
-
return _react["default"].createElement(_react.Fragment, null,
|
|
249
|
-
count: drawerFieldsValueCount
|
|
250
|
-
}, _react["default"].createElement(_button["default"], {
|
|
251
|
-
onClick: _this2.onShowDrawer
|
|
252
|
-
}, _react["default"].createElement(_Icon["default"], {
|
|
253
|
-
type: "filter"
|
|
254
|
-
}), "\u66F4\u591A\u8FC7\u6EE4")), showSearch && _react["default"].createElement(_button["default"], {
|
|
245
|
+
return _react["default"].createElement(_react.Fragment, null, showSearch && _react["default"].createElement(_button["default"], {
|
|
255
246
|
type: "primary",
|
|
256
247
|
onClick: _this2.onSubmit
|
|
257
248
|
}, "\u641C\u7D22"), showReset && _react["default"].createElement(_button["default"], {
|
|
@@ -260,8 +251,15 @@ function (_React$PureComponent) {
|
|
|
260
251
|
className: "expand-link",
|
|
261
252
|
type: "link",
|
|
262
253
|
onClick: _this2.onToggleExpand
|
|
263
|
-
}, expanded ? '收起' : '展开'), _react["default"].
|
|
264
|
-
|
|
254
|
+
}, expanded ? '收起' : '展开'), showFieldCount && _react["default"].createElement(_badge["default"], {
|
|
255
|
+
count: drawerFieldsValueCount
|
|
256
|
+
}, _react["default"].createElement(_button["default"], {
|
|
257
|
+
icon: "filter",
|
|
258
|
+
onClick: _this2.onShowDrawer
|
|
259
|
+
}, "\u66F4\u591A\u8FC7\u6EE4")), _react["default"].Children.map(children, function (child) {
|
|
260
|
+
return child && (0, _lodash.get)(child, 'props.align') === 'right' && _react["default"].cloneElement(child, {
|
|
261
|
+
form: form
|
|
262
|
+
});
|
|
265
263
|
}));
|
|
266
264
|
};
|
|
267
265
|
|
|
@@ -280,6 +278,7 @@ function (_React$PureComponent) {
|
|
|
280
278
|
ref: this.fieldsRef
|
|
281
279
|
}, _react["default"].Children.map(children, function (child, index) {
|
|
282
280
|
return child && (0, _lodash.get)(child, 'props.align') !== 'right' && (!showFieldCount || showFieldCount > index) && _react["default"].cloneElement(child, {
|
|
281
|
+
form: form,
|
|
283
282
|
actions: actions,
|
|
284
283
|
initialValue: initialValues[child.props.name]
|
|
285
284
|
});
|
|
@@ -302,7 +301,7 @@ function (_React$PureComponent) {
|
|
|
302
301
|
}, className, className))
|
|
303
302
|
}), _react["default"].Children.map(children, function (child, index) {
|
|
304
303
|
return child && index >= showFieldCount && _react["default"].cloneElement(child, {
|
|
305
|
-
|
|
304
|
+
form: form,
|
|
306
305
|
actions: actions,
|
|
307
306
|
initialValue: initialValues[child.props.name]
|
|
308
307
|
});
|
|
@@ -311,7 +310,7 @@ function (_React$PureComponent) {
|
|
|
311
310
|
onClick: this.onSubmit
|
|
312
311
|
}, "\u641C\u7D22"), _react["default"].createElement(_button["default"], {
|
|
313
312
|
onClick: this.onReset
|
|
314
|
-
}, "\
|
|
313
|
+
}, "\u6E05\u7A7A"))), extraActions && _react["default"].createElement("div", {
|
|
315
314
|
className: "".concat(clsPrefix, "-extra")
|
|
316
315
|
}, extraActions));
|
|
317
316
|
}
|
|
@@ -344,7 +343,7 @@ function (_React$PureComponent) {
|
|
|
344
343
|
var _current$children;
|
|
345
344
|
|
|
346
345
|
var current = fieldsRef.current;
|
|
347
|
-
var height =
|
|
346
|
+
var height = "32px";
|
|
348
347
|
|
|
349
348
|
if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
|
|
350
349
|
height = window.getComputedStyle(current.children[0]).height;
|
|
@@ -372,22 +371,20 @@ function (_React$PureComponent) {
|
|
|
372
371
|
key: "componentDidMount",
|
|
373
372
|
value: function componentDidMount() {
|
|
374
373
|
var current = this.fieldsRef.current;
|
|
375
|
-
var _this$
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
_this$
|
|
382
|
-
|
|
383
|
-
renderActions = _this$props7.renderActions;
|
|
374
|
+
var _this$props8 = this.props,
|
|
375
|
+
actions = _this$props8.actions,
|
|
376
|
+
qlsProps = _this$props8.qlsProps,
|
|
377
|
+
form = _this$props8.form,
|
|
378
|
+
showFieldCount = _this$props8.showFieldCount,
|
|
379
|
+
_this$props8$showExpa = _this$props8.showExpand,
|
|
380
|
+
showExpand = _this$props8$showExpa === void 0 ? true : _this$props8$showExpa,
|
|
381
|
+
renderActions = _this$props8.renderActions;
|
|
384
382
|
|
|
385
383
|
if (qlsProps.memory) {
|
|
386
|
-
|
|
387
|
-
} else {
|
|
388
|
-
actions.setData('formData', initialValues);
|
|
384
|
+
form.setFieldsValue(_objectSpread({}, form.getFieldsValue(), {}, actions.getFormData()));
|
|
389
385
|
}
|
|
390
386
|
|
|
387
|
+
actions.setData('formData', form.getFieldsValue());
|
|
391
388
|
this.updateFieldHeight(); // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
|
|
392
389
|
|
|
393
390
|
if (!showFieldCount && !showExpand || renderActions) {
|
|
@@ -417,7 +414,6 @@ function (_React$PureComponent) {
|
|
|
417
414
|
}]);
|
|
418
415
|
|
|
419
416
|
return QueryForm;
|
|
420
|
-
}(_react["default"].
|
|
421
|
-
|
|
417
|
+
}(_react["default"].Component), _temp)) || _class);
|
|
422
418
|
exports["default"] = QueryForm;
|
|
423
419
|
;
|
|
@@ -21,18 +21,11 @@
|
|
|
21
21
|
display: inline-block;
|
|
22
22
|
height: 32px;
|
|
23
23
|
line-height: 32px;
|
|
24
|
-
|
|
25
|
-
& > *:not(.expand-link) {
|
|
26
|
-
margin-right: 10px;
|
|
27
|
-
}
|
|
28
24
|
& > .expand-link {
|
|
29
25
|
padding: 0;
|
|
30
|
-
margin-right: 0;
|
|
31
26
|
}
|
|
32
|
-
& >
|
|
33
|
-
|
|
34
|
-
margin-right: 8px;
|
|
35
|
-
}
|
|
27
|
+
& > *:not(:last-child) {
|
|
28
|
+
margin-right: 10px;
|
|
36
29
|
}
|
|
37
30
|
}
|
|
38
31
|
|
|
@@ -41,9 +34,6 @@
|
|
|
41
34
|
margin-bottom: 12px;
|
|
42
35
|
display: flex;
|
|
43
36
|
flex: 1;
|
|
44
|
-
&.ant-form-inline {
|
|
45
|
-
flex-wrap: unset;
|
|
46
|
-
}
|
|
47
37
|
|
|
48
38
|
& > div:nth-child(1) {
|
|
49
39
|
height: 32px;
|
|
@@ -75,12 +65,10 @@
|
|
|
75
65
|
|
|
76
66
|
&.ant-form-inline .ant-form-item {
|
|
77
67
|
margin-right: 10px;
|
|
78
|
-
display: inline-block;
|
|
79
68
|
}
|
|
80
69
|
|
|
81
70
|
.ant-form-item-control {
|
|
82
|
-
|
|
83
|
-
// min-width: 200px;
|
|
71
|
+
min-width: 160px;
|
|
84
72
|
line-height: unset;
|
|
85
73
|
.ant-calendar-picker-input {
|
|
86
74
|
padding: 0 11px;
|
|
@@ -89,7 +77,6 @@
|
|
|
89
77
|
& > .ant-input,
|
|
90
78
|
& > .ant-input-affix-wrapper {
|
|
91
79
|
width: 160px;
|
|
92
|
-
// width: 200px;
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
82
|
}
|
|
@@ -112,7 +99,6 @@
|
|
|
112
99
|
display: block;
|
|
113
100
|
margin-right: 0;
|
|
114
101
|
margin-bottom: 20px;
|
|
115
|
-
width: 100%;
|
|
116
102
|
}
|
|
117
103
|
.ant-form-item-label {
|
|
118
104
|
display: block;
|