cloud-b2b 1.1.9 → 1.1.12

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 _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); }
31
+ function _unsupportedIterableToArray(o, minLen) { var _context19; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context19 = Object.prototype.toString.call(o)).call(_context19, 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 _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; }
37
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, 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); }; }
@@ -56,6 +59,7 @@ import fixed from '../SuperTable/fixed';
56
59
  import SuperToolbar from '../SuperToolbar';
57
60
  import variables from '../variables';
58
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', //多选下拉搜索
@@ -111,8 +115,11 @@ var CallbackType = {
111
115
  onToolbar: PropTypes.func,
112
116
  onDoubleClick: PropTypes.func,
113
117
  onTableFileChange: PropTypes.func,
114
- buildSuperUploadProps: PropTypes.func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
115
-
118
+ buildSuperUploadProps: PropTypes.func,
119
+ //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
120
+ onImgTileClick: PropTypes.func,
121
+ //点击img类型标题触发事件
122
+ onMoveRow: PropTypes.func
116
123
  };
117
124
  /**
118
125
  * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
@@ -213,6 +220,22 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
213
220
  };
214
221
  });
215
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);
237
+ });
238
+
216
239
  _defineProperty(_assertThisInitialized(_this), "closeValid", function () {
217
240
  var _this$props = _this.props,
218
241
  valid = _this$props.valid,
@@ -352,8 +375,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
352
375
  var split = index2 === list.length - 1 ? '' : ',';
353
376
 
354
377
  var onClick = function onClick() {
355
- var _ref9 = _this.props.callback || {},
356
- onLink = _ref9.onLink;
378
+ var _ref11 = _this.props.callback || {},
379
+ onLink = _ref11.onLink;
357
380
 
358
381
  onLink && onLink(col.key, index, item2);
359
382
  };
@@ -367,8 +390,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
367
390
  var title = typeof col.link === 'string' ? col.link : value;
368
391
 
369
392
  var onClick = function onClick() {
370
- var _ref10 = _this.props.callback || {},
371
- onLink = _ref10.onLink;
393
+ var _ref12 = _this.props.callback || {},
394
+ onLink = _ref12.onLink;
372
395
 
373
396
  onLink && onLink(col.key, index, record);
374
397
  };
@@ -385,7 +408,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
385
408
 
386
409
  _defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
387
410
  return function (value, record, index) {
388
- var _context3, _context4, _context5, _context6, _context7;
411
+ var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
389
412
 
390
413
  var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
391
414
 
@@ -464,7 +487,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
464
487
 
465
488
  case 'img':
466
489
  return value ? typeof value === 'string' ? /*#__PURE__*/React.createElement("img", {
467
- src: value,
490
+ src: _includesInstanceProperty(value).call(value, 'http') ? value : _concatInstanceProperty(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
468
491
  style: {
469
492
  width: '80px',
470
493
  height: '80px'
@@ -472,10 +495,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
472
495
  }) : /*#__PURE__*/React.createElement("div", {
473
496
  role: 'imgBox',
474
497
  style: {
475
- maxWidth: '120px'
498
+ maxWidth: "".concat(col.width, "px")
476
499
  }
477
500
  }, /*#__PURE__*/React.createElement("img", {
478
- src: value.img,
501
+ src: _includesInstanceProperty(_context8 = value.img).call(_context8, 'http') ? value.img : _concatInstanceProperty(_context9 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context9, value.img),
479
502
  style: {
480
503
  width: '80px',
481
504
  height: '80px'
@@ -486,8 +509,13 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
486
509
  }
487
510
  }, /*#__PURE__*/React.createElement("span", {
488
511
  style: {
489
- display: 'block'
490
- }
512
+ display: 'block',
513
+ whiteSpace: 'nowrap',
514
+ overflow: 'hidden',
515
+ textOverflow: 'ellipsis',
516
+ width: '80px'
517
+ },
518
+ onClick: _this.onImgTileClick(col, record, index)
491
519
  }, value.title), helper.isEmpty2(value.remark) ? null : /*#__PURE__*/React.createElement("span", {
492
520
  style: {
493
521
  color: '#333'
@@ -498,7 +526,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
498
526
  var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
499
527
 
500
528
  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,
529
+ onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
502
530
  type: col.type
503
531
  }, col.props), _this.props), commonProps), {}, {
504
532
  value: _this.props.items[index][col.key]
@@ -553,12 +581,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
553
581
  }
554
582
  });
