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
|
@@ -12,7 +12,6 @@ import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
|
12
12
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
13
13
|
import _Table from "antd/es/table";
|
|
14
14
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
15
|
-
import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/objectDestructuringEmpty";
|
|
16
15
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
17
16
|
import _Switch from "antd/es/switch";
|
|
18
17
|
import _Button from "antd/es/button";
|
|
@@ -26,11 +25,17 @@ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleC
|
|
|
26
25
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
27
26
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
28
27
|
var _excluded = ["onRowClick"];
|
|
28
|
+
|
|
29
29
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
30
|
+
|
|
30
31
|
function _unsupportedIterableToArray(o, minLen) { var _context20; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context20 = Object.prototype.toString.call(o)).call(_context20, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
-
|
|
32
|
+
|
|
33
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
34
|
+
|
|
32
35
|
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; }
|
|
36
|
+
|
|
33
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context18, _context19; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context18 = ownKeys(Object(source), !0)).call(_context18, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context19 = ownKeys(Object(source))).call(_context19, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
38
|
+
|
|
34
39
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
35
40
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
36
41
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
@@ -40,8 +45,11 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
40
45
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
41
46
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
42
47
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
48
|
+
|
|
43
49
|
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); }; }
|
|
50
|
+
|
|
44
51
|
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; } }
|
|
52
|
+
|
|
45
53
|
import React from 'react';
|
|
46
54
|
import PropTypes from 'prop-types';
|
|
47
55
|
import ReactDOM from 'react-dom';
|
|
@@ -52,18 +60,12 @@ import SuperToolbar from '../SuperToolbar';
|
|
|
52
60
|
import variables from '../variables';
|
|
53
61
|
import helper, { getObjectExclude } from '../helper';
|
|
54
62
|
import DragSortRow from "../SuperTable/DragSortRow";
|
|
55
|
-
var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select',
|
|
56
|
-
//存储
|
|
57
|
-
'
|
|
58
|
-
|
|
59
|
-
'
|
|
60
|
-
//多选下拉搜索
|
|
61
|
-
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar',
|
|
62
|
-
//按钮组
|
|
63
|
-
'img',
|
|
64
|
-
//图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
63
|
+
var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
|
|
64
|
+
'selectText', //存储title
|
|
65
|
+
'search', 'searchText', 'selectSearch', //多选下拉搜索
|
|
66
|
+
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
|
|
67
|
+
'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
65
68
|
'uploadImg', 'double'];
|
|
66
|
-
|
|
67
69
|
/**
|
|
68
70
|
* key:标识所在列,在一个表格中必须唯一
|
|
69
71
|
* title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
|
|
@@ -76,6 +78,7 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select',
|
|
|
76
78
|
* showAdd: 表头是否显示+号,默认为false,加号会触发onAdd事件
|
|
77
79
|
* hide: 为true时隐藏该列
|
|
78
80
|
*/
|
|
81
|
+
|
|
79
82
|
var ColType = {
|
|
80
83
|
key: PropTypes.string.isRequired,
|
|
81
84
|
title: PropTypes.string.isRequired,
|
|
@@ -88,7 +91,6 @@ var ColType = {
|
|
|
88
91
|
hide: PropTypes.bool,
|
|
89
92
|
props: PropTypes.any
|
|
90
93
|
};
|
|
91
|
-
|
|
92
94
|
/**
|
|
93
95
|
* onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
|
|
94
96
|
* onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
|
|
@@ -100,6 +102,7 @@ var ColType = {
|
|
|
100
102
|
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
|
|
101
103
|
* onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
|
|
102
104
|
*/
|
|
105
|
+
|
|
103
106
|
var CallbackType = {
|
|
104
107
|
onExitValid: PropTypes.func,
|
|
105
108
|
onCheck: PropTypes.func,
|
|
@@ -118,110 +121,144 @@ var CallbackType = {
|
|
|
118
121
|
//点击img类型标题触发事件
|
|
119
122
|
onMoveRow: PropTypes.func
|
|
120
123
|
};
|
|
121
|
-
|
|
122
124
|
/**
|
|
123
125
|
* base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
|
|
124
126
|
* isEmphasized: [可选],是否强调,行字体加粗显示, 除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
|
|
125
127
|
*/
|
|
128
|
+
|
|
126
129
|
var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
127
130
|
_inherits(SuperTable2, _React$Component);
|
|
131
|
+
|
|
128
132
|
var _super = _createSuper(SuperTable2);
|
|
133
|
+
|
|
129
134
|
function SuperTable2() {
|
|
130
135
|
var _context;
|
|
136
|
+
|
|
131
137
|
var _this;
|
|
138
|
+
|
|
132
139
|
_classCallCheck(this, SuperTable2);
|
|
140
|
+
|
|
133
141
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
134
142
|
args[_key] = arguments[_key];
|
|
135
143
|
}
|
|
144
|
+
|
|
136
145
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
146
|
+
|
|
137
147
|
_defineProperty(_assertThisInitialized(_this), "onSwitch", function (key, rowIndex) {
|
|
138
148
|
return function (value) {
|
|
139
149
|
var _ref = _this.props.callback || {},
|
|
140
|
-
|
|
150
|
+
onContentChange = _ref.onContentChange;
|
|
151
|
+
|
|
141
152
|
onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
|
|
142
153
|
};
|
|
143
154
|
});
|
|
155
|
+
|
|
144
156
|
_defineProperty(_assertThisInitialized(_this), "onCheck", function (key, rowIndex) {
|
|
145
157
|
return function (e) {
|
|
146
158
|
var _ref2 = _this.props.callback || {},
|
|
147
|
-
|
|
159
|
+
onCheck = _ref2.onCheck;
|
|
160
|
+
|
|
148
161
|
onCheck && onCheck(_this.getIndex(rowIndex), key, e.target.checked);
|
|
149
162
|
};
|
|
150
163
|
});
|
|
164
|
+
|
|
151
165
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (key, rowIndex) {
|
|
152
166
|
return function (value) {
|
|
153
167
|
var _ref3 = _this.props.callback || {},
|
|
154
|
-
|
|
168
|
+
onContentChange = _ref3.onContentChange;
|
|
169
|
+
|
|
155
170
|
_this.closeValid();
|
|
171
|
+
|
|
156
172
|
onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
|
|
157
173
|
};
|
|
158
174
|
});
|
|
175
|
+
|
|
159
176
|
_defineProperty(_assertThisInitialized(_this), "onDoubleChange1", function (key, rowIndex) {
|
|
160
177
|
return function (doublekey, value) {
|
|
161
178
|
var _ref4 = _this.props.callback || {},
|
|
162
|
-
|
|
179
|
+
onContentChange = _ref4.onContentChange;
|
|
180
|
+
|
|
163
181
|
_this.closeValid();
|
|
182
|
+
|
|
164
183
|
onContentChange && onContentChange(_this.getIndex(rowIndex), doublekey, value);
|
|
165
184
|
};
|
|
166
185
|
});
|
|
186
|
+
|
|
167
187
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (key, rowIndex, config) {
|
|
168
188
|
return function (value) {
|
|
169
189
|
var _ref5 = _this.props.callback || {},
|
|
170
|
-
|
|
190
|
+
onSearch = _ref5.onSearch;
|
|
191
|
+
|
|
171
192
|
onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
|
|
172
193
|
};
|
|
173
194
|
});
|
|
195
|
+
|
|
174
196
|
_defineProperty(_assertThisInitialized(_this), "onAdd", function (key) {
|
|
175
197
|
return function () {
|
|
176
198
|
var _ref6 = _this.props.callback || {},
|
|
177
|
-
|
|
199
|
+
onAdd = _ref6.onAdd;
|
|
200
|
+
|
|
178
201
|
onAdd && onAdd(key);
|
|
179
202
|
};
|
|
180
203
|
});
|
|
204
|
+
|
|
181
205
|
_defineProperty(_assertThisInitialized(_this), "onRowAdd", function (key, index) {
|
|
182
206
|
return function () {
|
|
183
207
|
var _ref7 = _this.props.callback || {},
|
|
184
|
-
|
|
208
|
+
onLink = _ref7.onLink;
|
|
209
|
+
|
|
185
210
|
onLink && onLink(key, index, _this.props.items[index]);
|
|
186
211
|
};
|
|
187
212
|
});
|
|
213
|
+
|
|
188
214
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (key, rowIndex) {
|
|
189
215
|
return function (value) {
|
|
190
216
|
var _ref8 = _this.props.callback || {},
|
|
191
|
-
|
|
217
|
+
onBlur = _ref8.onBlur;
|
|
218
|
+
|
|
192
219
|
_this.closeValid();
|
|
220
|
+
|
|
193
221
|
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
194
222
|
};
|
|
195
223
|
});
|
|
224
|
+
|
|
196
225
|
_defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
|
|
197
226
|
return function () {
|
|
198
227
|
var _ref9 = _this.props.callback || {},
|
|
199
|
-
|
|
228
|
+
onDoubleClick = _ref9.onDoubleClick;
|
|
229
|
+
|
|
200
230
|
onDoubleClick && onDoubleClick(key, value);
|
|
201
231
|
};
|
|
202
232
|
});
|
|
233
|
+
|
|
203
234
|
_defineProperty(_assertThisInitialized(_this), "onImgTileClick", function (col, value, rowIndex) {
|
|
204
235
|
return function () {
|
|
205
236
|
var _ref10 = _this.props.callback || {},
|
|
206
|
-
|
|
237
|
+
onImgTileClick = _ref10.onImgTileClick;
|
|
238
|
+
|
|
207
239
|
onImgTileClick && onImgTileClick(col, value, rowIndex);
|
|
208
240
|
};
|
|
209
241
|
});
|
|
242
|
+
|
|
210
243
|
_defineProperty(_assertThisInitialized(_this), "onMoveRow", function (dragIndex, targetIndex) {
|
|
211
244
|
var _ref11 = _this.props.callback || {},
|
|
212
|
-
|
|
245
|
+
onMoveRow = _ref11.onMoveRow;
|
|
246
|
+
|
|
213
247
|
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
214
248
|
});
|
|
249
|
+
|
|
215
250
|
_defineProperty(_assertThisInitialized(_this), "closeValid", function () {
|
|
216
251
|
var _this$props = _this.props,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
252
|
+
valid = _this$props.valid,
|
|
253
|
+
_this$props$callback = _this$props.callback,
|
|
254
|
+
callback = _this$props$callback === void 0 ? {} : _this$props$callback;
|
|
220
255
|
valid && callback.onExitValid();
|
|
221
256
|
});
|
|
257
|
+
|
|
222
258
|
_defineProperty(_assertThisInitialized(_this), "getOptions", function (key, colOptions, index) {
|
|
223
259
|
var options = _this.props.items[index].options;
|
|
224
260
|
var options2 = _this.props.options;
|
|
261
|
+
|
|
225
262
|
if (options && _Array$isArray(options[key])) {
|
|
226
263
|
return options[key];
|
|
227
264
|
} else if (options2 && _Array$isArray(options2[key])) {
|
|
@@ -230,6 +267,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
230
267
|
return colOptions;
|
|
231
268
|
}
|
|
232
269
|
});
|
|
270
|
+
|
|
233
271
|
_defineProperty(_assertThisInitialized(_this), "validField", function (required, value) {
|
|
234
272
|
if (!_this.props.valid || _this.error || !required || value) {
|
|
235
273
|
return false;
|
|
@@ -240,22 +278,25 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
240
278
|
return true;
|
|
241
279
|
}
|
|
242
280
|
});
|
|
281
|
+
|
|
243
282
|
_defineProperty(_assertThisInitialized(_this), "renderEditableCell", function (config, value, index) {
|
|
244
283
|
var key = config.key,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
284
|
+
type = config.type,
|
|
285
|
+
options = config.options,
|
|
286
|
+
props = config.props,
|
|
287
|
+
required = config.required,
|
|
288
|
+
width = config.width,
|
|
289
|
+
showRowAdd = config.showRowAdd;
|
|
290
|
+
|
|
251
291
|
var _this$props$items$ind = _this.props.items[index],
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
292
|
+
readonly = _this$props$items$ind.readonly,
|
|
293
|
+
_this$props$items$ind2 = _this$props$items$ind.isReadonly,
|
|
294
|
+
isReadonly = _this$props$items$ind2 === void 0 ? [] : _this$props$items$ind2,
|
|
295
|
+
_this$props$items$ind3 = _this$props$items$ind.isRequired,
|
|
296
|
+
isRequired = _this$props$items$ind3 === void 0 ? [] : _this$props$items$ind3,
|
|
297
|
+
_this$props$items$ind4 = _this$props$items$ind._extraProps,
|
|
298
|
+
_extraProps = _this$props$items$ind4 === void 0 ? {} : _this$props$items$ind4;
|
|
299
|
+
|
|
259
300
|
var cellProps = {
|
|
260
301
|
value: value,
|
|
261
302
|
width: width,
|
|
@@ -268,6 +309,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
268
309
|
onSearch: _this.onSearch(key, index, config),
|
|
269
310
|
onBlur: _this.onBlur(key, index)
|
|
270
311
|
};
|
|
312
|
+
|
|
271
313
|
if (showRowAdd && _Array$isArray(isRequired) && _includesInstanceProperty(isRequired).call(isRequired, key)) {
|
|
272
314
|
cellProps.error = _this.validField(true, value);
|
|
273
315
|
cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
|
|
@@ -293,6 +335,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
293
335
|
onClick: _this.onRowAdd(key, index)
|
|
294
336
|
})));
|
|
295
337
|
}
|
|
338
|
+
|
|
296
339
|
if (_Array$isArray(isRequired) && _includesInstanceProperty(isRequired).call(isRequired, key)) {
|
|
297
340
|
cellProps.error = _this.validField(true, value);
|
|
298
341
|
cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
|
|
@@ -309,6 +352,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
309
352
|
}
|
|
310
353
|
}, /*#__PURE__*/React.createElement(SuperTableCell, cellProps)));
|
|
311
354
|
}
|
|
355
|
+
|
|
312
356
|
if (showRowAdd) {
|
|
313
357
|
return /*#__PURE__*/React.createElement("div", {
|
|
314
358
|
style: {
|
|
@@ -330,24 +374,28 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
330
374
|
onClick: _this.onRowAdd(key, index)
|
|
331
375
|
})));
|
|
332
376
|
}
|
|
377
|
+
|
|
333
378
|
return /*#__PURE__*/React.createElement(SuperTableCell, cellProps);
|
|
334
379
|
});
|
|
380
|
+
|
|
335
381
|
_defineProperty(_assertThisInitialized(_this), "renderDoubleEditableCell", function (config, value, index) {
|
|
336
382
|
var key = config.key,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
383
|
+
type = config.type,
|
|
384
|
+
options = config.options,
|
|
385
|
+
props = config.props,
|
|
386
|
+
required = config.required,
|
|
387
|
+
width = config.width,
|
|
388
|
+
showRowAdd = config.showRowAdd;
|
|
389
|
+
|
|
343
390
|
var _this$props$items$ind5 = _this.props.items[index],
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
391
|
+
readonly = _this$props$items$ind5.readonly,
|
|
392
|
+
_this$props$items$ind6 = _this$props$items$ind5.isReadonly,
|
|
393
|
+
isReadonly = _this$props$items$ind6 === void 0 ? [] : _this$props$items$ind6,
|
|
394
|
+
_this$props$items$ind7 = _this$props$items$ind5.isRequired,
|
|
395
|
+
isRequired = _this$props$items$ind7 === void 0 ? [] : _this$props$items$ind7,
|
|
396
|
+
_this$props$items$ind8 = _this$props$items$ind5._extraProps,
|
|
397
|
+
_extraProps = _this$props$items$ind8 === void 0 ? {} : _this$props$items$ind8;
|
|
398
|
+
|
|
351
399
|
var cellProps = {
|
|
352
400
|
value: value,
|
|
353
401
|
width: width,
|
|
@@ -362,6 +410,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
362
410
|
};
|
|
363
411
|
return /*#__PURE__*/React.createElement(SuperTableCell, cellProps);
|
|
364
412
|
});
|
|
413
|
+
|
|
365
414
|
_defineProperty(_assertThisInitialized(_this), "renderLinkCell", function (col, value, record, index) {
|
|
366
415
|
if (col.link === 'list') {
|
|
367
416
|
var list = value && _Array$isArray(value) ? value : [];
|
|
@@ -371,12 +420,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
371
420
|
}
|
|
372
421
|
}, _mapInstanceProperty(list).call(list, function (item2, index2) {
|
|
373
422
|
var _context2;
|
|
423
|
+
|
|
374
424
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
425
|
+
|
|
375
426
|
var onClick = function onClick() {
|
|
376
427
|
var _ref12 = _this.props.callback || {},
|
|
377
|
-
|
|
428
|
+
onLink = _ref12.onLink;
|
|
429
|
+
|
|
378
430
|
onLink && onLink(col.key, index, item2);
|
|
379
431
|
};
|
|
432
|
+
|
|
380
433
|
return /*#__PURE__*/React.createElement("a", {
|
|
381
434
|
key: index2,
|
|
382
435
|
onClick: onClick
|
|
@@ -384,11 +437,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
384
437
|
}));
|
|
385
438
|
} else {
|
|
386
439
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
440
|
+
|
|
387
441
|
var onClick = function onClick() {
|
|
388
442
|
var _ref13 = _this.props.callback || {},
|
|
389
|
-
|
|
443
|
+
onLink = _ref13.onLink;
|
|
444
|
+
|
|
390
445
|
onLink && onLink(col.key, index, record);
|
|
391
446
|
};
|
|
447
|
+
|
|
392
448
|
return /*#__PURE__*/React.createElement("a", {
|
|
393
449
|
style: {
|
|
394
450
|
whiteSpace: 'normal',
|
|
@@ -398,13 +454,17 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
398
454
|
}, title);
|
|
399
455
|
}
|
|
400
456
|
});
|
|
457
|
+
|
|
401
458
|
_defineProperty(_assertThisInitialized(_this), "getIndex", function (index) {
|
|
402
459
|
return (_this.props.base || 0) + index;
|
|
403
460
|
});
|
|
461
|
+
|
|
404
462
|
_defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
|
|
405
463
|
return function (value, record, index) {
|
|
406
464
|
var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
|
|
465
|
+
|
|
407
466
|
var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
|
|
467
|
+
|
|
408
468
|
if (!realType) {
|
|
409
469
|
return /*#__PURE__*/React.createElement("div", {
|
|
410
470
|
onDoubleClick: _this.onDoubleClick(col.key, record.key),
|
|
@@ -423,18 +483,23 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
423
483
|
title: value
|
|
424
484
|
}, value);
|
|
425
485
|
}
|
|
486
|
+
|
|
426
487
|
switch (realType) {
|
|
427
488
|
case 'checkbox':
|
|
428
489
|
return /*#__PURE__*/React.createElement(_Checkbox, {
|
|
429
490
|
onChange: _this.onCheck(col.key, record.key),
|
|
430
491
|
checked: value || false
|
|
431
492
|
});
|
|
493
|
+
|
|
432
494
|
case 'index':
|
|
433
495
|
return _this.getIndex(index) + 1;
|
|
496
|
+
|
|
434
497
|
case 'link':
|
|
435
498
|
return _this.renderLinkCell(col, value, record, record.key);
|
|
499
|
+
|
|
436
500
|
case 'button':
|
|
437
501
|
var onClick = _this.props.callback.onLink ? _bindInstanceProperty(_context3 = _this.props.callback.onLink).call(_context3, null, col.key, record.key, record) : undefined;
|
|
502
|
+
|
|
438
503
|
if (col.icon === 'add') {
|
|
439
504
|
return /*#__PURE__*/React.createElement(_Button, {
|
|
440
505
|
onClick: onClick,
|
|
@@ -452,6 +517,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
452
517
|
type: col.bsStyle
|
|
453
518
|
}, record[col.key] || col.typeRelated);
|
|
454
519
|
}
|
|
520
|
+
|
|
455
521
|
case 'switch':
|
|
456
522
|
return typeof value === 'string' ? /*#__PURE__*/React.createElement("div", null, value) : /*#__PURE__*/React.createElement(_Switch, {
|
|
457
523
|
checkedChildren: col.props.checkedChildren || '',
|
|
@@ -461,8 +527,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
461
527
|
checked: typeof value === 'number' ? Boolean(value) : value || false,
|
|
462
528
|
disabled: !(record._isEdit === true)
|
|
463
529
|
});
|
|
530
|
+
|
|
464
531
|
case 'custom':
|
|
465
532
|
return _this.props.callback.onRenderCustom(record.key, col.key, value, col.props, col);
|
|
533
|
+
|
|
466
534
|
case 'toolbar':
|
|
467
535
|
//showByKey为true时,每条数据中与按钮key相同的属性值决定按钮是否显示,建议key用下划线开始命名,避免与后台数据冲突
|
|
468
536
|
var props = {
|
|
@@ -474,6 +542,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
474
542
|
})
|
|
475
543
|
};
|
|
476
544
|
return /*#__PURE__*/React.createElement(SuperToolbar, props);
|
|
545
|
+
|
|
477
546
|
case 'img':
|
|
478
547
|
return value ? typeof value === 'string' ? /*#__PURE__*/React.createElement("img", {
|
|
479
548
|
src: _includesInstanceProperty(value).call(value, 'http') ? value : _concatInstanceProperty(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
|
|
@@ -487,7 +556,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
487
556
|
maxWidth: "".concat(col.width, "px")
|
|
488
557
|
}
|
|
489
558
|
}, /*#__PURE__*/React.createElement("img", {
|
|
490
|
-
src: value.img ? '/productDefault.png' : _includesInstanceProperty(_context8 = value.img).call(_context8, 'http') ? value.img : _concatInstanceProperty(_context9 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context9, value.img),
|
|
559
|
+
src: value.img === '' ? '/productDefault.png' : _includesInstanceProperty(_context8 = value.img).call(_context8, 'http') ? value.img : _concatInstanceProperty(_context9 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context9, value.img),
|
|
491
560
|
onError: function onError(e) {
|
|
492
561
|
return e.target.src = '/productDefault.png';
|
|
493
562
|
},
|
|
@@ -518,19 +587,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
518
587
|
color: '#333'
|
|
519
588
|
}
|
|
520
589
|
}, value.remark))) : /*#__PURE__*/React.createElement("div", null);
|
|
590
|
+
|
|
521
591
|
case 'uploadImg':
|
|
522
592
|
var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
|
|
593
|
+
|
|
523
594
|
var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
524
595
|
onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
|
|
525
596
|
type: col.type
|
|
526
597
|
}, col.props), _this.props), commonProps), {}, {
|
|
527
598
|
value: _this.props.items[index][col.key]
|
|
528
599
|
});
|
|
600
|
+
|
|
529
601
|
return /*#__PURE__*/React.createElement(Control, uploadProps);
|
|
602
|
+
|
|
530
603
|
case 'double':
|
|
531
604
|
return _this.renderDoubleEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
532
605
|
type: realType
|
|
533
606
|
}), value, record.key);
|
|
607
|
+
|
|
534
608
|
default:
|
|
535
609
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
536
610
|
type: realType
|
|
@@ -538,12 +612,15 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
538
612
|
}
|
|
539
613
|
};
|
|
540
614
|
});
|
|
615
|
+
|
|
541
616
|
_defineProperty(_assertThisInitialized(_this), "getCheckedStatus", function (key) {
|
|
542
617
|
var has = false,
|
|
543
|
-
|
|
618
|
+
not = false;
|
|
544
619
|
var items = _this.props.items;
|
|
620
|
+
|
|
545
621
|
var _iterator = _createForOfIteratorHelper(items),
|
|
546
|
-
|
|
622
|
+
_step;
|
|
623
|
+
|
|
547
624
|
try {
|
|
548
625
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
549
626
|
var item = _step.value;
|
|
@@ -554,14 +631,17 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
554
631
|
} finally {
|
|
555
632
|
_iterator.f();
|
|
556
633
|
}
|
|
634
|
+
|
|
557
635
|
return {
|
|
558
636
|
checked: has && !not,
|
|
559
637
|
indeterminate: has && not
|
|
560
638
|
};
|
|
561
639
|
});
|
|
640
|
+
|
|
562
641
|
_defineProperty(_assertThisInitialized(_this), "toAdd", function (key, showAdd) {
|
|
563
642
|
if (showAdd) {
|
|
564
643
|
var onClick = _this.onAdd(key);
|
|
644
|
+
|
|
565
645
|
return /*#__PURE__*/React.createElement(_Icon, {
|
|
566
646
|
type: "plus-circle-o",
|
|
567
647
|
role: "add",
|
|
@@ -571,14 +651,17 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
571
651
|
return null;
|
|
572
652
|
}
|
|
573
653
|
});
|
|
654
|
+
|
|
574
655
|
_defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref14) {
|
|
575
656
|
var required = _ref14.required,
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
657
|
+
title = _ref14.title,
|
|
658
|
+
type = _ref14.type,
|
|
659
|
+
key = _ref14.key,
|
|
660
|
+
showAdd = _ref14.showAdd;
|
|
661
|
+
|
|
580
662
|
if (type === 'checkbox') {
|
|
581
663
|
var status = _this.getCheckedStatus(key);
|
|
664
|
+
|
|
582
665
|
return /*#__PURE__*/React.createElement(_Checkbox, _extends({
|
|
583
666
|
onChange: _this.onCheck(key, -1)
|
|
584
667
|
}, status));
|
|
@@ -589,40 +672,49 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
589
672
|
}, title, _this.toAdd(key, showAdd));
|
|
590
673
|
}
|
|
591
674
|
});
|
|
675
|
+
|
|
592
676
|
_defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref15) {
|
|
593
677
|
var type = _ref15.type,
|
|
594
|
-
|
|
678
|
+
align = _ref15.align;
|
|
679
|
+
|
|
595
680
|
if (type === 'index' || type === 'checkbox') {
|
|
596
681
|
return 'ant-table-selection-column';
|
|
597
682
|
} else {
|
|
598
683
|
return align ? variables('SuperTable2')[align] : '';
|
|
599
684
|
}
|
|
600
685
|
});
|
|
686
|
+
|
|
601
687
|
_defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
|
|
602
688
|
var _context11;
|
|
689
|
+
|
|
603
690
|
return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
|
|
604
691
|
});
|
|
692
|
+
|
|
605
693
|
_defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
|
|
606
694
|
var _context12;
|
|
695
|
+
|
|
607
696
|
var readonly = _this.props.readonly;
|
|
608
697
|
return _mapInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
|
|
609
698
|
return !col.hide;
|
|
610
699
|
})).call(_context12, function (_ref16, index) {
|
|
611
700
|
var _context13;
|
|
612
|
-
|
|
701
|
+
|
|
702
|
+
var col = _extends({}, _ref16);
|
|
703
|
+
|
|
613
704
|
col.className = _this.getColumnClassName(col);
|
|
614
705
|
col.title = _this.getColumnTitle(col);
|
|
615
706
|
col.dataIndex = col.key;
|
|
616
|
-
col.width = col.width ? col.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120;
|
|
617
|
-
// const {props = {}} =
|
|
707
|
+
col.width = col.width ? col.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} =
|
|
618
708
|
// const {edit = false} = props
|
|
619
709
|
// if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
|
|
620
710
|
// if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
|
|
621
711
|
// return col
|
|
622
712
|
// }
|
|
623
713
|
// }
|
|
714
|
+
|
|
624
715
|
col.readonly = readonly;
|
|
625
716
|
col.render = _this.getCellRender(col);
|
|
717
|
+
|
|
626
718
|
if (col.link) {
|
|
627
719
|
col.type = 'link';
|
|
628
720
|
col.render = _this.getCellRender(col);
|
|
@@ -636,21 +728,26 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
636
728
|
}
|
|
637
729
|
};
|
|
638
730
|
}
|
|
731
|
+
|
|
639
732
|
return col;
|
|
640
733
|
});
|
|
641
734
|
});
|
|
735
|
+
|
|
642
736
|
_defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
|
|
643
737
|
return _mapInstanceProperty(items).call(items, function (item, index) {
|
|
644
738
|
return _reduceInstanceProperty(cols).call(cols, function (result, _ref17) {
|
|
645
739
|
var _context14, _context15;
|
|
740
|
+
|
|
646
741
|
var key = _ref17.key,
|
|
647
|
-
|
|
648
|
-
|
|
742
|
+
type = _ref17.type,
|
|
743
|
+
options = _ref17.options;
|
|
744
|
+
|
|
649
745
|
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context14 = item.isReadonly).call(_context14, key)) || _includesInstanceProperty(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
|
|
650
746
|
result[key] = item[key];
|
|
651
747
|
} else {
|
|
652
748
|
result[key] = getTitle(item[key], options);
|
|
653
749
|
}
|
|
750
|
+
|
|
654
751
|
return result;
|
|
655
752
|
}, _objectSpread(_objectSpread({}, item), {}, {
|
|
656
753
|
key: index,
|
|
@@ -658,56 +755,68 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
658
755
|
}));
|
|
659
756
|
});
|
|
660
757
|
});
|
|
758
|
+
|
|
661
759
|
_defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox", function () {
|
|
662
760
|
var _this$props2 = _this.props,
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
761
|
+
items = _this$props2.items,
|
|
762
|
+
_this$props2$isEmphas = _this$props2.isEmphasized,
|
|
763
|
+
isEmphasized = _this$props2$isEmphas === void 0 ? false : _this$props2$isEmphas;
|
|
764
|
+
|
|
666
765
|
var rowClassName = function rowClassName(record) {
|
|
667
766
|
if (isEmphasized && items[record.key].__isEmphasized) {
|
|
668
767
|
return items[record.key].checked ? variables('SuperTable2').emphasizedSelectRow : variables('SuperTable2').emphasizedUnselectRow;
|
|
669
768
|
}
|
|
769
|
+
|
|
670
770
|
return items[record.key].checked ? variables('SuperTable2').select : '';
|
|
671
771
|
};
|
|
772
|
+
|
|
672
773
|
return {
|
|
673
774
|
rowClassName: rowClassName
|
|
674
775
|
};
|
|
675
776
|
});
|
|
777
|
+
|
|
676
778
|
_defineProperty(_assertThisInitialized(_this), "getSelectedRowKeys", function (items) {
|
|
677
779
|
return _reduceInstanceProperty(items).call(items, function (result, item, index) {
|
|
678
780
|
item.checked && result.push(index);
|
|
679
781
|
return result;
|
|
680
782
|
}, []);
|
|
681
783
|
});
|
|
784
|
+
|
|
682
785
|
_defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox2", function (items) {
|
|
683
786
|
var _this$props3 = _this.props,
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
787
|
+
_this$props3$checkbox = _this$props3.checkbox,
|
|
788
|
+
checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
|
|
789
|
+
_this$props3$radio = _this$props3.radio,
|
|
790
|
+
radio = _this$props3$radio === void 0 ? false : _this$props3$radio,
|
|
791
|
+
isolation = _this$props3.isolation,
|
|
792
|
+
_this$props3$checkedR = _this$props3.checkedRows,
|
|
793
|
+
checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR,
|
|
794
|
+
_this$props3$isEmphas = _this$props3.isEmphasized,
|
|
795
|
+
isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
|
|
796
|
+
_this$props3$isWeaken = _this$props3.isWeaken,
|
|
797
|
+
isWeaken = _this$props3$isWeaken === void 0 ? true : _this$props3$isWeaken;
|
|
798
|
+
|
|
695
799
|
var rowClassName1 = function rowClassName1(record) {
|
|
696
800
|
if (items[record.key].__total) return variables('SuperTable').totalRow;
|
|
697
801
|
if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
|
|
698
802
|
return _includesInstanceProperty(checkedRows).call(checkedRows, record.key) ? variables('SuperTable').select : '';
|
|
699
803
|
};
|
|
804
|
+
|
|
700
805
|
var rowClassName2 = function rowClassName2(record) {
|
|
701
806
|
if (items[record.key].__total) return variables('SuperTable').totalRow;
|
|
702
807
|
if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
|
|
808
|
+
|
|
703
809
|
if (isEmphasized && items[record.key].__isEmphasized) {
|
|
704
810
|
return items[record.key].checked ? variables('SuperTable').emphasizedSelectRow : variables('SuperTable').emphasizedUnselectRow;
|
|
705
811
|
}
|
|
812
|
+
|
|
706
813
|
if (isWeaken && items[record.key].__isWeaken) {
|
|
707
814
|
return items[record.key].checked ? variables('SuperTable').weakenedSelectRow : variables('SuperTable').weakenedUnselectRow;
|
|
708
815
|
}
|
|
816
|
+
|
|
709
817
|
return items[record.key].checked ? variables('SuperTable').select : '';
|
|
710
818
|
};
|
|
819
|
+
|
|
711
820
|
if (checkbox) {
|
|
712
821
|
if (radio) {
|
|
713
822
|
return {
|
|
@@ -728,6 +837,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
728
837
|
onChange: _this.onCheckChange,
|
|
729
838
|
getCheckboxProps: function getCheckboxProps(record) {
|
|
730
839
|
var checked = _includesInstanceProperty(checkedRows).call(checkedRows, record.key);
|
|
840
|
+
|
|
731
841
|
return {
|
|
732
842
|
checked: checked,
|
|
733
843
|
disabled: items[record.key].__isWeaken,
|
|
@@ -764,6 +874,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
764
874
|
};
|
|
765
875
|
}
|
|
766
876
|
});
|
|
877
|
+
|
|
767
878
|
_defineProperty(_assertThisInitialized(_this), "getRowPropsForDrag", function () {
|
|
768
879
|
return function (record, index) {
|
|
769
880
|
return {
|
|
@@ -772,6 +883,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
772
883
|
};
|
|
773
884
|
};
|
|
774
885
|
});
|
|
886
|
+
|
|
775
887
|
_defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick) {
|
|
776
888
|
return function (record) {
|
|
777
889
|
return {
|
|
@@ -784,31 +896,36 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
784
896
|
};
|
|
785
897
|
};
|
|
786
898
|
});
|
|
899
|
+
|
|
787
900
|
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
788
901
|
var _context16;
|
|
902
|
+
|
|
789
903
|
var _this$props4 = _this.props,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
904
|
+
cols = _this$props4.cols,
|
|
905
|
+
items = _this$props4.items,
|
|
906
|
+
_this$props4$style = _this$props4.style,
|
|
907
|
+
style = _this$props4$style === void 0 ? {} : _this$props4$style,
|
|
908
|
+
_this$props4$footer = _this$props4.footer,
|
|
909
|
+
footer = _this$props4$footer === void 0 ? null : _this$props4$footer,
|
|
910
|
+
_this$props4$paginati = _this$props4.pagination,
|
|
911
|
+
pagination = _this$props4$paginati === void 0 ? false : _this$props4$paginati,
|
|
912
|
+
dragSort = _this$props4.dragSort,
|
|
913
|
+
_this$props4$isEmphas = _this$props4.isEmphasized,
|
|
914
|
+
isEmphasized = _this$props4$isEmphas === void 0 ? false : _this$props4$isEmphas,
|
|
915
|
+
maxHeight = _this$props4.maxHeight,
|
|
916
|
+
_this$props4$expanded = _this$props4.expandedRowRender,
|
|
917
|
+
expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
|
|
918
|
+
_this$props4$onExpand = _this$props4.onExpand,
|
|
919
|
+
onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
|
|
920
|
+
|
|
806
921
|
var widthX = _reduceInstanceProperty(_context16 = _filterInstanceProperty(cols).call(cols, function (col) {
|
|
807
922
|
return !col.hide;
|
|
808
923
|
})).call(_context16, function (width, item) {
|
|
809
924
|
var _context17;
|
|
925
|
+
|
|
810
926
|
return width += item.width ? item.width : _includesInstanceProperty(_context17 = ['index', 'checked']).call(_context17, item.key) ? 70 : item.type === 'img' ? 200 : 120;
|
|
811
927
|
}, 0);
|
|
928
|
+
|
|
812
929
|
var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
|
|
813
930
|
expandedRowRender: expandedRowRender
|
|
814
931
|
} : {
|
|
@@ -819,9 +936,11 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
819
936
|
y: maxHeight
|
|
820
937
|
}
|
|
821
938
|
};
|
|
939
|
+
|
|
822
940
|
var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
|
|
823
|
-
|
|
824
|
-
|
|
941
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
942
|
+
extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
|
|
943
|
+
|
|
825
944
|
return _objectSpread(_objectSpread({
|
|
826
945
|
className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
|
|
827
946
|
columns: _this.getColumns(cols),
|
|
@@ -845,6 +964,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
845
964
|
onExpand: onExpand
|
|
846
965
|
}, scrollProps);
|
|
847
966
|
});
|
|
967
|
+
|
|
848
968
|
_defineProperty(_assertThisInitialized(_this), "setScroll", function () {
|
|
849
969
|
if (_this.props.maxHeight && _this.props.items.length) {
|
|
850
970
|
var root = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
|
@@ -853,8 +973,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
853
973
|
fixed(container, header, _this.props.maxHeight);
|
|
854
974
|
}
|
|
855
975
|
});
|
|
976
|
+
|
|
856
977
|
return _this;
|
|
857
978
|
}
|
|
979
|
+
|
|
858
980
|
_createClass(SuperTable2, [{
|
|
859
981
|
key: "componentDidMount",
|
|
860
982
|
value: function componentDidMount() {
|
|
@@ -874,8 +996,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
874
996
|
}));
|
|
875
997
|
}
|
|
876
998
|
}]);
|
|
999
|
+
|
|
877
1000
|
return SuperTable2;
|
|
878
1001
|
}(React.Component);
|
|
1002
|
+
|
|
879
1003
|
_defineProperty(SuperTable2, "propTypes", {
|
|
880
1004
|
cols: PropTypes.arrayOf(PropTypes.shape(ColType)).isRequired,
|
|
881
1005
|
items: PropTypes.array.isRequired,
|
|
@@ -891,4 +1015,5 @@ _defineProperty(SuperTable2, "propTypes", {
|
|
|
891
1015
|
isEmphasized: PropTypes.bool,
|
|
892
1016
|
dragSort: PropTypes.bool
|
|
893
1017
|
});
|
|
1018
|
+
|
|
894
1019
|
export default SuperTable2;
|