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