cloud-b2b 1.1.8 → 1.1.9

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.
@@ -76,12 +76,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
76
76
 
77
77
  case 3:
78
78
  if (!_context.sent) {
79
- _context.next = 8;
79
+ _context.next = 7;
80
80
  break;
81
81
  }
82
82
 
83
- debugger;
84
-
85
83
  _this.setState({
86
84
  time: _this.props.time || 60
87
85
  });
@@ -97,10 +95,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
97
95
  }
98
96
  }, 1000);
99
97
 
100
- case 8:
98
+ case 7:
101
99
  ;
102
100
 
103
- case 9:
101
+ case 8:
104
102
  case "end":
105
103
  return _context.stop();
106
104
  }
@@ -9,8 +9,9 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
9
9
  import _Row from "antd/es/row";
10
10
  import _Col from "antd/es/col";
11
11
  import _extends from "@babel/runtime-corejs3/helpers/extends";
12
- import _Checkbox from "antd/es/checkbox";
12
+ import _Tooltip from "antd/es/tooltip";
13
13
  import _Icon from "antd/es/icon";
14
+ import _Checkbox from "antd/es/checkbox";
14
15
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
15
16
  import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
16
17
  import _createClass from "@babel/runtime-corejs3/helpers/createClass";
@@ -30,7 +31,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
30
31
 
31
32
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32
33
 
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
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context24, _context25; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context24 = ownKeys(Object(source), !0)).call(_context24, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context25 = ownKeys(Object(source))).call(_context25, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
34
35
 
35
36
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
36
37
 
@@ -45,7 +46,7 @@ import variables from '../variables';
45
46
  var FormItem = _Form.Item;
46
47
  var defaultSize = 'large';
47
48
  var defaultColNum = 4;
48
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader'];
49
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox'];
49
50
  /**
50
51
  * key:[必须],用于唯一标识该Form下的一个表单元素
51
52
  * title:[必须],表单元素的标签
@@ -571,6 +572,17 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
571
572
  return /*#__PURE__*/React.createElement(Control, props);
572
573
  });
573
574
 
575
+ _defineProperty(_assertThisInitialized(_this2), "toCheckbox", function (props, control) {
576
+ var _context21;
577
+
578
+ var options = control.options || [];
579
+ return /*#__PURE__*/React.createElement(_Checkbox.Group, {
580
+ options: options,
581
+ onChange: _bindInstanceProperty(_context21 = _this2.onBlur).call(_context21, _assertThisInitialized(_this2), control.key),
582
+ value: _this2.props.value[control.key]
583
+ });
584
+ });
585
+
574
586
  _defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
575
587
  switch (props.type) {
576
588
  case 'readonly':
@@ -626,6 +638,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
626
638
  case 'cascader':
627
639
  return _this2.toCascader(props, control);
628
640
 
641
+ case 'checkbox':
642
+ return _this2.toCheckbox(props, control);
643
+
629
644
  default:
630
645
  return 'type error';
631
646
  }
@@ -634,18 +649,26 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
634
649
  _defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
635
650
  var title = _ref11.title,
636
651
  showAdd = _ref11.showAdd,
637
- key = _ref11.key;
652
+ key = _ref11.key,
653
+ showInfo = _ref11.showInfo,
654
+ showInfoTitle = _ref11.showInfoTitle;
638
655
 
639
656
  if (showAdd && type !== 'readonly') {
640
- var _context21;
657
+ var _context22;
641
658
 
642
- var onClick = _bindInstanceProperty(_context21 = _this2.onAdd).call(_context21, _assertThisInitialized(_this2), key, title);
659
+ var onClick = _bindInstanceProperty(_context22 = _this2.onAdd).call(_context22, _assertThisInitialized(_this2), key, title);
643
660
 
644
661
  return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
645
662
  role: "add",
646
663
  type: "plus-circle-o",
647
664
  onClick: onClick
648
665
  }));
666
+ } else if (showInfo) {
667
+ return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Tooltip, {
668
+ title: showInfoTitle
669
+ }, /*#__PURE__*/React.createElement(_Icon, {
670
+ type: "info-circle"
671
+ })));
649
672
  } else {
650
673
  return title;
651
674
  }
@@ -701,7 +724,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
701
724
  });
702
725
 
