@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,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { TablePipeline } from '../pipeline';
3
3
  export declare const treeMetaSymbol: unique symbol;
4
+ export declare const treeModeOptionsKey = "treeModeOptions";
4
5
  interface ExpandIconProps extends React.DOMAttributes<Element> {
5
6
  expanded: boolean;
6
7
  style: React.CSSProperties;
@@ -4,13 +4,9 @@ import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-meth
4
4
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
5
5
  import _extends from "@babel/runtime-corejs3/helpers/extends";
6
6
  import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
7
-
8
- 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; } } }; }
9
-
10
- function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context2 = Object.prototype.toString.call(o)).call(_context2, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
-
12
- 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; }
13
-
7
+ 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; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { var _context2; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_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; } }
9
+ 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; }
14
10
  import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
15
11
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
16
12
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
@@ -23,74 +19,72 @@ import { internals } from '../../internals';
23
19
  import { isLeafNode as standardIsLeafNode, mergeCellProps } from '../../utils';
24
20
  import { Classes } from '../../base/styles';
25
21
  export var treeMetaSymbol = _Symbol('treeMetaSymbol');
22
+ export var treeModeOptionsKey = 'treeModeOptions';
26
23
  export function treeMode() {
27
24
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
25
  return function treeModeStep(pipeline) {
29
26
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
30
-
31
27
  var stateKey = 'treeMode';
32
28
  var ctx = pipeline.ctx;
33
29
  var primaryKey = pipeline.ensurePrimaryKey('treeMode');
34
30
  var openKeys = (_c = (_b = (_a = opts.openKeys) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultOpenKeys) !== null && _c !== void 0 ? _c : [];
35
31
  var openKeySet = new _Set(openKeys);
36
-
37
32
  var onChangeOpenKeys = function onChangeOpenKeys(nextKeys, key, action) {
38
33
  var _a;
39
-
40
34
  (_a = opts.onChangeOpenKeys) === null || _a === void 0 ? void 0 : _a.call(opts, nextKeys, key, action);
41
35
  pipeline.setStateAtKey(stateKey, nextKeys, {
42
36
  key: key,
43
37
  action: action
44
38
  });
45
39
  };
46
-
47
40
  var toggle = function toggle(rowKey) {
48
41
  var expanded = openKeySet.has(rowKey);
49
-
50
42
  if (expanded) {
51
43
  onChangeOpenKeys(_filterInstanceProperty(openKeys).call(openKeys, function (key) {
52
44
  return key !== rowKey;
53
45
  }), rowKey, 'collapse');
54
46
  } else {
55
47
  var _context;
56
-
57
48
  onChangeOpenKeys(_concatInstanceProperty(_context = []).call(_context, _toConsumableArray(openKeys), [rowKey]), rowKey, 'expand');
58
49
  }
59
50
  };
60
-
61
51
  var isLeafNode = (_d = opts.isLeafNode) !== null && _d !== void 0 ? _d : standardIsLeafNode;
62
52
  var clickArea = (_e = opts.clickArea) !== null && _e !== void 0 ? _e : 'cell';
63
53
  var treeMetaKey = (_f = opts.treeMetaKey) !== null && _f !== void 0 ? _f : treeMetaSymbol;
64
- var stopClickEventPropagation = Boolean(opts.stopClickEventPropagation); // indents
65
-
54
+ var stopClickEventPropagation = Boolean(opts.stopClickEventPropagation);
55
+ // indents
66
56
  var iconWidth = ctx.indents.iconWidth;
67
57
  var iconIndent = (_g = opts.iconIndent) !== null && _g !== void 0 ? _g : ctx.indents.iconIndent;
68
58
  var iconGap = (_h = opts.iconGap) !== null && _h !== void 0 ? _h : ctx.indents.iconGap;
69
59
  var indentSize = (_j = opts.indentSize) !== null && _j !== void 0 ? _j : ctx.indents.indentSize;
60
+ pipeline.setFeatureOptions(treeModeOptionsKey, {
61
+ iconWidth: iconWidth,
62
+ iconIndent: iconIndent,
63
+ iconGap: iconGap,
64
+ indentSize: indentSize,
65
+ treeMetaKey: treeMetaKey
66
+ });
70
67
  var Icon = opts.icon;
71
68
  return pipeline.mapDataSource(processDataSource).mapColumns(processColumns);
72
-
73
69
  function processDataSource(input) {
74
70
  if (pipeline.isSameInputDataSource() && openKeys === pipeline.getFeatureOptions('lastOpenKeys')) {
75
71
  return pipeline.getFeatureOptions('lastTreeMode');
76
72
  }
77
-
78
- pipeline.setFeatureOptions('lastOpenKeys', pipeline.getStateAtKey(stateKey));
73
+ pipeline.setFeatureOptions('lastOpenKeys', pipeline.getStateAtKey(stateKey) || openKeys);
79
74
  var result = [];
80
75
  dfs(input, 0);
81
-
82
76
  function dfs(nodes, depth) {
77
+ var parentNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
83
78
  if (nodes == null) {
84
79
  return;
85
80
  }
86
-
87
81
  var _iterator = _createForOfIteratorHelper(nodes),
88
- _step;
89
-
82
+ _step;
90
83
  try {
91
84
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
92
85
  var node = _step.value;
93
86
  var rowKey = internals.safeGetRowKey(primaryKey, node, -1);
87
+ var parentRowKey = parentNode ? internals.safeGetRowKey(primaryKey, parentNode, -1) : null;
94
88
  var expanded = openKeySet.has(rowKey);
95
89
  var isLeaf = isLeafNode(node, {
96
90
  depth: depth,
@@ -101,12 +95,12 @@ export function treeMode() {
101
95
  depth: depth,
102
96
  isLeaf: isLeaf,
103
97
  expanded: expanded,
104
- rowKey: rowKey
98
+ rowKey: rowKey,
99
+ parentRowKey: parentRowKey
105
100
  };
106
101
  result.push(_extends(_defineProperty({}, treeMetaKey, treeMeta), node));
107
-
108
102
  if (!isLeaf && expanded) {
109
- dfs(node.children, depth + 1);
103
+ dfs(node.children, depth + 1, node);
110
104
  }
111
105
  }
112
106
  } catch (err) {
@@ -115,39 +109,31 @@ export function treeMode() {
115
109
  _iterator.f();
116
110
  }
117
111
  }
118
-
119
112
  pipeline.setFeatureOptions('lastTreeMode', result);
120
113
  return result;
121
114
  }
122
-
123
115
  function processColumns(columns) {
124
116
  if (columns.length === 0) {
125
117
  return columns;
126
118
  }
127
-
128
119
  var expandColIndex = _findIndexInstanceProperty(columns).call(columns, function (_ref) {
129
120
  var code = _ref.code;
130
121
  return code && opts.expandColCode === code;
131
122
  });
132
-
133
123
  expandColIndex = expandColIndex === -1 ? 0 : expandColIndex;
134
124
  var expandCol = columns[expandColIndex];
135
-
136
125
  var render = function render(value, record, recordIndex) {
137
126
  var content = internals.safeRender(expandCol, record, recordIndex);
138
-
139
127
  if (record[treeMetaKey] == null) {
140
128
  // 没有 treeMeta 信息的话,就返回原先的渲染结果
141
129
  return content;
142
130
  }
143
-
144
131
  var _record$treeMetaKey = record[treeMetaKey],
145
- rowKey = _record$treeMetaKey.rowKey,
146
- depth = _record$treeMetaKey.depth,
147
- isLeaf = _record$treeMetaKey.isLeaf,
148
- expanded = _record$treeMetaKey.expanded;
132
+ rowKey = _record$treeMetaKey.rowKey,
133
+ depth = _record$treeMetaKey.depth,
134
+ isLeaf = _record$treeMetaKey.isLeaf,
135
+ expanded = _record$treeMetaKey.expanded;
149
136
  var indent = iconIndent + depth * indentSize;
150
-
151
137
  if (isLeaf) {
152
138
  return /*#__PURE__*/React.createElement(InlineFlexCell, {
153
139
  className: cx('expansion-cell', Classes.leaf)
@@ -157,15 +143,12 @@ export function treeMode() {
157
143
  }
158
144
  }, content));
159
145
  }
160
-
161
146
  var onClick = function onClick(e) {
162
147
  if (stopClickEventPropagation) {
163
148
  e.stopPropagation();
164
149
  }
165
-
166
150
  toggle(rowKey);
167
151
  };
168
-
169
152
  var expandCls = expanded ? Classes.expanded : Classes.collapsed;
170
153
  return /*#__PURE__*/React.createElement(ExpansionCell, {
171
154
  className: cx('expansion-cell', expandCls),
@@ -192,46 +175,44 @@ export function treeMode() {
192
175
  onClick: clickArea === 'icon' ? onClick : undefined
193
176
  }), content);
194
177
  };
195
-
196
178
  var getCellProps = function getCellProps(value, record, rowIndex) {
197
179
  var prevProps = internals.safeGetCellProps(expandCol, record, rowIndex);
198
-
199
- if (record[treeMetaKey] == null) {
180
+ if (record[treeMetaKey] == null || clickArea !== 'cell') {
200
181
  // 没有 treeMeta 信息的话,就返回原先的 cellProps
201
- return prevProps;
182
+ return mergeCellProps(prevProps, {
183
+ className: Classes.tableExtendCell
184
+ });
202
185
  }
203
-
204
186
  var _record$treeMetaKey2 = record[treeMetaKey],
205
- isLeaf = _record$treeMetaKey2.isLeaf,
206
- rowKey = _record$treeMetaKey2.rowKey;
207
-
187
+ isLeaf = _record$treeMetaKey2.isLeaf,
188
+ rowKey = _record$treeMetaKey2.rowKey;
208
189
  if (isLeaf) {
209
- return prevProps;
190
+ return mergeCellProps(prevProps, {
191
+ className: Classes.tableExtendCell
192
+ });
210
193
  }
211
-
212
194
  return mergeCellProps(prevProps, {
213
195
  onClick: function onClick(e) {
214
196
  if (stopClickEventPropagation) {
215
197
  e.stopPropagation();
216
198
  }
217
-
218
199
  toggle(rowKey);
219
200
  },
220
201
  style: {
221
202
  cursor: 'pointer'
222
- }
203
+ },
204
+ className: Classes.tableExtendCell
223
205
  });
224
206
  };
225
-
226
207
  columns[expandColIndex] = _extends(_extends({}, expandCol), {
227
- title: /*#__PURE__*/React.createElement("span", {
208
+ title: (/*#__PURE__*/React.createElement("span", {
228
209
  style: {
229
210
  marginLeft: iconIndent + iconWidth + iconGap,
230
211
  display: 'flex'
231
212
  }
232
- }, internals.safeRenderHeader(expandCol)),
213
+ }, internals.safeRenderHeader(expandCol))),
233
214
  render: render,
234
- getCellProps: clickArea === 'cell' ? getCellProps : expandCol.getCellProps
215
+ getCellProps: getCellProps
235
216
  });
236
217
  return _toConsumableArray(columns);
237
218
  }
@@ -8,32 +8,24 @@ import TreeDataHelper from '../../utils/tree-data-helpers/TreeDataHelper';
8
8
  var STATE_KEY = 'treeSelect';
9
9
  export function treeSelect(opts) {
10
10
  return function treeSelectStep(pipeline) {
11
- var _ref, _context;
12
-
11
+ var _context;
13
12
  var _a, _b, _c, _d, _e, _f, _g, _h;
14
-
15
13
  var Checkbox = pipeline.ctx.components.Checkbox;
16
-
17
14
  if (Checkbox == null) {
18
15
  throw new Error('使用 treeSelect 之前需要通过 pipeline context 设置 components.Checkbox');
19
16
  }
20
-
21
17
  var primaryKey = pipeline.ensurePrimaryKey('treeSelect');
22
-
23
18
  if (typeof primaryKey !== 'string') {
24
19
  throw new Error('treeSelect 仅支持字符串作为 primaryKey');
25
20
  }
26
-
27
21
  var clickArea = (_a = opts.clickArea) !== null && _a !== void 0 ? _a : 'checkbox';
28
22
  var isDisabled = (_b = opts.isDisabled) !== null && _b !== void 0 ? _b : always(false);
29
23
  var isDetached = (_c = opts.idDetached) !== null && _c !== void 0 ? _c : always(false);
30
24
  var value = (_f = (_e = (_d = opts.value) !== null && _d !== void 0 ? _d : pipeline.getStateAtKey(STATE_KEY)) !== null && _e !== void 0 ? _e : opts.defaultValue) !== null && _f !== void 0 ? _f : [];
31
- var tree = opts.rootKey != null ? [(_ref = {}, _defineProperty(_ref, primaryKey, opts.rootKey), _defineProperty(_ref, "children", opts.tree), _ref)] : opts.tree;
32
-
25
+ var tree = opts.rootKey != null ? [_defineProperty(_defineProperty({}, primaryKey, opts.rootKey), "children", opts.tree)] : opts.tree;
33
26
  var getNodeValue = function getNodeValue(node) {
34
27
  return node[primaryKey];
35
28
  };
36
-
37
29
  var treeDataHelper = opts.checkStrictly ? new StrictTreeDataHelper({
38
30
  value: value,
39
31
  getNodeValue: getNodeValue,
@@ -45,15 +37,12 @@ export function treeSelect(opts) {
45
37
  tree: tree,
46
38
  checkedStrategy: (_g = opts.checkedStrategy) !== null && _g !== void 0 ? _g : 'parent'
47
39
  });
48
-
49
40
  var onToggleKey = function onToggleKey(key) {
50
41
  var _a;
51
-
52
42
  var nextValue = treeDataHelper.getValueAfterToggle(key);
53
43
  pipeline.setStateAtKey(STATE_KEY, nextValue);
54
44
  (_a = opts.onChange) === null || _a === void 0 ? void 0 : _a.call(opts, nextValue);
55
45
  };
56
-
57
46
  var makeCheckbox = function makeCheckbox(key, root, row) {
58
47
  return /*#__PURE__*/React.createElement(Checkbox, {
59
48
  checked: treeDataHelper.isChecked(key),
@@ -64,7 +53,6 @@ export function treeSelect(opts) {
64
53
  } : undefined
65
54
  });
66
55
  };
67
-
68
56
  var checkboxColumn = _extends(_extends({
69
57
  name: '',
70
58
  width: 50,
@@ -76,13 +64,10 @@ export function treeSelect(opts) {
76
64
  },
77
65
  getCellProps: function getCellProps(value, row) {
78
66
  var rowKey = row[primaryKey];
79
-
80
67
  if (clickArea !== 'cell') {
81
68
  return;
82
69
  }
83
-
84
70
  var disabled = isDisabled(row);
85
-
86
71
  if (disabled) {
87
72
  return {
88
73
  style: {
@@ -90,7 +75,6 @@ export function treeSelect(opts) {
90
75
  }
91
76
  };
92
77
  }
93
-
94
78
  return {
95
79
  style: {
96
80
  cursor: 'pointer'
@@ -99,29 +83,22 @@ export function treeSelect(opts) {
99
83
  if (opts.stopClickEventPropagation) {
100
84
  e.stopPropagation();
101
85
  }
102
-
103
86
  onToggleKey(rowKey);
104
87
  }
105
88
  };
106
89
  }
107
90
  });
108
-
109
91
  var nextColumns = _sliceInstanceProperty(_context = pipeline.getColumns()).call(_context);
110
-
111
92
  var checkboxPlacement = (_h = opts.checkboxPlacement) !== null && _h !== void 0 ? _h : 'start';
112
-
113
93
  if (checkboxPlacement === 'start') {
114
94
  nextColumns.unshift(checkboxColumn);
115
95
  } else {
116
96
  nextColumns.push(checkboxColumn);
117
97
  }
118
-
119
98
  pipeline.columns(nextColumns);
120
-
121
99
  if (clickArea === 'row') {
122
100
  pipeline.appendRowPropsGetter(function (row) {
123
101
  var disabled = isDisabled(row);
124
-
125
102
  if (!disabled) {
126
103
  return {
127
104
  style: {
@@ -131,14 +108,12 @@ export function treeSelect(opts) {
131
108
  if (opts.stopClickEventPropagation) {
132
109
  e.stopPropagation();
133
110
  }
134
-
135
111
  onToggleKey(row[primaryKey]);
136
112
  }
137
113
  };
138
114
  }
139
115
  });
140
116
  }
141
-
142
117
  if (opts.highlightRowWhenSelected) {
143
118
  pipeline.appendRowPropsGetter(function (row) {
144
119
  if (treeDataHelper.isChecked(row[primaryKey])) {
@@ -148,7 +123,6 @@ export function treeSelect(opts) {
148
123
  }
149
124
  });
150
125
  }
151
-
152
126
  return pipeline;
153
127
  };
154
128
  }
@@ -90,6 +90,9 @@ export declare class TablePipeline {
90
90
  setFeatureOptions(optionKey: string, value: any): void;
91
91
  /** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */
92
92
  getProps(this: TablePipeline): TableProps;
93
+ getFeatureApi(featureName: string): any;
94
+ addFeatureApi(featureName: string): any;
95
+ getLastPipeline(): any;
93
96
  }
94
97
  export declare function useTablePipeline(ctx?: Partial<TablePipelineCtx>): TablePipeline;
95
98
  export {};
@@ -8,6 +8,7 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
8
8
  import { useState, useRef } from 'react';
9
9
  import { mergeCellProps } from '../utils';
10
10
  import { autoFillTableWidth, tableWidthKey } from './features/autoFill';
11
+ import { createFeatureApi } from './features/featureApi/utils';
11
12
  /**
12
13
  * 表格数据处理流水线。TablePipeline 提供了表格数据处理过程中的一些上下方与工具方法,包括……
13
14
  *
@@ -21,16 +22,13 @@ import { autoFillTableWidth, tableWidthKey } from './features/autoFill';
21
22
  *
22
23
  * 4. snapshots,调用 pipeline.snapshot(name) 可以记录当前的状态,后续可以通过 name 来读取保存的状态
23
24
  * */
24
-
25
25
  export var TablePipeline = /*#__PURE__*/function () {
26
26
  function TablePipeline(_ref) {
27
27
  var state = _ref.state,
28
- setState = _ref.setState,
29
- ctx = _ref.ctx,
30
- ref = _ref.ref;
31
-
28
+ setState = _ref.setState,
29
+ ctx = _ref.ctx,
30
+ ref = _ref.ref;
32
31
  _classCallCheck(this, TablePipeline);
33
-
34
32
  this._snapshots = {};
35
33
  this._rowPropsGetters = [];
36
34
  this._tableProps = {};
@@ -41,25 +39,21 @@ export var TablePipeline = /*#__PURE__*/function () {
41
39
  this.state = state;
42
40
  this.setState = setState;
43
41
  this.ref = ref;
44
-
45
42
  _extends(this.ctx, ctx);
46
- } // Generate a pseudo-GUID by concatenating random hexadecimal.
47
-
48
-
49
- _createClass(TablePipeline, [{
43
+ }
44
+ // Generate a pseudo-GUID by concatenating random hexadecimal.
45
+ return _createClass(TablePipeline, [{
50
46
  key: "guid",
51
47
  value: function guid() {
52
48
  function S4() {
53
49
  return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
54
50
  }
55
-
56
51
  return S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4();
57
52
  }
58
53
  }, {
59
54
  key: "appendRowPropsGetter",
60
55
  value: function appendRowPropsGetter(getter) {
61
56
  this._rowPropsGetters.push(getter);
62
-
63
57
  return this;
64
58
  }
65
59
  }, {
@@ -99,11 +93,9 @@ export var TablePipeline = /*#__PURE__*/function () {
99
93
  key: "getStateAtKey",
100
94
  value: function getStateAtKey(stateKey, defaultValue) {
101
95
  var _a;
102
-
103
96
  return (_a = this.state[stateKey]) !== null && _a !== void 0 ? _a : defaultValue;
104
97
  }
105
98
  /** 将 stateKey 对应的状态设置为 partialState */
106
-
107
99
  }, {
108
100
  key: "setStateAtKey",
109
101
  value: function setStateAtKey(stateKey, partialState, extraInfo) {
@@ -112,32 +104,28 @@ export var TablePipeline = /*#__PURE__*/function () {
112
104
  }, stateKey, partialState, extraInfo);
113
105
  }
114
106
  /** 确保 primaryKey 已被设置,并返回 primaryKey */
115
-
116
107
  }, {
117
108
  key: "ensurePrimaryKey",
118
109
  value: function ensurePrimaryKey(hint) {
119
110
  if (this.ctx.primaryKey == null) {
120
111
  throw new Error(hint ? "\u4F7F\u7528 ".concat(hint, " \u4E4B\u524D\u5FC5\u987B\u5148\u8BBE\u7F6E primaryKey") : '必须先设置 primaryKey');
121
112
  }
122
-
123
113
  return this.ctx.primaryKey;
124
114
  }
125
115
  /** 设置流水线的输入数据 */
126
-
127
116
  }, {
128
117
  key: "input",
129
118
  value: function input(_input) {
130
119
  var _context,
131
- _this = this;
132
-
120
+ _this = this;
133
121
  if (this._dataSource != null || this._columns != null) {
134
122
  throw new Error('input 不能调用两次');
135
- } // 在 pipeline 中识别本次更新是否有数据变化
136
-
137
-
123
+ }
124
+ // 在 pipeline 中识别本次更新是否有数据变化
138
125
  this._isSameInputDataSource = _input.dataSource === this.ref.current._lastInputDataSource;
139
126
  this._dataSource = _input.dataSource;
140
127
  this.ref.current._lastInputDataSource = _input.dataSource;
128
+ this.ref.current.lastPipeline = this;
141
129
  this._columns = _mapInstanceProperty(_context = _input.columns).call(_context, function (col) {
142
130
  return _extends(_extends({}, col), {
143
131
  key: _this.guid()
@@ -147,7 +135,6 @@ export var TablePipeline = /*#__PURE__*/function () {
147
135
  return this;
148
136
  }
149
137
  /** 设置 dataSource */
150
-
151
138
  }, {
152
139
  key: "dataSource",
153
140
  value: function dataSource(rows) {
@@ -155,7 +142,6 @@ export var TablePipeline = /*#__PURE__*/function () {
155
142
  return this;
156
143
  }
157
144
  /** 设置 columns */
158
-
159
145
  }, {
160
146
  key: "columns",
161
147
  value: function columns(cols) {
@@ -163,7 +149,6 @@ export var TablePipeline = /*#__PURE__*/function () {
163
149
  return this;
164
150
  }
165
151
  /** 设置主键 */
166
-
167
152
  }, {
168
153
  key: "primaryKey",
169
154
  value: function primaryKey(key) {
@@ -171,7 +156,6 @@ export var TablePipeline = /*#__PURE__*/function () {
171
156
  return this;
172
157
  }
173
158
  /** 设置页脚数据 */
174
-
175
159
  }, {
176
160
  key: "footerDataSource",
177
161
  value: function footerDataSource(rows) {
@@ -179,12 +163,10 @@ export var TablePipeline = /*#__PURE__*/function () {
179
163
  return this;
180
164
  }
181
165
  /** 保存快照 */
182
-
183
166
  }, {
184
167
  key: "snapshot",
185
168
  value: function snapshot(name) {
186
169
  var _context2;
187
-
188
170
  this._snapshots[name] = {
189
171
  dataSource: this._dataSource,
190
172
  columns: this._columns,
@@ -194,7 +176,6 @@ export var TablePipeline = /*#__PURE__*/function () {
194
176
  }
195
177
  /** @deprecated
196
178
  * 应用一个 kd-table Table transform */
197
-
198
179
  }, {
199
180
  key: "useTransform",
200
181
  value: function useTransform(transform) {
@@ -205,63 +186,52 @@ export var TablePipeline = /*#__PURE__*/function () {
205
186
  return this.dataSource(next.dataSource).columns(next.columns);
206
187
  }
207
188
  /** 使用 pipeline 功能拓展 */
208
-
209
189
  }, {
210
190
  key: "use",
211
191
  value: function use(step) {
212
192
  return step(this);
213
193
  }
214
194
  /** 转换 dataSource */
215
-
216
195
  }, {
217
196
  key: "mapDataSource",
218
197
  value: function mapDataSource(mapper) {
219
198
  return this.dataSource(mapper(this.getDataSource()));
220
199
  }
221
200
  /** 转换 columns */
222
-
223
201
  }, {
224
202
  key: "mapColumns",
225
203
  value: function mapColumns(mapper) {
226
204
  return this.columns(mapper(this.getColumns()));
227
205
  }
228
206
  /** 获取featureOptions 内容 */
229
-
230
207
  }, {
231
208
  key: "getFeatureOptions",
232
209
  value: function getFeatureOptions(optionKey) {
233
210
  var _a;
234
-
235
211
  return (_a = this.ref.current.featureOptions) === null || _a === void 0 ? void 0 : _a[optionKey];
236
212
  }
237
213
  /** 设置pipelineOptions 内容 */
238
-
239
214
  }, {
240
215
  key: "setFeatureOptions",
241
216
  value: function setFeatureOptions(optionKey, value) {
242
217
  this.ref.current.featureOptions[optionKey] = value;
243
218
  }
244
219
  /** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */
245
-
246
220
  }, {
247
221
  key: "getProps",
248
222
  value: function getProps() {
249
223
  var _this2 = this;
250
-
251
224
  this.use(autoFillTableWidth());
252
225
  var result = {
253
226
  dataSource: this._dataSource,
254
227
  columns: this._columns
255
228
  };
256
-
257
229
  if (this.ctx.primaryKey) {
258
230
  result.primaryKey = this.ctx.primaryKey;
259
231
  }
260
-
261
232
  if (this._footerDataSource) {
262
233
  result.footerDataSource = this._footerDataSource;
263
234
  }
264
-
265
235
  if (this._rowPropsGetters.length > 0) {
266
236
  result.getRowProps = function (row, rowIndex) {
267
237
  return _this2._rowPropsGetters.reduce(function (res, get) {
@@ -269,32 +239,43 @@ export var TablePipeline = /*#__PURE__*/function () {
269
239
  }, {});
270
240
  };
271
241
  }
272
-
273
242
  result.getTableProps = function () {
274
243
  return _this2._tableProps;
275
244
  };
276
-
277
245
  result.setTableWidth = function (tableWidth) {
278
246
  var preTableWidth = _this2.getStateAtKey(tableWidthKey);
279
-
280
247
  if (preTableWidth !== tableWidth) {
281
248
  tableWidth && _this2.setStateAtKey(tableWidthKey, tableWidth);
282
249
  }
283
250
  };
284
-
285
251
  result.setTableDomHelper = function (domHelper) {
286
252
  _this2.ref.current.domHelper = domHelper;
287
253
  };
288
-
289
254
  result.setRowHeightManager = function (rowHeightManager) {
290
255
  _this2.ref.current.rowHeightManager = rowHeightManager;
291
256
  };
292
-
293
257
  return result;
294
258
  }
259
+ }, {
260
+ key: "getFeatureApi",
261
+ value: function getFeatureApi(featureName) {
262
+ var _a;
263
+ return (_a = this.ref.current.featureApi) === null || _a === void 0 ? void 0 : _a[featureName];
264
+ }
265
+ }, {
266
+ key: "addFeatureApi",
267
+ value: function addFeatureApi(featureName) {
268
+ if (!this.getFeatureApi(featureName)) {
269
+ this.ref.current.featureApi[featureName] = createFeatureApi(featureName, this);
270
+ }
271
+ return this.ref.current.featureApi[featureName];
272
+ }
273
+ }, {
274
+ key: "getLastPipeline",
275
+ value: function getLastPipeline() {
276
+ return this.ref.current.lastPipeline;
277
+ }
295
278
  }]);
296
-
297
- return TablePipeline;
298
279
  }();
299
280
  TablePipeline.defaultIndents = {
300
281
  iconIndent: -8,
@@ -304,12 +285,12 @@ TablePipeline.defaultIndents = {
304
285
  };
305
286
  export function useTablePipeline(ctx) {
306
287
  var _useState = useState({}),
307
- _useState2 = _slicedToArray(_useState, 2),
308
- state = _useState2[0],
309
- setState = _useState2[1];
310
-
288
+ _useState2 = _slicedToArray(_useState, 2),
289
+ state = _useState2[0],
290
+ setState = _useState2[1];
311
291
  var ref = useRef({
312
- featureOptions: {}
292
+ featureOptions: {},
293
+ featureApi: {}
313
294
  });
314
295
  return new TablePipeline({
315
296
  state: state,