tntd 1.3.56 → 1.3.60
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 +2 -2
- package/components/Layout/OrgAppList.js +1 -1
- package/components/QueryListScene/List.js +17 -13
- 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/ArrayInput/icon.js +31 -27
- package/lib/ArrayInput/index.js +298 -211
- package/lib/AuthContext.js +13 -2
- package/lib/BlockHeader/README.md +83 -0
- package/lib/BlockHeader/fonts/OswaldLight.ttf +0 -0
- package/lib/BlockHeader/index.js +42 -0
- package/lib/BlockHeader/index.less +141 -0
- package/lib/Columns/index.js +100 -71
- package/lib/DevelopmentLogin/LoginModal.js +141 -79
- package/lib/DevelopmentLogin/index.js +55 -28
- package/lib/Ellipsis/Svg/CopySVG.js +71 -23
- package/lib/Ellipsis/Svg/TickSVG.js +49 -17
- package/lib/Ellipsis/index.js +155 -149
- package/lib/Handle/index.js +109 -72
- package/lib/Icon/fonts/iconfont.js +43 -1
- package/lib/Icon/iconList.js +8 -119
- package/lib/Icon/index.js +45 -13
- package/lib/Img/Contain.js +81 -49
- package/lib/Img/Cover.js +136 -88
- package/lib/Img/index.js +89 -36
- package/lib/Layout/ActionsContext.js +11 -2
- package/lib/Layout/AppList.js +256 -262
- package/lib/Layout/Application.js +135 -119
- package/lib/Layout/Avatar.js +137 -137
- package/lib/Layout/CompatibleLanguage.js +195 -214
- package/lib/Layout/EnterpriseLayout/Avatar.js +168 -156
- package/lib/Layout/EnterpriseLayout/Language.js +100 -75
- package/lib/Layout/EnterpriseLayout/Theme.js +94 -96
- package/lib/Layout/EnterpriseLayout/index.js +45 -32
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +407 -335
- package/lib/Layout/GlobalNavigation/index.js +158 -110
- package/lib/Layout/Header.js +116 -165
- package/lib/Layout/HeaderActions.js +129 -170
- package/lib/Layout/HeaderNavs.js +113 -90
- package/lib/Layout/HeaderTabs.js +278 -312
- package/lib/Layout/Iconfont.js +15 -2
- package/lib/Layout/Language.js +102 -63
- package/lib/Layout/Layout.js +261 -272
- package/lib/Layout/Logo.js +87 -132
- package/lib/Layout/OrgAppList.js +319 -440
- package/lib/Layout/SideMenu.js +343 -429
- package/lib/Layout/Theme.js +124 -95
- package/lib/Layout/checkAuth.js +35 -21
- package/lib/Layout/createActions.js +51 -38
- package/lib/Layout/images/index.js +41 -33
- package/lib/Layout/index.js +161 -110
- package/lib/Layout/locale.js +53 -0
- package/lib/Layout/paaslayout/CompactSideMenu.js +178 -200
- package/lib/Layout/paaslayout/Header.js +90 -84
- package/lib/Layout/paaslayout/Logo.js +32 -27
- package/lib/Layout/paaslayout/SideMenu.js +174 -161
- package/lib/Layout/paaslayout/index.js +261 -240
- package/lib/Layout/paaslayout/index.less +75 -0
- package/lib/Layout/storage.js +78 -20
- package/lib/Layout/utils.js +143 -93
- package/lib/LoadingButton/index.js +57 -29
- package/lib/Modal/index.js +108 -83
- package/lib/Page/Box.js +81 -56
- package/lib/Page/index.js +173 -151
- package/lib/Page/utils.js +30 -12
- package/lib/QueryForm/Field/Checkbox.js +33 -11
- package/lib/QueryForm/Field/Select.js +99 -63
- package/lib/QueryForm/Field/SelectInput.js +114 -69
- package/lib/QueryForm/Field/fieldsMap.js +52 -30
- package/lib/QueryForm/Field/index.js +156 -75
- package/lib/QueryForm/createActions.js +65 -50
- package/lib/QueryForm/index.js +382 -303
- package/lib/QueryForm/useForm.js +17 -6
- package/lib/QueryListScene/Field/SelectInput.js +115 -0
- package/lib/QueryListScene/Field/fieldsMap.js +52 -0
- package/lib/QueryListScene/Field/index.js +159 -0
- package/lib/QueryListScene/Field/select.js +100 -0
- package/lib/QueryListScene/List.js +362 -285
- package/lib/QueryListScene/QueryForm/index.js +423 -0
- package/lib/QueryListScene/QueryForm/index.less +141 -0
- package/lib/QueryListScene/QueryForm.js +159 -91
- package/lib/QueryListScene/QueryListScene.js +87 -33
- package/lib/QueryListScene/Title.js +20 -10
- package/lib/QueryListScene/Toolbar.js +31 -8
- package/lib/QueryListScene/createActions.js +79 -64
- package/lib/QueryListScene/index.js +40 -23
- package/lib/QueryListScene/useActions.js +17 -6
- package/lib/Select/DropDownWrap.js +124 -60
- package/lib/Select/index.js +563 -426
- package/lib/Table/ResizableTable/index.js +121 -77
- package/lib/Table/index.js +51 -19
- package/lib/Title/index.js +52 -34
- package/lib/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
- package/lib/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
- package/lib/index.html +6 -0
- package/lib/index.js +159 -19
- package/lib/locale.js +63 -48
- package/lib/main.css +16420 -0
- package/lib/tntd.js +2 -0
- package/lib/tntd.js.LICENSE.txt +36 -0
- package/package.json +2 -2
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
require("antd/lib/form/style");
|
|
9
|
+
|
|
10
|
+
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
11
|
+
|
|
12
|
+
require("antd/lib/drawer/style");
|
|
13
|
+
|
|
14
|
+
var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
15
|
+
|
|
16
|
+
require("antd/lib/badge/style");
|
|
17
|
+
|
|
18
|
+
var _badge = _interopRequireDefault(require("antd/lib/badge"));
|
|
19
|
+
|
|
20
|
+
require("antd/lib/button/style");
|
|
21
|
+
|
|
22
|
+
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
+
|
|
26
|
+
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
27
|
+
|
|
28
|
+
var _lodash = require("lodash");
|
|
29
|
+
|
|
30
|
+
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
31
|
+
|
|
32
|
+
require("./index.less");
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
35
|
+
|
|
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; }
|
|
37
|
+
|
|
38
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
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
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
51
|
+
|
|
52
|
+
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); } }
|
|
53
|
+
|
|
54
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
55
|
+
|
|
56
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
57
|
+
|
|
58
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
59
|
+
|
|
60
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
61
|
+
|
|
62
|
+
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); }
|
|
63
|
+
|
|
64
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
65
|
+
|
|
66
|
+
var clsPrefix = 'tnt-querylistscene-queryform';
|
|
67
|
+
|
|
68
|
+
var QueryForm =
|
|
69
|
+
/*#__PURE__*/
|
|
70
|
+
function (_React$PureComponent) {
|
|
71
|
+
_inherits(QueryForm, _React$PureComponent);
|
|
72
|
+
|
|
73
|
+
function QueryForm(props) {
|
|
74
|
+
var _this;
|
|
75
|
+
|
|
76
|
+
_classCallCheck(this, QueryForm);
|
|
77
|
+
|
|
78
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
|
|
79
|
+
_this.onWindowResize = (0, _lodash.debounce)(function () {
|
|
80
|
+
var current = _this.fieldsRef.current;
|
|
81
|
+
|
|
82
|
+
if (current) {
|
|
83
|
+
setTimeout(function () {
|
|
84
|
+
_this.setState({
|
|
85
|
+
showMore: _this.isFieldsWidthOverflow()
|
|
86
|
+
});
|
|
87
|
+
}, 25);
|
|
88
|
+
}
|
|
89
|
+
}, 50);
|
|
90
|
+
|
|
91
|
+
_this.onSubmit = function () {
|
|
92
|
+
var _this$props = _this.props,
|
|
93
|
+
onSubmit = _this$props.onSubmit,
|
|
94
|
+
actions = _this$props.actions;
|
|
95
|
+
var values = actions.getFormData();
|
|
96
|
+
|
|
97
|
+
var params = _objectSpread({}, values, {
|
|
98
|
+
current: 1
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
actions.setData('formData', values);
|
|
102
|
+
onSubmit && onSubmit(params);
|
|
103
|
+
actions.emit('search', params);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_this.onReset = function () {
|
|
107
|
+
var _this$props2 = _this.props,
|
|
108
|
+
initialValues = _this$props2.initialValues,
|
|
109
|
+
onReset = _this$props2.onReset,
|
|
110
|
+
actions = _this$props2.actions;
|
|
111
|
+
actions.setFormData(initialValues, false);
|
|
112
|
+
onReset && onReset(initialValues);
|
|
113
|
+
|
|
114
|
+
_this.updateDrawerFieldsValueCount(initialValues);
|
|
115
|
+
|
|
116
|
+
_this.onSubmit();
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
_this.onToggleExpand = function () {
|
|
120
|
+
var onToggleExpand = _this.props.onToggleExpand;
|
|
121
|
+
onToggleExpand && onToggleExpand(!_this.state.expanded);
|
|
122
|
+
|
|
123
|
+
_this.setState({
|
|
124
|
+
expanded: !_this.state.expanded
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
_this.onShowDrawer = function () {
|
|
129
|
+
_this.setState({
|
|
130
|
+
drawerVisible: true
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
_this.onFieldChange = function (name, value) {
|
|
135
|
+
var _this$props3 = _this.props,
|
|
136
|
+
onChange = _this$props3.onChange,
|
|
137
|
+
actions = _this$props3.actions;
|
|
138
|
+
var values = actions.getFormData() || {};
|
|
139
|
+
|
|
140
|
+
var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
|
|
141
|
+
|
|
142
|
+
var changedInfo = {
|
|
143
|
+
name: name,
|
|
144
|
+
value: value,
|
|
145
|
+
preValue: values[name]
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
149
|
+
rest[_key - 2] = arguments[_key];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
|
|
153
|
+
actions.setFormData(newValues, false);
|
|
154
|
+
|
|
155
|
+
_this.updateDrawerFieldsValueCount(newValues);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
_this.updateDrawerFieldsValueCount = function (values) {
|
|
159
|
+
var _this$props4 = _this.props,
|
|
160
|
+
actions = _this$props4.actions,
|
|
161
|
+
showFieldCount = _this$props4.showFieldCount,
|
|
162
|
+
children = _this$props4.children;
|
|
163
|
+
|
|
164
|
+
if (showFieldCount) {
|
|
165
|
+
values = values || actions.getFormData();
|
|
166
|
+
var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
|
|
167
|
+
if (index >= showFieldCount && values[(0, _lodash.get)(cur, 'props.name')]) {
|
|
168
|
+
acc++;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return acc;
|
|
172
|
+
}, 0);
|
|
173
|
+
|
|
174
|
+
if (drawerFieldsValueCount !== _this.state.drawerFieldsValueCount) {
|
|
175
|
+
_this.setState({
|
|
176
|
+
drawerFieldsValueCount: drawerFieldsValueCount
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
_this.setFormData = function (data, needSearch) {
|
|
183
|
+
var actions = _this.props.actions;
|
|
184
|
+
actions.setData('formData', data);
|
|
185
|
+
needSearch && _this.onSubmit();
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
_this.resetFormData = function (needSearch) {
|
|
189
|
+
var _this$props5 = _this.props,
|
|
190
|
+
initialValues = _this$props5.initialValues,
|
|
191
|
+
actions = _this$props5.actions;
|
|
192
|
+
actions.setFormData(initialValues, needSearch);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
var _props$showExpand = props.showExpand,
|
|
196
|
+
showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
|
|
197
|
+
renderActions = props.renderActions,
|
|
198
|
+
_actions = props.actions;
|
|
199
|
+
_this.state = {
|
|
200
|
+
showMore: false,
|
|
201
|
+
expanded: !showExpand || renderActions ? true : false,
|
|
202
|
+
drawerVisible: false,
|
|
203
|
+
drawerFieldsValueCount: 0
|
|
204
|
+
};
|
|
205
|
+
_this.fieldsRef = (0, _react.createRef)();
|
|
206
|
+
_this.formBoxRef = (0, _react.createRef)();
|
|
207
|
+
|
|
208
|
+
_actions.on('setFormData', _this.setFormData);
|
|
209
|
+
|
|
210
|
+
_actions.on('resetFormData', _this.resetFormData);
|
|
211
|
+
|
|
212
|
+
_actions.on('fieldChange', _this.onFieldChange);
|
|
213
|
+
|
|
214
|
+
return _this;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
_createClass(QueryForm, [{
|
|
218
|
+
key: "render",
|
|
219
|
+
value: function render() {
|
|
220
|
+
var _this2 = this;
|
|
221
|
+
|
|
222
|
+
var _this$props6 = this.props,
|
|
223
|
+
title = _this$props6.title,
|
|
224
|
+
children = _this$props6.children,
|
|
225
|
+
_this$props6$classNam = _this$props6.className,
|
|
226
|
+
className = _this$props6$classNam === void 0 ? '' : _this$props6$classNam,
|
|
227
|
+
actions = _this$props6.actions,
|
|
228
|
+
_this$props6$initialV = _this$props6.initialValues,
|
|
229
|
+
initialValues = _this$props6$initialV === void 0 ? {} : _this$props6$initialV,
|
|
230
|
+
renderActions = _this$props6.renderActions,
|
|
231
|
+
_this$props6$showSear = _this$props6.showSearch,
|
|
232
|
+
showSearch = _this$props6$showSear === void 0 ? true : _this$props6$showSear,
|
|
233
|
+
_this$props6$showRese = _this$props6.showReset,
|
|
234
|
+
showReset = _this$props6$showRese === void 0 ? true : _this$props6$showRese,
|
|
235
|
+
showFieldCount = _this$props6.showFieldCount,
|
|
236
|
+
_this$props6$drawerPr = _this$props6.drawerProps,
|
|
237
|
+
drawerProps = _this$props6$drawerPr === void 0 ? {} : _this$props6$drawerPr,
|
|
238
|
+
size = _this$props6.size; // 前期拼写错误,导致需要兼容错误的api
|
|
239
|
+
|
|
240
|
+
var extraActions = this.props.extraActions || this.props.extralActions;
|
|
241
|
+
var _this$state = this.state,
|
|
242
|
+
expanded = _this$state.expanded,
|
|
243
|
+
showMore = _this$state.showMore,
|
|
244
|
+
drawerVisible = _this$state.drawerVisible,
|
|
245
|
+
drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
|
|
246
|
+
|
|
247
|
+
var renderFormActions = renderActions || function () {
|
|
248
|
+
return _react["default"].createElement(_react.Fragment, null, showFieldCount && _react["default"].createElement(_badge["default"], {
|
|
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"], {
|
|
255
|
+
type: "primary",
|
|
256
|
+
onClick: _this2.onSubmit
|
|
257
|
+
}, "\u641C\u7D22"), showReset && _react["default"].createElement(_button["default"], {
|
|
258
|
+
onClick: _this2.onReset
|
|
259
|
+
}, "\u91CD\u7F6E"), showMore && !showFieldCount && _react["default"].createElement(_button["default"], {
|
|
260
|
+
className: "expand-link",
|
|
261
|
+
type: "link",
|
|
262
|
+
onClick: _this2.onToggleExpand
|
|
263
|
+
}, expanded ? '收起' : '展开'), _react["default"].Children.map(children, function (child) {
|
|
264
|
+
return child && (0, _lodash.get)(child, 'props.align') === 'right' && _react["default"].cloneElement(child);
|
|
265
|
+
}));
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
return _react["default"].createElement("div", {
|
|
269
|
+
ref: this.formBoxRef,
|
|
270
|
+
className: (0, _classnames3["default"])(clsPrefix, _defineProperty({}, className, className))
|
|
271
|
+
}, title && _react["default"].createElement("span", {
|
|
272
|
+
className: "".concat(clsPrefix, "-title")
|
|
273
|
+
}, title), _react["default"].createElement(_form["default"], {
|
|
274
|
+
layout: "inline",
|
|
275
|
+
className: (0, _classnames3["default"])({
|
|
276
|
+
expanded: !showMore || expanded,
|
|
277
|
+
showMore: showMore
|
|
278
|
+
})
|
|
279
|
+
}, _react["default"].createElement("div", {
|
|
280
|
+
ref: this.fieldsRef
|
|
281
|
+
}, _react["default"].Children.map(children, function (child, index) {
|
|
282
|
+
return child && (0, _lodash.get)(child, 'props.align') !== 'right' && (!showFieldCount || showFieldCount > index) && _react["default"].cloneElement(child, {
|
|
283
|
+
actions: actions,
|
|
284
|
+
initialValue: initialValues[child.props.name]
|
|
285
|
+
});
|
|
286
|
+
})), _react["default"].createElement("div", {
|
|
287
|
+
className: "query-form-actions"
|
|
288
|
+
}, renderFormActions()), showFieldCount && _react["default"].createElement(_drawer["default"], _extends({
|
|
289
|
+
title: "\u66F4\u591A\u8FC7\u6EE4",
|
|
290
|
+
visible: drawerVisible,
|
|
291
|
+
onClose: function onClose() {
|
|
292
|
+
return _this2.setState({
|
|
293
|
+
drawerVisible: false
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
width: 300,
|
|
297
|
+
size: size,
|
|
298
|
+
getContainer: false
|
|
299
|
+
}, drawerProps, {
|
|
300
|
+
className: (0, _classnames3["default"])("".concat(clsPrefix, "-drawer"), _defineProperty({
|
|
301
|
+
'large-size': size === 'large'
|
|
302
|
+
}, className, className))
|
|
303
|
+
}), _react["default"].Children.map(children, function (child, index) {
|
|
304
|
+
return child && index >= showFieldCount && _react["default"].cloneElement(child, {
|
|
305
|
+
isFieldInDrawer: true,
|
|
306
|
+
actions: actions,
|
|
307
|
+
initialValue: initialValues[child.props.name]
|
|
308
|
+
});
|
|
309
|
+
}), _react["default"].createElement(_button["default"], {
|
|
310
|
+
type: "primary",
|
|
311
|
+
onClick: this.onSubmit
|
|
312
|
+
}, "\u641C\u7D22"), _react["default"].createElement(_button["default"], {
|
|
313
|
+
onClick: this.onReset
|
|
314
|
+
}, "\u91CD\u7F6E"))), extraActions && _react["default"].createElement("div", {
|
|
315
|
+
className: "".concat(clsPrefix, "-extra")
|
|
316
|
+
}, extraActions));
|
|
317
|
+
}
|
|
318
|
+
}, {
|
|
319
|
+
key: "isFieldsWidthOverflow",
|
|
320
|
+
value: function isFieldsWidthOverflow() {
|
|
321
|
+
var current = this.fieldsRef.current;
|
|
322
|
+
|
|
323
|
+
if (current) {
|
|
324
|
+
return current.offsetWidth < [].reduce.call(current.children, function (acc, cur) {
|
|
325
|
+
var marginArray = window.getComputedStyle(cur).margin.split(' ').map(function (str) {
|
|
326
|
+
return parseInt(str, 10);
|
|
327
|
+
});
|
|
328
|
+
acc += cur.offsetWidth + marginArray[1];
|
|
329
|
+
return acc;
|
|
330
|
+
}, 0);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}, {
|
|
336
|
+
key: "updateFieldHeight",
|
|
337
|
+
value: function updateFieldHeight() {
|
|
338
|
+
var _formBoxRef$current, _formBoxRef$current2, _fieldsRef$current;
|
|
339
|
+
|
|
340
|
+
var formBoxRef = this.formBoxRef,
|
|
341
|
+
fieldsRef = this.fieldsRef;
|
|
342
|
+
|
|
343
|
+
var getFieldHeight = function getFieldHeight() {
|
|
344
|
+
var _current$children;
|
|
345
|
+
|
|
346
|
+
var current = fieldsRef.current;
|
|
347
|
+
var height = '32px';
|
|
348
|
+
|
|
349
|
+
if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
|
|
350
|
+
height = window.getComputedStyle(current.children[0]).height;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return height;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
var queryFormActionsDom = formBoxRef == null ? void 0 : (_formBoxRef$current = formBoxRef.current) == null ? void 0 : _formBoxRef$current.querySelector('.query-form-actions');
|
|
357
|
+
var queryFormExtraDom = formBoxRef == null ? void 0 : (_formBoxRef$current2 = formBoxRef.current) == null ? void 0 : _formBoxRef$current2.querySelector(".".concat(clsPrefix, "-extra"));
|
|
358
|
+
var formItemsDomList = fieldsRef == null ? void 0 : (_fieldsRef$current = fieldsRef.current) == null ? void 0 : _fieldsRef$current.querySelectorAll('.ant-form-item-control');
|
|
359
|
+
var fieldHeight = getFieldHeight();
|
|
360
|
+
fieldsRef.current.style.height = fieldHeight;
|
|
361
|
+
[queryFormActionsDom, queryFormExtraDom].forEach(function (item) {
|
|
362
|
+
item && Object.assign(item.style, {
|
|
363
|
+
height: fieldHeight,
|
|
364
|
+
lineHeight: fieldHeight
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
[].forEach.call(formItemsDomList, function (item) {
|
|
368
|
+
item.style.lineHeight = fieldHeight;
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}, {
|
|
372
|
+
key: "componentDidMount",
|
|
373
|
+
value: function componentDidMount() {
|
|
374
|
+
var current = this.fieldsRef.current;
|
|
375
|
+
var _this$props7 = this.props,
|
|
376
|
+
_this$props7$initialV = _this$props7.initialValues,
|
|
377
|
+
initialValues = _this$props7$initialV === void 0 ? {} : _this$props7$initialV,
|
|
378
|
+
actions = _this$props7.actions,
|
|
379
|
+
qlsProps = _this$props7.qlsProps,
|
|
380
|
+
showFieldCount = _this$props7.showFieldCount,
|
|
381
|
+
_this$props7$showExpa = _this$props7.showExpand,
|
|
382
|
+
showExpand = _this$props7$showExpa === void 0 ? true : _this$props7$showExpa,
|
|
383
|
+
renderActions = _this$props7.renderActions;
|
|
384
|
+
|
|
385
|
+
if (qlsProps.memory) {
|
|
386
|
+
actions.setFormData(_objectSpread({}, initialValues, {}, actions.getFormData()), false);
|
|
387
|
+
} else {
|
|
388
|
+
actions.setData('formData', initialValues);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
this.updateFieldHeight(); // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
|
|
392
|
+
|
|
393
|
+
if (!showFieldCount && !showExpand || renderActions) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (!showFieldCount) {
|
|
398
|
+
if (current && this.isFieldsWidthOverflow()) {
|
|
399
|
+
this.setState({
|
|
400
|
+
showMore: true
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
window.addEventListener('resize', this.onWindowResize);
|
|
405
|
+
} else {
|
|
406
|
+
this.updateDrawerFieldsValueCount();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}, {
|
|
410
|
+
key: "componentWillUnmount",
|
|
411
|
+
value: function componentWillUnmount() {
|
|
412
|
+
var actions = this.props.actions;
|
|
413
|
+
actions.removeListener('setFormData', this.setFormData);
|
|
414
|
+
actions.removeListener('fieldChange', this.onFieldChange);
|
|
415
|
+
window.removeEventListener('resize', this.onWindowResize);
|
|
416
|
+
}
|
|
417
|
+
}]);
|
|
418
|
+
|
|
419
|
+
return QueryForm;
|
|
420
|
+
}(_react["default"].PureComponent);
|
|
421
|
+
|
|
422
|
+
exports["default"] = QueryForm;
|
|
423
|
+
;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
.tnt-querylistscene-queryform {
|
|
2
|
+
display: flex;
|
|
3
|
+
|
|
4
|
+
&-title {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
line-height: 32px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-extra {
|
|
12
|
+
line-height: 32px;
|
|
13
|
+
margin-left: 12px;
|
|
14
|
+
& > * {
|
|
15
|
+
margin-left: 8px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.query-form-actions {
|
|
20
|
+
align-items: center;
|
|
21
|
+
display: inline-block;
|
|
22
|
+
height: 32px;
|
|
23
|
+
line-height: 32px;
|
|
24
|
+
|
|
25
|
+
& > *:not(.expand-link) {
|
|
26
|
+
margin-right: 10px;
|
|
27
|
+
}
|
|
28
|
+
& > .expand-link {
|
|
29
|
+
padding: 0;
|
|
30
|
+
margin-right: 0;
|
|
31
|
+
}
|
|
32
|
+
& > .ant-badge {
|
|
33
|
+
.tnt-icon {
|
|
34
|
+
margin-right: 8px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ant-form {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
margin-bottom: 12px;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex: 1;
|
|
44
|
+
&.ant-form-inline {
|
|
45
|
+
flex-wrap: unset;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
& > div:nth-child(1) {
|
|
49
|
+
height: 32px;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
.ant-form-item-label {
|
|
52
|
+
label {
|
|
53
|
+
bottom: 4px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.expanded {
|
|
59
|
+
& > div:nth-child(1) {
|
|
60
|
+
height: auto !important;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.showMore {
|
|
65
|
+
& > div:nth-child(1) {
|
|
66
|
+
.ant-form-item {
|
|
67
|
+
margin-bottom: 12px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
& > div:nth-child(2) {
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.ant-form-inline .ant-form-item {
|
|
77
|
+
margin-right: 10px;
|
|
78
|
+
display: inline-block;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ant-form-item-control {
|
|
82
|
+
// min-width: 160px;
|
|
83
|
+
// min-width: 200px;
|
|
84
|
+
line-height: unset;
|
|
85
|
+
.ant-calendar-picker-input {
|
|
86
|
+
padding: 0 11px;
|
|
87
|
+
}
|
|
88
|
+
.ant-form-item-children {
|
|
89
|
+
& > .ant-input,
|
|
90
|
+
& > .ant-input-affix-wrapper {
|
|
91
|
+
width: 160px;
|
|
92
|
+
// width: 200px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&-drawer {
|
|
99
|
+
margin-top: 50px;
|
|
100
|
+
&.large-size {
|
|
101
|
+
margin-top: 60px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.ant-drawer.ant-drawer-open {
|
|
105
|
+
.ant-drawer-mask {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
background: unset;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
.ant-drawer-body {
|
|
111
|
+
.ant-form-item {
|
|
112
|
+
display: block;
|
|
113
|
+
margin-right: 0;
|
|
114
|
+
margin-bottom: 20px;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
.ant-form-item-label {
|
|
118
|
+
display: block;
|
|
119
|
+
text-align: left;
|
|
120
|
+
line-height: 22px;
|
|
121
|
+
margin-bottom: 10px;
|
|
122
|
+
}
|
|
123
|
+
.ant-form-item-control-wrapper,
|
|
124
|
+
.ant-form-item-control,
|
|
125
|
+
.ant-calendar-picker,
|
|
126
|
+
.ant-input {
|
|
127
|
+
min-width: 100%;
|
|
128
|
+
width: 100%;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
& > .ant-btn {
|
|
132
|
+
display: block;
|
|
133
|
+
width: 100%;
|
|
134
|
+
margin-bottom: 10px;
|
|
135
|
+
&.ant-btn-primary {
|
|
136
|
+
margin-top: 20px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|