555
583
 
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;
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;
562
590
 
563
591
  if (type === 'checkbox') {
564
592
  var status = _this.getCheckedStatus(key);
@@ -574,9 +602,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
574
602
  }
575
603
  });
576
604
 
577
- _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref12) {
578
- var type = _ref12.type,
579
- align = _ref12.align;
605
+ _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref14) {
606
+ var type = _ref14.type,
607
+ align = _ref14.align;
580
608
 
581
609
  if (type === 'index' || type === 'checkbox') {
582
610
  return 'ant-table-selection-column';
@@ -586,26 +614,26 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
586
614
  });
587
615
 
588
616
  _defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
589
- var _context8;
617
+ var _context11;
590
618
 
591
- return !_includesInstanceProperty(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
619
+ return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context11, type);
592
620
  });
593
621
 
594
622
  _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
595
- var _context9;
623
+ var _context12;
596
624
 
597
625
  var readonly = _this.props.readonly;
598
- return _mapInstanceProperty(_context9 = _filterInstanceProperty(cols).call(cols, function (col) {
626
+ return _mapInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
599
627
  return !col.hide;
600
- })).call(_context9, function (_ref13, index) {
601
- var _context10;
628
+ })).call(_context12, function (_ref15, index) {
629
+ var _context13;
602
630
 
603
- var col = _extends({}, _ref13);
631
+ var col = _extends({}, _ref15);
604
632
 
605
633
  col.className = _this.getColumnClassName(col);
606
634
  col.title = _this.getColumnTitle(col);
607
635
  col.dataIndex = col.key;
608
- col.width = col.width || _includesInstanceProperty(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : 120; // const {props = {}} = col;
636
+ col.width = col.width ? col.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} = col;
609
637
  // const {edit = false} = props
610
638
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
611
639
  // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
@@ -626,14 +654,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
626
654
 
627
655
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
628
656
  return _mapInstanceProperty(items).call(items, function (item, index) {
629
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref14) {
630
- var _context11;
657
+ return _reduceInstanceProperty(cols).call(cols, function (result, _ref16) {
658
+ var _context14;
631
659
 
632
- var key = _ref14.key,
633
- type = _ref14.type,
634
- options = _ref14.options;
660
+ var key = _ref16.key,
661
+ type = _ref16.type,
662
+ options = _ref16.options;
635
663
 
636
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context11 = item.isReadonly).call(_context11, key))) {
664
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context14 = item.isReadonly).call(_context14, key))) {
637
665
  result[key] = item[key];
638
666
  } else {
639
667
  result[key] = getTitle(item[key], options);
@@ -666,42 +694,172 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
666
694
  };
667
695
  });
668
696
 
669
- _defineProperty(_assertThisInitialized(_this), "getProps", function () {
670
- var _context12;
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
+ });
671
703
 
704
+ _defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox2", function (items) {
672
705
  var _this$props3 = _this.props,
673
- cols = _this$props3.cols,
674
- items = _this$props3.items,
675
- _this$props3$style = _this$props3.style,
676
- style = _this$props3$style === void 0 ? {} : _this$props3$style,
677
- _this$props3$footer = _this$props3.footer,
678
- footer = _this$props3$footer === void 0 ? null : _this$props3$footer,
679
- _this$props3$paginati = _this$props3.pagination,
680
- 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,
681
713
  _this$props3$isEmphas = _this$props3.isEmphasized,
682
714
  isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
683
- maxHeight = _this$props3.maxHeight,
684
- _this$props3$expanded = _this$props3.expandedRowRender,
685
- expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
686
- _this$props3$onExpand = _this$props3.onExpand,
687
- 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
+ };
723
+
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
+ }
688
731
 