703
726
  _defineProperty(_assertThisInitialized(_this2), "toCols", function () {
704
- var _context22;
727
+ var _context23;
705
728
 
706
729
  var _this2$props4 = _this2.props,
707
730
  _this2$props4$colNum = _this2$props4.colNum,
@@ -713,7 +736,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
713
736
  }
714
737
 
715
738
  var span = 24 / colNum;
716
- return _mapInstanceProperty(_context22 = _this2.getControls()).call(_context22, function (control) {
739
+ return _mapInstanceProperty(_context23 = _this2.getControls()).call(_context23, function (control) {
717
740
  if (allFullFather) {
718
741
  control.allFullFather = allFullFather;
719
742
  }
@@ -26,13 +26,13 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
26
26
 
27
27
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
28
28
 
29
- function _unsupportedIterableToArray(o, minLen) { var _context13; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context13 = Object.prototype.toString.call(o)).call(_context13, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
+ function _unsupportedIterableToArray(o, minLen) { var _context16; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
30
30
 
31
31
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
32
32
 
33
33
  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; }
34
34
 
35
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context11 = ownKeys(Object(source), !0)).call(_context11, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context12 = ownKeys(Object(source))).call(_context12, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
35
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
36
36
 
37
37
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
38
38
  import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
@@ -50,18 +50,18 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
50
50
  import React from 'react';
51
51
  import PropTypes from 'prop-types';
52
52
  import ReactDOM from 'react-dom';
53
- import { getTitle } from '../Control';
53
+ import Control, { getTitle } from '../Control';
54
54
  import SuperTableCell from './SuperTableCell';
55
55
  import fixed from '../SuperTable/fixed';
56
56
  import SuperToolbar from '../SuperToolbar';
57
57
  import variables from '../variables';
58
- import helper from '../helper';
58
+ import helper, { getObjectExclude } from '../helper';
59
59
  var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
60
60
  'selectText', //存储title
61
61
  'search', 'searchText', 'selectSearch', //多选下拉搜索
62
62
  'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
63
- 'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
64
- ];
63
+ 'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
64
+ 'uploadImg'];
65
65
  /**
66
66
  * key:标识所在列,在一个表格中必须唯一
67
67
  * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
@@ -95,7 +95,8 @@ var ColType = {
95
95
  * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
96
96
  * onAdd:点击+号时触发,原型为function(keyName)
97
97
  * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
98
- * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
98
+ * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
99
+ * onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
99
100
  */
100
101
 
101
102
  var CallbackType = {
@@ -107,7 +108,11 @@ var CallbackType = {
107
108
  onLink: PropTypes.func,
108
109
  onAdd: PropTypes.func,
109
110
  onRenderCustom: PropTypes.func,
110
- onToolbar: PropTypes.func
111
+ onToolbar: PropTypes.func,
112
+ onDoubleClick: PropTypes.func,
113
+ onTableFileChange: PropTypes.func,
114
+ buildSuperUploadProps: PropTypes.func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
115
+
111
116
  };
112
117
  /**
113
118
  * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
@@ -199,6 +204,15 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
199
204
  };
200
205
  });
201
206
 
207
+ _defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
208
+ return function () {
209
+ var _ref8 = _this.props.callback || {},
210
+ onDoubleClick = _ref8.onDoubleClick;
211
+
212
+ onDoubleClick && onDoubleClick(key, value);
213
+ };
214
+ });
215
+
202
216
  _defineProperty(_assertThisInitialized(_this), "closeValid", function () {
203
217
  var _this$props = _this.props,
204
218
  valid = _this$props.valid,
@@ -338,8 +352,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
338
352
  var split = index2 === list.length - 1 ? '' : ',';
339
353
 
340
354
  var onClick = function onClick() {
341
- var _ref8 = _this.props.callback || {},
342
- onLink = _ref8.onLink;
355
+ var _ref9 = _this.props.callback || {},
356
+ onLink = _ref9.onLink;
343
357
 
344
358
  onLink && onLink(col.key, index, item2);
345
359
  };
@@ -353,8 +367,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
353
367
  var title = typeof col.link === 'string' ? col.link : value;
354
368
 
355
369
  var onClick = function onClick() {
356
- var _ref9 = _this.props.callback || {},
357
- onLink = _ref9.onLink;
370
+ var _ref10 = _this.props.callback || {},
371
+ onLink = _ref10.onLink;
358
372
 
359
373
  onLink && onLink(col.key, index, record);
360
374
  };
@@ -371,13 +385,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
371
385
 
372
386
  _defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
373
387
  return function (value, record, index) {
374
- var _context3, _context4, _context5, _context6;
388
+ var _context3, _context4, _context5, _context6, _context7;
375
389
 
376
390
  var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
377
391
 
378
392
  if (!realType) {
379
393
  return /*#__PURE__*/React.createElement("div", {
394
+ onDoubleClick: _this.onDoubleClick(col.key, record.key),
380
395
  style: {
396
+ minHeight: '20px',
397
+ minWidth: '100px',
381
398
  maxWidth: "".concat(col.width - 16, "px"),
382
399
  overflow: 'hidden',
383
400
  textOverflow: 'ellipsis'
@@ -421,12 +438,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
421
438
  }
422
439
 
423
440
  case 'switch':
424
- return value === 'noneDisplay' ? /*#__PURE__*/React.createElement("div", null) : /*#__PURE__*/React.createElement(_Switch, {
441
+ return typeof value === 'string' ? /*#__PURE__*/React.createElement("div", null, value) : /*#__PURE__*/React.createElement(_Switch, {
425
442
  checkedChildren: col.props.checkedChildren || '',
426
443
  unCheckedChildren: col.props.unCheckedChildren || '',
427
444
  onChange: _this.onSwitch(col.key, record.key),
428
445
  size: "default",
429
- checked: value || false,
446
+ checked: typeof value === 'number' ? Boolean(value) : value || false,
430
447
  disabled: !(record._isEdit === true)
431
448
  });
432
449
 
@@ -453,14 +470,41 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
453
470
  height: '80px'
454
471
  }
455
472
  }) : /*#__PURE__*/React.createElement("div", {
456
- role: 'imgBox'
473
+ role: 'imgBox',
474
+ style: {
475
+ maxWidth: '120px'
476
+ }
457
477
  }, /*#__PURE__*/React.createElement("img", {
458
478
  src: value.img,
459
479
  style: {
460
480
  width: '80px',
461
481
  height: '80px'
462
482
  }
463
- }), /*#__PURE__*/React.createElement("span", null, value.title)) : /*#__PURE__*/React.createElement("div", null);
483
+ }), /*#__PURE__*/React.createElement("div", {
484
+ style: {
485
+ display: 'inline-block'
486
+ }
487
+ }, /*#__PURE__*/React.createElement("span", {
488
+ style: {
489
+ display: 'block'
490
+ }
491
+ }, value.title), helper.isEmpty2(value.remark) ? null : /*#__PURE__*/React.createElement("span", {
492
+ style: {
493
+ color: '#333'
494
+ }
495
+ }, value.remark))) : /*#__PURE__*/React.createElement("div", null);
496
+
497
+ case 'uploadImg':
498
+ var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
499
+
500
+ var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
501
+ onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context7 = _this.props.callback.onTableFileChange).call(_context7, null, col.key, index) : undefined,
502
+ type: col.type
503
+ }, col.props), _this.props), commonProps), {}, {
504
+ value: _this.props.items[index][col.key]
505
+ });
506
+
507
+ return /*#__PURE__*/React.createElement(Control, uploadProps);
464
508
 
