cloud-b2b 1.1.7 → 1.1.10

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.
@@ -11,6 +11,7 @@ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
11
11
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
12
12
  import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
13
13
  import _Table from "antd/es/table";
14
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
14
15
  import _extends from "@babel/runtime-corejs3/helpers/extends";
15
16
  import _Switch from "antd/es/switch";
16
17
  import _Button from "antd/es/button";
@@ -23,16 +24,17 @@ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
23
24
  import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
24
25
  import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
25
26
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
27
+ var _excluded = ["onRowClick"];
26
28
 
27
29
  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
30
 
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); }
31
+ 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
32
 
31
33
  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
34
 
33
35
  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
36
 
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; }
37
+ 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
38
 
37
39
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
38
40
  import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
@@ -41,6 +43,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
41
43
  import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
42
44
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
43
45
  import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
46
+ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
44
47
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
45
48
 
46
49
  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); }; }
@@ -50,18 +53,19 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
50
53
  import React from 'react';
51
54
  import PropTypes from 'prop-types';
52
55
  import ReactDOM from 'react-dom';
53
- import { getTitle } from '../Control';
56
+ import Control, { getTitle } from '../Control';
54
57
  import SuperTableCell from './SuperTableCell';
55
58
  import fixed from '../SuperTable/fixed';
56
59
  import SuperToolbar from '../SuperToolbar';
57
60
  import variables from '../variables';
58
- import helper from '../helper';
61
+ import helper, { getObjectExclude } from '../helper';
62
+ import DragSortRow from "../SuperTable/DragSortRow";
59
63
  var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
60
64
  'selectText', //存储title
61
65
  'search', 'searchText', 'selectSearch', //多选下拉搜索
62
66
  'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
63
- 'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
64
- ];
67
+ 'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
68
+ 'uploadImg'];
65
69
  /**
66
70
  * key:标识所在列,在一个表格中必须唯一
67
71
  * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
@@ -90,22 +94,32 @@ var ColType = {
90
94
  /**
91
95
  * onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
92
96
  * onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
93
- * onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value)
97
+ * onBlur: 输入框失去焦点时触发,原型为function(rowIndex, keyName, value)
98
+ * onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value, col)
94
99
  * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
95
100
  * onAdd:点击+号时触发,原型为function(keyName)
96
101
  * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
97
- * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
102
+ * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
103
+ * onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
98
104
  */
99
105
 
100
106
  var CallbackType = {
101
107
  onExitValid: PropTypes.func,
102
108
  onCheck: PropTypes.func,
103
109
  onContentChange: PropTypes.func,
110
+ onBlur: PropTypes.func,
104
111
  onSearch: PropTypes.func,
105
112
  onLink: PropTypes.func,
106
113
  onAdd: PropTypes.func,
107
114
  onRenderCustom: PropTypes.func,
108
- onToolbar: PropTypes.func
115
+ onToolbar: PropTypes.func,
116
+ onDoubleClick: PropTypes.func,
117
+ onTableFileChange: PropTypes.func,
118
+ buildSuperUploadProps: PropTypes.func,
119
+ //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
120
+ onImgTileClick: PropTypes.func,
121
+ //点击img类型标题触发事件
122
+ onMoveRow: PropTypes.func
109
123
  };
