cloud-b2b 1.1.65 → 1.1.67

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.
@@ -154,7 +154,8 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
154
154
  });
155
155
  _defineProperty(_assertThisInitialized(_this), "isMatch", function (inputValue, option) {
156
156
  var _context2;
157
- return option.props.children && _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
157
+ // return option.props.children && option.props.children.indexOf(inputValue) !== -1;
158
+ return option.props.children && _indexOfInstanceProperty(_context2 = option.props.children.toUpperCase()).call(_context2, inputValue.toUpperCase()) !== -1;
158
159
  });
159
160
  _defineProperty(_assertThisInitialized(_this), "isMatchRemark", function (inputValue, option) {
160
161
  var _option$props = option.props,
@@ -9,6 +9,9 @@ import _Table from "antd/es/table";
9
9
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
10
10
  import _Tooltip from "antd/es/tooltip";
11
11
  import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/objectDestructuringEmpty";
12
+ import _Badge from "antd/es/badge";
13
+ import _Tag from "antd/es/tag";
14
+ import _Icon from "antd/es/icon";
12
15
  import _extends from "@babel/runtime-corejs3/helpers/extends";
13
16
  import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
14
17
  import _createClass from "@babel/runtime-corejs3/helpers/createClass";
@@ -19,7 +22,7 @@ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
19
22
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
20
23
  var _excluded = ["onRowClick"];
21
24
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context9 = ownKeys(Object(t), !0)).call(_context9, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context10 = ownKeys(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context10, _context11; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context10 = ownKeys(Object(t), !0)).call(_context10, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context11 = ownKeys(Object(t))).call(_context11, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
23
26
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
24
27
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
25
28
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
@@ -370,16 +373,52 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
370
373
  }
371
374
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, text));
372
375
  });
376
+ _defineProperty(_assertThisInitialized(_this), "tags", function (key, index, item, _ref11) {
377
+ var tags = _ref11.tags;
378
+ var list = item[key] || [];
379
+ return /*#__PURE__*/React.createElement("div", null, _mapInstanceProperty(list).call(list, function (item2, index2) {
380
+ var _context5;
381
+ var onClick = _bindInstanceProperty(_context5 = _this.onLink).call(_context5, null, key, index, _objectSpread(_objectSpread({}, item2), item));
382
+ var tagProps = {
383
+ key: index2,
384
+ color: item2.color,
385
+ style: {
386
+ cursor: 'default'
387
+ }
388
+ };
389
+ if (item2.click === true) {
390
+ tagProps.onClick = onClick;
391
+ tagProps.onDoubleClick = _this.onLinkDouble;
392
+ tagProps.style = {
393
+ cursor: 'pointer'
394
+ };
395
+ }
396
+ return item2.tagType === 'warning_tag' ? /*#__PURE__*/React.createElement(_Icon, _extends({
397
+ type: "alert"
398
+ }, tagProps, {
399
+ style: {
400
+ color: '#FFB90F',
401
+ fontSize: '16px',
402
+ margin: '0px 5px',
403
+ cursor: 'pointer'
404
+ }
405
+ })) : item2.tagType === 'exception_tag' ? /*#__PURE__*/React.createElement(_Badge, {
406
+ count: item2.num,
407
+ offset: [-8, 0],
408
+ key: index2
409
+ }, /*#__PURE__*/React.createElement(_Tag, tagProps, item2[tags])) : /*#__PURE__*/React.createElement(_Tag, tagProps, item2[tags]);
410
+ }));
411
+ });
373
412
  _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols, items) {
374
- var _context5, _context6;
413
+ var _context6, _context7;
375
414
  var _this$props5 = _this.props,
376
415
  sortInfo = _this$props5.sortInfo,
377
416
  filterInfo = _this$props5.filterInfo;
378
417
  var filterVisibleKey = _this.state.filterVisibleKey;
379
- return _mapInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _this.getIndexInfo(items)).call(_context6, _filterInstanceProperty(cols).call(cols, function (col) {
418
+ return _mapInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _this.getIndexInfo(items)).call(_context7, _filterInstanceProperty(cols).call(cols, function (col) {
380
419
  return !col.hide;
381
- }))).call(_context5, function (_ref11) {
382
- var col = _extends({}, (_objectDestructuringEmpty(_ref11), _ref11));
420
+ }))).call(_context6, function (_ref12) {
421
+ var col = _extends({}, (_objectDestructuringEmpty(_ref12), _ref12));
383
422
  col.dataIndex = col.key;
384
423
  col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? variables('SuperTable')[col.align] : '';
385
424
  col.noWrap && (col.className = variables('SuperTable').noWrap);
@@ -405,6 +444,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
405
444
  col.render = function (text, record, index) {
406
445
  return _this.tooltip(col.key, index, items[index], col);
407
446
  };
447
+ } else if (col.tags) {
448
+ col.render = function (text, record, index) {
449
+ return _this.tags(col.key, index, items[index], col);
450
+ };
408
451
  }
409
452
  return col;
410
453
  });
