cloud-b2b 1.1.7 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/CodeInput/CodeInput.js +3 -5
- package/es/NumberInput/NumberInput.js +2 -2
- package/es/SuperForm2/SuperForm.js +32 -9
- package/es/SuperTable2/SuperTable2.js +288 -65
- package/es/SuperUpload/SuperUpload.js +2 -2
- package/lib/CodeInput/CodeInput.js +3 -5
- package/lib/NumberInput/NumberInput.js +2 -2
- package/lib/SuperForm2/SuperForm.js +32 -9
- package/lib/SuperTable2/SuperTable2.js +295 -68
- package/lib/SuperUpload/SuperUpload.js +2 -2
- 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 _context16; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
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 _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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为空字符串时,表头才会显示为复选框
|
|
@@ -144,22 +160,32 @@ var ColType = {
|
|
|
144
160
|
/**
|
|
145
161
|
* onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
|
|
146
162
|
* onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
|
|
147
|
-
*
|
|
163
|
+
* onBlur: 输入框失去焦点时触发,原型为function(rowIndex, keyName, value)
|
|
164
|
+
* onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value, col)
|
|
148
165
|
* onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
|
|
149
166
|
* onAdd:点击+号时触发,原型为function(keyName)
|
|
150
167
|
* onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
|
|
151
|
-
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
|
|
168
|
+
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
|
|
169
|
+
* onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
|
|
152
170
|
*/
|
|
153
171
|
|
|
154
172
|
var CallbackType = {
|
|
155
173
|
onExitValid: _propTypes["default"].func,
|
|
156
174
|
onCheck: _propTypes["default"].func,
|
|
157
175
|
onContentChange: _propTypes["default"].func,
|
|
176
|
+
onBlur: _propTypes["default"].func,
|
|
158
177
|
onSearch: _propTypes["default"].func,
|
|
159
178
|
onLink: _propTypes["default"].func,
|
|
160
179
|
onAdd: _propTypes["default"].func,
|
|
161
180
|
onRenderCustom: _propTypes["default"].func,
|
|
162
|
-
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
|
|
163
189
|
};
|
|
164
190
|
/**
|
|
165
191
|
* base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
|
|
@@ -233,8 +259,37 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
233
259
|
onLink && onLink(key, index, _this.props.items[index]);
|
|
234
260
|
};
|
|
235
261
|
});
|
|
236
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function () {
|
|
237
|
-
|
|
262
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (key, rowIndex) {
|
|
263
|
+
return function (value) {
|
|
264
|
+
var _ref7 = _this.props.callback || {},
|
|
265
|
+
onBlur = _ref7.onBlur;
|
|
266
|
+
|
|
267
|
+
_this.closeValid();
|
|
268
|
+
|
|
269
|
+
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
270
|
+
};
|
|
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);
|
|
238
293
|
});
|
|
239
294
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
|
|
240
295
|
var _this$props = _this.props,
|
|
@@ -292,7 +347,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
292
347
|
options: _this.getOptions(key, options, index),
|
|
293
348
|
onChange: _this.onChange(key, index),
|
|
294
349
|
onSearch: _this.onSearch(key, index, config),
|
|
295
|
-
onBlur: _this.onBlur
|
|
350
|
+
onBlur: _this.onBlur(key, index)
|
|
296
351
|
};
|
|
297
352
|
|
|
298
353
|
if (showRowAdd && (0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
|
|
@@ -371,8 +426,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
371
426
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
372
427
|
|
|
373
428
|
var onClick = function onClick() {
|
|
374
|
-
var
|
|
375
|
-
onLink =
|
|
429
|
+
var _ref11 = _this.props.callback || {},
|
|
430
|
+
onLink = _ref11.onLink;
|
|
376
431
|
|
|
377
432
|
onLink && onLink(col.key, index, item2);
|
|
378
433
|
};
|
|
@@ -386,8 +441,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
386
441
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
387
442
|
|
|
388
443
|
var onClick = function onClick() {
|
|
389
|
-
var
|
|
390
|
-
onLink =
|
|
444
|
+
var _ref12 = _this.props.callback || {},
|
|
445
|
+
onLink = _ref12.onLink;
|
|
391
446
|
|
|
392
447
|
onLink && onLink(col.key, index, record);
|
|
393
448
|
};
|
|
@@ -402,13 +457,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
402
457
|
});
|
|
403
458
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
|
|
404
459
|
return function (value, record, index) {
|
|
405
|
-
var _context3, _context4, _context5, _context6;
|
|
460
|
+
var _context3, _context4, _context5, _context6, _context7;
|
|
406
461
|
|
|
407
462
|
var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
|
|
408
463
|
|
|
409
464
|
if (!realType) {
|
|
410
465
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
466
|
+
onDoubleClick: _this.onDoubleClick(col.key, record.key),
|
|
411
467
|
style: {
|
|
468
|
+
minHeight: '20px',
|
|
469
|
+
minWidth: '100px',
|
|
412
470
|
maxWidth: "".concat(col.width - 16, "px"),
|
|
413
471
|
overflow: 'hidden',
|
|
414
472
|
textOverflow: 'ellipsis'
|
|
@@ -452,12 +510,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
452
510
|
}
|
|
453
511
|
|
|
454
512
|
case 'switch':
|
|
455
|
-
return value === '
|
|
513
|
+
return typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("div", null, value) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
456
514
|
checkedChildren: col.props.checkedChildren || '',
|
|
457
515
|
unCheckedChildren: col.props.unCheckedChildren || '',
|
|
458
516
|
onChange: _this.onSwitch(col.key, record.key),
|
|
459
517
|
size: "default",
|
|
460
|
-
checked: value || false,
|
|
518
|
+
checked: typeof value === 'number' ? Boolean(value) : value || false,
|
|
461
519
|
disabled: !(record._isEdit === true)
|
|
462
520
|
});
|
|
463
521
|
|
|
@@ -484,14 +542,46 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
484
542
|
height: '80px'
|
|
485
543
|
}
|
|
486
544
|
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
487
|
-
role: 'imgBox'
|
|
545
|
+
role: 'imgBox',
|
|
546
|
+
style: {
|
|
547
|
+
maxWidth: "".concat(col.width, "px")
|
|
548
|
+
}
|
|
488
549
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
489
550
|
src: value.img,
|
|
490
551
|
style: {
|
|
491
552
|
width: '80px',
|
|
492
553
|
height: '80px'
|
|
493
554
|
}
|
|
494
|
-
}), /*#__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"])(_context7 = _this.props.callback.onTableFileChange).call(_context7, 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);
|
|
495
585
|
|
|
496
586
|
default:
|
|
497
587
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -537,12 +627,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
537
627
|
return null;
|
|
538
628
|
}
|
|
539
629
|
});
|
|
540
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (
|
|
541
|
-
var required =
|
|
542
|
-
title =
|
|
543
|
-
type =
|
|
544
|
-
key =
|
|
545
|
-
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;
|
|
546
636
|
|
|
547
637
|
if (type === 'checkbox') {
|
|
548
638
|
var status = _this.getCheckedStatus(key);
|
|
@@ -557,9 +647,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
557
647
|
}, title, _this.toAdd(key, showAdd));
|
|
558
648
|
}
|
|
559
649
|
});
|
|
560
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (
|
|
561
|
-
var type =
|
|
562
|
-
align =
|
|
650
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref14) {
|
|
651
|
+
var type = _ref14.type,
|
|
652
|
+
align = _ref14.align;
|
|
563
653
|
|
|
564
654
|
if (type === 'index' || type === 'checkbox') {
|
|
565
655
|
return 'ant-table-selection-column';
|
|
@@ -568,22 +658,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
568
658
|
}
|
|
569
659
|
});
|
|
570
660
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
|
|
571
|
-
var
|
|
661
|
+
var _context8;
|
|
572
662
|
|
|
573
|
-
return !(0, _includes["default"])(
|
|
663
|
+
return !(0, _includes["default"])(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
|
|
574
664
|
});
|
|
575
665
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
|
|
576
|
-
var
|
|
666
|
+
var _context9;
|
|
577
667
|
|
|
578
668
|
var readonly = _this.props.readonly;
|
|
579
|
-
return (0, _map["default"])(
|
|
669
|
+
return (0, _map["default"])(_context9 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
580
670
|
return !col.hide;
|
|
581
|
-
})).call(
|
|
582
|
-
var
|
|
671
|
+
})).call(_context9, function (_ref15, index) {
|
|
672
|
+
var _context10;
|
|
673
|
+
|
|
674
|
+
var col = (0, _extends2["default"])({}, _ref15);
|
|
583
675
|
col.className = _this.getColumnClassName(col);
|
|
584
676
|
col.title = _this.getColumnTitle(col);
|
|
585
677
|
col.dataIndex = col.key;
|
|
586
|
-
col.width = col.width
|
|
678
|
+
col.width = col.width ? col.width : (0, _includes["default"])(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} = col;
|
|
587
679
|
// const {edit = false} = props
|
|
588
680
|
// if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
|
|
589
681
|
// if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
|
|
@@ -603,14 +695,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
603
695
|
});
|
|
604
696
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
|
|
605
697
|
return (0, _map["default"])(items).call(items, function (item, index) {
|
|
606
|
-
return (0, _reduce["default"])(cols).call(cols, function (result,
|
|
607
|
-
var
|
|
698
|
+
return (0, _reduce["default"])(cols).call(cols, function (result, _ref16) {
|
|
699
|
+
var _context11;
|
|
608
700
|
|
|
609
|
-
var key =
|
|
610
|
-
type =
|
|
611
|
-
options =
|
|
701
|
+
var key = _ref16.key,
|
|
702
|
+
type = _ref16.type,
|
|
703
|
+
options = _ref16.options;
|
|
612
704
|
|
|
613
|
-
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"])(_context11 = item.isReadonly).call(_context11, key))) {
|
|
614
706
|
result[key] = item[key];
|
|
615
707
|
} else {
|
|
616
708
|
result[key] = (0, _Control.getTitle)(item[key], options);
|
|
@@ -641,36 +733,165 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
641
733
|
rowClassName: rowClassName
|
|
642
734
|
};
|
|
643
735
|
});
|
|
644
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "
|
|
645
|
-
|
|
646
|
-
|
|
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) {
|
|
647
743
|
var _this$props3 = _this.props,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
_this$props3$
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
_this$props3$
|
|
655
|
-
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,
|
|
656
751
|
_this$props3$isEmphas = _this$props3.isEmphasized,
|
|
657
752
|
isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
|
|
658
|
-
|
|
659
|
-
_this$props3$
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
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 _context12;
|
|
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"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
664
874
|
return !col.hide;
|
|
665
|
-
})).call(
|
|
666
|
-
|
|
875
|
+
})).call(_context12, function (width, item) {
|
|
876
|
+
var _context13;
|
|
877
|
+
|
|
878
|
+
return width += item.width ? item.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : item.type === 'img' ? 200 : 120;
|
|
667
879
|
}, 0);
|
|
668
|
-
var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
|
|
880
|
+
var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
|
|
881
|
+
expandedRowRender: expandedRowRender
|
|
882
|
+
} : {
|
|
669
883
|
scroll: {
|
|
670
|
-
x:
|
|
884
|
+
x: (0, _some["default"])(cols).call(cols, function (item) {
|
|
885
|
+
return !_helper["default"].isEmpty2(item.fixed);
|
|
886
|
+
}) ? widthX : true,
|
|
671
887
|
y: maxHeight
|
|
672
888
|
}
|
|
673
889
|
};
|
|
890
|
+
|
|
891
|
+
var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
|
|
892
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
893
|
+
extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
|
|
894
|
+
|
|
674
895
|
return _objectSpread(_objectSpread({
|
|
675
896
|
className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
|
|
676
897
|
columns: _this.getColumns(cols),
|
|
@@ -681,11 +902,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
681
902
|
size: 'small',
|
|
682
903
|
pagination: pagination,
|
|
683
904
|
footer: footer,
|
|
905
|
+
onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
|
|
906
|
+
components: dragSort ? {
|
|
907
|
+
body: {
|
|
908
|
+
row: _DragSortRow["default"]
|
|
909
|
+
}
|
|
910
|
+
} : {},
|
|
684
911
|
locale: _this.props.emptyText ? {
|
|
685
912
|
emptyText: _this.props.emptyText
|
|
686
913
|
} : null
|
|
687
914
|
}, _this.getPropsByCheckbox()), {}, {
|
|
688
|
-
expandedRowRender: expandedRowRender,
|
|
689
915
|
onExpand: onExpand
|
|
690
916
|
}, scrollProps);
|
|
691
917
|
});
|
|
@@ -735,7 +961,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
735
961
|
emptyText: _propTypes["default"].string,
|
|
736
962
|
footer: _propTypes["default"].func,
|
|
737
963
|
callback: _propTypes["default"].shape(CallbackType),
|
|
738
|
-
isEmphasized: _propTypes["default"].bool
|
|
964
|
+
isEmphasized: _propTypes["default"].bool,
|
|
965
|
+
dragSort: _propTypes["default"].bool
|
|
739
966
|
});
|
|
740
967
|
var _default = SuperTable2;
|
|
741
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,
|