110
124
  /**
111
125
  * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
@@ -186,8 +200,40 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
186
200
  };
187
201
  });
188
202
 
189
- _defineProperty(_assertThisInitialized(_this), "onBlur", function () {
190
- _this.closeValid();
203
+ _defineProperty(_assertThisInitialized(_this), "onBlur", function (key, rowIndex) {
204
+ return function (value) {
205
+ var _ref7 = _this.props.callback || {},
206
+ onBlur = _ref7.onBlur;
207
+
208
+ _this.closeValid();
209
+
210
+ onBlur && onBlur(_this.getIndex(rowIndex), key, value);
211
+ };
212
+ });
213
+
214
+ _defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
215
+ return function () {
216
+ var _ref8 = _this.props.callback || {},
217
+ onDoubleClick = _ref8.onDoubleClick;
218
+
219
+ onDoubleClick && onDoubleClick(key, value);
220
+ };
221
+ });
222
+
223
+ _defineProperty(_assertThisInitialized(_this), "onImgTileClick", function (col, value, rowIndex) {
224
+ return function () {
225
+ var _ref9 = _this.props.callback || {},
226
+ onImgTileClick = _ref9.onImgTileClick;
227
+
228
+ onImgTileClick && onImgTileClick(col, value, rowIndex);
229
+ };
230
+ });
231
+
232
+ _defineProperty(_assertThisInitialized(_this), "onMoveRow", function (dragIndex, targetIndex) {
233
+ var _ref10 = _this.props.callback || {},
234
+ onMoveRow = _ref10.onMoveRow;
235
+
236
+ onMoveRow && onMoveRow(dragIndex, targetIndex);
191
237
  });
192
238
 
193
239
  _defineProperty(_assertThisInitialized(_this), "closeValid", function () {
@@ -249,7 +295,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
249
295
  options: _this.getOptions(key, options, index),
250
296
  onChange: _this.onChange(key, index),
251
297
  onSearch: _this.onSearch(key, index, config),
252
- onBlur: _this.onBlur
298
+ onBlur: _this.onBlur(key, index)
253
299
  };
254
300
 
255
301
  if (showRowAdd && _Array$isArray(isRequired) && _includesInstanceProperty(isRequired).call(isRequired, key)) {
@@ -329,8 +375,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
329
375
  var split = index2 === list.length - 1 ? '' : ',';
330
376
 
331
377
  var onClick = function onClick() {
332
- var _ref7 = _this.props.callback || {},
333
- onLink = _ref7.onLink;
378
+ var _ref11 = _this.props.callback || {},
379
+ onLink = _ref11.onLink;
334
380
 
335
381
  onLink && onLink(col.key, index, item2);
336
382
  };
@@ -344,8 +390,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
344
390
  var title = typeof col.link === 'string' ? col.link : value;
345
391
 
346
392
  var onClick = function onClick() {
347
- var _ref8 = _this.props.callback || {},
348
- onLink = _ref8.onLink;
393
+ var _ref12 = _this.props.callback || {},
394
+ onLink = _ref12.onLink;
349
395
 
350
396
  onLink && onLink(col.key, index, record);
351
397
  };
@@ -362,13 +408,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
362
408
 
363
409
  _defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
364
410
  return function (value, record, index) {
365
- var _context3, _context4, _context5, _context6;
411
+ var _context3, _context4, _context5, _context6, _context7;
366
412
 
367
413
  var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
368
414
 
369
415
  if (!realType) {
370
416
  return /*#__PURE__*/React.createElement("div", {
417
+ onDoubleClick: _this.onDoubleClick(col.key, record.key),
371
418
  style: {
419
+ minHeight: '20px',
420
+ minWidth: '100px',
372
421
  maxWidth: "".concat(col.width - 16, "px"),
373
422
  overflow: 'hidden',
374
423
  textOverflow: 'ellipsis'
@@ -412,12 +461,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
412
461
  }
413
462
 
414
463
  case 'switch':
415
- return value === 'noneDisplay' ? /*#__PURE__*/React.createElement("div", null) : /*#__PURE__*/React.createElement(_Switch, {
464
+ return typeof value === 'string' ? /*#__PURE__*/React.createElement("div", null, value) : /*#__PURE__*/React.createElement(_Switch, {
416
465
  checkedChildren: col.props.checkedChildren || '',
417
466
  unCheckedChildren: col.props.unCheckedChildren || '',
418
467
  onChange: _this.onSwitch(col.key, record.key),
419
468
  size: "default",
420
- checked: value || false,
469
+ checked: typeof value === 'number' ? Boolean(value) : value || false,
421
470
  disabled: !(record._isEdit === true)
422
471
  });
423
472
 
@@ -444,14 +493,46 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
444
493
  height: '80px'
445
494
  }
446
495
  }) : /*#__PURE__*/React.createElement("div", {
447
- role: 'imgBox'
496
+ role: 'imgBox',
497
+ style: {
498
+ maxWidth: "".concat(col.width, "px")
499
+ }
448
500
  }, /*#__PURE__*/React.createElement("img", {
449
501
  src: value.img,
450
502
  style: {
451
503
  width: '80px',
452
504
  height: '80px'
453
505
  }
454
- }), /*#__PURE__*/React.createElement("span", null, value.title)) : /*#__PURE__*/React.createElement("div", null);
506
+ }), /*#__PURE__*/React.createElement("div", {
507
+ style: {
508
+ display: 'inline-block'
509
+ }
510
+ }, /*#__PURE__*/React.createElement("span", {
511
+ style: {
512
+ display: 'block',
513
+ whiteSpace: 'nowrap',
514
+ overflow: 'hidden',
515
+ textOverflow: 'ellipsis',
516
+ width: '80px'
517
+ },
518
+ onClick: _this.onImgTileClick(col, record, index)
519
+ }, value.title), helper.isEmpty2(value.remark) ? null : /*#__PURE__*/React.createElement("span", {
520
+ style: {
521
+ color: '#333'
522
+ }
523
+ }, value.remark))) : /*#__PURE__*/React.createElement("div", null);
524
+
525
+ case 'uploadImg':
526
+ var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
527
+
528
+ var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
529
+ onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context7 = _this.props.callback.onTableFileChange).call(_context7, null, col.key, index) : undefined,
530
+ type: col.type
531
+ }, col.props), _this.props), commonProps), {}, {
532
+ value: _this.props.items[index][col.key]
533
+ });
534
+
535
+ return /*#__PURE__*/React.createElement(Control, uploadProps);
455
536
 
