cloud-b2b 1.1.8 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
11
11
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
12
12
  import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
13
13
  import _Table from "antd/es/table";
14
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
14
15
  import _extends from "@babel/runtime-corejs3/helpers/extends";
15
16
  import _Switch from "antd/es/switch";
16
17
  import _Button from "antd/es/button";
@@ -23,16 +24,17 @@ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
23
24
  import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
24
25
  import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
25
26
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
27
+ var _excluded = ["onRowClick"];
26
28
 
27
29
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
28
30
 
29
- function _unsupportedIterableToArray(o, minLen) { var _context13; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context13 = Object.prototype.toString.call(o)).call(_context13, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
31
+ function _unsupportedIterableToArray(o, minLen) { var _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 _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context11 = ownKeys(Object(source), !0)).call(_context11, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context12 = ownKeys(Object(source))).call(_context12, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
37
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _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); }; }
@@ -50,18 +53,19 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
50
53
  import React from 'react';
51
54
  import PropTypes from 'prop-types';
52
55
  import ReactDOM from 'react-dom';
53
- import { getTitle } from '../Control';
56
+ import Control, { getTitle } from '../Control';
54
57
  import SuperTableCell from './SuperTableCell';
55
58
  import fixed from '../SuperTable/fixed';
56
59
  import SuperToolbar from '../SuperToolbar';
57
60
  import variables from '../variables';
58
- import helper from '../helper';
61
+ import helper, { getObjectExclude } from '../helper';
62
+ import DragSortRow from "../SuperTable/DragSortRow";
59
63
  var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
60
64
  'selectText', //存储title
61
65
  'search', 'searchText', 'selectSearch', //多选下拉搜索
62
66
  'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
63
- 'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
64
- ];
67
+ 'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
68
+ 'uploadImg'];
65
69
  /**
66
70
  * key:标识所在列,在一个表格中必须唯一
67
71
  * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
@@ -95,7 +99,8 @@ var ColType = {
95
99
  * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
96
100
  * onAdd:点击+号时触发,原型为function(keyName)
97
101
  * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
98
- * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
102
+ * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
103
+ * onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
99
104
  */
100
105
 