465
509
  default:
466
510
  return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
@@ -509,12 +553,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
509
553
  }
510
554
  });
511
555
 
512
- _defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref10) {
513
- var required = _ref10.required,
514
- title = _ref10.title,
515
- type = _ref10.type,
516
- key = _ref10.key,
517
- showAdd = _ref10.showAdd;
556
+ _defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref11) {
557
+ var required = _ref11.required,
558
+ title = _ref11.title,
559
+ type = _ref11.type,
560
+ key = _ref11.key,
561
+ showAdd = _ref11.showAdd;
518
562
 
519
563
  if (type === 'checkbox') {
520
564
  var status = _this.getCheckedStatus(key);
@@ -530,9 +574,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
530
574
  }
531
575
  });
532
576
 
533
- _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref11) {
534
- var type = _ref11.type,
535
- align = _ref11.align;
577
+ _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref12) {
578
+ var type = _ref12.type,
579
+ align = _ref12.align;
536
580
 
537
581
  if (type === 'index' || type === 'checkbox') {
538
582
  return 'ant-table-selection-column';
@@ -542,24 +586,26 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
542
586
  });
543
587
 
544
588
  _defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
545
- var _context7;
589
+ var _context8;
546
590
 
547
- return !_includesInstanceProperty(_context7 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar']).call(_context7, type);
591
+ return !_includesInstanceProperty(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
548
592
  });
549
593
 
550
594
  _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
551
- var _context8;
595
+ var _context9;
552
596
 
553
597
  var readonly = _this.props.readonly;
