cloud-b2b 1.1.2 → 1.1.5

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 CHANGED
@@ -58,7 +58,8 @@ var Area = /*#__PURE__*/function (_React$Component) {
58
58
  var _this$props = _this.props,
59
59
  onParentChange = _this$props.onParentChange,
60
60
  child = _this$props.child,
61
- value = _this$props.value;
61
+ _this$props$value = _this$props.value,
62
+ value = _this$props$value === void 0 ? {} : _this$props$value;
62
63
  var newValue = {};
63
64
  newValue[key] = keyValue;
64
65
  var CheckValue, checkIndex;
@@ -83,7 +84,8 @@ var Area = /*#__PURE__*/function (_React$Component) {
83
84
  var _this$props2 = _this.props,
84
85
  onAreaSearch = _this$props2.onAreaSearch,
85
86
  child = _this$props2.child,
86
- value = _this$props2.value;
87
+ _this$props2$value = _this$props2.value,
88
+ value = _this$props2$value === void 0 ? {} : _this$props2$value;
87
89
  var flag = true;
88
90
 
89
91
  _mapInstanceProperty(child).call(child, function (item, index) {
@@ -113,7 +115,7 @@ var Area = /*#__PURE__*/function (_React$Component) {
113
115
  value: function componentWillReceiveProps(props) {
114
116
  if (props.value !== this.props.value) {
115
117
  this.setState({
116
- value: props.value
118
+ value: props.value || {}
117
119
  });
118
120
  }
119
121
  }
@@ -129,7 +131,8 @@ var Area = /*#__PURE__*/function (_React$Component) {
129
131
  options = _this$props3$options === void 0 ? {} : _this$props3$options,
130
132
  _this$props3$readonly = _this$props3.readonly,
131
133
  readonly = _this$props3$readonly === void 0 ? false : _this$props3$readonly,
132
- value = _this$props3.value;
134
+ _this$props3$value = _this$props3.value,
135
+ value = _this$props3$value === void 0 ? {} : _this$props3$value;
133
136
  return /*#__PURE__*/React.createElement(_Row, null, _mapInstanceProperty(child).call(child, function (item, index) {
134
137
  var _context, _context2, _context3;
135
138
 
@@ -148,7 +151,7 @@ var Area = /*#__PURE__*/function (_React$Component) {
148
151
  onSearch: _bindInstanceProperty(_context2 = _this2.onSearch).call(_context2, _this2, item.key, item, parentKey),
149
152
  onChange: _bindInstanceProperty(_context3 = _this2.onChange).call(_context3, _this2, item.key),
150
153
  options: childOptions,
151
- value: _this2.props.value[item.key].title ? _this2.props.value[item.key].title : _this2.props.value[item.key],
154
+ value: value[item.key].title ? value[item.key].title : value[item.key],
152
155
  type: readonly ? 'readonly' : item.type
153
156
  });
154
157
 
@@ -45,7 +45,7 @@ import variables from '../variables';
45
45
  var FormItem = _Form.Item;
46
46
  var defaultSize = 'small';
47
47
  var defaultColNum = 4;
48
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg'];
48
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader'];
49
49
  /**
50
50
  * key:[必须],用于唯一标识该Form下的一个表单元素
51
51
  * title:[必须],表单元素的标签
@@ -256,6 +256,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
256
256
  return colNum * 250;
257
257
  });
258
258
 
259
+ _defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
260
+ return _this2.props.getContainer;
261
+ });
262
+
259
263
  _defineProperty(_assertThisInitialized(_this2), "getControls", function () {
260
264
  var _this2$props2 = _this2.props,
261
265
  hideControls = _this2$props2.hideControls,
@@ -515,6 +519,17 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
515
519
  return /*#__PURE__*/React.createElement(Control, props);
516
520
  });
517
521
 
522
+ _defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
523
+ var container = _this2.getContainer();
524
+
525
+ container && (props.getPopupContainer = container);
526
+ props.options = control.options || [];
527
+ props.onSearch = _this2.createSearchEvent(control);
528
+ props.placeholder = props.placeholder || '';
529
+ props.loadData = _this2.createSearchEvent(control);
530
+ return /*#__PURE__*/React.createElement(Control, props);
531
+ });
532
+
518
533
  _defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
519
534
  switch (props.type) {
520
535
  case 'readonly':
@@ -564,6 +579,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
564
579
  case 'uploadImg':
565
580
  return _this2.uploadImg(props, control);
566
581
 
582
+ case 'cascader':
583
+ return _this2.toCascader(props, control);
584
+
567
585
  default:
568
586
  return 'type error';
569
587
  }
@@ -30,7 +30,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
30
30
 
31
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
32
 
33
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context22, _context23; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context22 = ownKeys(Object(source), !0)).call(_context22, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context23 = ownKeys(Object(source))).call(_context23, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context23, _context24; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context23 = ownKeys(Object(source), !0)).call(_context23, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context24 = ownKeys(Object(source))).call(_context24, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
34
34
 
35
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
36
 
@@ -45,7 +45,7 @@ import variables from '../variables';
45
45
  var FormItem = _Form.Item;
46
46
  var defaultSize = 'small';
47
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'];
48
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader'];
49
49
  /**
50
50
  * key:[必须],用于唯一标识该Form下的一个表单元素
51
51
  * title:[必须],表单元素的标签
@@ -67,9 +67,7 @@ var ControlType = {
67
67
  onCheckItem: PropTypes.any,
68
68
  showAdd: PropTypes.any,
69
69
  rule: PropTypes.object,
70
- props: PropTypes.object,
71
- buildSuperUploadProps: PropTypes.func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
72
-
70
+ props: PropTypes.object
73
71
  };
74
72
 
75
73
  var Controlled = /*#__PURE__*/function (_React$Component) {
@@ -269,6 +267,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
269
267
  return colNum * 1200;
270
268
  });
271
269
 
270
+ _defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
271
+ return _this2.props.getContainer;
272
+ });
273
+
272
274
  _defineProperty(_assertThisInitialized(_this2), "getControls", function () {
273
275
  var _this2$props2 = _this2.props,
274
276
  hideControls = _this2$props2.hideControls,
@@ -322,65 +324,74 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
322
324
  readonly: true,
323
325
  onBlur: _bindInstanceProperty(_context3 = _this2.onExitValid).call(_context3, _assertThisInitialized(_this2), key)
324
326
  };
325
- } else {
327
+ } else if (originType === 'uploadImg') {
326
328
  var _context4;
327
329
 
328
- return {
330
+ var commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
331
+ return _objectSpread(_objectSpread(_objectSpread({}, props), commonProps), {}, {
332
+ readonly: true,
329
333
  onBlur: _bindInstanceProperty(_context4 = _this2.onExitValid).call(_context4, _assertThisInitialized(_this2), key)
334
+ });
335
+ } else {
336
+ var _context5;
337
+
338
+ return {
339
+ onBlur: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key)
330
340
  };
331
341
  }
332
342
  } else if (type === 'text' || type === 'textArea') {
333
- var _context5, _context6;
343
+ var _context6, _context7;
334
344
 
335
345
  return _objectSpread(_objectSpread({}, props), {}, {
336
- onChange: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key),
337
- onBlur: _bindInstanceProperty(_context6 = _this2.onChange).call(_context6, _assertThisInitialized(_this2), key)
346
+ onChange: _bindInstanceProperty(_context6 = _this2.onExitValid).call(_context6, _assertThisInitialized(_this2), key),
347
+ onBlur: _bindInstanceProperty(_context7 = _this2.onChange).call(_context7, _assertThisInitialized(_this2), key)
338
348
  });