689
- var widthX = _reduceInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
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 _context15;
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(_context15 = _filterInstanceProperty(cols).call(cols, function (col) {
690
841
  return !col.hide;
691
- })).call(_context12, function (width, item) {
692
- var _context13;
842
+ })).call(_context15, function (width, item) {
843
+ var _context16;
693
844
 
694
- return width += item.width ? item.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : 120;
845
+ return width += item.width ? item.width : _includesInstanceProperty(_context16 = ['index', 'checked']).call(_context16, item.key) ? 70 : item.type === 'img' ? 200 : 120;
695
846
  }, 0);
696
847
 
697
848
  var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
698
849
  expandedRowRender: expandedRowRender
699
850
  } : {
700
851
  scroll: {
701
- x: widthX,
852
+ x: _someInstanceProperty(cols).call(cols, function (item) {
853
+ return !helper.isEmpty2(item.fixed);
854
+ }) ? widthX : true,
702
855
  y: maxHeight
703
856
  }
704
857
  };
858
+
859
+ var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
860
+ onRowClick = _this$getPropsByCheck.onRowClick,
861
+ extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
862
+
705
863
  return _objectSpread(_objectSpread({
706
864
  className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
707
865
  columns: _this.getColumns(cols),
@@ -712,6 +870,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
712
870
  size: 'small',
713
871
  pagination: pagination,
714
872
  footer: footer,
873
+ onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
874
+ components: dragSort ? {
875
+ body: {
876
+ row: DragSortRow
877
+ }
878
+ } : {},
715
879
  locale: _this.props.emptyText ? {
716
880
  emptyText: _this.props.emptyText
717
881
  } : null
@@ -767,7 +931,8 @@ _defineProperty(SuperTable2, "propTypes", {
767
931
  emptyText: PropTypes.string,
768
932
  footer: PropTypes.func,
769
933
  callback: PropTypes.shape(CallbackType),
770
- isEmphasized: PropTypes.bool
934
+ isEmphasized: PropTypes.bool,
935
+ dragSort: PropTypes.bool
771
936
  });
772
937
 
773
938
  export default SuperTable2;
@@ -40,6 +40,10 @@ _Object$defineProperty(exports, "__esModule", {
40
40
 
41
41
  exports["default"] = void 0;
42
42
 
43
+ var _table = _interopRequireDefault(require("antd/lib/table"));
44
+
45
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
46
+
43
47
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
44
48
 
45
49
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
@@ -54,9 +58,9 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
54
58
 
55
59
  var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
56
60
 
57
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
61
+ var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
58
62
 
59
- var _table = _interopRequireDefault(require("antd/lib/table"));
63
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
60
64
 
61
65
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
62
66
 
@@ -100,19 +104,23 @@ var _variables = _interopRequireDefault(require("../variables"));
100
104
 
101
105
  var _helper = _interopRequireWildcard(require("../helper"));
102
106
 
107
+ var _DragSortRow = _interopRequireDefault(require("../SuperTable/DragSortRow"));
108
+
109
+ var _excluded = ["onRowClick"];
110
+
103
111
  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
112
 
105
113
  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; }
106
114
 
107
115
  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; } } }; }
108
116
 
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); }
117
+ function _unsupportedIterableToArray(o, minLen) { var _context19; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context19 = Object.prototype.toString.call(o)).call(_context19, 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); }
110
118
 
111
119
  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; }
112
120
 
113
121
  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; }
114
122
 
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; }
123
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
116
124
 
117
125
  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); }; }
118
126
 
@@ -173,8 +181,11 @@ var CallbackType = {
173
181
  onToolbar: _propTypes["default"].func,
174
182
  onDoubleClick: _propTypes["default"].func,
175
183
  onTableFileChange: _propTypes["default"].func,
176
- buildSuperUploadProps: _propTypes["default"].func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
177
-
184
+ buildSuperUploadProps: _propTypes["default"].func,
185
+ //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
186
+ onImgTileClick: _propTypes["default"].func,
187
+ //点击img类型标题触发事件
188
+ onMoveRow: _propTypes["default"].func
178
189
  };