554
- return _mapInstanceProperty(_context8 = _filterInstanceProperty(cols).call(cols, function (col) {
598
+ return _mapInstanceProperty(_context9 = _filterInstanceProperty(cols).call(cols, function (col) {
555
599
  return !col.hide;
556
- })).call(_context8, function (_ref12, index) {
557
- var col = _extends({}, _ref12);
600
+ })).call(_context9, function (_ref13, index) {
601
+ var _context10;
602
+
603
+ var col = _extends({}, _ref13);
558
604
 
559
605
  col.className = _this.getColumnClassName(col);
560
606
  col.title = _this.getColumnTitle(col);
561
607
  col.dataIndex = col.key;
562
- col.width = col.width || 120; // const {props = {}} = col;
608
+ col.width = col.width || _includesInstanceProperty(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : 120; // const {props = {}} = col;
563
609
  // const {edit = false} = props
564
610
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
565
611
  // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
@@ -580,14 +626,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
580
626
 
581
627
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
582
628
  return _mapInstanceProperty(items).call(items, function (item, index) {
583
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref13) {
584
- var _context9;
629
+ return _reduceInstanceProperty(cols).call(cols, function (result, _ref14) {
630
+ var _context11;
585
631
 
586
- var key = _ref13.key,
587
- type = _ref13.type,
588
- options = _ref13.options;
632
+ var key = _ref14.key,
633
+ type = _ref14.type,
634
+ options = _ref14.options;
589
635
 
590
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context9 = item.isReadonly).call(_context9, key))) {
636
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context11 = item.isReadonly).call(_context11, key))) {
591
637
  result[key] = item[key];
592
638
  } else {
593
639
  result[key] = getTitle(item[key], options);
@@ -621,7 +667,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
621
667
  });
622
668
 
623
669
  _defineProperty(_assertThisInitialized(_this), "getProps", function () {
624
- var _context10;
670
+ var _context12;
625
671
 
626
672
  var _this$props3 = _this.props,
627
673
  cols = _this$props3.cols,
@@ -640,13 +686,17 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
640
686
  _this$props3$onExpand = _this$props3.onExpand,
641
687
  onExpand = _this$props3$onExpand === void 0 ? undefined : _this$props3$onExpand;
642
688
 
643
- var widthX = _reduceInstanceProperty(_context10 = _filterInstanceProperty(cols).call(cols, function (col) {
689
+ var widthX = _reduceInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
644
690
  return !col.hide;
645
- })).call(_context10, function (width, item) {
646
- return width += item.width ? item.width : 120;
691
+ })).call(_context12, function (width, item) {
692
+ var _context13;
693
+
694
+ return width += item.width ? item.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : 120;
647
695
  }, 0);
648
696
 
649
- var scrollProps = !helper.isEmpty2(expandedRowRender) ? {} : {
697
+ var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
698
+ expandedRowRender: expandedRowRender
699
+ } : {
650
700
  scroll: {
651
701
  x: widthX,
652
702
  y: maxHeight
@@ -666,7 +716,6 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
666
716
  emptyText: _this.props.emptyText
667
717
  } : null
668
718
  }, _this.getPropsByCheckbox()), {}, {
669
- expandedRowRender: expandedRowRender,
670
719
  onExpand: onExpand
671
720
  }, scrollProps);
672
721
  });
@@ -25,7 +25,7 @@ import PropTypes from 'prop-types';
25
25
  import helper from '../helper';
26
26
  import Title from '../Title';
27
27
  import variables from '../variables';
28
- var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF'];
28
+ var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
29
29
  var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
30
30
 
31
31
  var propTypes = {
@@ -38,7 +38,7 @@ var propTypes = {
38
38
  required: PropTypes.bool,
39
39
  //是否必须上传,默认false
40
40
  listType: PropTypes.oneOf[('text', 'picture', 'picture-card')],
41
- //上传列表的内建样式,支持三种,默认text
41
+ //上传列表的内建样式,支持三种,默认picture-card
42
42
  readonly: PropTypes.bool,
43
43
  //所在页面是否只读,默认false
44
44
  multiple: PropTypes.bool,
@@ -1,35 +1,35 @@
1
- @import '../variables';
2
-
3
- .@{cloudlink-prefix}-title {
4
- > *:first-child {
5
- display: inline-block;
6
- color: @brand-primary;
7
- line-height: 1.2;
8
-
9
- &[data-border='true'] {
10
- padding: 0 5px;
11
- border-left: @brand-primary solid 3px;
12
- }
13
-
14
- &[data-fold='true'] {
15
- cursor: pointer;
16
- margin: 8px 0;
17
- }
18
-
19
- &[data-required='true'] {
20
- &::after {
21
- display: inline-block;
22
- margin-left: 4px;
23
- color: #f5222d;
24
- font-size: 12px;
25
- font-family: SimSun, sans-serif;
26
- line-height: 1;
27
- content: '*';
28
- }
29
- }
30
- }
31
-
32
- > [role = 'toolbar'] {
33
- display: inline-block;
34
- }
35
- }
1
+ @import '../variables';
2
+
3
+ .@{cloudlink-prefix}-title {
4
+ > *:first-child {
5
+ display: inline-block;
6
+ color: @brand-primary;
7
+ line-height: 1.2;
8
+
9
+ &[data-border='true'] {
10
+ padding: 0 5px;
11
+ border-left: @brand-primary solid 3px;
12
+ }
13
+
14
+ &[data-fold='true'] {
15
+ cursor: pointer;
16
+ margin: 8px 0;
17
+ }
18
+
19
+ &[data-required='true'] {
20
+ &::after {
21
+ display: inline-block;
22
+ margin-left: 4px;
23
+ color: #f5222d;
24
+ font-size: 12px;
25
+ font-family: SimSun, sans-serif;
26
+ line-height: 1;
27
+ content: '*';
28
+ }
29
+ }
30
+ }
31
+
32
+ > [role = 'toolbar'] {
33
+ display: inline-block;
34
+ }
35
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "name": "Title",
3
- "version": "0.0.0",
4
- "private": true,
5
- "main": "./Title.js"
6
- }
1
+ {
2
+ "name": "Title",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Title.js"
6
+ }
@@ -110,12 +110,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
110
110
 
111
111
  case 3:
112
112
  if (!_context.sent) {
113
- _context.next = 8;
113
+ _context.next = 7;
114
114
  break;
115
115
  }
116
116
 
117
- debugger;
118
-
119
117
  _this.setState({
120
118
  time: _this.props.time || 60
121
119
  });
@@ -131,10 +129,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
131
129
  }
132
130
  }, 1000);