339
349
  } else if (type === 'date') {
340
- var _context7, _context8;
350
+ var _context8, _context9;
341
351
 
342
352
  var propsObj = _objectSpread(_objectSpread({}, props), {}, {
343
- onChange: _bindInstanceProperty(_context7 = _this2.onBlur).call(_context7, _assertThisInitialized(_this2), key),
344
- onBlur: _bindInstanceProperty(_context8 = _this2.onExitValid).call(_context8, _assertThisInitialized(_this2), key)
353
+ onChange: _bindInstanceProperty(_context8 = _this2.onBlur).call(_context8, _assertThisInitialized(_this2), key),
354
+ onBlur: _bindInstanceProperty(_context9 = _this2.onExitValid).call(_context9, _assertThisInitialized(_this2), key)
345
355
  });
346
356
 
347
357
  if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
348
- var _context9;
358
+ var _context10;
349
359
 
350
- propsObj.onOpenChange = _bindInstanceProperty(_context9 = _this2.props.onOpenChange).call(_context9, _assertThisInitialized(_this2), key);
360
+ propsObj.onOpenChange = _bindInstanceProperty(_context10 = _this2.props.onOpenChange).call(_context10, _assertThisInitialized(_this2), key);
351
361
  }
352
362
 
353
363
  return propsObj;
