cloud-b2b 1.1.68 → 1.1.70

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.
@@ -7,10 +7,10 @@ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-st
7
7
  import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
8
  import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
9
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
10
- import _DatePicker from "antd/es/date-picker";
11
10
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
12
11
  import _extends from "@babel/runtime-corejs3/helpers/extends";
13
12
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
13
+ import _DatePicker from "antd/es/date-picker";
14
14
  import _Radio from "antd/es/radio";
15
15
  import _Input from "antd/es/input";
16
16
  import _Select from "antd/es/select";
@@ -46,6 +46,7 @@ import Area from '../Area/Area';
46
46
  var SelectOption = _Select.Option;
47
47
  var TextArea = _Input.TextArea;
48
48
  var RadioGroup = _Radio.Group;
49
+ var RangePicker = _DatePicker.RangePicker;
49
50
  moment.locale('zh-cn');
50
51
  var getTitleOptions = function getTitleOptions(options) {
51
52
  var existTitles = [];
@@ -291,7 +292,20 @@ var date = function date(props) {
291
292
  onBlur: props.onBlur
292
293
  }, /*#__PURE__*/React.createElement(_DatePicker, props));
293
294
  };
294
-
295
+ var rangePicker = function rangePicker(props) {
296
+ var origin = props.onChange;
297
+ if (typeof props.value !== 'undefined' && props.value.length === 2) {
298
+ props.value = !props.value ? undefined : [moment(props.value[0]), moment(props.value[1])];
299
+ }
300
+ if (props.onChange) {
301
+ props.onChange = function (date, str) {
302
+ return origin(str);
303
+ };
304
+ }
305
+ return /*#__PURE__*/React.createElement("div", {
306
+ onBlur: props.onBlur
307
+ }, " ", /*#__PURE__*/React.createElement(RangePicker, props));
308
+ };
295
309
  // 单选按钮组
296
310
  var radioGroup = function radioGroup(_ref3) {
297
311
  var _ref3$options = _ref3.options,
@@ -362,12 +376,16 @@ var controls = {
362
376
  area: area,
363
377
  uploadImg: uploadImg,
364
378
  "double": _double,
365
- treeSelect: treeSelect
379
+ treeSelect: treeSelect,
380
+ rangePicker: rangePicker
366
381
  };
367
382
  var Control = function Control(_ref4) {
368
383
  var type = _ref4.type,
369
384
  autoFocus = _ref4.autoFocus,
370
385
  props = _objectWithoutProperties(_ref4, _excluded2);
386
+ if (props && props['data-__meta'] && props['data-__meta'].originalProps && props['data-__meta'].originalProps.value) {
387
+ props.value = props['data-__meta'].originalProps.value;
388
+ }
371
389
  var ref = autoFocus ? function (e) {
372
390
  return setFocus(e, type);
373
391
  } : null;
@@ -74,14 +74,17 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
74
74
  _classCallCheck(this, InputSearch);
75
75
  _this = _super.call(this, _props);
76
76
  _defineProperty(_assertThisInitialized(_this), "onSearch", function (value) {
77
- _this.setState({
78
- value: value
79
- });
77
+ // this.setState({value});
80
78
  var _this$props = _this.props,
81
79
  onSearch = _this$props.onSearch,
82
80
  noSearchWhenTypo = _this$props.noSearchWhenTypo;
83
81
  !noSearchWhenTypo && onSearch && onSearch(value);
84
82
  });
83
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (value) {
84
+ _this.setState({
85
+ value: value
86
+ });
87
+ });
85
88
  _defineProperty(_assertThisInitialized(_this), "onBlur", function () {
86
89
  var _this$props2 = _this.props,
87
90
  _this$props2$autoAdd = _this$props2.autoAdd,
@@ -220,12 +223,13 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
220
223
  value: _this.getValue(),
221
224
  allowClear: true,
222
225
  ref: inputRef,
223
- onChange: _this.onSearch,
226
+ onChange: _this.onChange,
227
+ onSearch: _this.onSearch,
228
+ onSelect: _this.onSelect,
229
+ onBlur: _this.onBlur,
224
230
  filterOption: function filterOption(e, option) {
225
231
  return option;
226
- },
227
- onSelect: _this.onSelect,
228
- onBlur: _this.onBlur
232
+ }
229
233
  });
