cloud-b2b 1.0.5 → 1.0.6

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.
@@ -0,0 +1,732 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
+ import _Row from "antd/es/row";
10
+ import _Col from "antd/es/col";
11
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
12
+ import _Checkbox from "antd/es/checkbox";
13
+ import _Icon from "antd/es/icon";
14
+ import _typeof from "@babel/runtime-corejs3/helpers/typeof";
15
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
16
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
17
+ import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
18
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
19
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
20
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
21
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
22
+ import _Form from "antd/es/form";
23
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
24
+ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
25
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
26
+ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
27
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
28
+ import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
29
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
30
+
31
+ 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
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context20, _context21; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context20 = ownKeys(Object(source), !0)).call(_context20, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context21 = ownKeys(Object(source))).call(_context21, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
34
+
35
+ 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
+ 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
+ import React from 'react';
40
+ import PropTypes from 'prop-types';
41
+ import ReactDOM from 'react-dom';
42
+ import helper from '../helper';
43
+ import Control, { getTitle, makeString } from '../Control';
44
+ import variables from '../variables';
45
+ var FormItem = _Form.Item;
46
+ var defaultSize = 'small';
47
+ var defaultColNum = 4;
48
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg'];
49
+ /**
50
+ * key:[必须],用于唯一标识该Form下的一个表单元素
51
+ * title:[必须],表单元素的标签
52
+ * type:[必须],表单元素类型
53
+ * required: [可选],是否为必填项
54
+ * options: [可选],对象数组(type为readonly,radio,search, searchText,select, selectText时有效)
55
+ * span: [可选],占据的列数,默认为1
56
+ * showAdd: [可选],是否显示+号,点击+号会触发onAdd事件,默认为false
57
+ * rule: [可选],用于设置校验规则
58
+ */
59
+
60
+ var ControlType = {
61
+ key: PropTypes.string.isRequired,
62
+ title: PropTypes.string,
63
+ type: PropTypes.oneOf(TYPE).isRequired,
64
+ required: PropTypes.bool,
65
+ options: PropTypes.array,
66
+ span: PropTypes.number,
67
+ onCheckItem: PropTypes.any,
68
+ showAdd: PropTypes.any,
69
+ rule: PropTypes.object,
70
+ props: PropTypes.object
71
+ };
72
+
73
+ var Controlled = /*#__PURE__*/function (_React$Component) {
74
+ _inherits(Controlled, _React$Component);
75
+
76
+ var _super = _createSuper(Controlled);
77
+
78
+ function Controlled(props) {
79
+ var _this;
80
+
81
+ _classCallCheck(this, Controlled);
82
+
83
+ _this = _super.call(this, props);
84
+
85
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (value) {
86
+ var onChange = _this.props.onChange;
87
+
88
+ _this.setState({
89
+ value: value
90
+ });
91
+
92
+ onChange && onChange(value);
93
+ });
94
+
95
+ _this.state = {
96
+ value: props.value
97
+ };
98
+ return _this;
99
+ }
100
+
101
+ _createClass(Controlled, [{
102
+ key: "componentWillReceiveProps",
103
+ value: function componentWillReceiveProps(nextProps) {
104
+ if (this.props.value !== nextProps.value) {
105
+ this.setState({
106
+ value: nextProps.value
107
+ });
108
+ }
109
+ }
110
+ }, {
111
+ key: "render",
112
+ value: function render() {
113
+ var props = _objectSpread(_objectSpread({}, this.props), {}, {
114
+ size: 'large',
115
+ value: this.state.value,
116
+ onChange: this.onChange
117
+ });
118
+
119
+ return /*#__PURE__*/React.createElement(Control, props);
120
+ }
121
+ }]);
122
+
123
+ return Controlled;
124
+ }(React.Component);
125
+ /**
126
+ * colNum:[可选],表单的列数,默认为4
127
+ * readonly: [可选],为true时,所有表单元素都是只读的; 为字符串数组时,用于指定key的表单元素是只读的
128
+ * hideControls: [可选],指定key的表单元素被隐藏
129
+ * options: [可选],键值对,值与ControlType中options作用相同,但优先级更高
130
+ * onChange:内容改变时触发,原型为func(key, value)
131
+ * onSearch:搜索框中用户输入时触发,原型为func(key, title, control)
132
+ * onAdd: 点击+号时触发,原型为func(key)
133
+ * checkable:是否显示checkbox选择框
134
+ * onOpenChange:控制日期框显示隐藏回调func(key, open)
135
+ * onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
136
+ * OnFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
137
+ */
138
+
139
+
140
+ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
141
+ _inherits(SuperForm2, _React$Component2);
142
+
143
+ var _super2 = _createSuper(SuperForm2);
144
+
145
+ function SuperForm2() {
146
+ var _context;
147
+
148
+ var _this2;
149
+
150
+ _classCallCheck(this, SuperForm2);
151
+
152
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
153
+ args[_key] = arguments[_key];
154
+ }
155
+
156
+ _this2 = _super2.call.apply(_super2, _concatInstanceProperty(_context = [this]).call(_context, args));
157
+
158
+ _defineProperty(_assertThisInitialized(_this2), "onAdd", function (key, title) {
159
+ var onAdd = _this2.props.onAdd;
160
+ onAdd && onAdd(key, title);
161
+ });
162
+
163
+ _defineProperty(_assertThisInitialized(_this2), "onFileChange", function (_ref, file) {
164
+ var key = _ref.key;
165
+ var onFileChange = _this2.props.onFileChange;
166
+ onFileChange && onFileChange(key, file);
167
+ });
168
+
169
+ _defineProperty(_assertThisInitialized(_this2), "onChange", function (key, value) {
170
+ var onChange = _this2.props.onChange;
171
+
172
+ if (onChange) {
173
+ _this2.onExitValid(key);
174
+
175
+ onChange(key, value);
176
+ }
177
+ });
178
+
179
+ _defineProperty(_assertThisInitialized(_this2), "onGetCode", function (key, value) {
180
+ var onGetCode = _this2.props.onGetCode;
181
+ onGetCode && onGetCode();
182
+ });
183
+
184
+ _defineProperty(_assertThisInitialized(_this2), "onBlur", function (key, value) {
185
+ var onChange = _this2.props.onChange;
186
+
187
+ if (onChange) {
188
+ _this2.onExitValid(key);
189
+
190
+ onChange(key, value);
191
+ }
192
+ });
193
+
194
+ _defineProperty(_assertThisInitialized(_this2), "onExitValid", function (key, value) {
195
+ if (key === _this2.validKey) {
196
+ _this2.validKey = '';
197
+
198
+ _this2.props.onExitValid();
199
+ }
200
+
201
+ _this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
202
+ });
203
+
204
+ _defineProperty(_assertThisInitialized(_this2), "initValidState", function () {
205
+ var _this2$props = _this2.props,
206
+ value = _this2$props.value,
207
+ valid = _this2$props.valid;
208
+
209
+ var invalid = function invalid() {
210
+ return null;
211
+ };
212
+
213
+ var _valid = function _valid(_ref2) {
214
+ var key = _ref2.key,
215
+ required = _ref2.required;
216
+
217
+ if (required) {
218
+ if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
219
+ _this2.getValidState = invalid;
220
+ _this2.validKey = key;
221
+ return 'error';
222
+ }
223
+ }
224
+
225
+ return null;
226
+ };
227
+
228
+ _this2.getValidState = valid ? _valid : invalid;
229
+ });
230
+
231
+ _defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref3) {
232
+ var key = _ref3.key,
233
+ type = _ref3.type;
234
+ return function (date) {
235
+ var _this2$props$value = _this2.props.value,
236
+ value = _this2$props$value === void 0 ? {} : _this2$props$value;
237
+
238
+ if (!date || !value[key]) {
239
+ return false;
240
+ } else {
241
+ if (type === '>') {
242
+ return date.format('YYYY-MM-DD') <= value[key];
243
+ } else if (type === '<') {
244
+ return date.format('YYYY-MM-DD') >= value[key];
245
+ } else {
246
+ return false;
247
+ }
248
+ }
249
+ };
250
+ });
251
+
252
+ _defineProperty(_assertThisInitialized(_this2), "getPopupContainer", function () {
253
+ var container = _this2.props.container;
254
+
255
+ if (typeof container === 'undefined') {
256
+ return ReactDOM.findDOMNode(_assertThisInitialized(_this2));
257
+ } else if (typeof container === 'boolean') {
258
+ return document.body;
259
+ } else {
260
+ return ReactDOM.findDOMNode(container);
261
+ }
262
+ });
263
+
264
+ _defineProperty(_assertThisInitialized(_this2), "getMaxWidth", function () {
265
+ var _this2$props$colNum = _this2.props.colNum,
266
+ colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
267
+ return colNum * 1200;
268
+ });
269
+
270
+ _defineProperty(_assertThisInitialized(_this2), "getControls", function () {
271
+ var _this2$props2 = _this2.props,
272
+ hideControls = _this2$props2.hideControls,
273
+ controls = _this2$props2.controls;
274
+
275
+ if (!hideControls) {
276
+ return controls;
277
+ } else {
278
+ return _filterInstanceProperty(controls).call(controls, function (control) {
279
+ return !_someInstanceProperty(hideControls).call(hideControls, function (key) {
280
+ return control.key === key;
281
+ });
282
+ });
283
+ }
284
+ });
285
+
286
+ _defineProperty(_assertThisInitialized(_this2), "getType", function (_ref4) {
287
+ var _context2;
288
+
289
+ var key = _ref4.key,
290
+ type = _ref4.type;
291
+ var readonly = _this2.props.readonly;
292
+
293
+ if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
294
+ return type;
295
+ } else if (!readonly) {
296
+ return type;
297
+ } else if (readonly === true) {
298
+ return 'readonly';
299
+ } else if (_Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
300
+ return readonlyKey === key;
301
+ })) {
302
+ return 'readonly';
303
+ } else {
304
+ return type;
305
+ }
306
+ });
307
+
308
+ _defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref5) {
309
+ var key = _ref5.key,
310
+ _ref5$props = _ref5.props,
311
+ props = _ref5$props === void 0 ? {} : _ref5$props,
312
+ originType = _ref5.type;
313
+
314
+ if (type === 'readonly') {
315
+ if (originType === 'textArea') {
316
+ var _context3;
317
+
318
+ return {
319
+ type: 'textArea',
320
+ readonly: true,
321
+ onBlur: _bindInstanceProperty(_context3 = _this2.onExitValid).call(_context3, _assertThisInitialized(_this2), key)
322
+ };
323
+ } else {
324
+ var _context4;
325
+
326
+ return {
327
+ onBlur: _bindInstanceProperty(_context4 = _this2.onExitValid).call(_context4, _assertThisInitialized(_this2), key)
328
+ };
329
+ }
330
+ } else if (type === 'text' || type === 'textArea') {
331
+ var _context5, _context6;
332
+
333
+ return _objectSpread(_objectSpread({}, props), {}, {
334
+ onChange: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key),
335
+ onBlur: _bindInstanceProperty(_context6 = _this2.onChange).call(_context6, _assertThisInitialized(_this2), key)
336
+ });
337
+ } else if (type === 'date') {
338
+ var _context7, _context8;
339
+
340
+ var propsObj = _objectSpread(_objectSpread({}, props), {}, {
341
+ onChange: _bindInstanceProperty(_context7 = _this2.onBlur).call(_context7, _assertThisInitialized(_this2), key),
342
+ onBlur: _bindInstanceProperty(_context8 = _this2.onExitValid).call(_context8, _assertThisInitialized(_this2), key)
343
+ });
344
+
345
+ if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
346
+ var _context9;
347
+
348
+ propsObj.onOpenChange = _bindInstanceProperty(_context9 = _this2.props.onOpenChange).call(_context9, _assertThisInitialized(_this2), key);
349
+ }
350
+
351
+ return propsObj;
352
+ } else if (type === 'captcha') {
353
+ var _context10, _context11, _context12;
354
+
355
+ return _objectSpread(_objectSpread({}, props), {}, {
356
+ onChange: _bindInstanceProperty(_context10 = _this2.onBlur).call(_context10, _assertThisInitialized(_this2), key),
357
+ onBlur: _bindInstanceProperty(_context11 = _this2.onExitValid).call(_context11, _assertThisInitialized(_this2), key),
358
+ onGetCode: _bindInstanceProperty(_context12 = _this2.onGetCode).call(_context12, _assertThisInitialized(_this2), key)
359
+ });
360
+ } else if (type === 'area') {
361
+ var _context13, _context14;
362
+
363
+ return _objectSpread(_objectSpread({}, props), {}, {
364
+ onChange: _bindInstanceProperty(_context13 = _this2.onBlur).call(_context13, _assertThisInitialized(_this2), key),
365
+ onBlur: _bindInstanceProperty(_context14 = _this2.onExitValid).call(_context14, _assertThisInitialized(_this2), key),
366
+ onAreaSearch: _this2.props.onAreaSearch
367
+ });
368
+ } else {
369
+ var _context15, _context16;
370
+
371
+ return _objectSpread(_objectSpread({}, props), {}, {
372
+ onChange: _bindInstanceProperty(_context15 = _this2.onBlur).call(_context15, _assertThisInitialized(_this2), key),
373
+ onBlur: _bindInstanceProperty(_context16 = _this2.onExitValid).call(_context16, _assertThisInitialized(_this2), key)
374
+ });
375
+ }
376
+ });
377
+
378
+ _defineProperty(_assertThisInitialized(_this2), "getControlProps", function (control, status) {
379
+ var _this2$props$value2 = _this2.props.value,
380
+ value = _this2$props$value2 === void 0 ? {} : _this2$props$value2;
381
+
382
+ var type = _this2.getType(control);
383
+
384
+ var props = _this2.specialProps(type, control);
385
+
386
+ return _objectSpread(_objectSpread({
387
+ autoFocus: !!status,
388
+ type: type
389
+ }, props), {}, {
390
+ size: defaultSize,
391
+ value: makeString(value[control.key])
392
+ });
393
+ });
394
+
395
+ _defineProperty(_assertThisInitialized(_this2), "getOptions", function (key, options) {
396
+ var higher = _this2.props.options || {};
397
+ return higher[key] || options;
398
+ });
399
+
400
+ _defineProperty(_assertThisInitialized(_this2), "toEmpty", function (props) {});
401
+
402
+ _defineProperty(_assertThisInitialized(_this2), "toText", function (props) {
403
+ return /*#__PURE__*/React.createElement(Controlled, props);
404
+ });
405
+
406
+ _defineProperty(_assertThisInitialized(_this2), "toPassword", function (props) {
407
+ return /*#__PURE__*/React.createElement(Controlled, props);
408
+ });
409
+
410
+ _defineProperty(_assertThisInitialized(_this2), "toEditor", function (props, control) {
411
+ props.inputKey = control.key;
412
+ return /*#__PURE__*/React.createElement(Controlled, props);
413
+ });
414
+
415
+ _defineProperty(_assertThisInitialized(_this2), "toSelectWriting", function (props, control) {
416
+ return /*#__PURE__*/React.createElement(Controlled, props);
417
+ });
418
+
419
+ _defineProperty(_assertThisInitialized(_this2), "toTextArea", function (props, control) {
420
+ if (control.allFullFather) {
421
+ props.rows = control.rows;
422
+ props.maxLength = control.maxLength;
423
+ props.style = {
424
+ 'resize': 'none'
425
+ };
426
+ } else {
427
+ props.autosize = {
428
+ minRows: 1,
429
+ maxRows: 5
430
+ };
431
+ }
432
+
433
+ return /*#__PURE__*/React.createElement(Controlled, props);
434
+ });
435
+
436
+ _defineProperty(_assertThisInitialized(_this2), "toNumber", function (props) {
437
+ props.defaultValue = props.value;
438
+ delete props.value;
439
+ return /*#__PURE__*/React.createElement(Control, props);
440
+ });
441
+
442
+ _defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref6) {
443
+ var options = _ref6.options,
444
+ key = _ref6.key;
445
+ props.getPopupContainer = _this2.getPopupContainer;
446
+ props.options = _this2.getOptions(key, options);
447
+ props.dropdownMatchSelectWidth = false;
448
+ return /*#__PURE__*/React.createElement(Control, props);
449
+ });
450
+
451
+ _defineProperty(_assertThisInitialized(_this2), "createSearchEvent", function (control) {
452
+ if (_this2.props.onSearch) {
453
+ return function (value) {
454
+ return _this2.props.onSearch(control.key, value, control);
455
+ };
456
+ } else {
457
+ return null;
458
+ }
459
+ });
460
+
461
+ _defineProperty(_assertThisInitialized(_this2), "createGetCodeEvent", function (control) {
462
+ if (_this2.props.onGetCode) {
463
+ return function (value) {
464
+ return _this2.props.onGetCode(control.key, value, control);
465
+ };
466
+ } else {
467
+ return null;
468
+ }
469
+ });
470
+
471
+ _defineProperty(_assertThisInitialized(_this2), "toSearch", function (props, control) {
472
+ props.getPopupContainer = _this2.getPopupContainer;
473
+ props.options = _this2.getOptions(control.key, control.options);
474
+ props.onSearch = _this2.createSearchEvent(control);
475
+ props.dropdownMatchSelectWidth = false;
476
+ props.size = 'large';
477
+ return /*#__PURE__*/React.createElement(Control, props);
478
+ });
479
+
480
+ _defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref7) {
481
+ var rule = _ref7.rule;
482
+ props.getCalendarContainer = _this2.getPopupContainer;
483
+ props.style = {
484
+ width: '100%'
485
+ };
486
+ rule && (props.disabledDate = _this2.validDate(rule));
487
+ return /*#__PURE__*/React.createElement(Control, props);
488
+ });
489
+
490
+ _defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref8) {
491
+ var key = _ref8.key,
492
+ options = _ref8.options;
493
+ props.options = _this2.getOptions(key, options);
494
+ return /*#__PURE__*/React.createElement(Control, props);
495
+ });
496
+
497
+ _defineProperty(_assertThisInitialized(_this2), "captcha", function (props, control) {
498
+ props.onGetCode = _this2.props.onGetCode;
499
+ return /*#__PURE__*/React.createElement(Control, props);
500
+ });
501
+
502
+ _defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref9) {
503
+ var options = _ref9.options,
504
+ key = _ref9.key;
505
+ props.value = getTitle(props.value, _this2.getOptions(key, options));
506
+ return /*#__PURE__*/React.createElement(Control, props);
507
+ });
508
+
509
+ _defineProperty(_assertThisInitialized(_this2), "selectSearch", function (props, control) {
510
+ props.getPopupContainer = _this2.getPopupContainer;
511
+ props.options = _this2.getOptions(control.key, control.options);
512
+ props.onSearch = _this2.createSearchEvent(control);
513
+ props.dropdownMatchSelectWidth = false;
514
+ return /*#__PURE__*/React.createElement(Control, props);
515
+ });
516
+
517
+ _defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref10) {
518
+ var key = _ref10.key,
519
+ options = _ref10.options;
520
+ var readonly = _this2.props.readonly;
521
+ props.parentKey = key;
522
+ props.options = _this2.getOptions(key, options);
523
+ props.dropdownMatchSelectWidth = false;
524
+ props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
525
+ return readonlyKey === key;
526
+ }) ? true : false;
527
+ return /*#__PURE__*/React.createElement(Control, props);
528
+ });
529
+
530
+ _defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
531
+ var _context17;
532
+
533
+ var readonly = _this2.props.readonly;
534
+ props.required = control.required || false;
535
+ props.onFileChange = _bindInstanceProperty(_context17 = _this2.onFileChange).call(_context17, _assertThisInitialized(_this2), control);
536
+ props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
537
+ return readonlyKey === control.key;
538
+ }) ? true : false;
539
+ return /*#__PURE__*/React.createElement(Control, props);
540
+ });
541
+
542
+ _defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
543
+ switch (props.type) {
544
+ case 'readonly':
545
+ return _this2.toReadonly(props, control);
546
+
547
+ case 'text':
548
+ return _this2.toText(props, control);
549
+
550
+ case 'number':
551
+ return _this2.toNumber(props, control);
552
+
553
+ case 'select':
554
+ case 'selectText':
555
+ return _this2.toSelect(props, control);
556
+
557
+ case 'search':
558
+ case 'searchText':
559
+ return _this2.toSearch(props, control);
560
+
561
+ case 'date':
562
+ return _this2.toDate(props, control);
563
+
564
+ case 'radioGroup':
565
+ return _this2.toRadioGroup(props, control);
566
+
567
+ case 'textArea':
568
+ return _this2.toTextArea(props, control);
569
+
570
+ case 'password':
571
+ return _this2.toPassword(props, control);
572
+
573
+ case 'editor':
574
+ return _this2.toEditor(props, control);
575
+
576
+ case 'selectWriting':
577
+ return _this2.toSelectWriting(props, control);
578
+
579
+ case 'selectSearch':
580
+ return _this2.selectSearch(props, control);
581
+
582
+ case 'empty':
583
+ return _this2.toEmpty(props, control);
584
+
585
+ case 'captcha':
586
+ return _this2.captcha(props, control);
587
+
588
+ case 'area':
589
+ return _this2.area(props, control);
590
+
591
+ case 'uploadImg':
592
+ return _this2.uploadImg(props, control);
593
+
594
+ default:
595
+ return 'type error';
596
+ }
597
+ });
598
+
599
+ _defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
600
+ var title = _ref11.title,
601
+ showAdd = _ref11.showAdd,
602
+ key = _ref11.key;
603
+
604
+ if (showAdd && type !== 'readonly') {
605
+ var _context18;
606
+
607
+ var onClick = _bindInstanceProperty(_context18 = _this2.onAdd).call(_context18, _assertThisInitialized(_this2), key, title);
608
+
609
+ return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
610
+ role: "add",
611
+ type: "plus-circle-o",
612
+ onClick: onClick
613
+ }));
614
+ } else {
615
+ return title;
616
+ }
617
+ });
618
+
619
+ _defineProperty(_assertThisInitialized(_this2), "toCol", function (span, control) {
620
+ var factor = control.span || 1;
621
+
622
+ var status = _this2.getValidState(control);
623
+
624
+ var controlProps = _this2.getControlProps(control, status);
625
+
626
+ var itemProps = {
627
+ label: _this2.toLabel(control, controlProps.type),
628
+ required: control.required,
629
+ validateStatus: status
630
+ };
631
+ var _this2$props3 = _this2.props,
632
+ checkable = _this2$props3.checkable,
633
+ onCheckItem = _this2$props3.onCheckItem;
634
+ return control.type !== 'empty' ? /*#__PURE__*/React.createElement(_Col, {
635
+ span: span * factor,
636
+ key: control.key
637
+ }, checkable && /*#__PURE__*/React.createElement(_Checkbox, {
638
+ className: variables('SuperForm2').checkbox,
639
+ onChange: _bindInstanceProperty(onCheckItem).call(onCheckItem, _assertThisInitialized(_this2), control),
640
+ checked: control.checked
641
+ }), /*#__PURE__*/React.createElement(FormItem, _extends({}, itemProps, {
642
+ className: checkable ? variables('SuperForm2').formItemWithCheckbox : '',
643
+ labelCol: {
644
+ xs: {
645
+ span: 24
646
+ },
647
+ sm: {
648
+ span: 8
649
+ }
650
+ },
651
+ wrapperCol: {
652
+ xs: {
653
+ span: 24
654
+ },
655
+ sm: {
656
+ span: 16
657
+ }
658
+ }
659
+ }), _this2.toControl(controlProps, control))) : /*#__PURE__*/React.createElement(_Col, {
660
+ span: span * factor,
661
+ key: control.key,
662
+ style: {
663
+ height: '44px'
664
+ }
665
+ });
666
+ });
667
+
668
+ _defineProperty(_assertThisInitialized(_this2), "toCols", function () {
669
+ var _context19;
670
+
671
+ var _this2$props4 = _this2.props,
672
+ _this2$props4$colNum = _this2$props4.colNum,
673
+ colNum = _this2$props4$colNum === void 0 ? defaultColNum : _this2$props4$colNum,
674
+ allFullFather = _this2$props4.allFullFather;
675
+
676
+ if (allFullFather) {
677
+ colNum = 1;
678
+ }
679
+
680
+ var span = 24 / colNum;
681
+ return _mapInstanceProperty(_context19 = _this2.getControls()).call(_context19, function (control) {
682
+ if (allFullFather) {
683
+ control.allFullFather = allFullFather;
684
+ }
685
+
686
+ return _this2.toCol(span, control);
687
+ });
688
+ });
689
+
690
+ return _this2;
691
+ }
692
+
693
+ _createClass(SuperForm2, [{
694
+ key: "render",
695
+ value: function render() {
696
+ this.initValidState();
697
+ return /*#__PURE__*/React.createElement("div", {
698
+ className: variables('SuperForm2')
699
+ }, /*#__PURE__*/React.createElement(_Form, {
700
+ layout: "horizontal",
701
+ style: {
702
+ maxWidth: this.props.allFullFather ? '100%' : this.getMaxWidth()
703
+ }
704
+ }, /*#__PURE__*/React.createElement(_Row, {
705
+ gutter: 20
706
+ }, this.toCols())));
707
+ }
708
+ }]);
709
+
710
+ return SuperForm2;
711
+ }(React.Component);
712
+
713
+ _defineProperty(SuperForm2, "propTypes", {
714
+ controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
715
+ value: PropTypes.object,
716
+ colNum: PropTypes.number,
717
+ valid: PropTypes.bool,
718
+ readonly: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
719
+ hideControls: PropTypes.array,
720
+ options: PropTypes.object,
721
+ onChange: PropTypes.func,
722
+ onSearch: PropTypes.func,
723
+ onExitValid: PropTypes.func,
724
+ onAdd: PropTypes.func,
725
+ checkable: PropTypes.bool,
726
+ onOpenChange: PropTypes.func,
727
+ onGetCode: PropTypes.func,
728
+ onFileChange: PropTypes.func,
729
+ onAreaSearch: PropTypes.func
730
+ });
731
+
732
+ export default SuperForm2;