354
364
  } else if (type === 'captcha') {
355
- var _context10, _context11, _context12;
365
+ var _context11, _context12, _context13;
356
366
 
357
367
  return _objectSpread(_objectSpread({}, props), {}, {
358
- onChange: _bindInstanceProperty(_context10 = _this2.onBlur).call(_context10, _assertThisInitialized(_this2), key),
359
- onBlur: _bindInstanceProperty(_context11 = _this2.onExitValid).call(_context11, _assertThisInitialized(_this2), key),
360
- onGetCode: _bindInstanceProperty(_context12 = _this2.onGetCode).call(_context12, _assertThisInitialized(_this2), key)
368
+ onChange: _bindInstanceProperty(_context11 = _this2.onBlur).call(_context11, _assertThisInitialized(_this2), key),
369
+ onBlur: _bindInstanceProperty(_context12 = _this2.onExitValid).call(_context12, _assertThisInitialized(_this2), key),
370
+ onGetCode: _bindInstanceProperty(_context13 = _this2.onGetCode).call(_context13, _assertThisInitialized(_this2), key)
361
371
  });
362
372
  } else if (type === 'area') {
363
- var _context13, _context14;
373
+ var _context14, _context15;
364
374
 
365
375
  return _objectSpread(_objectSpread({}, props), {}, {
366
- onChange: _bindInstanceProperty(_context13 = _this2.onBlur).call(_context13, _assertThisInitialized(_this2), key),
367
- onBlur: _bindInstanceProperty(_context14 = _this2.onExitValid).call(_context14, _assertThisInitialized(_this2), key),
376
+ onChange: _bindInstanceProperty(_context14 = _this2.onBlur).call(_context14, _assertThisInitialized(_this2), key),
377
+ onBlur: _bindInstanceProperty(_context15 = _this2.onExitValid).call(_context15, _assertThisInitialized(_this2), key),
368
378
  onAreaSearch: _this2.props.onAreaSearch
369
379
  });
370
380
  } else if (type === 'uploadImg') {
371
- var _context15, _context16;
381
+ var _context16, _context17;
382
+
383
+ var _commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
372
384
 
373
- var commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
374
- return _objectSpread(_objectSpread(_objectSpread({}, props), commonProps), {}, {
375
- onChange: _bindInstanceProperty(_context15 = _this2.onBlur).call(_context15, _assertThisInitialized(_this2), key),
376
- onBlur: _bindInstanceProperty(_context16 = _this2.onExitValid).call(_context16, _assertThisInitialized(_this2), key)
385
+ return _objectSpread(_objectSpread(_objectSpread({}, props), _commonProps), {}, {
386
+ onChange: _bindInstanceProperty(_context16 = _this2.onBlur).call(_context16, _assertThisInitialized(_this2), key),
387
+ onBlur: _bindInstanceProperty(_context17 = _this2.onExitValid).call(_context17, _assertThisInitialized(_this2), key)
377
388
  });
378
389
  } else {
379
- var _context17, _context18;
390
+ var _context18, _context19;
380
391
 
381
392
  return _objectSpread(_objectSpread({}, props), {}, {
382
- onChange: _bindInstanceProperty(_context17 = _this2.onBlur).call(_context17, _assertThisInitialized(_this2), key),
383
- onBlur: _bindInstanceProperty(_context18 = _this2.onExitValid).call(_context18, _assertThisInitialized(_this2), key)
393
+ onChange: _bindInstanceProperty(_context18 = _this2.onBlur).call(_context18, _assertThisInitialized(_this2), key),
394
+ onBlur: _bindInstanceProperty(_context19 = _this2.onExitValid).call(_context19, _assertThisInitialized(_this2), key)
384
395
  });
385
396
  }
386
397
  });
@@ -538,17 +549,28 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
538
549
  });
539
550
 
540
551
  _defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
541
- var _context19;
552
+ var _context20;
542
553
 
543
554
  var readonly = _this2.props.readonly;
544
555
  props.required = control.required || false;
