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