230
234
  if (_this.props.remark) {
231
235
  props.dataSource = _this.getDataSourceRemark();
@@ -257,7 +261,8 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
257
261
  return /*#__PURE__*/React.createElement("div", {
258
262
  onClick: this.onClick
259
263
  }, /*#__PURE__*/React.createElement(_AutoComplete, this.getProps(), /*#__PURE__*/React.createElement(_Input, {
260
- suffix: suffix
264
+ suffix: suffix,
265
+ placeholder: this.props.placeholder
261
266
  })));
262
267
  }
263
268
  }]);
@@ -41,7 +41,7 @@ import variables from '../variables';
41
41
  var FormItem = _Form.Item;
42
42
  var defaultSize = 'large';
43
43
  var defaultColNum = 4;
44
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox', 'treeSelect'];
44
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'rangePicker', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox', 'treeSelect'];
45
45
 
46
46
  /**
47
47
  * key:[必须],用于唯一标识该Form下的一个表单元素
@@ -443,9 +443,18 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
443
443
  rule && (props.disabledDate = _this2.validDate(rule));
444
444
  return /*#__PURE__*/React.createElement(Control, props);
445
445
  });
446
- _defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref8) {
447
- var key = _ref8.key,
448
- options = _ref8.options;
446
+ _defineProperty(_assertThisInitialized(_this2), "toRangePicker", function (props, _ref8) {
447
+ var rule = _ref8.rule;
448
+ props.getCalendarContainer = _this2.getPopupContainer;
449
+ props.style = {
450
+ width: '100%'
451
+ };
452
+ // rule && (props.disabledDate = this.validDate(rule));
453
+ return /*#__PURE__*/React.createElement(Control, props);
454
+ });
455
+ _defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref9) {
456
+ var key = _ref9.key,
457
+ options = _ref9.options;
449
458
  props.options = _this2.getOptions(key, options);
450
459
  return /*#__PURE__*/React.createElement(Control, props);
451
460
  });
@@ -453,9 +462,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
453
462
  props.onGetCode = _this2.props.onGetCode;
454
463
  return /*#__PURE__*/React.createElement(Control, props);
455
464
  });
456
- _defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref9) {
457
- var options = _ref9.options,
458
- key = _ref9.key;
465
+ _defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref10) {
466
+ var options = _ref10.options,
467
+ key = _ref10.key;
459
468
  props.value = getTitle(props.value, _this2.getOptions(key, options));
460
469
  return /*#__PURE__*/React.createElement(Control, props);
461
470
  });
@@ -466,9 +475,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
466
475
  props.dropdownMatchSelectWidth = false;
467
476
  return /*#__PURE__*/React.createElement(Control, props);
468
477
  });
469
- _defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref10) {
470
- var key = _ref10.key,
471
- options = _ref10.options;
478
+ _defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref11) {
479
+ var key = _ref11.key,
480
+ options = _ref11.options;
472
481
  var readonly = _this2.props.readonly;
473
482
  props.parentKey = key;
474
483
  props.options = _this2.getOptions(key, options);
@@ -524,6 +533,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
524
533
  return _this2.toSearch(props, control);
525
534
  case 'date':
526
535
  return _this2.toDate(props, control);
536
+ case 'rangePicker':
537
+ return _this2.toRangePicker(props, control);
527
538
  case 'radioGroup':
528
539
  return _this2.toRadioGroup(props, control);
529
540
  case 'textArea':
@@ -554,12 +565,12 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
554
565
  return 'type error';
555
566
  }
556
567
  });
