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