101
106
  var CallbackType = {
@@ -107,7 +112,14 @@ var CallbackType = {
107
112
  onLink: PropTypes.func,
108
113
  onAdd: PropTypes.func,
109
114
  onRenderCustom: PropTypes.func,
110
- onToolbar: PropTypes.func
115
+ onToolbar: PropTypes.func,
116
+ onDoubleClick: PropTypes.func,
117
+ onTableFileChange: PropTypes.func,
118
+ buildSuperUploadProps: PropTypes.func,
119
+ //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
120
+ onImgTileClick: PropTypes.func,
121
+ //点击img类型标题触发事件
122
+ onMoveRow: PropTypes.func
111
123
  };
112
124
  /**
113
125
  * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
@@ -199,6 +211,31 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
199
211
  };
200
212
  });
201
213
 
214
+ _defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
215
+ return function () {
216
+ var _ref8 = _this.props.callback || {},
217
+ onDoubleClick = _ref8.onDoubleClick;
218
+
219
+ onDoubleClick && onDoubleClick(key, value);
220
+ };
221
+ });
222
+
223
+ _defineProperty(_assertThisInitialized(_this), "onImgTileClick", function (col, value, rowIndex) {
224
+ return function () {
225
+ var _ref9 = _this.props.callback || {},
226
+ onImgTileClick = _ref9.onImgTileClick;
227
+
228
+ onImgTileClick && onImgTileClick(col, value, rowIndex);
229
+ };
230
+ });
231
+
232
+ _defineProperty(_assertThisInitialized(_this), "onMoveRow", function (dragIndex, targetIndex) {
233
+ var _ref10 = _this.props.callback || {},
234
+ onMoveRow = _ref10.onMoveRow;
235
+
236
+ onMoveRow && onMoveRow(dragIndex, targetIndex);
237
+ });
238
+
202
239
  _defineProperty(_assertThisInitialized(_this), "closeValid", function () {
203
240
  var _this$props = _this.props,
204
241
  valid = _this$props.valid,
@@ -338,8 +375,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
338
375
  var split = index2 === list.length - 1 ? '' : ',';
339
376
 
340
377
  var onClick = function onClick() {
341
- var _ref8 = _this.props.callback || {},
342
- onLink = _ref8.onLink;
378
+ var _ref11 = _this.props.callback || {},
379
+ onLink = _ref11.onLink;
343
380
 
344
381
  onLink && onLink(col.key, index, item2);
345
382
  };
@@ -353,8 +390,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
353
390
  var title = typeof col.link === 'string' ? col.link : value;
354
391
 
355
392
  var onClick = function onClick() {
356
- var _ref9 = _this.props.callback || {},
357
- onLink = _ref9.onLink;
393
+ var _ref12 = _this.props.callback || {},
394
+ onLink = _ref12.onLink;
358
395
 
359
396
  onLink && onLink(col.key, index, record);
360
397
  };
@@ -371,13 +408,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
371
408
 
372
409
  _defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
373
410
  return function (value, record, index) {
374
- var _context3, _context4, _context5, _context6;
411
+ var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
375
412
 
376
413
  var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
377
414
 
378
415
  if (!realType) {
379
416
  return /*#__PURE__*/React.createElement("div", {
417
+ onDoubleClick: _this.onDoubleClick(col.key, record.key),
380
418
  style: {
419
+ minHeight: '20px',
420
+ minWidth: '100px',
381
421
  maxWidth: "".concat(col.width - 16, "px"),
382
422
  overflow: 'hidden',
383
423
  textOverflow: 'ellipsis'
@@ -421,12 +461,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
421
461
  }
422
462
 
423
463
  case 'switch':
424
- return value === 'noneDisplay' ? /*#__PURE__*/React.createElement("div", null) : /*#__PURE__*/React.createElement(_Switch, {
464
+ return typeof value === 'string' ? /*#__PURE__*/React.createElement("div", null, value) : /*#__PURE__*/React.createElement(_Switch, {
425
465
  checkedChildren: col.props.checkedChildren || '',
426
466
  unCheckedChildren: col.props.unCheckedChildren || '',
427
467
  onChange: _this.onSwitch(col.key, record.key),
428
468
  size: "default",
429
- checked: value || false,
469
+ checked: typeof value === 'number' ? Boolean(value) : value || false,
430
470
  disabled: !(record._isEdit === true)
431
471
  });
432
472
 
@@ -447,20 +487,52 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
447
487
 
448
488
  case 'img':
449
489
  return value ? typeof value === 'string' ? /*#__PURE__*/React.createElement("img", {
450
- src: value,
490
+ src: _includesInstanceProperty(value).call(value, 'http') ? value : _concatInstanceProperty(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
451
491
  style: {
452
492
  width: '80px',
453
493
  height: '80px'
454
494
  }
455
495
  }) : /*#__PURE__*/React.createElement("div", {
456
- role: 'imgBox'
496
+ role: 'imgBox',
497
+ style: {
498
+ maxWidth: "".concat(col.width, "px")
499
+ }
457
500
  }, /*#__PURE__*/React.createElement("img", {
458
- 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),
459
502
  style: {
460
503
  width: '80px',
461
504
  height: '80px'
462
505
  }
463
- }), /*#__PURE__*/React.createElement("span", null, value.title)) : /*#__PURE__*/React.createElement("div", null);
506
+ }), /*#__PURE__*/React.createElement("div", {
507
+ style: {
508
+ display: 'inline-block'
509
+ }
510
+ }, /*#__PURE__*/React.createElement("span", {
511
+ style: {
512
+ display: 'block',
513
+ whiteSpace: 'nowrap',
514
+ overflow: 'hidden',
515
+ textOverflow: 'ellipsis',
516
+ width: '80px'
517
+ },
518
+ onClick: _this.onImgTileClick(col, record, index)
519
+ }, value.title), helper.isEmpty2(value.remark) ? null : /*#__PURE__*/React.createElement("span", {
520
+ style: {
521
+ color: '#333'
522
+ }
523
+ }, value.remark))) : /*#__PURE__*/React.createElement("div", null);
524
+
525
+ case 'uploadImg':
526
+ var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
527
+
528
+ var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
529
+ onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
530
+ type: col.type
531
+ }, col.props), _this.props), commonProps), {}, {
532
+ value: _this.props.items[index][col.key]
533
+ });
534
+
535
+ return /*#__PURE__*/React.createElement(Control, uploadProps);
464
536
 
465
537
  default:
466
538
  return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
@@ -509,12 +581,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
509
581
  }
510
582
  });
511
583
 
512
- _defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref10) {
513
- var required = _ref10.required,
514
- title = _ref10.title,
515
- type = _ref10.type,
516
- key = _ref10.key,
517
- showAdd = _ref10.showAdd;
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;
518
590
 
519
591
  if (type === 'checkbox') {
520
592
  var status = _this.getCheckedStatus(key);
@@ -530,9 +602,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
530
602
  }
531
603
  });
