cloud-b2b 1.1.26 → 1.1.28
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 +16 -45
- package/es/Card/Card.js +3 -4
- package/es/CodeInput/CodeInput.js +30 -59
- package/es/Control/Control.js +47 -94
- package/es/Control/event.js +0 -14
- package/es/Enhance/Dialogs.js +0 -15
- package/es/Enhance/Loading.js +16 -36
- package/es/Enhance/index.js +0 -2
- package/es/Header/Header.js +3 -35
- package/es/Header/Vertical.js +1 -24
- package/es/ImageView/ImageView.js +5 -22
- package/es/Indent/Indent.js +3 -7
- package/es/InpurCascader/InputCascader.js +10 -36
- package/es/InputEditor/InputEditor.js +55 -55
- package/es/InputSearch/InputSearch.js +26 -71
- package/es/InputSelect/InputSelect.js +17 -48
- package/es/InputWriting/InputWriting.js +6 -28
- package/es/Layout/Layout.js +28 -59
- package/es/LayoutLink/LayoutLink.js +11 -20
- package/es/Link/Link.js +4 -27
- package/es/Loading/Loading.js +1 -3
- package/es/Loading2/Loading2.js +0 -2
- package/es/ModalWithDrag/ModalWithDrag.js +3 -8
- package/es/ModalWithDrag/drag.js +12 -29
- package/es/NumberInput/NumberInput.js +24 -63
- package/es/Search/Search.js +53 -149
- package/es/Sidebar/Sidebar.js +13 -34
- package/es/Sidebar2/Sidebar.js +3 -30
- package/es/SuperForm/SuperForm.js +27 -150
- package/es/SuperForm2/SuperForm.js +31 -165
- package/es/SuperIcon/SuperIcon.js +3 -6
- package/es/SuperPagination/SuperPagination.js +15 -32
- package/es/SuperTab/SuperTab.js +4 -27
- package/es/SuperTab2/SuperTab2.js +11 -33
- package/es/SuperTable/DragSortRow.js +6 -34
- package/es/SuperTable/FilterDropDown.js +10 -34
- package/es/SuperTable/SuperTable.js +91 -216
- package/es/SuperTable/fixed.js +1 -9
- package/es/SuperTable2/SuperTable2.js +104 -206
- package/es/SuperTable2/SuperTableCell.js +16 -55
- package/es/SuperTable3/FilterDropDown.js +10 -34
- package/es/SuperTable3/SuperTable.js +57 -175
- package/es/SuperTable3/fixed.js +1 -9
- package/es/SuperToolbar/SuperToolbar.js +21 -49
- package/es/SuperUpload/SuperUpload.js +73 -110
- package/es/Title/Title.js +12 -15
- package/es/Viewer/ImageViews.js +7 -60
- package/es/Viewer/Viewer.js +7 -34
- package/es/WingBlank/WingBlank.js +2 -6
- package/es/helper.js +36 -23
- package/es/history.js +3 -2
- package/lib/Area/Area.js +16 -64
- package/lib/Card/Card.js +3 -13
- package/lib/CodeInput/CodeInput.js +30 -77
- package/lib/Control/Control.js +47 -135
- package/lib/Control/event.js +0 -16
- package/lib/Enhance/Dialogs.js +0 -26
- package/lib/Enhance/Loading.js +16 -52
- package/lib/Enhance/index.js +0 -9
- package/lib/Header/Header.js +3 -48
- package/lib/Header/Vertical.js +1 -36
- package/lib/ImageView/ImageView.js +5 -30
- package/lib/Indent/Indent.js +3 -13
- package/lib/InpurCascader/InputCascader.js +11 -50
- package/lib/InputEditor/InputEditor.js +55 -64
- package/lib/InputSearch/InputSearch.js +26 -78
- package/lib/InputSelect/InputSelect.js +17 -62
- package/lib/InputWriting/InputWriting.js +6 -35
- package/lib/Layout/Layout.js +28 -76
- package/lib/LayoutLink/LayoutLink.js +11 -38
- package/lib/Link/Link.js +4 -40
- package/lib/Loading/Loading.js +1 -9
- package/lib/Loading2/Loading2.js +0 -8
- package/lib/ModalWithDrag/ModalWithDrag.js +3 -18
- package/lib/ModalWithDrag/drag.js +12 -34
- package/lib/NumberInput/NumberInput.js +24 -76
- package/lib/Search/Search.js +53 -157
- package/lib/Sidebar/Sidebar.js +13 -46
- package/lib/Sidebar2/Sidebar.js +3 -42
- package/lib/SuperForm/SuperForm.js +27 -149
- package/lib/SuperForm2/SuperForm.js +31 -160
- package/lib/SuperIcon/SuperIcon.js +3 -14
- package/lib/SuperPagination/SuperPagination.js +15 -42
- package/lib/SuperTab/SuperTab.js +4 -34
- package/lib/SuperTab2/SuperTab2.js +11 -48
- package/lib/SuperTable/DragSortRow.js +6 -42
- package/lib/SuperTable/FilterDropDown.js +10 -42
- package/lib/SuperTable/SuperTable.js +90 -210
- package/lib/SuperTable/fixed.js +1 -13
- package/lib/SuperTable2/SuperTable2.js +104 -222
- package/lib/SuperTable2/SuperTableCell.js +13 -62
- package/lib/SuperTable3/FilterDropDown.js +10 -42
- package/lib/SuperTable3/SuperTable.js +56 -169
- package/lib/SuperTable3/fixed.js +1 -13
- package/lib/SuperToolbar/SuperToolbar.js +20 -64
- package/lib/SuperUpload/SuperUpload.js +73 -140
- package/lib/Title/Title.js +12 -24
- package/lib/Viewer/ImageViews.js +7 -63
- package/lib/Viewer/Viewer.js +7 -43
- package/lib/WingBlank/WingBlank.js +2 -14
- package/lib/helper.js +36 -37
- package/lib/history.js +0 -5
- package/lib/index.js +0 -76
- package/lib/variables.js +0 -4
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
|
8
8
|
import _Table from "antd/es/table";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
10
10
|
import _Tooltip from "antd/es/tooltip";
|
|
11
|
+
import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/objectDestructuringEmpty";
|
|
11
12
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
12
13
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
13
14
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
@@ -17,11 +18,8 @@ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleC
|
|
|
17
18
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
18
19
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
19
20
|
var _excluded = ["onRowClick"];
|
|
20
|
-
|
|
21
21
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
-
|
|
23
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context11 = ownKeys(Object(source), !0)).call(_context11, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context12 = ownKeys(Object(source))).call(_context12, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
|
-
|
|
25
23
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
26
24
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
27
25
|
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
@@ -37,11 +35,8 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
37
35
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
38
36
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
39
37
|
import _parseFloat from "@babel/runtime-corejs3/core-js-stable/parse-float";
|
|
40
|
-
|
|
41
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
42
|
-
|
|
43
39
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
44
|
-
|
|
45
40
|
import React from 'react';
|
|
46
41
|
import PropTypes from 'prop-types';
|
|
47
42
|
import ReactDOM from 'react-dom';
|
|
@@ -49,6 +44,7 @@ import { getTitle } from '../Control';
|
|
|
49
44
|
import FilterDropDown from './FilterDropDown';
|
|
50
45
|
import fixed from './fixed';
|
|
51
46
|
import variables from '../variables';
|
|
47
|
+
|
|
52
48
|
/**
|
|
53
49
|
* sorter: [可选],不传表示该列不支持排序;为string表示按字符串排序;为number表示按数字大小排序
|
|
54
50
|
* filter: [可选],是否支持过滤,默认为false
|
|
@@ -57,7 +53,6 @@ import variables from '../variables';
|
|
|
57
53
|
* isDateFilterByStartAndEnd: [可选],为true时做过滤操作会显示时间段搜索,默认为false
|
|
58
54
|
*
|
|
59
55
|
*/
|
|
60
|
-
|
|
61
56
|
var ColType = {
|
|
62
57
|
key: PropTypes.string.isRequired,
|
|
63
58
|
title: PropTypes.string,
|
|
@@ -74,6 +69,7 @@ var ColType = {
|
|
|
74
69
|
var ItemType = {
|
|
75
70
|
checked: PropTypes.bool
|
|
76
71
|
};
|
|
72
|
+
|
|
77
73
|
/**
|
|
78
74
|
* onCheck:点击复选框时触发, 原型为onCheck(checkedRows)
|
|
79
75
|
* onRadio: 点击单选按钮时触发,原型为func(checkedRows)
|
|
@@ -81,7 +77,6 @@ var ItemType = {
|
|
|
81
77
|
* onLink: 点击超链接时触发,原型为func(key, rowIndex, item)
|
|
82
78
|
* onTableChange: 排序信息改变时触发,原型为func(sortInfo, filterInfo)
|
|
83
79
|
*/
|
|
84
|
-
|
|
85
80
|
var CallbackType = {
|
|
86
81
|
onCheck: PropTypes.func,
|
|
87
82
|
onRadio: PropTypes.func,
|
|
@@ -89,6 +84,7 @@ var CallbackType = {
|
|
|
89
84
|
onLink: PropTypes.func,
|
|
90
85
|
onTableChange: PropTypes.func
|
|
91
86
|
};
|
|
87
|
+
|
|
92
88
|
/**
|
|
93
89
|
* checkbox: [可选],是否有复选框,默认为true
|
|
94
90
|
* isPaging: [可选],是否分页,默认为false
|
|
@@ -101,68 +97,51 @@ var CallbackType = {
|
|
|
101
97
|
* maxHeight: [可选],设置表格的最大高度
|
|
102
98
|
* childrenKey: [可选],设置子列表数据的key,默认children
|
|
103
99
|
*/
|
|
104
|
-
|
|
105
100
|
var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
106
101
|
_inherits(SuperTable, _React$Component);
|
|
107
|
-
|
|
108
102
|
var _super = _createSuper(SuperTable);
|
|
109
|
-
|
|
110
103
|
function SuperTable() {
|
|
111
104
|
var _context;
|
|
112
|
-
|
|
113
105
|
var _this;
|
|
114
|
-
|
|
115
106
|
_classCallCheck(this, SuperTable);
|
|
116
|
-
|
|
117
107
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
118
108
|
args[_key] = arguments[_key];
|
|
119
109
|
}
|
|
120
|
-
|
|
121
110
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
122
|
-
|
|
123
111
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
124
112
|
filterVisibleKey: ''
|
|
125
113
|
});
|
|
126
|
-
|
|
127
114
|
_defineProperty(_assertThisInitialized(_this), "onTableChange", function (pagination, filters, sorter) {
|
|
128
115
|
var _ref = _this.props.callback || {},
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
onTableChange = _ref.onTableChange;
|
|
131
117
|
var _this$props$filterInf = _this.props.filterInfo,
|
|
132
|
-
|
|
118
|
+
filterInfo = _this$props$filterInf === void 0 ? null : _this$props$filterInf;
|
|
133
119
|
onTableChange && onTableChange(sorter, filterInfo);
|
|
134
120
|
});
|
|
135
|
-
|
|
136
121
|
_defineProperty(_assertThisInitialized(_this), "onChange", function () {
|
|
137
122
|
var selectedKeyArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
138
|
-
|
|
139
123
|
var _ref2 = _this.props.callback || {},
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
onCheck = _ref2.onCheck;
|
|
142
125
|
if (onCheck) {
|
|
143
126
|
var _this$props$items = _this.props.items,
|
|
144
|
-
|
|
127
|
+
items = _this$props$items === void 0 ? [] : _this$props$items;
|
|
145
128
|
var offset = 0;
|
|
146
129
|
var realSlectedList = selectedKeyArr.length > items.length ? _sliceInstanceProperty(selectedKeyArr).call(selectedKeyArr, 0, selectedKeyArr.length + offset) : selectedKeyArr;
|
|
147
130
|
var selectedKeys = realSlectedList;
|
|
148
131
|
var newItems = items;
|
|
149
|
-
|
|
150
132
|
if (selectedKeys.length === 0) {
|
|
151
133
|
onCheck(true, false, -1);
|
|
152
134
|
} else if (selectedKeys.length === newItems.length) {
|
|
153
135
|
var checked = _everyInstanceProperty(newItems).call(newItems, function (o) {
|
|
154
136
|
return o.checked;
|
|
155
137
|
});
|
|
156
|
-
|
|
157
138
|
onCheck(true, !checked, -1);
|
|
158
139
|
} else {
|
|
159
140
|
var defaultSelectedKeys = _this.getSelectedRowKeys(newItems);
|
|
160
|
-
|
|
161
141
|
if (selectedKeys.length > defaultSelectedKeys.length) {
|
|
162
142
|
if (_this.props.isPaging && selectedKeys.length - defaultSelectedKeys.length > 1) {
|
|
163
143
|
return onCheck(true, true, -1);
|
|
164
144
|
}
|
|
165
|
-
|
|
166
145
|
onCheck(false, true, selectedKeys[selectedKeys.length - 1]);
|
|
167
146
|
} else {
|
|
168
147
|
var index = _findIndexInstanceProperty(defaultSelectedKeys).call(defaultSelectedKeys, function (key) {
|
|
@@ -170,46 +149,36 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
170
149
|
return select === key;
|
|
171
150
|
});
|
|
172
151
|
});
|
|
173
|
-
|
|
174
152
|
onCheck(false, false, defaultSelectedKeys[index]);
|
|
175
153
|
}
|
|
176
154
|
}
|
|
177
155
|
}
|
|
178
156
|
});
|
|
179
|
-
|
|
180
157
|
_defineProperty(_assertThisInitialized(_this), "onCheckChange", function (selectedKeys) {
|
|
181
158
|
var _ref3 = _this.props.callback || {},
|
|
182
|
-
|
|
183
|
-
|
|
159
|
+
onCheck = _ref3.onCheck;
|
|
184
160
|
onCheck && onCheck(selectedKeys);
|
|
185
161
|
});
|
|
186
|
-
|
|
187
162
|
_defineProperty(_assertThisInitialized(_this), "onRadioChange", function (selectedKeys) {
|
|
188
163
|
var _ref4 = _this.props.callback || {},
|
|
189
|
-
|
|
190
|
-
|
|
164
|
+
onRadio = _ref4.onRadio;
|
|
191
165
|
onRadio && onRadio(selectedKeys);
|
|
192
166
|
});
|
|
193
|
-
|
|
194
167
|
_defineProperty(_assertThisInitialized(_this), "onRadioRowClick", function (record) {
|
|
195
168
|
var _ref5 = _this.props.callback || {},
|
|
196
|
-
|
|
197
|
-
|
|
169
|
+
onRadio = _ref5.onRadio;
|
|
198
170
|
onRadio && onRadio([record.key]);
|
|
199
171
|
});
|
|
200
|
-
|
|
201
172
|
_defineProperty(_assertThisInitialized(_this), "onRowClick", function (record) {
|
|
202
173
|
var items = _this.props.items;
|
|
203
174
|
if (items.length <= record.key) return;
|
|
204
175
|
clearTimeout(_this.timer);
|
|
205
176
|
_this.timer = _setTimeout(function () {
|
|
206
177
|
var _ref6 = _this.props.callback || {},
|
|
207
|
-
|
|
208
|
-
|
|
178
|
+
onCheck = _ref6.onCheck;
|
|
209
179
|
if (onCheck) {
|
|
210
180
|
var _this$props$checkedRo = _this.props.checkedRows,
|
|
211
|
-
|
|
212
|
-
|
|
181
|
+
checkedRows = _this$props$checkedRo === void 0 ? [] : _this$props$checkedRo;
|
|
213
182
|
if (_includesInstanceProperty(checkedRows).call(checkedRows, record.key)) {
|
|
214
183
|
onCheck(_filterInstanceProperty(checkedRows).call(checkedRows, function (key) {
|
|
215
184
|
return record.key !== key;
|
|
@@ -220,42 +189,34 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
220
189
|
}
|
|
221
190
|
}, 250);
|
|
222
191
|
});
|
|
223
|
-
|
|
224
192
|
_defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (record) {
|
|
225
193
|
clearTimeout(_this.timer);
|
|
226
|
-
|
|
227
194
|
var _ref7 = _this.props.callback || {},
|
|
228
|
-
|
|
229
|
-
|
|
195
|
+
onDoubleClick = _ref7.onDoubleClick;
|
|
230
196
|
onDoubleClick && onDoubleClick(record.key);
|
|
231
197
|
});
|
|
232
|
-
|
|
233
198
|
_defineProperty(_assertThisInitialized(_this), "onLink", function (key, index, item, e) {
|
|
234
199
|
var _ref8 = _this.props.callback || {},
|
|
235
|
-
|
|
236
|
-
|
|
200
|
+
onLink = _ref8.onLink;
|
|
237
201
|
onLink && onLink(key, index, item);
|
|
238
202
|
e.stopPropagation();
|
|
239
203
|
});
|
|
240
|
-
|
|
241
204
|
_defineProperty(_assertThisInitialized(_this), "onLinkDouble", function (e) {
|
|
242
205
|
e.stopPropagation();
|
|
243
206
|
});
|
|
244
|
-
|
|
245
207
|
_defineProperty(_assertThisInitialized(_this), "getSelectedRowKeys", function (items) {
|
|
246
208
|
return _reduceInstanceProperty(items).call(items, function (result, item, index) {
|
|
247
209
|
item.checked && result.push(index);
|
|
248
210
|
return result;
|
|
249
211
|
}, []);
|
|
250
212
|
});
|
|
251
|
-
|
|
252
213
|
_defineProperty(_assertThisInitialized(_this), "getIndexInfo", function () {
|
|
253
214
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
254
215
|
var _this$props = _this.props,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
216
|
+
_this$props$index = _this$props.index,
|
|
217
|
+
index = _this$props$index === void 0 ? true : _this$props$index,
|
|
218
|
+
_this$props$indexTitl = _this$props.indexTitle,
|
|
219
|
+
indexTitle = _this$props$indexTitl === void 0 ? '序号' : _this$props$indexTitl;
|
|
259
220
|
return index ? [{
|
|
260
221
|
key: 'index',
|
|
261
222
|
title: indexTitle,
|
|
@@ -264,15 +225,12 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
264
225
|
}
|
|
265
226
|
}] : [];
|
|
266
227
|
});
|
|
267
|
-
|
|
268
228
|
_defineProperty(_assertThisInitialized(_this), "setSortInfo", function (col, sortInfo) {
|
|
269
229
|
if (col.sorter === 'string') {
|
|
270
230
|
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
271
|
-
|
|
272
231
|
col.sorter = function (row1, row2) {
|
|
273
232
|
var a = !col.link ? row1[col.key] : row1[col.key].props.children;
|
|
274
233
|
var b = !col.link ? row2[col.key] : row2[col.key].props.children;
|
|
275
|
-
|
|
276
234
|
if (a > b) {
|
|
277
235
|
return 1;
|
|
278
236
|
} else if (a === b) {
|
|
@@ -283,7 +241,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
283
241
|
};
|
|
284
242
|
} else if (col.sorter === 'number') {
|
|
285
243
|
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
286
|
-
|
|
287
244
|
col.sorter = function (a, b) {
|
|
288
245
|
return a[col.key] - b[col.key];
|
|
289
246
|
};
|
|
@@ -291,45 +248,35 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
291
248
|
delete col.sorter;
|
|
292
249
|
}
|
|
293
250
|
});
|
|
294
|
-
|
|
295
251
|
_defineProperty(_assertThisInitialized(_this), "setFilterInfo", function (col, filterInfo, visibleKey) {
|
|
296
252
|
if (_filterInstanceProperty(col)) {
|
|
297
253
|
var _col$isDateFilterBySt = col.isDateFilterByStartAndEnd,
|
|
298
|
-
|
|
299
|
-
|
|
254
|
+
isDateFilterByStartAndEnd = _col$isDateFilterBySt === void 0 ? false : _col$isDateFilterBySt;
|
|
300
255
|
var onSearch = function onSearch(value) {
|
|
301
256
|
var _ref9 = _this.props.callback || {},
|
|
302
|
-
|
|
303
|
-
|
|
257
|
+
onTableChange = _ref9.onTableChange;
|
|
304
258
|
var _this$props$sortInfo = _this.props.sortInfo,
|
|
305
|
-
|
|
306
|
-
|
|
259
|
+
sortInfo = _this$props$sortInfo === void 0 ? null : _this$props$sortInfo;
|
|
307
260
|
var newFilterInfo = _Object$assign({}, filterInfo, _defineProperty({}, col.key, value));
|
|
308
|
-
|
|
309
261
|
_this.setState({
|
|
310
262
|
filterVisibleKey: ''
|
|
311
263
|
});
|
|
312
|
-
|
|
313
264
|
onTableChange && onTableChange(sortInfo, newFilterInfo);
|
|
314
265
|
};
|
|
315
|
-
|
|
316
266
|
var value = filterInfo[col.key];
|
|
317
267
|
col.filteredValue = value ? [value] : null;
|
|
318
268
|
col.filterDropdownVisible = visibleKey === col.key;
|
|
319
|
-
|
|
320
269
|
var onClose = function onClose() {
|
|
321
270
|
_this.setState({
|
|
322
271
|
filterVisibleKey: ''
|
|
323
272
|
});
|
|
324
273
|
};
|
|
325
|
-
|
|
326
274
|
col.filterDropdown = /*#__PURE__*/React.createElement(FilterDropDown, {
|
|
327
275
|
value: value,
|
|
328
276
|
onSearch: onSearch,
|
|
329
277
|
onClose: onClose,
|
|
330
278
|
isDateFilterByStartAndEnd: isDateFilterByStartAndEnd
|
|
331
279
|
});
|
|
332
|
-
|
|
333
280
|
col.onFilterDropdownVisibleChange = function (visible) {
|
|
334
281
|
if (isDateFilterByStartAndEnd) {
|
|
335
282
|
visible && _this.setState({
|
|
@@ -341,10 +288,8 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
341
288
|
});
|
|
342
289
|
}
|
|
343
290
|
};
|
|
344
|
-
|
|
345
291
|
col.onFilter = function (value, record) {
|
|
346
292
|
var content = !col.link ? record[col.key] : record[col.key].props.children;
|
|
347
|
-
|
|
348
293
|
if (!col.isDateFilterByStartAndEnd) {
|
|
349
294
|
var con = _Array$isArray(content) ? content : String(content);
|
|
350
295
|
return _includesInstanceProperty(con).call(con, value);
|
|
@@ -353,20 +298,15 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
353
298
|
}
|
|
354
299
|
};
|
|
355
300
|
}
|
|
356
|
-
|
|
357
301
|
delete col.filter;
|
|
358
302
|
});
|
|
359
|
-
|
|
360
303
|
_defineProperty(_assertThisInitialized(_this), "linkList", function (key, index, item) {
|
|
361
304
|
var linkTitleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'fileName';
|
|
362
305
|
var list = item[key] || [];
|
|
363
306
|
return /*#__PURE__*/React.createElement("div", null, _mapInstanceProperty(list).call(list, function (item2, index2) {
|
|
364
307
|
var _context2, _context3;
|
|
365
|
-
|
|
366
308
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
367
|
-
|
|
368
309
|
var onClick = _bindInstanceProperty(_context2 = _this.onLink).call(_context2, null, key, index, item2);
|
|
369
|
-
|
|
370
310
|
return /*#__PURE__*/React.createElement("a", {
|
|
371
311
|
key: index2,
|
|
372
312
|
onClick: onClick,
|
|
@@ -374,7 +314,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
374
314
|
}, _concatInstanceProperty(_context3 = "".concat(item2[linkTitleKey])).call(_context3, split));
|
|
375
315
|
}));
|
|
376
316
|
});
|
|
377
|
-
|
|
378
317
|
_defineProperty(_assertThisInitialized(_this), "waring", function (key, index, item, warningKey) {
|
|
379
318
|
var text = item[key] ? item[key] : '';
|
|
380
319
|
var color = item[warningKey] == 1 ? 'red' : 'rgba(0, 0, 0, 0.65)';
|
|
@@ -384,42 +323,32 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
384
323
|
}
|
|
385
324
|
}, text.title ? text.title : text));
|
|
386
325
|
});
|
|
387
|
-
|
|
388
326
|
_defineProperty(_assertThisInitialized(_this), "defaultList", function (key, index, item, text, link) {
|
|
389
327
|
var _context4;
|
|
390
|
-
|
|
391
328
|
var onClick = _bindInstanceProperty(_context4 = _this.onLink).call(_context4, null, key, index, item);
|
|
392
|
-
|
|
393
329
|
if (link && typeof link === 'string') {
|
|
394
330
|
return /*#__PURE__*/React.createElement("a", {
|
|
395
331
|
onClick: onClick,
|
|
396
332
|
onDoubleClick: _this.onLinkDouble
|
|
397
333
|
}, text);
|
|
398
334
|
}
|
|
399
|
-
|
|
400
335
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, text));
|
|
401
336
|
});
|
|
402
|
-
|
|
403
337
|
_defineProperty(_assertThisInitialized(_this), "getColumns", function (cols, items) {
|
|
404
338
|
var _context5, _context6;
|
|
405
|
-
|
|
406
339
|
var _this$props2 = _this.props,
|
|
407
|
-
|
|
408
|
-
|
|
340
|
+
sortInfo = _this$props2.sortInfo,
|
|
341
|
+
filterInfo = _this$props2.filterInfo;
|
|
409
342
|
var filterVisibleKey = _this.state.filterVisibleKey;
|
|
410
343
|
return _mapInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _this.getIndexInfo(items)).call(_context6, _filterInstanceProperty(cols).call(cols, function (col) {
|
|
411
344
|
return !col.hide;
|
|
412
345
|
}))).call(_context5, function (_ref10) {
|
|
413
|
-
var col = _extends({}, _ref10);
|
|
414
|
-
|
|
346
|
+
var col = _extends({}, (_objectDestructuringEmpty(_ref10), _ref10));
|
|
415
347
|
col.dataIndex = col.key;
|
|
416
348
|
col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? s[col.align] : '';
|
|
417
349
|
col.noWrap && (col.className = variables('SuperTable3').noWrap);
|
|
418
|
-
|
|
419
350
|
_this.setSortInfo(col, sortInfo || {});
|
|
420
|
-
|
|
421
351
|
_this.setFilterInfo(col, filterInfo || {}, filterVisibleKey);
|
|
422
|
-
|
|
423
352
|
if (col.defaultValue) {
|
|
424
353
|
col.render = function (text, record, index) {
|
|
425
354
|
return _this.defaultList(col.key, index, items[index], col.defaultValue, col.link);
|
|
@@ -441,11 +370,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
441
370
|
return _this.tooltip(col.key, index, items[index], col);
|
|
442
371
|
};
|
|
443
372
|
}
|
|
444
|
-
|
|
445
373
|
return col;
|
|
446
374
|
});
|
|
447
375
|
});
|
|
448
|
-
|
|
449
376
|
_defineProperty(_assertThisInitialized(_this), "getText", function (value, options) {
|
|
450
377
|
if (_Array$isArray(value)) {
|
|
451
378
|
return _mapInstanceProperty(value).call(value, function (v) {
|
|
@@ -455,41 +382,38 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
455
382
|
return getTitle(value, options);
|
|
456
383
|
}
|
|
457
384
|
});
|
|
458
|
-
|
|
459
385
|
_defineProperty(_assertThisInitialized(_this), "link", function (key, index, item, text) {
|
|
460
386
|
var _context7;
|
|
461
|
-
|
|
462
387
|
var onClick = _bindInstanceProperty(_context7 = _this.onLink).call(_context7, null, key, index, item);
|
|
463
|
-
|
|
464
388
|
return /*#__PURE__*/React.createElement("a", {
|
|
465
389
|
onClick: onClick,
|
|
466
390
|
onDoubleClick: _this.onLinkDouble
|
|
467
391
|
}, text);
|
|
468
392
|
});
|
|
469
|
-
|
|
470
393
|
_defineProperty(_assertThisInitialized(_this), "tooltip", function (key, index, item, _ref11) {
|
|
471
394
|
var tipLen = _ref11.tooltip,
|
|
472
|
-
|
|
473
|
-
|
|
395
|
+
options = _ref11.options;
|
|
474
396
|
var text = _this.getText(item[key], options);
|
|
475
|
-
|
|
476
397
|
var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
|
|
477
398
|
return needTip ? /*#__PURE__*/React.createElement(_Tooltip, {
|
|
478
399
|
title: text
|
|
479
400
|
}, /*#__PURE__*/React.createElement("span", null, _sliceInstanceProperty(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/React.createElement("span", null, _Array$isArray(text) ? text.join(',') : text);
|
|
480
401
|
});
|
|
481
|
-
|
|
482
402
|
_defineProperty(_assertThisInitialized(_this), "getImgSrc", function (value, options) {
|
|
483
403
|
var index = _findIndexInstanceProperty(options).call(options, function (obj) {
|
|
484
404
|
return obj.value == value;
|
|
485
405
|
});
|
|
486
|
-
|
|
487
406
|
return index === -1 ? null : options[index].img;
|
|
488
407
|
});
|
|
489
|
-
|
|
408
|
+
/**
|
|
409
|
+
*
|
|
410
|
+
* @param item{array}:列数据
|
|
411
|
+
* @param key{string}:字段key
|
|
412
|
+
* @param options{array}:字段options
|
|
413
|
+
* @param dataSource{string,array}:数据源,如果列数据有多层则用此决定
|
|
414
|
+
*/
|
|
490
415
|
_defineProperty(_assertThisInitialized(_this), "getSourceText", function (item, key, options, dataSource) {
|
|
491
416
|
var value = {};
|
|
492
|
-
|
|
493
417
|
if (typeof dataSource === 'string') {
|
|
494
418
|
value = item[dataSource] || {};
|
|
495
419
|
} else if (_Array$isArray(dataSource)) {
|
|
@@ -503,36 +427,28 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
503
427
|
});
|
|
504
428
|
}
|
|
505
429
|
/*如果上面已经取到结果则不进入*/
|
|
506
|
-
|
|
507
|
-
|
|
508
430
|
if (typeof value !== 'string') {
|
|
509
431
|
value = value[key];
|
|
510
432
|
}
|
|
511
|
-
|
|
512
433
|
return _this.getText(value, options);
|
|
513
434
|
});
|
|
514
|
-
|
|
515
435
|
_defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
|
|
516
436
|
var getItemObj = function getItemObj(item, index) {
|
|
517
437
|
return _reduceInstanceProperty(cols).call(cols, function (result, _ref12) {
|
|
518
438
|
var key = _ref12.key,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
439
|
+
options = _ref12.options,
|
|
440
|
+
link = _ref12.link,
|
|
441
|
+
icon = _ref12.icon,
|
|
442
|
+
dataSource = _ref12.dataSource;
|
|
524
443
|
if (link) {
|
|
525
444
|
if (typeof link === 'boolean') {
|
|
526
445
|
result[key] = _this.link(key, index, item, _this.getText(item[key], options));
|
|
527
446
|
}
|
|
528
447
|
} else if (icon) {
|
|
529
448
|
var _context8;
|
|
530
|
-
|
|
531
449
|
//单独的icon列,icon=true数据值根据options获得显示的图片url
|
|
532
450
|
var src = _this.getImgSrc(item[key], options);
|
|
533
|
-
|
|
534
451
|
var onClick = _bindInstanceProperty(_context8 = _this.onLink).call(_context8, null, key, index, item);
|
|
535
|
-
|
|
536
452
|
result[key] = src ? /*#__PURE__*/React.createElement("img", {
|
|
537
453
|
src: src,
|
|
538
454
|
onClick: onClick
|
|
@@ -542,40 +458,32 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
542
458
|
} else {
|
|
543
459
|
result[key] = _this.getText(item[key], options);
|
|
544
460
|
}
|
|
545
|
-
|
|
546
461
|
return result;
|
|
547
462
|
}, {
|
|
548
463
|
key: index,
|
|
549
464
|
checked: !!item.checked
|
|
550
465
|
});
|
|
551
466
|
};
|
|
552
|
-
|
|
553
467
|
var data = _mapInstanceProperty(items).call(items, function (item, index) {
|
|
554
468
|
var _context9;
|
|
555
|
-
|
|
556
469
|
return _objectSpread(_objectSpread({}, getItemObj(item, index)), {}, {
|
|
557
470
|
children: item.children ? _mapInstanceProperty(_context9 = item.children).call(_context9, function (item2, index2) {
|
|
558
471
|
var _context10;
|
|
559
|
-
|
|
560
472
|
return getItemObj(item2, _concatInstanceProperty(_context10 = "".concat(index, "-")).call(_context10, index2));
|
|
561
473
|
}) : null
|
|
562
474
|
});
|
|
563
475
|
});
|
|
564
|
-
|
|
565
476
|
return data;
|
|
566
477
|
});
|
|
567
|
-
|
|
568
478
|
_defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox", function () {
|
|
569
479
|
var _this$props3 = _this.props,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
480
|
+
_this$props3$checkbox = _this$props3.checkbox,
|
|
481
|
+
checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
|
|
482
|
+
_this$props3$checkedR = _this$props3.checkedRows,
|
|
483
|
+
checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR;
|
|
575
484
|
var rowClassName1 = function rowClassName1(record) {
|
|
576
485
|
return _includesInstanceProperty(checkedRows).call(checkedRows, record.key) ? variables('SuperTable3').select : '';
|
|
577
486
|
};
|
|
578
|
-
|
|
579
487
|
if (checkbox) {
|
|
580
488
|
return {
|
|
581
489
|
rowClassName: rowClassName1,
|
|
@@ -585,7 +493,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
585
493
|
onChange: _this.onCheckChange,
|
|
586
494
|
getCheckboxProps: function getCheckboxProps(record) {
|
|
587
495
|
var checked = _includesInstanceProperty(checkedRows).call(checkedRows, record.key);
|
|
588
|
-
|
|
589
496
|
return {
|
|
590
497
|
checked: checked
|
|
591
498
|
};
|
|
@@ -594,7 +501,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
594
501
|
};
|
|
595
502
|
}
|
|
596
503
|
});
|
|
597
|
-
|
|
598
504
|
_defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick) {
|
|
599
505
|
return function (record) {
|
|
600
506
|
return {
|
|
@@ -607,13 +513,11 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
607
513
|
};
|
|
608
514
|
};
|
|
609
515
|
});
|
|
610
|
-
|
|
611
516
|
_defineProperty(_assertThisInitialized(_this), "getItems", function () {
|
|
612
517
|
var _this$props4 = _this.props,
|
|
613
|
-
|
|
614
|
-
|
|
518
|
+
items = _this$props4.items,
|
|
519
|
+
childrenKey = _this$props4.childrenKey;
|
|
615
520
|
var resItems = items;
|
|
616
|
-
|
|
617
521
|
if (childrenKey) {
|
|
618
522
|
resItems = _mapInstanceProperty(items).call(items, function (o) {
|
|
619
523
|
return o[childrenKey] && o[childrenKey].length ? _objectSpread(_objectSpread({}, o), {}, {
|
|
@@ -621,43 +525,34 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
621
525
|
}) : o;
|
|
622
526
|
});
|
|
623
527
|
}
|
|
624
|
-
|
|
625
528
|
return resItems;
|
|
626
529
|
});
|
|
627
|
-
|
|
628
530
|
_defineProperty(_assertThisInitialized(_this), "toTotalFooter", function () {
|
|
629
531
|
var _this$props5 = _this.props,
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
532
|
+
cols = _this$props5.cols,
|
|
533
|
+
items = _this$props5.items,
|
|
534
|
+
checkedRows = _this$props5.checkedRows;
|
|
634
535
|
var totalCols = _filterInstanceProperty(cols).call(cols, function (item) {
|
|
635
536
|
return item.total;
|
|
636
537
|
});
|
|
637
|
-
|
|
638
538
|
if (totalCols.length > 0) {
|
|
639
539
|
var checkedItems = _filterInstanceProperty(items).call(items, function (item, index) {
|
|
640
540
|
return _includesInstanceProperty(checkedRows).call(checkedRows, index);
|
|
641
541
|
});
|
|
642
|
-
|
|
643
542
|
var countItems = checkedItems.length ? checkedItems : items;
|
|
644
|
-
|
|
645
543
|
var totalItems = _mapInstanceProperty(totalCols).call(totalCols, function (_ref13) {
|
|
646
544
|
var title = _ref13.title,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
545
|
+
key = _ref13.key,
|
|
546
|
+
_ref13$props = _ref13.props,
|
|
547
|
+
props = _ref13$props === void 0 ? {} : _ref13$props;
|
|
651
548
|
var value = _reduceInstanceProperty(countItems).call(countItems, function (result, item) {
|
|
652
549
|
return _parseFloat((result + Number(item[key] || 0)).toFixed(props.precision || 6));
|
|
653
550
|
}, 0);
|
|
654
|
-
|
|
655
551
|
return {
|
|
656
552
|
title: title,
|
|
657
553
|
value: value
|
|
658
554
|
};
|
|
659
555
|
});
|
|
660
|
-
|
|
661
556
|
return /*#__PURE__*/React.createElement("div", {
|
|
662
557
|
style: {
|
|
663
558
|
height: '36px',
|
|
@@ -669,7 +564,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
669
564
|
}
|
|
670
565
|
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), _mapInstanceProperty(totalItems).call(totalItems, function (_ref14, index) {
|
|
671
566
|
var title = _ref14.title,
|
|
672
|
-
|
|
567
|
+
value = _ref14.value;
|
|
673
568
|
return /*#__PURE__*/React.createElement("span", {
|
|
674
569
|
key: index,
|
|
675
570
|
style: {
|
|
@@ -685,21 +580,17 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
685
580
|
return null;
|
|
686
581
|
}
|
|
687
582
|
});
|
|
688
|
-
|
|
689
583
|
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
690
584
|
var _this$props6 = _this.props,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
585
|
+
cols = _this$props6.cols,
|
|
586
|
+
_this$props6$isPaging = _this$props6.isPaging,
|
|
587
|
+
isPaging = _this$props6$isPaging === void 0 ? false : _this$props6$isPaging,
|
|
588
|
+
_this$props6$footer = _this$props6.footer,
|
|
589
|
+
footer = _this$props6$footer === void 0 ? null : _this$props6$footer;
|
|
697
590
|
var items = _this.getItems();
|
|
698
|
-
|
|
699
591
|
var _this$getPropsByCheck = _this.getPropsByCheckbox(items),
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
592
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
593
|
+
extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
|
|
703
594
|
var renderProps = _objectSpread({
|
|
704
595
|
className: variables('SuperTable3'),
|
|
705
596
|
columns: _this.getColumns(cols, items),
|
|
@@ -714,13 +605,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
714
605
|
components: {},
|
|
715
606
|
footer: footer ? footer : _this.toTotalFooter
|
|
716
607
|
}, extraProps);
|
|
717
|
-
|
|
718
608
|
return renderProps;
|
|
719
609
|
});
|
|
720
|
-
|
|
721
610
|
_defineProperty(_assertThisInitialized(_this), "setScroll", function () {
|
|
722
611
|
var maxHeight = _this.props.maxHeight;
|
|
723
|
-
|
|
724
612
|
if (maxHeight && _this.getItems().length) {
|
|
725
613
|
var root = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
|
726
614
|
var container = root.getElementsByClassName('ant-table-body')[0];
|
|
@@ -728,15 +616,12 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
728
616
|
fixed(container, header, maxHeight);
|
|
729
617
|
}
|
|
730
618
|
});
|
|
731
|
-
|
|
732
619
|
return _this;
|
|
733
620
|
}
|
|
734
|
-
|
|
735
621
|
_createClass(SuperTable, [{
|
|
736
622
|
key: "shouldComponentUpdate",
|
|
737
623
|
value: function shouldComponentUpdate(props, state) {
|
|
738
624
|
var _this2 = this;
|
|
739
|
-
|
|
740
625
|
var keys = ['cols', 'items', 'maxHeight', 'checkedRows', 'sortInfo', 'filterInfo'];
|
|
741
626
|
return _someInstanceProperty(keys).call(keys, function (key) {
|
|
742
627
|
return props[key] !== _this2.props[key];
|
|
@@ -760,10 +645,8 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
760
645
|
}));
|
|
761
646
|
}
|
|
762
647
|
}]);
|
|
763
|
-
|
|
764
648
|
return SuperTable;
|
|
765
649
|
}(React.Component);
|
|
766
|
-
|
|
767
650
|
_defineProperty(SuperTable, "propTypes", {
|
|
768
651
|
cols: PropTypes.arrayOf(PropTypes.shape(ColType)).isRequired,
|
|
769
652
|
items: PropTypes.arrayOf(PropTypes.shape(ItemType)).isRequired,
|
|
@@ -779,5 +662,4 @@ _defineProperty(SuperTable, "propTypes", {
|
|
|
779
662
|
callback: PropTypes.shape(CallbackType),
|
|
780
663
|
childrenKey: PropTypes.string
|
|
781
664
|
});
|
|
782
|
-
|
|
783
665
|
export default SuperTable;
|