@kdcloudjs/table 1.2.1-canary.6 → 1.2.2-canary.3

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 (288) 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 +5480 -6087
  5. package/dist/@kdcloudjs/table.js.map +1 -1
  6. package/dist/@kdcloudjs/table.min.css +1 -1
  7. package/dist/@kdcloudjs/table.min.js +18 -16
  8. package/dist/@kdcloudjs/table.min.js.map +1 -1
  9. package/dist/kd-ui-complete.less +777 -777
  10. package/es/_utils/arrayUtil.js +0 -3
  11. package/es/_utils/devwarning.js +0 -1
  12. package/es/_utils/formatUtil.js +36 -101
  13. package/es/_utils/hooks.js +21 -45
  14. package/es/_utils/index.js +0 -2
  15. package/es/_utils/numberUtil.js +32 -55
  16. package/es/_utils/omit.js +0 -2
  17. package/es/_utils/type.js +0 -2
  18. package/es/_utils/usePopper.js +81 -144
  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 +11 -50
  24. package/es/style/color/colors.less +1 -1
  25. package/es/style/core/index.less +1 -1
  26. package/es/style/core/motion/other.less +27 -27
  27. package/es/style/core/motion/slide.less +53 -53
  28. package/es/style/core/motion.less +1 -1
  29. package/es/style/core/reset.less +185 -185
  30. package/es/style/index.less +1 -1
  31. package/es/style/mixins/index.less +18 -18
  32. package/es/style/mixins/overlay.less +21 -21
  33. package/es/style/mixins/reset.less +12 -12
  34. package/es/style/themes/default.less +445 -445
  35. package/es/table/base/calculations.js +25 -75
  36. package/es/table/base/colgroup.js +0 -1
  37. package/es/table/base/empty.js +6 -6
  38. package/es/table/base/globalStyleComponent.d.ts +4 -0
  39. package/es/table/base/globalStyleComponent.js +24 -0
  40. package/es/table/base/header.js +21 -76
  41. package/es/table/base/helpers/SpanManager.js +4 -11
  42. package/es/table/base/helpers/TableDOMUtils.js +9 -34
  43. package/es/table/base/helpers/__test__/SpanManager.test.js +2 -2
  44. package/es/table/base/helpers/__test__/TableDOMUtils.test.js +0 -1
  45. package/es/table/base/helpers/getRichVisibleRectsStream.js +13 -45
  46. package/es/table/base/helpers/rowHeightManager.js +0 -28
  47. package/es/table/base/html-table.js +17 -39
  48. package/es/table/base/loading.js +8 -10
  49. package/es/table/base/renderTemplates.js +42 -60
  50. package/es/table/base/styles.d.ts +10 -0
  51. package/es/table/base/styles.js +17 -16
  52. package/es/table/base/table.js +113 -201
  53. package/es/table/base/utils.js +17 -57
  54. package/es/table/common-views.js +0 -7
  55. package/es/table/interfaces.d.ts +38 -0
  56. package/es/table/internals.js +0 -13
  57. package/es/table/pipeline/const.d.ts +3 -0
  58. package/es/table/pipeline/const.js +3 -0
  59. package/es/table/pipeline/features/autoFill.js +11 -40
  60. package/es/table/pipeline/features/autoRowSpan.js +1 -14
  61. package/es/table/pipeline/features/colGroupExtendable.js +4 -19
  62. package/es/table/pipeline/features/columnDrag.js +41 -97
  63. package/es/table/pipeline/features/columnFilter.js +12 -51
  64. package/es/table/pipeline/features/columnHover.js +1 -7
  65. package/es/table/pipeline/features/columnRangeHover.js +1 -8
  66. package/es/table/pipeline/features/columnResizeWidth.js +13 -39
  67. package/es/table/pipeline/features/contextMenu.js +22 -95
  68. package/es/table/pipeline/features/featureApi/RowDragApi.d.ts +15 -0
  69. package/es/table/pipeline/features/featureApi/RowDragApi.js +66 -0
  70. package/es/table/pipeline/features/featureApi/utils.d.ts +2 -0
  71. package/es/table/pipeline/features/featureApi/utils.js +10 -0
  72. package/es/table/pipeline/features/filter/DefaultFilterContent.js +14 -30
  73. package/es/table/pipeline/features/filter/DefaultFilterIcon.js +1 -1
  74. package/es/table/pipeline/features/filter/Filter.js +27 -51
  75. package/es/table/pipeline/features/filter/FilterPanel.js +11 -25
  76. package/es/table/pipeline/features/filter/util.js +0 -4
  77. package/es/table/pipeline/features/footerDataSource.js +0 -3
  78. package/es/table/pipeline/features/mergeCellHover.js +0 -1
  79. package/es/table/pipeline/features/multiSelect.js +15 -57
  80. package/es/table/pipeline/features/rangeSelection.js +73 -152
  81. package/es/table/pipeline/features/rowDetail.js +4 -43
  82. package/es/table/pipeline/features/rowDrag.d.ts +10 -12
  83. package/es/table/pipeline/features/rowDrag.js +491 -236
  84. package/es/table/pipeline/features/rowGrouping.js +4 -37
  85. package/es/table/pipeline/features/singleSelect.js +0 -24
  86. package/es/table/pipeline/features/sort.js +38 -96
  87. package/es/table/pipeline/features/tips.js +4 -10
  88. package/es/table/pipeline/features/treeMode.d.ts +1 -0
  89. package/es/table/pipeline/features/treeMode.js +38 -57
  90. package/es/table/pipeline/features/treeSelect.js +2 -28
  91. package/es/table/pipeline/pipeline.d.ts +3 -0
  92. package/es/table/pipeline/pipeline.js +35 -54
  93. package/es/table/pivot/cross-table/buildCrossTable.js +21 -72
  94. package/es/table/pivot/cross-table/cross-table.js +23 -31
  95. package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -57
  96. package/es/table/pivot/cross-tree-table/cross-tree-table.js +36 -61
  97. package/es/table/pivot/pivot-utils/buildDrillTree.js +10 -23
  98. package/es/table/pivot/pivot-utils/builders.js +34 -74
  99. package/es/table/pivot/pivot-utils/convert-utils.js +16 -42
  100. package/es/table/pivot/pivot-utils/simpleEncode.js +0 -1
  101. package/es/table/style/index.less +1 -1
  102. package/es/table/transforms/autoRowSpan.js +1 -15
  103. package/es/table/transforms/autoWidth.js +13 -35
  104. package/es/table/transforms/buildTree.js +1 -2
  105. package/es/table/transforms/columnHover.js +9 -15
  106. package/es/table/transforms/columnRangeHover.js +12 -19
  107. package/es/table/transforms/columnResize.js +18 -42
  108. package/es/table/transforms/flatten.js +0 -3
  109. package/es/table/transforms/orderField.js +0 -3
  110. package/es/table/transforms/sort.js +42 -101
  111. package/es/table/transforms/tips.js +5 -10
  112. package/es/table/transforms/treeMode.js +36 -77
  113. package/es/table/transforms/visible.js +0 -2
  114. package/es/table/use/useResizeObserver.js +1 -4
  115. package/es/table/utils/applyTransforms.js +0 -1
  116. package/es/table/utils/browserType.js +12 -19
  117. package/es/table/utils/buildTree.js +7 -22
  118. package/es/table/utils/collectNodes.js +4 -13
  119. package/es/table/utils/console.js +0 -14
  120. package/es/table/utils/copyToClipboard.js +0 -4
  121. package/es/table/utils/element.js +14 -41
  122. package/es/table/utils/exportTableAsExcel.js +7 -43
  123. package/es/table/utils/getTreeDepth.js +4 -12
  124. package/es/table/utils/groupBy.js +4 -13
  125. package/es/table/utils/layeredFilter.js +0 -4
  126. package/es/table/utils/layeredSort.js +0 -5
  127. package/es/table/utils/makeRecursiveMapper.js +4 -15
  128. package/es/table/utils/mergeCellProps.js +6 -14
  129. package/es/table/utils/others.js +6 -19
  130. package/es/table/utils/proto.js +2 -30
  131. package/es/table/utils/smartCompare.js +4 -12
  132. package/es/table/utils/traverseColumn.js +5 -18
  133. package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -30
  134. package/es/table/utils/tree-data-helpers/TreeDataHelper.js +19 -74
  135. package/es/table/utils/uiDegrade.js +0 -5
  136. package/lib/_utils/arrayUtil.js +2 -8
  137. package/lib/_utils/devwarning.js +0 -5
  138. package/lib/_utils/formatUtil.js +36 -105
  139. package/lib/_utils/hooks.js +21 -56
  140. package/lib/_utils/index.js +2 -9
  141. package/lib/_utils/numberUtil.js +32 -63
  142. package/lib/_utils/omit.js +0 -5
  143. package/lib/_utils/react-children.js +0 -5
  144. package/lib/_utils/type.js +3 -11
  145. package/lib/_utils/usePopper.js +86 -173
  146. package/lib/config-provider/ConfigContext.js +2 -6
  147. package/lib/config-provider/compDefaultProps.js +1 -3
  148. package/lib/config-provider/configProvider.js +6 -22
  149. package/lib/config-provider/defaultConfig.js +1 -7
  150. package/lib/config-provider/index.js +1 -8
  151. package/lib/index.js +2 -8
  152. package/lib/locale/index.js +3 -11
  153. package/lib/locale/locale.js +15 -71
  154. package/lib/locale/zh-CN.js +1 -2
  155. package/lib/style/color/colors.less +1 -1
  156. package/lib/style/components.less +1 -1
  157. package/lib/style/core/index.less +1 -1
  158. package/lib/style/core/motion/other.less +27 -27
  159. package/lib/style/core/motion/slide.less +53 -53
  160. package/lib/style/core/motion.less +1 -1
  161. package/lib/style/core/reset.less +185 -185
  162. package/lib/style/index.less +1 -1
  163. package/lib/style/mixins/index.less +18 -18
  164. package/lib/style/mixins/overlay.less +21 -21
  165. package/lib/style/mixins/reset.less +12 -12
  166. package/lib/style/themes/default.less +445 -445
  167. package/lib/table/base/calculations.js +25 -86
  168. package/lib/table/base/colgroup.js +0 -5
  169. package/lib/table/base/empty.js +8 -20
  170. package/lib/table/base/globalStyleComponent.d.ts +4 -0
  171. package/lib/table/base/globalStyleComponent.js +35 -0
  172. package/lib/table/base/header.js +21 -86
  173. package/lib/table/base/helpers/SpanManager.js +6 -16
  174. package/lib/table/base/helpers/TableDOMUtils.js +9 -37
  175. package/lib/table/base/helpers/__test__/SpanManager.test.js +2 -4
  176. package/lib/table/base/helpers/__test__/TableDOMUtils.test.js +0 -5
  177. package/lib/table/base/helpers/__test__/rowHeightManager.test.js +0 -1
  178. package/lib/table/base/helpers/getRichVisibleRectsStream.js +15 -65
  179. package/lib/table/base/helpers/rowHeightManager.js +0 -33
  180. package/lib/table/base/html-table.js +17 -49
  181. package/lib/table/base/index.js +0 -2
  182. package/lib/table/base/loading.js +8 -14
  183. package/lib/table/base/renderTemplates.js +45 -76
  184. package/lib/table/base/styles.d.ts +10 -0
  185. package/lib/table/base/styles.js +24 -42
  186. package/lib/table/base/table.js +125 -245
  187. package/lib/table/base/utils.js +27 -109
  188. package/lib/table/common-views.js +4 -24
  189. package/lib/table/index.js +0 -13
  190. package/lib/table/interfaces.d.ts +38 -0
  191. package/lib/table/internals.js +2 -17
  192. package/lib/table/pipeline/const.d.ts +3 -0
  193. package/lib/table/pipeline/const.js +9 -0
  194. package/lib/table/pipeline/features/autoFill.js +14 -53
  195. package/lib/table/pipeline/features/autoRowSpan.js +1 -19
  196. package/lib/table/pipeline/features/buildTree.js +0 -2
  197. package/lib/table/pipeline/features/colGroupExtendable.js +6 -35
  198. package/lib/table/pipeline/features/columnDrag.js +41 -103
  199. package/lib/table/pipeline/features/columnFilter.js +12 -65
  200. package/lib/table/pipeline/features/columnHover.js +1 -11
  201. package/lib/table/pipeline/features/columnRangeHover.js +1 -13
  202. package/lib/table/pipeline/features/columnResizeWidth.js +18 -63
  203. package/lib/table/pipeline/features/contextMenu.js +24 -121
  204. package/lib/table/pipeline/features/featureApi/RowDragApi.d.ts +15 -0
  205. package/lib/table/pipeline/features/featureApi/RowDragApi.js +72 -0
  206. package/lib/table/pipeline/features/featureApi/utils.d.ts +2 -0
  207. package/lib/table/pipeline/features/featureApi/utils.js +17 -0
  208. package/lib/table/pipeline/features/filter/DefaultFilterContent.js +17 -52
  209. package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
  210. package/lib/table/pipeline/features/filter/Filter.js +30 -77
  211. package/lib/table/pipeline/features/filter/FilterPanel.js +14 -44
  212. package/lib/table/pipeline/features/filter/index.js +0 -5
  213. package/lib/table/pipeline/features/filter/util.js +2 -10
  214. package/lib/table/pipeline/features/footerDataSource.js +1 -12
  215. package/lib/table/pipeline/features/index.js +0 -23
  216. package/lib/table/pipeline/features/mergeCellHover.js +0 -5
  217. package/lib/table/pipeline/features/multiSelect.js +15 -71
  218. package/lib/table/pipeline/features/rangeSelection.js +75 -173
  219. package/lib/table/pipeline/features/rowDetail.js +4 -67
  220. package/lib/table/pipeline/features/rowDrag.d.ts +10 -12
  221. package/lib/table/pipeline/features/rowDrag.js +494 -252
  222. package/lib/table/pipeline/features/rowGrouping.js +4 -57
  223. package/lib/table/pipeline/features/singleSelect.js +0 -34
  224. package/lib/table/pipeline/features/sort.js +37 -115
  225. package/lib/table/pipeline/features/tips.js +4 -19
  226. package/lib/table/pipeline/features/treeMode.d.ts +1 -0
  227. package/lib/table/pipeline/features/treeMode.js +40 -80
  228. package/lib/table/pipeline/features/treeSelect.js +2 -36
  229. package/lib/table/pipeline/index.js +2 -10
  230. package/lib/table/pipeline/pipeline.d.ts +3 -0
  231. package/lib/table/pipeline/pipeline.js +36 -65
  232. package/lib/table/pivot/cross-table/buildCrossTable.js +21 -83
  233. package/lib/table/pivot/cross-table/constants.js +1 -2
  234. package/lib/table/pivot/cross-table/cross-table.js +25 -42
  235. package/lib/table/pivot/cross-table/index.js +0 -4
  236. package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -70
  237. package/lib/table/pivot/cross-tree-table/cross-tree-table.js +37 -73
  238. package/lib/table/pivot/cross-tree-table/index.js +0 -3
  239. package/lib/table/pivot/pivot-utils/buildDrillTree.js +10 -29
  240. package/lib/table/pivot/pivot-utils/builders.js +34 -85
  241. package/lib/table/pivot/pivot-utils/convert-utils.js +16 -60
  242. package/lib/table/pivot/pivot-utils/index.js +0 -7
  243. package/lib/table/pivot/pivot-utils/simpleEncode.js +0 -2
  244. package/lib/table/style/css.js +0 -1
  245. package/lib/table/style/index.js +0 -1
  246. package/lib/table/style/index.less +1 -1
  247. package/lib/table/transforms/autoRowSpan.js +1 -21
  248. package/lib/table/transforms/autoWidth.js +15 -58
  249. package/lib/table/transforms/buildTree.js +1 -4
  250. package/lib/table/transforms/columnHover.js +9 -22
  251. package/lib/table/transforms/columnRangeHover.js +12 -27
  252. package/lib/table/transforms/columnResize.js +20 -63
  253. package/lib/table/transforms/flatten.js +0 -5
  254. package/lib/table/transforms/index.js +0 -12
  255. package/lib/table/transforms/orderField.js +0 -7
  256. package/lib/table/transforms/sort.js +44 -127
  257. package/lib/table/transforms/tips.js +5 -20
  258. package/lib/table/transforms/treeMode.js +38 -106
  259. package/lib/table/transforms/visible.js +0 -7
  260. package/lib/table/transforms/warnTransformsDeprecated.js +0 -4
  261. package/lib/table/use/useResizeObserver.js +2 -10
  262. package/lib/table/utils/applyTransforms.js +0 -2
  263. package/lib/table/utils/browserType.js +14 -23
  264. package/lib/table/utils/buildTree.js +7 -33
  265. package/lib/table/utils/collectNodes.js +4 -18
  266. package/lib/table/utils/console.js +2 -19
  267. package/lib/table/utils/copyToClipboard.js +1 -8
  268. package/lib/table/utils/element.js +14 -46
  269. package/lib/table/utils/exportTableAsExcel.js +7 -52
  270. package/lib/table/utils/getTreeDepth.js +4 -17
  271. package/lib/table/utils/groupBy.js +4 -17
  272. package/lib/table/utils/index.js +0 -22
  273. package/lib/table/utils/isGroupColumn.js +0 -3
  274. package/lib/table/utils/isLeafNode.js +0 -1
  275. package/lib/table/utils/keyCode.js +1 -2
  276. package/lib/table/utils/layeredFilter.js +0 -10
  277. package/lib/table/utils/layeredSort.js +0 -10
  278. package/lib/table/utils/makeRecursiveMapper.js +4 -24
  279. package/lib/table/utils/mergeCellProps.js +6 -18
  280. package/lib/table/utils/others.js +7 -36
  281. package/lib/table/utils/proto.js +3 -35
  282. package/lib/table/utils/selectColumn.js +2 -5
  283. package/lib/table/utils/smartCompare.js +4 -13
  284. package/lib/table/utils/traverseColumn.js +5 -25
  285. package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +10 -41
  286. package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +21 -90
  287. package/lib/table/utils/uiDegrade.js +1 -8
  288. package/package.json +218 -218