532
604
 
533
- _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref11) {
534
- var type = _ref11.type,
535
- align = _ref11.align;
605
+ _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref14) {
606
+ var type = _ref14.type,
607
+ align = _ref14.align;
536
608
 
537
609
  if (type === 'index' || type === 'checkbox') {
538
610
  return 'ant-table-selection-column';
@@ -542,24 +614,26 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
542
614
  });
543
615
 
544
616
  _defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
545
- var _context7;
617
+ var _context11;
546
618
 
547
- return !_includesInstanceProperty(_context7 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar']).call(_context7, type);
619
+ return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context11, type);
548
620
  });
549
621
 
550
622
  _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
551
- var _context8;
623
+ var _context12;
552
624
 
553
625
  var readonly = _this.props.readonly;
554
- return _mapInstanceProperty(_context8 = _filterInstanceProperty(cols).call(cols, function (col) {
626
+ return _mapInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
555
627
  return !col.hide;
556
- })).call(_context8, function (_ref12, index) {
557
- var col = _extends({}, _ref12);
628
+ })).call(_context12, function (_ref15, index) {
629
+ var _context13;
630
+
631
+ var col = _extends({}, _ref15);
558
632
 
559
633
  col.className = _this.getColumnClassName(col);
560
634
  col.title = _this.getColumnTitle(col);
561
635
  col.dataIndex = col.key;
562
- col.width = col.width || 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;
563
637
  // const {edit = false} = props
564
638
  // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
565
639
  // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
@@ -580,14 +654,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
580
654
 
581
655
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
582
656
  return _mapInstanceProperty(items).call(items, function (item, index) {
583
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref13) {
584
- var _context9;
657
+ return _reduceInstanceProperty(cols).call(cols, function (result, _ref16) {
658
+ var _context14;
585
659
 
586
- var key = _ref13.key,
587
- type = _ref13.type,
588
- options = _ref13.options;
660
+ var key = _ref16.key,
661
+ type = _ref16.type,
662
+ options = _ref16.options;
589
663
 
590
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context9 = item.isReadonly).call(_context9, key))) {
664
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context14 = item.isReadonly).call(_context14, key))) {
591
665
  result[key] = item[key];
592
666
  } else {
593
667
  result[key] = getTitle(item[key], options);
@@ -620,38 +694,172 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
620
694
  };
621
695
  });
622
696
 
623
- _defineProperty(_assertThisInitialized(_this), "getProps", function () {
624
- var _context10;
697
+ _defineProperty(_assertThisInitialized(_this), "getSelectedRowKeys", function (items) {
698
+ return _reduceInstanceProperty(items).call(items, function (result, item, index) {
699
+ item.checked && result.push(index);
700
+ return result;
701
+ }, []);
702
+ });
625
703
 
704
+ _defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox2", function (items) {
626
705
  var _this$props3 = _this.props,
627
- cols = _this$props3.cols,
628
- items = _this$props3.items,
629
- _this$props3$style = _this$props3.style,
630
- style = _this$props3$style === void 0 ? {} : _this$props3$style,
631
- _this$props3$footer = _this$props3.footer,
632
- footer = _this$props3$footer === void 0 ? null : _this$props3$footer,
633
- _this$props3$paginati = _this$props3.pagination,
634
- 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,
635
713
  _this$props3$isEmphas = _this$props3.isEmphasized,
636
714
  isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
637
- maxHeight = _this$props3.maxHeight,
638
- _this$props3$expanded = _this$props3.expandedRowRender,
639
- expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
640
- _this$props3$onExpand = _this$props3.onExpand,
641
- 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
+ }
642
731
 
643
- var widthX = _reduceInstanceProperty(_context10 = _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) {
644
841
  return !col.hide;
645
- })).call(_context10, function (width, item) {
646
- return width += item.width ? item.width : 120;
842
+ })).call(_context15, function (width, item) {
843
+ var _context16;
844
+
845
+ return width += item.width ? item.width : _includesInstanceProperty(_context16 = ['index', 'checked']).call(_context16, item.key) ? 70 : item.type === 'img' ? 200 : 120;
647
846
  }, 0);
648
847
 
