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