545
- props.onFileChange = _bindInstanceProperty(_context19 = _this2.onFileChange).call(_context19, _assertThisInitialized(_this2), control);
556
+ props.onFileChange = _bindInstanceProperty(_context20 = _this2.onFileChange).call(_context20, _assertThisInitialized(_this2), control);
546
557
  props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
547
558
  return readonlyKey === control.key;
548
559
  }) ? true : false;
549
560
  return /*#__PURE__*/React.createElement(Control, props);
550
561
  });
551
562
 
563
+ _defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
564
+ var container = _this2.getContainer();
565
+
566
+ container && (props.getPopupContainer = container);
567
+ props.options = control.options || [];
568
+ props.onSearch = _this2.createSearchEvent(control);
569
+ props.placeholder = props.placeholder || '';
570
+ props.loadData = _this2.createSearchEvent(control);
571
+ return /*#__PURE__*/React.createElement(Control, props);
572
+ });
573
+
552
574
  _defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
553
575
  switch (props.type) {
554
576
  case 'readonly':
@@ -601,6 +623,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
601
623
  case 'uploadImg':
602
624
  return _this2.uploadImg(props, control);
603
625
 
626
+ case 'cascader':
627
+ return _this2.toCascader(props, control);
628
+
604
629
  default:
605
630
  return 'type error';
606
631
  }
@@ -612,9 +637,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
612
637
  key = _ref11.key;
613
638
 
614
639
  if (showAdd && type !== 'readonly') {
615
- var _context20;
640
+ var _context21;
616
641
 
617
- var onClick = _bindInstanceProperty(_context20 = _this2.onAdd).call(_context20, _assertThisInitialized(_this2), key, title);
642
+ var onClick = _bindInstanceProperty(_context21 = _this2.onAdd).call(_context21, _assertThisInitialized(_this2), key, title);
618
643
 
619
644
  return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
620
645
  role: "add",
@@ -676,7 +701,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
676
701
  });
677
702
 
