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