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
|
@@ -1,107 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
4
|
-
|
|
5
4
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
6
|
-
|
|
7
5
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
8
|
-
|
|
9
6
|
var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
10
|
-
|
|
11
7
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
12
|
-
|
|
13
8
|
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
14
|
-
|
|
15
9
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
16
|
-
|
|
17
10
|
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
18
|
-
|
|
19
11
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
20
|
-
|
|
21
12
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
22
|
-
|
|
23
13
|
_Object$defineProperty(exports, "__esModule", {
|
|
24
14
|
value: true
|
|
25
15
|
});
|
|
26
|
-
|
|
27
16
|
exports["default"] = void 0;
|
|
28
|
-
|
|
29
17
|
var _table = _interopRequireDefault(require("antd/lib/table"));
|
|
30
|
-
|
|
31
18
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
32
|
-
|
|
33
19
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
34
|
-
|
|
35
20
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
36
|
-
|
|
37
21
|
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
38
|
-
|
|
39
22
|
var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
40
|
-
|
|
41
23
|
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
42
|
-
|
|
43
24
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
|
44
|
-
|
|
45
25
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
46
|
-
|
|
47
26
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
48
|
-
|
|
49
27
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
50
|
-
|
|
51
28
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
52
|
-
|
|
53
29
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
54
|
-
|
|
55
30
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
56
|
-
|
|
57
31
|
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
58
|
-
|
|
59
32
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
60
|
-
|
|
61
33
|
var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
|
|
62
|
-
|
|
63
34
|
var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
|
|
64
|
-
|
|
35
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectDestructuringEmpty"));
|
|
65
36
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
66
|
-
|
|
67
37
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
68
|
-
|
|
69
38
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
70
|
-
|
|
71
39
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
72
|
-
|
|
73
40
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
74
|
-
|
|
75
41
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
76
|
-
|
|
77
42
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
78
|
-
|
|
79
43
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
80
|
-
|
|
81
44
|
var _react = _interopRequireDefault(require("react"));
|
|
82
|
-
|
|
83
45
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
84
|
-
|
|
85
46
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
86
|
-
|
|
87
47
|
var _Control = require("../Control");
|
|
88
|
-
|
|
89
48
|
var _FilterDropDown = _interopRequireDefault(require("./FilterDropDown"));
|
|
90
|
-
|
|
91
49
|
var _fixed = _interopRequireDefault(require("./fixed"));
|
|
92
|
-
|
|
93
50
|
var _variables = _interopRequireDefault(require("../variables"));
|
|
94
|
-
|
|
95
51
|
var _excluded = ["onRowClick"];
|
|
96
|
-
|
|
97
52
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
98
|
-
|
|
99
53
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty2(_context11 = ownKeys(Object(source), !0)).call(_context11, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context12 = ownKeys(Object(source))).call(_context12, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
100
|
-
|
|
101
54
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
102
|
-
|
|
103
55
|
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; } }
|
|
104
|
-
|
|
105
56
|
/**
|
|
106
57
|
* sorter: [可选],不传表示该列不支持排序;为string表示按字符串排序;为number表示按数字大小排序
|
|
107
58
|
* filter: [可选],是否支持过滤,默认为false
|
|
@@ -126,6 +77,7 @@ var ColType = {
|
|
|
126
77
|
var ItemType = {
|
|
127
78
|
checked: _propTypes["default"].bool
|
|
128
79
|
};
|
|
80
|
+
|
|
129
81
|
/**
|
|
130
82
|
* onCheck:点击复选框时触发, 原型为onCheck(checkedRows)
|
|
131
83
|
* onRadio: 点击单选按钮时触发,原型为func(checkedRows)
|
|
@@ -133,7 +85,6 @@ var ItemType = {
|
|
|
133
85
|
* onLink: 点击超链接时触发,原型为func(key, rowIndex, item)
|
|
134
86
|
* onTableChange: 排序信息改变时触发,原型为func(sortInfo, filterInfo)
|
|
135
87
|
*/
|
|
136
|
-
|
|
137
88
|
var CallbackType = {
|
|
138
89
|
onCheck: _propTypes["default"].func,
|
|
139
90
|
onRadio: _propTypes["default"].func,
|
|
@@ -141,6 +92,7 @@ var CallbackType = {
|
|
|
141
92
|
onLink: _propTypes["default"].func,
|
|
142
93
|
onTableChange: _propTypes["default"].func
|
|
143
94
|
};
|
|
95
|
+
|
|
144
96
|
/**
|
|
145
97
|
* checkbox: [可选],是否有复选框,默认为true
|
|
146
98
|
* isPaging: [可选],是否分页,默认为false
|
|
@@ -153,49 +105,38 @@ var CallbackType = {
|
|
|
153
105
|
* maxHeight: [可选],设置表格的最大高度
|
|
154
106
|
* childrenKey: [可选],设置子列表数据的key,默认children
|
|
155
107
|
*/
|
|
156
|
-
|
|
157
108
|
var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
158
109
|
(0, _inherits2["default"])(SuperTable, _React$Component);
|
|
159
|
-
|
|
160
110
|
var _super = _createSuper(SuperTable);
|
|
161
|
-
|
|
162
111
|
function SuperTable() {
|
|
163
112
|
var _context;
|
|
164
|
-
|
|
165
113
|
var _this;
|
|
166
|
-
|
|
167
114
|
(0, _classCallCheck2["default"])(this, SuperTable);
|
|
168
|
-
|
|
169
115
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
170
116
|
args[_key] = arguments[_key];
|
|
171
117
|
}
|
|
172
|
-
|
|
173
118
|
_this = _super.call.apply(_super, (0, _concat["default"])(_context = [this]).call(_context, args));
|
|
174
119
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
175
120
|
filterVisibleKey: ''
|
|
176
121
|
});
|
|
177
122
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTableChange", function (pagination, filters, sorter) {
|
|
178
123
|
var _ref = _this.props.callback || {},
|
|
179
|
-
|
|
180
|
-
|
|
124
|
+
onTableChange = _ref.onTableChange;
|
|
181
125
|
var _this$props$filterInf = _this.props.filterInfo,
|
|
182
|
-
|
|
126
|
+
filterInfo = _this$props$filterInf === void 0 ? null : _this$props$filterInf;
|
|
183
127
|
onTableChange && onTableChange(sorter, filterInfo);
|
|
184
128
|
});
|
|
185
129
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function () {
|
|
186
130
|
var selectedKeyArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
187
|
-
|
|
188
131
|
var _ref2 = _this.props.callback || {},
|
|
189
|
-
|
|
190
|
-
|
|
132
|
+
onCheck = _ref2.onCheck;
|
|
191
133
|
if (onCheck) {
|
|
192
134
|
var _this$props$items = _this.props.items,
|
|
193
|
-
|
|
135
|
+
items = _this$props$items === void 0 ? [] : _this$props$items;
|
|
194
136
|
var offset = 0;
|
|
195
137
|
var realSlectedList = selectedKeyArr.length > items.length ? (0, _slice["default"])(selectedKeyArr).call(selectedKeyArr, 0, selectedKeyArr.length + offset) : selectedKeyArr;
|
|
196
138
|
var selectedKeys = realSlectedList;
|
|
197
139
|
var newItems = items;
|
|
198
|
-
|
|
199
140
|
if (selectedKeys.length === 0) {
|
|
200
141
|
onCheck(true, false, -1);
|
|
201
142
|
} else if (selectedKeys.length === newItems.length) {
|
|
@@ -205,12 +146,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
205
146
|
onCheck(true, !checked, -1);
|
|
206
147
|
} else {
|
|
207
148
|
var defaultSelectedKeys = _this.getSelectedRowKeys(newItems);
|
|
208
|
-
|
|
209
149
|
if (selectedKeys.length > defaultSelectedKeys.length) {
|
|
210
150
|
if (_this.props.isPaging && selectedKeys.length - defaultSelectedKeys.length > 1) {
|
|
211
151
|
return onCheck(true, true, -1);
|
|
212
152
|
}
|
|
213
|
-
|
|
214
153
|
onCheck(false, true, selectedKeys[selectedKeys.length - 1]);
|
|
215
154
|
} else {
|
|
216
155
|
var index = (0, _findIndex["default"])(defaultSelectedKeys).call(defaultSelectedKeys, function (key) {
|
|
@@ -225,20 +164,17 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
225
164
|
});
|
|
226
165
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCheckChange", function (selectedKeys) {
|
|
227
166
|
var _ref3 = _this.props.callback || {},
|
|
228
|
-
|
|
229
|
-
|
|
167
|
+
onCheck = _ref3.onCheck;
|
|
230
168
|
onCheck && onCheck(selectedKeys);
|
|
231
169
|
});
|
|
232
170
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRadioChange", function (selectedKeys) {
|
|
233
171
|
var _ref4 = _this.props.callback || {},
|
|
234
|
-
|
|
235
|
-
|
|
172
|
+
onRadio = _ref4.onRadio;
|
|
236
173
|
onRadio && onRadio(selectedKeys);
|
|
237
174
|
});
|
|
238
175
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRadioRowClick", function (record) {
|
|
239
176
|
var _ref5 = _this.props.callback || {},
|
|
240
|
-
|
|
241
|
-
|
|
177
|
+
onRadio = _ref5.onRadio;
|
|
242
178
|
onRadio && onRadio([record.key]);
|
|
243
179
|
});
|
|
244
180
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRowClick", function (record) {
|
|
@@ -247,12 +183,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
247
183
|
clearTimeout(_this.timer);
|
|
248
184
|
_this.timer = (0, _setTimeout2["default"])(function () {
|
|
249
185
|
var _ref6 = _this.props.callback || {},
|
|
250
|
-
|
|
251
|
-
|
|
186
|
+
onCheck = _ref6.onCheck;
|
|
252
187
|
if (onCheck) {
|
|
253
188
|
var _this$props$checkedRo = _this.props.checkedRows,
|
|
254
|
-
|
|
255
|
-
|
|
189
|
+
checkedRows = _this$props$checkedRo === void 0 ? [] : _this$props$checkedRo;
|
|
256
190
|
if ((0, _includes["default"])(checkedRows).call(checkedRows, record.key)) {
|
|
257
191
|
onCheck((0, _filter["default"])(checkedRows).call(checkedRows, function (key) {
|
|
258
192
|
return record.key !== key;
|
|
@@ -265,16 +199,13 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
265
199
|
});
|
|
266
200
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (record) {
|
|
267
201
|
clearTimeout(_this.timer);
|
|
268
|
-
|
|
269
202
|
var _ref7 = _this.props.callback || {},
|
|
270
|
-
|
|
271
|
-
|
|
203
|
+
onDoubleClick = _ref7.onDoubleClick;
|
|
272
204
|
onDoubleClick && onDoubleClick(record.key);
|
|
273
205
|
});
|
|
274
206
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLink", function (key, index, item, e) {
|
|
275
207
|
var _ref8 = _this.props.callback || {},
|
|
276
|
-
|
|
277
|
-
|
|
208
|
+
onLink = _ref8.onLink;
|
|
278
209
|
onLink && onLink(key, index, item);
|
|
279
210
|
e.stopPropagation();
|
|
280
211
|
});
|
|
@@ -290,10 +221,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
290
221
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getIndexInfo", function () {
|
|
291
222
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
292
223
|
var _this$props = _this.props,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
224
|
+
_this$props$index = _this$props.index,
|
|
225
|
+
index = _this$props$index === void 0 ? true : _this$props$index,
|
|
226
|
+
_this$props$indexTitl = _this$props.indexTitle,
|
|
227
|
+
indexTitle = _this$props$indexTitl === void 0 ? '序号' : _this$props$indexTitl;
|
|
297
228
|
return index ? [{
|
|
298
229
|
key: 'index',
|
|
299
230
|
title: indexTitle,
|
|
@@ -305,11 +236,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
305
236
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setSortInfo", function (col, sortInfo) {
|
|
306
237
|
if (col.sorter === 'string') {
|
|
307
238
|
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
308
|
-
|
|
309
239
|
col.sorter = function (row1, row2) {
|
|
310
240
|
var a = !col.link ? row1[col.key] : row1[col.key].props.children;
|
|
311
241
|
var b = !col.link ? row2[col.key] : row2[col.key].props.children;
|
|
312
|
-
|
|
313
242
|
if (a > b) {
|
|
314
243
|
return 1;
|
|
315
244
|
} else if (a === b) {
|
|
@@ -320,7 +249,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
320
249
|
};
|
|
321
250
|
} else if (col.sorter === 'number') {
|
|
322
251
|
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
323
|
-
|
|
324
252
|
col.sorter = function (a, b) {
|
|
325
253
|
return a[col.key] - b[col.key];
|
|
326
254
|
};
|
|
@@ -331,40 +259,32 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
331
259
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setFilterInfo", function (col, filterInfo, visibleKey) {
|
|
332
260
|
if ((0, _filter["default"])(col)) {
|
|
333
261
|
var _col$isDateFilterBySt = col.isDateFilterByStartAndEnd,
|
|
334
|
-
|
|
335
|
-
|
|
262
|
+
isDateFilterByStartAndEnd = _col$isDateFilterBySt === void 0 ? false : _col$isDateFilterBySt;
|
|
336
263
|
var onSearch = function onSearch(value) {
|
|
337
264
|
var _ref9 = _this.props.callback || {},
|
|
338
|
-
|
|
339
|
-
|
|
265
|
+
onTableChange = _ref9.onTableChange;
|
|
340
266
|
var _this$props$sortInfo = _this.props.sortInfo,
|
|
341
|
-
|
|
267
|
+
sortInfo = _this$props$sortInfo === void 0 ? null : _this$props$sortInfo;
|
|
342
268
|
var newFilterInfo = (0, _assign["default"])({}, filterInfo, (0, _defineProperty2["default"])({}, col.key, value));
|
|
343
|
-
|
|
344
269
|
_this.setState({
|
|
345
270
|
filterVisibleKey: ''
|
|
346
271
|
});
|
|
347
|
-
|
|
348
272
|
onTableChange && onTableChange(sortInfo, newFilterInfo);
|
|
349
273
|
};
|
|
350
|
-
|
|
351
274
|
var value = filterInfo[col.key];
|
|
352
275
|
col.filteredValue = value ? [value] : null;
|
|
353
276
|
col.filterDropdownVisible = visibleKey === col.key;
|
|
354
|
-
|
|
355
277
|
var onClose = function onClose() {
|
|
356
278
|
_this.setState({
|
|
357
279
|
filterVisibleKey: ''
|
|
358
280
|
});
|
|
359
281
|
};
|
|
360
|
-
|
|
361
282
|
col.filterDropdown = /*#__PURE__*/_react["default"].createElement(_FilterDropDown["default"], {
|
|
362
283
|
value: value,
|
|
363
284
|
onSearch: onSearch,
|
|
364
285
|
onClose: onClose,
|
|
365
286
|
isDateFilterByStartAndEnd: isDateFilterByStartAndEnd
|
|
366
287
|
});
|
|
367
|
-
|
|
368
288
|
col.onFilterDropdownVisibleChange = function (visible) {
|
|
369
289
|
if (isDateFilterByStartAndEnd) {
|
|
370
290
|
visible && _this.setState({
|
|
@@ -376,10 +296,8 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
376
296
|
});
|
|
377
297
|
}
|
|
378
298
|
};
|
|
379
|
-
|
|
380
299
|
col.onFilter = function (value, record) {
|
|
381
300
|
var content = !col.link ? record[col.key] : record[col.key].props.children;
|
|
382
|
-
|
|
383
301
|
if (!col.isDateFilterByStartAndEnd) {
|
|
384
302
|
var con = (0, _isArray["default"])(content) ? content : String(content);
|
|
385
303
|
return (0, _includes["default"])(con).call(con, value);
|
|
@@ -388,7 +306,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
388
306
|
}
|
|
389
307
|
};
|
|
390
308
|
}
|
|
391
|
-
|
|
392
309
|
delete col.filter;
|
|
393
310
|
});
|
|
394
311
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "linkList", function (key, index, item) {
|
|
@@ -396,7 +313,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
396
313
|
var list = item[key] || [];
|
|
397
314
|
return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(list).call(list, function (item2, index2) {
|
|
398
315
|
var _context2, _context3;
|
|
399
|
-
|
|
400
316
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
401
317
|
var onClick = (0, _bind["default"])(_context2 = _this.onLink).call(_context2, null, key, index, item2);
|
|
402
318
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
@@ -417,37 +333,30 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
417
333
|
});
|
|
418
334
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "defaultList", function (key, index, item, text, link) {
|
|
419
335
|
var _context4;
|
|
420
|
-
|
|
421
336
|
var onClick = (0, _bind["default"])(_context4 = _this.onLink).call(_context4, null, key, index, item);
|
|
422
|
-
|
|
423
337
|
if (link && typeof link === 'string') {
|
|
424
338
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
425
339
|
onClick: onClick,
|
|
426
340
|
onDoubleClick: _this.onLinkDouble
|
|
427
341
|
}, text);
|
|
428
342
|
}
|
|
429
|
-
|
|
430
343
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", null, text));
|
|
431
344
|
});
|
|
432
345
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols, items) {
|
|
433
346
|
var _context5, _context6;
|
|
434
|
-
|
|
435
347
|
var _this$props2 = _this.props,
|
|
436
|
-
|
|
437
|
-
|
|
348
|
+
sortInfo = _this$props2.sortInfo,
|
|
349
|
+
filterInfo = _this$props2.filterInfo;
|
|
438
350
|
var filterVisibleKey = _this.state.filterVisibleKey;
|
|
439
351
|
return (0, _map["default"])(_context5 = (0, _concat["default"])(_context6 = _this.getIndexInfo(items)).call(_context6, (0, _filter["default"])(cols).call(cols, function (col) {
|
|
440
352
|
return !col.hide;
|
|
441
353
|
}))).call(_context5, function (_ref10) {
|
|
442
|
-
var col = (0, _extends2["default"])({}, _ref10);
|
|
354
|
+
var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref10), _ref10));
|
|
443
355
|
col.dataIndex = col.key;
|
|
444
356
|
col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? s[col.align] : '';
|
|
445
357
|
col.noWrap && (col.className = (0, _variables["default"])('SuperTable3').noWrap);
|
|
446
|
-
|
|
447
358
|
_this.setSortInfo(col, sortInfo || {});
|
|
448
|
-
|
|
449
359
|
_this.setFilterInfo(col, filterInfo || {}, filterVisibleKey);
|
|
450
|
-
|
|
451
360
|
if (col.defaultValue) {
|
|
452
361
|
col.render = function (text, record, index) {
|
|
453
362
|
return _this.defaultList(col.key, index, items[index], col.defaultValue, col.link);
|
|
@@ -469,7 +378,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
469
378
|
return _this.tooltip(col.key, index, items[index], col);
|
|
470
379
|
};
|
|
471
380
|
}
|
|
472
|
-
|
|
473
381
|
return col;
|
|
474
382
|
});
|
|
475
383
|
});
|
|
@@ -484,7 +392,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
484
392
|
});
|
|
485
393
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "link", function (key, index, item, text) {
|
|
486
394
|
var _context7;
|
|
487
|
-
|
|
488
395
|
var onClick = (0, _bind["default"])(_context7 = _this.onLink).call(_context7, null, key, index, item);
|
|
489
396
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
490
397
|
onClick: onClick,
|
|
@@ -493,10 +400,8 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
493
400
|
});
|
|
494
401
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "tooltip", function (key, index, item, _ref11) {
|
|
495
402
|
var tipLen = _ref11.tooltip,
|
|
496
|
-
|
|
497
|
-
|
|
403
|
+
options = _ref11.options;
|
|
498
404
|
var text = _this.getText(item[key], options);
|
|
499
|
-
|
|
500
405
|
var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
|
|
501
406
|
return needTip ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
|
|
502
407
|
title: text
|
|
@@ -508,9 +413,15 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
508
413
|
});
|
|
509
414
|
return index === -1 ? null : options[index].img;
|
|
510
415
|
});
|
|
416
|
+
/**
|
|
417
|
+
*
|
|
418
|
+
* @param item{array}:列数据
|
|
419
|
+
* @param key{string}:字段key
|
|
420
|
+
* @param options{array}:字段options
|
|
421
|
+
* @param dataSource{string,array}:数据源,如果列数据有多层则用此决定
|
|
422
|
+
*/
|
|
511
423
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getSourceText", function (item, key, options, dataSource) {
|
|
512
424
|
var value = {};
|
|
513
|
-
|
|
514
425
|
if (typeof dataSource === 'string') {
|
|
515
426
|
value = item[dataSource] || {};
|
|
516
427
|
} else if ((0, _isArray["default"])(dataSource)) {
|
|
@@ -524,33 +435,27 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
524
435
|
});
|
|
525
436
|
}
|
|
526
437
|
/*如果上面已经取到结果则不进入*/
|
|
527
|
-
|
|
528
|
-
|
|
529
438
|
if (typeof value !== 'string') {
|
|
530
439
|
value = value[key];
|
|
531
440
|
}
|
|
532
|
-
|
|
533
441
|
return _this.getText(value, options);
|
|
534
442
|
});
|
|
535
443
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
|
|
536
444
|
var getItemObj = function getItemObj(item, index) {
|
|
537
445
|
return (0, _reduce["default"])(cols).call(cols, function (result, _ref12) {
|
|
538
446
|
var key = _ref12.key,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
447
|
+
options = _ref12.options,
|
|
448
|
+
link = _ref12.link,
|
|
449
|
+
icon = _ref12.icon,
|
|
450
|
+
dataSource = _ref12.dataSource;
|
|
544
451
|
if (link) {
|
|
545
452
|
if (typeof link === 'boolean') {
|
|
546
453
|
result[key] = _this.link(key, index, item, _this.getText(item[key], options));
|
|
547
454
|
}
|
|
548
455
|
} else if (icon) {
|
|
549
456
|
var _context8;
|
|
550
|
-
|
|
551
457
|
//单独的icon列,icon=true数据值根据options获得显示的图片url
|
|
552
458
|
var src = _this.getImgSrc(item[key], options);
|
|
553
|
-
|
|
554
459
|
var onClick = (0, _bind["default"])(_context8 = _this.onLink).call(_context8, null, key, index, item);
|
|
555
460
|
result[key] = src ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
556
461
|
src: src,
|
|
@@ -561,21 +466,17 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
561
466
|
} else {
|
|
562
467
|
result[key] = _this.getText(item[key], options);
|
|
563
468
|
}
|
|
564
|
-
|
|
565
469
|
return result;
|
|
566
470
|
}, {
|
|
567
471
|
key: index,
|
|
568
472
|
checked: !!item.checked
|
|
569
473
|
});
|
|
570
474
|
};
|
|
571
|
-
|
|
572
475
|
var data = (0, _map["default"])(items).call(items, function (item, index) {
|
|
573
476
|
var _context9;
|
|
574
|
-
|
|
575
477
|
return _objectSpread(_objectSpread({}, getItemObj(item, index)), {}, {
|
|
576
478
|
children: item.children ? (0, _map["default"])(_context9 = item.children).call(_context9, function (item2, index2) {
|
|
577
479
|
var _context10;
|
|
578
|
-
|
|
579
480
|
return getItemObj(item2, (0, _concat["default"])(_context10 = "".concat(index, "-")).call(_context10, index2));
|
|
580
481
|
}) : null
|
|
581
482
|
});
|
|
@@ -584,15 +485,13 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
584
485
|
});
|
|
585
486
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox", function () {
|
|
586
487
|
var _this$props3 = _this.props,
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
488
|
+
_this$props3$checkbox = _this$props3.checkbox,
|
|
489
|
+
checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
|
|
490
|
+
_this$props3$checkedR = _this$props3.checkedRows,
|
|
491
|
+
checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR;
|
|
592
492
|
var rowClassName1 = function rowClassName1(record) {
|
|
593
493
|
return (0, _includes["default"])(checkedRows).call(checkedRows, record.key) ? (0, _variables["default"])('SuperTable3').select : '';
|
|
594
494
|
};
|
|
595
|
-
|
|
596
495
|
if (checkbox) {
|
|
597
496
|
return {
|
|
598
497
|
rowClassName: rowClassName1,
|
|
@@ -624,10 +523,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
624
523
|
});
|
|
625
524
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getItems", function () {
|
|
626
525
|
var _this$props4 = _this.props,
|
|
627
|
-
|
|
628
|
-
|
|
526
|
+
items = _this$props4.items,
|
|
527
|
+
childrenKey = _this$props4.childrenKey;
|
|
629
528
|
var resItems = items;
|
|
630
|
-
|
|
631
529
|
if (childrenKey) {
|
|
632
530
|
resItems = (0, _map["default"])(items).call(items, function (o) {
|
|
633
531
|
return o[childrenKey] && o[childrenKey].length ? _objectSpread(_objectSpread({}, o), {}, {
|
|
@@ -635,18 +533,16 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
635
533
|
}) : o;
|
|
636
534
|
});
|
|
637
535
|
}
|
|
638
|
-
|
|
639
536
|
return resItems;
|
|
640
537
|
});
|
|
641
538
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toTotalFooter", function () {
|
|
642
539
|
var _this$props5 = _this.props,
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
540
|
+
cols = _this$props5.cols,
|
|
541
|
+
items = _this$props5.items,
|
|
542
|
+
checkedRows = _this$props5.checkedRows;
|
|
646
543
|
var totalCols = (0, _filter["default"])(cols).call(cols, function (item) {
|
|
647
544
|
return item.total;
|
|
648
545
|
});
|
|
649
|
-
|
|
650
546
|
if (totalCols.length > 0) {
|
|
651
547
|
var checkedItems = (0, _filter["default"])(items).call(items, function (item, index) {
|
|
652
548
|
return (0, _includes["default"])(checkedRows).call(checkedRows, index);
|
|
@@ -654,9 +550,9 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
654
550
|
var countItems = checkedItems.length ? checkedItems : items;
|
|
655
551
|
var totalItems = (0, _map["default"])(totalCols).call(totalCols, function (_ref13) {
|
|
656
552
|
var title = _ref13.title,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
553
|
+
key = _ref13.key,
|
|
554
|
+
_ref13$props = _ref13.props,
|
|
555
|
+
props = _ref13$props === void 0 ? {} : _ref13$props;
|
|
660
556
|
var value = (0, _reduce["default"])(countItems).call(countItems, function (result, item) {
|
|
661
557
|
return (0, _parseFloat2["default"])((result + Number(item[key] || 0)).toFixed(props.precision || 6));
|
|
662
558
|
}, 0);
|
|
@@ -676,7 +572,7 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
676
572
|
}
|
|
677
573
|
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), (0, _map["default"])(totalItems).call(totalItems, function (_ref14, index) {
|
|
678
574
|
var title = _ref14.title,
|
|
679
|
-
|
|
575
|
+
value = _ref14.value;
|
|
680
576
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
681
577
|
key: index,
|
|
682
578
|
style: {
|
|
@@ -694,18 +590,15 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
694
590
|
});
|
|
695
591
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
|
|
696
592
|
var _this$props6 = _this.props,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
593
|
+
cols = _this$props6.cols,
|
|
594
|
+
_this$props6$isPaging = _this$props6.isPaging,
|
|
595
|
+
isPaging = _this$props6$isPaging === void 0 ? false : _this$props6$isPaging,
|
|
596
|
+
_this$props6$footer = _this$props6.footer,
|
|
597
|
+
footer = _this$props6$footer === void 0 ? null : _this$props6$footer;
|
|
703
598
|
var items = _this.getItems();
|
|
704
|
-
|
|
705
599
|
var _this$getPropsByCheck = _this.getPropsByCheckbox(items),
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
600
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
601
|
+
extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
|
|
709
602
|
var renderProps = _objectSpread({
|
|
710
603
|
className: (0, _variables["default"])('SuperTable3'),
|
|
711
604
|
columns: _this.getColumns(cols, items),
|
|
@@ -720,15 +613,12 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
720
613
|
components: {},
|
|
721
614
|
footer: footer ? footer : _this.toTotalFooter
|
|
722
615
|
}, extraProps);
|
|
723
|
-
|
|
724
616
|
return renderProps;
|
|
725
617
|
});
|
|
726
618
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setScroll", function () {
|
|
727
619
|
var maxHeight = _this.props.maxHeight;
|
|
728
|
-
|
|
729
620
|
if (maxHeight && _this.getItems().length) {
|
|
730
621
|
var root = _reactDom["default"].findDOMNode((0, _assertThisInitialized2["default"])(_this));
|
|
731
|
-
|
|
732
622
|
var container = root.getElementsByClassName('ant-table-body')[0];
|
|
733
623
|
var header = root.getElementsByClassName('ant-table-thead')[0];
|
|
734
624
|
(0, _fixed["default"])(container, header, maxHeight);
|
|
@@ -736,12 +626,10 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
736
626
|
});
|
|
737
627
|
return _this;
|
|
738
628
|
}
|
|
739
|
-
|
|
740
629
|
(0, _createClass2["default"])(SuperTable, [{
|
|
741
630
|
key: "shouldComponentUpdate",
|
|
742
631
|
value: function shouldComponentUpdate(props, state) {
|
|
743
632
|
var _this2 = this;
|
|
744
|
-
|
|
745
633
|
var keys = ['cols', 'items', 'maxHeight', 'checkedRows', 'sortInfo', 'filterInfo'];
|
|
746
634
|
return (0, _some["default"])(keys).call(keys, function (key) {
|
|
747
635
|
return props[key] !== _this2.props[key];
|
|
@@ -767,7 +655,6 @@ var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
|
767
655
|
}]);
|
|
768
656
|
return SuperTable;
|
|
769
657
|
}(_react["default"].Component);
|
|
770
|
-
|
|
771
658
|
(0, _defineProperty2["default"])(SuperTable, "propTypes", {
|
|
772
659
|
cols: _propTypes["default"].arrayOf(_propTypes["default"].shape(ColType)).isRequired,
|
|
773
660
|
items: _propTypes["default"].arrayOf(_propTypes["default"].shape(ItemType)).isRequired,
|