cloud-b2b 1.1.45 → 1.1.50
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/es/Area/Area.js +45 -16
- package/es/Card/Card.js +4 -3
- package/es/CodeInput/CodeInput.js +59 -30
- package/es/Control/Control.js +117 -58
- package/es/Control/event.js +14 -0
- package/es/Enhance/Dialogs.js +21 -6
- package/es/Enhance/Loading.js +46 -26
- package/es/Enhance/index.js +2 -0
- package/es/Header/Header.js +35 -3
- package/es/Header/Vertical.js +24 -1
- package/es/ImageView/ImageView.js +22 -5
- package/es/Indent/Indent.js +7 -3
- package/es/InpurCascader/InputCascader.js +36 -10
- package/es/InputEditor/InputEditor.js +52 -53
- package/es/InputSearch/InputSearch.js +71 -26
- package/es/InputSelect/InputSelect.js +48 -17
- package/es/InputTreeSelect/InputTreeSelect.js +147 -0
- package/es/InputTreeSelect/package.json +6 -0
- package/es/InputWriting/InputWriting.js +28 -6
- package/es/Layout/Layout.js +59 -28
- package/es/LayoutLink/LayoutLink.js +20 -11
- package/es/Link/Link.js +27 -4
- package/es/Loading/Loading.js +3 -1
- package/es/Loading2/Loading2.js +2 -0
- package/es/ModalWithDrag/ModalWithDrag.js +8 -3
- package/es/ModalWithDrag/drag.js +29 -12
- package/es/NumberInput/NumberInput.js +64 -24
- package/es/Search/Search.js +164 -54
- package/es/Sidebar/Sidebar.js +34 -13
- package/es/Sidebar2/Sidebar.js +30 -3
- package/es/SuperForm/SuperForm.js +164 -27
- package/es/SuperForm2/SuperForm.js +182 -31
- package/es/SuperIcon/SuperIcon.js +6 -3
- package/es/SuperPagination/SuperPagination.js +32 -15
- package/es/SuperTab/SuperTab.js +27 -4
- package/es/SuperTab2/SuperTab2.js +33 -11
- package/es/SuperTable/DragSortRow.js +34 -6
- package/es/SuperTable/FilterDropDown.js +34 -10
- package/es/SuperTable/SuperTable.js +216 -84
- package/es/SuperTable/fixed.js +9 -1
- package/es/SuperTable2/SuperTable2.js +227 -102
- package/es/SuperTable2/SuperTableCell.js +60 -16
- package/es/SuperTable3/FilterDropDown.js +34 -10
- package/es/SuperTable3/SuperTable.js +175 -50
- package/es/SuperTable3/fixed.js +9 -1
- package/es/SuperToolbar/SuperToolbar.js +49 -21
- package/es/SuperUpload/SuperUpload.js +233 -156
- package/es/Title/Title.js +15 -12
- package/es/Viewer/ImageViews.js +60 -7
- package/es/Viewer/Viewer.js +32 -5
- package/es/WingBlank/WingBlank.js +6 -2
- package/es/helper.js +29 -7
- package/es/history.js +2 -3
- package/lib/Area/Area.js +64 -16
- package/lib/Card/Card.js +13 -3
- package/lib/CodeInput/CodeInput.js +77 -30
- package/lib/Control/Control.js +160 -58
- package/lib/Control/event.js +16 -0
- package/lib/Enhance/Dialogs.js +32 -6
- package/lib/Enhance/Loading.js +62 -26
- package/lib/Enhance/index.js +9 -0
- package/lib/Header/Header.js +48 -3
- package/lib/Header/Vertical.js +36 -1
- package/lib/ImageView/ImageView.js +30 -5
- package/lib/Indent/Indent.js +13 -3
- package/lib/InpurCascader/InputCascader.js +50 -11
- package/lib/InputEditor/InputEditor.js +61 -53
- package/lib/InputSearch/InputSearch.js +78 -26
- package/lib/InputSelect/InputSelect.js +62 -17
- package/lib/InputTreeSelect/InputTreeSelect.js +169 -0
- package/lib/InputTreeSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +35 -6
- package/lib/Layout/Layout.js +76 -28
- package/lib/LayoutLink/LayoutLink.js +38 -11
- package/lib/Link/Link.js +40 -4
- package/lib/Loading/Loading.js +9 -1
- package/lib/Loading2/Loading2.js +8 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +18 -3
- package/lib/ModalWithDrag/drag.js +34 -12
- package/lib/NumberInput/NumberInput.js +77 -24
- package/lib/Search/Search.js +171 -54
- package/lib/Sidebar/Sidebar.js +46 -13
- package/lib/Sidebar2/Sidebar.js +42 -3
- package/lib/SuperForm/SuperForm.js +162 -27
- package/lib/SuperForm2/SuperForm.js +175 -31
- package/lib/SuperIcon/SuperIcon.js +14 -3
- package/lib/SuperPagination/SuperPagination.js +42 -15
- package/lib/SuperTab/SuperTab.js +34 -4
- package/lib/SuperTab2/SuperTab2.js +48 -11
- package/lib/SuperTable/DragSortRow.js +42 -6
- package/lib/SuperTable/FilterDropDown.js +42 -10
- package/lib/SuperTable/SuperTable.js +211 -83
- package/lib/SuperTable/fixed.js +13 -1
- package/lib/SuperTable2/SuperTable2.js +241 -102
- package/lib/SuperTable2/SuperTableCell.js +67 -13
- package/lib/SuperTable3/FilterDropDown.js +42 -10
- package/lib/SuperTable3/SuperTable.js +170 -49
- package/lib/SuperTable3/fixed.js +13 -1
- package/lib/SuperToolbar/SuperToolbar.js +64 -20
- package/lib/SuperUpload/SuperUpload.js +267 -156
- package/lib/Title/Title.js +24 -12
- package/lib/Viewer/ImageViews.js +63 -7
- package/lib/Viewer/Viewer.js +41 -5
- package/lib/WingBlank/WingBlank.js +14 -2
- package/lib/helper.js +47 -6
- package/lib/history.js +5 -0
- package/lib/index.js +76 -0
- package/lib/variables.js +4 -0
- package/package.json +2 -2
|
@@ -28,10 +28,15 @@ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
|
|
|
28
28
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
29
29
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
30
30
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
31
|
+
|
|
31
32
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
32
34
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context26, _context27; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context26 = ownKeys(Object(source), !0)).call(_context26, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context27 = ownKeys(Object(source))).call(_context27, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
|
|
33
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
+
|
|
34
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
+
|
|
35
40
|
import React from 'react';
|
|
36
41
|
import PropTypes from 'prop-types';
|
|
37
42
|
import ReactDOM from 'react-dom';
|
|
@@ -41,8 +46,7 @@ import variables from '../variables';
|
|
|
41
46
|
var FormItem = _Form.Item;
|
|
42
47
|
var defaultSize = 'large';
|
|
43
48
|
var defaultColNum = 4;
|
|
44
|
-
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox'];
|
|
45
|
-
|
|
49
|
+
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox', 'treeSelect'];
|
|
46
50
|
/**
|
|
47
51
|
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
48
52
|
* title:[必须],表单元素的标签
|
|
@@ -53,6 +57,7 @@ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText',
|
|
|
53
57
|
* showAdd: [可选],是否显示+号,点击+号会触发onAdd事件,默认为false
|
|
54
58
|
* rule: [可选],用于设置校验规则
|
|
55
59
|
*/
|
|
60
|
+
|
|
56
61
|
var ControlType = {
|
|
57
62
|
key: PropTypes.string.isRequired,
|
|
58
63
|
title: PropTypes.string,
|
|
@@ -65,25 +70,35 @@ var ControlType = {
|
|
|
65
70
|
rule: PropTypes.object,
|
|
66
71
|
props: PropTypes.object
|
|
67
72
|
};
|
|
73
|
+
|
|
68
74
|
var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
69
75
|
_inherits(Controlled, _React$Component);
|
|
76
|
+
|
|
70
77
|
var _super = _createSuper(Controlled);
|
|
78
|
+
|
|
71
79
|
function Controlled(props) {
|
|
72
80
|
var _this;
|
|
81
|
+
|
|
73
82
|
_classCallCheck(this, Controlled);
|
|
83
|
+
|
|
74
84
|
_this = _super.call(this, props);
|
|
85
|
+
|
|
75
86
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (value) {
|
|
76
87
|
var onChange = _this.props.onChange;
|
|
88
|
+
|
|
77
89
|
_this.setState({
|
|
78
90
|
value: value
|
|
79
91
|
});
|
|
92
|
+
|
|
80
93
|
onChange && onChange(value);
|
|
81
94
|
});
|
|
95
|
+
|
|
82
96
|
_this.state = {
|
|
83
97
|
value: props.value
|
|
84
98
|
};
|
|
85
99
|
return _this;
|
|
86
100
|
}
|
|
101
|
+
|
|
87
102
|
_createClass(Controlled, [{
|
|
88
103
|
key: "componentWillReceiveProps",
|
|
89
104
|
value: function componentWillReceiveProps(nextProps) {
|
|
@@ -101,9 +116,11 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
101
116
|
value: this.state.value,
|
|
102
117
|
onChange: this.onChange
|
|
103
118
|
});
|
|
119
|
+
|
|
104
120
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
105
121
|
}
|
|
106
122
|
}]);
|
|
123
|
+
|
|
107
124
|
return Controlled;
|
|
108
125
|
}(React.Component);
|
|
109
126
|
/**
|
|
@@ -119,62 +136,86 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
119
136
|
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
120
137
|
* onFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
121
138
|
*/
|
|
139
|
+
|
|
140
|
+
|
|
122
141
|
var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
123
142
|
_inherits(SuperForm2, _React$Component2);
|
|
143
|
+
|
|
124
144
|
var _super2 = _createSuper(SuperForm2);
|
|
145
|
+
|
|
125
146
|
function SuperForm2() {
|
|
126
147
|
var _context;
|
|
148
|
+
|
|
127
149
|
var _this2;
|
|
150
|
+
|
|
128
151
|
_classCallCheck(this, SuperForm2);
|
|
152
|
+
|
|
129
153
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
130
154
|
args[_key] = arguments[_key];
|
|
131
155
|
}
|
|
156
|
+
|
|
132
157
|
_this2 = _super2.call.apply(_super2, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
158
|
+
|
|
133
159
|
_defineProperty(_assertThisInitialized(_this2), "onAdd", function (key, title) {
|
|
134
160
|
var onAdd = _this2.props.onAdd;
|
|
135
161
|
onAdd && onAdd(key, title);
|
|
136
162
|
});
|
|
163
|
+
|
|
137
164
|
_defineProperty(_assertThisInitialized(_this2), "onFileChange", function (_ref, file) {
|
|
138
165
|
var key = _ref.key;
|
|
139
166
|
var onFileChange = _this2.props.onFileChange;
|
|
140
167
|
onFileChange && onFileChange(key, file);
|
|
141
168
|
});
|
|
169
|
+
|
|
142
170
|
_defineProperty(_assertThisInitialized(_this2), "onChange", function (key, value) {
|
|
143
171
|
var onChange = _this2.props.onChange;
|
|
172
|
+
|
|
144
173
|
if (onChange) {
|
|
145
174
|
_this2.onExitValid(key);
|
|
175
|
+
|
|
146
176
|
onChange(key, value);
|
|
147
177
|
}
|
|
148
178
|
});
|
|
179
|
+
|
|
149
180
|
_defineProperty(_assertThisInitialized(_this2), "onGetCode", function (key, value) {
|
|
150
181
|
var onGetCode = _this2.props.onGetCode;
|
|
151
182
|
onGetCode && onGetCode();
|
|
152
183
|
});
|
|
184
|
+
|
|
153
185
|
_defineProperty(_assertThisInitialized(_this2), "onBlur", function (key, value) {
|
|
154
186
|
var onChange = _this2.props.onChange;
|
|
187
|
+
|
|
155
188
|
if (onChange) {
|
|
156
189
|
_this2.onExitValid(key);
|
|
190
|
+
|
|
157
191
|
onChange(key, value);
|
|
158
192
|
}
|
|
159
193
|
});
|
|
194
|
+
|
|
160
195
|
_defineProperty(_assertThisInitialized(_this2), "onExitValid", function (key, value) {
|
|
161
196
|
if (key === _this2.validKey) {
|
|
162
197
|
_this2.validKey = '';
|
|
198
|
+
|
|
163
199
|
_this2.props.onExitValid();
|
|
164
200
|
}
|
|
201
|
+
|
|
165
202
|
_this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
|
|
166
203
|
});
|
|
204
|
+
|
|
167
205
|
// 动态生成getValidState方法
|
|
168
206
|
_defineProperty(_assertThisInitialized(_this2), "initValidState", function () {
|
|
169
207
|
var _this2$props = _this2.props,
|
|
170
|
-
|
|
171
|
-
|
|
208
|
+
value = _this2$props.value,
|
|
209
|
+
valid = _this2$props.valid;
|
|
210
|
+
|
|
172
211
|
var invalid = function invalid() {
|
|
173
212
|
return null;
|
|
174
213
|
};
|
|
214
|
+
|
|
175
215
|
var _valid = function _valid(_ref2) {
|
|
176
216
|
var key = _ref2.key,
|
|
177
|
-
|
|
217
|
+
required = _ref2.required;
|
|
218
|
+
|
|
178
219
|
if (required) {
|
|
179
220
|
if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
|
|
180
221
|
_this2.getValidState = invalid;
|
|
@@ -182,16 +223,20 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
182
223
|
return 'error';
|
|
183
224
|
}
|
|
184
225
|
}
|
|
226
|
+
|
|
185
227
|
return null;
|
|
186
228
|
};
|
|
229
|
+
|
|
187
230
|
_this2.getValidState = valid ? _valid : invalid;
|
|
188
231
|
});
|
|
232
|
+
|
|
189
233
|
_defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref3) {
|
|
190
234
|
var key = _ref3.key,
|
|
191
|
-
|
|
235
|
+
type = _ref3.type;
|
|
192
236
|
return function (date) {
|
|
193
237
|
var _this2$props$value = _this2.props.value,
|
|
194
|
-
|
|
238
|
+
value = _this2$props$value === void 0 ? {} : _this2$props$value;
|
|
239
|
+
|
|
195
240
|
if (!date || !value[key]) {
|
|
196
241
|
return false;
|
|
197
242
|
} else {
|
|
@@ -205,8 +250,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
205
250
|
}
|
|
206
251
|
};
|
|
207
252
|
});
|
|
253
|
+
|
|
208
254
|
_defineProperty(_assertThisInitialized(_this2), "getPopupContainer", function () {
|
|
209
255
|
var container = _this2.props.container;
|
|
256
|
+
|
|
210
257
|
if (typeof container === 'undefined') {
|
|
211
258
|
return ReactDOM.findDOMNode(_assertThisInitialized(_this2));
|
|
212
259
|
} else if (typeof container === 'boolean') {
|
|
@@ -215,18 +262,22 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
215
262
|
return ReactDOM.findDOMNode(container);
|
|
216
263
|
}
|
|
217
264
|
});
|
|
265
|
+
|
|
218
266
|
_defineProperty(_assertThisInitialized(_this2), "getMaxWidth", function () {
|
|
219
267
|
var _this2$props$colNum = _this2.props.colNum,
|
|
220
|
-
|
|
268
|
+
colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
|
|
221
269
|
return colNum * 1200;
|
|
222
270
|
});
|
|
271
|
+
|
|
223
272
|
_defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
|
|
224
273
|
return _this2.props.getContainer;
|
|
225
274
|
});
|
|
275
|
+
|
|
226
276
|
_defineProperty(_assertThisInitialized(_this2), "getControls", function () {
|
|
227
277
|
var _this2$props2 = _this2.props,
|
|
228
|
-
|
|
229
|
-
|
|
278
|
+
hideControls = _this2$props2.hideControls,
|
|
279
|
+
controls = _this2$props2.controls;
|
|
280
|
+
|
|
230
281
|
if (!hideControls) {
|
|
231
282
|
return controls;
|
|
232
283
|
} else {
|
|
@@ -237,11 +288,14 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
237
288
|
});
|
|
238
289
|
}
|
|
239
290
|
});
|
|
291
|
+
|
|
240
292
|
_defineProperty(_assertThisInitialized(_this2), "getType", function (_ref4) {
|
|
241
293
|
var _context2;
|
|
294
|
+
|
|
242
295
|
var key = _ref4.key,
|
|
243
|
-
|
|
296
|
+
type = _ref4.type;
|
|
244
297
|
var readonly = _this2.props.readonly;
|
|
298
|
+
|
|
245
299
|
if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
|
|
246
300
|
return type;
|
|
247
301
|
} else if (!readonly) {
|
|
@@ -256,14 +310,17 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
256
310
|
return type;
|
|
257
311
|
}
|
|
258
312
|
});
|
|
313
|
+
|
|
259
314
|
_defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref5) {
|
|
260
315
|
var key = _ref5.key,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
316
|
+
_ref5$props = _ref5.props,
|
|
317
|
+
props = _ref5$props === void 0 ? {} : _ref5$props,
|
|
318
|
+
originType = _ref5.type;
|
|
319
|
+
|
|
264
320
|
if (type === 'readonly') {
|
|
265
321
|
if (originType === 'textArea') {
|
|
266
322
|
var _context3;
|
|
323
|
+
|
|
267
324
|
return {
|
|
268
325
|
type: 'textArea',
|
|
269
326
|
readonly: true,
|
|
@@ -271,6 +328,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
271
328
|
};
|
|
272
329
|
} else if (originType === 'uploadImg') {
|
|
273
330
|
var _context4;
|
|
331
|
+
|
|
274
332
|
var commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
|
|
275
333
|
return _objectSpread(_objectSpread(_objectSpread({}, props), commonProps), {}, {
|
|
276
334
|
readonly: true,
|
|
@@ -278,29 +336,36 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
278
336
|
});
|
|
279
337
|
} else {
|
|
280
338
|
var _context5;
|
|
339
|
+
|
|
281
340
|
return {
|
|
282
341
|
onBlur: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key)
|
|
283
342
|
};
|
|
284
343
|
}
|
|
285
344
|
} else if (type === 'text' || type === 'textArea') {
|
|
286
345
|
var _context6, _context7;
|
|
346
|
+
|
|
287
347
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
288
348
|
onChange: _bindInstanceProperty(_context6 = _this2.onExitValid).call(_context6, _assertThisInitialized(_this2), key),
|
|
289
349
|
onBlur: _bindInstanceProperty(_context7 = _this2.onChange).call(_context7, _assertThisInitialized(_this2), key)
|
|
290
350
|
});
|
|
291
351
|
} else if (type === 'date') {
|
|
292
352
|
var _context8, _context9;
|
|
353
|
+
|
|
293
354
|
var propsObj = _objectSpread(_objectSpread({}, props), {}, {
|
|
294
355
|
onChange: _bindInstanceProperty(_context8 = _this2.onBlur).call(_context8, _assertThisInitialized(_this2), key),
|
|
295
356
|
onBlur: _bindInstanceProperty(_context9 = _this2.onExitValid).call(_context9, _assertThisInitialized(_this2), key)
|
|
296
357
|
});
|
|
358
|
+
|
|
297
359
|
if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
|
|
298
360
|
var _context10;
|
|
361
|
+
|
|
299
362
|
propsObj.onOpenChange = _bindInstanceProperty(_context10 = _this2.props.onOpenChange).call(_context10, _assertThisInitialized(_this2), key);
|
|
300
363
|
}
|
|
364
|
+
|
|
301
365
|
return propsObj;
|
|
302
366
|
} else if (type === 'captcha') {
|
|
303
367
|
var _context11, _context12, _context13;
|
|
368
|
+
|
|
304
369
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
305
370
|
onChange: _bindInstanceProperty(_context11 = _this2.onBlur).call(_context11, _assertThisInitialized(_this2), key),
|
|
306
371
|
onBlur: _bindInstanceProperty(_context12 = _this2.onExitValid).call(_context12, _assertThisInitialized(_this2), key),
|
|
@@ -308,6 +373,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
308
373
|
});
|
|
309
374
|
} else if (type === 'area') {
|
|
310
375
|
var _context14, _context15;
|
|
376
|
+
|
|
311
377
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
312
378
|
onChange: _bindInstanceProperty(_context14 = _this2.onBlur).call(_context14, _assertThisInitialized(_this2), key),
|
|
313
379
|
onBlur: _bindInstanceProperty(_context15 = _this2.onExitValid).call(_context15, _assertThisInitialized(_this2), key),
|
|
@@ -315,7 +381,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
315
381
|
});
|
|
316
382
|
} else if (type === 'uploadImg') {
|
|
317
383
|
var _context16, _context17;
|
|
384
|
+
|
|
318
385
|
var _commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
|
|
386
|
+
|
|
319
387
|
return _objectSpread(_objectSpread(_objectSpread({}, props), _commonProps), {}, {
|
|
320
388
|
onChange: _bindInstanceProperty(_context16 = _this2.onBlur).call(_context16, _assertThisInitialized(_this2), key),
|
|
321
389
|
onBlur: _bindInstanceProperty(_context17 = _this2.onExitValid).call(_context17, _assertThisInitialized(_this2), key)
|
|
@@ -324,19 +392,24 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
324
392
|
return props;
|
|
325
393
|
} else {
|
|
326
394
|
var _context18, _context19;
|
|
395
|
+
|
|
327
396
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
328
397
|
onChange: _bindInstanceProperty(_context18 = _this2.onBlur).call(_context18, _assertThisInitialized(_this2), key),
|
|
329
398
|
onBlur: _bindInstanceProperty(_context19 = _this2.onExitValid).call(_context19, _assertThisInitialized(_this2), key)
|
|
330
399
|
});
|
|
331
400
|
}
|
|
332
401
|
});
|
|
402
|
+
|
|
333
403
|
_defineProperty(_assertThisInitialized(_this2), "getControlProps", function (control, status) {
|
|
334
404
|
var _this2$props3 = _this2.props,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
405
|
+
_this2$props3$value = _this2$props3.value,
|
|
406
|
+
value = _this2$props3$value === void 0 ? {} : _this2$props3$value,
|
|
407
|
+
readonly = _this2$props3.readonly;
|
|
408
|
+
|
|
338
409
|
var type = _this2.getType(control);
|
|
410
|
+
|
|
339
411
|
var props = _this2.specialProps(type, control);
|
|
412
|
+
|
|
340
413
|
return _objectSpread(_objectSpread({
|
|
341
414
|
autoFocus: !!status,
|
|
342
415
|
type: type
|
|
@@ -345,24 +418,31 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
345
418
|
value: makeString(value[control.key])
|
|
346
419
|
});
|
|
347
420
|
});
|
|
421
|
+
|
|
348
422
|
_defineProperty(_assertThisInitialized(_this2), "getOptions", function (key, options) {
|
|
349
423
|
var higher = _this2.props.options || {};
|
|
350
424
|
return higher[key] || options;
|
|
351
425
|
});
|
|
426
|
+
|
|
352
427
|
_defineProperty(_assertThisInitialized(_this2), "toEmpty", function (props) {});
|
|
428
|
+
|
|
353
429
|
_defineProperty(_assertThisInitialized(_this2), "toText", function (props) {
|
|
354
430
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
355
431
|
});
|
|
432
|
+
|
|
356
433
|
_defineProperty(_assertThisInitialized(_this2), "toPassword", function (props) {
|
|
357
434
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
358
435
|
});
|
|
436
|
+
|
|
359
437
|
_defineProperty(_assertThisInitialized(_this2), "toEditor", function (props, control) {
|
|
360
438
|
props.inputKey = control.key;
|
|
361
439
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
362
440
|
});
|
|
441
|
+
|
|
363
442
|
_defineProperty(_assertThisInitialized(_this2), "toSelectWriting", function (props, control) {
|
|
364
443
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
365
444
|
});
|
|
445
|
+
|
|
366
446
|
_defineProperty(_assertThisInitialized(_this2), "toTextArea", function (props, control) {
|
|
367
447
|
if (control.allFullFather) {
|
|
368
448
|
props.rows = control.rows;
|
|
@@ -376,15 +456,19 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
376
456
|
maxRows: 5
|
|
377
457
|
};
|
|
378
458
|
}
|
|
459
|
+
|
|
379
460
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
380
461
|
});
|
|
462
|
+
|
|
381
463
|
_defineProperty(_assertThisInitialized(_this2), "toNumber", function (props) {
|
|
382
464
|
props.defaultValue = props.value;
|
|
383
465
|
delete props.value;
|
|
384
466
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
385
467
|
});
|
|
468
|
+
|
|
386
469
|
_defineProperty(_assertThisInitialized(_this2), "toDoubleInput", function (props, control, cc) {
|
|
387
470
|
var _context20, _context21;
|
|
471
|
+
|
|
388
472
|
props.defaultValue = props.value;
|
|
389
473
|
props.doubleKey = props.key;
|
|
390
474
|
props.doubleValue = helper.getObject(cc, props.key);
|
|
@@ -393,14 +477,26 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
393
477
|
delete props.value;
|
|
394
478
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
395
479
|
});
|
|
480
|
+
|
|
396
481
|
_defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref6) {
|
|
397
482
|
var options = _ref6.options,
|
|
398
|
-
|
|
483
|
+
key = _ref6.key;
|
|
399
484
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
400
485
|
props.options = _this2.getOptions(key, options);
|
|
401
486
|
props.dropdownMatchSelectWidth = false;
|
|
402
487
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
403
488
|
});
|
|
489
|
+
|
|
490
|
+
_defineProperty(_assertThisInitialized(_this2), "toTreeSelect", function (props, filter) {
|
|
491
|
+
var container = _this2.getContainer();
|
|
492
|
+
|
|
493
|
+
container && (props.getPopupContainer = container);
|
|
494
|
+
props.options = _this2.getOptions(filter);
|
|
495
|
+
props.onSearch = _this2.createSearchEvent(filter);
|
|
496
|
+
props.placeholder = filter.placeholder || '';
|
|
497
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
498
|
+
});
|
|
499
|
+
|
|
404
500
|
_defineProperty(_assertThisInitialized(_this2), "createSearchEvent", function (control) {
|
|
405
501
|
if (_this2.props.onSearch) {
|
|
406
502
|
return function (value) {
|
|
@@ -410,6 +506,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
410
506
|
return null;
|
|
411
507
|
}
|
|
412
508
|
});
|
|
509
|
+
|
|
413
510
|
_defineProperty(_assertThisInitialized(_this2), "createGetCodeEvent", function (control) {
|
|
414
511
|
if (_this2.props.onGetCode) {
|
|
415
512
|
return function (value) {
|
|
@@ -419,6 +516,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
419
516
|
return null;
|
|
420
517
|
}
|
|
421
518
|
});
|
|
519
|
+
|
|
422
520
|
_defineProperty(_assertThisInitialized(_this2), "toSearch", function (props, control) {
|
|
423
521
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
424
522
|
props.options = _this2.getOptions(control.key, control.options);
|
|
@@ -427,6 +525,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
427
525
|
props.size = 'large';
|
|
428
526
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
429
527
|
});
|
|
528
|
+
|
|
430
529
|
_defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref7) {
|
|
431
530
|
var rule = _ref7.rule;
|
|
432
531
|
props.getCalendarContainer = _this2.getPopupContainer;
|
|
@@ -436,22 +535,26 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
436
535
|
rule && (props.disabledDate = _this2.validDate(rule));
|
|
437
536
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
438
537
|
});
|
|
538
|
+
|
|
439
539
|
_defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref8) {
|
|
440
540
|
var key = _ref8.key,
|
|
441
|
-
|
|
541
|
+
options = _ref8.options;
|
|
442
542
|
props.options = _this2.getOptions(key, options);
|
|
443
543
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
444
544
|
});
|
|
545
|
+
|
|
445
546
|
_defineProperty(_assertThisInitialized(_this2), "captcha", function (props, control) {
|
|
446
547
|
props.onGetCode = _this2.props.onGetCode;
|
|
447
548
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
448
549
|
});
|
|
550
|
+
|
|
449
551
|
_defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref9) {
|
|
450
552
|
var options = _ref9.options,
|
|
451
|
-
|
|
553
|
+
key = _ref9.key;
|
|
452
554
|
props.value = getTitle(props.value, _this2.getOptions(key, options));
|
|
453
555
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
454
556
|
});
|
|
557
|
+
|
|
455
558
|
_defineProperty(_assertThisInitialized(_this2), "selectSearch", function (props, control) {
|
|
456
559
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
457
560
|
props.options = _this2.getOptions(control.key, control.options);
|
|
@@ -459,9 +562,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
459
562
|
props.dropdownMatchSelectWidth = false;
|
|
460
563
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
461
564
|
});
|
|
565
|
+
|
|
462
566
|
_defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref10) {
|
|
463
567
|
var key = _ref10.key,
|
|
464
|
-
|
|
568
|
+
options = _ref10.options;
|
|
465
569
|
var readonly = _this2.props.readonly;
|
|
466
570
|
props.parentKey = key;
|
|
467
571
|
props.options = _this2.getOptions(key, options);
|
|
@@ -471,8 +575,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
471
575
|
}) ? true : false;
|
|
472
576
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
473
577
|
});
|
|
578
|
+
|
|
474
579
|
_defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
|
|
475
580
|
var _context22;
|
|
581
|
+
|
|
476
582
|
var readonly = _this2.props.readonly;
|
|
477
583
|
props.required = control.required || false;
|
|
478
584
|
props.onFileChange = _bindInstanceProperty(_context22 = _this2.onFileChange).call(_context22, _assertThisInitialized(_this2), control);
|
|
@@ -481,8 +587,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
481
587
|
}) ? true : false;
|
|
482
588
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
483
589
|
});
|
|
590
|
+
|
|
484
591
|
_defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
|
|
485
592
|
var container = _this2.getContainer();
|
|
593
|
+
|
|
486
594
|
container && (props.getPopupContainer = container);
|
|
487
595
|
props.options = control.options || [];
|
|
488
596
|
props.onSearch = _this2.createSearchEvent(control);
|
|
@@ -490,8 +598,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
490
598
|
props.loadData = _this2.createSearchEvent(control);
|
|
491
599
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
492
600
|
});
|
|
601
|
+
|
|
493
602
|
_defineProperty(_assertThisInitialized(_this2), "toCheckbox", function (props, control) {
|
|
494
603
|
var _context23;
|
|
604
|
+
|
|
495
605
|
var options = control.options || [];
|
|
496
606
|
return /*#__PURE__*/React.createElement(_Checkbox.Group, {
|
|
497
607
|
options: options,
|
|
@@ -499,61 +609,88 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
499
609
|
value: _this2.props.value[control.key]
|
|
500
610
|
});
|
|
501
611
|
});
|
|
612
|
+
|
|
502
613
|
_defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
|
|
503
614
|
switch (props.type) {
|
|
504
615
|
case 'readonly':
|
|
505
616
|
return _this2.toReadonly(props, control);
|
|
617
|
+
|
|
506
618
|
case 'double':
|
|
507
619
|
return _this2.toDoubleInput(props, control, _this2.props.value);
|
|
620
|
+
|
|
508
621
|
case 'text':
|
|
509
622
|
return _this2.toText(props, control);
|
|
623
|
+
|
|
510
624
|
case 'number':
|
|
511
625
|
return _this2.toNumber(props, control);
|
|
626
|
+
|
|
512
627
|
case 'select':
|
|
513
628
|
case 'selectText':
|
|
514
629
|
return _this2.toSelect(props, control);
|
|
630
|
+
|
|
515
631
|
case 'search':
|
|
516
632
|
case 'searchText':
|
|
517
633
|
return _this2.toSearch(props, control);
|
|
634
|
+
|
|
518
635
|
case 'date':
|
|
519
636
|
return _this2.toDate(props, control);
|
|
637
|
+
|
|
520
638
|
case 'radioGroup':
|
|
521
639
|
return _this2.toRadioGroup(props, control);
|
|
640
|
+
|
|
522
641
|
case 'textArea':
|
|
523
642
|
return _this2.toTextArea(props, control);
|
|
643
|
+
|
|
524
644
|
case 'password':
|
|
525
645
|
return _this2.toPassword(props, control);
|
|
646
|
+
|
|
526
647
|
case 'editor':
|
|
527
648
|
return _this2.toEditor(props, control);
|
|
649
|
+
|
|
528
650
|
case 'selectWriting':
|
|
529
651
|
return _this2.toSelectWriting(props, control);
|
|
652
|
+
|
|
530
653
|
case 'selectSearch':
|
|
531
654
|
return _this2.selectSearch(props, control);
|
|
655
|
+
|
|
532
656
|
case 'empty':
|
|
533
657
|
return _this2.toEmpty(props, control);
|
|
658
|
+
|
|
534
659
|
case 'captcha':
|
|
535
660
|
return _this2.captcha(props, control);
|
|
661
|
+
|
|
536
662
|
case 'area':
|
|
537
663
|
return _this2.area(props, control);
|
|
664
|
+
|
|
538
665
|
case 'uploadImg':
|
|
539
666
|
return _this2.uploadImg(props, control);
|
|
667
|
+
|
|
540
668
|
case 'cascader':
|
|
541
669
|
return _this2.toCascader(props, control);
|
|
670
|
+
|
|
671
|
+
case 'treeSelect':
|
|
672
|
+
return _this2.toTreeSelect(props, control);
|
|
673
|
+
|
|
542
674
|
case 'checkbox':
|
|
543
675
|
return _this2.toCheckbox(props, control);
|
|
676
|
+
|
|
544
677
|
default:
|
|
545
678
|
return 'type error';
|
|
546
679
|
}
|
|
547
680
|
});
|
|
681
|
+
|
|
548
682
|
_defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
|
|
549
683
|
var title = _ref11.title,
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
684
|
+
showAdd = _ref11.showAdd,
|
|
685
|
+
key = _ref11.key,
|
|
686
|
+
showInfo = _ref11.showInfo,
|
|
687
|
+
showInfoTitle = _ref11.showInfoTitle;
|
|
688
|
+
|
|
554
689
|
if (showAdd && type !== 'readonly') {
|
|
555
690
|
var _context24;
|
|
691
|
+
|
|
556
692
|
var onClick = _bindInstanceProperty(_context24 = _this2.onAdd).call(_context24, _assertThisInitialized(_this2), key, title);
|
|
693
|
+
|
|
557
694
|
return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
|
|
558
695
|
role: "add",
|
|
559
696
|
type: "plus-circle-o",
|
|
@@ -569,18 +706,22 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
569
706
|
return title;
|
|
570
707
|
}
|
|
571
708
|
});
|
|
709
|
+
|
|
572
710
|
_defineProperty(_assertThisInitialized(_this2), "toCol", function (span, control) {
|
|
573
711
|
var factor = control.span || 1;
|
|
712
|
+
|
|
574
713
|
var status = _this2.getValidState(control);
|
|
714
|
+
|
|
575
715
|
var controlProps = _this2.getControlProps(control, status);
|
|
716
|
+
|
|
576
717
|
var itemProps = {
|
|
577
718
|
label: _this2.toLabel(control, controlProps.type),
|
|
578
719
|
required: control.required,
|
|
579
720
|
validateStatus: status
|
|
580
721
|
};
|
|
581
722
|
var _this2$props4 = _this2.props,
|
|
582
|
-
|
|
583
|
-
|
|
723
|
+
checkable = _this2$props4.checkable,
|
|
724
|
+
onCheckItem = _this2$props4.onCheckItem;
|
|
584
725
|
return control.type !== 'empty' ? /*#__PURE__*/React.createElement(_Col, {
|
|
585
726
|
span: span * factor,
|
|
586
727
|
key: control.key
|
|
@@ -614,31 +755,38 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
614
755
|
}
|
|
615
756
|
});
|
|
616
757
|
});
|
|
758
|
+
|
|
617
759
|
_defineProperty(_assertThisInitialized(_this2), "toCols", function () {
|
|
618
760
|
var _context25;
|
|
761
|
+
|
|
619
762
|
var _this2$props5 = _this2.props,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
763
|
+
_this2$props5$colNum = _this2$props5.colNum,
|
|
764
|
+
colNum = _this2$props5$colNum === void 0 ? defaultColNum : _this2$props5$colNum,
|
|
765
|
+
allFullFather = _this2$props5.allFullFather;
|
|
766
|
+
|
|
623
767
|
if (allFullFather) {
|
|
624
768
|
colNum = 1;
|
|
625
769
|
}
|
|
770
|
+
|
|
626
771
|
var span = 24 / colNum;
|
|
627
772
|
return _mapInstanceProperty(_context25 = _this2.getControls()).call(_context25, function (control) {
|
|
628
773
|
if (allFullFather) {
|
|
629
774
|
control.allFullFather = allFullFather;
|
|
630
775
|
}
|
|
776
|
+
|
|
631
777
|
return _this2.toCol(span, control);
|
|
632
778
|
});
|
|
633
779
|
});
|
|
780
|
+
|
|
634
781
|
return _this2;
|
|
635
782
|
}
|
|
783
|
+
|
|
636
784
|
_createClass(SuperForm2, [{
|
|
637
785
|
key: "render",
|
|
638
786
|
value: function render() {
|
|
639
787
|
this.initValidState();
|
|
640
788
|
var _this$props$layout = this.props.layout,
|
|
641
|
-
|
|
789
|
+
layout = _this$props$layout === void 0 ? 'horizontal' : _this$props$layout;
|
|
642
790
|
return /*#__PURE__*/React.createElement("div", {
|
|
643
791
|
className: variables('SuperForm2')
|
|
644
792
|
}, /*#__PURE__*/React.createElement(_Form, {
|
|
@@ -651,8 +799,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
651
799
|
}, this.toCols())));
|
|
652
800
|
}
|
|
653
801
|
}]);
|
|
802
|
+
|
|
654
803
|
return SuperForm2;
|
|
655
804
|
}(React.Component);
|
|
805
|
+
|
|
656
806
|
_defineProperty(SuperForm2, "propTypes", {
|
|
657
807
|
controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
|
|
658
808
|
value: PropTypes.object,
|
|
@@ -674,4 +824,5 @@ _defineProperty(SuperForm2, "propTypes", {
|
|
|
674
824
|
//构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
|
|
675
825
|
layout: PropTypes.string
|
|
676
826
|
});
|
|
827
|
+
|
|
677
828
|
export default SuperForm2;
|