cloud-b2b 1.1.86 → 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 +10 -13
- 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 +111 -116
- 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 +11 -15
- 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 +112 -118
- 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
|
@@ -15,14 +15,13 @@ import _Icon from "antd/es/icon";
|
|
|
15
15
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
16
16
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
17
17
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
18
|
-
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
19
|
-
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
20
18
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
21
19
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
20
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
22
21
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
23
22
|
var _excluded = ["onRowClick"];
|
|
24
23
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
24
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context1, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context1 = ownKeys(Object(t), !0)).call(_context1, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context10 = ownKeys(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
25
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
27
26
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
28
27
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
@@ -32,14 +31,14 @@ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
|
|
|
32
31
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
33
32
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
34
33
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
34
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
35
35
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
36
36
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
37
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
38
37
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
39
38
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
40
39
|
import _parseFloat from "@babel/runtime-corejs3/core-js-stable/parse-float";
|
|
41
|
-
function
|
|
42
|
-
function _isNativeReflectConstruct() {
|
|
40
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
41
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
43
42
|
import React from 'react';
|
|
44
43
|
import PropTypes from 'prop-types';
|
|
45
44
|
import ReactDOM from 'react-dom';
|
|
@@ -48,6 +47,7 @@ import FilterDropDown from './FilterDropDown';
|
|
|
48
47
|
import fixed from './fixed';
|
|
49
48
|
import DragSortRow from './DragSortRow';
|
|
50
49
|
import variables from '../variables';
|
|
50
|
+
import helper from "../helper";
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* sorter: [可选],不传表示该列不支持排序;为string表示按字符串排序;为number表示按数字大小排序
|
|
@@ -111,8 +111,6 @@ var CallbackType = {
|
|
|
111
111
|
* searchTotal: [可选], 表格汇总数据对象,该属性不为空时pageTotal默认开启,当dragSort为true时,该选项失效
|
|
112
112
|
*/
|
|
113
113
|
var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
114
|
-
_inherits(SuperTable, _React$Component);
|
|
115
|
-
var _super = _createSuper(SuperTable);
|
|
116
114
|
function SuperTable() {
|
|
117
115
|
var _context;
|
|
118
116
|
var _this;
|
|
@@ -120,18 +118,18 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
120
118
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
121
119
|
args[_key] = arguments[_key];
|
|
122
120
|
}
|
|
123
|
-
_this =
|
|
124
|
-
_defineProperty(
|
|
121
|
+
_this = _callSuper(this, SuperTable, _concatInstanceProperty(_context = []).call(_context, args));
|
|
122
|
+
_defineProperty(_this, "state", {
|
|
125
123
|
filterVisibleKey: ''
|
|
126
124
|
});
|
|
127
|
-
_defineProperty(
|
|
125
|
+
_defineProperty(_this, "onTableChange", function (pagination, filters, sorter) {
|
|
128
126
|
var _ref = _this.props.callback || {},
|
|
129
127
|
onTableChange = _ref.onTableChange;
|
|
130
128
|
var _this$props$filterInf = _this.props.filterInfo,
|
|
131
129
|
filterInfo = _this$props$filterInf === void 0 ? null : _this$props$filterInf;
|
|
132
130
|
onTableChange && onTableChange(sorter, filterInfo);
|
|
133
131
|
});
|
|
134
|
-
_defineProperty(
|
|
132
|
+
_defineProperty(_this, "onChange", function () {
|
|
135
133
|
var selectedKeyArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
136
134
|
var _ref2 = _this.props.callback || {},
|
|
137
135
|
onCheck = _ref2.onCheck;
|
|
@@ -178,22 +176,22 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
178
|
});
|
|
181
|
-
_defineProperty(
|
|
179
|
+
_defineProperty(_this, "onCheckChange", function (selectedKeys) {
|
|
182
180
|
var _ref3 = _this.props.callback || {},
|
|
183
181
|
onCheck = _ref3.onCheck;
|
|
184
182
|
onCheck && onCheck(selectedKeys);
|
|
185
183
|
});
|
|
186
|
-
_defineProperty(
|
|
184
|
+
_defineProperty(_this, "onRadioChange", function (selectedKeys) {
|
|
187
185
|
var _ref4 = _this.props.callback || {},
|
|
188
186
|
onRadio = _ref4.onRadio;
|
|
189
187
|
onRadio && onRadio(selectedKeys);
|
|
190
188
|
});
|
|
191
|
-
_defineProperty(
|
|
189
|
+
_defineProperty(_this, "onRadioRowClick", function (record) {
|
|
192
190
|
var _ref5 = _this.props.callback || {},
|
|
193
191
|
onRadio = _ref5.onRadio;
|
|
194
192
|
onRadio && onRadio([record.key]);
|
|
195
193
|
});
|
|
196
|
-
_defineProperty(
|
|
194
|
+
_defineProperty(_this, "onRowClick", function (record) {
|
|
197
195
|
var _this$props2 = _this.props,
|
|
198
196
|
_this$props2$isWeaken = _this$props2.isWeaken,
|
|
199
197
|
isWeaken = _this$props2$isWeaken === void 0 ? false : _this$props2$isWeaken,
|
|
@@ -223,48 +221,56 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
223
221
|
}
|
|
224
222
|
}, 250);
|
|
225
223
|
});
|
|
226
|
-
_defineProperty(
|
|
224
|
+
_defineProperty(_this, "onDoubleClick", function (record) {
|
|
227
225
|
clearTimeout(_this.timer);
|
|
228
226
|
var _ref7 = _this.props.callback || {},
|
|
229
227
|
onDoubleClick = _ref7.onDoubleClick;
|
|
230
228
|
onDoubleClick && onDoubleClick(record.key);
|
|
231
229
|
});
|
|
232
|
-
_defineProperty(
|
|
230
|
+
_defineProperty(_this, "onLink", function (key, index, item, e) {
|
|
233
231
|
var _ref8 = _this.props.callback || {},
|
|
234
232
|
onLink = _ref8.onLink;
|
|
235
233
|
onLink && onLink(key, index, item);
|
|
236
234
|
e.stopPropagation();
|
|
237
235
|
});
|
|
238
|
-
_defineProperty(
|
|
236
|
+
_defineProperty(_this, "onLinkDouble", function (e) {
|
|
239
237
|
e.stopPropagation();
|
|
240
238
|
});
|
|
241
|
-
_defineProperty(
|
|
239
|
+
_defineProperty(_this, "onMoveRow", function (dragIndex, targetIndex) {
|
|
242
240
|
var _ref9 = _this.props.callback || {},
|
|
243
241
|
onMoveRow = _ref9.onMoveRow;
|
|
244
242
|
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
245
243
|
});
|
|
246
|
-
_defineProperty(
|
|
244
|
+
_defineProperty(_this, "getSelectedRowKeys", function (items) {
|
|
247
245
|
return _reduceInstanceProperty(items).call(items, function (result, item, index) {
|
|
248
246
|
item.checked && result.push(index);
|
|
249
247
|
return result;
|
|
250
248
|
}, []);
|
|
251
249
|
});
|
|
252
|
-
_defineProperty(
|
|
250
|
+
_defineProperty(_this, "getIndexInfo", function () {
|
|
253
251
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
252
|
+
var cols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
254
253
|
var _this$props4 = _this.props,
|
|
255
254
|
_this$props4$index = _this$props4.index,
|
|
256
255
|
index = _this$props4$index === void 0 ? true : _this$props4$index,
|
|
257
256
|
_this$props4$indexTit = _this$props4.indexTitle,
|
|
258
257
|
indexTitle = _this$props4$indexTit === void 0 ? '序号' : _this$props4$indexTit;
|
|
258
|
+
var fixed = '';
|
|
259
|
+
_mapInstanceProperty(cols).call(cols, function (col) {
|
|
260
|
+
if (col.fixed && col.fixed === 'left') {
|
|
261
|
+
fixed = col.fixed;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
259
264
|
return index ? [{
|
|
260
265
|
key: 'index',
|
|
266
|
+
fixed: fixed,
|
|
261
267
|
title: indexTitle,
|
|
262
268
|
render: function render(text, record, index) {
|
|
263
269
|
return items[record.key].__totalIndexTitle || index + 1;
|
|
264
270
|
}
|
|
265
271
|
}] : [];
|
|
266
272
|
});
|
|
267
|
-
_defineProperty(
|
|
273
|
+
_defineProperty(_this, "setSortInfo", function (col, sortInfo) {
|
|
268
274
|
if (col.sorter === 'string') {
|
|
269
275
|
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
270
276
|
col.sorter = function (row1, row2) {
|
|
@@ -287,13 +293,13 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
287
293
|
delete col.sorter;
|
|
288
294
|
}
|
|
289
295
|
});
|
|
290
|
-
_defineProperty(
|
|
296
|
+
_defineProperty(_this, "setFilterInfo", function (col, filterInfo, visibleKey) {
|
|
291
297
|
if (_filterInstanceProperty(col)) {
|
|
292
298
|
var _col$isDateFilterBySt = col.isDateFilterByStartAndEnd,
|
|
293
299
|
isDateFilterByStartAndEnd = _col$isDateFilterBySt === void 0 ? false : _col$isDateFilterBySt;
|
|
294
300
|
var onSearch = function onSearch(value) {
|
|
295
|
-
var
|
|
296
|
-
onTableChange =
|
|
301
|
+
var _ref0 = _this.props.callback || {},
|
|
302
|
+
onTableChange = _ref0.onTableChange;
|
|
297
303
|
var _this$props$sortInfo = _this.props.sortInfo,
|
|
298
304
|
sortInfo = _this$props$sortInfo === void 0 ? null : _this$props$sortInfo;
|
|
299
305
|
var newFilterInfo = _Object$assign({}, filterInfo, _defineProperty({}, col.key, value));
|
|
@@ -341,7 +347,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
341
347
|
}
|
|
342
348
|
delete col.filter;
|
|
343
349
|
});
|
|
344
|
-
_defineProperty(
|
|
350
|
+
_defineProperty(_this, "linkList", function (key, index, item) {
|
|
345
351
|
var linkTitleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'fileName';
|
|
346
352
|
var list = item[key] || [];
|
|
347
353
|
return /*#__PURE__*/React.createElement("div", null, _mapInstanceProperty(list).call(list, function (item2, index2) {
|
|
@@ -355,28 +361,48 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
355
361
|
}, _concatInstanceProperty(_context3 = "".concat(item2[linkTitleKey])).call(_context3, split));
|
|
356
362
|
}));
|
|
357
363
|
});
|
|
358
|
-
_defineProperty(
|
|
364
|
+
_defineProperty(_this, "waring", function (key, index, item, warningKey) {
|
|
359
365
|
var text = item[key] ? item[key] : '';
|
|
360
366
|
var color = item[warningKey] == 1 ? 'red' : 'rgba(0, 0, 0, 0.65)';
|
|
361
|
-
return /*#__PURE__*/React.createElement("div",
|
|
367
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
368
|
+
style: {
|
|
369
|
+
whiteSpace: 'break-spaces'
|
|
370
|
+
}
|
|
371
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
362
372
|
style: {
|
|
363
373
|
color: color
|
|
364
374
|
}
|
|
365
375
|
}, text.title ? text.title : text));
|
|
366
376
|
});
|
|
367
|
-
_defineProperty(
|
|
377
|
+
_defineProperty(_this, "textCellRender", function (value) {
|
|
378
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
379
|
+
style: {
|
|
380
|
+
whiteSpace: 'break-spaces'
|
|
381
|
+
}
|
|
382
|
+
}, value);
|
|
383
|
+
});
|
|
384
|
+
_defineProperty(_this, "defaultList", function (key, index, item, text, link) {
|
|
368
385
|
var _context4;
|
|
369
386
|
var onClick = _bindInstanceProperty(_context4 = _this.onLink).call(_context4, null, key, index, item);
|
|
370
387
|
if (link && typeof link === 'string') {
|
|
371
388
|
return /*#__PURE__*/React.createElement("a", {
|
|
389
|
+
style: {
|
|
390
|
+
whiteSpace: 'normal',
|
|
391
|
+
wordBreak: "break-all"
|
|
392
|
+
},
|
|
372
393
|
onClick: onClick,
|
|
373
394
|
onDoubleClick: _this.onLinkDouble
|
|
374
395
|
}, text);
|
|
375
396
|
}
|
|
376
|
-
return /*#__PURE__*/React.createElement("div",
|
|
397
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
398
|
+
style: {
|
|
399
|
+
whiteSpace: 'normal',
|
|
400
|
+
wordBreak: "break-all"
|
|
401
|
+
}
|
|
402
|
+
}, /*#__PURE__*/React.createElement("p", null, text));
|
|
377
403
|
});
|
|
378
|
-
_defineProperty(
|
|
379
|
-
var tags =
|
|
404
|
+
_defineProperty(_this, "tags", function (key, index, item, _ref1) {
|
|
405
|
+
var tags = _ref1.tags;
|
|
380
406
|
var list = item[key] || [];
|
|
381
407
|
return /*#__PURE__*/React.createElement("div", null, _mapInstanceProperty(list).call(list, function (item2, index2) {
|
|
382
408
|
var _context5;
|
|
@@ -411,16 +437,16 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
411
437
|
}, /*#__PURE__*/React.createElement(_Tag, tagProps, item2[tags])) : /*#__PURE__*/React.createElement(_Tag, tagProps, item2[tags]);
|
|
412
438
|
}));
|
|
413
439
|
});
|
|
414
|
-
_defineProperty(
|
|
440
|
+
_defineProperty(_this, "getColumns", function (cols, items) {
|
|
415
441
|
var _context6, _context7;
|
|
416
442
|
var _this$props5 = _this.props,
|
|
417
443
|
sortInfo = _this$props5.sortInfo,
|
|
418
444
|
filterInfo = _this$props5.filterInfo;
|
|
419
445
|
var filterVisibleKey = _this.state.filterVisibleKey;
|
|
420
|
-
return _mapInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _this.getIndexInfo(items)).call(_context7, _filterInstanceProperty(cols).call(cols, function (col) {
|
|
421
|
-
return !col.hide;
|
|
422
|
-
}))).call(_context6, function (
|
|
423
|
-
var col = _extends({}, (_objectDestructuringEmpty(
|
|
446
|
+
return _mapInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _this.getIndexInfo(items, cols)).call(_context7, _filterInstanceProperty(cols).call(cols, function (col) {
|
|
447
|
+
return !col.hide && col.key !== 'index';
|
|
448
|
+
}))).call(_context6, function (_ref10) {
|
|
449
|
+
var col = _extends({}, (_objectDestructuringEmpty(_ref10), _ref10));
|
|
424
450
|
col.dataIndex = col.key;
|
|
425
451
|
col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? variables('SuperTable')[col.align] : '';
|
|
426
452
|
col.noWrap && (col.className = variables('SuperTable').noWrap);
|
|
@@ -454,11 +480,15 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
454
480
|
col.render = function (text, record, index) {
|
|
455
481
|
return _this.props.callback.onRenderCustom(index, col.key, record[col.key], record);
|
|
456
482
|
};
|
|
483
|
+
} else if (col.key !== 'index' && (!col.type || col.type !== 'otherCustom')) {
|
|
484
|
+
col.render = function (text, record, index) {
|
|
485
|
+
return _this.textCellRender(text);
|
|
486
|
+
};
|
|
457
487
|
}
|
|
458
488
|
return col;
|
|
459
489
|
});
|
|
460
490
|
});
|
|
461
|
-
_defineProperty(
|
|
491
|
+
_defineProperty(_this, "getText", function (value, options) {
|
|
462
492
|
if (_Array$isArray(value)) {
|
|
463
493
|
return _mapInstanceProperty(value).call(value, function (v) {
|
|
464
494
|
return getTitle(v, options);
|
|
@@ -467,7 +497,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
467
497
|
return getTitle(value, options);
|
|
468
498
|
}
|
|
469
499
|
});
|
|
470
|
-
_defineProperty(
|
|
500
|
+
_defineProperty(_this, "link", function (key, index, item, text) {
|
|
471
501
|
var _context8;
|
|
472
502
|
var onClick = _bindInstanceProperty(_context8 = _this.onLink).call(_context8, null, key, index, item);
|
|
473
503
|
return /*#__PURE__*/React.createElement("a", {
|
|
@@ -475,16 +505,24 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
475
505
|
onDoubleClick: _this.onLinkDouble
|
|
476
506
|
}, text);
|
|
477
507
|
});
|
|
478
|
-
_defineProperty(
|
|
479
|
-
var tipLen =
|
|
480
|
-
options =
|
|
508
|
+
_defineProperty(_this, "tooltip", function (key, index, item, _ref11) {
|
|
509
|
+
var tipLen = _ref11.tooltip,
|
|
510
|
+
options = _ref11.options;
|
|
481
511
|
var text = _this.getText(item[key], options);
|
|
482
512
|
var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
|
|
483
513
|
return needTip ? /*#__PURE__*/React.createElement(_Tooltip, {
|
|
484
514
|
title: text
|
|
485
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
515
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
516
|
+
style: {
|
|
517
|
+
whiteSpace: 'break-spaces'
|
|
518
|
+
}
|
|
519
|
+
}, _sliceInstanceProperty(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/React.createElement("span", {
|
|
520
|
+
style: {
|
|
521
|
+
whiteSpace: 'break-spaces'
|
|
522
|
+
}
|
|
523
|
+
}, _Array$isArray(text) ? text.join(',') : text);
|
|
486
524
|
});
|
|
487
|
-
_defineProperty(
|
|
525
|
+
_defineProperty(_this, "getImgSrc", function (value, options) {
|
|
488
526
|
var index = _findIndexInstanceProperty(options).call(options, function (obj) {
|
|
489
527
|
return obj.value == value;
|
|
490
528
|
});
|
|
@@ -497,7 +535,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
497
535
|
* @param options{array}:字段options
|
|
498
536
|
* @param dataSource{string,array}:数据源,如果列数据有多层则用此决定
|
|
499
537
|
*/
|
|
500
|
-
_defineProperty(
|
|
538
|
+
_defineProperty(_this, "getSourceText", function (item, key, options, dataSource) {
|
|
501
539
|
var value = {};
|
|
502
540
|
if (typeof dataSource === 'string') {
|
|
503
541
|
value = item[dataSource] || {};
|
|
@@ -517,14 +555,14 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
517
555
|
}
|
|
518
556
|
return _this.getText(value, options);
|
|
519
557
|
});
|
|
520
|
-
_defineProperty(
|
|
558
|
+
_defineProperty(_this, "getDataSource", function (items, cols) {
|
|
521
559
|
return _mapInstanceProperty(items).call(items, function (item, index) {
|
|
522
|
-
return _reduceInstanceProperty(cols).call(cols, function (result,
|
|
523
|
-
var key =
|
|
524
|
-
options =
|
|
525
|
-
link =
|
|
526
|
-
icon =
|
|
527
|
-
dataSource =
|
|
560
|
+
return _reduceInstanceProperty(cols).call(cols, function (result, _ref12) {
|
|
561
|
+
var key = _ref12.key,
|
|
562
|
+
options = _ref12.options,
|
|
563
|
+
link = _ref12.link,
|
|
564
|
+
icon = _ref12.icon,
|
|
565
|
+
dataSource = _ref12.dataSource;
|
|
528
566
|
if (link) {
|
|
529
567
|
if (typeof link === 'boolean') {
|
|
530
568
|
result[key] = _this.link(key, index, item, _this.getText(item[key], options));
|
|
@@ -550,7 +588,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
550
588
|
});
|
|
551
589
|
});
|
|
552
590
|
});
|
|
553
|
-
_defineProperty(
|
|
591
|
+
_defineProperty(_this, "getPropsByCheckbox", function (items) {
|
|
554
592
|
var _this$props6 = _this.props,
|
|
555
593
|
_this$props6$checkbox = _this$props6.checkbox,
|
|
556
594
|
checkbox = _this$props6$checkbox === void 0 ? true : _this$props6$checkbox,
|
|
@@ -635,7 +673,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
635
673
|
};
|
|
636
674
|
}
|
|
637
675
|
});
|
|
638
|
-
_defineProperty(
|
|
676
|
+
_defineProperty(_this, "getRowProps", function (onRowClick, items) {
|
|
639
677
|
return function (record) {
|
|
640
678
|
var item = items[record.key];
|
|
641
679
|
var rowProps = {
|
|
@@ -652,7 +690,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
652
690
|
return rowProps;
|
|
653
691
|
};
|
|
654
692
|
});
|
|
655
|
-
_defineProperty(
|
|
693
|
+
_defineProperty(_this, "getRowPropsForDrag", function () {
|
|
656
694
|
return function (record, index) {
|
|
657
695
|
return {
|
|
658
696
|
index: index,
|
|
@@ -660,7 +698,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
660
698
|
};
|
|
661
699
|
};
|
|
662
700
|
});
|
|
663
|
-
_defineProperty(
|
|
701
|
+
_defineProperty(_this, "getItems", function () {
|
|
664
702
|
var _this$props7 = _this.props,
|
|
665
703
|
items = _this$props7.items,
|
|
666
704
|
cols = _this$props7.cols,
|
|
@@ -672,10 +710,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
672
710
|
var resItems = items;
|
|
673
711
|
if (!dragSort && items.length > 1) {
|
|
674
712
|
if (pageTotal || searchTotal) {
|
|
675
|
-
var totalItem = _reduceInstanceProperty(cols).call(cols, function (result,
|
|
676
|
-
var key =
|
|
677
|
-
|
|
678
|
-
total =
|
|
713
|
+
var totalItem = _reduceInstanceProperty(cols).call(cols, function (result, _ref13) {
|
|
714
|
+
var key = _ref13.key,
|
|
715
|
+
_ref13$total = _ref13.total,
|
|
716
|
+
total = _ref13$total === void 0 ? false : _ref13$total;
|
|
679
717
|
if (total) {
|
|
680
718
|
result[key] = _parseFloat(Number(_reduceInstanceProperty(items).call(items, function (result, item) {
|
|
681
719
|
return _parseFloat(String(item[key] || 0)) + result;
|
|
@@ -697,7 +735,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
697
735
|
}
|
|
698
736
|
return resItems;
|
|
699
737
|
});
|
|
700
|
-
_defineProperty(
|
|
738
|
+
_defineProperty(_this, "toTotalFooter", function () {
|
|
701
739
|
var _this$props8 = _this.props,
|
|
702
740
|
cols = _this$props8.cols,
|
|
703
741
|
items = _this$props8.items,
|
|
@@ -713,11 +751,11 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
713
751
|
return item.checked;
|
|
714
752
|
});
|
|
715
753
|
var countItems = checkedItems.length ? checkedItems : items;
|
|
716
|
-
var totalItems = _mapInstanceProperty(totalCols).call(totalCols, function (
|
|
717
|
-
var title =
|
|
718
|
-
key =
|
|
719
|
-
|
|
720
|
-
props =
|
|
754
|
+
var totalItems = _mapInstanceProperty(totalCols).call(totalCols, function (_ref14) {
|
|
755
|
+
var title = _ref14.title,
|
|
756
|
+
key = _ref14.key,
|
|
757
|
+
_ref14$props = _ref14.props,
|
|
758
|
+
props = _ref14$props === void 0 ? {} : _ref14$props;
|
|
721
759
|
var value = _reduceInstanceProperty(countItems).call(countItems, function (result, item) {
|
|
722
760
|
return _parseFloat((result + Number(item[key] || 0)).toFixed(props.precision || 6));
|
|
723
761
|
}, 0);
|
|
@@ -735,9 +773,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
735
773
|
style: {
|
|
736
774
|
marginRight: "15px"
|
|
737
775
|
}
|
|
738
|
-
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), _mapInstanceProperty(totalItems).call(totalItems, function (
|
|
739
|
-
var title =
|
|
740
|
-
value =
|
|
776
|
+
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), _mapInstanceProperty(totalItems).call(totalItems, function (_ref15, index) {
|
|
777
|
+
var title = _ref15.title,
|
|
778
|
+
value = _ref15.value;
|
|
741
779
|
return /*#__PURE__*/React.createElement("span", {
|
|
742
780
|
key: index,
|
|
743
781
|
style: {
|
|
@@ -753,7 +791,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
753
791
|
return null;
|
|
754
792
|
}
|
|
755
793
|
});
|
|
756
|
-
_defineProperty(
|
|
794
|
+
_defineProperty(_this, "getProps", function () {
|
|
757
795
|
var _this$props9 = _this.props,
|
|
758
796
|
cols = _this$props9.cols,
|
|
759
797
|
_this$props9$isPaging = _this$props9.isPaging,
|
|
@@ -764,20 +802,38 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
764
802
|
isWeaken = _this$props9$isWeaken === void 0 ? false : _this$props9$isWeaken,
|
|
765
803
|
dragSort = _this$props9.dragSort,
|
|
766
804
|
_this$props9$footer = _this$props9.footer,
|
|
767
|
-
footer = _this$props9$footer === void 0 ? null : _this$props9$footer
|
|
805
|
+
footer = _this$props9$footer === void 0 ? null : _this$props9$footer,
|
|
806
|
+
maxHeight = _this$props9.maxHeight;
|
|
768
807
|
var items = _this.getItems();
|
|
769
808
|
var _this$getPropsByCheck = _this.getPropsByCheckbox(items),
|
|
770
809
|
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
771
810
|
extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
|
|
772
|
-
var
|
|
811
|
+
var needLeft = false;
|
|
812
|
+
_mapInstanceProperty(cols).call(cols, function (col) {
|
|
813
|
+
if (col.fixed && col.fixed === 'left') {
|
|
814
|
+
needLeft = true;
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
var widthX = 0;
|
|
818
|
+
_mapInstanceProperty(cols).call(cols, function (item) {
|
|
819
|
+
var _context0;
|
|
820
|
+
item.width = item.width ? item.width : _includesInstanceProperty(_context0 = ['index', 'checked']).call(_context0, item.key) ? 70 : 180;
|
|
821
|
+
widthX += item.width;
|
|
822
|
+
});
|
|
823
|
+
var scrollProps = {
|
|
824
|
+
scroll: {
|
|
825
|
+
x: _someInstanceProperty(cols).call(cols, function (item) {
|
|
826
|
+
return !helper.isEmpty2(item.fixed);
|
|
827
|
+
}) ? widthX + 140 : true,
|
|
828
|
+
y: maxHeight
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
var renderProps = _objectSpread(_objectSpread({
|
|
773
832
|
className: !isEmphasized || !isWeaken ? variables('SuperTable') : variables('SuperTable').noTransition,
|
|
774
833
|
columns: _this.getColumns(cols, items),
|
|
775
834
|
dataSource: _this.getDataSource(items, cols),
|
|
776
835
|
size: 'small',
|
|
777
836
|
pagination: isPaging,
|
|
778
|
-
scroll: {
|
|
779
|
-
x: true
|
|
780
|
-
},
|
|
781
837
|
onChange: _this.onTableChange,
|
|
782
838
|
onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick, items),
|
|
783
839
|
components: dragSort ? {
|
|
@@ -786,31 +842,21 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
786
842
|
}
|
|
787
843
|
} : {},
|
|
788
844
|
footer: footer ? footer : _this.toTotalFooter
|
|
789
|
-
}, extraProps);
|
|
845
|
+
}, extraProps), scrollProps);
|
|
790
846
|
return renderProps;
|
|
791
847
|
});
|
|
792
|
-
_defineProperty(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
pageTotal = _this$props10.pageTotal,
|
|
796
|
-
searchTotal = _this$props10.searchTotal;
|
|
797
|
-
if (maxHeight && _this.getItems().length) {
|
|
798
|
-
var root = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
|
848
|
+
_defineProperty(_this, "setScroll", function () {
|
|
849
|
+
if (_this.props.maxHeight && _this.props.items.length) {
|
|
850
|
+
var root = ReactDOM.findDOMNode(_this);
|
|
799
851
|
var container = root.getElementsByClassName('ant-table-body')[0];
|
|
800
852
|
var header = root.getElementsByClassName('ant-table-thead')[0];
|
|
801
|
-
|
|
802
|
-
var pageTotalOffset = searchTotal ? 2 : 1;
|
|
803
|
-
var pageTotalElement = pageTotal && tbody && tbody.children ? tbody.children[tbody.children.length - pageTotalOffset] : null;
|
|
804
|
-
var searchTotalElement = searchTotal && tbody && tbody.children ? tbody.children[tbody.children.length - 1] : null;
|
|
805
|
-
fixed(container, header, maxHeight, {
|
|
806
|
-
pageTotalElement: pageTotalElement,
|
|
807
|
-
searchTotalElement: searchTotalElement
|
|
808
|
-
});
|
|
853
|
+
fixed(container, header, _this.props.maxHeight, {});
|
|
809
854
|
}
|
|
810
855
|
});
|
|
811
856
|
return _this;
|
|
812
857
|
}
|
|
813
|
-
|
|
858
|
+
_inherits(SuperTable, _React$Component);
|
|
859
|
+
return _createClass(SuperTable, [{
|
|
814
860
|
key: "shouldComponentUpdate",
|
|
815
861
|
value: function shouldComponentUpdate(props, state) {
|
|
816
862
|
var _this2 = this;
|
|
@@ -837,7 +883,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
837
883
|
}));
|
|
838
884
|
}
|
|
839
885
|
}]);
|
|
840
|
-
return SuperTable;
|
|
841
886
|
}(React.Component);
|
|
842
887
|
_defineProperty(SuperTable, "propTypes", {
|
|
843
888
|
cols: PropTypes.arrayOf(PropTypes.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;
|