179
190
  /**
180
191
  * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
@@ -266,6 +277,20 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
266
277
  onDoubleClick && onDoubleClick(key, value);
267
278
  };
268
279
  });
280
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onImgTileClick", function (col, value, rowIndex) {
281
+ return function () {
282
+ var _ref9 = _this.props.callback || {},
283
+ onImgTileClick = _ref9.onImgTileClick;
284
+
285
+ onImgTileClick && onImgTileClick(col, value, rowIndex);
286
+ };
287
+ });
288
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMoveRow", function (dragIndex, targetIndex) {
289
+ var _ref10 = _this.props.callback || {},
290
+ onMoveRow = _ref10.onMoveRow;
291
+
292
+ onMoveRow && onMoveRow(dragIndex, targetIndex);
293
+ });
269
294
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
270
295
  var _this$props = _this.props,
271
296
  valid = _this$props.valid,
@@ -401,8 +426,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
401
426
  var split = index2 === list.length - 1 ? '' : ',';
402
427
 
403
428
  var onClick = function onClick() {
404
- var _ref9 = _this.props.callback || {},
405
- onLink = _ref9.onLink;
429
+ var _ref11 = _this.props.callback || {},
430
+ onLink = _ref11.onLink;
406
431
 
407
432
  onLink && onLink(col.key, index, item2);
408
433
  };
@@ -416,8 +441,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
416
441
  var title = typeof col.link === 'string' ? col.link : value;
417
442
 
418
443
  var onClick = function onClick() {
419
- var _ref10 = _this.props.callback || {},
420
- onLink = _ref10.onLink;
444
+ var _ref12 = _this.props.callback || {},
445
+ onLink = _ref12.onLink;
421
446
 
422
447
  onLink && onLink(col.key, index, record);
423
448
  };
@@ -432,7 +457,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
432
457
  });
433
458
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
434
459
  return function (value, record, index) {
435
- var _context3, _context4, _context5, _context6, _context7;
460
+ var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
436
461
 
437
462
  var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
438
463
 
@@ -511,7 +536,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
511
536
 
512
537
  case 'img':
513
538
  return value ? typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("img", {
514
- src: value,
539
+ src: (0, _includes["default"])(value).call(value, 'http') ? value : (0, _concat["default"])(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
515
540
  style: {
516
541
  width: '80px',
517
542
  height: '80px'
@@ -519,10 +544,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
519
544
  }) : /*#__PURE__*/_react["default"].createElement("div", {
520
545
  role: 'imgBox',
521
546
  style: {
522
- maxWidth: '120px'
547
+ maxWidth: "".concat(col.width, "px")
523
548
  }
524
549
  }, /*#__PURE__*/_react["default"].createElement("img", {
525
- src: value.img,
550
+ src: (0, _includes["default"])(_context8 = value.img).call(_context8, 'http') ? value.img : (0, _concat["default"])(_context9 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context9, value.img),
526
551
  style: {
527
552
  width: '80px',
528
553
  height: '80px'
@@ -533,8 +558,13 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
533
558
  }
534
559
  }, /*#__PURE__*/_react["default"].createElement("span", {
535
560
  style: {
536
- display: 'block'
537
- }
561
+ display: 'block',
562
+ whiteSpace: 'nowrap',
563
+ overflow: 'hidden',
564
+ textOverflow: 'ellipsis',
565
+ width: '80px'
566
+ },
567
+ onClick: _this.onImgTileClick(col, record, index)
538
568
  }, value.title), _helper["default"].isEmpty2(value.remark) ? null : /*#__PURE__*/_react["default"].createElement("span", {
539
569
  style: {
540
570
  color: '#333'
@@ -545,7 +575,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
545
575
  var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
546
576
 
547
577
  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,
578
+ onFileChange: _this.props.callback.onTableFileChange ? (0, _bind["default"])(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
549
579
  type: col.type
550
580
  }, col.props), _this.props), commonProps), {}, {
551
581
  value: _this.props.items[index][col.key]
@@ -597,12 +627,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
597
627
  return null;
598
628
  }
599
629
  });
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;
630
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref13) {
631
+ var required = _ref13.required,
632
+ title = _ref13.title,
633
+ type = _ref13.type,
634
+ key = _ref13.key,
635
+ showAdd = _ref13.showAdd;
606
636
 
607
637
  if (type === 'checkbox') {
608
638
  var status = _this.getCheckedStatus(key);
@@ -617,9 +647,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
617
647
  }, title, _this.toAdd(key, showAdd));
