@kdcloudjs/table 1.2.1-canary.6 → 1.2.1-canary.6-hotfix.1

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 (243) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/dist/@kdcloudjs/table.css +1 -1
  3. package/dist/@kdcloudjs/table.js +4847 -6022
  4. package/dist/@kdcloudjs/table.js.map +1 -1
  5. package/dist/@kdcloudjs/table.min.css +1 -1
  6. package/dist/@kdcloudjs/table.min.js +16 -24
  7. package/dist/@kdcloudjs/table.min.js.map +1 -1
  8. package/es/_utils/arrayUtil.js +0 -3
  9. package/es/_utils/devwarning.js +0 -1
  10. package/es/_utils/formatUtil.js +36 -101
  11. package/es/_utils/hooks.js +21 -45
  12. package/es/_utils/index.js +0 -2
  13. package/es/_utils/numberUtil.js +32 -55
  14. package/es/_utils/omit.js +0 -2
  15. package/es/_utils/type.js +0 -2
  16. package/es/_utils/usePopper.js +84 -147
  17. package/es/config-provider/compDefaultProps.js +0 -1
  18. package/es/config-provider/configProvider.js +2 -7
  19. package/es/config-provider/defaultConfig.js +0 -1
  20. package/es/index.js +0 -2
  21. package/es/locale/locale.js +11 -50
  22. package/es/table/base/calculations.js +25 -75
  23. package/es/table/base/colgroup.js +0 -1
  24. package/es/table/base/empty.js +6 -6
  25. package/es/table/base/header.js +30 -81
  26. package/es/table/base/helpers/SpanManager.js +4 -11
  27. package/es/table/base/helpers/TableDOMUtils.js +9 -34
  28. package/es/table/base/helpers/__test__/SpanManager.test.js +2 -2
  29. package/es/table/base/helpers/__test__/TableDOMUtils.test.js +2 -3
  30. package/es/table/base/helpers/getRichVisibleRectsStream.js +13 -45
  31. package/es/table/base/helpers/rowHeightManager.js +0 -28
  32. package/es/table/base/html-table.js +17 -39
  33. package/es/table/base/loading.js +8 -10
  34. package/es/table/base/renderTemplates.js +42 -60
  35. package/es/table/base/styles.js +0 -9
  36. package/es/table/base/table.js +110 -199
  37. package/es/table/base/utils.js +17 -57
  38. package/es/table/common-views.js +0 -7
  39. package/es/table/interfaces.d.ts +2 -0
  40. package/es/table/internals.d.ts +2 -1
  41. package/es/table/internals.js +0 -13
  42. package/es/table/pipeline/features/autoFill.js +11 -40
  43. package/es/table/pipeline/features/autoRowSpan.js +1 -14
  44. package/es/table/pipeline/features/colGroupExtendable.js +4 -19
  45. package/es/table/pipeline/features/columnDrag.js +41 -97
  46. package/es/table/pipeline/features/columnFilter.js +12 -51
  47. package/es/table/pipeline/features/columnHover.js +1 -7
  48. package/es/table/pipeline/features/columnRangeHover.js +1 -8
  49. package/es/table/pipeline/features/columnResizeWidth.js +13 -39
  50. package/es/table/pipeline/features/contextMenu.js +22 -95
  51. package/es/table/pipeline/features/filter/DefaultFilterContent.js +14 -30
  52. package/es/table/pipeline/features/filter/DefaultFilterIcon.js +1 -1
  53. package/es/table/pipeline/features/filter/Filter.js +27 -51
  54. package/es/table/pipeline/features/filter/FilterPanel.js +11 -25
  55. package/es/table/pipeline/features/filter/util.js +0 -4
  56. package/es/table/pipeline/features/footerDataSource.js +0 -3
  57. package/es/table/pipeline/features/mergeCellHover.js +0 -1
  58. package/es/table/pipeline/features/multiSelect.js +15 -57
  59. package/es/table/pipeline/features/rangeSelection.js +73 -152
  60. package/es/table/pipeline/features/rowDetail.js +6 -43
  61. package/es/table/pipeline/features/rowDrag.js +39 -78
  62. package/es/table/pipeline/features/rowGrouping.js +10 -42
  63. package/es/table/pipeline/features/singleSelect.js +0 -24
  64. package/es/table/pipeline/features/sort.js +37 -90
  65. package/es/table/pipeline/features/tips.js +4 -10
  66. package/es/table/pipeline/features/treeMode.js +14 -49
  67. package/es/table/pipeline/features/treeSelect.js +2 -28
  68. package/es/table/pipeline/pipeline.js +12 -53
  69. package/es/table/pivot/cross-table/buildCrossTable.js +21 -72
  70. package/es/table/pivot/cross-table/cross-table.js +23 -31
  71. package/es/table/pivot/cross-table/interfaces.d.ts +1 -1
  72. package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -57
  73. package/es/table/pivot/cross-tree-table/cross-tree-table.js +36 -61
  74. package/es/table/pivot/pivot-utils/buildDrillTree.js +10 -23
  75. package/es/table/pivot/pivot-utils/builders.js +34 -74
  76. package/es/table/pivot/pivot-utils/convert-utils.js +16 -42
  77. package/es/table/pivot/pivot-utils/simpleEncode.js +0 -1
  78. package/es/table/transforms/autoRowSpan.js +1 -15
  79. package/es/table/transforms/autoWidth.js +13 -35
  80. package/es/table/transforms/buildTree.js +1 -2
  81. package/es/table/transforms/columnHover.js +9 -15
  82. package/es/table/transforms/columnRangeHover.js +12 -19
  83. package/es/table/transforms/columnResize.js +18 -42
  84. package/es/table/transforms/flatten.js +0 -3
  85. package/es/table/transforms/orderField.js +0 -3
  86. package/es/table/transforms/sort.d.ts +1 -0
  87. package/es/table/transforms/sort.js +42 -96
  88. package/es/table/transforms/tips.js +5 -10
  89. package/es/table/transforms/treeMode.js +39 -80
  90. package/es/table/transforms/visible.js +0 -2
  91. package/es/table/use/useResizeObserver.js +1 -4
  92. package/es/table/utils/applyTransforms.js +0 -1
  93. package/es/table/utils/browserType.js +12 -19
  94. package/es/table/utils/buildTree.js +7 -22
  95. package/es/table/utils/collectNodes.js +4 -13
  96. package/es/table/utils/console.js +0 -14
  97. package/es/table/utils/copyToClipboard.js +0 -4
  98. package/es/table/utils/element.js +14 -41
  99. package/es/table/utils/exportTableAsExcel.js +7 -43
  100. package/es/table/utils/getTreeDepth.js +8 -13
  101. package/es/table/utils/groupBy.js +4 -13
  102. package/es/table/utils/layeredFilter.js +0 -4
  103. package/es/table/utils/layeredSort.js +0 -5
  104. package/es/table/utils/makeRecursiveMapper.js +4 -15
  105. package/es/table/utils/mergeCellProps.js +6 -14
  106. package/es/table/utils/others.js +6 -19
  107. package/es/table/utils/proto.js +2 -30
  108. package/es/table/utils/smartCompare.js +4 -12
  109. package/es/table/utils/traverseColumn.js +5 -18
  110. package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -30
  111. package/es/table/utils/tree-data-helpers/TreeDataHelper.js +19 -74
  112. package/es/table/utils/uiDegrade.js +0 -5
  113. package/lib/_utils/arrayUtil.js +2 -8
  114. package/lib/_utils/devwarning.js +0 -5
  115. package/lib/_utils/formatUtil.js +36 -105
  116. package/lib/_utils/hooks.js +21 -56
  117. package/lib/_utils/index.js +2 -9
  118. package/lib/_utils/numberUtil.js +32 -63
  119. package/lib/_utils/omit.js +0 -5
  120. package/lib/_utils/react-children.js +0 -5
  121. package/lib/_utils/type.js +3 -11
  122. package/lib/_utils/usePopper.js +88 -176
  123. package/lib/config-provider/ConfigContext.js +2 -6
  124. package/lib/config-provider/compDefaultProps.js +1 -3
  125. package/lib/config-provider/configProvider.js +5 -22
  126. package/lib/config-provider/defaultConfig.js +1 -7
  127. package/lib/config-provider/index.js +1 -8
  128. package/lib/index.js +2 -8
  129. package/lib/locale/index.js +2 -11
  130. package/lib/locale/locale.js +15 -71
  131. package/lib/locale/zh-CN.js +1 -2
  132. package/lib/table/base/calculations.js +25 -86
  133. package/lib/table/base/colgroup.js +0 -5
  134. package/lib/table/base/empty.js +7 -20
  135. package/lib/table/base/header.js +30 -91
  136. package/lib/table/base/helpers/SpanManager.js +6 -16
  137. package/lib/table/base/helpers/TableDOMUtils.js +9 -37
  138. package/lib/table/base/helpers/__test__/SpanManager.test.js +2 -4
  139. package/lib/table/base/helpers/__test__/TableDOMUtils.test.js +2 -7
  140. package/lib/table/base/helpers/__test__/rowHeightManager.test.js +0 -1
  141. package/lib/table/base/helpers/getRichVisibleRectsStream.js +14 -65
  142. package/lib/table/base/helpers/rowHeightManager.js +0 -33
  143. package/lib/table/base/html-table.js +17 -49
  144. package/lib/table/base/index.js +0 -2
  145. package/lib/table/base/loading.js +8 -14
  146. package/lib/table/base/renderTemplates.js +44 -76
  147. package/lib/table/base/styles.js +8 -37
  148. package/lib/table/base/table.js +121 -243
  149. package/lib/table/base/utils.js +26 -109
  150. package/lib/table/common-views.js +4 -24
  151. package/lib/table/index.js +0 -13
  152. package/lib/table/interfaces.d.ts +2 -0
  153. package/lib/table/internals.d.ts +2 -1
  154. package/lib/table/internals.js +2 -17
  155. package/lib/table/pipeline/features/autoFill.js +14 -53
  156. package/lib/table/pipeline/features/autoRowSpan.js +1 -19
  157. package/lib/table/pipeline/features/buildTree.js +0 -2
  158. package/lib/table/pipeline/features/colGroupExtendable.js +6 -35
  159. package/lib/table/pipeline/features/columnDrag.js +41 -103
  160. package/lib/table/pipeline/features/columnFilter.js +12 -65
  161. package/lib/table/pipeline/features/columnHover.js +1 -11
  162. package/lib/table/pipeline/features/columnRangeHover.js +1 -13
  163. package/lib/table/pipeline/features/columnResizeWidth.js +17 -63
  164. package/lib/table/pipeline/features/contextMenu.js +23 -121
  165. package/lib/table/pipeline/features/filter/DefaultFilterContent.js +16 -52
  166. package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
  167. package/lib/table/pipeline/features/filter/Filter.js +29 -77
  168. package/lib/table/pipeline/features/filter/FilterPanel.js +13 -44
  169. package/lib/table/pipeline/features/filter/index.js +0 -5
  170. package/lib/table/pipeline/features/filter/util.js +2 -10
  171. package/lib/table/pipeline/features/footerDataSource.js +1 -12
  172. package/lib/table/pipeline/features/index.js +0 -23
  173. package/lib/table/pipeline/features/mergeCellHover.js +0 -5
  174. package/lib/table/pipeline/features/multiSelect.js +15 -71
  175. package/lib/table/pipeline/features/rangeSelection.js +75 -173
  176. package/lib/table/pipeline/features/rowDetail.js +6 -67
  177. package/lib/table/pipeline/features/rowDrag.js +41 -93
  178. package/lib/table/pipeline/features/rowGrouping.js +10 -62
  179. package/lib/table/pipeline/features/singleSelect.js +0 -34
  180. package/lib/table/pipeline/features/sort.js +37 -110
  181. package/lib/table/pipeline/features/tips.js +4 -19
  182. package/lib/table/pipeline/features/treeMode.js +15 -72
  183. package/lib/table/pipeline/features/treeSelect.js +2 -36
  184. package/lib/table/pipeline/index.js +1 -10
  185. package/lib/table/pipeline/pipeline.js +13 -64
  186. package/lib/table/pivot/cross-table/buildCrossTable.js +21 -83
  187. package/lib/table/pivot/cross-table/constants.js +1 -2
  188. package/lib/table/pivot/cross-table/cross-table.js +25 -42
  189. package/lib/table/pivot/cross-table/index.js +0 -4
  190. package/lib/table/pivot/cross-table/interfaces.d.ts +1 -1
  191. package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -70
  192. package/lib/table/pivot/cross-tree-table/cross-tree-table.js +37 -73
  193. package/lib/table/pivot/cross-tree-table/index.js +0 -3
  194. package/lib/table/pivot/pivot-utils/buildDrillTree.js +10 -29
  195. package/lib/table/pivot/pivot-utils/builders.js +34 -85
  196. package/lib/table/pivot/pivot-utils/convert-utils.js +16 -60
  197. package/lib/table/pivot/pivot-utils/index.js +0 -7
  198. package/lib/table/pivot/pivot-utils/simpleEncode.js +0 -2
  199. package/lib/table/style/css.js +0 -1
  200. package/lib/table/style/index.js +0 -1
  201. package/lib/table/transforms/autoRowSpan.js +1 -21
  202. package/lib/table/transforms/autoWidth.js +14 -58
  203. package/lib/table/transforms/buildTree.js +1 -4
  204. package/lib/table/transforms/columnHover.js +9 -22
  205. package/lib/table/transforms/columnRangeHover.js +12 -27
  206. package/lib/table/transforms/columnResize.js +19 -63
  207. package/lib/table/transforms/flatten.js +0 -5
  208. package/lib/table/transforms/index.js +0 -12
  209. package/lib/table/transforms/orderField.js +0 -7
  210. package/lib/table/transforms/sort.d.ts +1 -0
  211. package/lib/table/transforms/sort.js +43 -122
  212. package/lib/table/transforms/tips.js +5 -20
  213. package/lib/table/transforms/treeMode.js +40 -109
  214. package/lib/table/transforms/visible.js +0 -7
  215. package/lib/table/transforms/warnTransformsDeprecated.js +0 -4
  216. package/lib/table/use/useResizeObserver.js +2 -10
  217. package/lib/table/utils/applyTransforms.js +0 -2
  218. package/lib/table/utils/browserType.js +14 -23
  219. package/lib/table/utils/buildTree.js +7 -33
  220. package/lib/table/utils/collectNodes.js +4 -18
  221. package/lib/table/utils/console.js +2 -19
  222. package/lib/table/utils/copyToClipboard.js +1 -8
  223. package/lib/table/utils/element.js +14 -46
  224. package/lib/table/utils/exportTableAsExcel.js +7 -52
  225. package/lib/table/utils/getTreeDepth.js +8 -18
  226. package/lib/table/utils/groupBy.js +4 -17
  227. package/lib/table/utils/index.js +0 -22
  228. package/lib/table/utils/isGroupColumn.js +0 -3
  229. package/lib/table/utils/isLeafNode.js +0 -1
  230. package/lib/table/utils/keyCode.js +1 -2
  231. package/lib/table/utils/layeredFilter.js +0 -10
  232. package/lib/table/utils/layeredSort.js +0 -10
  233. package/lib/table/utils/makeRecursiveMapper.js +4 -24
  234. package/lib/table/utils/mergeCellProps.js +6 -18
  235. package/lib/table/utils/others.js +7 -36
  236. package/lib/table/utils/proto.js +3 -35
  237. package/lib/table/utils/selectColumn.js +2 -5
  238. package/lib/table/utils/smartCompare.js +4 -13
  239. package/lib/table/utils/traverseColumn.js +5 -25
  240. package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +10 -41
  241. package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +21 -90
  242. package/lib/table/utils/uiDegrade.js +1 -8
  243. package/package.json +3 -2