649
- var scrollProps = !helper.isEmpty2(expandedRowRender) ? {} : {
848
+ var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
849
+ expandedRowRender: expandedRowRender
850
+ } : {
650
851
  scroll: {
651
- x: widthX,
852
+ x: _someInstanceProperty(cols).call(cols, function (item) {
853
+ return !helper.isEmpty2(item.fixed);
854
+ }) ? widthX : true,
652
855
  y: maxHeight
653
856
  }
654
857
  };
858
+
859
+ var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
860
+ onRowClick = _this$getPropsByCheck.onRowClick,
861
+ extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
862
+
655
863
  return _objectSpread(_objectSpread({
656
864
  className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
657
865
  columns: _this.getColumns(cols),
@@ -662,11 +870,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
662
870
  size: 'small',
663
871
  pagination: pagination,
664
872
  footer: footer,
873
+ onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
874
+ components: dragSort ? {
875
+ body: {
876
+ row: DragSortRow
877
+ }
878
+ } : {},
665
879
  locale: _this.props.emptyText ? {
666
880
  emptyText: _this.props.emptyText
667
881
  } : null
668
882
  }, _this.getPropsByCheckbox()), {}, {
669
- expandedRowRender: expandedRowRender,
670
883
  onExpand: onExpand
671
884
  }, scrollProps);
672
885
  });
@@ -718,7 +931,8 @@ _defineProperty(SuperTable2, "propTypes", {
718
931
  emptyText: PropTypes.string,
719
932
  footer: PropTypes.func,
720
933
  callback: PropTypes.shape(CallbackType),
721
- isEmphasized: PropTypes.bool
934
+ isEmphasized: PropTypes.bool,
935
+ dragSort: PropTypes.bool
722
936
  });
723
937
 
724
938
  export default SuperTable2;
@@ -25,7 +25,7 @@ import PropTypes from 'prop-types';
25
25
  import helper from '../helper';
26
26
  import Title from '../Title';
27
27
  import variables from '../variables';
28
- var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF'];
28
+ var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
29
29
  var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
30
30
 
31
31
  var propTypes = {
@@ -38,7 +38,7 @@ var propTypes = {
38
38
  required: PropTypes.bool,
39
39
  //是否必须上传,默认false
40
40
  listType: PropTypes.oneOf[('text', 'picture', 'picture-card')],
41
- //上传列表的内建样式,支持三种,默认text
41
+ //上传列表的内建样式,支持三种,默认picture-card
42
42
  readonly: PropTypes.bool,
43
43
  //所在页面是否只读,默认false
44
44
  multiple: PropTypes.bool,
@@ -1,35 +1,35 @@
1
- @import '../variables';
2
-
3
- .@{cloudlink-prefix}-title {
4
- > *:first-child {
5
- display: inline-block;
6
- color: @brand-primary;
7
- line-height: 1.2;
8
-
9
- &[data-border='true'] {
10
- padding: 0 5px;
11
- border-left: @brand-primary solid 3px;
12
- }
13
-
14
- &[data-fold='true'] {
15
- cursor: pointer;
16
- margin: 8px 0;
17
- }
18
-
19
- &[data-required='true'] {
20
- &::after {
21
- display: inline-block;
22
- margin-left: 4px;
23
- color: #f5222d;
24
- font-size: 12px;
25
- font-family: SimSun, sans-serif;
26
- line-height: 1;
27
- content: '*';
28
- }
29
- }
30
- }
31
-
32
- > [role = 'toolbar'] {
33
- display: inline-block;
34
- }
35
- }
1
+ @import '../variables';
2
+
3
+ .@{cloudlink-prefix}-title {
4
+ > *:first-child {
5
+ display: inline-block;
6
+ color: @brand-primary;
7
+ line-height: 1.2;
8
+
9
+ &[data-border='true'] {
10
+ padding: 0 5px;
11
+ border-left: @brand-primary solid 3px;
12
+ }
13
+
14
+ &[data-fold='true'] {
15
+ cursor: pointer;
16
+ margin: 8px 0;
17
+ }
18
+
19
+ &[data-required='true'] {
20
+ &::after {
21
+ display: inline-block;
22
+ margin-left: 4px;
23
+ color: #f5222d;
24
+ font-size: 12px;
25
+ font-family: SimSun, sans-serif;
26
+ line-height: 1;
27
+ content: '*';
28
+ }
29
+ }
30
+ }
31
+
32
+ > [role = 'toolbar'] {
33
+ display: inline-block;
34
+ }
35
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "name": "Title",
3
- "version": "0.0.0",
4
- "private": true,
5
- "main": "./Title.js"
6
- }
1
+ {
2
+ "name": "Title",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "main": "./Title.js"
6
+ }