618
648
  }
619
649
  });
620
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref12) {
621
- var type = _ref12.type,
622
- align = _ref12.align;
650
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref14) {
651
+ var type = _ref14.type,
652
+ align = _ref14.align;
623
653
 
624
654
  if (type === 'index' || type === 'checkbox') {
625
655
  return 'ant-table-selection-column';
@@ -628,24 +658,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
628
658
  }
629
659
  });
630
660
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
631
- var _context8;
661
+ var _context11;
632
662
 
633
- return !(0, _includes["default"])(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
663
+ return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context11, type);
634
664
  });
635
665
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
636
- var _context9;
666
+ var _context12;
637
667
 
638
668
  var readonly = _this.props.readonly;
639
- return (0, _map["default"])(_context9 = (0, _filter["default"])(cols).call(cols, function (col) {
669
+ return (0, _map["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
640
670
  return !col.hide;
641
- })).call(_context9, function (_ref13, index) {
642
- var _context10;
671
+ })).call(_context12, function (_ref15, index) {
672
+ var _context13;
643
673
 
644
- var col = (0, _extends2["default"])({}, _ref13);
674
+ var col = (0, _extends2["default"])({}, _ref15);
645
675
  col.className = _this.getColumnClassName(col);
646
676
  col.title = _this.getColumnTitle(col);
647
677
  col.dataIndex = col.key;
648
- col.width = col.width || (0, _includes["default"])(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : 120; // const {props = {}} = col;
678
+ col.width = col.width ? col.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} = col;
649
679
  // const {edit = false} = props
650
680
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
651
681
  // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
@@ -665,14 +695,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
665
695
  });
666
696
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
667
697
  return (0, _map["default"])(items).call(items, function (item, index) {
668
- return (0, _reduce["default"])(cols).call(cols, function (result, _ref14) {
669
- var _context11;
698
+ return (0, _reduce["default"])(cols).call(cols, function (result, _ref16) {
699
+ var _context14;
670
700
 
671
- var key = _ref14.key,
672
- type = _ref14.type,
673
- options = _ref14.options;
701
+ var key = _ref16.key,
702
+ type = _ref16.type,
703
+ options = _ref16.options;
674
704
 
675
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context11 = item.isReadonly).call(_context11, key))) {
705
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context14 = item.isReadonly).call(_context14, key))) {
676
706
  result[key] = item[key];
677
707
  } else {
678
708
  result[key] = (0, _Control.getTitle)(item[key], options);
@@ -703,40 +733,165 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
703
733
  rowClassName: rowClassName
704
734
  };
705
735
  });
706
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
707
- var _context12;
708
-
736
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getSelectedRowKeys", function (items) {
737
+ return (0, _reduce["default"])(items).call(items, function (result, item, index) {
738
+ item.checked && result.push(index);
739
+ return result;
740
+ }, []);
741
+ });
742
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox2", function (items) {
709
743
  var _this$props3 = _this.props,
710
- cols = _this$props3.cols,
711
- items = _this$props3.items,
712
- _this$props3$style = _this$props3.style,
713
- style = _this$props3$style === void 0 ? {} : _this$props3$style,
714
- _this$props3$footer = _this$props3.footer,
715
- footer = _this$props3$footer === void 0 ? null : _this$props3$footer,
716
- _this$props3$paginati = _this$props3.pagination,
717
- pagination = _this$props3$paginati === void 0 ? false : _this$props3$paginati,
744
+ _this$props3$checkbox = _this$props3.checkbox,
745
+ checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
746
+ _this$props3$radio = _this$props3.radio,
747
+ radio = _this$props3$radio === void 0 ? false : _this$props3$radio,
748
+ isolation = _this$props3.isolation,
749
+ _this$props3$checkedR = _this$props3.checkedRows,
750
+ checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR,
718
751
  _this$props3$isEmphas = _this$props3.isEmphasized,