456
537
  default:
457
538
  return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
@@ -500,12 +581,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
500
581
  }
501
582
  });
502
583
 
503
- _defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref9) {
504
- var required = _ref9.required,
505
- title = _ref9.title,
506
- type = _ref9.type,
507
- key = _ref9.key,
508
- showAdd = _ref9.showAdd;
584
+ _defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref13) {
585
+ var required = _ref13.required,
586
+ title = _ref13.title,
587
+ type = _ref13.type,
588
+ key = _ref13.key,
589
+ showAdd = _ref13.showAdd;
509
590
 
510
591
  if (type === 'checkbox') {
511
592
  var status = _this.getCheckedStatus(key);
@@ -521,9 +602,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
521
602
  }
522
603
  });
523
604
 
524
- _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref10) {
525
- var type = _ref10.type,
526
- align = _ref10.align;
605
+ _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref14) {
606
+ var type = _ref14.type,
607
+ align = _ref14.align;
527
608
 
528
609
  if (type === 'index' || type === 'checkbox') {
529
610
  return 'ant-table-selection-column';
@@ -533,24 +614,26 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
533
614
  });
534
615
 
535
616
  _defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
536
- var _context7;
617
+ var _context8;
537
618
 
538
- return !_includesInstanceProperty(_context7 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar']).call(_context7, type);
619
+ return !_includesInstanceProperty(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
539
620
  });
540
621
 
541
622
  _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
542
- var _context8;
623
+ var _context9;
543
624
 
544
625
  var readonly = _this.props.readonly;