@@ -419,16 +462,16 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
419
462
  }
420
463
  });
421
464
  _defineProperty(_assertThisInitialized(_this), "link", function (key, index, item, text) {
422
- var _context7;
423
- var onClick = _bindInstanceProperty(_context7 = _this.onLink).call(_context7, null, key, index, item);
465
+ var _context8;
466
+ var onClick = _bindInstanceProperty(_context8 = _this.onLink).call(_context8, null, key, index, item);
424
467
  return /*#__PURE__*/React.createElement("a", {
425
468
  onClick: onClick,
426
469
  onDoubleClick: _this.onLinkDouble
427
470
  }, text);
428
471
  });
429
- _defineProperty(_assertThisInitialized(_this), "tooltip", function (key, index, item, _ref12) {
430
- var tipLen = _ref12.tooltip,
431
- options = _ref12.options;
472
+ _defineProperty(_assertThisInitialized(_this), "tooltip", function (key, index, item, _ref13) {
473
+ var tipLen = _ref13.tooltip,
474
+ options = _ref13.options;
432
475
  var text = _this.getText(item[key], options);
433
476
  var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
434
477
  return needTip ? /*#__PURE__*/React.createElement(_Tooltip, {
@@ -470,21 +513,21 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
470
513
  });
471
514
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
472
515
  return _mapInstanceProperty(items).call(items, function (item, index) {
473
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref13) {
474
- var key = _ref13.key,
475
- options = _ref13.options,
476
- link = _ref13.link,
477
- icon = _ref13.icon,
478
- dataSource = _ref13.dataSource;
516
+ return _reduceInstanceProperty(cols).call(cols, function (result, _ref14) {
517
+ var key = _ref14.key,
518
+ options = _ref14.options,
519
+ link = _ref14.link,
520
+ icon = _ref14.icon,
521
+ dataSource = _ref14.dataSource;
479
522
  if (link) {
480
523
  if (typeof link === 'boolean') {
481
524
  result[key] = _this.link(key, index, item, _this.getText(item[key], options));
482
525
  }
483
526
  } else if (icon) {
484
- var _context8;
527
+ var _context9;
485
528
  //单独的icon列,icon=true数据值根据options获得显示的图片url
486
529
  var src = _this.getImgSrc(item[key], options);
487
- var onClick = _bindInstanceProperty(_context8 = _this.onLink).call(_context8, null, key, index, item);
530
+ var onClick = _bindInstanceProperty(_context9 = _this.onLink).call(_context9, null, key, index, item);
488
531
  result[key] = src ? /*#__PURE__*/React.createElement("img", {
489
532
  src: src,
490
533
  onClick: onClick
@@ -586,9 +629,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
586
629
  };
587
630
  }
588
631
  });
589
- _defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick) {
632
+ _defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick, items) {
590
633
  return function (record) {
591
- return {
634
+ var item = items[record.key];
635
+ var rowProps = {
592
636
  onClick: function onClick() {
593
637
  return onRowClick && onRowClick(record);
594
638
  },
@@ -596,6 +640,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
596
640
  return _this.onDoubleClick(record);
597
641
  }
598
642
  };
643
+ item && item.__bgColor && (rowProps.style = {
644
+ backgroundColor: item.__bgColor
645
+ });
646
+ return rowProps;
599
647
  };
600
648
  });
601
649
  _defineProperty(_assertThisInitialized(_this), "getRowPropsForDrag", function () {
@@ -618,10 +666,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
618
666
  var resItems = items;
619
667
  if (!dragSort && items.length > 1) {
620
668
  if (pageTotal || searchTotal) {
621
- var totalItem = _reduceInstanceProperty(cols).call(cols, function (result, _ref14) {
622
- var key = _ref14.key,
623
- _ref14$total = _ref14.total,
624
- total = _ref14$total === void 0 ? false : _ref14$total;
669
+ var totalItem = _reduceInstanceProperty(cols).call(cols, function (result, _ref15) {
670
+ var key = _ref15.key,
671
+ _ref15$total = _ref15.total,
672
+ total = _ref15$total === void 0 ? false : _ref15$total;
625
673
  if (total) {
626
674
  result[key] = _parseFloat(Number(_reduceInstanceProperty(items).call(items, function (result, item) {
627
675
  return _parseFloat(String(item[key] || 0)) + result;
@@ -659,11 +707,11 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
659
707
  return item.checked;
660
708
  });
661
709
  var countItems = checkedItems.length ? checkedItems : items;
662
- var totalItems = _mapInstanceProperty(totalCols).call(totalCols, function (_ref15) {
663
- var title = _ref15.title,
664
- key = _ref15.key,
665
- _ref15$props = _ref15.props,
666
- props = _ref15$props === void 0 ? {} : _ref15$props;
710
+ var totalItems = _mapInstanceProperty(totalCols).call(totalCols, function (_ref16) {
711
+ var title = _ref16.title,
712
+ key = _ref16.key,
713
+ _ref16$props = _ref16.props,
714
+ props = _ref16$props === void 0 ? {} : _ref16$props;
667
715
  var value = _reduceInstanceProperty(countItems).call(countItems, function (result, item) {
668
716
  return _parseFloat((result + Number(item[key] || 0)).toFixed(props.precision || 6));
669
717
  }, 0);
@@ -681,9 +729,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
681
729
  style: {
682
730
  marginRight: "15px"
683
731
  }
684
- }, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), _mapInstanceProperty(totalItems).call(totalItems, function (_ref16, index) {
685
- var title = _ref16.title,
686
- value = _ref16.value;
732
+ }, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), _mapInstanceProperty(totalItems).call(totalItems, function (_ref17, index) {
733
+ var title = _ref17.title,
734
+ value = _ref17.value;
687
735
  return /*#__PURE__*/React.createElement("span", {
688
736
  key: index,
689
737
  style: {
@@ -725,7 +773,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
725
773
  x: true
726
774
  },
727
775
  onChange: _this.onTableChange,
728
- onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
776
+ onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick, items),
729
777
  components: dragSort ? {
730
778
  body: {
731
779
  row: DragSortRow
@@ -6,13 +6,13 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
6
6
  import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
7
  import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
8
  import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
10
9
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
11
10
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
12
11
  import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
13
12
  import _Table from "antd/es/table";
14
13
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
15
14
  import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/objectDestructuringEmpty";
15
+ import _Tooltip from "antd/es/tooltip";
16
16
  import _extends from "@babel/runtime-corejs3/helpers/extends";
17
17
  import _Switch from "antd/es/switch";
18
18
  import _Button from "antd/es/button";
@@ -38,6 +38,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
38
38
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
39
39
  import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
40
40
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
41
+ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
41
42
  import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
42
43
  import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
43
44
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
@@ -630,18 +631,56 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
630
631
  var _context11;
631
632
  return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
632
633
  });
633
- _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
634
+ _defineProperty(_assertThisInitialized(_this), "tooltip", function (key, index, item, _ref18) {
635
+ var tipLen = _ref18.tooltip,
636
+ options = _ref18.options,
637
+ width = _ref18.width;
638
+ var text = _this.getText(item[key], options);
639
+ var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
640
+ return needTip ? /*#__PURE__*/React.createElement(_Tooltip, {
641
+ title: text
642
+ }, /*#__PURE__*/React.createElement("div", {
643
+ style: {
644
+ minHeight: '20px',
645
+ minWidth: '10px',
646
+ maxWidth: "".concat(width - 16, "px"),
647
+ overflow: 'hidden',
648
+ textOverflow: 'ellipsis',
649
+ display: '-webkit-box',
650
+ WebkitLineClamp: 2,
651
+ WebkitBoxOrient: "vertical",
652
+ whiteSpace: 'break-spaces'
653
+ },
654
+ title: true
655
+ }, _sliceInstanceProperty(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/React.createElement("div", {
656
+ style: {
657
+ minHeight: '20px',
658
+ minWidth: '10px',
659
+ maxWidth: "".concat(width - 16, "px"),
660
+ overflow: 'hidden',
661
+ textOverflow: 'ellipsis',
662
+ display: '-webkit-box',
663
+ WebkitLineClamp: 2,
664
+ WebkitBoxOrient: "vertical",
665
+ whiteSpace: 'break-spaces'
666
+ },
667
+ title: true
668
+ }, _Array$isArray(text) ? text.join(',') : text, " ");
669
+ });
670
+ _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols, items) {
634
671
  var _context12;
635
672
  var readonly = _this.props.readonly;
636
673
  return _mapInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
637
674
  return !col.hide;
638
- })).call(_context12, function (_ref18, index) {
675
+ })).call(_context12, function (_ref19, index) {
639
676
  var _context13;
640
- var col = _extends({}, (_objectDestructuringEmpty(_ref18), _ref18));
677
+ var col = _extends({}, (_objectDestructuringEmpty(_ref19), _ref19));
641
678
  col.className = _this.getColumnClassName(col);
642
679
  col.title = _this.getColumnTitle(col);
643
680
  col.dataIndex = col.key;
644
- col.width = col.width ? col.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120;
681
+ !_this.props.autoAdjustingWidth && (col.width = col.width ? col.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120);
682
+ // col.width = col.width ? col.width : (['index','checked'].includes(col.key) ? 70 : (col.type === 'img' ? 200 : 120));
683
+
645
684
  // const {props = {}} =
646
685
  // const {edit = false} = props
647
686
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
@@ -663,6 +702,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
663
702
  return text ? "\uFFE5".concat(text.toFixed(2)) : text;
664
703
  }
665
704
  };
705
+ } else if (col.tooltip) {
706
+ col.render = function (text, record, index) {
707
+ return _this.tooltip(col.key, index, items[index], col);
708
+ };
666
709
  }
667
710
  return col;
668
711
  });
@@ -678,11 +721,11 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
678
721
  });
679
722
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
680
723
  return _mapInstanceProperty(items).call(items, function (item, index) {
681
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref19) {
724
+ return _reduceInstanceProperty(cols).call(cols, function (result, _ref20) {
682
725
  var _context14, _context15;
683
- var key = _ref19.key,
684
- type = _ref19.type,
685
- options = _ref19.options;
726
+ var key = _ref20.key,
727
+ type = _ref20.type,
728
+ options = _ref20.options;
686
729
  if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context14 = item.isReadonly).call(_context14, key)) || _includesInstanceProperty(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
687
730
  result[key] = item[key];
688
731
  } else {
@@ -839,29 +882,47 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
839
882
  _this$props4$expanded = _this$props4.expandedRowRender,
840
883
  expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
841
884
  _this$props4$onExpand = _this$props4.onExpand,
842
- onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
885
+ onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand,
886
+ _this$props4$expanded2 = _this$props4.expandedRowRenderKeepScroll,
887
+ expandedRowRenderKeepScroll = _this$props4$expanded2 === void 0 ? false : _this$props4$expanded2,
888
+ _this$props4$autoAdju = _this$props4.autoAdjustingWidth,
889
+ autoAdjustingWidth = _this$props4$autoAdju === void 0 ? false : _this$props4$autoAdju;
843
890
  var widthX = _reduceInstanceProperty(_context16 = _filterInstanceProperty(cols).call(cols, function (col) {
844
891
  return !col.hide;
845
892
  })).call(_context16, function (width, item) {
846
893
  var _context17;
847
894
  return width += item.width ? item.width : _includesInstanceProperty(_context17 = ['index', 'checked']).call(_context17, item.key) ? 70 : item.type === 'img' ? 200 : 120;
848
895
  }, 0);
849
- var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
850
- expandedRowRender: expandedRowRender
851
- } : {
852
- scroll: {
853
- x: _someInstanceProperty(cols).call(cols, function (item) {
854
- return !helper.isEmpty2(item.fixed);
855
- }) ? widthX : true,
856
- y: maxHeight
857
- }
858
- };
896
+ var scrollProps = {};
897
+ if (expandedRowRenderKeepScroll) {
898
+ //拥有expandedRowRender时候保持scroll属性
899
+ scrollProps = {
900
+ expandedRowRender: expandedRowRender,
901
+ scroll: {
902
+ x: _someInstanceProperty(cols).call(cols, function (item) {
903
+ return !helper.isEmpty2(item.fixed);
904
+ }) ? widthX : true,
905
+ y: maxHeight
906
+ }
907
+ };
908
+ } else {
909
+ scrollProps = !helper.isEmpty2(expandedRowRender) ? {
910
+ expandedRowRender: expandedRowRender
911
+ } : {
912
+ scroll: {
913
+ x: _someInstanceProperty(cols).call(cols, function (item) {
914
+ return !helper.isEmpty2(item.fixed);
915
+ }) ? widthX : true,
916
+ y: maxHeight
917
+ }
918
+ };
919
+ }
859
920
  var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
860
921
  onRowClick = _this$getPropsByCheck.onRowClick,
861
922
  extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
862
- return _objectSpread(_objectSpread({
923
+ var props = _objectSpread(_objectSpread({
863
924
  className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
864
- columns: _this.getColumns(cols),
925
+ columns: _this.getColumns(cols, items),
865
926
  dataSource: _this.getDataSource(items, cols),
866
927
  style: _Object$assign({}, {
867
928
  whiteSpace: 'nowrap'
@@ -881,6 +942,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
881
942
  }, _this.getPropsByCheckbox()), {}, {
882
943
  onExpand: onExpand
883
944
  }, scrollProps);
945
+ autoAdjustingWidth && (props.scroll = {
946
+ x: true
947
+ });
948
+ return props;
884
949
  });
885
950
  _defineProperty(_assertThisInitialized(_this), "setScroll", function () {
886
951
  if (_this.props.maxHeight && _this.props.items.length) {
@@ -926,6 +991,7 @@ _defineProperty(SuperTable2, "propTypes", {
926
991
  footer: PropTypes.func,
927
992
  callback: PropTypes.shape(CallbackType),
928
993
  isEmphasized: PropTypes.bool,
929
- dragSort: PropTypes.bool
994
+ dragSort: PropTypes.bool,
995
+ autoAdjustingWidth: PropTypes.bool //列宽度随内容自适应
930
996
  });
931
997
  export default SuperTable2;
@@ -162,7 +162,8 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
162
162
  });
163
163
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isMatch", function (inputValue, option) {
164
164
  var _context2;
165
- return option.props.children && (0, _indexOf["default"])(_context2 = option.props.children).call(_context2, inputValue) !== -1;
165
+ // return option.props.children && option.props.children.indexOf(inputValue) !== -1;
166
+ return option.props.children && (0, _indexOf["default"])(_context2 = option.props.children.toUpperCase()).call(_context2, inputValue.toUpperCase()) !== -1;
166
167
  });
167
168
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isMatchRemark", function (inputValue, option) {
168
169
  var _option$props = option.props,
@@ -33,6 +33,9 @@ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
33
33
  var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
34
34
  var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
35
35
  var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectDestructuringEmpty"));
36
+ var _badge = _interopRequireDefault(require("antd/lib/badge"));
37
+ var _tag = _interopRequireDefault(require("antd/lib/tag"));
38
+ var _icon = _interopRequireDefault(require("antd/lib/icon"));
36
39
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
37
40
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
38
41
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
@@ -51,7 +54,7 @@ var _DragSortRow = _interopRequireDefault(require("./DragSortRow"));
51
54
  var _variables = _interopRequireDefault(require("../variables"));
52
55
  var _excluded = ["onRowClick"];
53
56
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty2(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
54
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty2(_context9 = ownKeys(Object(t), !0)).call(_context9, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty2(_context10 = ownKeys(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
57
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context10, _context11; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty2(_context10 = ownKeys(Object(t), !0)).call(_context10, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty2(_context11 = ownKeys(Object(t))).call(_context11, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
55
58
  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); }; }
56
59
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
57
60
  /**
@@ -378,16 +381,52 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
378
381
  }
379
382
  return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", null, text));
380
383
  });
384
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "tags", function (key, index, item, _ref11) {
385
+ var tags = _ref11.tags;
386
+ var list = item[key] || [];
387
+ return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(list).call(list, function (item2, index2) {
388
+ var _context5;
389
+ var onClick = (0, _bind["default"])(_context5 = _this.onLink).call(_context5, null, key, index, _objectSpread(_objectSpread({}, item2), item));
390
+ var tagProps = {
391
+ key: index2,
392
+ color: item2.color,
393
+ style: {
394
+ cursor: 'default'
395
+ }
396
+ };
397
+ if (item2.click === true) {
398
+ tagProps.onClick = onClick;
399
+ tagProps.onDoubleClick = _this.onLinkDouble;
400
+ tagProps.style = {
401
+ cursor: 'pointer'
402
+ };
403
+ }
404
+ return item2.tagType === 'warning_tag' ? /*#__PURE__*/_react["default"].createElement(_icon["default"], (0, _extends2["default"])({
405
+ type: "alert"
406
+ }, tagProps, {
407
+ style: {
408
+ color: '#FFB90F',
409
+ fontSize: '16px',
410
+ margin: '0px 5px',
411
+ cursor: 'pointer'
412
+ }
413
+ })) : item2.tagType === 'exception_tag' ? /*#__PURE__*/_react["default"].createElement(_badge["default"], {
414
+ count: item2.num,
415
+ offset: [-8, 0],
416
+ key: index2
417
+ }, /*#__PURE__*/_react["default"].createElement(_tag["default"], tagProps, item2[tags])) : /*#__PURE__*/_react["default"].createElement(_tag["default"], tagProps, item2[tags]);
418
+ }));
419
+ });
381
420
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols, items) {
382
- var _context5, _context6;
421
+ var _context6, _context7;
383
422
  var _this$props5 = _this.props,
384
423
  sortInfo = _this$props5.sortInfo,
385
424
  filterInfo = _this$props5.filterInfo;
386
425
  var filterVisibleKey = _this.state.filterVisibleKey;
387
- return (0, _map["default"])(_context5 = (0, _concat["default"])(_context6 = _this.getIndexInfo(items)).call(_context6, (0, _filter["default"])(cols).call(cols, function (col) {
426
+ return (0, _map["default"])(_context6 = (0, _concat["default"])(_context7 = _this.getIndexInfo(items)).call(_context7, (0, _filter["default"])(cols).call(cols, function (col) {
388
427
  return !col.hide;
389
- }))).call(_context5, function (_ref11) {
390
- var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref11), _ref11));
428
+ }))).call(_context6, function (_ref12) {
429
+ var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref12), _ref12));
391
430
  col.dataIndex = col.key;
392
431
  col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? (0, _variables["default"])('SuperTable')[col.align] : '';
393
432
  col.noWrap && (col.className = (0, _variables["default"])('SuperTable').noWrap);
@@ -413,6 +452,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
413
452
  col.render = function (text, record, index) {
414
453
  return _this.tooltip(col.key, index, items[index], col);
415
454
  };
455
+ } else if (col.tags) {
456
+ col.render = function (text, record, index) {
457
+ return _this.tags(col.key, index, items[index], col);
458
+ };
416
459
  }
417
460
  return col;
418
461
  });
@@ -427,16 +470,16 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
427
470
  }
428
471
  });
429
472
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "link", function (key, index, item, text) {
430
- var _context7;
431
- var onClick = (0, _bind["default"])(_context7 = _this.onLink).call(_context7, null, key, index, item);
473
+ var _context8;
474
+ var onClick = (0, _bind["default"])(_context8 = _this.onLink).call(_context8, null, key, index, item);
432
475
  return /*#__PURE__*/_react["default"].createElement("a", {
433
476
  onClick: onClick,
434
477
  onDoubleClick: _this.onLinkDouble
435
478
  }, text);
436
479
  });
437
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "tooltip", function (key, index, item, _ref12) {
438
- var tipLen = _ref12.tooltip,
439
- options = _ref12.options;
480
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "tooltip", function (key, index, item, _ref13) {
481
+ var tipLen = _ref13.tooltip,
482
+ options = _ref13.options;
440
483
  var text = _this.getText(item[key], options);
441
484
  var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
442
485
  return needTip ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
@@ -478,21 +521,21 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
478
521
  });
479
522
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
480
523
  return (0, _map["default"])(items).call(items, function (item, index) {
481
- return (0, _reduce["default"])(cols).call(cols, function (result, _ref13) {
482
- var key = _ref13.key,
483
- options = _ref13.options,
484
- link = _ref13.link,
485
- icon = _ref13.icon,
486
- dataSource = _ref13.dataSource;
524
+ return (0, _reduce["default"])(cols).call(cols, function (result, _ref14) {
525
+ var key = _ref14.key,
526
+ options = _ref14.options,
527
+ link = _ref14.link,
528
+ icon = _ref14.icon,
529
+ dataSource = _ref14.dataSource;
487
530
  if (link) {
488
531
  if (typeof link === 'boolean') {
489
532
  result[key] = _this.link(key, index, item, _this.getText(item[key], options));
490
533
  }
491
534
  } else if (icon) {
492
- var _context8;
535
+ var _context9;
493
536
  //单独的icon列,icon=true数据值根据options获得显示的图片url
494
537
  var src = _this.getImgSrc(item[key], options);
495
- var onClick = (0, _bind["default"])(_context8 = _this.onLink).call(_context8, null, key, index, item);
538
+ var onClick = (0, _bind["default"])(_context9 = _this.onLink).call(_context9, null, key, index, item);
496
539
  result[key] = src ? /*#__PURE__*/_react["default"].createElement("img", {
497
540
  src: src,
498
541
  onClick: onClick
@@ -594,9 +637,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
594
637
  };
595
638
  }
596
639
  });
597
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowProps", function (onRowClick) {
640
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowProps", function (onRowClick, items) {
598
641
  return function (record) {
599
- return {
642
+ var item = items[record.key];
643
+ var rowProps = {
600
644
  onClick: function onClick() {
601
645
  return onRowClick && onRowClick(record);
602
646
  },
@@ -604,6 +648,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
604
648
  return _this.onDoubleClick(record);
605
649
  }
606
650
  };
651
+ item && item.__bgColor && (rowProps.style = {
652
+ backgroundColor: item.__bgColor
653
+ });
654
+ return rowProps;
607
655
  };
608
656
  });
609
657
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRowPropsForDrag", function () {
@@ -626,10 +674,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
626
674
  var resItems = items;
627
675
  if (!dragSort && items.length > 1) {
628
676
  if (pageTotal || searchTotal) {
629
- var totalItem = (0, _reduce["default"])(cols).call(cols, function (result, _ref14) {
630
- var key = _ref14.key,
631
- _ref14$total = _ref14.total,
632
- total = _ref14$total === void 0 ? false : _ref14$total;
677
+ var totalItem = (0, _reduce["default"])(cols).call(cols, function (result, _ref15) {
678
+ var key = _ref15.key,
679
+ _ref15$total = _ref15.total,
680
+ total = _ref15$total === void 0 ? false : _ref15$total;
633
681
  if (total) {
634
682
  result[key] = (0, _parseFloat2["default"])(Number((0, _reduce["default"])(items).call(items, function (result, item) {
635
683
  return (0, _parseFloat2["default"])(String(item[key] || 0)) + result;
@@ -667,11 +715,11 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
667
715
  return item.checked;
668
716
  });
669
717
  var countItems = checkedItems.length ? checkedItems : items;
670
- var totalItems = (0, _map["default"])(totalCols).call(totalCols, function (_ref15) {
671
- var title = _ref15.title,
672
- key = _ref15.key,
673
- _ref15$props = _ref15.props,
674
- props = _ref15$props === void 0 ? {} : _ref15$props;
718
+ var totalItems = (0, _map["default"])(totalCols).call(totalCols, function (_ref16) {
719
+ var title = _ref16.title,
720
+ key = _ref16.key,
721
+ _ref16$props = _ref16.props,
722
+ props = _ref16$props === void 0 ? {} : _ref16$props;
675
723
  var value = (0, _reduce["default"])(countItems).call(countItems, function (result, item) {
676
724
  return (0, _parseFloat2["default"])((result + Number(item[key] || 0)).toFixed(props.precision || 6));
677
725
  }, 0);
@@ -689,9 +737,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
689
737
  style: {
690
738
  marginRight: "15px"
691
739
  }
692
- }, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), (0, _map["default"])(totalItems).call(totalItems, function (_ref16, index) {
693
- var title = _ref16.title,
694
- value = _ref16.value;
740
+ }, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), (0, _map["default"])(totalItems).call(totalItems, function (_ref17, index) {
741
+ var title = _ref17.title,
742
+ value = _ref17.value;
695
743
  return /*#__PURE__*/_react["default"].createElement("span", {
696
744
  key: index,
697
745
  style: {
@@ -733,7 +781,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
733
781
  x: true
734
782
  },
735
783
  onChange: _this.onTableChange,
736
- onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
784
+ onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick, items),
737
785
  components: dragSort ? {
738
786
  body: {
739
787
  row: _DragSortRow["default"]
@@ -10,7 +10,7 @@ var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/in
10
10
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
11
11
  var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
12
12
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
13
- var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
13
+ var _sliceInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
14
14
  var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
15
15
  var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
16
16
  var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
@@ -29,10 +29,12 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
29
29
  var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
30
30
  var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
31
31
  var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
32
+ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
32
33
  var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
33
34
  var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
34
35
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
35
36
  var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectDestructuringEmpty"));
37
+ var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
36
38
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
37
39
  var _switch = _interopRequireDefault(require("antd/lib/switch"));
38
40
  var _button = _interopRequireDefault(require("antd/lib/button"));
@@ -60,7 +62,7 @@ var _excluded = ["onRowClick"];
60
62
  function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
61
63
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
62
64
  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; } } }; }
63
- function _unsupportedIterableToArray(o, minLen) { var _context20; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context20 = Object.prototype.toString.call(o)).call(_context20, 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); }
65
+ function _unsupportedIterableToArray(o, minLen) { var _context20; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context20 = Object.prototype.toString.call(o)).call(_context20, 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); }
64
66
  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; }
65
67
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty2(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
66
68
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context18, _context19; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context18 = ownKeys(Object(t), !0)).call(_context18, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context19 = ownKeys(Object(t))).call(_context19, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -643,18 +645,56 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
643
645
  var _context11;
644
646
  return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
645
647
  });
646
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
648
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "tooltip", function (key, index, item, _ref18) {
649
+ var tipLen = _ref18.tooltip,
650
+ options = _ref18.options,
651
+ width = _ref18.width;
652
+ var text = _this.getText(item[key], options);
653
+ var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
654
+ return needTip ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
655
+ title: text
656
+ }, /*#__PURE__*/_react["default"].createElement("div", {
657
+ style: {
658
+ minHeight: '20px',
659
+ minWidth: '10px',
660
+ maxWidth: "".concat(width - 16, "px"),
661
+ overflow: 'hidden',
662
+ textOverflow: 'ellipsis',
663
+ display: '-webkit-box',
664
+ WebkitLineClamp: 2,
665
+ WebkitBoxOrient: "vertical",
666
+ whiteSpace: 'break-spaces'
667
+ },
668
+ title: true
669
+ }, (0, _slice["default"])(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/_react["default"].createElement("div", {
670
+ style: {
671
+ minHeight: '20px',
672
+ minWidth: '10px',
673
+ maxWidth: "".concat(width - 16, "px"),
674
+ overflow: 'hidden',
675
+ textOverflow: 'ellipsis',
676
+ display: '-webkit-box',
677
+ WebkitLineClamp: 2,
678
+ WebkitBoxOrient: "vertical",
679
+ whiteSpace: 'break-spaces'
680
+ },
681
+ title: true
682
+ }, (0, _isArray["default"])(text) ? text.join(',') : text, " ");
683
+ });
684
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols, items) {
647
685
  var _context12;
648
686
  var readonly = _this.props.readonly;
649
687
  return (0, _map["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
650
688
  return !col.hide;
651
- })).call(_context12, function (_ref18, index) {
689
+ })).call(_context12, function (_ref19, index) {
652
690
  var _context13;
653
- var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref18), _ref18));
691
+ var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref19), _ref19));
654
692
  col.className = _this.getColumnClassName(col);
655
693
  col.title = _this.getColumnTitle(col);
656
694
  col.dataIndex = col.key;
657
- col.width = col.width ? col.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120;
695
+ !_this.props.autoAdjustingWidth && (col.width = col.width ? col.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120);
696
+ // col.width = col.width ? col.width : (['index','checked'].includes(col.key) ? 70 : (col.type === 'img' ? 200 : 120));
697
+
658
698
  // const {props = {}} =
659
699
  // const {edit = false} = props
660
700
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
@@ -676,6 +716,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
676
716
  return text ? "\uFFE5".concat(text.toFixed(2)) : text;
677
717
  }
678
718
  };
719
+ } else if (col.tooltip) {
720
+ col.render = function (text, record, index) {
721
+ return _this.tooltip(col.key, index, items[index], col);
722
+ };
679
723
  }
680
724
  return col;
681
725
  });
@@ -691,11 +735,11 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
691
735
  });
692
736
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
693
737
  return (0, _map["default"])(items).call(items, function (item, index) {
694
- return (0, _reduce["default"])(cols).call(cols, function (result, _ref19) {
738
+ return (0, _reduce["default"])(cols).call(cols, function (result, _ref20) {
695
739
  var _context14, _context15;
696
- var key = _ref19.key,
697
- type = _ref19.type,
698
- options = _ref19.options;
740
+ var key = _ref20.key,
741
+ type = _ref20.type,
742
+ options = _ref20.options;
699
743
  if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context14 = item.isReadonly).call(_context14, key)) || (0, _includes["default"])(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
700
744
  result[key] = item[key];
701
745
  } else {
@@ -852,29 +896,47 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
852
896
  _this$props4$expanded = _this$props4.expandedRowRender,
853
897
  expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
854
898
  _this$props4$onExpand = _this$props4.onExpand,
855
- onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
899
+ onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand,
900
+ _this$props4$expanded2 = _this$props4.expandedRowRenderKeepScroll,
901
+ expandedRowRenderKeepScroll = _this$props4$expanded2 === void 0 ? false : _this$props4$expanded2,
902
+ _this$props4$autoAdju = _this$props4.autoAdjustingWidth,
903
+ autoAdjustingWidth = _this$props4$autoAdju === void 0 ? false : _this$props4$autoAdju;
856
904
  var widthX = (0, _reduce["default"])(_context16 = (0, _filter["default"])(cols).call(cols, function (col) {
857
905
  return !col.hide;
858
906
  })).call(_context16, function (width, item) {
859
907
  var _context17;
860
908
  return width += item.width ? item.width : (0, _includes["default"])(_context17 = ['index', 'checked']).call(_context17, item.key) ? 70 : item.type === 'img' ? 200 : 120;
861
909
  }, 0);
862
- var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
863
- expandedRowRender: expandedRowRender
864
- } : {
865
- scroll: {
866
- x: (0, _some["default"])(cols).call(cols, function (item) {
867
- return !_helper["default"].isEmpty2(item.fixed);
868
- }) ? widthX : true,
869
- y: maxHeight
870
- }
871
- };
910
+ var scrollProps = {};
911
+ if (expandedRowRenderKeepScroll) {
912
+ //拥有expandedRowRender时候保持scroll属性
913
+ scrollProps = {
914
+ expandedRowRender: expandedRowRender,
915
+ scroll: {
916
+ x: (0, _some["default"])(cols).call(cols, function (item) {
917
+ return !_helper["default"].isEmpty2(item.fixed);
918
+ }) ? widthX : true,
919
+ y: maxHeight
920
+ }
921
+ };
922
+ } else {
923
+ scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
924
+ expandedRowRender: expandedRowRender
925
+ } : {
926
+ scroll: {
927
+ x: (0, _some["default"])(cols).call(cols, function (item) {
928
+ return !_helper["default"].isEmpty2(item.fixed);
929
+ }) ? widthX : true,
930
+ y: maxHeight
931
+ }
932
+ };
933
+ }
872
934
  var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
873
935
  onRowClick = _this$getPropsByCheck.onRowClick,
874
936
  extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
875
- return _objectSpread(_objectSpread({
937
+ var props = _objectSpread(_objectSpread({
876
938
  className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
877
- columns: _this.getColumns(cols),
939
+ columns: _this.getColumns(cols, items),
878
940
  dataSource: _this.getDataSource(items, cols),
879
941
  style: (0, _assign["default"])({}, {
880
942
  whiteSpace: 'nowrap'
@@ -894,6 +956,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
894
956
  }, _this.getPropsByCheckbox()), {}, {
895
957
  onExpand: onExpand
896
958
  }, scrollProps);
959
+ autoAdjustingWidth && (props.scroll = {
960
+ x: true
961
+ });
962
+ return props;
897
963
  });
898
964
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setScroll", function () {
899
965
  if (_this.props.maxHeight && _this.props.items.length) {
@@ -939,6 +1005,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
939
1005
  footer: _propTypes["default"].func,
940
1006
  callback: _propTypes["default"].shape(CallbackType),
941
1007
  isEmphasized: _propTypes["default"].bool,
942
- dragSort: _propTypes["default"].bool
1008
+ dragSort: _propTypes["default"].bool,
1009
+ autoAdjustingWidth: _propTypes["default"].bool //列宽度随内容自适应
943
1010
  });
944
1011
  var _default = exports["default"] = SuperTable2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud-b2b",
3
- "version": "1.1.65",
3
+ "version": "1.1.67",
4
4
  "description": "A react component library dependent antd",
5
5
  "keywords": [
6
6
  "react",