719
752
  isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
720
- maxHeight = _this$props3.maxHeight,
721
- _this$props3$expanded = _this$props3.expandedRowRender,
722
- expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
723
- _this$props3$onExpand = _this$props3.onExpand,
724
- onExpand = _this$props3$onExpand === void 0 ? undefined : _this$props3$onExpand;
725
- var widthX = (0, _reduce["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
753
+ _this$props3$isWeaken = _this$props3.isWeaken,
754
+ isWeaken = _this$props3$isWeaken === void 0 ? true : _this$props3$isWeaken;
755
+
756
+ var rowClassName1 = function rowClassName1(record) {
757
+ if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
758
+ if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
759
+ return (0, _includes["default"])(checkedRows).call(checkedRows, record.key) ? (0, _variables["default"])('SuperTable').select : '';
760
+ };
761
+
762
+ var rowClassName2 = function rowClassName2(record) {
763
+ if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
764
+ if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
765
+
766
+ if (isEmphasized && items[record.key].__isEmphasized) {
767
+ return items[record.key].checked ? (0, _variables["default"])('SuperTable').emphasizedSelectRow : (0, _variables["default"])('SuperTable').emphasizedUnselectRow;
768
+ }
769
+
770
+ if (isWeaken && items[record.key].__isWeaken) {
771
+ return items[record.key].checked ? (0, _variables["default"])('SuperTable').weakenedSelectRow : (0, _variables["default"])('SuperTable').weakenedUnselectRow;
772
+ }
773
+
774
+ return items[record.key].checked ? (0, _variables["default"])('SuperTable').select : '';
775
+ };
776
+
777
+ if (checkbox) {
778
+ if (radio) {
779
+ return {
780
+ rowClassName: rowClassName1,
781
+ onRowClick: _this.onRadioRowClick,
782
+ rowSelection: {
783
+ type: 'radio',
784
+ selectedRowKeys: checkedRows,
785
+ onChange: _this.onRadioChange
786
+ }
787
+ };
788
+ } else if (isolation) {
789
+ return {
790
+ rowClassName: rowClassName1,
791
+ onRowClick: _this.onRowClick,
792
+ rowSelection: {
793
+ selectedRowKeys: checkedRows,
794
+ onChange: _this.onCheckChange,
795
+ getCheckboxProps: function getCheckboxProps(record) {
796
+ var checked = (0, _includes["default"])(checkedRows).call(checkedRows, record.key);
797
+ return {
798
+ checked: checked,
799
+ disabled: items[record.key].__isWeaken,
800
+ style: items[record.key].__total ? {
801
+ display: 'none'
802
+ } : {}
803
+ };
804
+ }
805
+ }
806
+ };
807
+ } else {
808
+ return {
809
+ rowClassName: rowClassName2,
810
+ onRowClick: _this.onRowClick,
811
+ rowSelection: {
812
+ selectedRowKeys: _this.getSelectedRowKeys(items),
813
+ onChange: _this.onChange,
814
+ getCheckboxProps: function getCheckboxProps(record) {
815
+ var checked = isWeaken && items[record.key].__isWeaken ? false : !!record.checked;
816
+ return {
817
+ checked: checked,
818
+ disabled: items[record.key].__isWeaken,
819
+ style: items[record.key].__total ? {
820
+ display: 'none'
821
+ } : {}
822
+ };
823
+ }
824
+ }
825
+ };
826
+ }
827
+ } else {
828
+ return {
829
+ rowClassName: rowClassName2
830
+ };
831
+ }
832
+ });
833
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowPropsForDrag", function () {
834
+ return function (record, index) {
835
+ return {
836
+ index: index,
837
+ onMoveRow: _this.onMoveRow
838
+ };
839
+ };
840
+ });
841
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowProps", function (onRowClick) {
842
+ return function (record) {
843
+ return {
844
+ onClick: function onClick() {
845
+ return onRowClick && onRowClick(record);
846
+ },
847
+ onDoubleClick: function onDoubleClick() {
848
+ return _this.onDoubleClick(record);
849
+ }
850
+ };
851
+ };
852
+ });
853
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
854
+ var _context15;
855
+
856
+ var _this$props4 = _this.props,
857
+ cols = _this$props4.cols,
858
+ items = _this$props4.items,
859
+ _this$props4$style = _this$props4.style,
860
+ style = _this$props4$style === void 0 ? {} : _this$props4$style,
861
+ _this$props4$footer = _this$props4.footer,
862
+ footer = _this$props4$footer === void 0 ? null : _this$props4$footer,
863
+ _this$props4$paginati = _this$props4.pagination,
864
+ pagination = _this$props4$paginati === void 0 ? false : _this$props4$paginati,
865
+ dragSort = _this$props4.dragSort,
866
+ _this$props4$isEmphas = _this$props4.isEmphasized,
867
+ isEmphasized = _this$props4$isEmphas === void 0 ? false : _this$props4$isEmphas,
868
+ maxHeight = _this$props4.maxHeight,
869
+ _this$props4$expanded = _this$props4.expandedRowRender,
870
+ expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
871
+ _this$props4$onExpand = _this$props4.onExpand,
872
+ onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
873
+ var widthX = (0, _reduce["default"])(_context15 = (0, _filter["default"])(cols).call(cols, function (col) {
726
874
  return !col.hide;
727
- })).call(_context12, function (width, item) {
728
- var _context13;
875
+ })).call(_context15, function (width, item) {
876
+ var _context16;
729
877
 
730
- return width += item.width ? item.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : 120;
878
+ return width += item.width ? item.width : (0, _includes["default"])(_context16 = ['index', 'checked']).call(_context16, item.key) ? 70 : item.type === 'img' ? 200 : 120;
731
879
  }, 0);