545
- return _mapInstanceProperty(_context8 = _filterInstanceProperty(cols).call(cols, function (col) {
626
+ return _mapInstanceProperty(_context9 = _filterInstanceProperty(cols).call(cols, function (col) {
546
627
  return !col.hide;
547
- })).call(_context8, function (_ref11, index) {
548
- var col = _extends({}, _ref11);
628
+ })).call(_context9, function (_ref15, index) {
629
+ var _context10;
630
+
631
+ var col = _extends({}, _ref15);
549
632
 
550
633
  col.className = _this.getColumnClassName(col);
551
634
  col.title = _this.getColumnTitle(col);
552
635
  col.dataIndex = col.key;
553
- col.width = col.width || 120; // const {props = {}} = col;
636
+ col.width = col.width ? col.width : _includesInstanceProperty(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} = col;
554
637
  // const {edit = false} = props
555
638
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
556
639
  // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
@@ -571,14 +654,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
571
654
 
572
655
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
573
656
  return _mapInstanceProperty(items).call(items, function (item, index) {
574
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref12) {
575
- var _context9;
657
+ return _reduceInstanceProperty(cols).call(cols, function (result, _ref16) {
658
+ var _context11;
576
659
 
577
- var key = _ref12.key,
578
- type = _ref12.type,
579
- options = _ref12.options;
660
+ var key = _ref16.key,
661
+ type = _ref16.type,
662
+ options = _ref16.options;
580
663
 
581
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context9 = item.isReadonly).call(_context9, key))) {
664
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context11 = item.isReadonly).call(_context11, key))) {
582
665
  result[key] = item[key];
583
666
  } else {
584
667
  result[key] = getTitle(item[key], options);
@@ -611,38 +694,172 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
611
694
  };
612
695
  });
613
696
 
614
- _defineProperty(_assertThisInitialized(_this), "getProps", function () {
615
- var _context10;
697
+ _defineProperty(_assertThisInitialized(_this), "getSelectedRowKeys", function (items) {
698
+ return _reduceInstanceProperty(items).call(items, function (result, item, index) {
699
+ item.checked && result.push(index);
700
+ return result;
701
+ }, []);
702
+ });
616
703
 
704
+ _defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox2", function (items) {
617
705
  var _this$props3 = _this.props,
618
- cols = _this$props3.cols,
619
- items = _this$props3.items,
620
- _this$props3$style = _this$props3.style,
621
- style = _this$props3$style === void 0 ? {} : _this$props3$style,
622
- _this$props3$footer = _this$props3.footer,
623
- footer = _this$props3$footer === void 0 ? null : _this$props3$footer,
624
- _this$props3$paginati = _this$props3.pagination,
625
- pagination = _this$props3$paginati === void 0 ? false : _this$props3$paginati,
706
+ _this$props3$checkbox = _this$props3.checkbox,
707
+ checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
708
+ _this$props3$radio = _this$props3.radio,
709
+ radio = _this$props3$radio === void 0 ? false : _this$props3$radio,
710
+ isolation = _this$props3.isolation,
711
+ _this$props3$checkedR = _this$props3.checkedRows,
712
+ checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR,
626
713
  _this$props3$isEmphas = _this$props3.isEmphasized,
627
714
  isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
628
- maxHeight = _this$props3.maxHeight,
629
- _this$props3$expanded = _this$props3.expandedRowRender,
630
- expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
631
- _this$props3$onExpand = _this$props3.onExpand,
632
- onExpand = _this$props3$onExpand === void 0 ? undefined : _this$props3$onExpand;
715
+ _this$props3$isWeaken = _this$props3.isWeaken,
716
+ isWeaken = _this$props3$isWeaken === void 0 ? true : _this$props3$isWeaken;
717
+
718
+ var rowClassName1 = function rowClassName1(record) {
719
+ if (items[record.key].__total) return variables('SuperTable').totalRow;
720
+ if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
721
+ return _includesInstanceProperty(checkedRows).call(checkedRows, record.key) ? variables('SuperTable').select : '';
722
+ };
633
723
 
634
- var widthX = _reduceInstanceProperty(_context10 = _filterInstanceProperty(cols).call(cols, function (col) {
724
+ var rowClassName2 = function rowClassName2(record) {
725
+ if (items[record.key].__total) return variables('SuperTable').totalRow;
726
+ if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
727
+
728
+ if (isEmphasized && items[record.key].__isEmphasized) {
729
+ return items[record.key].checked ? variables('SuperTable').emphasizedSelectRow : variables('SuperTable').emphasizedUnselectRow;
730
+ }
731
+
732
+ if (isWeaken && items[record.key].__isWeaken) {
733
+ return items[record.key].checked ? variables('SuperTable').weakenedSelectRow : variables('SuperTable').weakenedUnselectRow;
734
+ }
735
+
736
+ return items[record.key].checked ? variables('SuperTable').select : '';
737
+ };
738
+
739
+ if (checkbox) {
740
+ if (radio) {
741
+ return {
742
+ rowClassName: rowClassName1,
743
+ onRowClick: _this.onRadioRowClick,
744
+ rowSelection: {
745
+ type: 'radio',
746
+ selectedRowKeys: checkedRows,
747
+ onChange: _this.onRadioChange
748
+ }
749
+ };
750
+ } else if (isolation) {
751
+ return {
752
+ rowClassName: rowClassName1,
753
+ onRowClick: _this.onRowClick,
754
+ rowSelection: {
755
+ selectedRowKeys: checkedRows,
756
+ onChange: _this.onCheckChange,
757
+ getCheckboxProps: function getCheckboxProps(record) {
758
+ var checked = _includesInstanceProperty(checkedRows).call(checkedRows, record.key);
759
+
760
+ return {
761
+ checked: checked,
762
+ disabled: items[record.key].__isWeaken,
763
+ style: items[record.key].__total ? {
764
+ display: 'none'
765
+ } : {}
766
+ };
767
+ }
768
+ }
769
+ };
770
+ } else {
771
+ return {
772
+ rowClassName: rowClassName2,
773
+ onRowClick: _this.onRowClick,
774
+ rowSelection: {
775
+ selectedRowKeys: _this.getSelectedRowKeys(items),
776
+ onChange: _this.onChange,
777
+ getCheckboxProps: function getCheckboxProps(record) {
778
+ var checked = isWeaken && items[record.key].__isWeaken ? false : !!record.checked;
779
+ return {
780
+ checked: checked,
781
+ disabled: items[record.key].__isWeaken,
782
+ style: items[record.key].__total ? {
783
+ display: 'none'
784
+ } : {}
785
+ };
786
+ }
787
+ }
788
+ };
789
+ }
790
+ } else {
791
+ return {
792
+ rowClassName: rowClassName2
793
+ };
794
+ }
795
+ });
796
+
797
+ _defineProperty(_assertThisInitialized(_this), "getRowPropsForDrag", function () {
798
+ return function (record, index) {
799
+ return {
800
+ index: index,
801
+ onMoveRow: _this.onMoveRow
802
+ };
803
+ };
804
+ });
805
+
806
+ _defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick) {
807
+ return function (record) {
808
+ return {
809
+ onClick: function onClick() {
810
+ return onRowClick && onRowClick(record);
811
+ },
812
+ onDoubleClick: function onDoubleClick() {
813
+ return _this.onDoubleClick(record);
814
+ }
815
+ };
816
+ };
817
+ });
818
+
819
+ _defineProperty(_assertThisInitialized(_this), "getProps", function () {
820
+ var _context12;
821
+
822
+ var _this$props4 = _this.props,
823
+ cols = _this$props4.cols,
824
+ items = _this$props4.items,
825
+ _this$props4$style = _this$props4.style,
826
+ style = _this$props4$style === void 0 ? {} : _this$props4$style,
827
+ _this$props4$footer = _this$props4.footer,
828
+ footer = _this$props4$footer === void 0 ? null : _this$props4$footer,
829
+ _this$props4$paginati = _this$props4.pagination,
830
+ pagination = _this$props4$paginati === void 0 ? false : _this$props4$paginati,
831
+ dragSort = _this$props4.dragSort,
832
+ _this$props4$isEmphas = _this$props4.isEmphasized,
833
+ isEmphasized = _this$props4$isEmphas === void 0 ? false : _this$props4$isEmphas,
834
+ maxHeight = _this$props4.maxHeight,
835
+ _this$props4$expanded = _this$props4.expandedRowRender,
836
+ expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
837
+ _this$props4$onExpand = _this$props4.onExpand,
838
+ onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
839
+
840
+ var widthX = _reduceInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
635
841
  return !col.hide;
636
- })).call(_context10, function (width, item) {
637
- return width += item.width ? item.width : 120;
842
+ })).call(_context12, function (width, item) {
843
+ var _context13;
844
+
845
+ return width += item.width ? item.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : item.type === 'img' ? 200 : 120;
638
846
  }, 0);
