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.
- package/es/CodeInput/CodeInput.js +3 -5
- package/es/SuperForm2/SuperForm.js +31 -8
- package/es/SuperTable2/SuperTable2.js +277 -63
- package/es/SuperUpload/SuperUpload.js +2 -2
- package/es/Title/Title.less +35 -35
- package/es/Title/package.json +6 -6
- package/lib/CodeInput/CodeInput.js +3 -5
- package/lib/SuperForm2/SuperForm.js +31 -8
- package/lib/SuperTable2/SuperTable2.js +284 -66
- package/lib/SuperUpload/SuperUpload.js +2 -2
- package/lib/Title/Title.less +35 -35
- package/lib/Title/package.json +6 -6
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
|
|
3
5
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
4
6
|
|
|
5
7
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
@@ -28,6 +30,8 @@ var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-me
|
|
|
28
30
|
|
|
29
31
|
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
30
32
|
|
|
33
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
34
|
+
|
|
31
35
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
32
36
|
|
|
33
37
|
_Object$defineProperty(exports, "__esModule", {
|
|
@@ -36,6 +40,10 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
36
40
|
|
|
37
41
|
exports["default"] = void 0;
|
|
38
42
|
|
|
43
|
+
var _table = _interopRequireDefault(require("antd/lib/table"));
|
|
44
|
+
|
|
45
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
46
|
+
|
|
39
47
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
40
48
|
|
|
41
49
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
@@ -50,9 +58,9 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
50
58
|
|
|
51
59
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
52
60
|
|
|
53
|
-
var
|
|
61
|
+
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
54
62
|
|
|
55
|
-
var
|
|
63
|
+
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
56
64
|
|
|
57
65
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
58
66
|
|
|
@@ -84,7 +92,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
84
92
|
|
|
85
93
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
86
94
|
|
|
87
|
-
var _Control = require("../Control");
|
|
95
|
+
var _Control = _interopRequireWildcard(require("../Control"));
|
|
88
96
|
|
|
89
97
|
var _SuperTableCell = _interopRequireDefault(require("./SuperTableCell"));
|
|
90
98
|
|
|
@@ -94,17 +102,25 @@ var _SuperToolbar = _interopRequireDefault(require("../SuperToolbar"));
|
|
|
94
102
|
|
|
95
103
|
var _variables = _interopRequireDefault(require("../variables"));
|
|
96
104
|
|
|
97
|
-
var _helper =
|
|
105
|
+
var _helper = _interopRequireWildcard(require("../helper"));
|
|
106
|
+
|
|
107
|
+
var _DragSortRow = _interopRequireDefault(require("../SuperTable/DragSortRow"));
|
|
108
|
+
|
|
109
|
+
var _excluded = ["onRowClick"];
|
|
110
|
+
|
|
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); }
|
|
112
|
+
|
|
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; }
|
|
98
114
|
|
|
99
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; } } }; }
|
|
100
116
|
|
|
101
|
-
function _unsupportedIterableToArray(o, minLen) { var
|
|
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); }
|
|
102
118
|
|
|
103
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; }
|
|
104
120
|
|
|
105
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; }
|
|
106
122
|
|
|
107
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
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; }
|
|
108
124
|
|
|
109
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); }; }
|
|
110
126
|
|
|
@@ -114,8 +130,8 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //
|
|
|
114
130
|
'selectText', //存储title
|
|
115
131
|
'search', 'searchText', 'selectSearch', //多选下拉搜索
|
|
116
132
|
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
|
|
117
|
-
'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
118
|
-
];
|
|
133
|
+
'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
134
|
+
'uploadImg'];
|
|
119
135
|
/**
|
|
120
136
|
* key:标识所在列,在一个表格中必须唯一
|
|
121
137
|
* title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
|
|
@@ -149,7 +165,8 @@ var ColType = {
|
|
|
149
165
|
* onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
|
|
150
166
|
* onAdd:点击+号时触发,原型为function(keyName)
|
|
151
167
|
* onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
|
|
152
|
-
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
|
|
168
|
+
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
|
|
169
|
+
* onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
|
|
153
170
|
*/
|
|
154
171
|
|
|
155
172
|
var CallbackType = {
|
|
@@ -161,7 +178,14 @@ var CallbackType = {
|
|
|
161
178
|
onLink: _propTypes["default"].func,
|
|
162
179
|
onAdd: _propTypes["default"].func,
|
|
163
180
|
onRenderCustom: _propTypes["default"].func,
|
|
164
|
-
onToolbar: _propTypes["default"].func
|
|
181
|
+
onToolbar: _propTypes["default"].func,
|
|
182
|
+
onDoubleClick: _propTypes["default"].func,
|
|
183
|
+
onTableFileChange: _propTypes["default"].func,
|
|
184
|
+
buildSuperUploadProps: _propTypes["default"].func,
|
|
185
|
+
//构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
|
|
186
|
+
onImgTileClick: _propTypes["default"].func,
|
|
187
|
+
//点击img类型标题触发事件
|
|
188
|
+
onMoveRow: _propTypes["default"].func
|
|
165
189
|
};
|
|
166
190
|
/**
|
|
167
191
|
* base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
|
|
@@ -245,6 +269,28 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
245
269
|
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
246
270
|
};
|
|
247
271
|
});
|
|
272
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (key, value) {
|
|
273
|
+
return function () {
|
|
274
|
+
var _ref8 = _this.props.callback || {},
|
|
275
|
+
onDoubleClick = _ref8.onDoubleClick;
|
|
276
|
+
|
|
277
|
+
onDoubleClick && onDoubleClick(key, value);
|
|
278
|
+
};
|
|
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
|
+
});
|
|
248
294
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
|
|
249
295
|
var _this$props = _this.props,
|
|
250
296
|
valid = _this$props.valid,
|
|
@@ -380,8 +426,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
380
426
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
381
427
|
|
|
382
428
|
var onClick = function onClick() {
|
|
383
|
-
var
|
|
384
|
-
onLink =
|
|
429
|
+
var _ref11 = _this.props.callback || {},
|
|
430
|
+
onLink = _ref11.onLink;
|
|
385
431
|
|
|
386
432
|
onLink && onLink(col.key, index, item2);
|
|
387
433
|
};
|
|
@@ -395,8 +441,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
395
441
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
396
442
|
|
|
397
443
|
var onClick = function onClick() {
|
|
398
|
-
var
|
|
399
|
-
onLink =
|
|
444
|
+
var _ref12 = _this.props.callback || {},
|
|
445
|
+
onLink = _ref12.onLink;
|
|
400
446
|
|
|
401
447
|
onLink && onLink(col.key, index, record);
|
|
402
448
|
};
|
|
@@ -411,13 +457,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
411
457
|
});
|
|
412
458
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
|
|
413
459
|
return function (value, record, index) {
|
|
414
|
-
var _context3, _context4, _context5, _context6;
|
|
460
|
+
var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
|
|
415
461
|
|
|
416
462
|
var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
|
|
417
463
|
|
|
418
464
|
if (!realType) {
|
|
419
465
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
466
|
+
onDoubleClick: _this.onDoubleClick(col.key, record.key),
|
|
420
467
|
style: {
|
|
468
|
+
minHeight: '20px',
|
|
469
|
+
minWidth: '100px',
|
|
421
470
|
maxWidth: "".concat(col.width - 16, "px"),
|
|
422
471
|
overflow: 'hidden',
|
|
423
472
|
textOverflow: 'ellipsis'
|
|
@@ -461,12 +510,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
461
510
|
}
|
|
462
511
|
|
|
463
512
|
case 'switch':
|
|
464
|
-
return value === '
|
|
513
|
+
return typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("div", null, value) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
465
514
|
checkedChildren: col.props.checkedChildren || '',
|
|
466
515
|
unCheckedChildren: col.props.unCheckedChildren || '',
|
|
467
516
|
onChange: _this.onSwitch(col.key, record.key),
|
|
468
517
|
size: "default",
|
|
469
|
-
checked: value || false,
|
|
518
|
+
checked: typeof value === 'number' ? Boolean(value) : value || false,
|
|
470
519
|
disabled: !(record._isEdit === true)
|
|
471
520
|
});
|
|
472
521
|
|
|
@@ -487,20 +536,52 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
487
536
|
|
|
488
537
|
case 'img':
|
|
489
538
|
return value ? typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
490
|
-
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),
|
|
491
540
|
style: {
|
|
492
541
|
width: '80px',
|
|
493
542
|
height: '80px'
|
|
494
543
|
}
|
|
495
544
|
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
496
|
-
role: 'imgBox'
|
|
545
|
+
role: 'imgBox',
|
|
546
|
+
style: {
|
|
547
|
+
maxWidth: "".concat(col.width, "px")
|
|
548
|
+
}
|
|
497
549
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
498
|
-
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),
|
|
499
551
|
style: {
|
|
500
552
|
width: '80px',
|
|
501
553
|
height: '80px'
|
|
502
554
|
}
|
|
503
|
-
}), /*#__PURE__*/_react["default"].createElement("
|
|
555
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
556
|
+
style: {
|
|
557
|
+
display: 'inline-block'
|
|
558
|
+
}
|
|
559
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
560
|
+
style: {
|
|
561
|
+
display: 'block',
|
|
562
|
+
whiteSpace: 'nowrap',
|
|
563
|
+
overflow: 'hidden',
|
|
564
|
+
textOverflow: 'ellipsis',
|
|
565
|
+
width: '80px'
|
|
566
|
+
},
|
|
567
|
+
onClick: _this.onImgTileClick(col, record, index)
|
|
568
|
+
}, value.title), _helper["default"].isEmpty2(value.remark) ? null : /*#__PURE__*/_react["default"].createElement("span", {
|
|
569
|
+
style: {
|
|
570
|
+
color: '#333'
|
|
571
|
+
}
|
|
572
|
+
}, value.remark))) : /*#__PURE__*/_react["default"].createElement("div", null);
|
|
573
|
+
|
|
574
|
+
case 'uploadImg':
|
|
575
|
+
var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
|
|
576
|
+
|
|
577
|
+
var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
578
|
+
onFileChange: _this.props.callback.onTableFileChange ? (0, _bind["default"])(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
|
|
579
|
+
type: col.type
|
|
580
|
+
}, col.props), _this.props), commonProps), {}, {
|
|
581
|
+
value: _this.props.items[index][col.key]
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
return /*#__PURE__*/_react["default"].createElement(_Control["default"], uploadProps);
|
|
504
585
|
|
|
505
586
|
default:
|
|
506
587
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -546,12 +627,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
546
627
|
return null;
|
|
547
628
|
}
|
|
548
629
|
});
|
|
549
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (
|
|
550
|
-
var required =
|
|
551
|
-
title =
|
|
552
|
-
type =
|
|
553
|
-
key =
|
|
554
|
-
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;
|
|
555
636
|
|
|
556
637
|
if (type === 'checkbox') {
|
|
557
638
|
var status = _this.getCheckedStatus(key);
|
|
@@ -566,9 +647,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
566
647
|
}, title, _this.toAdd(key, showAdd));
|
|
567
648
|
}
|
|
568
649
|
});
|
|
569
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (
|
|
570
|
-
var type =
|
|
571
|
-
align =
|
|
650
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref14) {
|
|
651
|
+
var type = _ref14.type,
|
|
652
|
+
align = _ref14.align;
|
|
572
653
|
|
|
573
654
|
if (type === 'index' || type === 'checkbox') {
|
|
574
655
|
return 'ant-table-selection-column';
|
|
@@ -577,22 +658,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
577
658
|
}
|
|
578
659
|
});
|
|
579
660
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
|
|
580
|
-
var
|
|
661
|
+
var _context11;
|
|
581
662
|
|
|
582
|
-
return !(0, _includes["default"])(
|
|
663
|
+
return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context11, type);
|
|
583
664
|
});
|
|
584
665
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
|
|
585
|
-
var
|
|
666
|
+
var _context12;
|
|
586
667
|
|
|
587
668
|
var readonly = _this.props.readonly;
|
|
588
|
-
return (0, _map["default"])(
|
|
669
|
+
return (0, _map["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
589
670
|
return !col.hide;
|
|
590
|
-
})).call(
|
|
591
|
-
var
|
|
671
|
+
})).call(_context12, function (_ref15, index) {
|
|
672
|
+
var _context13;
|
|
673
|
+
|
|
674
|
+
var col = (0, _extends2["default"])({}, _ref15);
|
|
592
675
|
col.className = _this.getColumnClassName(col);
|
|
593
676
|
col.title = _this.getColumnTitle(col);
|
|
594
677
|
col.dataIndex = col.key;
|
|
595
|
-
col.width = col.width
|
|
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;
|
|
596
679
|
// const {edit = false} = props
|
|
597
680
|
// if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
|
|
598
681
|
// if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
|
|
@@ -612,14 +695,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
612
695
|
});
|
|
613
696
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
|
|
614
697
|
return (0, _map["default"])(items).call(items, function (item, index) {
|
|
615
|
-
return (0, _reduce["default"])(cols).call(cols, function (result,
|
|
616
|
-
var
|
|
698
|
+
return (0, _reduce["default"])(cols).call(cols, function (result, _ref16) {
|
|
699
|
+
var _context14;
|
|
617
700
|
|
|
618
|
-
var key =
|
|
619
|
-
type =
|
|
620
|
-
options =
|
|
701
|
+
var key = _ref16.key,
|
|
702
|
+
type = _ref16.type,
|
|
703
|
+
options = _ref16.options;
|
|
621
704
|
|
|
622
|
-
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(
|
|
705
|
+
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context14 = item.isReadonly).call(_context14, key))) {
|
|
623
706
|
result[key] = item[key];
|
|
624
707
|
} else {
|
|
625
708
|
result[key] = (0, _Control.getTitle)(item[key], options);
|
|
@@ -650,36 +733,165 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
650
733
|
rowClassName: rowClassName
|
|
651
734
|
};
|
|
652
735
|
});
|
|
653
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "
|
|
654
|
-
|
|
655
|
-
|
|
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) {
|
|
656
743
|
var _this$props3 = _this.props,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
_this$props3$
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
_this$props3$
|
|
664
|
-
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,
|
|
665
751
|
_this$props3$isEmphas = _this$props3.isEmphasized,
|
|
666
752
|
isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
|
|
667
|
-
|
|
668
|
-
_this$props3$
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
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) {
|
|
673
874
|
return !col.hide;
|
|
674
|
-
})).call(
|
|
675
|
-
|
|
875
|
+
})).call(_context15, function (width, item) {
|
|
876
|
+
var _context16;
|
|
877
|
+
|
|
878
|
+
return width += item.width ? item.width : (0, _includes["default"])(_context16 = ['index', 'checked']).call(_context16, item.key) ? 70 : item.type === 'img' ? 200 : 120;
|
|
676
879
|
}, 0);
|
|
677
|
-
var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
|
|
880
|
+
var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
|
|
881
|
+
expandedRowRender: expandedRowRender
|
|
882
|
+
} : {
|
|
678
883
|
scroll: {
|
|
679
|
-
x:
|
|
884
|
+
x: (0, _some["default"])(cols).call(cols, function (item) {
|
|
885
|
+
return !_helper["default"].isEmpty2(item.fixed);
|
|
886
|
+
}) ? widthX : true,
|
|
680
887
|
y: maxHeight
|
|
681
888
|
}
|
|
682
889
|
};
|
|
890
|
+
|
|
891
|
+
var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
|
|
892
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
893
|
+
extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
|
|
894
|
+
|
|
683
895
|
return _objectSpread(_objectSpread({
|
|
684
896
|
className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
|
|
685
897
|
columns: _this.getColumns(cols),
|
|
@@ -690,11 +902,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
690
902
|
size: 'small',
|
|
691
903
|
pagination: pagination,
|
|
692
904
|
footer: footer,
|
|
905
|
+
onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
|
|
906
|
+
components: dragSort ? {
|
|
907
|
+
body: {
|
|
908
|
+
row: _DragSortRow["default"]
|
|
909
|
+
}
|
|
910
|
+
} : {},
|
|
693
911
|
locale: _this.props.emptyText ? {
|
|
694
912
|
emptyText: _this.props.emptyText
|
|
695
913
|
} : null
|
|
696
914
|
}, _this.getPropsByCheckbox()), {}, {
|
|
697
|
-
expandedRowRender: expandedRowRender,
|
|
698
915
|
onExpand: onExpand
|
|
699
916
|
}, scrollProps);
|
|
700
917
|
});
|
|
@@ -744,7 +961,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
744
961
|
emptyText: _propTypes["default"].string,
|
|
745
962
|
footer: _propTypes["default"].func,
|
|
746
963
|
callback: _propTypes["default"].shape(CallbackType),
|
|
747
|
-
isEmphasized: _propTypes["default"].bool
|
|
964
|
+
isEmphasized: _propTypes["default"].bool,
|
|
965
|
+
dragSort: _propTypes["default"].bool
|
|
748
966
|
});
|
|
749
967
|
var _default = SuperTable2;
|
|
750
968
|
exports["default"] = _default;
|
|
@@ -66,7 +66,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
|
66
66
|
|
|
67
67
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
68
68
|
|
|
69
|
-
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF'];
|
|
69
|
+
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
|
|
70
70
|
var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
|
|
71
71
|
|
|
72
72
|
var propTypes = {
|
|
@@ -79,7 +79,7 @@ var propTypes = {
|
|
|
79
79
|
required: _propTypes["default"].bool,
|
|
80
80
|
//是否必须上传,默认false
|
|
81
81
|
listType: _propTypes["default"].oneOf[('text', 'picture', 'picture-card')],
|
|
82
|
-
//上传列表的内建样式,支持三种,默认
|
|
82
|
+
//上传列表的内建样式,支持三种,默认picture-card
|
|
83
83
|
readonly: _propTypes["default"].bool,
|
|
84
84
|
//所在页面是否只读,默认false
|
|
85
85
|
multiple: _propTypes["default"].bool,
|
package/lib/Title/Title.less
CHANGED
|
@@ -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
|
+
}
|