678
703
  _defineProperty(_assertThisInitialized(_this2), "toCols", function () {
679
- var _context21;
704
+ var _context22;
680
705
 
681
706
  var _this2$props4 = _this2.props,
682
707
  _this2$props4$colNum = _this2$props4.colNum,
@@ -688,7 +713,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
688
713
  }
689
714
 
690
715
  var span = 24 / colNum;
691
- return _mapInstanceProperty(_context21 = _this2.getControls()).call(_context21, function (control) {
716
+ return _mapInstanceProperty(_context22 = _this2.getControls()).call(_context22, function (control) {
692
717
  if (allFullFather) {
693
718
  control.allFullFather = allFullFather;
694
719
  }
@@ -736,7 +761,9 @@ _defineProperty(SuperForm2, "propTypes", {
736
761
  onOpenChange: PropTypes.func,
737
762
  onGetCode: PropTypes.func,
738
763
  onFileChange: PropTypes.func,
739
- onAreaSearch: PropTypes.func
764
+ onAreaSearch: PropTypes.func,
765
+ buildSuperUploadProps: PropTypes.func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
766
+
740
767
  });
741
768
 
742
769
  export default SuperForm2;
@@ -439,14 +439,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
439
439
  return value ? typeof value === 'string' ? /*#__PURE__*/React.createElement("img", {
440
440
  src: value,
441
441
  style: {
442
- maxWidth: '100px'
442
+ width: '80px',
443
+ height: '80px'
443
444
  }
444
445
  }) : /*#__PURE__*/React.createElement("div", {
445
446
  role: 'imgBox'
446
447
  }, /*#__PURE__*/React.createElement("img", {
447
448
  src: value.img,
448
449
  style: {
449
- maxWidth: '100px'
450
+ width: '80px',
451
+ height: '80px'
450
452
  }
451
453
  }), /*#__PURE__*/React.createElement("span", null, value.title)) : /*#__PURE__*/React.createElement("div", null);
452
454
 
package/lib/Area/Area.js CHANGED
@@ -91,7 +91,8 @@ var Area = /*#__PURE__*/function (_React$Component) {
91
91
  var _this$props = _this.props,
92
92
  onParentChange = _this$props.onParentChange,
93
93
  child = _this$props.child,
94
- value = _this$props.value;
94
+ _this$props$value = _this$props.value,
95
+ value = _this$props$value === void 0 ? {} : _this$props$value;
95
96
  var newValue = {};
96
97
  newValue[key] = keyValue;
97
98
  var CheckValue, checkIndex;
@@ -114,7 +115,8 @@ var Area = /*#__PURE__*/function (_React$Component) {
114
115
  var _this$props2 = _this.props,
115
116
  onAreaSearch = _this$props2.onAreaSearch,
116
117
  child = _this$props2.child,
117
- value = _this$props2.value;
118
+ _this$props2$value = _this$props2.value,
119
+ value = _this$props2$value === void 0 ? {} : _this$props2$value;
118
120
  var flag = true;
119
121
  (0, _map["default"])(child).call(child, function (item, index) {
120
122
  if (item.key === key && index !== 0) {
@@ -141,7 +143,7 @@ var Area = /*#__PURE__*/function (_React$Component) {
141
143
  value: function componentWillReceiveProps(props) {
142
144
  if (props.value !== this.props.value) {
143
145
  this.setState({
144
- value: props.value
146
+ value: props.value || {}
145
147
  });
146
148
  }
147
149
  }
@@ -157,7 +159,8 @@ var Area = /*#__PURE__*/function (_React$Component) {
157
159
  options = _this$props3$options === void 0 ? {} : _this$props3$options,
158
160
  _this$props3$readonly = _this$props3.readonly,
159
161
  readonly = _this$props3$readonly === void 0 ? false : _this$props3$readonly,
160
- value = _this$props3.value;
162
+ _this$props3$value = _this$props3.value,
163
+ value = _this$props3$value === void 0 ? {} : _this$props3$value;
161
164
  return /*#__PURE__*/_react["default"].createElement(_row["default"], null, (0, _map["default"])(child).call(child, function (item, index) {
162
165
  var _context, _context2, _context3;
163
166
 
@@ -176,7 +179,7 @@ var Area = /*#__PURE__*/function (_React$Component) {
176
179
  onSearch: (0, _bind["default"])(_context2 = _this2.onSearch).call(_context2, _this2, item.key, item, parentKey),
177
180
  onChange: (0, _bind["default"])(_context3 = _this2.onChange).call(_context3, _this2, item.key),
178
181
  options: childOptions,
179
- value: _this2.props.value[item.key].title ? _this2.props.value[item.key].title : _this2.props.value[item.key],
182
+ value: value[item.key].title ? value[item.key].title : value[item.key],
180
183
  type: readonly ? 'readonly' : item.type
181
184
  });
182
185
 
@@ -99,7 +99,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
99
99
  var FormItem = _form["default"].Item;
100
100
  var defaultSize = 'small';
101
101
  var defaultColNum = 4;
102
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg'];
102
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader'];
103
103
  /**
104
104
  * key:[必须],用于唯一标识该Form下的一个表单元素
105
105
  * title:[必须],表单元素的标签
@@ -297,6 +297,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
297
297
  colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
298
298
  return colNum * 250;
299
299
  });
300
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getContainer", function () {
301
+ return _this2.props.getContainer;
302
+ });
300
303
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getControls", function () {
301
304
  var _this2$props2 = _this2.props,
302
305
  hideControls = _this2$props2.hideControls,
@@ -535,6 +538,16 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
535
538
  }) ? true : false;
536
539
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
537
540
  });
541
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCascader", function (props, control) {
542
+ var container = _this2.getContainer();
543
+
544
+ container && (props.getPopupContainer = container);
545
+ props.options = control.options || [];
546
+ props.onSearch = _this2.createSearchEvent(control);
547
+ props.placeholder = props.placeholder || '';
548
+ props.loadData = _this2.createSearchEvent(control);
549
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
550
+ });
538
551
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toControl", function (props, control) {
539
552
  switch (props.type) {
540
553
  case 'readonly':
@@ -584,6 +597,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
584
597
  case 'uploadImg':
585
598
  return _this2.uploadImg(props, control);
586
599
 
600
+ case 'cascader':
601
+ return _this2.toCascader(props, control);
602
+
587
603
  default:
588
604
  return 'type error';
589
605
  }
@@ -90,7 +90,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
90
90
 
91
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
92
 
93
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context22, _context23; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context22 = ownKeys(Object(source), !0)).call(_context22, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context23 = ownKeys(Object(source))).call(_context23, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
93
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context23, _context24; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context23 = ownKeys(Object(source), !0)).call(_context23, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context24 = ownKeys(Object(source))).call(_context24, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
94
94
 
95
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
96
 
@@ -99,7 +99,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
99
99
  var FormItem = _form["default"].Item;
100
100
  var defaultSize = 'small';
101
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'];
102
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader'];
103
103
  /**
104
104
  * key:[必须],用于唯一标识该Form下的一个表单元素
105
105
  * title:[必须],表单元素的标签
@@ -121,9 +121,7 @@ var ControlType = {
121
121
  onCheckItem: _propTypes["default"].any,
122
122
  showAdd: _propTypes["default"].any,
123
123
  rule: _propTypes["default"].object,
124
- props: _propTypes["default"].object,
125
- buildSuperUploadProps: _propTypes["default"].func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
126
-
124
+ props: _propTypes["default"].object
127
125
  };
128
126
 
129
127
  var Controlled = /*#__PURE__*/function (_React$Component) {
@@ -308,6 +306,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
308
306
  colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
309
307
  return colNum * 1200;
310
308
  });
309
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getContainer", function () {
310
+ return _this2.props.getContainer;
311
+ });
311
312
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getControls", function () {
312
313
  var _this2$props2 = _this2.props,
313
314
  hideControls = _this2$props2.hideControls,
@@ -359,65 +360,74 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
359
360
  readonly: true,
360
361
  onBlur: (0, _bind["default"])(_context3 = _this2.onExitValid).call(_context3, (0, _assertThisInitialized2["default"])(_this2), key)
361
362
  };
362
- } else {
363
+ } else if (originType === 'uploadImg') {
363
364
  var _context4;
364
365
 
365
- return {
366
+ var commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
367
+ return _objectSpread(_objectSpread(_objectSpread({}, props), commonProps), {}, {
368
+ readonly: true,
366
369
  onBlur: (0, _bind["default"])(_context4 = _this2.onExitValid).call(_context4, (0, _assertThisInitialized2["default"])(_this2), key)
370
+ });
371
+ } else {
372
+ var _context5;
373
+
374
+ return {
375
+ onBlur: (0, _bind["default"])(_context5 = _this2.onExitValid).call(_context5, (0, _assertThisInitialized2["default"])(_this2), key)
367
376
  };
368
377
  }
369
378
  } else if (type === 'text' || type === 'textArea') {
370
- var _context5, _context6;
379
+ var _context6, _context7;
371
380
 
372
381
  return _objectSpread(_objectSpread({}, props), {}, {
373
- onChange: (0, _bind["default"])(_context5 = _this2.onExitValid).call(_context5, (0, _assertThisInitialized2["default"])(_this2), key),
374
- onBlur: (0, _bind["default"])(_context6 = _this2.onChange).call(_context6, (0, _assertThisInitialized2["default"])(_this2), key)
382
+ onChange: (0, _bind["default"])(_context6 = _this2.onExitValid).call(_context6, (0, _assertThisInitialized2["default"])(_this2), key),
383
+ onBlur: (0, _bind["default"])(_context7 = _this2.onChange).call(_context7, (0, _assertThisInitialized2["default"])(_this2), key)
375
384
  });
376
385
  } else if (type === 'date') {
377
- var _context7, _context8;
386
+ var _context8, _context9;
378
387
 
379
388
  var propsObj = _objectSpread(_objectSpread({}, props), {}, {
380
- onChange: (0, _bind["default"])(_context7 = _this2.onBlur).call(_context7, (0, _assertThisInitialized2["default"])(_this2), key),
381
- onBlur: (0, _bind["default"])(_context8 = _this2.onExitValid).call(_context8, (0, _assertThisInitialized2["default"])(_this2), key)
389
+ onChange: (0, _bind["default"])(_context8 = _this2.onBlur).call(_context8, (0, _assertThisInitialized2["default"])(_this2), key),
390
+ onBlur: (0, _bind["default"])(_context9 = _this2.onExitValid).call(_context9, (0, _assertThisInitialized2["default"])(_this2), key)
382
391
  });
383
392
 
384
393
  if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
385
- var _context9;
394
+ var _context10;
386
395
 
387
- propsObj.onOpenChange = (0, _bind["default"])(_context9 = _this2.props.onOpenChange).call(_context9, (0, _assertThisInitialized2["default"])(_this2), key);
396
+ propsObj.onOpenChange = (0, _bind["default"])(_context10 = _this2.props.onOpenChange).call(_context10, (0, _assertThisInitialized2["default"])(_this2), key);
388
397
  }
389
398
 
390
399
  return propsObj;
391
400
  } else if (type === 'captcha') {
392
- var _context10, _context11, _context12;
401
+ var _context11, _context12, _context13;
393
402
 
394
403
  return _objectSpread(_objectSpread({}, props), {}, {
395
- onChange: (0, _bind["default"])(_context10 = _this2.onBlur).call(_context10, (0, _assertThisInitialized2["default"])(_this2), key),
396
- onBlur: (0, _bind["default"])(_context11 = _this2.onExitValid).call(_context11, (0, _assertThisInitialized2["default"])(_this2), key),
397
- onGetCode: (0, _bind["default"])(_context12 = _this2.onGetCode).call(_context12, (0, _assertThisInitialized2["default"])(_this2), key)
404
+ onChange: (0, _bind["default"])(_context11 = _this2.onBlur).call(_context11, (0, _assertThisInitialized2["default"])(_this2), key),
405
+ onBlur: (0, _bind["default"])(_context12 = _this2.onExitValid).call(_context12, (0, _assertThisInitialized2["default"])(_this2), key),
406
+ onGetCode: (0, _bind["default"])(_context13 = _this2.onGetCode).call(_context13, (0, _assertThisInitialized2["default"])(_this2), key)
398
407
  });
399
408
  } else if (type === 'area') {
400
- var _context13, _context14;
409
+ var _context14, _context15;
401
410
 
402
411
  return _objectSpread(_objectSpread({}, props), {}, {
403
- onChange: (0, _bind["default"])(_context13 = _this2.onBlur).call(_context13, (0, _assertThisInitialized2["default"])(_this2), key),
404
- onBlur: (0, _bind["default"])(_context14 = _this2.onExitValid).call(_context14, (0, _assertThisInitialized2["default"])(_this2), key),
412
+ onChange: (0, _bind["default"])(_context14 = _this2.onBlur).call(_context14, (0, _assertThisInitialized2["default"])(_this2), key),
413
+ onBlur: (0, _bind["default"])(_context15 = _this2.onExitValid).call(_context15, (0, _assertThisInitialized2["default"])(_this2), key),
405
414
  onAreaSearch: _this2.props.onAreaSearch
406
415
  });
407
416
  } else if (type === 'uploadImg') {
408
- var _context15, _context16;
417
+ var _context16, _context17;
418
+
419
+ var _commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
409
420
 
410
- var commonProps = _this2.props.buildSuperUploadProps ? _this2.props.buildSuperUploadProps() : {};
411
- return _objectSpread(_objectSpread(_objectSpread({}, props), commonProps), {}, {
412
- onChange: (0, _bind["default"])(_context15 = _this2.onBlur).call(_context15, (0, _assertThisInitialized2["default"])(_this2), key),
413
- onBlur: (0, _bind["default"])(_context16 = _this2.onExitValid).call(_context16, (0, _assertThisInitialized2["default"])(_this2), key)
421
+ return _objectSpread(_objectSpread(_objectSpread({}, props), _commonProps), {}, {
422
+ onChange: (0, _bind["default"])(_context16 = _this2.onBlur).call(_context16, (0, _assertThisInitialized2["default"])(_this2), key),
423
+ onBlur: (0, _bind["default"])(_context17 = _this2.onExitValid).call(_context17, (0, _assertThisInitialized2["default"])(_this2), key)
414
424
  });
415
425
  } else {
416
- var _context17, _context18;
426
+ var _context18, _context19;
417
427
 
418
428
  return _objectSpread(_objectSpread({}, props), {}, {
419
- onChange: (0, _bind["default"])(_context17 = _this2.onBlur).call(_context17, (0, _assertThisInitialized2["default"])(_this2), key),
420
- onBlur: (0, _bind["default"])(_context18 = _this2.onExitValid).call(_context18, (0, _assertThisInitialized2["default"])(_this2), key)
429
+ onChange: (0, _bind["default"])(_context18 = _this2.onBlur).call(_context18, (0, _assertThisInitialized2["default"])(_this2), key),
430
+ onBlur: (0, _bind["default"])(_context19 = _this2.onExitValid).call(_context19, (0, _assertThisInitialized2["default"])(_this2), key)
421
431
  });
422
432
  }
423
433
  });
@@ -555,16 +565,26 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
555
565
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
556
566
  });
557
567
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "uploadImg", function (props, control) {
558
- var _context19;
568
+ var _context20;
559
569
 
560
570
  var readonly = _this2.props.readonly;
561
571
  props.required = control.required || false;
562
- props.onFileChange = (0, _bind["default"])(_context19 = _this2.onFileChange).call(_context19, (0, _assertThisInitialized2["default"])(_this2), control);
572
+ props.onFileChange = (0, _bind["default"])(_context20 = _this2.onFileChange).call(_context20, (0, _assertThisInitialized2["default"])(_this2), control);
563
573
  props.readonly = readonly === true || (0, _isArray["default"])(readonly) && (0, _some["default"])(readonly).call(readonly, function (readonlyKey) {
564
574
  return readonlyKey === control.key;
565
575
  }) ? true : false;
566
576
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
567
577
  });
578
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCascader", function (props, control) {
579
+ var container = _this2.getContainer();
580
+
581
+ container && (props.getPopupContainer = container);
582
+ props.options = control.options || [];
583
+ props.onSearch = _this2.createSearchEvent(control);
584
+ props.placeholder = props.placeholder || '';
585
+ props.loadData = _this2.createSearchEvent(control);
586
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
587
+ });
568
588
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toControl", function (props, control) {
569
589
  switch (props.type) {
570
590
  case 'readonly':
@@ -617,6 +637,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
617
637
  case 'uploadImg':
618
638
  return _this2.uploadImg(props, control);
619
639
 
640
+ case 'cascader':
641
+ return _this2.toCascader(props, control);
642
+
620
643
  default:
621
644
  return 'type error';
622
645
  }
@@ -627,9 +650,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
627
650
  key = _ref11.key;
628
651
 
629
652
  if (showAdd && type !== 'readonly') {
630
- var _context20;
653
+ var _context21;
631
654
 
632
- var onClick = (0, _bind["default"])(_context20 = _this2.onAdd).call(_context20, (0, _assertThisInitialized2["default"])(_this2), key, title);
655
+ var onClick = (0, _bind["default"])(_context21 = _this2.onAdd).call(_context21, (0, _assertThisInitialized2["default"])(_this2), key, title);
633
656
  return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
634
657
  role: "add",
635
658
  type: "plus-circle-o",
@@ -688,7 +711,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
688
711
  });
689
712
  });