@@ -1,166 +1,106 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
-
4
+ var _mapInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/map");
5
+ var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
5
6
  var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
6
-
7
7
  var _sliceInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
8
-
9
8
  var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
10
-
11
9
  var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
12
-
13
10
  var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
14
-
15
11
  var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
16
-
17
12
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
18
-
19
13
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
20
-
21
14
  Object.defineProperty(exports, "__esModule", {
22
15
  value: true
23
16
  });
24
17
  exports.BaseTable = void 0;
25
-
26
18
  var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
27
-
28
19
  var _flat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/flat"));
29
-
30
20
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
31
-
32
21
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
33
-
34
22
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
35
-
36
23
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
37
-
38
24
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
39
-
40
25
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
41
-
42
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
43
-
44
26
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
45
-
46
27
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
47
-
28
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
48
29
  var _classnames = _interopRequireDefault(require("classnames"));
49
-
50
30
  var _react = _interopRequireDefault(require("react"));
51
-
52
31
  var _rxjs = require("rxjs");
53
-
54
32
  var op = _interopRequireWildcard(require("rxjs/operators"));
55
-
56
33
  var _calculations = require("./calculations");
57
-
58
34
  var _empty = require("./empty");
59
-
60
35
  var _header = _interopRequireDefault(require("./header"));