732
880
  var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
733
881
  expandedRowRender: expandedRowRender
734
882
  } : {
735
883
  scroll: {
736
- x: widthX,
884
+ x: (0, _some["default"])(cols).call(cols, function (item) {
885
+ return !_helper["default"].isEmpty2(item.fixed);
886
+ }) ? widthX : true,
737
887
  y: maxHeight
738
888
  }
739
889
  };
890
+
891
+ var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
892
+ onRowClick = _this$getPropsByCheck.onRowClick,
893
+ extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
894
+
740
895
  return _objectSpread(_objectSpread({
741
896
  className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
742
897
  columns: _this.getColumns(cols),
@@ -747,6 +902,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
747
902
  size: 'small',
748
903
  pagination: pagination,
749
904
  footer: footer,
905
+ onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
906
+ components: dragSort ? {
907
+ body: {
908
+ row: _DragSortRow["default"]
909
+ }
910
+ } : {},
750
911
  locale: _this.props.emptyText ? {
751
912
  emptyText: _this.props.emptyText
752
913
  } : null
@@ -800,7 +961,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
800
961
  emptyText: _propTypes["default"].string,
801
962
  footer: _propTypes["default"].func,
802
963
  callback: _propTypes["default"].shape(CallbackType),
803
- isEmphasized: _propTypes["default"].bool
964
+ isEmphasized: _propTypes["default"].bool,
965
+ dragSort: _propTypes["default"].bool
804
966
  });
805
967
  var _default = SuperTable2;
806
968
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud-b2b",
3
- "version": "1.1.9",
3
+ "version": "1.1.12",
4
4
  "description": "A react component library dependent antd",
5
5
  "keywords": [
6
6
  "react",
@@ -11,11 +11,11 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "@babel/runtime-corejs3": "^7.11.2",
14
- "antd": "3.13.6",
14
+ "antd": "^3.26.19",
15
+ "history": "^4.5.0",
15
16
  "prop-types": "^15.7.2",
16
17
  "react": "^16.8.2",
17
- "react-dom": "^16.8.2",
18
- "history": "^4.5.0"
18
+ "react-dom": "^16.8.2"
19
19
  },
20
20
  "main": "lib/index.js",
21
21
  "module": "es/index.js"