639
847
 
640
- var scrollProps = !helper.isEmpty2(expandedRowRender) ? {} : {
848
+ var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
849
+ expandedRowRender: expandedRowRender
850
+ } : {
641
851
  scroll: {
642
- x: widthX,
852
+ x: _someInstanceProperty(cols).call(cols, function (item) {
853
+ return !helper.isEmpty2(item.fixed);
854
+ }) ? widthX : true,
643
855
  y: maxHeight
644
856
  }
645
857
  };
858
+
859
+ var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
860
+ onRowClick = _this$getPropsByCheck.onRowClick,
861
+ extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
862
+
646
863
  return _objectSpread(_objectSpread({
647
864
  className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
648
865
  columns: _this.getColumns(cols),
@@ -653,11 +870,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
653
870
  size: 'small',
654
871
  pagination: pagination,
655
872
  footer: footer,
873
+ onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
874
+ components: dragSort ? {
875
+ body: {
876
+ row: DragSortRow
877
+ }
878
+ } : {},
656
879
  locale: _this.props.emptyText ? {
657
880
  emptyText: _this.props.emptyText
658
881
  } : null
659
882
  }, _this.getPropsByCheckbox()), {}, {
660
- expandedRowRender: expandedRowRender,
661
883
  onExpand: onExpand
662
884
  }, scrollProps);
663
885
  });
@@ -709,7 +931,8 @@ _defineProperty(SuperTable2, "propTypes", {
709
931
  emptyText: PropTypes.string,
710
932
  footer: PropTypes.func,
711
933
  callback: PropTypes.shape(CallbackType),
712
- isEmphasized: PropTypes.bool
934
+ isEmphasized: PropTypes.bool,
935
+ dragSort: PropTypes.bool
713
936
  });
714
937
 
715
938
  export default SuperTable2;
@@ -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,
@@ -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
  }
@@ -194,9 +194,9 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
194
194
  if (!invalid) {
195
195
  onChange && onChange(value);
196
196
  }
197
- }
198
197
 
199
- onBlur && onBlur(event);
198
+ onBlur && onBlur(event); //有输入才触发外部失去焦点事件,避免非必要请求
199
+ }
200
200
  });
201
201
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasSpecialChar", function (value) {
202
202
  if ((0, _includes["default"])(value).call(value, '+')) {