61
-
62
36
  var _getRichVisibleRectsStream = require("./helpers/getRichVisibleRectsStream");
63
-
64
37
  var _rowHeightManager = require("./helpers/rowHeightManager");
65
-
66
38
  var _TableDOMUtils = require("./helpers/TableDOMUtils");
67
-
68
39
  var _htmlTable = require("./html-table");
69
-
70
40
  var _loading = _interopRequireDefault(require("./loading"));
71
-
72
41
  var _styles = require("./styles");
73
-
74
42
  var _utils = require("./utils");
75
-
76
43
  var _utils2 = require("../utils");
77
-
78
44
  var _renderTemplates = _interopRequireDefault(require("./renderTemplates"));
79
-
80
- 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); }
81
-
82
- 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; }
83
-
84
- 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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
85
-
86
- function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context2 = Object.prototype.toString.call(o)).call(_context2, 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); }
87
-
88
- 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; }
89
-
90
- 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); }; }
91
-
92
- 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; } }
93
-
45
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
46
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
47
+ function _unsupportedIterableToArray(r, a) { if (r) { var _context2; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty2(_context2 = {}.toString.call(r)).call(_context2, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
48
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
49
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
50
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
94
51
  var propsDotEmptyContentDeprecatedWarned = false;
95
-
96
52
  function warnPropsDotEmptyContentIsDeprecated() {
97
53
  if (!propsDotEmptyContentDeprecatedWarned) {
98
54
  propsDotEmptyContentDeprecatedWarned = true;
99
-
100
55
  _utils2.console.warn('BaseTable props.emptyContent 已经过时,请使用 props.components.EmptyContent 来自定义数据为空时的表格表现');
101
56
  }
102
57
  }
103
-
104
- var BaseTable = /*#__PURE__*/function (_React$Component) {
105
- (0, _inherits2.default)(BaseTable, _React$Component);
106
-
107
- var _super = _createSuper(BaseTable);
108
-
58
+ var BaseTable = exports.BaseTable = /*#__PURE__*/function (_React$Component) {
109
59
  function BaseTable(props) {
110
60
  var _this;
111
-
112
61
  (0, _classCallCheck2.default)(this, BaseTable);
113
- _this = _super.call(this, props);
62
+ _this = _callSuper(this, BaseTable, [props]);
114
63
  _this.rowHeightManager = (0, _rowHeightManager.makeRowHeightManager)(_this.props.dataSource.length, _this.props.estimatedRowHeight);
115
64
  _this.artTableWrapperRef = /*#__PURE__*/_react.default.createRef();
116
65
  _this.hasScrollY = false;
117
66
  _this.offsetY = 0;
118
-
119
67
  _this.handleRowMouseEnter = function (e) {
120
68
  var nodeList = _this.domHelper.getRowNodeListByEvent(e);
121
-
122
69
  nodeList && nodeList.forEach(function (node) {
123
70
  node.classList.add('row-hover');
124
71
  });
125
72
  };
126
-
127
73
  _this.handleRowMouseLeave = function (e) {
128
74
  var nodeList = _this.domHelper.getRowNodeListByEvent(e);
129
-
130
75
  nodeList && nodeList.forEach(function (node) {
131
76
  node.classList.remove('row-hover');
132
77
  });
133
78
  };
134
-
135
79
  _this.renderTableBody = function (info) {
136
80
  // console.log('render body')
137
81
  var _this$props = _this.props,
138
- dataSource = _this$props.dataSource,
139
- getRowProps = _this$props.getRowProps,
140
- primaryKey = _this$props.primaryKey,
141
- isLoading = _this$props.isLoading,
142
- emptyCellHeight = _this$props.emptyCellHeight,
143
- footerDataSource = _this$props.footerDataSource;
144
- var tableBodyClassName = (0, _classnames.default)(_styles.Classes.tableBody, _styles.Classes.horizontalScrollContainer); // 低版本Edge浏览器下也会出现双滚动条,这里设置overflow: 'hidden',先去掉edge的方向键控制滚动条的功能
145
-
82
+ dataSource = _this$props.dataSource,
83
+ getRowProps = _this$props.getRowProps,
84
+ primaryKey = _this$props.primaryKey,
85
+ isLoading = _this$props.isLoading,
86
+ emptyCellHeight = _this$props.emptyCellHeight,
87
+ footerDataSource = _this$props.footerDataSource;
88
+ var tableBodyClassName = (0, _classnames.default)(_styles.Classes.tableBody, _styles.Classes.horizontalScrollContainer);
89
+ // 低版本Edge浏览器下也会出现双滚动条,这里设置overflow: 'hidden',先去掉edge的方向键控制滚动条的功能
146
90
  var virtualStyle = _utils2.browserType.isIE || _utils2.browserType.isEdge ? {
147
91
  overflow: 'hidden'
148
92
  } : {};
149
-
150
93
  if (dataSource.length === 0) {
151
94
  var _this$props2 = _this.props,
152
- components = _this$props2.components,
153
- emptyContent = _this$props2.emptyContent;
95
+ components = _this$props2.components,
96
+ emptyContent = _this$props2.emptyContent;
154
97
  var EmptyContent = components.EmptyContent;
155
-
156
98
  if (EmptyContent == null && emptyContent != null) {
157
99
  warnPropsDotEmptyContentIsDeprecated();
158
-
159
100
  EmptyContent = function EmptyContent() {
160
101
  return emptyContent;
161
102
  };
162
103
  }
163
-
164
104
  return /*#__PURE__*/_react.default.createElement("div", {
165
105
  className: (0, _classnames.default)(tableBodyClassName, 'empty')
166
106
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -174,14 +114,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
174
114
  emptyCellHeight: emptyCellHeight
175
115
  })));
176
116
  }
177
-
178
117
  var _info$verticalRenderR = info.verticalRenderRange,
179
- topIndex = _info$verticalRenderR.topIndex,
180
- bottomBlank = _info$verticalRenderR.bottomBlank,
181
- topBlank = _info$verticalRenderR.topBlank,
182
- bottomIndex = _info$verticalRenderR.bottomIndex;
118
+ topIndex = _info$verticalRenderR.topIndex,
119
+ bottomBlank = _info$verticalRenderR.bottomBlank,
120
+ topBlank = _info$verticalRenderR.topBlank,
121
+ bottomIndex = _info$verticalRenderR.bottomIndex;
183
122
  var renderBody = (0, _renderTemplates.default)('body');
184
-
185
123
  if (typeof renderBody === 'function') {
186
124
  return renderBody(info, _this.props, {
187
125
  rowProps: {
@@ -190,20 +128,19 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
190
128
  }
191
129
  });
192
130
  }
193
-
194
131
  return /*#__PURE__*/_react.default.createElement("div", {
195
132
  className: tableBodyClassName
196
133
  }, /*#__PURE__*/_react.default.createElement("div", {
197
134
  className: _styles.Classes.virtual,
198
135
  tabIndex: -1,
199
136
  style: virtualStyle
200
- }, topBlank > 0 && /*#__PURE__*/_react.default.createElement("div", {
137
+ }, topBlank > 0 && (/*#__PURE__*/_react.default.createElement("div", {
201
138
  key: "top-blank",
202
139
  className: (0, _classnames.default)(_styles.Classes.virtualBlank, 'top'),
203
140
  style: {
204
141
  height: topBlank
205
142
  }
206
- }), /*#__PURE__*/_react.default.createElement(_htmlTable.HtmlTable, {
143
+ })), /*#__PURE__*/_react.default.createElement(_htmlTable.HtmlTable, {
207
144
  tbodyHtmlTag: "tbody",
208
145
  getRowProps: getRowProps,
209
146
  primaryKey: primaryKey,
@@ -215,15 +152,14 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
215
152
  limit: bottomIndex,
216
153
  last: dataSource.length - 1
217
154
  }
218
- }), bottomBlank > 0 && /*#__PURE__*/_react.default.createElement("div", {
155
+ }), bottomBlank > 0 && (/*#__PURE__*/_react.default.createElement("div", {
219
156
  key: "bottom-blank",
220
157
  className: (0, _classnames.default)(_styles.Classes.virtualBlank, 'bottom'),
221
158
  style: {
222
159
  height: bottomBlank
223
160
  }
224
- })));
161
+ }))));
225
162
  };