557
- _defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
558
- var title = _ref11.title,
559
- showAdd = _ref11.showAdd,
560
- key = _ref11.key,
561
- showInfo = _ref11.showInfo,
562
- showInfoTitle = _ref11.showInfoTitle;
568
+ _defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref12, type) {
569
+ var title = _ref12.title,
570
+ showAdd = _ref12.showAdd,
571
+ key = _ref12.key,
572
+ showInfo = _ref12.showInfo,
573
+ showInfoTitle = _ref12.showInfoTitle;
563
574
  if (showAdd && type !== 'readonly') {
564
575
  var _context24;
565
576
  var onClick = _bindInstanceProperty(_context24 = _this2.onAdd).call(_context24, _assertThisInitialized(_this2), key, title);
@@ -34,6 +34,13 @@
34
34
  :global(.ant-select-selection--multiple) {
35
35
  border-top-width: 1px;
36
36
  }
37
+ :global(.ant-calendar-picker-input) {
38
+ display: flex;
39
+ }
40
+ :global(.has-error .ant-calendar-picker-input) {
41
+ border-color: #ff4d4f !important;
42
+ box-shadow:0 0 2px rgba(245, 34, 45, 0.2) !important;
43
+ }
37
44
 
38
45
  :global(.ant-radio-group-small) {
39
46
  display: block;
@@ -24,10 +24,10 @@ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
24
24
  var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
25
25
  var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
26
26
  var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
27
- var _datePicker = _interopRequireDefault(require("antd/lib/date-picker"));
28
27
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
29
28
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
30
29
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
30
+ var _datePicker = _interopRequireDefault(require("antd/lib/date-picker"));
31
31
  var _radio = _interopRequireDefault(require("antd/lib/radio"));
32
32
  var _input = _interopRequireDefault(require("antd/lib/input"));
33
33
  var _select = _interopRequireDefault(require("antd/lib/select"));
@@ -53,6 +53,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _co
53
53
  var SelectOption = _select["default"].Option;
54
54
  var TextArea = _input["default"].TextArea;
55
55
  var RadioGroup = _radio["default"].Group;
56
+ var RangePicker = _datePicker["default"].RangePicker;
56
57
  _moment["default"].locale('zh-cn');
57
58
  var getTitleOptions = function getTitleOptions(options) {
58
59
  var existTitles = [];
@@ -298,7 +299,20 @@ var date = function date(props) {
298
299
  onBlur: props.onBlur
299
300
  }, /*#__PURE__*/_react["default"].createElement(_datePicker["default"], props));
300
301
  };
301
-
302
+ var rangePicker = function rangePicker(props) {
303
+ var origin = props.onChange;
304
+ if (typeof props.value !== 'undefined' && props.value.length === 2) {
305
+ props.value = !props.value ? undefined : [(0, _moment["default"])(props.value[0]), (0, _moment["default"])(props.value[1])];
306
+ }
307
+ if (props.onChange) {
308
+ props.onChange = function (date, str) {
309
+ return origin(str);
310
+ };
311
+ }
312
+ return /*#__PURE__*/_react["default"].createElement("div", {
313
+ onBlur: props.onBlur
314
+ }, " ", /*#__PURE__*/_react["default"].createElement(RangePicker, props));
315
+ };
302
316
  // 单选按钮组
303
317
  var radioGroup = function radioGroup(_ref3) {
304
318
  var _ref3$options = _ref3.options,
@@ -369,12 +383,16 @@ var controls = {
369
383
  area: area,
370
384
  uploadImg: uploadImg,
371
385
  "double": _double,
372
- treeSelect: treeSelect
386
+ treeSelect: treeSelect,
387
+ rangePicker: rangePicker
373
388
  };
374
389
  var Control = function Control(_ref4) {
375
390
  var type = _ref4.type,
376
391
  autoFocus = _ref4.autoFocus,
377
392
  props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded2);
393
+ if (props && props['data-__meta'] && props['data-__meta'].originalProps && props['data-__meta'].originalProps.value) {
394
+ props.value = props['data-__meta'].originalProps.value;
395
+ }
378
396
  var ref = autoFocus ? function (e) {
379
397
  return setFocus(e, type);
380
398
  } : null;
@@ -82,14 +82,17 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
82
82
  (0, _classCallCheck2["default"])(this, InputSearch);
83
83
  _this = _super.call(this, _props);
84
84
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSearch", function (value) {
85
- _this.setState({
86
- value: value
87
- });
85
+ // this.setState({value});
88
86
  var _this$props = _this.props,
89
87
  onSearch = _this$props.onSearch,
90
88
  noSearchWhenTypo = _this$props.noSearchWhenTypo;
91
89
  !noSearchWhenTypo && onSearch && onSearch(value);
92
90
  });
91
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (value) {
92
+ _this.setState({
93
+ value: value
94
+ });
95
+ });
93
96
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function () {
94
97
  var _this$props2 = _this.props,
95
98
  _this$props2$autoAdd = _this$props2.autoAdd,
@@ -228,12 +231,13 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
228
231
  value: _this.getValue(),
229
232
  allowClear: true,
230
233
  ref: inputRef,
231
- onChange: _this.onSearch,
234
+ onChange: _this.onChange,
235
+ onSearch: _this.onSearch,
236
+ onSelect: _this.onSelect,
237
+ onBlur: _this.onBlur,
232
238
  filterOption: function filterOption(e, option) {
233
239
  return option;
234
- },
235
- onSelect: _this.onSelect,
236
- onBlur: _this.onBlur
240
+ }
237
241
  });
