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