226
-
227
163
  _this.state = {
228
164
  hasScroll: true,
229
165
  hasScrollY: true,
@@ -239,44 +175,37 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
239
175
  return _this;
240
176
  }
241
177
  /** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
242
-
243
-
244
- (0, _createClass2.default)(BaseTable, [{
178
+ (0, _inherits2.default)(BaseTable, _React$Component);
179
+ return (0, _createClass2.default)(BaseTable, [{
245
180
  key: "getDoms",
246
181
  value: function getDoms() {
247
182
  _utils2.console.warn('[kd-table] BaseTable.getDoms() 已经过时');
248
-
249
183
  return this.domHelper;
250
184
  }
251
185
  /** 自定义滚动条宽度为table宽度,使滚动条滑块宽度相同 */
252
-
253
186
  }, {
254
187
  key: "updateStickyScroll",
255
188
  value: function updateStickyScroll() {
256
189
  var _a, _b;
257
-
258
190
  var _this$domHelper = this.domHelper,
259
- stickyScroll = _this$domHelper.stickyScroll,
260
- artTable = _this$domHelper.artTable,
261
- stickyScrollItem = _this$domHelper.stickyScrollItem;
191
+ stickyScroll = _this$domHelper.stickyScroll,
192
+ artTable = _this$domHelper.artTable,
193
+ stickyScrollItem = _this$domHelper.stickyScrollItem;
262
194
  var _lastHasScrollY = this.hasScrollY;
263
-
264
195
  if (!artTable) {
265
196
  return;
266
197
  }
267
-
268
198
  var tableBodyHtmlTable = this.domHelper.getTableBodyHtmlTable();
269
199
  var innerTableWidth = tableBodyHtmlTable.offsetWidth;
270
200
  var artTableWidth = artTable.offsetWidth;
271
- var artTableHeight = artTable.offsetHeight; // 表格隐藏后,不需要对表格的滚动条做额外的逻辑处理
272
-
201
+ var artTableHeight = artTable.offsetHeight;
202
+ // 表格隐藏后,不需要对表格的滚动条做额外的逻辑处理
273
203
  if (artTableWidth === 0 && artTableHeight === 0) return;
274
204
  var stickyScrollHeightProp = this.props.stickyScrollHeight;
275
- var stickyScrollHeight = stickyScrollHeightProp === 'auto' ? this.getScrollBarWidth() : stickyScrollHeightProp; // stickyScroll.style.marginTop = `-${stickyScrollHeight + 1}px`
205
+ var stickyScrollHeight = stickyScrollHeightProp === 'auto' ? this.getScrollBarWidth() : stickyScrollHeightProp;
206
+ // stickyScroll.style.marginTop = `-${stickyScrollHeight + 1}px`
276
207
  // 设置滚动条高度
277
-
278
208
  stickyScroll.style.height = "".concat(stickyScrollHeight, "px");
279
-
280
209
  if (artTableWidth >= innerTableWidth) {
281
210
  if (this.state.hasScroll) {
282
211
  this.setState({
@@ -291,7 +220,6 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
291
220
  });
292
221
  }
293
222
  }
294
-
295
223
  if (this.domHelper.virtual.offsetHeight > this.domHelper.tableBody.offsetHeight) {
296
224
  // if (!this.state.hasScroll) {
297
225
  // this.setState({
@@ -306,34 +234,30 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
306
234
  // })
307
235
  this.hasScrollY = false;
308
236
  }
309
-
310
237
  if (_lastHasScrollY !== this.hasScrollY) {
311
238
  (_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
312
239
  }
313
-
314
240
  var _this$lastInfo = this.lastInfo,
315
- leftLockTotalWidth = _this$lastInfo.leftLockTotalWidth,
316
- rightLockTotalWidth = _this$lastInfo.rightLockTotalWidth;
241
+ leftLockTotalWidth = _this$lastInfo.leftLockTotalWidth,
242
+ rightLockTotalWidth = _this$lastInfo.rightLockTotalWidth;
317
243
  var lockTotalWidth = leftLockTotalWidth + rightLockTotalWidth;
318
- var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0; // 设置子节点宽度
319
-
244
+ var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
245
+ // 设置子节点宽度
320
246
  stickyScrollItem.style.width = "".concat(innerTableWidth - lockTotalWidth + stickyRightOffset, "px");
321
247
  }
322
248
  }, {
323
249
  key: "renderTableHeader",
324
250
  value: function renderTableHeader(info) {
325
251
  var _this$props3 = this.props,
326
- stickyTop = _this$props3.stickyTop,
327
- hasHeader = _this$props3.hasHeader;
252
+ stickyTop = _this$props3.stickyTop,
253
+ hasHeader = _this$props3.hasHeader;
328
254
  var renderHeader = (0, _renderTemplates.default)('header');
329
255
  var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
330
-
331
256
  if (typeof renderHeader === 'function') {
332
257
  return renderHeader(info, this.props, {
333
258
  stickyRightOffset: stickyRightOffset
334
259
  });
335
260
  }
336
-
337
261
  return /*#__PURE__*/_react.default.createElement("div", {
338
262
  className: (0, _classnames.default)(_styles.Classes.tableHeader, 'no-scrollbar'),
339
263
  style: {
@@ -367,29 +291,23 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
367
291
  this.syncHorizontalScroll(this.domHelper.virtual.scrollLeft);
368
292
  }
369
293
  /** 同步横向滚动偏移量 */
370
-
371
294
  }, {
372
295
  key: "syncHorizontalScroll",
373
296
  value: function syncHorizontalScroll(x) {
374
297
  this.updateOffsetX(x);
375
298
  var flat = (0, _flat.default)(this.lastInfo);
376
299
  var leftLockShadow = this.domHelper.getLeftLockShadow();
377
-
378
300
  if (leftLockShadow) {
379
301
  var shouldShowLeftLockShadow = flat.left.length > 0 && this.state.needRenderLock && x > 0;
380
-
381
302
  if (shouldShowLeftLockShadow) {
382
303
  leftLockShadow.classList.add('show-shadow');
383
304
  } else {
384
305
  leftLockShadow.classList.remove('show-shadow');
385
306
  }
386
307
  }
387
-
388
308
  var rightLockShadow = this.domHelper.getRightLockShadow();
389
-
390
309
  if (rightLockShadow) {
391
310
  var shouldShowRightLockShadow = flat.right.length > 0 && this.state.needRenderLock && x < this.domHelper.virtual.scrollWidth - this.domHelper.virtual.clientWidth;
392
-
393
311
  if (shouldShowRightLockShadow) {
394
312
  rightLockShadow.classList.add('show-shadow');
395
313
  } else {
@@ -402,10 +320,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
402
320
  value: function getVerticalRenderRange(useVirtual) {
403
321
  var dataSource = this.props.dataSource;
404
322
  var _this$state = this.state,
405
- offsetY = _this$state.offsetY,
406
- maxRenderHeight = _this$state.maxRenderHeight;
323
+ offsetY = _this$state.offsetY,
324
+ maxRenderHeight = _this$state.maxRenderHeight;
407
325
  var rowCount = dataSource.length;
408
-
409
326
  if (useVirtual.vertical) {
410
327
  return this.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
411
328
  } else {
@@ -417,14 +334,13 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
417
334
  value: function renderTableFooter(info) {
418
335
  // console.log('render footer')
419
336
  var _this$props4 = this.props,
420
- _this$props4$footerDa = _this$props4.footerDataSource,
421
- footerDataSource = _this$props4$footerDa === void 0 ? [] : _this$props4$footerDa,
422
- getRowProps = _this$props4.getRowProps,
423
- primaryKey = _this$props4.primaryKey,
424
- stickyBottom = _this$props4.stickyBottom;
337
+ _this$props4$footerDa = _this$props4.footerDataSource,
338
+ footerDataSource = _this$props4$footerDa === void 0 ? [] : _this$props4$footerDa,
339
+ getRowProps = _this$props4.getRowProps,
340
+ primaryKey = _this$props4.primaryKey,
341
+ stickyBottom = _this$props4.stickyBottom;
425
342
  var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
426
343
  var renderFooter = (0, _renderTemplates.default)('footer');
427
-
428
344
  if (typeof renderFooter === 'function') {
429
345
  return renderFooter(info, this.props, {
430
346
  rowProps: {
@@ -434,7 +350,6 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
434
350
  stickyRightOffset: stickyRightOffset
435
351
  });
436
352
  }
437
-
438
353
  return /*#__PURE__*/_react.default.createElement("div", {
439
354
  className: (0, _classnames.default)(_styles.Classes.tableFooter, _styles.Classes.horizontalScrollContainer),
440
355
  style: {
@@ -464,8 +379,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
464
379
  }, {
465
380
  key: "renderLockShadows",
466
381
  value: function renderLockShadows(info) {
467
- var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0; // console.log('render LockShadows')
468
-
382
+ var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
383
+ // console.log('render LockShadows')
469
384
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
470
385
  className: _styles.Classes.lockShadowMask,
471
386
  style: {
@@ -489,8 +404,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
489
404
  value: function renderStickyScroll(info) {
490
405
  // console.log('render stickyscroll')
491
406
  var _this$props5 = this.props,
492
- hasStickyScroll = _this$props5.hasStickyScroll,
493
- stickyBottom = _this$props5.stickyBottom;
407
+ hasStickyScroll = _this$props5.hasStickyScroll,
408
+ stickyBottom = _this$props5.stickyBottom;
494
409
  var hasScroll = this.state.hasScroll;
495
410
  var isScroll = hasStickyScroll && hasScroll;
496
411
  var stickyScrollContainerStyle = this.getStickyScrollContainerStyle();
@@ -528,8 +443,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
528
443
  key: "getStickyScrollContainerStyle",
529
444
  value: function getStickyScrollContainerStyle() {
530
445
  var _this$props6 = this.props,
531
- hasStickyScroll = _this$props6.hasStickyScroll,
532
- stickyScrollHeight = _this$props6.stickyScrollHeight;
446
+ hasStickyScroll = _this$props6.hasStickyScroll,
447
+ stickyScrollHeight = _this$props6.stickyScrollHeight;
533
448
  var hasScroll = this.state.hasScroll;
534
449
  var isScroll = hasStickyScroll && hasScroll;
535
450
  var height = stickyScrollHeight === 'auto' ? this.getScrollBarWidth() : stickyScrollHeight;
@@ -543,26 +458,24 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
543
458
  }, {
544
459
  key: "render",
545
460
  value: function render() {
546
- var _cx;
547
-
548
461
  // console.log('render table')
549
462
  var info = (0, _calculations.calculateRenderInfo)(this);
550
463
  this.lastInfo = info;
551
464
  var _this$props7 = this.props,
552
- dataSource = _this$props7.dataSource,
553
- className = _this$props7.className,
554
- style = _this$props7.style,
555
- hasHeader = _this$props7.hasHeader,
556
- useOuterBorder = _this$props7.useOuterBorder,
557
- isStickyHead = _this$props7.isStickyHead,
558
- isStickyHeader = _this$props7.isStickyHeader,
559
- isStickyFooter = _this$props7.isStickyFooter,
560
- isLoading = _this$props7.isLoading,
561
- getTableProps = _this$props7.getTableProps,
562
- footerDataSource = _this$props7.footerDataSource,
563
- components = _this$props7.components,
564
- bordered = _this$props7.bordered;
565
- var artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.artTableWrapper, (_cx = {
465
+ dataSource = _this$props7.dataSource,
466
+ className = _this$props7.className,
467
+ style = _this$props7.style,
468
+ hasHeader = _this$props7.hasHeader,
469
+ useOuterBorder = _this$props7.useOuterBorder,
470
+ isStickyHead = _this$props7.isStickyHead,
471
+ isStickyHeader = _this$props7.isStickyHeader,
472
+ isStickyFooter = _this$props7.isStickyFooter,
473
+ isLoading = _this$props7.isLoading,
474
+ getTableProps = _this$props7.getTableProps,
475
+ footerDataSource = _this$props7.footerDataSource,
476
+ components = _this$props7.components,
477
+ bordered = _this$props7.bordered;
478
+ var artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.artTableWrapper, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
566
479
  'use-outer-border': useOuterBorder,
567
480
  empty: dataSource.length === 0,
568
481
  lock: info.hasLockColumn,
@@ -570,7 +483,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
570
483
  'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
571
484
  'has-footer': footerDataSource.length > 0,
572
485
  'sticky-footer': isStickyFooter
573
- }, (0, _defineProperty2.default)(_cx, _styles.Classes.artTableBordered, bordered), (0, _defineProperty2.default)(_cx, 'ie-polyfill-wrapper', _utils2.browserType.isIE), (0, _defineProperty2.default)(_cx, 'sticky-polyfill-wrapper', (0, _utils2.isStickyUIDegrade)()), _cx), className);
486
+ }, _styles.Classes.artTableBordered, bordered), 'ie-polyfill-wrapper', _utils2.browserType.isIE), 'sticky-polyfill-wrapper', (0, _utils2.isStickyUIDegrade)()), className);
574
487
  var artTableWrapperProps = (0, _defineProperty2.default)({
575
488
  className: artTableWrapperClassName,
576
489
  style: style
@@ -588,18 +501,17 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
588
501
  key: "componentDidMount",
589
502
  value: function componentDidMount() {
590
503
  var _a, _b, _c, _d, _e, _f;
591
-
592
504
  this.rootSubscription = new _rxjs.Subscription();
593
505
  this.resizeSubject = new _rxjs.Subject();
594
506
  this.updateDOMHelper();
595
507
  this.props$ = new _rxjs.BehaviorSubject(this.props);
596
508
  this.initSubscriptions();
597
- this.didMountOrUpdate(); // console.log('did mount end')
598
-
509
+ this.didMountOrUpdate();
510
+ // console.log('did mount end')
599
511
  var _this$props8 = this.props,
600
- cssVariables = _this$props8.cssVariables,
601
- enableCSSVariables = _this$props8.enableCSSVariables,
602
- bordered = _this$props8.bordered;
512
+ cssVariables = _this$props8.cssVariables,
513
+ enableCSSVariables = _this$props8.enableCSSVariables,
514
+ bordered = _this$props8.bordered;
603
515
  (0, _utils.cssPolifill)({
604
516
  variables: cssVariables || {},
605
517
  enableCSSVariables: enableCSSVariables,
@@ -612,14 +524,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
612
524
  }, {
613
525
  key: "componentDidUpdate",
614
526
  value: function componentDidUpdate(prevProps, prevState) {
615
- var _a; // console.log('did update start')
616
-
617
-
527
+ var _a;
528
+ // console.log('did update start')
618
529
  var _this$props9 = this.props,
619
- cssVariables = _this$props9.cssVariables,
620
- enableCSSVariables = _this$props9.enableCSSVariables,
621
- bordered = _this$props9.bordered;
622
-
530
+ cssVariables = _this$props9.cssVariables,
531
+ enableCSSVariables = _this$props9.enableCSSVariables,
532
+ bordered = _this$props9.bordered;
623
533
  if (!(0, _utils.shallowEqual)(prevProps === null || prevProps === void 0 ? void 0 : prevProps.cssVariables, (_a = this.props) === null || _a === void 0 ? void 0 : _a.cssVariables)) {
624
534
  (0, _utils.cssPolifill)({
625
535
  variables: cssVariables || {},
@@ -627,10 +537,10 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
627
537
  bordered: bordered
628
538
  });
629
539
  }
630
-
631
540
  this.updateDOMHelper();
632
541
  this.props$.next(this.props);
633
- this.didMountOrUpdate(prevProps, prevState); // console.log('did update end')
542
+ this.didMountOrUpdate(prevProps, prevState);
543
+ // console.log('did update end')
634
544
  }
635
545
  }, {
636
546
  key: "didMountOrUpdate",
@@ -649,11 +559,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
649
559
  this.domHelper.stickyScroll.scrollLeft = 0;
650
560
  }
651
561
  }
652
-
653
562
  if (prevProps != null) {
654
563
  var prevHasFooter = prevProps.footerDataSource.length > 0;
655
564
  var currentHasFooter = this.props.footerDataSource.length > 0;
656
-
657
565
  if (!prevHasFooter && currentHasFooter) {
658
566
  (0, _utils.getTableScrollFooterDOM)(this.domHelper).scrollLeft = this.domHelper.virtual.scrollLeft;
659
567
  }
@@ -663,64 +571,55 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
663
571
  key: "initSubscriptions",
664
572
  value: function initSubscriptions() {
665
573
  var _this2 = this;
666
-
667
574
  var _this$domHelper2 = this.domHelper,
668
- virtual = _this$domHelper2.virtual,
669
- stickyScroll = _this$domHelper2.stickyScroll;
575
+ virtual = _this$domHelper2.virtual,
576
+ stickyScroll = _this$domHelper2.stickyScroll;
670
577
  this.rootSubscription.add(_utils.throttledWindowResize$.subscribe(function () {
671
578
  _this2.updateStickyScroll();
672
-
673
579
  _this2.adjustNeedRenderLock();
674
580
  }));
675
581
  this.resizeSubject.pipe(op.debounceTime(100)).subscribe(function () {
676
582
  var _a, _b;
677
-
678
583
  (_b = (_a = _this2.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, _this2.domHelper.tableBody.clientWidth);
679
584
  });
680
-
681
585
  var handleTableWrapperResize = function handleTableWrapperResize() {
682
586
  _this2.resizeSubject.next();
683
587
  };
684
-
685
- this.resizeObserver = (0, _utils.addResizeObserver)(this.domHelper.artTableWrapper, handleTableWrapperResize); // 滚动同步
686
-
588
+ this.resizeObserver = (0, _utils.addResizeObserver)(this.domHelper.artTableWrapper, handleTableWrapperResize);
589
+ // 滚动同步
687
590
  this.rootSubscription.add((0, _utils.syncScrollLeft)([(0, _utils.getTableScrollHeaderDOM)(this.domHelper), virtual, (0, _utils.getTableScrollFooterDOM)(this.domHelper), stickyScroll], function (scrollLeft) {
688
591
  _this2.syncHorizontalScroll(scrollLeft);
689
592
  }));
690
- var richVisibleRects$ = (0, _getRichVisibleRectsStream.getRichVisibleRectsStream)(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay()); // 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
691
-
692
- this.rootSubscription.add((0, _rxjs.combineLatest)([richVisibleRects$.pipe(op.map(function (p) {
593
+ var richVisibleRects$ = (0, _getRichVisibleRectsStream.getRichVisibleRectsStream)(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay());
594
+ // 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
595
+ this.rootSubscription.add((0, _rxjs.combineLatest)([richVisibleRects$.pipe(_mapInstanceProperty2(op).call(op, function (p) {
693
596
  return p.clipRect;
694
- }), op.distinctUntilChanged(_utils.shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (_ref) {
597
+ }), op.distinctUntilChanged(_utils.shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), _filterInstanceProperty(op).call(op, function (_ref) {
695
598
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
696
- prevProps = _ref2[0],
697
- props = _ref2[1];
698
-
599
+ prevProps = _ref2[0],
600
+ props = _ref2[1];
699
601
  return prevProps == null || !prevProps.isLoading && props.isLoading;
700
602
  }))]).subscribe(function (_ref3) {
701
603
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
702
- clipRect = _ref4[0];
703
-
604
+ clipRect = _ref4[0];
704
605
  var loadingIndicator = _this2.domHelper.getLoadingIndicator();
705
-
706
606
  if (!loadingIndicator) {
707
607
  return;
708
608
  }
709
-
710
- var height = clipRect.bottom - clipRect.top; // fixme 这里的定位在有些特殊情况下可能会出错 see #132
711
-
609
+ var height = clipRect.bottom - clipRect.top;
610
+ // fixme 这里的定位在有些特殊情况下可能会出错 see #132
712
611
  loadingIndicator.style.top = "".concat(height / 2, "px");
713
612
  loadingIndicator.style.marginTop = "".concat(height / 2, "px");
714
- })); // 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
715
-
716
- this.rootSubscription.add(richVisibleRects$.pipe(op.filter(function () {
613
+ }));
614
+ // 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
615
+ this.rootSubscription.add(richVisibleRects$.pipe(_filterInstanceProperty(op).call(op, function () {
717
616
  var _this2$lastInfo$useVi = _this2.lastInfo.useVirtual,
718
- horizontal = _this2$lastInfo$useVi.horizontal,
719
- vertical = _this2$lastInfo$useVi.vertical;
617
+ horizontal = _this2$lastInfo$useVi.horizontal,
618
+ vertical = _this2$lastInfo$useVi.vertical;
720
619
  return horizontal || vertical;
721
- }), op.map(function (_ref5) {
620
+ }), _mapInstanceProperty2(op).call(op, function (_ref5) {
722
621
  var clipRect = _ref5.clipRect,
723
- offsetY = _ref5.offsetY;
622
+ offsetY = _ref5.offsetY;
724
623
  return {
725
624
  maxRenderHeight: clipRect.bottom - clipRect.top,
726
625
  maxRenderWidth: clipRect.right - clipRect.left,
@@ -730,16 +629,15 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
730
629
  // 如果表格区域被隐藏, 不需要触发组件重渲染
731
630
  if (y.maxRenderHeight === 0 && y.maxRenderWidth === 0) {
732
631
  return true;
733
- } // 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
734
-
735
-
632
+ }
633
+ // 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
736
634
  return Math.abs(x.maxRenderWidth - y.maxRenderWidth) < _utils.OVERSCAN_SIZE / 2 && Math.abs(x.maxRenderHeight - y.maxRenderHeight) < _utils.OVERSCAN_SIZE / 2 && Math.abs(x.offsetY - y.offsetY) < _utils.OVERSCAN_SIZE / 2;
737
635
  })).subscribe(function (sizeAndOffset) {
738
636
  _this2.setState(sizeAndOffset);
739
637
  }));
740
- this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (_ref6) {
638
+ this.rootSubscription.add(richVisibleRects$.pipe(_mapInstanceProperty2(op).call(op, function (_ref6) {
741
639
  var clipRect = _ref6.clipRect,
742
- offsetY = _ref6.offsetY;
640
+ offsetY = _ref6.offsetY;
743
641
  return {
744
642
  maxRenderHeight: clipRect.bottom - clipRect.top,
745
643
  maxRenderWidth: clipRect.right - clipRect.left,
@@ -747,20 +645,18 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
747
645
  };
748
646
  }), op.distinctUntilChanged(function (x, y) {
749
647
  return x.offsetY - y.offsetY === 0;
750
- }), // 计算得到当前行索引对应的数据块,blocks改成数组的形式,兼容快速拖动可视区域出现两个数据块的情况
751
- op.map(function (sizeAndOffset) {
648
+ }),
649
+ // 计算得到当前行索引对应的数据块,blocks改成数组的形式,兼容快速拖动可视区域出现两个数据块的情况
650
+ _mapInstanceProperty2(op).call(op, function (sizeAndOffset) {
752
651
  var _a;
753
-
754
652
  var offsetY = sizeAndOffset.offsetY,
755
- maxRenderHeight = sizeAndOffset.maxRenderHeight;
653
+ maxRenderHeight = sizeAndOffset.maxRenderHeight;
756
654
  var scrollDirection = offsetY - _this2.offsetY >= 0 ? 'down' : 'up';
757
655
  _this2.offsetY = offsetY;
758
656
  var rowCount = _this2.props.dataSource.length;
759
-
760
657
  var vertical = _this2.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
761
-
762
658
  var topIndex = vertical.topIndex,
763
- bottomIndex = vertical.bottomIndex;
659
+ bottomIndex = vertical.bottomIndex;
764
660
  var blockSize = ((_a = _this2.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.blockSize) || 200;
765
661
  var topBlockStartIndex = Math.floor(Math.max(topIndex - 1, 0) / blockSize) * blockSize;
766
662
  var bottomBlockStartIndex = Math.floor((bottomIndex + 1) / blockSize) * blockSize;
@@ -769,13 +665,13 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
769
665
  return x[0] === y[0] && x[1] === y[1];
770
666
  }), op.switchMap(function (startIndexs) {
771
667
  var event$ = (0, _rxjs.from)(startIndexs);
772
- return event$.pipe(op.map(function (startIndex) {
668
+ return event$.pipe(_mapInstanceProperty2(op).call(op, function (startIndex) {
773
669
  return startIndex;
774
670
  }));
775
- }), // 过滤掉重复掉值
671
+ }),
672
+ // 过滤掉重复掉值
776
673
  op.distinctUntilChanged()).subscribe(function (startIndex) {
777
674
  var _a;
778
-
779
675
  (_a = _this2.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.callback(startIndex);
780
676
  }));
781
677
  }
@@ -783,13 +679,11 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
783
679
  key: "componentWillUnmount",
784
680
  value: function componentWillUnmount() {
785
681
  var _a;
786
-
787
682
  (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
788
683
  this.rootSubscription.unsubscribe();
789
684
  this.resizeSubject.unsubscribe();
790
685
  }
791
686
  /** 更新 DOM 节点的引用,方便其他方法直接操作 DOM */
792
-
793
687
  }, {
794
688
  key: "updateDOMHelper",
795
689
  value: function updateDOMHelper() {
@@ -799,51 +693,42 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
799
693
  key: "updateRowHeightManager",
800
694
  value: function updateRowHeightManager() {
801
695
  var _a;
802
-
803
696
  var virtualTop = this.domHelper.getVirtualTop();
804
697
  var virtualTopHeight = (_a = virtualTop === null || virtualTop === void 0 ? void 0 : virtualTop.clientHeight) !== null && _a !== void 0 ? _a : 0;
805
698
  var maxTrRowIndex = -1;
806
699
  var maxTrBottom = -1;
807
700
  var zeroHeightRowCount = 0;
808
-
809
701
  var _iterator = _createForOfIteratorHelper(this.domHelper.getTableRows()),
810
- _step;
811
-
702
+ _step;
812
703
  try {
813
704
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
814
705
  var tr = _step.value;
815
706
  var rowIndex = Number(tr.dataset.rowindex);
816
-
817
707
  if (isNaN(rowIndex)) {
818
708
  continue;
819
709
  }
820
-
821
710
  maxTrRowIndex = Math.max(maxTrRowIndex, rowIndex);
822
711
  var offset = tr.offsetTop + virtualTopHeight;
823
712
  var size = tr.offsetHeight;
824
-
825
713
  if (size === 0) {
826
714
  zeroHeightRowCount += 1;
827
715
  } else {
828
716
  // 渲染出来的行高度为0,说明是display=none情况,行高不存在该种异常情况,不保存当前的高度
829
717
  this.rowHeightManager.updateRow(rowIndex, offset, size);
830
718
  }
831
-
832
719
  maxTrBottom = Math.max(maxTrBottom, offset + size);
833
- } // 当 estimatedRowHeight 过大时,可能出现「渲染行数过少,无法覆盖可视范围」的情况
720
+ }
721
+ // 当 estimatedRowHeight 过大时,可能出现「渲染行数过少,无法覆盖可视范围」的情况
834
722
  // 出现这种情况时,我们判断「下一次渲染能够渲染更多行」是否满足,满足的话就直接调用 forceUpdate
835
723
  // zeroHeightRowCount === 0 用于确保当前没有 display=none 的情况
836
-
837
724
  } catch (err) {
838
725
  _iterator.e(err);
839
726
  } finally {
840
727
  _iterator.f();
841
728
  }
842
-
843
729
  if (maxTrRowIndex !== -1 && zeroHeightRowCount === 0) {
844
730
  if (maxTrBottom < this.state.offsetY + this.state.maxRenderHeight) {
845
731
  var vertical = this.getVerticalRenderRange(this.lastInfo.useVirtual);
846
-
847
732
  if (vertical.bottomIndex - 1 > maxTrRowIndex) {
848
733
  this.forceUpdate();
849
734
  }
@@ -851,23 +736,19 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
851
736
  }
852
737
  }
853
738
  /** 计算表格所有列的渲染宽度之和,判断表格是否需要渲染锁列 */
854
-
855
739
  }, {
856
740
  key: "adjustNeedRenderLock",
857
741
  value: function adjustNeedRenderLock() {
858
742
  var needRenderLock = this.state.needRenderLock;
859
743
  var _this$lastInfo2 = this.lastInfo,
860
- flat = (0, _flat.default)(_this$lastInfo2),
861
- hasLockColumn = _this$lastInfo2.hasLockColumn;
862
-
744
+ flat = (0, _flat.default)(_this$lastInfo2),
745
+ hasLockColumn = _this$lastInfo2.hasLockColumn;
863
746
  if (hasLockColumn) {
864
747
  var _context;
865
-
866
748
  var sumOfColWidth = (0, _utils.sum)((0, _map.default)(_context = flat.full).call(_context, function (col) {
867
749
  return col.width;
868
750
  }));
869
751
  var nextNeedRenderLock = sumOfColWidth > this.domHelper.artTable.clientWidth;
870
-
871
752
  if (needRenderLock !== nextNeedRenderLock) {
872
753
  this.setState({
873
754
  needRenderLock: nextNeedRenderLock
@@ -882,10 +763,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
882
763
  }
883
764
  }
884
765
  }]);
885
- return BaseTable;
886
766
  }(_react.default.Component);
887
-
888
- exports.BaseTable = BaseTable;
889
767
  BaseTable.defaultProps = {
890
768
  hasHeader: true,
891
769
  isStickyHeader: true,