133
131
 
134
- case 8:
132
+ case 7:
135
133
  ;
136
134
 
137
- case 9:
135
+ case 8:
138
136
  case "end":
139
137
  return _context.stop();
140
138
  }
@@ -50,10 +50,12 @@ var _col = _interopRequireDefault(require("antd/lib/col"));
50
50
 
51
51
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
52
52
 
53
- var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
53
+ var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
54
54
 
55
55
  var _icon = _interopRequireDefault(require("antd/lib/icon"));
56
56
 
57
+ var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
58
+
57
59
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
58
60
 
59
61
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
@@ -90,7 +92,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
90
92
 
91
93
  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
94
 
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; }
95
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context24, _context25; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context24 = ownKeys(Object(source), !0)).call(_context24, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context25 = ownKeys(Object(source))).call(_context25, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
94
96
 
95
97
  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
98
 
@@ -99,7 +101,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
99
101
  var FormItem = _form["default"].Item;
100
102
  var defaultSize = 'large';
101
103
  var defaultColNum = 4;
102
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader'];
104
+ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox'];
103
105
  /**
104
106
  * key:[必须],用于唯一标识该Form下的一个表单元素
105
107
  * title:[必须],表单元素的标签
@@ -585,6 +587,16 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
585
587
  props.loadData = _this2.createSearchEvent(control);
586
588
  return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
587
589
  });
590
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCheckbox", function (props, control) {
591
+ var _context21;
592
+
593
+ var options = control.options || [];
594
+ return /*#__PURE__*/_react["default"].createElement(_checkbox["default"].Group, {
595
+ options: options,
596
+ onChange: (0, _bind["default"])(_context21 = _this2.onBlur).call(_context21, (0, _assertThisInitialized2["default"])(_this2), control.key),
597
+ value: _this2.props.value[control.key]
598
+ });
599
+ });
588
600
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toControl", function (props, control) {
589
601
  switch (props.type) {
590
602
  case 'readonly':
@@ -640,6 +652,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
640
652
  case 'cascader':
641
653
  return _this2.toCascader(props, control);
642
654
 
655
+ case 'checkbox':
656
+ return _this2.toCheckbox(props, control);
657
+
643
658
  default:
644
659
  return 'type error';
645
660
  }
@@ -647,17 +662,25 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
647
662
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (_ref11, type) {
648
663
  var title = _ref11.title,
649
664
  showAdd = _ref11.showAdd,
650
- key = _ref11.key;
665
+ key = _ref11.key,
666
+ showInfo = _ref11.showInfo,
667
+ showInfoTitle = _ref11.showInfoTitle;
651
668
 
652
669
  if (showAdd && type !== 'readonly') {
653
- var _context21;
670
+ var _context22;
654
671
 
655
- var onClick = (0, _bind["default"])(_context21 = _this2.onAdd).call(_context21, (0, _assertThisInitialized2["default"])(_this2), key, title);
672
+ var onClick = (0, _bind["default"])(_context22 = _this2.onAdd).call(_context22, (0, _assertThisInitialized2["default"])(_this2), key, title);
656
673
  return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
657
674
  role: "add",
658
675
  type: "plus-circle-o",
659
676
  onClick: onClick
660
677
  }));
678
+ } else if (showInfo) {
679
+ return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
680
+ title: showInfoTitle
681
+ }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
682
+ type: "info-circle"
683
+ })));
661
684
  } else {
662
685
  return title;
663
686
  }
@@ -711,7 +734,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
711
734
  });
712
735
  });
713
736
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCols", function () {
714
- var _context22;
737
+ var _context23;
715
738
 
716
739
  var _this2$props4 = _this2.props,
717
740
  _this2$props4$colNum = _this2$props4.colNum,
@@ -723,7 +746,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
723
746
  }
724
747
 
725
748
  var span = 24 / colNum;
