cloud-b2b 1.1.85 → 1.1.87
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/Area/Area.js +48 -23
- package/es/CodeInput/CodeInput.js +16 -19
- package/es/Enhance/Dialogs.js +11 -14
- package/es/Enhance/Loading.js +15 -18
- package/es/Header/Header.js +17 -20
- package/es/Header/Vertical.js +11 -14
- package/es/ImageView/ImageView.js +10 -13
- package/es/InpurCascader/InputCascader.js +11 -14
- package/es/InputEditor/InputEditor.js +16 -18
- package/es/InputSearch/InputSearch.js +20 -23
- package/es/InputSelect/InputSelect.js +14 -17
- package/es/InputTreeSelect/InputTreeSelect.js +10 -13
- package/es/InputWriting/InputWriting.js +12 -15
- package/es/Layout/Layout.js +14 -17
- package/es/Link/Link.js +7 -10
- package/es/NumberInput/NumberInput.js +13 -16
- package/es/Search/Search.js +52 -55
- package/es/Search2/Search.js +83 -86
- package/es/Search2/Search.less +64 -64
- package/es/Search2/package.json +6 -6
- package/es/Sidebar/Sidebar.js +11 -14
- package/es/Sidebar2/Sidebar.js +13 -16
- package/es/SuperForm/SuperForm.js +74 -79
- package/es/SuperForm2/SuperForm.js +112 -114
- package/es/SuperPagination/SuperPagination.js +8 -11
- package/es/SuperTab/SuperTab.js +12 -15
- package/es/SuperTab2/SuperTab2.js +13 -16
- package/es/SuperTable/DragSortRow.js +12 -15
- package/es/SuperTable/FilterDropDown.js +11 -14
- package/es/SuperTable/SuperTable.js +139 -94
- package/es/SuperTable/SuperTable.less +11 -0
- package/es/SuperTable2/SuperTable2.js +89 -92
- package/es/SuperTable2/SuperTableCell.js +27 -30
- package/es/SuperTable3/FilterDropDown.js +11 -14
- package/es/SuperTable3/SuperTable.js +58 -61
- package/es/SuperToolbar/SuperToolbar.js +12 -15
- package/es/SuperUpload/SuperUpload.js +38 -38
- package/es/Viewer/ImageViews.js +16 -19
- package/es/Viewer/Viewer.js +11 -14
- package/es/helper.js +18 -17
- package/lib/Area/Area.js +49 -25
- package/lib/CodeInput/CodeInput.js +16 -19
- package/lib/Enhance/Dialogs.js +11 -14
- package/lib/Enhance/Loading.js +15 -18
- package/lib/Header/Header.js +17 -20
- package/lib/Header/Vertical.js +11 -14
- package/lib/ImageView/ImageView.js +10 -13
- package/lib/InpurCascader/InputCascader.js +11 -14
- package/lib/InputEditor/InputEditor.js +16 -18
- package/lib/InputSearch/InputSearch.js +20 -23
- package/lib/InputSelect/InputSelect.js +14 -17
- package/lib/InputTreeSelect/InputTreeSelect.js +10 -13
- package/lib/InputWriting/InputWriting.js +12 -15
- package/lib/Layout/Layout.js +14 -17
- package/lib/LayoutLink/LayoutLink.js +1 -2
- package/lib/Link/Link.js +7 -10
- package/lib/NumberInput/NumberInput.js +13 -16
- package/lib/Search/Search.js +53 -57
- package/lib/Search2/Search.js +84 -88
- package/lib/Search2/Search.less +64 -64
- package/lib/Search2/package.json +6 -6
- package/lib/Sidebar/Sidebar.js +11 -14
- package/lib/Sidebar2/Sidebar.js +13 -16
- package/lib/SuperForm/SuperForm.js +75 -81
- package/lib/SuperForm2/SuperForm.js +113 -116
- package/lib/SuperPagination/SuperPagination.js +8 -11
- package/lib/SuperTab/SuperTab.js +12 -15
- package/lib/SuperTab2/SuperTab2.js +13 -16
- package/lib/SuperTable/DragSortRow.js +12 -15
- package/lib/SuperTable/FilterDropDown.js +11 -14
- package/lib/SuperTable/SuperTable.js +139 -94
- package/lib/SuperTable/SuperTable.less +11 -0
- package/lib/SuperTable2/SuperTable2.js +90 -94
- package/lib/SuperTable2/SuperTableCell.js +27 -30
- package/lib/SuperTable3/FilterDropDown.js +11 -14
- package/lib/SuperTable3/SuperTable.js +58 -61
- package/lib/SuperToolbar/SuperToolbar.js +12 -15
- package/lib/SuperUpload/SuperUpload.js +39 -40
- package/lib/Viewer/ImageViews.js +16 -19
- package/lib/Viewer/Viewer.js +11 -14
- package/lib/helper.js +18 -17
- package/package.json +1 -1
|
@@ -25,9 +25,9 @@ var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
|
|
|
25
25
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
|
26
26
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
27
27
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
28
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
28
29
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
29
30
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
30
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
31
31
|
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
32
32
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
33
33
|
var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
|
|
@@ -39,10 +39,9 @@ var _icon = _interopRequireDefault(require("antd/lib/icon"));
|
|
|
39
39
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
40
40
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
41
41
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
42
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
43
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
44
42
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
45
43
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
44
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
46
45
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
47
46
|
var _react = _interopRequireDefault(require("react"));
|
|
48
47
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -52,11 +51,12 @@ var _FilterDropDown = _interopRequireDefault(require("./FilterDropDown"));
|
|
|
52
51
|
var _fixed = _interopRequireDefault(require("./fixed"));
|
|
53
52
|
var _DragSortRow = _interopRequireDefault(require("./DragSortRow"));
|
|
54
53
|
var _variables = _interopRequireDefault(require("../variables"));
|
|
54
|
+
var _helper = _interopRequireDefault(require("../helper"));
|
|
55
55
|
var _excluded = ["onRowClick"];
|
|
56
56
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty2(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
57
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
58
|
-
function
|
|
59
|
-
function _isNativeReflectConstruct() {
|
|
57
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context1, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty2(_context1 = ownKeys(Object(t), !0)).call(_context1, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty2(_context10 = ownKeys(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
58
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
59
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
60
60
|
/**
|
|
61
61
|
* sorter: [可选],不传表示该列不支持排序;为string表示按字符串排序;为number表示按数字大小排序
|
|
62
62
|
* filter: [可选],是否支持过滤,默认为false
|
|
@@ -119,8 +119,6 @@ var CallbackType = {
|
|
|
119
119
|
* searchTotal: [可选], 表格汇总数据对象,该属性不为空时pageTotal默认开启,当dragSort为true时,该选项失效
|
|
120
120
|
*/
|
|
121
121
|
var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
122
|
-
(0, _inherits2["default"])(SuperTable, _React$Component);
|
|
123
|
-
var _super = _createSuper(SuperTable);
|
|
124
122
|
function SuperTable() {
|
|
125
123
|
var _context;
|
|
126
124
|
var _this;
|
|
@@ -128,18 +126,18 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
128
126
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
129
127
|
args[_key] = arguments[_key];
|
|
130
128
|
}
|
|
131
|
-
_this =
|
|
132
|
-
(0, _defineProperty2["default"])(
|
|
129
|
+
_this = _callSuper(this, SuperTable, (0, _concat["default"])(_context = []).call(_context, args));
|
|
130
|
+
(0, _defineProperty2["default"])(_this, "state", {
|
|
133
131
|
filterVisibleKey: ''
|
|
134
132
|
});
|
|
135
|
-
(0, _defineProperty2["default"])(
|
|
133
|
+
(0, _defineProperty2["default"])(_this, "onTableChange", function (pagination, filters, sorter) {
|
|
136
134
|
var _ref = _this.props.callback || {},
|
|
137
135
|
onTableChange = _ref.onTableChange;
|
|
138
136
|
var _this$props$filterInf = _this.props.filterInfo,
|
|
139
137
|
filterInfo = _this$props$filterInf === void 0 ? null : _this$props$filterInf;
|
|
140
138
|
onTableChange && onTableChange(sorter, filterInfo);
|
|
141
139
|
});
|
|
142
|
-
(0, _defineProperty2["default"])(
|
|
140
|
+
(0, _defineProperty2["default"])(_this, "onChange", function () {
|
|
143
141
|
var selectedKeyArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
144
142
|
var _ref2 = _this.props.callback || {},
|
|
145
143
|
onCheck = _ref2.onCheck;
|
|
@@ -186,22 +184,22 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
186
184
|
}
|
|
187
185
|
}
|
|
188
186
|
});
|
|
189
|
-
(0, _defineProperty2["default"])(
|
|
187
|
+
(0, _defineProperty2["default"])(_this, "onCheckChange", function (selectedKeys) {
|
|
190
188
|
var _ref3 = _this.props.callback || {},
|
|
191
189
|
onCheck = _ref3.onCheck;
|
|
192
190
|
onCheck && onCheck(selectedKeys);
|
|
193
191
|
});
|
|
194
|
-
(0, _defineProperty2["default"])(
|
|
192
|
+
(0, _defineProperty2["default"])(_this, "onRadioChange", function (selectedKeys) {
|
|
195
193
|
var _ref4 = _this.props.callback || {},
|
|
196
194
|
onRadio = _ref4.onRadio;
|
|
197
195
|
onRadio && onRadio(selectedKeys);
|
|
198
196
|
});
|
|
199
|
-
(0, _defineProperty2["default"])(
|
|
197
|
+
(0, _defineProperty2["default"])(_this, "onRadioRowClick", function (record) {
|
|
200
198
|
var _ref5 = _this.props.callback || {},
|
|
201
199
|
onRadio = _ref5.onRadio;
|
|
202
200
|
onRadio && onRadio([record.key]);
|
|
203
201
|
});
|
|
204
|
-
(0, _defineProperty2["default"])(
|
|
202
|
+
(0, _defineProperty2["default"])(_this, "onRowClick", function (record) {
|
|
205
203
|
var _this$props2 = _this.props,
|
|
206
204
|
_this$props2$isWeaken = _this$props2.isWeaken,
|
|
207
205
|
isWeaken = _this$props2$isWeaken === void 0 ? false : _this$props2$isWeaken,
|
|
@@ -231,48 +229,56 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
231
229
|
}
|
|
232
230
|
}, 250);
|
|
233
231
|
});
|
|
234
|
-
(0, _defineProperty2["default"])(
|
|
232
|
+
(0, _defineProperty2["default"])(_this, "onDoubleClick", function (record) {
|
|
235
233
|
clearTimeout(_this.timer);
|
|
236
234
|
var _ref7 = _this.props.callback || {},
|
|
237
235
|
onDoubleClick = _ref7.onDoubleClick;
|
|
238
236
|
onDoubleClick && onDoubleClick(record.key);
|
|
239
237
|
});
|
|
240
|
-
(0, _defineProperty2["default"])(
|
|
238
|
+
(0, _defineProperty2["default"])(_this, "onLink", function (key, index, item, e) {
|
|
241
239
|
var _ref8 = _this.props.callback || {},
|
|
242
240
|
onLink = _ref8.onLink;
|
|
243
241
|
onLink && onLink(key, index, item);
|
|
244
242
|
e.stopPropagation();
|
|
245
243
|
});
|
|
246
|
-
(0, _defineProperty2["default"])(
|
|
244
|
+
(0, _defineProperty2["default"])(_this, "onLinkDouble", function (e) {
|
|
247
245
|
e.stopPropagation();
|
|
248
246
|
});
|
|
249
|
-
(0, _defineProperty2["default"])(
|
|
247
|
+
(0, _defineProperty2["default"])(_this, "onMoveRow", function (dragIndex, targetIndex) {
|
|
250
248
|
var _ref9 = _this.props.callback || {},
|
|
251
249
|
onMoveRow = _ref9.onMoveRow;
|
|
252
250
|
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
253
251
|
});
|
|
254
|
-
(0, _defineProperty2["default"])(
|
|
252
|
+
(0, _defineProperty2["default"])(_this, "getSelectedRowKeys", function (items) {
|
|
255
253
|
return (0, _reduce["default"])(items).call(items, function (result, item, index) {
|
|
256
254
|
item.checked && result.push(index);
|
|
257
255
|
return result;
|
|
258
256
|
}, []);
|
|
259
257
|
});
|
|
260
|
-
(0, _defineProperty2["default"])(
|
|
258
|
+
(0, _defineProperty2["default"])(_this, "getIndexInfo", function () {
|
|
261
259
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
260
|
+
var cols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
262
261
|
var _this$props4 = _this.props,
|
|
263
262
|
_this$props4$index = _this$props4.index,
|
|
264
263
|
index = _this$props4$index === void 0 ? true : _this$props4$index,
|
|
265
264
|
_this$props4$indexTit = _this$props4.indexTitle,
|
|
266
265
|
indexTitle = _this$props4$indexTit === void 0 ? '序号' : _this$props4$indexTit;
|
|
266
|
+
var fixed = '';
|
|
267
|
+
(0, _map["default"])(cols).call(cols, function (col) {
|
|
268
|
+
if (col.fixed && col.fixed === 'left') {
|
|
269
|
+
fixed = col.fixed;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
267
272
|
return index ? [{
|
|
268
273
|
key: 'index',
|
|
274
|
+
fixed: fixed,
|
|
269
275
|
title: indexTitle,
|
|
270
276
|
render: function render(text, record, index) {
|
|
271
277
|
return items[record.key].__totalIndexTitle || index + 1;
|
|
272
278
|
}
|
|
273
279
|
}] : [];
|
|
274
280
|
});
|
|
275
|
-
(0, _defineProperty2["default"])(
|
|
281
|
+
(0, _defineProperty2["default"])(_this, "setSortInfo", function (col, sortInfo) {
|
|
276
282
|
if (col.sorter === 'string') {
|
|
277
283
|
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
278
284
|
col.sorter = function (row1, row2) {
|
|
@@ -295,13 +301,13 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
295
301
|
delete col.sorter;
|
|
296
302
|
}
|
|
297
303
|
});
|
|
298
|
-
(0, _defineProperty2["default"])(
|
|
304
|
+
(0, _defineProperty2["default"])(_this, "setFilterInfo", function (col, filterInfo, visibleKey) {
|
|
299
305
|
if ((0, _filter["default"])(col)) {
|
|
300
306
|
var _col$isDateFilterBySt = col.isDateFilterByStartAndEnd,
|
|
301
307
|
isDateFilterByStartAndEnd = _col$isDateFilterBySt === void 0 ? false : _col$isDateFilterBySt;
|
|
302
308
|
var onSearch = function onSearch(value) {
|
|
303
|
-
var
|
|
304
|
-
onTableChange =
|
|
309
|
+
var _ref0 = _this.props.callback || {},
|
|
310
|
+
onTableChange = _ref0.onTableChange;
|
|
305
311
|
var _this$props$sortInfo = _this.props.sortInfo,
|
|
306
312
|
sortInfo = _this$props$sortInfo === void 0 ? null : _this$props$sortInfo;
|
|
307
313
|
var newFilterInfo = (0, _assign["default"])({}, filterInfo, (0, _defineProperty2["default"])({}, col.key, value));
|
|
@@ -349,7 +355,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
349
355
|
}
|
|
350
356
|
delete col.filter;
|
|
351
357
|
});
|
|
352
|
-
(0, _defineProperty2["default"])(
|
|
358
|
+
(0, _defineProperty2["default"])(_this, "linkList", function (key, index, item) {
|
|
353
359
|
var linkTitleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'fileName';
|
|
354
360
|
var list = item[key] || [];
|
|
355
361
|
return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(list).call(list, function (item2, index2) {
|
|
@@ -363,28 +369,48 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
363
369
|
}, (0, _concat["default"])(_context3 = "".concat(item2[linkTitleKey])).call(_context3, split));
|
|
364
370
|
}));
|
|
365
371
|
});
|
|
366
|
-
(0, _defineProperty2["default"])(
|
|
372
|
+
(0, _defineProperty2["default"])(_this, "waring", function (key, index, item, warningKey) {
|
|
367
373
|
var text = item[key] ? item[key] : '';
|
|
368
374
|
var color = item[warningKey] == 1 ? 'red' : 'rgba(0, 0, 0, 0.65)';
|
|
369
|
-
return /*#__PURE__*/_react["default"].createElement("div",
|
|
375
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
376
|
+
style: {
|
|
377
|
+
whiteSpace: 'break-spaces'
|
|
378
|
+
}
|
|
379
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
370
380
|
style: {
|
|
371
381
|
color: color
|
|
372
382
|
}
|
|
373
383
|
}, text.title ? text.title : text));
|
|
374
384
|
});
|
|
375
|
-
(0, _defineProperty2["default"])(
|
|
385
|
+
(0, _defineProperty2["default"])(_this, "textCellRender", function (value) {
|
|
386
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
387
|
+
style: {
|
|
388
|
+
whiteSpace: 'break-spaces'
|
|
389
|
+
}
|
|
390
|
+
}, value);
|
|
391
|
+
});
|
|
392
|
+
(0, _defineProperty2["default"])(_this, "defaultList", function (key, index, item, text, link) {
|
|
376
393
|
var _context4;
|
|
377
394
|
var onClick = (0, _bind["default"])(_context4 = _this.onLink).call(_context4, null, key, index, item);
|
|
378
395
|
if (link && typeof link === 'string') {
|
|
379
396
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
397
|
+
style: {
|
|
398
|
+
whiteSpace: 'normal',
|
|
399
|
+
wordBreak: "break-all"
|
|
400
|
+
},
|
|
380
401
|
onClick: onClick,
|
|
381
402
|
onDoubleClick: _this.onLinkDouble
|
|
382
403
|
}, text);
|
|
383
404
|
}
|
|
384
|
-
return /*#__PURE__*/_react["default"].createElement("div",
|
|
405
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
406
|
+
style: {
|
|
407
|
+
whiteSpace: 'normal',
|
|
408
|
+
wordBreak: "break-all"
|
|
409
|
+
}
|
|
410
|
+
}, /*#__PURE__*/_react["default"].createElement("p", null, text));
|
|
385
411
|
});
|
|
386
|
-
(0, _defineProperty2["default"])(
|
|
387
|
-
var tags =
|
|
412
|
+
(0, _defineProperty2["default"])(_this, "tags", function (key, index, item, _ref1) {
|
|
413
|
+
var tags = _ref1.tags;
|
|
388
414
|
var list = item[key] || [];
|
|
389
415
|
return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(list).call(list, function (item2, index2) {
|
|
390
416
|
var _context5;
|
|
@@ -419,16 +445,16 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
419
445
|
}, /*#__PURE__*/_react["default"].createElement(_tag["default"], tagProps, item2[tags])) : /*#__PURE__*/_react["default"].createElement(_tag["default"], tagProps, item2[tags]);
|
|
420
446
|
}));
|
|
421
447
|
});
|
|
422
|
-
(0, _defineProperty2["default"])(
|
|
448
|
+
(0, _defineProperty2["default"])(_this, "getColumns", function (cols, items) {
|
|
423
449
|
var _context6, _context7;
|
|
424
450
|
var _this$props5 = _this.props,
|
|
425
451
|
sortInfo = _this$props5.sortInfo,
|
|
426
452
|
filterInfo = _this$props5.filterInfo;
|
|
427
453
|
var filterVisibleKey = _this.state.filterVisibleKey;
|
|
428
|
-
return (0, _map["default"])(_context6 = (0, _concat["default"])(_context7 = _this.getIndexInfo(items)).call(_context7, (0, _filter["default"])(cols).call(cols, function (col) {
|
|
429
|
-
return !col.hide;
|
|
430
|
-
}))).call(_context6, function (
|
|
431
|
-
var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(
|
|
454
|
+
return (0, _map["default"])(_context6 = (0, _concat["default"])(_context7 = _this.getIndexInfo(items, cols)).call(_context7, (0, _filter["default"])(cols).call(cols, function (col) {
|
|
455
|
+
return !col.hide && col.key !== 'index';
|
|
456
|
+
}))).call(_context6, function (_ref10) {
|
|
457
|
+
var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref10), _ref10));
|
|
432
458
|
col.dataIndex = col.key;
|
|
433
459
|
col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? (0, _variables["default"])('SuperTable')[col.align] : '';
|
|
434
460
|
col.noWrap && (col.className = (0, _variables["default"])('SuperTable').noWrap);
|
|
@@ -462,11 +488,15 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
462
488
|
col.render = function (text, record, index) {
|
|
463
489
|
return _this.props.callback.onRenderCustom(index, col.key, record[col.key], record);
|
|
464
490
|
};
|
|
491
|
+
} else if (col.key !== 'index' && (!col.type || col.type !== 'otherCustom')) {
|
|
492
|
+
col.render = function (text, record, index) {
|
|
493
|
+
return _this.textCellRender(text);
|
|
494
|
+
};
|
|
465
495
|
}
|
|
466
496
|
return col;
|
|
467
497
|
});
|
|
468
498
|
});
|
|
469
|
-
(0, _defineProperty2["default"])(
|
|
499
|
+
(0, _defineProperty2["default"])(_this, "getText", function (value, options) {
|
|
470
500
|
if ((0, _isArray["default"])(value)) {
|
|
471
501
|
return (0, _map["default"])(value).call(value, function (v) {
|
|
472
502
|
return (0, _Control.getTitle)(v, options);
|
|
@@ -475,7 +505,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
475
505
|
return (0, _Control.getTitle)(value, options);
|
|
476
506
|
}
|
|
477
507
|
});
|
|
478
|
-
(0, _defineProperty2["default"])(
|
|
508
|
+
(0, _defineProperty2["default"])(_this, "link", function (key, index, item, text) {
|
|
479
509
|
var _context8;
|
|
480
510
|
var onClick = (0, _bind["default"])(_context8 = _this.onLink).call(_context8, null, key, index, item);
|
|
481
511
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
@@ -483,16 +513,24 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
483
513
|
onDoubleClick: _this.onLinkDouble
|
|
484
514
|
}, text);
|
|
485
515
|
});
|
|
486
|
-
(0, _defineProperty2["default"])(
|
|
487
|
-
var tipLen =
|
|
488
|
-
options =
|
|
516
|
+
(0, _defineProperty2["default"])(_this, "tooltip", function (key, index, item, _ref11) {
|
|
517
|
+
var tipLen = _ref11.tooltip,
|
|
518
|
+
options = _ref11.options;
|
|
489
519
|
var text = _this.getText(item[key], options);
|
|
490
520
|
var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
|
|
491
521
|
return needTip ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
|
|
492
522
|
title: text
|
|
493
|
-
}, /*#__PURE__*/_react["default"].createElement("span",
|
|
523
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
524
|
+
style: {
|
|
525
|
+
whiteSpace: 'break-spaces'
|
|
526
|
+
}
|
|
527
|
+
}, (0, _slice["default"])(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/_react["default"].createElement("span", {
|
|
528
|
+
style: {
|
|
529
|
+
whiteSpace: 'break-spaces'
|
|
530
|
+
}
|
|
531
|
+
}, (0, _isArray["default"])(text) ? text.join(',') : text);
|
|
494
532
|
});
|
|
495
|
-
(0, _defineProperty2["default"])(
|
|
533
|
+
(0, _defineProperty2["default"])(_this, "getImgSrc", function (value, options) {
|
|
496
534
|
var index = (0, _findIndex["default"])(options).call(options, function (obj) {
|
|
497
535
|
return obj.value == value;
|
|
498
536
|
});
|
|
@@ -505,7 +543,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
505
543
|
* @param options{array}:字段options
|
|
506
544
|
* @param dataSource{string,array}:数据源,如果列数据有多层则用此决定
|
|
507
545
|
*/
|
|
508
|
-
(0, _defineProperty2["default"])(
|
|
546
|
+
(0, _defineProperty2["default"])(_this, "getSourceText", function (item, key, options, dataSource) {
|
|
509
547
|
var value = {};
|
|
510
548
|
if (typeof dataSource === 'string') {
|
|
511
549
|
value = item[dataSource] || {};
|
|
@@ -525,14 +563,14 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
525
563
|
}
|
|
526
564
|
return _this.getText(value, options);
|
|
527
565
|
});
|
|
528
|
-
(0, _defineProperty2["default"])(
|
|
566
|
+
(0, _defineProperty2["default"])(_this, "getDataSource", function (items, cols) {
|
|
529
567
|
return (0, _map["default"])(items).call(items, function (item, index) {
|
|
530
|
-
return (0, _reduce["default"])(cols).call(cols, function (result,
|
|
531
|
-
var key =
|
|
532
|
-
options =
|
|
533
|
-
link =
|
|
534
|
-
icon =
|
|
535
|
-
dataSource =
|
|
568
|
+
return (0, _reduce["default"])(cols).call(cols, function (result, _ref12) {
|
|
569
|
+
var key = _ref12.key,
|
|
570
|
+
options = _ref12.options,
|
|
571
|
+
link = _ref12.link,
|
|
572
|
+
icon = _ref12.icon,
|
|
573
|
+
dataSource = _ref12.dataSource;
|
|
536
574
|
if (link) {
|
|
537
575
|
if (typeof link === 'boolean') {
|
|
538
576
|
result[key] = _this.link(key, index, item, _this.getText(item[key], options));
|
|
@@ -558,7 +596,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
558
596
|
});
|
|
559
597
|
});
|
|
560
598
|
});
|
|
561
|
-
(0, _defineProperty2["default"])(
|
|
599
|
+
(0, _defineProperty2["default"])(_this, "getPropsByCheckbox", function (items) {
|
|
562
600
|
var _this$props6 = _this.props,
|
|
563
601
|
_this$props6$checkbox = _this$props6.checkbox,
|
|
564
602
|
checkbox = _this$props6$checkbox === void 0 ? true : _this$props6$checkbox,
|
|
@@ -643,7 +681,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
643
681
|
};
|
|
644
682
|
}
|
|
645
683
|
});
|
|
646
|
-
(0, _defineProperty2["default"])(
|
|
684
|
+
(0, _defineProperty2["default"])(_this, "getRowProps", function (onRowClick, items) {
|
|
647
685
|
return function (record) {
|
|
648
686
|
var item = items[record.key];
|
|
649
687
|
var rowProps = {
|
|
@@ -660,7 +698,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
660
698
|
return rowProps;
|
|
661
699
|
};
|
|
662
700
|
});
|
|
663
|
-
(0, _defineProperty2["default"])(
|
|
701
|
+
(0, _defineProperty2["default"])(_this, "getRowPropsForDrag", function () {
|
|
664
702
|
return function (record, index) {
|
|
665
703
|
return {
|
|
666
704
|
index: index,
|
|
@@ -668,7 +706,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
668
706
|
};
|
|
669
707
|
};
|
|
670
708
|
});
|
|
671
|
-
(0, _defineProperty2["default"])(
|
|
709
|
+
(0, _defineProperty2["default"])(_this, "getItems", function () {
|
|
672
710
|
var _this$props7 = _this.props,
|
|
673
711
|
items = _this$props7.items,
|
|
674
712
|
cols = _this$props7.cols,
|
|
@@ -680,10 +718,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
680
718
|
var resItems = items;
|
|
681
719
|
if (!dragSort && items.length > 1) {
|
|
682
720
|
if (pageTotal || searchTotal) {
|
|
683
|
-
var totalItem = (0, _reduce["default"])(cols).call(cols, function (result,
|
|
684
|
-
var key =
|
|
685
|
-
|
|
686
|
-
total =
|
|
721
|
+
var totalItem = (0, _reduce["default"])(cols).call(cols, function (result, _ref13) {
|
|
722
|
+
var key = _ref13.key,
|
|
723
|
+
_ref13$total = _ref13.total,
|
|
724
|
+
total = _ref13$total === void 0 ? false : _ref13$total;
|
|
687
725
|
if (total) {
|
|
688
726
|
result[key] = (0, _parseFloat2["default"])(Number((0, _reduce["default"])(items).call(items, function (result, item) {
|
|
689
727
|
return (0, _parseFloat2["default"])(String(item[key] || 0)) + result;
|
|
@@ -705,7 +743,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
705
743
|
}
|
|
706
744
|
return resItems;
|
|
707
745
|
});
|
|
708
|
-
(0, _defineProperty2["default"])(
|
|
746
|
+
(0, _defineProperty2["default"])(_this, "toTotalFooter", function () {
|
|
709
747
|
var _this$props8 = _this.props,
|
|
710
748
|
cols = _this$props8.cols,
|
|
711
749
|
items = _this$props8.items,
|
|
@@ -721,11 +759,11 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
721
759
|
return item.checked;
|
|
722
760
|
});
|
|
723
761
|
var countItems = checkedItems.length ? checkedItems : items;
|
|
724
|
-
var totalItems = (0, _map["default"])(totalCols).call(totalCols, function (
|
|
725
|
-
var title =
|
|
726
|
-
key =
|
|
727
|
-
|
|
728
|
-
props =
|
|
762
|
+
var totalItems = (0, _map["default"])(totalCols).call(totalCols, function (_ref14) {
|
|
763
|
+
var title = _ref14.title,
|
|
764
|
+
key = _ref14.key,
|
|
765
|
+
_ref14$props = _ref14.props,
|
|
766
|
+
props = _ref14$props === void 0 ? {} : _ref14$props;
|
|
729
767
|
var value = (0, _reduce["default"])(countItems).call(countItems, function (result, item) {
|
|
730
768
|
return (0, _parseFloat2["default"])((result + Number(item[key] || 0)).toFixed(props.precision || 6));
|
|
731
769
|
}, 0);
|
|
@@ -743,9 +781,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
743
781
|
style: {
|
|
744
782
|
marginRight: "15px"
|
|
745
783
|
}
|
|
746
|
-
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), (0, _map["default"])(totalItems).call(totalItems, function (
|
|
747
|
-
var title =
|
|
748
|
-
value =
|
|
784
|
+
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), (0, _map["default"])(totalItems).call(totalItems, function (_ref15, index) {
|
|
785
|
+
var title = _ref15.title,
|
|
786
|
+
value = _ref15.value;
|
|
749
787
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
750
788
|
key: index,
|
|
751
789
|
style: {
|
|
@@ -761,7 +799,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
761
799
|
return null;
|
|
762
800
|
}
|
|
763
801
|
});
|
|
764
|
-
(0, _defineProperty2["default"])(
|
|
802
|
+
(0, _defineProperty2["default"])(_this, "getProps", function () {
|
|
765
803
|
var _this$props9 = _this.props,
|
|
766
804
|
cols = _this$props9.cols,
|
|
767
805
|
_this$props9$isPaging = _this$props9.isPaging,
|
|
@@ -772,20 +810,38 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
772
810
|
isWeaken = _this$props9$isWeaken === void 0 ? false : _this$props9$isWeaken,
|
|
773
811
|
dragSort = _this$props9.dragSort,
|
|
774
812
|
_this$props9$footer = _this$props9.footer,
|
|
775
|
-
footer = _this$props9$footer === void 0 ? null : _this$props9$footer
|
|
813
|
+
footer = _this$props9$footer === void 0 ? null : _this$props9$footer,
|
|
814
|
+
maxHeight = _this$props9.maxHeight;
|
|
776
815
|
var items = _this.getItems();
|
|
777
816
|
var _this$getPropsByCheck = _this.getPropsByCheckbox(items),
|
|
778
817
|
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
779
818
|
extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
|
|
780
|
-
var
|
|
819
|
+
var needLeft = false;
|
|
820
|
+
(0, _map["default"])(cols).call(cols, function (col) {
|
|
821
|
+
if (col.fixed && col.fixed === 'left') {
|
|
822
|
+
needLeft = true;
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
var widthX = 0;
|
|
826
|
+
(0, _map["default"])(cols).call(cols, function (item) {
|
|
827
|
+
var _context0;
|
|
828
|
+
item.width = item.width ? item.width : (0, _includes["default"])(_context0 = ['index', 'checked']).call(_context0, item.key) ? 70 : 180;
|
|
829
|
+
widthX += item.width;
|
|
830
|
+
});
|
|
831
|
+
var scrollProps = {
|
|
832
|
+
scroll: {
|
|
833
|
+
x: (0, _some["default"])(cols).call(cols, function (item) {
|
|
834
|
+
return !_helper["default"].isEmpty2(item.fixed);
|
|
835
|
+
}) ? widthX + 140 : true,
|
|
836
|
+
y: maxHeight
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
var renderProps = _objectSpread(_objectSpread({
|
|
781
840
|
className: !isEmphasized || !isWeaken ? (0, _variables["default"])('SuperTable') : (0, _variables["default"])('SuperTable').noTransition,
|
|
782
841
|
columns: _this.getColumns(cols, items),
|
|
783
842
|
dataSource: _this.getDataSource(items, cols),
|
|
784
843
|
size: 'small',
|
|
785
844
|
pagination: isPaging,
|
|
786
|
-
scroll: {
|
|
787
|
-
x: true
|
|
788
|
-
},
|
|
789
845
|
onChange: _this.onTableChange,
|
|
790
846
|
onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick, items),
|
|
791
847
|
components: dragSort ? {
|
|
@@ -794,31 +850,21 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
794
850
|
}
|
|
795
851
|
} : {},
|
|
796
852
|
footer: footer ? footer : _this.toTotalFooter
|
|
797
|
-
}, extraProps);
|
|
853
|
+
}, extraProps), scrollProps);
|
|
798
854
|
return renderProps;
|
|
799
855
|
});
|
|
800
|
-
(0, _defineProperty2["default"])(
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
pageTotal = _this$props10.pageTotal,
|
|
804
|
-
searchTotal = _this$props10.searchTotal;
|
|
805
|
-
if (maxHeight && _this.getItems().length) {
|
|
806
|
-
var root = _reactDom["default"].findDOMNode((0, _assertThisInitialized2["default"])(_this));
|
|
856
|
+
(0, _defineProperty2["default"])(_this, "setScroll", function () {
|
|
857
|
+
if (_this.props.maxHeight && _this.props.items.length) {
|
|
858
|
+
var root = _reactDom["default"].findDOMNode(_this);
|
|
807
859
|
var container = root.getElementsByClassName('ant-table-body')[0];
|
|
808
860
|
var header = root.getElementsByClassName('ant-table-thead')[0];
|
|
809
|
-
|
|
810
|
-
var pageTotalOffset = searchTotal ? 2 : 1;
|
|
811
|
-
var pageTotalElement = pageTotal && tbody && tbody.children ? tbody.children[tbody.children.length - pageTotalOffset] : null;
|
|
812
|
-
var searchTotalElement = searchTotal && tbody && tbody.children ? tbody.children[tbody.children.length - 1] : null;
|
|
813
|
-
(0, _fixed["default"])(container, header, maxHeight, {
|
|
814
|
-
pageTotalElement: pageTotalElement,
|
|
815
|
-
searchTotalElement: searchTotalElement
|
|
816
|
-
});
|
|
861
|
+
(0, _fixed["default"])(container, header, _this.props.maxHeight, {});
|
|
817
862
|
}
|
|
818
863
|
});
|
|
819
864
|
return _this;
|
|
820
865
|
}
|
|
821
|
-
(0,
|
|
866
|
+
(0, _inherits2["default"])(SuperTable, _React$Component);
|
|
867
|
+
return (0, _createClass2["default"])(SuperTable, [{
|
|
822
868
|
key: "shouldComponentUpdate",
|
|
823
869
|
value: function shouldComponentUpdate(props, state) {
|
|
824
870
|
var _this2 = this;
|
|
@@ -845,7 +891,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
845
891
|
}));
|
|
846
892
|
}
|
|
847
893
|
}]);
|
|
848
|
-
return SuperTable;
|
|
849
894
|
}(_react["default"].Component);
|
|
850
895
|
(0, _defineProperty2["default"])(SuperTable, "propTypes", {
|
|
851
896
|
cols: _propTypes["default"].arrayOf(_propTypes["default"].shape(ColType)).isRequired,
|
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
z-index: -1;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
:global(.ant-table-tbody){
|
|
15
|
+
width: 100% !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:global(.ant-table-thead){
|
|
19
|
+
-moz-transform: none !important;
|
|
20
|
+
-webkit-transform: none !important;
|
|
21
|
+
-o-transform: none !important;
|
|
22
|
+
-ms-transform: none !important;
|
|
23
|
+
transform: none !important;
|
|
24
|
+
}
|
|
14
25
|
|
|
15
26
|
:global(.ant-table-placeholder) {
|
|
16
27
|
padding: 0;
|