238
242
  if (_this.props.remark) {
239
243
  props.dataSource = _this.getDataSourceRemark();
@@ -265,7 +269,8 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
265
269
  return /*#__PURE__*/_react["default"].createElement("div", {
266
270
  onClick: this.onClick
267
271
  }, /*#__PURE__*/_react["default"].createElement(_autoComplete["default"], this.getProps(), /*#__PURE__*/_react["default"].createElement(_input["default"], {
268
- suffix: suffix
272
+ suffix: suffix,
273
+ placeholder: this.props.placeholder
269
274
  })));
270
275
  }
271
276
  }]);
@@ -53,7 +53,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
53
53
  var FormItem = _form["default"].Item;
54
54
  var defaultSize = 'large';
55
55
  var defaultColNum = 4;
56
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox', 'treeSelect'];
56
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'rangePicker', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox', 'treeSelect'];
57
57
 
58
58
  /**
59
59
  * key:[必须],用于唯一标识该Form下的一个表单元素
@@ -455,9 +455,18 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
455
455
  rule && (props.disabledDate = _this2.validDate(rule));
456
456
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
457
457
  });
458
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toRadioGroup", function (props, _ref8) {
459
- var key = _ref8.key,
460
- options = _ref8.options;
458
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toRangePicker", function (props, _ref8) {
459
+ var rule = _ref8.rule;
460
+ props.getCalendarContainer = _this2.getPopupContainer;
461
+ props.style = {
462
+ width: '100%'
463
+ };
464
+ // rule && (props.disabledDate = this.validDate(rule));
465
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
466
+ });
467
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toRadioGroup", function (props, _ref9) {
468
+ var key = _ref9.key,
469
+ options = _ref9.options;
461
470
  props.options = _this2.getOptions(key, options);
462
471
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
463
472
  });
@@ -465,9 +474,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
465
474
  props.onGetCode = _this2.props.onGetCode;
466
475
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
467
476
  });
468
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toReadonly", function (props, _ref9) {
469
- var options = _ref9.options,
470
- key = _ref9.key;
477
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toReadonly", function (props, _ref10) {
478
+ var options = _ref10.options,
479
+ key = _ref10.key;
471
480
  props.value = (0, _Control.getTitle)(props.value, _this2.getOptions(key, options));
472
481
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
473
482
  });
@@ -478,9 +487,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
478
487
  props.dropdownMatchSelectWidth = false;
479
488
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
480
489
  });
481
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "area", function (props, _ref10) {
482
- var key = _ref10.key,
483
- options = _ref10.options;
490
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "area", function (props, _ref11) {
491
+ var key = _ref11.key,
492
+ options = _ref11.options;
484
493
  var readonly = _this2.props.readonly;
485
494
  props.parentKey = key;
486
495
  props.options = _this2.getOptions(key, options);
@@ -536,6 +545,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
536
545
  return _this2.toSearch(props, control);
537
546
  case 'date':
538
547
  return _this2.toDate(props, control);
548
+ case 'rangePicker':
549
+ return _this2.toRangePicker(props, control);
539
550
  case 'radioGroup':
540
551
  return _this2.toRadioGroup(props, control);
541
552
  case 'textArea':
@@ -566,12 +577,12 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
566
577
  return 'type error';
567
578
  }
568
579
  });
569
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (_ref11, type) {
570
- var title = _ref11.title,
571
- showAdd = _ref11.showAdd,
572
- key = _ref11.key,
573
- showInfo = _ref11.showInfo,
574
- showInfoTitle = _ref11.showInfoTitle;
580
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (_ref12, type) {
581
+ var title = _ref12.title,
582
+ showAdd = _ref12.showAdd,
583
+ key = _ref12.key,
584
+ showInfo = _ref12.showInfo,
585
+ showInfoTitle = _ref12.showInfoTitle;
575
586
  if (showAdd && type !== 'readonly') {
576
587
  var _context24;
577
588
  var onClick = (0, _bind["default"])(_context24 = _this2.onAdd).call(_context24, (0, _assertThisInitialized2["default"])(_this2), key, title);
@@ -34,6 +34,13 @@
34
34
  :global(.ant-select-selection--multiple) {
35
35
  border-top-width: 1px;
36
36
  }
37
+ :global(.ant-calendar-picker-input) {
38
+ display: flex;
39
+ }
40
+ :global(.has-error .ant-calendar-picker-input) {
41
+ border-color: #ff4d4f !important;
42
+ box-shadow:0 0 2px rgba(245, 34, 45, 0.2) !important;
43
+ }
37
44
 
38
45
  :global(.ant-radio-group-small) {
39
46
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud-b2b",
3
- "version": "1.1.68",
3
+ "version": "1.1.70",
4
4
  "description": "A react component library dependent antd",
5
5
  "keywords": [
6
6
  "react",