726
- return (0, _map["default"])(_context22 = _this2.getControls()).call(_context22, function (control) {
749
+ return (0, _map["default"])(_context23 = _this2.getControls()).call(_context23, function (control) {
727
750
  if (allFullFather) {
728
751
  control.allFullFather = allFullFather;
729
752
  }
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
+
3
5
  var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
6
 
5
7
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
@@ -28,6 +30,8 @@ var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-me
28
30
 
29
31
  var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
30
32
 
33
+ var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
34
+
31
35
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
32
36
 
33
37
  _Object$defineProperty(exports, "__esModule", {
@@ -84,7 +88,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
84
88
 
85
89
  var _reactDom = _interopRequireDefault(require("react-dom"));
86
90
 
87
- var _Control = require("../Control");
91
+ var _Control = _interopRequireWildcard(require("../Control"));
88
92
 
89
93
  var _SuperTableCell = _interopRequireDefault(require("./SuperTableCell"));
90
94
 
@@ -94,17 +98,21 @@ var _SuperToolbar = _interopRequireDefault(require("../SuperToolbar"));
94
98
 
95
99
  var _variables = _interopRequireDefault(require("../variables"));
96
100
 
97
- var _helper = _interopRequireDefault(require("../helper"));
101
+ var _helper = _interopRequireWildcard(require("../helper"));
102
+
103
+ 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); }
104
+
105
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
98
106
 
99
107
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
100
108
 
101
- function _unsupportedIterableToArray(o, minLen) { var _context13; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context13 = Object.prototype.toString.call(o)).call(_context13, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
109
+ function _unsupportedIterableToArray(o, minLen) { var _context16; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
102
110
 
103
111
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
104
112
 
105
113
  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; }
106
114
 
107
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context11 = ownKeys(Object(source), !0)).call(_context11, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context12 = ownKeys(Object(source))).call(_context12, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
115
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
108
116
 
109
117
  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); }; }
110
118
 
@@ -114,8 +122,8 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //
114
122
  'selectText', //存储title
115
123
  'search', 'searchText', 'selectSearch', //多选下拉搜索
116
124
  'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
117
- 'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
118
- ];
125
+ 'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
126
+ 'uploadImg'];
119
127
  /**
120
128
  * key:标识所在列,在一个表格中必须唯一
121
129
  * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
@@ -149,7 +157,8 @@ var ColType = {
149
157
  * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
150
158
  * onAdd:点击+号时触发,原型为function(keyName)
151
159
  * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
152
- * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
160
+ * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
161
+ * onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
153
162
  */
154
163
 
155
164
  var CallbackType = {
@@ -161,7 +170,11 @@ var CallbackType = {
161
170
  onLink: _propTypes["default"].func,
162
171
  onAdd: _propTypes["default"].func,
163
172
  onRenderCustom: _propTypes["default"].func,
164
- onToolbar: _propTypes["default"].func
173
+ onToolbar: _propTypes["default"].func,
174
+ onDoubleClick: _propTypes["default"].func,
175
+ onTableFileChange: _propTypes["default"].func,
176
+ buildSuperUploadProps: _propTypes["default"].func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
177
+
165
178
  };
166
179
  /**
167
180
  * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
@@ -245,6 +258,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
245
258
  onBlur && onBlur(_this.getIndex(rowIndex), key, value);
246
259
  };
247
260
  });
261
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (key, value) {
262
+ return function () {
263
+ var _ref8 = _this.props.callback || {},
264
+ onDoubleClick = _ref8.onDoubleClick;
265
+
266
+ onDoubleClick && onDoubleClick(key, value);
267
+ };
268
+ });
248
269
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
249
270
  var _this$props = _this.props,
250
271
  valid = _this$props.valid,
@@ -380,8 +401,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
380
401
  var split = index2 === list.length - 1 ? '' : ',';
381
402
 
382
403
  var onClick = function onClick() {
383
- var _ref8 = _this.props.callback || {},
384
- onLink = _ref8.onLink;
404
+ var _ref9 = _this.props.callback || {},
405
+ onLink = _ref9.onLink;
385
406
 
386
407
  onLink && onLink(col.key, index, item2);
387
408
  };
@@ -395,8 +416,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
395
416
  var title = typeof col.link === 'string' ? col.link : value;
396
417
 
397
418
  var onClick = function onClick() {
398
- var _ref9 = _this.props.callback || {},
399
- onLink = _ref9.onLink;
419
+ var _ref10 = _this.props.callback || {},
420
+ onLink = _ref10.onLink;
400
421
 
401
422
  onLink && onLink(col.key, index, record);
402
423
  };
@@ -411,13 +432,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
411
432
  });
412
433
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
413
434
  return function (value, record, index) {
414
- var _context3, _context4, _context5, _context6;
435
+ var _context3, _context4, _context5, _context6, _context7;
415
436
 
416
437
  var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
417
438
 
418
439
  if (!realType) {
419
440
  return /*#__PURE__*/_react["default"].createElement("div", {
441
+ onDoubleClick: _this.onDoubleClick(col.key, record.key),
420
442
  style: {
443
+ minHeight: '20px',
444
+ minWidth: '100px',
421
445
  maxWidth: "".concat(col.width - 16, "px"),
422
446
  overflow: 'hidden',
423
447
  textOverflow: 'ellipsis'
@@ -461,12 +485,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
461
485
  }
462
486
 
463
487
  case 'switch':
464
- return value === 'noneDisplay' ? /*#__PURE__*/_react["default"].createElement("div", null) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
488
+ return typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("div", null, value) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
465
489
  checkedChildren: col.props.checkedChildren || '',
466
490
  unCheckedChildren: col.props.unCheckedChildren || '',
467
491
  onChange: _this.onSwitch(col.key, record.key),
468
492
  size: "default",
469
- checked: value || false,
493
+ checked: typeof value === 'number' ? Boolean(value) : value || false,
470
494
  disabled: !(record._isEdit === true)
471
495
  });
472
496
 
@@ -493,14 +517,41 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
493
517
  height: '80px'
494
518
  }
