@kdcloudjs/table 1.2.0-canary.16 → 1.2.0-canary.17-hotfix

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