@kdcloudjs/table 1.2.0-canary.6 → 1.2.0-canary.6-hotfix.2

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