690
713
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCols", function () {
691
- var _context21;
714
+ var _context22;
692
715
 
693
716
  var _this2$props4 = _this2.props,
694
717
  _this2$props4$colNum = _this2$props4.colNum,
@@ -700,7 +723,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
700
723
  }
701
724
 
702
725
  var span = 24 / colNum;
703
- return (0, _map["default"])(_context21 = _this2.getControls()).call(_context21, function (control) {
726
+ return (0, _map["default"])(_context22 = _this2.getControls()).call(_context22, function (control) {
704
727
  if (allFullFather) {
705
728
  control.allFullFather = allFullFather;
706
729
  }
@@ -746,7 +769,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
746
769
  onOpenChange: _propTypes["default"].func,
747
770
  onGetCode: _propTypes["default"].func,
748
771
  onFileChange: _propTypes["default"].func,
749
- onAreaSearch: _propTypes["default"].func
772
+ onAreaSearch: _propTypes["default"].func,
773
+ buildSuperUploadProps: _propTypes["default"].func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
774
+
750
775
  });
751
776
  var _default = SuperForm2;
752
777
  exports["default"] = _default;
@@ -478,14 +478,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
478
478
  return value ? typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("img", {
479
479
  src: value,
480
480
  style: {
481
- maxWidth: '100px'
481
+ width: '80px',
482
+ height: '80px'
482
483
  }
483
484
  }) : /*#__PURE__*/_react["default"].createElement("div", {
484
485
  role: 'imgBox'
485
486
  }, /*#__PURE__*/_react["default"].createElement("img", {
486
487
  src: value.img,
487
488
  style: {
488
- maxWidth: '100px'
489
+ width: '80px',
490
+ height: '80px'
489
491
  }
490
492
  }), /*#__PURE__*/_react["default"].createElement("span", null, value.title)) : /*#__PURE__*/_react["default"].createElement("div", null);
491
493
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud-b2b",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "description": "A react component library dependent antd",
5
5
  "keywords": [
6
6
  "react",