495
519
  }) : /*#__PURE__*/_react["default"].createElement("div", {
496
- role: 'imgBox'
520
+ role: 'imgBox',
521
+ style: {
522
+ maxWidth: '120px'
523
+ }
497
524
  }, /*#__PURE__*/_react["default"].createElement("img", {
498
525
  src: value.img,
499
526
  style: {
500
527
  width: '80px',
501
528
  height: '80px'
502
529
  }
503
- }), /*#__PURE__*/_react["default"].createElement("span", null, value.title)) : /*#__PURE__*/_react["default"].createElement("div", null);
530
+ }), /*#__PURE__*/_react["default"].createElement("div", {
531
+ style: {
532
+ display: 'inline-block'
533
+ }
534
+ }, /*#__PURE__*/_react["default"].createElement("span", {
535
+ style: {
536
+ display: 'block'
537
+ }
538
+ }, value.title), _helper["default"].isEmpty2(value.remark) ? null : /*#__PURE__*/_react["default"].createElement("span", {
539
+ style: {
540
+ color: '#333'
541
+ }
542
+ }, value.remark))) : /*#__PURE__*/_react["default"].createElement("div", null);
543
+
544
+ case 'uploadImg':
545
+ var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
546
+
547
+ var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
548
+ onFileChange: _this.props.callback.onTableFileChange ? (0, _bind["default"])(_context7 = _this.props.callback.onTableFileChange).call(_context7, null, col.key, index) : undefined,
549
+ type: col.type
550
+ }, col.props), _this.props), commonProps), {}, {
551
+ value: _this.props.items[index][col.key]
552
+ });
553
+
554
+ return /*#__PURE__*/_react["default"].createElement(_Control["default"], uploadProps);
504
555
 
505
556
  default:
506
557
  return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
@@ -546,12 +597,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
546
597
  return null;
547
598
  }
548
599
  });
549
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref10) {
550
- var required = _ref10.required,
551
- title = _ref10.title,
552
- type = _ref10.type,
553
- key = _ref10.key,
554
- showAdd = _ref10.showAdd;
600
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref11) {
601
+ var required = _ref11.required,
602
+ title = _ref11.title,
603
+ type = _ref11.type,
604
+ key = _ref11.key,
605
+ showAdd = _ref11.showAdd;
555
606
 
556
607
  if (type === 'checkbox') {
557
608
  var status = _this.getCheckedStatus(key);
@@ -566,9 +617,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
566
617
  }, title, _this.toAdd(key, showAdd));
567
618
  }
568
619
  });
569
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref11) {
570
- var type = _ref11.type,
571
- align = _ref11.align;
620
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref12) {
621
+ var type = _ref12.type,
622
+ align = _ref12.align;
572
623
 
573
624
  if (type === 'index' || type === 'checkbox') {
574
625
  return 'ant-table-selection-column';
@@ -577,22 +628,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
577
628
  }
578
629
  });
579
630
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
580
- var _context7;
631
+ var _context8;
581
632
 
582
- return !(0, _includes["default"])(_context7 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar']).call(_context7, type);
633
+ return !(0, _includes["default"])(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
583
634
  });
584
635
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
585
- var _context8;
636
+ var _context9;
586
637
 
587
638
  var readonly = _this.props.readonly;