@@ -10,35 +10,25 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
10
10
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
11
11
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
12
12
  import _Map from "@babel/runtime-corejs3/core-js-stable/map";
13
-
14
- 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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
15
-
16
- function _unsupportedIterableToArray(o, minLen) { var _context10; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context10 = Object.prototype.toString.call(o)).call(_context10, 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
- 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
-
13
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { var _context10; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context10 = {}.toString.call(r)).call(_context10, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
20
16
  import { collectNodes, isLeafNode, console } from '../utils';
21
17
  import { AUTO_VIRTUAL_THRESHOLD, OVERSCAN_SIZE, sum } from './utils';
22
-
23
18
  function resolveVirtualEnabled(virtualEnum, defaultValue) {
24
19
  if (virtualEnum == null || virtualEnum === 'auto') {
25
20
  return defaultValue;
26
21
  }
27
-
28
22
  return virtualEnum;
29
23
  }
30
-
31
24
  var lockColumnNeedSpecifiedWidthWarned = false;
32
-
33
25
  function warnLockColumnNeedSpecifiedWidth(column) {
34
26
  if (!lockColumnNeedSpecifiedWidthWarned) {
35
27
  lockColumnNeedSpecifiedWidthWarned = true;
36
28
  console.warn('lock=true 的列需要指定宽度', column);
37
29
  }
38
30
  }
39
-
40
31
  var columnHiddenDeprecatedWarned = false;
41
-
42
32
  function warnColumnHiddenDeprecated(column) {
43
33
  if (!columnHiddenDeprecatedWarned) {
44
34
  columnHiddenDeprecatedWarned = true;
@@ -46,24 +36,18 @@ function warnColumnHiddenDeprecated(column) {
46
36
  }
47
37
  }
48
38
  /** 检查列配置 & 设置默认宽度 & 剔除隐藏的列 */
49
-
50
-
51
39
  function processColumns(columns, defaultColumnWidth) {
52
40
  if (columns == null || !Array.isArray(columns)) {
53
41
  console.warn('<BaseTable /> props.columns 需要传入一个数组', columns);
54
42
  columns = [];
55
43
  }
56
-
57
44
  function dfs(columns) {
58
45
  var result = [];
59
-
60
46
  var _iterator = _createForOfIteratorHelper(columns),
61
- _step;
62
-
47
+ _step;
63
48
  try {
64
49
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
65
50
  var column = _step.value;
66
-
67
51
  if (column.width == null) {
68
52
  if (defaultColumnWidth != null) {
69
53
  column = _extends(_extends({}, column), {
@@ -73,7 +57,6 @@ function processColumns(columns, defaultColumnWidth) {
73
57
  warnLockColumnNeedSpecifiedWidth(column);
74
58
  }
75
59
  }
76
-
77
60
  if (isLeafNode(column)) {
78
61
  if (column.hidden) {
79
62
  // 被隐藏的列 会在这里被剔除
@@ -82,8 +65,8 @@ function processColumns(columns, defaultColumnWidth) {
82
65
  result.push(column);
83
66
  }
84
67
  } else {
85
- var nextChildren = dfs(column.children); // 如果 nextChildren 为空,说明所有的子节点均被隐藏了,在这里隐藏父节点
86
-
68
+ var nextChildren = dfs(column.children);
69
+ // 如果 nextChildren 为空,说明所有的子节点均被隐藏了,在这里隐藏父节点
87
70
  if (nextChildren.length > 0) {
88
71
  result.push(_extends(_extends({}, column), {
89
72
  children: nextChildren
@@ -96,23 +79,17 @@ function processColumns(columns, defaultColumnWidth) {
96
79
  } finally {
97
80
  _iterator.f();
98
81
  }
99
-
100
82
  return result;
101
83
  }
102
-
103
84
  return dfs(columns);
104
85
  }
105
-
106
86
  export function getLeftNestedLockCount(columns) {
107
87
  var nestedCount = 0;
108
-
109
88
  var _iterator2 = _createForOfIteratorHelper(columns),
110
- _step2;
111
-
89
+ _step2;
112
90
  try {
113
91
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
114
92
  var col = _step2.value;
115
-
116
93
  if (isLock(col)) {
117
94
  nestedCount += 1;
118
95
  } else {
@@ -124,9 +101,7 @@ export function getLeftNestedLockCount(columns) {
124
101
  } finally {
125
102
  _iterator2.f();
126
103
  }
127
-
128
104
  return nestedCount;
129
-
130
105
  function isLock(col) {
131
106
  if (isLeafNode(col)) {
132
107
  return col.lock;
@@ -135,15 +110,12 @@ export function getLeftNestedLockCount(columns) {
135
110
  }
136
111
  }
137
112
  }
138
-
139
113
  function getHorizontalRenderRange(_ref) {
140
114
  var _context, _context2;
141
-
142
115
  var offsetX = _ref.offsetX,
143
- maxRenderWidth = _ref.maxRenderWidth,
144
- flat = _flatInstanceProperty(_ref),
145
- useVirtual = _ref.useVirtual;
146
-
116
+ maxRenderWidth = _ref.maxRenderWidth,
117
+ flat = _flatInstanceProperty(_ref),
118
+ useVirtual = _ref.useVirtual;
147
119
  if (!useVirtual.horizontal) {
148
120
  return {
149
121
  leftIndex: 0,
@@ -152,30 +124,24 @@ function getHorizontalRenderRange(_ref) {
152
124
  rightBlank: 0
153
125
  };
154
126
  }
155
-
156
127
  var leftIndex = 0;
157
128
  var centerCount = 0;
158
129
  var leftBlank = 0;
159
130
  var centerRenderWidth = 0;
160
131
  var overscannedOffsetX = Math.max(0, offsetX - OVERSCAN_SIZE);
161
-
162
132
  while (leftIndex < flat.center.length) {
163
133
  var col = flat.center[leftIndex];
164
-
165
134
  if (col.width + leftBlank < overscannedOffsetX) {
166
135
  leftIndex += 1;
167
136
  leftBlank += col.width;
168
137
  } else {
169
138
  break;
170
139
  }
171
- } // 考虑 over scan 之后,中间部分的列至少需要渲染的宽度
172
-
173
-
140
+ }
141
+ // 考虑 over scan 之后,中间部分的列至少需要渲染的宽度
174
142
  var minCenterRenderWidth = maxRenderWidth + (overscannedOffsetX - leftBlank) + 2 * OVERSCAN_SIZE;
175
-
176
143
  while (leftIndex + centerCount < flat.center.length) {
177
144
  var _col = flat.center[leftIndex + centerCount];
178
-
179
145
  if (centerRenderWidth < minCenterRenderWidth) {
180
146
  centerRenderWidth += _col.width;
181
147
  centerCount += 1;
@@ -183,7 +149,6 @@ function getHorizontalRenderRange(_ref) {
183
149
  break;
184
150
  }
185
151
  }
186
-
187
152
  var rightBlankCount = flat.center.length - leftIndex - centerCount;
188
153
  var rightBlank = sum(_mapInstanceProperty(_context = _sliceInstanceProperty(_context2 = flat.center).call(_context2, flat.center.length - rightBlankCount)).call(_context, function (col) {
189
154
  return col.width;
@@ -194,28 +159,25 @@ function getHorizontalRenderRange(_ref) {
194
159
  rightIndex: leftIndex + centerCount,
195
160
  rightBlank: rightBlank
196
161
  };
197
- } // 一顿计算,将表格本次渲染所需要的数据都给算出来(代码写得有点乱,有较大优化空间)
162
+ }
163
+ // 一顿计算,将表格本次渲染所需要的数据都给算出来(代码写得有点乱,有较大优化空间)
198
164
  // todo 可以考虑下将 header 部分的计算逻辑也放到这个文件中,目前应该有一些重复的计算逻辑
199
-
200
-
201
165
  export function calculateRenderInfo(table) {
202
166
  var _context3, _context4, _context5, _context6, _context7, _context8, _context9;
203
-
204
167
  var _table$state = table.state,
205
- offsetX = _table$state.offsetX,
206
- maxRenderWidth = _table$state.maxRenderWidth;
168
+ offsetX = _table$state.offsetX,
169
+ maxRenderWidth = _table$state.maxRenderWidth;
207
170
  var _table$props = table.props,
208
- useVirtualProp = _table$props.useVirtual,
209
- columnsProp = _table$props.columns,
210
- dataSourceProp = _table$props.dataSource,
211
- defaultColumnWidth = _table$props.defaultColumnWidth;
171
+ useVirtualProp = _table$props.useVirtual,
172
+ columnsProp = _table$props.columns,
173
+ dataSourceProp = _table$props.dataSource,
174
+ defaultColumnWidth = _table$props.defaultColumnWidth;
212
175
  var columns = processColumns(columnsProp, defaultColumnWidth);
213
176
  var leftNestedLockCount = getLeftNestedLockCount(columns);
214
177
  var fullFlat = collectNodes(columns, 'leaf-only');
215
178
  var flat;
216
179
  var nested;
217
180
  var useVirtual;
218
-
219
181
  if (leftNestedLockCount === columns.length) {
220
182
  flat = {
221
183
  left: [],
@@ -236,13 +198,9 @@ export function calculateRenderInfo(table) {
236
198
  };
237
199
  } else {
238
200
  var leftNested = _sliceInstanceProperty(columns).call(columns, 0, leftNestedLockCount);
239
-
240
201
  var rightNestedLockCount = getLeftNestedLockCount(_sliceInstanceProperty(columns).call(columns).reverse());
241
-
242
202
  var centerNested = _sliceInstanceProperty(columns).call(columns, leftNestedLockCount, columns.length - rightNestedLockCount);
243
-
244
203
  var rightNested = _sliceInstanceProperty(columns).call(columns, columns.length - rightNestedLockCount);
245
-
246
204
  var shouldEnableHozVirtual = fullFlat.length >= AUTO_VIRTUAL_THRESHOLD && fullFlat.every(function (col) {
247
205
  return col.width != null;
248
206
  });
@@ -265,7 +223,6 @@ export function calculateRenderInfo(table) {
265
223
  center: centerNested
266
224
  };
267
225
  }
268
-
269
226
  var horizontalRenderRange = getHorizontalRenderRange({
270
227
  maxRenderWidth: maxRenderWidth,
271
228
  offsetX: offsetX,
@@ -274,10 +231,9 @@ export function calculateRenderInfo(table) {
274
231
  });
275
232
  var verticalRenderRange = table.getVerticalRenderRange(useVirtual);
276
233
  var leftBlank = horizontalRenderRange.leftBlank,
277
- leftIndex = horizontalRenderRange.leftIndex,
278
- rightBlank = horizontalRenderRange.rightBlank,
279
- rightIndex = horizontalRenderRange.rightIndex;
280
-
234
+ leftIndex = horizontalRenderRange.leftIndex,
235
+ rightBlank = horizontalRenderRange.rightBlank,
236
+ rightIndex = horizontalRenderRange.rightIndex;
281
237
  var unfilteredVisibleColumnDescriptors = _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(_mapInstanceProperty(_context4 = flat.left).call(_context4, function (col, i) {
282
238
  return {
283
239
  type: 'normal',
@@ -305,8 +261,8 @@ export function calculateRenderInfo(table) {
305
261
  colIndex: flat.full.length - flat.right.length + i
306
262
  };
307
263
  })));
308
-
309
- var visibleColumnDescriptors = _filterInstanceProperty(unfilteredVisibleColumnDescriptors).call(unfilteredVisibleColumnDescriptors, Boolean); // const totalWidth = visibleColumnDescriptors.reduce((pre, cur) => {
264
+ var visibleColumnDescriptors = _filterInstanceProperty(unfilteredVisibleColumnDescriptors).call(unfilteredVisibleColumnDescriptors, Boolean);
265
+ // const totalWidth = visibleColumnDescriptors.reduce((pre, cur) => {
310
266
  // if (cur.type === 'blank') {
311
267
  // return cur.width + pre
312
268
  // } else {
@@ -320,27 +276,21 @@ export function calculateRenderInfo(table) {
320
276
  // width: `width: calc(100% - ${totalWidth}px)`
321
277
  // } as VisibleColumnDescriptor)
322
278
  // }
323
-
324
-
325
279
  var fullFlatCount = flat.full.length;
326
280
  var leftFlatCount = flat.left.length;
327
281
  var rightFlatCount = flat.right.length;
328
282
  var stickyLeftMap = new _Map();
329
283
  var stickyLeft = 0;
330
-
331
284
  for (var i = 0; i < leftFlatCount; i++) {
332
285
  stickyLeftMap.set(i, stickyLeft);
333
286
  stickyLeft += flat.full[i].width;
334
287
  }
335
-
336
288
  var stickyRightMap = new _Map();
337
289
  var stickyRight = 0;
338
-
339
290
  for (var _i = 0; _i < rightFlatCount; _i++) {
340
291
  stickyRightMap.set(fullFlatCount - 1 - _i, stickyRight);
341
292
  stickyRight += flat.full[fullFlatCount - 1 - _i].width;
342
293
  }
343
-
344
294
  var leftLockTotalWidth = sum(_mapInstanceProperty(_context8 = flat.left).call(_context8, function (col) {
345
295
  return col.width;
346
296
  }));
@@ -11,7 +11,6 @@ export function Colgroup(_ref) {
11
11
  }
12
12
  });
13
13
  }
14
-
15
14
  return /*#__PURE__*/React.createElement("col", {
16
15
  key: descriptor.colIndex,
17
16
  style: {
@@ -13,10 +13,10 @@ var DefaultEmptyContent = /*#__PURE__*/React.memo(function () {
13
13
  });
14
14
  export function EmptyHtmlTable(_ref) {
15
15
  var descriptors = _ref.descriptors,
16
- isLoading = _ref.isLoading,
17
- emptyCellHeight = _ref.emptyCellHeight,
18
- _ref$EmptyContent = _ref.EmptyContent,
19
- EmptyContent = _ref$EmptyContent === void 0 ? DefaultEmptyContent : _ref$EmptyContent;
16
+ isLoading = _ref.isLoading,
17
+ emptyCellHeight = _ref.emptyCellHeight,
18
+ _ref$EmptyContent = _ref.EmptyContent,
19
+ EmptyContent = _ref$EmptyContent === void 0 ? DefaultEmptyContent : _ref$EmptyContent;
20
20
  var show = !isLoading;
21
21
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("table", {
22
22
  key: "table"
@@ -31,8 +31,8 @@ export function EmptyHtmlTable(_ref) {
31
31
  style: {
32
32
  height: emptyCellHeight !== null && emptyCellHeight !== void 0 ? emptyCellHeight : 200
33
33
  }
34
- })))), show && /*#__PURE__*/React.createElement("div", {
34
+ })))), show && (/*#__PURE__*/React.createElement("div", {
35
35
  className: Classes.emptyWrapper,
36
36
  key: "empty"
37
- }, /*#__PURE__*/React.createElement(EmptyContent, null)));
37
+ }, /*#__PURE__*/React.createElement(EmptyContent, null))));
38
38
  }
@@ -0,0 +1,4 @@
1
+ import { PureComponent } from 'react';
2
+ export default class GlobalStyleComponent extends PureComponent {
3
+ render(): JSX.Element;
4
+ }
@@ -0,0 +1,24 @@
1
+ import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
+ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
4
+ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
6
+ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ import React, { PureComponent } from 'react';
10
+ import { GlobalStyle } from './styles';
11
+ var GlobalStyleComponent = /*#__PURE__*/function (_PureComponent) {
12
+ function GlobalStyleComponent() {
13
+ _classCallCheck(this, GlobalStyleComponent);
14
+ return _callSuper(this, GlobalStyleComponent, arguments);
15
+ }
16
+ _inherits(GlobalStyleComponent, _PureComponent);
17
+ return _createClass(GlobalStyleComponent, [{
18
+ key: "render",
19
+ value: function render() {
20
+ return /*#__PURE__*/React.createElement(GlobalStyle, null);
21
+ }
22
+ }]);
23
+ }(PureComponent);
24
+ export { GlobalStyleComponent as default };
@@ -8,48 +8,34 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
8
8
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
9
9
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
10
10
  import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
11
-
12
- 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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
13
-
14
- function _unsupportedIterableToArray(o, minLen) { var _context6; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(o)).call(_context6, 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); }
15
-
16
- 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; }
17
-
11
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { var _context6; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context6 = {}.toString.call(r)).call(_context6, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
14
  import cx from 'classnames';
19
15
  import React from 'react';
20
16
  import { getTreeDepth, isLeafNode } from '../utils';
21
17
  import { Classes } from './styles';
22
-
23
18
  function range(n) {
24
19
  var array = [];
25
-
26
20
  for (var i = 0; i < n; i++) {
27
21
  array.push(i);
28
22
  }
29
-
30
23
  return array;
31
24
  }
32
25
  /** 根据当前横向虚拟滚动 对 nested.center 进行过滤,结果只保留当前视野内可见的那些列配置 */
33
-
34
-
35
26
  function filterNestedCenter(centerNested, hoz, leftFlatCount) {
36
27
  return dfs(centerNested, leftFlatCount).filtered;
37
-
38
28
  function dfs(cols, startColIndex) {
39
29
  var leafCount = 0;
40
30
  var filtered = [];
41
-
42
31
  var _iterator = _createForOfIteratorHelper(cols),
43
- _step;
44
-
32
+ _step;
45
33
  try {
46
34
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
47
35
  var col = _step.value;
48
36
  var colIndex = startColIndex + leafCount;
49
-
50
37
  if (isLeafNode(col)) {
51
38
  leafCount += 1;
52
-
53
39
  if (leftFlatCount + hoz.leftIndex <= colIndex && colIndex < leftFlatCount + hoz.rightIndex) {
54
40
  filtered.push({
55
41
  colIndex: colIndex,
@@ -59,7 +45,6 @@ function filterNestedCenter(centerNested, hoz, leftFlatCount) {
59
45
  } else {
60
46
  var dfsRes = dfs(col.children, colIndex);
61
47
  leafCount += dfsRes.leafCount;
62
-
63
48
  if (dfsRes.filtered.length > 0) {
64
49
  filtered.push({
65
50
  colIndex: colIndex,
@@ -74,7 +59,6 @@ function filterNestedCenter(centerNested, hoz, leftFlatCount) {
74
59
  } finally {
75
60
  _iterator.f();
76
61
  }
77
-
78
62
  return {
79
63
  filtered: filtered,
80
64
  leafCount: leafCount
@@ -82,28 +66,21 @@ function filterNestedCenter(centerNested, hoz, leftFlatCount) {
82
66
  }
83
67
  }
84
68
  /** 根据输入的 nested 列配置,算出相应的 leveled & flat 配置方便渲染 */
85
-
86
-
87
69
  function calculateLeveledAndFlat(inputNested, rowCount) {
88
70
  var leveled = [];
89
-
90
71
  for (var depth = 0; depth < rowCount; depth++) {
91
72
  leveled.push([]);
92
73
  }
93
-
94
74
  var flat = [];
95
75
  dfs(inputNested, 0);
96
76
  return {
97
77
  flat: flat,
98
78
  leveled: leveled
99
79
  };
100
-
101
80
  function dfs(input, depth) {
102
81
  var leafCount = 0;
103
-
104
82
  for (var i = 0; i < input.length; i++) {
105
83
  var indexedCol = input[i];
106
-
107
84
  if (isLeafNode(indexedCol)) {
108
85
  leafCount += 1;
109
86
  var wrapped = {
@@ -119,7 +96,6 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
119
96
  } else {
120
97
  var dfsRes = dfs(indexedCol.children, depth + 1);
121
98
  leafCount += dfsRes.leafCount;
122
-
123
99
  if (dfsRes.leafCount > 0) {
124
100
  leveled[depth].push({
125
101
  type: 'normal',
@@ -132,26 +108,20 @@ function calculateLeveledAndFlat(inputNested, rowCount) {
132
108
  }
133
109
  }
134
110
  }
135
-
136
111
  return {
137
112
  leafCount: leafCount
138
113
  };
139
114
  }
140
115
  }
141
116
  /** 包装列配置,附加上 colIndex 属性 */
142
-
143
-
144
117
  function attachColIndex(inputNested, colIndexOffset) {
145
118
  return dfs(inputNested, colIndexOffset).result;
146
-
147
119
  function dfs(input, startColIndex) {
148
120
  var result = [];
149
121
  var leafCount = 0;
150
-
151
122
  for (var i = 0; i < input.length; i++) {
152
123
  var col = input[i];
153
124
  var colIndex = startColIndex + leafCount;
154
-
155
125
  if (isLeafNode(col)) {
156
126
  leafCount += 1;
157
127
  result.push({
@@ -161,7 +131,6 @@ function attachColIndex(inputNested, colIndexOffset) {
161
131
  } else {
162
132
  var sub = dfs(col.children, colIndex);
163
133
  leafCount += sub.leafCount;
164
-
165
134
  if (sub.leafCount > 0) {
166
135
  result.push({
167
136
  col: col,
@@ -171,7 +140,6 @@ function attachColIndex(inputNested, colIndexOffset) {
171
140
  }
172
141
  }
173
142
  }
174
-
175
143
  return {
176
144
  result: result,
177
145
  leafCount: leafCount
@@ -179,17 +147,13 @@ function attachColIndex(inputNested, colIndexOffset) {
179
147
  }
180
148
  }
181
149
  /** 计算用于渲染表头的数据结构 */
182
-
183
-
184
150
  function calculateHeaderRenderInfo(_ref, rowCount) {
185
151
  var flat = _flatInstanceProperty(_ref),
186
- nested = _ref.nested,
187
- hoz = _ref.horizontalRenderRange,
188
- useVirtual = _ref.useVirtual;
189
-
152
+ nested = _ref.nested,
153
+ hoz = _ref.horizontalRenderRange,
154
+ useVirtual = _ref.useVirtual;
190
155
  if (useVirtual.header) {
191
156
  var _context, _context2;
192
-
193
157
  var leftPart = calculateLeveledAndFlat(attachColIndex(nested.left, 0), rowCount);
194
158
  var filtered = filterNestedCenter(nested.center, hoz, flat.left.length);
195
159
  var centerPart = calculateLeveledAndFlat(filtered, rowCount);
@@ -206,7 +170,6 @@ function calculateHeaderRenderInfo(_ref, rowCount) {
206
170
  }], _toConsumableArray(_flatInstanceProperty(rightPart))),
207
171
  leveled: _mapInstanceProperty(_context2 = range(rowCount)).call(_context2, function (depth) {
208
172
  var _context3;
209
-
210
173
  return _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(leftPart.leveled[depth]), [{
211
174
  type: 'blank',
212
175
  width: hoz.leftBlank,
@@ -219,36 +182,27 @@ function calculateHeaderRenderInfo(_ref, rowCount) {
219
182
  })
220
183
  };
221
184
  }
222
-
223
185
  return calculateLeveledAndFlat(attachColIndex(nested.full, 0), rowCount);
224
186
  }
225
-
226
187
  export default function TableHeader(_ref2) {
227
188
  var _context4, _context5;
228
-
229
189
  var info = _ref2.info,
230
- theaderPosition = _ref2.theaderPosition,
231
- _rowCount = _ref2.rowCount,
232
- stickyRightOffset = _ref2.stickyRightOffset;
233
-
190
+ theaderPosition = _ref2.theaderPosition,
191
+ _rowCount = _ref2.rowCount,
192
+ stickyRightOffset = _ref2.stickyRightOffset;
234
193
  var nested = info.nested,
235
- flat = _flatInstanceProperty(info),
236
- stickyLeftMap = info.stickyLeftMap,
237
- stickyRightMap = info.stickyRightMap;
238
-
194
+ flat = _flatInstanceProperty(info),
195
+ stickyLeftMap = info.stickyLeftMap,
196
+ stickyRightMap = info.stickyRightMap;
239
197
  var rowCount = _rowCount !== null && _rowCount !== void 0 ? _rowCount : getTreeDepth(nested.full) + 1;
240
198
  var headerRenderInfo = calculateHeaderRenderInfo(info, rowCount);
241
199
  var fullFlatCount = flat.full.length;
242
200
  var leftFlatCount = flat.left.length;
243
201
  var rightFlatCount = flat.right.length;
244
-
245
202
  var thead = _mapInstanceProperty(_context4 = headerRenderInfo.leveled).call(_context4, function (wrappedCols, level) {
246
- var _cx2;
247
-
248
- var _wrappedCols = _concatInstanceProperty(wrappedCols).call(wrappedCols); // 左中右区域渲染,分组列可能单独位于一个区域,此时其他区域也需要适配分组的高度
203
+ var _wrappedCols = _concatInstanceProperty(wrappedCols).call(wrappedCols);
204
+ // 左中右区域渲染,分组列可能单独位于一个区域,此时其他区域也需要适配分组的高度
249
205
  // rowspan 需要空白的列头去占位, 需要补充额外的空白列头
250
-
251
-
252
206
  if (rowCount > 1 && ['left', 'right'].indexOf(theaderPosition) > -1) {
253
207
  _wrappedCols.push({
254
208
  type: 'blank',
@@ -257,34 +211,28 @@ export default function TableHeader(_ref2) {
257
211
  isPlacehoder: true
258
212
  });
259
213
  }
260
-
261
214
  var headerCells = _mapInstanceProperty(_wrappedCols).call(_wrappedCols, function (wrapped, index) {
262
215
  var _a, _b, _c;
263
-
264
216
  if (wrapped.type === 'normal') {
265
- var _cx;
266
-
267
217
  var colIndex = wrapped.colIndex,
268
- colSpan = wrapped.colSpan,
269
- isLeaf = wrapped.isLeaf,
270
- col = wrapped.col;
218
+ colSpan = wrapped.colSpan,
219
+ isLeaf = wrapped.isLeaf,
220
+ col = wrapped.col;
271
221
  var headerCellProps = (_a = col.headerCellProps) !== null && _a !== void 0 ? _a : {};
272
222
  var positionStyle = {};
273
-
274
223
  if (colIndex < leftFlatCount) {
275
224
  positionStyle.position = 'sticky';
276
225
  positionStyle.left = stickyLeftMap.get(colIndex);
277
226
  } else if (colIndex >= fullFlatCount - rightFlatCount) {
278
227
  positionStyle.position = 'sticky';
279
228
  var stickyRightIndex = colSpan > 1 ? colIndex + colSpan - 1 : colIndex;
280
- positionStyle.right = stickyRightMap.get(stickyRightIndex) + stickyRightOffset;
229
+ positionStyle.right = stickyRightMap.get(stickyRightIndex) + (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
281
230
  }
282
-
283
231
  var justifyContent = col.align === 'right' ? 'flex-end' : col.align === 'center' ? 'center' : 'flex-start';
284
232
  var cell = /*#__PURE__*/React.createElement("th", _extends({
285
233
  key: colIndex
286
234
  }, headerCellProps, {
287
- className: cx(Classes.tableHeaderCell, headerCellProps.className, (_cx = {}, _defineProperty(_cx, Classes.first, colIndex === 0), _defineProperty(_cx, Classes.last, colIndex + colSpan === fullFlatCount), _defineProperty(_cx, Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), _defineProperty(_cx, Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), _defineProperty(_cx, Classes.leaf, wrapped.isLeaf), _cx)),
235
+ className: cx(Classes.tableHeaderCell, headerCellProps.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Classes.first, colIndex === 0), Classes.last, colIndex + colSpan === fullFlatCount), Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), Classes.leaf, wrapped.isLeaf)),
288
236
  colSpan: colSpan,
289
237
  rowSpan: isLeaf ? rowCount - level : undefined,
290
238
  style: _extends(_extends({
@@ -312,13 +260,11 @@ export default function TableHeader(_ref2) {
312
260
  }
313
261
  }
314
262
  });
315
-
316
263
  return /*#__PURE__*/React.createElement("tr", {
317
264
  key: level,
318
- className: cx(Classes.tableHeaderRow, (_cx2 = {}, _defineProperty(_cx2, Classes.first, level === 0), _defineProperty(_cx2, Classes.last, level === rowCount - 1), _cx2))
265
+ className: cx(Classes.tableHeaderRow, _defineProperty(_defineProperty({}, Classes.first, level === 0), Classes.last, level === rowCount - 1))
319
266
  }, headerCells);
320
267
  });
321
-
322
268
  var colgroup = _mapInstanceProperty(_context5 = _flatInstanceProperty(headerRenderInfo)).call(_context5, function (wrapped) {
323
269
  if (wrapped.type === 'blank') {
324
270
  if (wrapped.width > 0) {
@@ -340,6 +286,5 @@ export default function TableHeader(_ref2) {
340
286
  });
341
287
  }
342
288
  });
343
-
344
289
  return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("colgroup", null, colgroup), /*#__PURE__*/React.createElement("thead", null, thead));
345
290
  }