cloud-b2b 1.1.46 → 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 +226 -101
- 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 +240 -101
- 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
|
@@ -1,82 +1,137 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
|
|
4
5
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
6
|
+
|
|
5
7
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
8
|
+
|
|
6
9
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
10
|
+
|
|
7
11
|
var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
12
|
+
|
|
8
13
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
14
|
+
|
|
9
15
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
16
|
+
|
|
10
17
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
18
|
+
|
|
11
19
|
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
20
|
+
|
|
12
21
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
22
|
+
|
|
13
23
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
24
|
+
|
|
14
25
|
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
26
|
+
|
|
15
27
|
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
28
|
+
|
|
16
29
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
30
|
+
|
|
17
31
|
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
32
|
+
|
|
18
33
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
34
|
+
|
|
19
35
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
36
|
+
|
|
20
37
|
_Object$defineProperty(exports, "__esModule", {
|
|
21
38
|
value: true
|
|
22
39
|
});
|
|
40
|
+
|
|
23
41
|
exports["default"] = void 0;
|
|
42
|
+
|
|
24
43
|
var _table = _interopRequireDefault(require("antd/lib/table"));
|
|
44
|
+
|
|
25
45
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
46
|
+
|
|
26
47
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
48
|
+
|
|
27
49
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
50
|
+
|
|
28
51
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
52
|
+
|
|
29
53
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
54
|
+
|
|
30
55
|
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
56
|
+
|
|
31
57
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
58
|
+
|
|
32
59
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
60
|
+
|
|
33
61
|
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
62
|
+
|
|
34
63
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
35
|
-
|
|
64
|
+
|
|
36
65
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
66
|
+
|
|
37
67
|
var _switch = _interopRequireDefault(require("antd/lib/switch"));
|
|
68
|
+
|
|
38
69
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
70
|
+
|
|
39
71
|
var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
|
|
72
|
+
|
|
40
73
|
var _icon = _interopRequireDefault(require("antd/lib/icon"));
|
|
74
|
+
|
|
41
75
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
76
|
+
|
|
42
77
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
78
|
+
|
|
43
79
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
80
|
+
|
|
44
81
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
82
|
+
|
|
45
83
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
84
|
+
|
|
46
85
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
86
|
+
|
|
47
87
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
88
|
+
|
|
48
89
|
var _react = _interopRequireDefault(require("react"));
|
|
90
|
+
|
|
49
91
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
92
|
+
|
|
50
93
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
94
|
+
|
|
51
95
|
var _Control = _interopRequireWildcard(require("../Control"));
|
|
96
|
+
|
|
52
97
|
var _SuperTableCell = _interopRequireDefault(require("./SuperTableCell"));
|
|
98
|
+
|
|
53
99
|
var _fixed = _interopRequireDefault(require("../SuperTable/fixed"));
|
|
100
|
+
|
|
54
101
|
var _SuperToolbar = _interopRequireDefault(require("../SuperToolbar"));
|
|
102
|
+
|
|
55
103
|
var _variables = _interopRequireDefault(require("../variables"));
|
|
104
|
+
|
|
56
105
|
var _helper = _interopRequireWildcard(require("../helper"));
|
|
106
|
+
|
|
57
107
|
var _DragSortRow = _interopRequireDefault(require("../SuperTable/DragSortRow"));
|
|
108
|
+
|
|
58
109
|
var _excluded = ["onRowClick"];
|
|
110
|
+
|
|
59
111
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
112
|
+
|
|
60
113
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
114
|
+
|
|
61
115
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray2(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; } } }; }
|
|
116
|
+
|
|
62
117
|
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); }
|
|
63
|
-
|
|
118
|
+
|
|
119
|
+
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; }
|
|
120
|
+
|
|
64
121
|
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; }
|
|
122
|
+
|
|
65
123
|
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) { (0, _defineProperty2["default"])(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; }
|
|
124
|
+
|
|
66
125
|
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); }; }
|
|
126
|
+
|
|
67
127
|
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; } }
|
|
68
|
-
var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select',
|
|
69
|
-
//存储value
|
|
70
|
-
'selectText',
|
|
71
|
-
//存储title
|
|
72
|
-
'search', 'searchText', 'selectSearch',
|
|
73
|
-
//多选下拉搜索
|
|
74
|
-
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar',
|
|
75
|
-
//按钮组
|
|
76
|
-
'img',
|
|
77
|
-
//图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
78
|
-
'uploadImg', 'double'];
|
|
79
128
|
|
|
129
|
+
var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
|
|
130
|
+
'selectText', //存储title
|
|
131
|
+
'search', 'searchText', 'selectSearch', //多选下拉搜索
|
|
132
|
+
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
|
|
133
|
+
'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
134
|
+
'uploadImg', 'double'];
|
|
80
135
|
/**
|
|
81
136
|
* key:标识所在列,在一个表格中必须唯一
|
|
82
137
|
* title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
|
|
@@ -89,6 +144,7 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select',
|
|
|
89
144
|
* showAdd: 表头是否显示+号,默认为false,加号会触发onAdd事件
|
|
90
145
|
* hide: 为true时隐藏该列
|
|
91
146
|
*/
|
|
147
|
+
|
|
92
148
|
var ColType = {
|
|
93
149
|
key: _propTypes["default"].string.isRequired,
|
|
94
150
|
title: _propTypes["default"].string.isRequired,
|
|
@@ -101,7 +157,6 @@ var ColType = {
|
|
|
101
157
|
hide: _propTypes["default"].bool,
|
|
102
158
|
props: _propTypes["default"].any
|
|
103
159
|
};
|
|
104
|
-
|
|
105
160
|
/**
|
|
106
161
|
* onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
|
|
107
162
|
* onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
|
|
@@ -113,6 +168,7 @@ var ColType = {
|
|
|
113
168
|
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
|
|
114
169
|
* onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
|
|
115
170
|
*/
|
|
171
|
+
|
|
116
172
|
var CallbackType = {
|
|
117
173
|
onExitValid: _propTypes["default"].func,
|
|
118
174
|
onCheck: _propTypes["default"].func,
|
|
@@ -131,110 +187,131 @@ var CallbackType = {
|
|
|
131
187
|
//点击img类型标题触发事件
|
|
132
188
|
onMoveRow: _propTypes["default"].func
|
|
133
189
|
};
|
|
134
|
-
|
|
135
190
|
/**
|
|
136
191
|
* base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
|
|
137
192
|
* isEmphasized: [可选],是否强调,行字体加粗显示, 除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
|
|
138
193
|
*/
|
|
194
|
+
|
|
139
195
|
var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
140
196
|
(0, _inherits2["default"])(SuperTable2, _React$Component);
|
|
197
|
+
|
|
141
198
|
var _super = _createSuper(SuperTable2);
|
|
199
|
+
|
|
142
200
|
function SuperTable2() {
|
|
143
201
|
var _context;
|
|
202
|
+
|
|
144
203
|
var _this;
|
|
204
|
+
|
|
145
205
|
(0, _classCallCheck2["default"])(this, SuperTable2);
|
|
206
|
+
|
|
146
207
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
147
208
|
args[_key] = arguments[_key];
|
|
148
209
|
}
|
|
210
|
+
|
|
149
211
|
_this = _super.call.apply(_super, (0, _concat["default"])(_context = [this]).call(_context, args));
|
|
150
212
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSwitch", function (key, rowIndex) {
|
|
151
213
|
return function (value) {
|
|
152
214
|
var _ref = _this.props.callback || {},
|
|
153
|
-
|
|
215
|
+
onContentChange = _ref.onContentChange;
|
|
216
|
+
|
|
154
217
|
onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
|
|
155
218
|
};
|
|
156
219
|
});
|
|
157
220
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCheck", function (key, rowIndex) {
|
|
158
221
|
return function (e) {
|
|
159
222
|
var _ref2 = _this.props.callback || {},
|
|
160
|
-
|
|
223
|
+
onCheck = _ref2.onCheck;
|
|
224
|
+
|
|
161
225
|
onCheck && onCheck(_this.getIndex(rowIndex), key, e.target.checked);
|
|
162
226
|
};
|
|
163
227
|
});
|
|
164
228
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (key, rowIndex) {
|
|
165
229
|
return function (value) {
|
|
166
230
|
var _ref3 = _this.props.callback || {},
|
|
167
|
-
|
|
231
|
+
onContentChange = _ref3.onContentChange;
|
|
232
|
+
|
|
168
233
|
_this.closeValid();
|
|
234
|
+
|
|
169
235
|
onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
|
|
170
236
|
};
|
|
171
237
|
});
|
|
172
238
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleChange1", function (key, rowIndex) {
|
|
173
239
|
return function (doublekey, value) {
|
|
174
240
|
var _ref4 = _this.props.callback || {},
|
|
175
|
-
|
|
241
|
+
onContentChange = _ref4.onContentChange;
|
|
242
|
+
|
|
176
243
|
_this.closeValid();
|
|
244
|
+
|
|
177
245
|
onContentChange && onContentChange(_this.getIndex(rowIndex), doublekey, value);
|
|
178
246
|
};
|
|
179
247
|
});
|
|
180
248
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSearch", function (key, rowIndex, config) {
|
|
181
249
|
return function (value) {
|
|
182
250
|
var _ref5 = _this.props.callback || {},
|
|
183
|
-
|
|
251
|
+
onSearch = _ref5.onSearch;
|
|
252
|
+
|
|
184
253
|
onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
|
|
185
254
|
};
|
|
186
255
|
});
|
|
187
256
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAdd", function (key) {
|
|
188
257
|
return function () {
|
|
189
258
|
var _ref6 = _this.props.callback || {},
|
|
190
|
-
|
|
259
|
+
onAdd = _ref6.onAdd;
|
|
260
|
+
|
|
191
261
|
onAdd && onAdd(key);
|
|
192
262
|
};
|
|
193
263
|
});
|
|
194
264
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRowAdd", function (key, index) {
|
|
195
265
|
return function () {
|
|
196
266
|
var _ref7 = _this.props.callback || {},
|
|
197
|
-
|
|
267
|
+
onLink = _ref7.onLink;
|
|
268
|
+
|
|
198
269
|
onLink && onLink(key, index, _this.props.items[index]);
|
|
199
270
|
};
|
|
200
271
|
});
|
|
201
272
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (key, rowIndex) {
|
|
202
273
|
return function (value) {
|
|
203
274
|
var _ref8 = _this.props.callback || {},
|
|
204
|
-
|
|
275
|
+
onBlur = _ref8.onBlur;
|
|
276
|
+
|
|
205
277
|
_this.closeValid();
|
|
278
|
+
|
|
206
279
|
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
207
280
|
};
|
|
208
281
|
});
|
|
209
282
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (key, value) {
|
|
210
283
|
return function () {
|
|
211
284
|
var _ref9 = _this.props.callback || {},
|
|
212
|
-
|
|
285
|
+
onDoubleClick = _ref9.onDoubleClick;
|
|
286
|
+
|
|
213
287
|
onDoubleClick && onDoubleClick(key, value);
|
|
214
288
|
};
|
|
215
289
|
});
|
|
216
290
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onImgTileClick", function (col, value, rowIndex) {
|
|
217
291
|
return function () {
|
|
218
292
|
var _ref10 = _this.props.callback || {},
|
|
219
|
-
|
|
293
|
+
onImgTileClick = _ref10.onImgTileClick;
|
|
294
|
+
|
|
220
295
|
onImgTileClick && onImgTileClick(col, value, rowIndex);
|
|
221
296
|
};
|
|
222
297
|
});
|
|
223
298
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMoveRow", function (dragIndex, targetIndex) {
|
|
224
299
|
var _ref11 = _this.props.callback || {},
|
|
225
|
-
|
|
300
|
+
onMoveRow = _ref11.onMoveRow;
|
|
301
|
+
|
|
226
302
|
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
227
303
|
});
|
|
228
304
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
|
|
229
305
|
var _this$props = _this.props,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
306
|
+
valid = _this$props.valid,
|
|
307
|
+
_this$props$callback = _this$props.callback,
|
|
308
|
+
callback = _this$props$callback === void 0 ? {} : _this$props$callback;
|
|
233
309
|
valid && callback.onExitValid();
|
|
234
310
|
});
|
|
235
311
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getOptions", function (key, colOptions, index) {
|
|
236
312
|
var options = _this.props.items[index].options;
|
|
237
313
|
var options2 = _this.props.options;
|
|
314
|
+
|
|
238
315
|
if (options && (0, _isArray["default"])(options[key])) {
|
|
239
316
|
return options[key];
|
|
240
317
|
} else if (options2 && (0, _isArray["default"])(options2[key])) {
|
|
@@ -255,20 +332,22 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
255
332
|
});
|
|
256
333
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderEditableCell", function (config, value, index) {
|
|
257
334
|
var key = config.key,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
335
|
+
type = config.type,
|
|
336
|
+
options = config.options,
|
|
337
|
+
props = config.props,
|
|
338
|
+
required = config.required,
|
|
339
|
+
width = config.width,
|
|
340
|
+
showRowAdd = config.showRowAdd;
|
|
341
|
+
|
|
264
342
|
var _this$props$items$ind = _this.props.items[index],
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
343
|
+
readonly = _this$props$items$ind.readonly,
|
|
344
|
+
_this$props$items$ind2 = _this$props$items$ind.isReadonly,
|
|
345
|
+
isReadonly = _this$props$items$ind2 === void 0 ? [] : _this$props$items$ind2,
|
|
346
|
+
_this$props$items$ind3 = _this$props$items$ind.isRequired,
|
|
347
|
+
isRequired = _this$props$items$ind3 === void 0 ? [] : _this$props$items$ind3,
|
|
348
|
+
_this$props$items$ind4 = _this$props$items$ind._extraProps,
|
|
349
|
+
_extraProps = _this$props$items$ind4 === void 0 ? {} : _this$props$items$ind4;
|
|
350
|
+
|
|
272
351
|
var cellProps = {
|
|
273
352
|
value: value,
|
|
274
353
|
width: width,
|
|
@@ -281,6 +360,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
281
360
|
onSearch: _this.onSearch(key, index, config),
|
|
282
361
|
onBlur: _this.onBlur(key, index)
|
|
283
362
|
};
|
|
363
|
+
|
|
284
364
|
if (showRowAdd && (0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
|
|
285
365
|
cellProps.error = _this.validField(true, value);
|
|
286
366
|
cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
|
|
@@ -306,6 +386,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
306
386
|
onClick: _this.onRowAdd(key, index)
|
|
307
387
|
})));
|
|
308
388
|
}
|
|
389
|
+
|
|
309
390
|
if ((0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
|
|
310
391
|
cellProps.error = _this.validField(true, value);
|
|
311
392
|
cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
|
|
@@ -322,6 +403,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
322
403
|
}
|
|
323
404
|
}, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)));
|
|
324
405
|
}
|
|
406
|
+
|
|
325
407
|
if (showRowAdd) {
|
|
326
408
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
327
409
|
style: {
|
|
@@ -343,24 +425,27 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
343
425
|
onClick: _this.onRowAdd(key, index)
|
|
344
426
|
})));
|
|
345
427
|
}
|
|
428
|
+
|
|
346
429
|
return /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps);
|
|
347
430
|
});
|
|
348
431
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderDoubleEditableCell", function (config, value, index) {
|
|
349
432
|
var key = config.key,
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
433
|
+
type = config.type,
|
|
434
|
+
options = config.options,
|
|
435
|
+
props = config.props,
|
|
436
|
+
required = config.required,
|
|
437
|
+
width = config.width,
|
|
438
|
+
showRowAdd = config.showRowAdd;
|
|
439
|
+
|
|
356
440
|
var _this$props$items$ind5 = _this.props.items[index],
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
441
|
+
readonly = _this$props$items$ind5.readonly,
|
|
442
|
+
_this$props$items$ind6 = _this$props$items$ind5.isReadonly,
|
|
443
|
+
isReadonly = _this$props$items$ind6 === void 0 ? [] : _this$props$items$ind6,
|
|
444
|
+
_this$props$items$ind7 = _this$props$items$ind5.isRequired,
|
|
445
|
+
isRequired = _this$props$items$ind7 === void 0 ? [] : _this$props$items$ind7,
|
|
446
|
+
_this$props$items$ind8 = _this$props$items$ind5._extraProps,
|
|
447
|
+
_extraProps = _this$props$items$ind8 === void 0 ? {} : _this$props$items$ind8;
|
|
448
|
+
|
|
364
449
|
var cellProps = {
|
|
365
450
|
value: value,
|
|
366
451
|
width: width,
|
|
@@ -384,12 +469,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
384
469
|
}
|
|
385
470
|
}, (0, _map["default"])(list).call(list, function (item2, index2) {
|
|
386
471
|
var _context2;
|
|
472
|
+
|
|
387
473
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
474
|
+
|
|
388
475
|
var onClick = function onClick() {
|
|
389
476
|
var _ref12 = _this.props.callback || {},
|
|
390
|
-
|
|
477
|
+
onLink = _ref12.onLink;
|
|
478
|
+
|
|
391
479
|
onLink && onLink(col.key, index, item2);
|
|
392
480
|
};
|
|
481
|
+
|
|
393
482
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
394
483
|
key: index2,
|
|
395
484
|
onClick: onClick
|
|
@@ -397,11 +486,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
397
486
|
}));
|
|
398
487
|
} else {
|
|
399
488
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
489
|
+
|
|
400
490
|
var onClick = function onClick() {
|
|
401
491
|
var _ref13 = _this.props.callback || {},
|
|
402
|
-
|
|
492
|
+
onLink = _ref13.onLink;
|
|
493
|
+
|
|
403
494
|
onLink && onLink(col.key, index, record);
|
|
404
495
|
};
|
|
496
|
+
|
|
405
497
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
406
498
|
style: {
|
|
407
499
|
whiteSpace: 'normal',
|
|
@@ -417,7 +509,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
417
509
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
|
|
418
510
|
return function (value, record, index) {
|
|
419
511
|
var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
|
|
512
|
+
|
|
420
513
|
var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
|
|
514
|
+
|
|
421
515
|
if (!realType) {
|
|
422
516
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
423
517
|
onDoubleClick: _this.onDoubleClick(col.key, record.key),
|
|
@@ -436,18 +530,23 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
436
530
|
title: value
|
|
437
531
|
}, value);
|
|
438
532
|
}
|
|
533
|
+
|
|
439
534
|
switch (realType) {
|
|
440
535
|
case 'checkbox':
|
|
441
536
|
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
442
537
|
onChange: _this.onCheck(col.key, record.key),
|
|
443
538
|
checked: value || false
|
|
444
539
|
});
|
|
540
|
+
|
|
445
541
|
case 'index':
|
|
446
542
|
return _this.getIndex(index) + 1;
|
|
543
|
+
|
|
447
544
|
case 'link':
|
|
448
545
|
return _this.renderLinkCell(col, value, record, record.key);
|
|
546
|
+
|
|
449
547
|
case 'button':
|
|
450
548
|
var onClick = _this.props.callback.onLink ? (0, _bind["default"])(_context3 = _this.props.callback.onLink).call(_context3, null, col.key, record.key, record) : undefined;
|
|
549
|
+
|
|
451
550
|
if (col.icon === 'add') {
|
|
452
551
|
return /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
453
552
|
onClick: onClick,
|
|
@@ -465,6 +564,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
465
564
|
type: col.bsStyle
|
|
466
565
|
}, record[col.key] || col.typeRelated);
|
|
467
566
|
}
|
|
567
|
+
|
|
468
568
|
case 'switch':
|
|
469
569
|
return typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("div", null, value) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
470
570
|
checkedChildren: col.props.checkedChildren || '',
|
|
@@ -474,8 +574,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
474
574
|
checked: typeof value === 'number' ? Boolean(value) : value || false,
|
|
475
575
|
disabled: !(record._isEdit === true)
|
|
476
576
|
});
|
|
577
|
+
|
|
477
578
|
case 'custom':
|
|
478
579
|
return _this.props.callback.onRenderCustom(record.key, col.key, value, col.props, col);
|
|
580
|
+
|
|
479
581
|
case 'toolbar':
|
|
480
582
|
//showByKey为true时,每条数据中与按钮key相同的属性值决定按钮是否显示,建议key用下划线开始命名,避免与后台数据冲突
|
|
481
583
|
var props = {
|
|
@@ -487,6 +589,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
487
589
|
})
|
|
488
590
|
};
|
|
489
591
|
return /*#__PURE__*/_react["default"].createElement(_SuperToolbar["default"], props);
|
|
592
|
+
|
|
490
593
|
case 'img':
|
|
491
594
|
return value ? typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
492
595
|
src: (0, _includes["default"])(value).call(value, 'http') ? value : (0, _concat["default"])(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
|
|
@@ -531,19 +634,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
531
634
|
color: '#333'
|
|
532
635
|
}
|
|
533
636
|
}, value.remark))) : /*#__PURE__*/_react["default"].createElement("div", null);
|
|
637
|
+
|
|
534
638
|
case 'uploadImg':
|
|
535
639
|
var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
|
|
640
|
+
|
|
536
641
|
var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
537
642
|
onFileChange: _this.props.callback.onTableFileChange ? (0, _bind["default"])(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
|
|
538
643
|
type: col.type
|
|
539
644
|
}, col.props), _this.props), commonProps), {}, {
|
|
540
645
|
value: _this.props.items[index][col.key]
|
|
541
646
|
});
|
|
647
|
+
|
|
542
648
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], uploadProps);
|
|
649
|
+
|
|
543
650
|
case 'double':
|
|
544
651
|
return _this.renderDoubleEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
545
652
|
type: realType
|
|
546
653
|
}), value, record.key);
|
|
654
|
+
|
|
547
655
|
default:
|
|
548
656
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
549
657
|
type: realType
|
|
@@ -553,10 +661,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
553
661
|
});
|
|
554
662
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCheckedStatus", function (key) {
|
|
555
663
|
var has = false,
|
|
556
|
-
|
|
664
|
+
not = false;
|
|
557
665
|
var items = _this.props.items;
|
|
666
|
+
|
|
558
667
|
var _iterator = _createForOfIteratorHelper(items),
|
|
559
|
-
|
|
668
|
+
_step;
|
|
669
|
+
|
|
560
670
|
try {
|
|
561
671
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
562
672
|
var item = _step.value;
|
|
@@ -567,6 +677,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
567
677
|
} finally {
|
|
568
678
|
_iterator.f();
|
|
569
679
|
}
|
|
680
|
+
|
|
570
681
|
return {
|
|
571
682
|
checked: has && !not,
|
|
572
683
|
indeterminate: has && not
|
|
@@ -575,6 +686,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
575
686
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toAdd", function (key, showAdd) {
|
|
576
687
|
if (showAdd) {
|
|
577
688
|
var onClick = _this.onAdd(key);
|
|
689
|
+
|
|
578
690
|
return /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
579
691
|
type: "plus-circle-o",
|
|
580
692
|
role: "add",
|
|
@@ -586,12 +698,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
586
698
|
});
|
|
587
699
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref14) {
|
|
588
700
|
var required = _ref14.required,
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
701
|
+
title = _ref14.title,
|
|
702
|
+
type = _ref14.type,
|
|
703
|
+
key = _ref14.key,
|
|
704
|
+
showAdd = _ref14.showAdd;
|
|
705
|
+
|
|
593
706
|
if (type === 'checkbox') {
|
|
594
707
|
var status = _this.getCheckedStatus(key);
|
|
708
|
+
|
|
595
709
|
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], (0, _extends2["default"])({
|
|
596
710
|
onChange: _this.onCheck(key, -1)
|
|
597
711
|
}, status));
|
|
@@ -604,7 +718,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
604
718
|
});
|
|
605
719
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref15) {
|
|
606
720
|
var type = _ref15.type,
|
|
607
|
-
|
|
721
|
+
align = _ref15.align;
|
|
722
|
+
|
|
608
723
|
if (type === 'index' || type === 'checkbox') {
|
|
609
724
|
return 'ant-table-selection-column';
|
|
610
725
|
} else {
|
|
@@ -613,29 +728,33 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
613
728
|
});
|
|
614
729
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
|
|
615
730
|
var _context11;
|
|
731
|
+
|
|
616
732
|
return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
|
|
617
733
|
});
|
|
618
734
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
|
|
619
735
|
var _context12;
|
|
736
|
+
|
|
620
737
|
var readonly = _this.props.readonly;
|
|
621
738
|
return (0, _map["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
622
739
|
return !col.hide;
|
|
623
740
|
})).call(_context12, function (_ref16, index) {
|
|
624
741
|
var _context13;
|
|
625
|
-
|
|
742
|
+
|
|
743
|
+
var col = (0, _extends2["default"])({}, _ref16);
|
|
626
744
|
col.className = _this.getColumnClassName(col);
|
|
627
745
|
col.title = _this.getColumnTitle(col);
|
|
628
746
|
col.dataIndex = col.key;
|
|
629
|
-
col.width = col.width ? col.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120;
|
|
630
|
-
// const {props = {}} =
|
|
747
|
+
col.width = col.width ? col.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} =
|
|
631
748
|
// const {edit = false} = props
|
|
632
749
|
// if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
|
|
633
750
|
// if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
|
|
634
751
|
// return col
|
|
635
752
|
// }
|
|
636
753
|
// }
|
|
754
|
+
|
|
637
755
|
col.readonly = readonly;
|
|
638
756
|
col.render = _this.getCellRender(col);
|
|
757
|
+
|
|
639
758
|
if (col.link) {
|
|
640
759
|
col.type = 'link';
|
|
641
760
|
col.render = _this.getCellRender(col);
|
|
@@ -649,6 +768,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
649
768
|
}
|
|
650
769
|
};
|
|
651
770
|
}
|
|
771
|
+
|
|
652
772
|
return col;
|
|
653
773
|
});
|
|
654
774
|
});
|
|
@@ -656,14 +776,17 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
656
776
|
return (0, _map["default"])(items).call(items, function (item, index) {
|
|
657
777
|
return (0, _reduce["default"])(cols).call(cols, function (result, _ref17) {
|
|
658
778
|
var _context14, _context15;
|
|
779
|
+
|
|
659
780
|
var key = _ref17.key,
|
|
660
|
-
|
|
661
|
-
|
|
781
|
+
type = _ref17.type,
|
|
782
|
+
options = _ref17.options;
|
|
783
|
+
|
|
662
784
|
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context14 = item.isReadonly).call(_context14, key)) || (0, _includes["default"])(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
|
|
663
785
|
result[key] = item[key];
|
|
664
786
|
} else {
|
|
665
787
|
result[key] = (0, _Control.getTitle)(item[key], options);
|
|
666
788
|
}
|
|
789
|
+
|
|
667
790
|
return result;
|
|
668
791
|
}, _objectSpread(_objectSpread({}, item), {}, {
|
|
669
792
|
key: index,
|
|
@@ -673,15 +796,18 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
673
796
|
});
|
|
674
797
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox", function () {
|
|
675
798
|
var _this$props2 = _this.props,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
799
|
+
items = _this$props2.items,
|
|
800
|
+
_this$props2$isEmphas = _this$props2.isEmphasized,
|
|
801
|
+
isEmphasized = _this$props2$isEmphas === void 0 ? false : _this$props2$isEmphas;
|
|
802
|
+
|
|
679
803
|
var rowClassName = function rowClassName(record) {
|
|
680
804
|
if (isEmphasized && items[record.key].__isEmphasized) {
|
|
681
805
|
return items[record.key].checked ? (0, _variables["default"])('SuperTable2').emphasizedSelectRow : (0, _variables["default"])('SuperTable2').emphasizedUnselectRow;
|
|
682
806
|
}
|
|
807
|
+
|
|
683
808
|
return items[record.key].checked ? (0, _variables["default"])('SuperTable2').select : '';
|
|
684
809
|
};
|
|
810
|
+
|
|
685
811
|
return {
|
|
686
812
|
rowClassName: rowClassName
|
|
687
813
|
};
|
|
@@ -694,33 +820,39 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
694
820
|
});
|
|
695
821
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox2", function (items) {
|
|
696
822
|
var _this$props3 = _this.props,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
823
|
+
_this$props3$checkbox = _this$props3.checkbox,
|
|
824
|
+
checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
|
|
825
|
+
_this$props3$radio = _this$props3.radio,
|
|
826
|
+
radio = _this$props3$radio === void 0 ? false : _this$props3$radio,
|
|
827
|
+
isolation = _this$props3.isolation,
|
|
828
|
+
_this$props3$checkedR = _this$props3.checkedRows,
|
|
829
|
+
checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR,
|
|
830
|
+
_this$props3$isEmphas = _this$props3.isEmphasized,
|
|
831
|
+
isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
|
|
832
|
+
_this$props3$isWeaken = _this$props3.isWeaken,
|
|
833
|
+
isWeaken = _this$props3$isWeaken === void 0 ? true : _this$props3$isWeaken;
|
|
834
|
+
|
|
708
835
|
var rowClassName1 = function rowClassName1(record) {
|
|
709
836
|
if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
|
|
710
837
|
if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
|
|
711
838
|
return (0, _includes["default"])(checkedRows).call(checkedRows, record.key) ? (0, _variables["default"])('SuperTable').select : '';
|
|
712
839
|
};
|
|
840
|
+
|
|
713
841
|
var rowClassName2 = function rowClassName2(record) {
|
|
714
842
|
if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
|
|
715
843
|
if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
|
|
844
|
+
|
|
716
845
|
if (isEmphasized && items[record.key].__isEmphasized) {
|
|
717
846
|
return items[record.key].checked ? (0, _variables["default"])('SuperTable').emphasizedSelectRow : (0, _variables["default"])('SuperTable').emphasizedUnselectRow;
|
|
718
847
|
}
|
|
848
|
+
|
|
719
849
|
if (isWeaken && items[record.key].__isWeaken) {
|
|
720
850
|
return items[record.key].checked ? (0, _variables["default"])('SuperTable').weakenedSelectRow : (0, _variables["default"])('SuperTable').weakenedUnselectRow;
|
|
721
851
|
}
|
|
852
|
+
|
|
722
853
|
return items[record.key].checked ? (0, _variables["default"])('SuperTable').select : '';
|
|
723
854
|
};
|
|
855
|
+
|
|
724
856
|
if (checkbox) {
|
|
725
857
|
if (radio) {
|
|
726
858
|
return {
|
|
@@ -799,27 +931,29 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
799
931
|
});
|
|
800
932
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
|
|
801
933
|
var _context16;
|
|
934
|
+
|
|
802
935
|
var _this$props4 = _this.props,
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
936
|
+
cols = _this$props4.cols,
|
|
937
|
+
items = _this$props4.items,
|
|
938
|
+
_this$props4$style = _this$props4.style,
|
|
939
|
+
style = _this$props4$style === void 0 ? {} : _this$props4$style,
|
|
940
|
+
_this$props4$footer = _this$props4.footer,
|
|
941
|
+
footer = _this$props4$footer === void 0 ? null : _this$props4$footer,
|
|
942
|
+
_this$props4$paginati = _this$props4.pagination,
|
|
943
|
+
pagination = _this$props4$paginati === void 0 ? false : _this$props4$paginati,
|
|
944
|
+
dragSort = _this$props4.dragSort,
|
|
945
|
+
_this$props4$isEmphas = _this$props4.isEmphasized,
|
|
946
|
+
isEmphasized = _this$props4$isEmphas === void 0 ? false : _this$props4$isEmphas,
|
|
947
|
+
maxHeight = _this$props4.maxHeight,
|
|
948
|
+
_this$props4$expanded = _this$props4.expandedRowRender,
|
|
949
|
+
expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
|
|
950
|
+
_this$props4$onExpand = _this$props4.onExpand,
|
|
951
|
+
onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
|
|
819
952
|
var widthX = (0, _reduce["default"])(_context16 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
820
953
|
return !col.hide;
|
|
821
954
|
})).call(_context16, function (width, item) {
|
|
822
955
|
var _context17;
|
|
956
|
+
|
|
823
957
|
return width += item.width ? item.width : (0, _includes["default"])(_context17 = ['index', 'checked']).call(_context17, item.key) ? 70 : item.type === 'img' ? 200 : 120;
|
|
824
958
|
}, 0);
|
|
825
959
|
var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
|
|
@@ -832,9 +966,11 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
832
966
|
y: maxHeight
|
|
833
967
|
}
|
|
834
968
|
};
|
|
969
|
+
|
|
835
970
|
var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
|
|
836
|
-
|
|
837
|
-
|
|
971
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
972
|
+
extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
|
|
973
|
+
|
|
838
974
|
return _objectSpread(_objectSpread({
|
|
839
975
|
className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
|
|
840
976
|
columns: _this.getColumns(cols),
|
|
@@ -861,6 +997,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
861
997
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setScroll", function () {
|
|
862
998
|
if (_this.props.maxHeight && _this.props.items.length) {
|
|
863
999
|
var root = _reactDom["default"].findDOMNode((0, _assertThisInitialized2["default"])(_this));
|
|
1000
|
+
|
|
864
1001
|
var container = root.getElementsByClassName('ant-table-body')[0];
|
|
865
1002
|
var header = root.getElementsByClassName('ant-table-thead')[0];
|
|
866
1003
|
(0, _fixed["default"])(container, header, _this.props.maxHeight);
|
|
@@ -868,6 +1005,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
868
1005
|
});
|
|
869
1006
|
return _this;
|
|
870
1007
|
}
|
|
1008
|
+
|
|
871
1009
|
(0, _createClass2["default"])(SuperTable2, [{
|
|
872
1010
|
key: "componentDidMount",
|
|
873
1011
|
value: function componentDidMount() {
|
|
@@ -889,6 +1027,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
889
1027
|
}]);
|
|
890
1028
|
return SuperTable2;
|
|
891
1029
|
}(_react["default"].Component);
|
|
1030
|
+
|
|
892
1031
|
(0, _defineProperty2["default"])(SuperTable2, "propTypes", {
|
|
893
1032
|
cols: _propTypes["default"].arrayOf(_propTypes["default"].shape(ColType)).isRequired,
|
|
894
1033
|
items: _propTypes["default"].array.isRequired,
|