588
- return (0, _map["default"])(_context8 = (0, _filter["default"])(cols).call(cols, function (col) {
639
+ return (0, _map["default"])(_context9 = (0, _filter["default"])(cols).call(cols, function (col) {
589
640
  return !col.hide;
590
- })).call(_context8, function (_ref12, index) {
591
- var col = (0, _extends2["default"])({}, _ref12);
641
+ })).call(_context9, function (_ref13, index) {
642
+ var _context10;
643
+
644
+ var col = (0, _extends2["default"])({}, _ref13);
592
645
  col.className = _this.getColumnClassName(col);
593
646
  col.title = _this.getColumnTitle(col);
594
647
  col.dataIndex = col.key;
595
- col.width = col.width || 120; // const {props = {}} = col;
648
+ col.width = col.width || (0, _includes["default"])(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : 120; // const {props = {}} = col;
596
649
  // const {edit = false} = props
597
650
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
598
651
  // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
@@ -612,14 +665,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
612
665
  });
613
666
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
614
667
  return (0, _map["default"])(items).call(items, function (item, index) {
615
- return (0, _reduce["default"])(cols).call(cols, function (result, _ref13) {
616
- var _context9;
668
+ return (0, _reduce["default"])(cols).call(cols, function (result, _ref14) {
669
+ var _context11;
617
670
 
618
- var key = _ref13.key,
619
- type = _ref13.type,
620
- options = _ref13.options;
671
+ var key = _ref14.key,
672
+ type = _ref14.type,
673
+ options = _ref14.options;
621
674
 
622
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context9 = item.isReadonly).call(_context9, key))) {
675
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context11 = item.isReadonly).call(_context11, key))) {
623
676
  result[key] = item[key];
624
677
  } else {
625
678
  result[key] = (0, _Control.getTitle)(item[key], options);
@@ -651,7 +704,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
651
704
  };
652
705
  });
653
706
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
654
- var _context10;
707
+ var _context12;
655
708
 
656
709
  var _this$props3 = _this.props,
657
710
  cols = _this$props3.cols,
@@ -669,12 +722,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
669
722
  expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
670
723
  _this$props3$onExpand = _this$props3.onExpand,
671
724
  onExpand = _this$props3$onExpand === void 0 ? undefined : _this$props3$onExpand;
672
- var widthX = (0, _reduce["default"])(_context10 = (0, _filter["default"])(cols).call(cols, function (col) {
725
+ var widthX = (0, _reduce["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
673
726
  return !col.hide;
674
- })).call(_context10, function (width, item) {
675
- return width += item.width ? item.width : 120;
727
+ })).call(_context12, function (width, item) {
728
+ var _context13;
729
+
730
+ return width += item.width ? item.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : 120;
676
731
  }, 0);
677
- var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {} : {
732
+ var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
733
+ expandedRowRender: expandedRowRender
734
+ } : {
678
735
  scroll: {
679
736
  x: widthX,
680
737
  y: maxHeight
@@ -694,7 +751,6 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
694
751
  emptyText: _this.props.emptyText
695
752
  } : null
696
753
  }, _this.getPropsByCheckbox()), {}, {
697
- expandedRowRender: expandedRowRender,
698
754
  onExpand: onExpand
699
755
  }, scrollProps);
700
756
  });
@@ -66,7 +66,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
66
66
 
67
67
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
68
68
 
69
- var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF'];
69
+ var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
70
70
  var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
71
71
 
72
72
  var propTypes = {
@@ -79,7 +79,7 @@ var propTypes = {
79
79
  required: _propTypes["default"].bool,
80
80
  //是否必须上传,默认false
81
81
  listType: _propTypes["default"].oneOf[('text', 'picture', 'picture-card')],
82
- //上传列表的内建样式,支持三种,默认text
82
+ //上传列表的内建样式,支持三种,默认picture-card
83
83
  readonly: _propTypes["default"].bool,
84
84
  //所在页面是否只读,默认false
85
85
  multiple: _propTypes["default"].bool,
@@ -1,35 +1,35 @@
1
- @import '../variables';
2
-
3
- .@{cloudlink-prefix}-title {
4
- > *:first-child {
5
- display: inline-block;
6
- color: @brand-primary;
7
- line-height: 1.2;
8
-
9
- &[data-border='true'] {
10
- padding: 0 5px;
11
- border-left: @brand-primary solid 3px;
12
- }
13
-
14
- &[data-fold='true'] {
15
- cursor: pointer;
16
- margin: 8px 0;
17
- }
18
-
19
- &[data-required='true'] {
20
- &::after {
21
- display: inline-block;
22
- margin-left: 4px;
23
- color: #f5222d;
24
- font-size: 12px;
25
- font-family: SimSun, sans-serif;
26
- line-height: 1;
27
- content: '*';
28
- }
29
- }
30
- }
31
-
32
- > [role = 'toolbar'] {
33
- display: inline-block;
34
- }
35
- }
1
+ @import '../variables';
2
+
3
+ .@{cloudlink-prefix}-title {
4
+ > *:first-child {
5
+ display: inline-block;
6
+ color: @brand-primary;
7
+ line-height: 1.2;
8
+
9
+ &[data-border='true'] {
10
+ padding: 0 5px;
11
+ border-left: @brand-primary solid 3px;
12
+ }
13
+
14
+ &[data-fold='true'] {
15
+ cursor: pointer;
16
+ margin: 8px 0;
17
+ }
18
+
19
+ &[data-required='true'] {
20
+ &::after {
21
+ display: inline-block;
22
+ margin-left: 4px;
23
+ color: #f5222d;
24
+ font-size: 12px;
25
+ font-family: SimSun, sans-serif;
26
+ line-height: 1;
27
+ content: '*';
28
+ }
29
+ }
30
+ }
31
+
32
+ > [role = 'toolbar'] {
33
+ display: inline-block;
34
+ }
35
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "name": "Title",
3
- "version": "0.0.0",
4
- "private": true,
5
- "main": "./Title.js"
6
- }
1
+ {
2
+ "name": "Title",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Title.js"
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud-b2b",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "A react component library dependent antd",
5
5
  "keywords": [
6
6
  "react",