@hi-ui/schema-editable-table 4.0.0-experimental.1

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 (284) hide show
  1. package/README.md +11 -0
  2. package/lib/cjs/body/index.js +110 -0
  3. package/lib/cjs/body/wrapper.js +132 -0
  4. package/lib/cjs/cell/aggregated.js +76 -0
  5. package/lib/cjs/cell/dependency.js +97 -0
  6. package/lib/cjs/cell/editing.js +89 -0
  7. package/lib/cjs/cell/footer.js +64 -0
  8. package/lib/cjs/cell/header.js +76 -0
  9. package/lib/cjs/cell/index.js +204 -0
  10. package/lib/cjs/const.js +35 -0
  11. package/lib/cjs/container/base.js +39 -0
  12. package/lib/cjs/container/bottom.js +86 -0
  13. package/lib/cjs/container/col-group.js +98 -0
  14. package/lib/cjs/container/column-virtual.js +53 -0
  15. package/lib/cjs/container/ctx.js +32 -0
  16. package/lib/cjs/container/full-virtual.js +61 -0
  17. package/lib/cjs/container/hooks.js +102 -0
  18. package/lib/cjs/container/index.js +69 -0
  19. package/lib/cjs/container/row-virtual.js +50 -0
  20. package/lib/cjs/container/wrapper.js +97 -0
  21. package/lib/cjs/ctx.js +32 -0
  22. package/lib/cjs/features/_overrides/aggregated.js +44 -0
  23. package/lib/cjs/features/_overrides/getter.js +61 -0
  24. package/lib/cjs/features/_overrides/grouping.js +40 -0
  25. package/lib/cjs/features/_overrides/overrides.js +43 -0
  26. package/lib/cjs/features/_overrides/row-selection.js +140 -0
  27. package/lib/cjs/features/async-data/getter.js +150 -0
  28. package/lib/cjs/features/async-data/normal.js +145 -0
  29. package/lib/cjs/features/async-data/use-data-fetcher.js +40 -0
  30. package/lib/cjs/features/async-data/use-reset-data.js +91 -0
  31. package/lib/cjs/features/column-grouping/get-grouping-config.js +27 -0
  32. package/lib/cjs/features/column-grouping/use-opts.js +42 -0
  33. package/lib/cjs/features/column-state.js +57 -0
  34. package/lib/cjs/features/filter/bridge.js +114 -0
  35. package/lib/cjs/features/filter/filter-fns/date.js +34 -0
  36. package/lib/cjs/features/filter/filter-fns/index.js +23 -0
  37. package/lib/cjs/features/filter/get-filter-config.js +61 -0
  38. package/lib/cjs/features/filter/index.js +29 -0
  39. package/lib/cjs/features/filter/use-opts.js +88 -0
  40. package/lib/cjs/features/header-actions/components/column-collapsing.js +74 -0
  41. package/lib/cjs/features/header-actions/get-actions.js +77 -0
  42. package/lib/cjs/features/pagination/component.js +89 -0
  43. package/lib/cjs/features/pagination/use-opts.js +98 -0
  44. package/lib/cjs/features/pagination/use-state.js +44 -0
  45. package/lib/cjs/features/row-controller.js +265 -0
  46. package/lib/cjs/features/row-edit/actions.js +65 -0
  47. package/lib/cjs/features/row-edit/hooks.js +29 -0
  48. package/lib/cjs/features/row-expanding/use-opts.js +39 -0
  49. package/lib/cjs/features/row-expanding/wrapper.js +74 -0
  50. package/lib/cjs/features/row-operation/buttons.js +91 -0
  51. package/lib/cjs/features/row-operation/cell.js +43 -0
  52. package/lib/cjs/features/row-operation/index.js +21 -0
  53. package/lib/cjs/features/row-operation/wrapper.js +114 -0
  54. package/lib/cjs/features/row-selection/cell.js +114 -0
  55. package/lib/cjs/features/row-selection/const.js +16 -0
  56. package/lib/cjs/features/row-selection/hooks/index.js +29 -0
  57. package/lib/cjs/features/row-selection/hooks/use-click-select.js +70 -0
  58. package/lib/cjs/features/row-selection/hooks/use-opts.js +120 -0
  59. package/lib/cjs/features/row-selection/hooks/use-set-selected-row-keys.js +48 -0
  60. package/lib/cjs/features/row-selection/hooks/use-sync-hover-style.js +86 -0
  61. package/lib/cjs/features/row-selection/indicator.js +173 -0
  62. package/lib/cjs/features/row-selection/wrapper.js +119 -0
  63. package/lib/cjs/features/setting-bridge.js +56 -0
  64. package/lib/cjs/features/sorter/bridge.js +65 -0
  65. package/lib/cjs/features/sorter/get-sorter-config.js +46 -0
  66. package/lib/cjs/features/sorter/index.js +29 -0
  67. package/lib/cjs/features/sorter/use-opts.js +81 -0
  68. package/lib/cjs/field-bridge/bridge.js +104 -0
  69. package/lib/cjs/field-bridge/index.js +58 -0
  70. package/lib/cjs/field-bridge/toolbar.js +53 -0
  71. package/lib/cjs/footer/index.js +99 -0
  72. package/lib/cjs/footer/use-first-cell-patch.js +42 -0
  73. package/lib/cjs/header/index.js +134 -0
  74. package/lib/cjs/header/validate.js +69 -0
  75. package/lib/cjs/hooks/use-get-fields-value.js +62 -0
  76. package/lib/cjs/hooks/use-global-actions.js +65 -0
  77. package/lib/cjs/hooks/use-global-static.js +158 -0
  78. package/lib/cjs/hooks/use-initial-render.js +30 -0
  79. package/lib/cjs/hooks/use-inner-ctx.js +105 -0
  80. package/lib/cjs/hooks/use-props.js +108 -0
  81. package/lib/cjs/hooks/use-table-columns.js +76 -0
  82. package/lib/cjs/hooks/use-table-meta.js +57 -0
  83. package/lib/cjs/hooks/use-update.js +57 -0
  84. package/lib/cjs/index.js +66 -0
  85. package/lib/cjs/index.scss.js +18 -0
  86. package/lib/cjs/table.js +263 -0
  87. package/lib/cjs/utils/cls.js +19 -0
  88. package/lib/cjs/utils/fixed.js +53 -0
  89. package/lib/cjs/utils/grouping.js +42 -0
  90. package/lib/cjs/utils/state-merge.js +43 -0
  91. package/lib/esm/body/index.js +98 -0
  92. package/lib/esm/body/wrapper.js +120 -0
  93. package/lib/esm/cell/aggregated.js +64 -0
  94. package/lib/esm/cell/dependency.js +90 -0
  95. package/lib/esm/cell/editing.js +76 -0
  96. package/lib/esm/cell/footer.js +52 -0
  97. package/lib/esm/cell/header.js +63 -0
  98. package/lib/esm/cell/index.js +192 -0
  99. package/lib/esm/const.js +24 -0
  100. package/lib/esm/container/base.js +27 -0
  101. package/lib/esm/container/bottom.js +74 -0
  102. package/lib/esm/container/col-group.js +85 -0
  103. package/lib/esm/container/column-virtual.js +41 -0
  104. package/lib/esm/container/ctx.js +19 -0
  105. package/lib/esm/container/full-virtual.js +49 -0
  106. package/lib/esm/container/hooks.js +95 -0
  107. package/lib/esm/container/index.js +57 -0
  108. package/lib/esm/container/row-virtual.js +38 -0
  109. package/lib/esm/container/wrapper.js +83 -0
  110. package/lib/esm/ctx.js +17 -0
  111. package/lib/esm/features/_overrides/aggregated.js +39 -0
  112. package/lib/esm/features/_overrides/getter.js +56 -0
  113. package/lib/esm/features/_overrides/grouping.js +35 -0
  114. package/lib/esm/features/_overrides/overrides.js +38 -0
  115. package/lib/esm/features/_overrides/row-selection.js +135 -0
  116. package/lib/esm/features/async-data/getter.js +143 -0
  117. package/lib/esm/features/async-data/normal.js +133 -0
  118. package/lib/esm/features/async-data/use-data-fetcher.js +34 -0
  119. package/lib/esm/features/async-data/use-reset-data.js +79 -0
  120. package/lib/esm/features/column-grouping/get-grouping-config.js +22 -0
  121. package/lib/esm/features/column-grouping/use-opts.js +36 -0
  122. package/lib/esm/features/column-state.js +51 -0
  123. package/lib/esm/features/filter/bridge.js +102 -0
  124. package/lib/esm/features/filter/filter-fns/date.js +28 -0
  125. package/lib/esm/features/filter/filter-fns/index.js +18 -0
  126. package/lib/esm/features/filter/get-filter-config.js +56 -0
  127. package/lib/esm/features/filter/index.js +24 -0
  128. package/lib/esm/features/filter/use-opts.js +82 -0
  129. package/lib/esm/features/header-actions/components/column-collapsing.js +62 -0
  130. package/lib/esm/features/header-actions/get-actions.js +65 -0
  131. package/lib/esm/features/pagination/component.js +77 -0
  132. package/lib/esm/features/pagination/use-opts.js +91 -0
  133. package/lib/esm/features/pagination/use-state.js +39 -0
  134. package/lib/esm/features/row-controller.js +253 -0
  135. package/lib/esm/features/row-edit/actions.js +53 -0
  136. package/lib/esm/features/row-edit/hooks.js +24 -0
  137. package/lib/esm/features/row-expanding/use-opts.js +33 -0
  138. package/lib/esm/features/row-expanding/wrapper.js +62 -0
  139. package/lib/esm/features/row-operation/buttons.js +79 -0
  140. package/lib/esm/features/row-operation/cell.js +31 -0
  141. package/lib/esm/features/row-operation/index.js +16 -0
  142. package/lib/esm/features/row-operation/wrapper.js +100 -0
  143. package/lib/esm/features/row-selection/cell.js +101 -0
  144. package/lib/esm/features/row-selection/const.js +11 -0
  145. package/lib/esm/features/row-selection/hooks/index.js +24 -0
  146. package/lib/esm/features/row-selection/hooks/use-click-select.js +65 -0
  147. package/lib/esm/features/row-selection/hooks/use-opts.js +114 -0
  148. package/lib/esm/features/row-selection/hooks/use-set-selected-row-keys.js +43 -0
  149. package/lib/esm/features/row-selection/hooks/use-sync-hover-style.js +81 -0
  150. package/lib/esm/features/row-selection/indicator.js +159 -0
  151. package/lib/esm/features/row-selection/wrapper.js +107 -0
  152. package/lib/esm/features/setting-bridge.js +50 -0
  153. package/lib/esm/features/sorter/bridge.js +53 -0
  154. package/lib/esm/features/sorter/get-sorter-config.js +41 -0
  155. package/lib/esm/features/sorter/index.js +24 -0
  156. package/lib/esm/features/sorter/use-opts.js +75 -0
  157. package/lib/esm/field-bridge/bridge.js +92 -0
  158. package/lib/esm/field-bridge/index.js +44 -0
  159. package/lib/esm/field-bridge/toolbar.js +41 -0
  160. package/lib/esm/footer/index.js +87 -0
  161. package/lib/esm/footer/use-first-cell-patch.js +37 -0
  162. package/lib/esm/header/index.js +121 -0
  163. package/lib/esm/header/validate.js +64 -0
  164. package/lib/esm/hooks/use-get-fields-value.js +56 -0
  165. package/lib/esm/hooks/use-global-actions.js +60 -0
  166. package/lib/esm/hooks/use-global-static.js +152 -0
  167. package/lib/esm/hooks/use-initial-render.js +18 -0
  168. package/lib/esm/hooks/use-inner-ctx.js +100 -0
  169. package/lib/esm/hooks/use-props.js +102 -0
  170. package/lib/esm/hooks/use-table-columns.js +70 -0
  171. package/lib/esm/hooks/use-table-meta.js +51 -0
  172. package/lib/esm/hooks/use-update.js +52 -0
  173. package/lib/esm/index.js +38 -0
  174. package/lib/esm/index.scss.js +13 -0
  175. package/lib/esm/table.js +251 -0
  176. package/lib/esm/utils/cls.js +13 -0
  177. package/lib/esm/utils/fixed.js +48 -0
  178. package/lib/esm/utils/grouping.js +36 -0
  179. package/lib/esm/utils/state-merge.js +37 -0
  180. package/lib/types/body/index.d.ts +14 -0
  181. package/lib/types/body/wrapper.d.ts +18 -0
  182. package/lib/types/cell/aggregated.d.ts +35 -0
  183. package/lib/types/cell/custom.d.ts +19 -0
  184. package/lib/types/cell/dependency.d.ts +47 -0
  185. package/lib/types/cell/editing.d.ts +8 -0
  186. package/lib/types/cell/footer.d.ts +5 -0
  187. package/lib/types/cell/header.d.ts +5 -0
  188. package/lib/types/cell/index.d.ts +6 -0
  189. package/lib/types/const.d.ts +11 -0
  190. package/lib/types/container/base.d.ts +2 -0
  191. package/lib/types/container/bottom.d.ts +20 -0
  192. package/lib/types/container/col-group.d.ts +11 -0
  193. package/lib/types/container/column-virtual.d.ts +7 -0
  194. package/lib/types/container/ctx.d.ts +23 -0
  195. package/lib/types/container/full-virtual.d.ts +8 -0
  196. package/lib/types/container/hooks.d.ts +13 -0
  197. package/lib/types/container/index.d.ts +17 -0
  198. package/lib/types/container/row-virtual.d.ts +7 -0
  199. package/lib/types/container/type.d.ts +17 -0
  200. package/lib/types/container/wrapper.d.ts +12 -0
  201. package/lib/types/ctx.d.ts +41 -0
  202. package/lib/types/features/_overrides/aggregated.d.ts +2 -0
  203. package/lib/types/features/_overrides/getter.d.ts +2 -0
  204. package/lib/types/features/_overrides/grouping.d.ts +7 -0
  205. package/lib/types/features/_overrides/index.d.ts +5 -0
  206. package/lib/types/features/_overrides/overrides.d.ts +2 -0
  207. package/lib/types/features/_overrides/row-selection.d.ts +2 -0
  208. package/lib/types/features/async-data/getter.d.ts +9 -0
  209. package/lib/types/features/async-data/group.d.ts +1 -0
  210. package/lib/types/features/async-data/index.d.ts +6 -0
  211. package/lib/types/features/async-data/normal.d.ts +48 -0
  212. package/lib/types/features/async-data/type.d.ts +22 -0
  213. package/lib/types/features/async-data/use-data-fetcher.d.ts +22 -0
  214. package/lib/types/features/async-data/use-reset-data.d.ts +14 -0
  215. package/lib/types/features/column-grouping/get-grouping-config.d.ts +2 -0
  216. package/lib/types/features/column-grouping/index.d.ts +3 -0
  217. package/lib/types/features/column-grouping/use-opts.d.ts +12 -0
  218. package/lib/types/features/column-state.d.ts +15 -0
  219. package/lib/types/features/filter/bridge.d.ts +9 -0
  220. package/lib/types/features/filter/filter-fns/date.d.ts +6 -0
  221. package/lib/types/features/filter/filter-fns/index.d.ts +6 -0
  222. package/lib/types/features/filter/get-filter-config.d.ts +4 -0
  223. package/lib/types/features/filter/index.d.ts +8 -0
  224. package/lib/types/features/filter/use-opts.d.ts +62 -0
  225. package/lib/types/features/header-actions/components/column-collapsing.d.ts +4 -0
  226. package/lib/types/features/header-actions/get-actions.d.ts +13 -0
  227. package/lib/types/features/header-actions/index.d.ts +3 -0
  228. package/lib/types/features/header-actions/type.d.ts +20 -0
  229. package/lib/types/features/pagination/component.d.ts +15 -0
  230. package/lib/types/features/pagination/index.d.ts +4 -0
  231. package/lib/types/features/pagination/use-opts.d.ts +14 -0
  232. package/lib/types/features/pagination/use-state.d.ts +11 -0
  233. package/lib/types/features/row-controller.d.ts +101 -0
  234. package/lib/types/features/row-edit/actions.d.ts +12 -0
  235. package/lib/types/features/row-edit/hooks.d.ts +1 -0
  236. package/lib/types/features/row-edit/index.d.ts +2 -0
  237. package/lib/types/features/row-expanding/index.d.ts +3 -0
  238. package/lib/types/features/row-expanding/use-opts.d.ts +12 -0
  239. package/lib/types/features/row-expanding/wrapper.d.ts +11 -0
  240. package/lib/types/features/row-operation/buttons.d.ts +41 -0
  241. package/lib/types/features/row-operation/cell.d.ts +6 -0
  242. package/lib/types/features/row-operation/index.d.ts +18 -0
  243. package/lib/types/features/row-operation/wrapper.d.ts +3 -0
  244. package/lib/types/features/row-selection/cell.d.ts +62 -0
  245. package/lib/types/features/row-selection/const.d.ts +1 -0
  246. package/lib/types/features/row-selection/hooks/index.d.ts +6 -0
  247. package/lib/types/features/row-selection/hooks/use-click-select.d.ts +1 -0
  248. package/lib/types/features/row-selection/hooks/use-opts.d.ts +15 -0
  249. package/lib/types/features/row-selection/hooks/use-set-selected-row-keys.d.ts +9 -0
  250. package/lib/types/features/row-selection/hooks/use-sync-hover-style.d.ts +5 -0
  251. package/lib/types/features/row-selection/index.d.ts +7 -0
  252. package/lib/types/features/row-selection/indicator.d.ts +8 -0
  253. package/lib/types/features/row-selection/wrapper.d.ts +9 -0
  254. package/lib/types/features/setting-bridge.d.ts +14 -0
  255. package/lib/types/features/sorter/bridge.d.ts +8 -0
  256. package/lib/types/features/sorter/get-sorter-config.d.ts +7 -0
  257. package/lib/types/features/sorter/index.d.ts +8 -0
  258. package/lib/types/features/sorter/use-opts.d.ts +71 -0
  259. package/lib/types/field-bridge/bridge.d.ts +18 -0
  260. package/lib/types/field-bridge/index.d.ts +11 -0
  261. package/lib/types/field-bridge/toolbar.d.ts +9 -0
  262. package/lib/types/footer/index.d.ts +6 -0
  263. package/lib/types/footer/use-first-cell-patch.d.ts +1 -0
  264. package/lib/types/header/index.d.ts +17 -0
  265. package/lib/types/header/validate.d.ts +10 -0
  266. package/lib/types/hooks/use-get-fields-value.d.ts +14 -0
  267. package/lib/types/hooks/use-global-actions.d.ts +24 -0
  268. package/lib/types/hooks/use-global-static.d.ts +83 -0
  269. package/lib/types/hooks/use-initial-render.d.ts +1 -0
  270. package/lib/types/hooks/use-inner-ctx.d.ts +12 -0
  271. package/lib/types/hooks/use-props.d.ts +109 -0
  272. package/lib/types/hooks/use-table-columns.d.ts +11 -0
  273. package/lib/types/hooks/use-table-meta.d.ts +15 -0
  274. package/lib/types/hooks/use-update.d.ts +11 -0
  275. package/lib/types/index.d.ts +32 -0
  276. package/lib/types/table.d.ts +152 -0
  277. package/lib/types/utils/cls.d.ts +4 -0
  278. package/lib/types/utils/fixed.d.ts +11 -0
  279. package/lib/types/utils/grouping.d.ts +6 -0
  280. package/lib/types/utils/index.d.ts +5 -0
  281. package/lib/types/utils/meta.d.ts +8 -0
  282. package/lib/types/utils/state-merge.d.ts +14 -0
  283. package/package.json +90 -0
  284. package/type.d.ts +143 -0
@@ -0,0 +1,251 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-editable-table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-editable-table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import React, { useRef, useMemo } from 'react';
11
+ import { useReactTable, getCoreRowModel } from '@tanstack/react-table';
12
+ import { useSetState } from 'ahooks';
13
+ import { useSubscription } from '@hi-ui/use-subscription';
14
+ import { EditableControlProvider } from '@hi-ui/schema-fields';
15
+ import { EditableSchemaTableCtx } from './ctx.js';
16
+ import { clsPrefix, cls } from './utils/cls.js';
17
+ import { TableContainer } from './container/index.js';
18
+ import Header from './header/index.js';
19
+ import Body from './body/index.js';
20
+ import Footer from './footer/index.js';
21
+ import DftCell from './cell/index.js';
22
+ import { usePropsRef } from './hooks/use-props.js';
23
+ import { useTableColumns } from './hooks/use-table-columns.js';
24
+ import { useTableUpdate } from './hooks/use-update.js';
25
+ import { useTableInnerCtx } from './hooks/use-inner-ctx.js';
26
+ import { useGlobalStatic } from './hooks/use-global-static.js';
27
+ import { useGlobalStaticActions } from './hooks/use-global-actions.js';
28
+ import { useTableMeta } from './hooks/use-table-meta.js';
29
+ import { CustomAggregatedFeature } from './features/_overrides/aggregated.js';
30
+ import { CustomGetterFeature } from './features/_overrides/getter.js';
31
+ import { OverridesFeature } from './features/_overrides/overrides.js';
32
+ import { CustomRowSelectionFeature } from './features/_overrides/row-selection.js';
33
+ import { CustomGroupingFeature } from './features/_overrides/grouping.js';
34
+ import { AsyncDataGetter } from './features/async-data/getter.js';
35
+ import { useGetFieldsValue, useGetGroupedValues } from './hooks/use-get-fields-value.js';
36
+ import { useInitialColumnState } from './features/column-state.js';
37
+ import { TableRowController } from './features/row-controller.js';
38
+ import { usePaginationOpts } from './features/pagination/use-opts.js';
39
+ import 'lodash-es';
40
+ import '@hi-ui/checkbox';
41
+ import '@hi-ui/radio';
42
+ import '@hi-ui/schema-utils';
43
+ import { useRowSelectionState } from './features/row-selection/hooks/index.js';
44
+ import '@hi-ui/space';
45
+ import '@hi-ui/switch';
46
+ import '@hi-ui/pagination';
47
+ import { usePaginationState } from './features/pagination/use-state.js';
48
+ import { useFilterState } from './features/filter/index.js';
49
+ import { useFilterOpts } from './features/filter/use-opts.js';
50
+ import { useSorterState } from './features/sorter/index.js';
51
+ import { useSorterOpts } from './features/sorter/use-opts.js';
52
+ import '@hi-ui/icons';
53
+ import { useRowExpandedOpts } from './features/row-expanding/use-opts.js';
54
+ import { useRowGroupedOpts } from './features/column-grouping/use-opts.js';
55
+ import './index.scss.js';
56
+ import { useRowSelectionOpts } from './features/row-selection/hooks/use-opts.js';
57
+ import HeaderCell from './cell/header.js';
58
+ import FooterCell from './cell/footer.js';
59
+ import AggregatedCell from './cell/aggregated.js';
60
+ import { BottomRender } from './container/bottom.js';
61
+
62
+ // @doc-comment-end code-block
63
+ function EditableSchemaTable(props) {
64
+ var _a, _b, _c, _d;
65
+ // propsRef 存在的意义是给内部组件一个统一的 props 引用
66
+ // 避免 props 变化导致的内部 memo 值引用变化
67
+ var _usePropsRef = usePropsRef(props),
68
+ propsRef = _usePropsRef.propsRef,
69
+ staticOptsRef = _usePropsRef.staticOptsRef;
70
+ // innerRef 存在的意义在于简化发生循环依赖时内部的实例对象的引用方式
71
+ // 例如 useReactTable 需要 useRowSelectionOpts 来初始化行选择功能
72
+ // 而 useRowSelectionOpts 又需要用到 table 实例,如果直接引用,则会报【声明之前已使用的块范围变量】的错误
73
+ var innerRef = useRef({});
74
+ // 核心数据订阅
75
+ var tableValue = useSubscription((_b = (_a = props.value) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : []);
76
+ // 订阅表格级别的数据变化,自动触发重渲染
77
+ var _useTableUpdate = useTableUpdate(tableValue),
78
+ rerender = _useTableUpdate.rerender,
79
+ forceRerenderFlag = _useTableUpdate.forceRerenderFlag;
80
+ // 表格列配置
81
+ var columns = useTableColumns({
82
+ propsRef: propsRef
83
+ });
84
+ // 初始化列状态
85
+ var initialState = useInitialColumnState(props);
86
+ // 分页配置
87
+ var _usePaginationState = usePaginationState({
88
+ propsRef: propsRef,
89
+ subscription: tableValue
90
+ }),
91
+ paginationState = _usePaginationState.paginationState;
92
+ var paginationOpts = usePaginationOpts({
93
+ innerRef: innerRef,
94
+ staticOptsRef: staticOptsRef
95
+ });
96
+ // 筛选配置
97
+ var _useFilterState = useFilterState(),
98
+ filterState = _useFilterState.filterState;
99
+ var filterOpts = useFilterOpts({
100
+ innerRef: innerRef,
101
+ staticOptsRef: staticOptsRef
102
+ });
103
+ // 排序配置
104
+ var _useSorterState = useSorterState(),
105
+ sorterState = _useSorterState.sorterState;
106
+ var sorterOpts = useSorterOpts({
107
+ innerRef: innerRef,
108
+ staticOptsRef: staticOptsRef,
109
+ propsRef: propsRef
110
+ });
111
+ // 行展开配置
112
+ var rowExpandedOpts = useRowExpandedOpts({
113
+ staticOptsRef: staticOptsRef
114
+ });
115
+ // 列分组配置
116
+ var rowGroupedOpts = useRowGroupedOpts({
117
+ staticOptsRef: staticOptsRef
118
+ });
119
+ // 表格元数据/操作
120
+ var tableMeta = useTableMeta(tableValue, {
121
+ fieldMap: props.fieldMap,
122
+ onValuesChange: props.onValuesChange,
123
+ innerRef: innerRef
124
+ });
125
+ // 行选择功能
126
+ var _useRowSelectionState = useRowSelectionState(),
127
+ rowSelectionState = _useRowSelectionState.rowSelectionState;
128
+ var rowSelectionOpts = useRowSelectionOpts({
129
+ rowSelection: propsRef.current.rowSelection,
130
+ innerRef: innerRef
131
+ });
132
+ // 动态的 table 选项,会由内部组件主动调用
133
+ var _useSetState = useSetState({}),
134
+ dynamicOpts = _useSetState[0],
135
+ setDynamicOpts = _useSetState[1];
136
+ // 核心表格实例
137
+ var table = useReactTable(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
138
+ _features: [OverridesFeature, CustomGetterFeature, CustomRowSelectionFeature, CustomAggregatedFeature, CustomGroupingFeature].concat(propsRef.current.features || []),
139
+ data: tableValue.getValue(),
140
+ columns: columns,
141
+ defaultColumn: Object.assign({
142
+ cell: DftCell,
143
+ header: HeaderCell,
144
+ footer: FooterCell,
145
+ aggregatedCell: (_d = (_c = props.customCell) === null || _c === void 0 ? void 0 : _c.aggregatedCell) !== null && _d !== void 0 ? _d : AggregatedCell
146
+ }, propsRef.current.defaultColumn),
147
+ getCoreRowModel: getCoreRowModel(),
148
+ getRowId: props.rowKey ? function (row) {
149
+ return row[props.rowKey];
150
+ } : undefined,
151
+ getSubRows: function getSubRows(row) {
152
+ return row[propsRef.current.subRowKey];
153
+ }
154
+ }, propsRef.current.debug), {
155
+ meta: tableMeta
156
+ }), rowSelectionOpts), paginationOpts), filterOpts), sorterOpts), rowExpandedOpts), rowGroupedOpts), {
157
+ initialState: Object.assign(Object.assign({}, initialState), {
158
+ pagination: Object.assign(Object.assign({}, paginationState.getValue()), paginationOpts.initialState ? paginationOpts.initialState.pagination : {})
159
+ })
160
+ }), dynamicOpts), props.customEngineOpts));
161
+ // 生成全局静态配置
162
+ var _s_ = tableValue; // 没啥用,就是太长了取个别名,防止换行
163
+ var globalStaticRef = useGlobalStatic({
164
+ table: table,
165
+ subscription: _s_,
166
+ propsRef: propsRef,
167
+ staticOptsRef: staticOptsRef
168
+ });
169
+ // 生成全局静态函数
170
+ var globalActionsRef = useGlobalStaticActions({
171
+ innerRef: innerRef
172
+ });
173
+ // 虚拟滚动需要知道可滚动的容器元素
174
+ var tableContainerRef = React.useRef(null);
175
+ // 行操作控制器
176
+ var enableRowEdit = globalStaticRef.current.enableRowEdit;
177
+ var rowActions = useMemo(function () {
178
+ return new TableRowController(tableValue, {
179
+ rowEdit: enableRowEdit,
180
+ propsRef: propsRef
181
+ });
182
+ }, [tableValue, enableRowEdit, propsRef]);
183
+ // 获取所有可编辑字段的值
184
+ var getFieldsValue = useGetFieldsValue({
185
+ innerRef: innerRef
186
+ });
187
+ // 获取分组后的所有可编辑字段的值和只读字段的值
188
+ var getGroupedValues = useGetGroupedValues({
189
+ innerRef: innerRef
190
+ });
191
+ // 组装内部上下文
192
+ var _useTableInnerCtx = useTableInnerCtx({
193
+ table: table,
194
+ setDynamicOpts: setDynamicOpts,
195
+ subscription: tableValue,
196
+ tableContainerRef: tableContainerRef,
197
+ rowActions: rowActions,
198
+ rerender: rerender,
199
+ rowSelectionState: rowSelectionState,
200
+ paginationState: paginationState,
201
+ filterState: filterState,
202
+ sorterState: sorterState,
203
+ propsRef: propsRef,
204
+ globalStaticRef: globalStaticRef,
205
+ globalActionsRef: globalActionsRef,
206
+ getFieldsValue: getFieldsValue,
207
+ getGroupedValues: getGroupedValues
208
+ }),
209
+ ctxValue = _useTableInnerCtx.ctxValue,
210
+ exposeCtxValue = _useTableInnerCtx.exposeCtxValue;
211
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
212
+ // @ts-ignore 仅允许此处赋值
213
+ innerRef.current = ctxValue;
214
+ React.useImperativeHandle(props.innerCtxRef, exposeCtxValue);
215
+ // 表头和表尾的 fixed 配置
216
+ var stickyOpts = propsRef.current.sticky;
217
+ var TableCtx = EditableSchemaTableCtx;
218
+ return /*#__PURE__*/React.createElement(TableCtx.Provider, {
219
+ value: ctxValue
220
+ }, /*#__PURE__*/React.createElement(EditableControlProvider, {
221
+ readonly: props.readonly || enableRowEdit
222
+ }, /*#__PURE__*/React.createElement("div", {
223
+ key: props.enableForceRerender ? forceRerenderFlag : undefined,
224
+ className: clsPrefix,
225
+ "data-is-empty": globalStaticRef.current.isEmpty,
226
+ "data-is-bordered": !!props.bordered,
227
+ "data-has-nest-header": globalStaticRef.current.hasNestHeader,
228
+ "data-has-sticky-footer": globalStaticRef.current.hasStickyFooter,
229
+ "data-has-selection": !!props.rowSelection,
230
+ "data-has-operation": !!props.rowOperation,
231
+ "data-has-left-fixed": globalStaticRef.current.hasLeftFixed,
232
+ "data-has-right-fixed": globalStaticRef.current.hasRightFixed,
233
+ "data-has-pagination": globalStaticRef.current.enablePagination
234
+ }, /*#__PURE__*/React.createElement("div", {
235
+ className: cls('container'),
236
+ ref: tableContainerRef
237
+ }, /*#__PURE__*/React.createElement(TableContainer, {
238
+ virtualize: propsRef.current.virtualize
239
+ }, /*#__PURE__*/React.createElement(TableContainer.Header, {
240
+ sticky: stickyOpts === null || stickyOpts === void 0 ? void 0 : stickyOpts.header,
241
+ stickyOffset: stickyOpts === null || stickyOpts === void 0 ? void 0 : stickyOpts.headerTop
242
+ }, /*#__PURE__*/React.createElement(Header, null)), /*#__PURE__*/React.createElement(TableContainer.Body, null, /*#__PURE__*/React.createElement(Body, {
243
+ getRowStyle: props.getRowStyle
244
+ })), globalStaticRef.current.showFooter ? ( /*#__PURE__*/React.createElement(TableContainer.Footer, {
245
+ sticky: stickyOpts === null || stickyOpts === void 0 ? void 0 : stickyOpts.footer,
246
+ stickyOffset: stickyOpts === null || stickyOpts === void 0 ? void 0 : stickyOpts.footerBottom
247
+ }, /*#__PURE__*/React.createElement(Footer, null))) : null)), /*#__PURE__*/React.createElement(BottomRender, Object.assign({
248
+ key: "bottom-container"
249
+ }, propsRef.current.bottom))), globalStaticRef.current.enableAsyncData ? /*#__PURE__*/React.createElement(AsyncDataGetter, null) : null));
250
+ }
251
+ export { EditableSchemaTable };
@@ -0,0 +1,13 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-editable-table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-editable-table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import { createPrefixClassnames } from '@hi-ui/schema-utils';
11
+ var clsPrefix = 'editable-schema-table';
12
+ var cls = createPrefixClassnames(clsPrefix);
13
+ export { cls, clsPrefix };
@@ -0,0 +1,48 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-editable-table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-editable-table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import { ROW_SELECTION_COL_WIDTH } from '../const.js';
11
+ function getFixedStyles(column, opts) {
12
+ var isPinned = column.getIsPinned();
13
+ if (!isPinned) return {};
14
+ var style = {};
15
+ if (isPinned === 'left') {
16
+ var className = ['fixed-left'];
17
+ // 如果开启行选择,则需要增加偏移量,+1是边框的偏移
18
+ var enableRowSelection = opts.globalStaticRef.current.enableRowSelection;
19
+ var offset = enableRowSelection ? ROW_SELECTION_COL_WIDTH : 0;
20
+ style.left = column.getStart('left') + offset;
21
+ // 增加阴影
22
+ var isLastLeft = column.getIsLastColumn('left');
23
+ if (isLastLeft) className.push('last-fixed-left');
24
+ return {
25
+ className: className,
26
+ style: style
27
+ };
28
+ }
29
+ if (isPinned === 'right') {
30
+ var _className = ['fixed-right'];
31
+ style.right = column.getAfter('right');
32
+ // 如果开启行操作,则需要增加偏移量
33
+ var _opts$globalStaticRef = opts.globalStaticRef.current,
34
+ enableRowOperation = _opts$globalStaticRef.enableRowOperation,
35
+ operationColWidth = _opts$globalStaticRef.operationColWidth;
36
+ var _offset = enableRowOperation ? operationColWidth : 0;
37
+ style.right = column.getAfter('right') + _offset;
38
+ // 增加阴影
39
+ var isFirstRight = column.getIsFirstColumn('right');
40
+ if (isFirstRight) _className.push('first-fixed-right');
41
+ return {
42
+ className: _className,
43
+ style: style
44
+ };
45
+ }
46
+ return {};
47
+ }
48
+ export { getFixedStyles };
@@ -0,0 +1,36 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-editable-table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-editable-table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ import { isNil } from 'lodash-es';
11
+
12
+ /**
13
+ * 检查值是否为空值(包括null、undefined、'null'、'undefined'和空字符串)
14
+ */
15
+ function isEmptyValue(value) {
16
+ if (isNil(value)) return true;
17
+ if (value === 'null' || value === 'undefined' || value === '') return true;
18
+ return false;
19
+ }
20
+ // 参考了内置的 flattenBy 方法
21
+ // https://github.com/TanStack/table/blob/66fbe3a74b129e700e4667d1d5e1b29dd0a7b723/packages/table-core/src/utils.ts#L115-L134
22
+ function getGroupedLeafRows(rows) {
23
+ var flat = [];
24
+ var recurse = function recurse(subRows) {
25
+ subRows.forEach(function (row) {
26
+ if (!row.getIsGrouped()) flat.push(row);
27
+ var children = row.subRows;
28
+ if (children === null || children === void 0 ? void 0 : children.length) {
29
+ recurse(children);
30
+ }
31
+ });
32
+ };
33
+ recurse(rows);
34
+ return flat;
35
+ }
36
+ export { getGroupedLeafRows, isEmptyValue };
@@ -0,0 +1,37 @@
1
+ /** @LICENSE
2
+ * @hi-ui/schema-editable-table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/schema/schema-editable-table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ /**
11
+ * 确保状态字段完整性,为被清空的字段添加默认值
12
+ * @param state 变化前的状态
13
+ * @param newState 变化后的状态
14
+ * @param stateKey 要设置默认值的字段名
15
+ * @param defaultValue 字段被清空时的默认值
16
+ * @returns 处理后的状态
17
+ */
18
+ function ensureStateFields(state, newState, stateKey, defaultValue) {
19
+ // 如果没有前一个状态,直接返回新状态
20
+ if (!state || state.length === 0) return newState;
21
+ // 创建新状态的 id 集合
22
+ var newStateIds = new Set(newState.map(function (item) {
23
+ return item.id;
24
+ }));
25
+ // 找出被删除的字段,为它们添加默认值
26
+ var missingItems = state.filter(function (item) {
27
+ return !newStateIds.has(item.id);
28
+ }).map(function (item) {
29
+ var _ref;
30
+ return _ref = {
31
+ id: item.id
32
+ }, _ref[stateKey] = defaultValue, _ref;
33
+ });
34
+ // 合并新状态和缺失字段的默认值
35
+ return [].concat(newState, missingItems);
36
+ }
37
+ export { ensureStateFields };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { Row } from '@tanstack/react-table';
3
+ type GetRowStyleCtxType<TData> = {
4
+ row: Row<TData>;
5
+ };
6
+ export type EditTableBodyProps<TData> = {
7
+ className?: string;
8
+ getRowStyle?: (row: TData, ctx: GetRowStyleCtxType<TData>) => React.CSSProperties;
9
+ };
10
+ export type OnBodyRowMountedFn<TData> = (ctx: {
11
+ row: Row<TData>;
12
+ }) => void;
13
+ declare const _default: <TData>(props: EditTableBodyProps<TData>) => React.ReactElement;
14
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { Cell, Row } from '@tanstack/react-table';
3
+ type BodyCellWrapperProps = {
4
+ cell: Cell<AnyType, unknown>;
5
+ fixed?: boolean;
6
+ };
7
+ type BodyCellWrapperDynamicAttrsCtxType = {
8
+ cell: Cell<AnyType, unknown>;
9
+ row: Row<AnyType>;
10
+ rowData: AnyObject;
11
+ renderCase: BodyCellRenderCaseType;
12
+ };
13
+ type BodyCellWrapperDynamicAttrsType = React.TdHTMLAttributes<HTMLTableCellElement>;
14
+ export type GetBodyCellWrapperDynamicAttrsFnType = (ctx: BodyCellWrapperDynamicAttrsCtxType) => BodyCellWrapperDynamicAttrsType;
15
+ export declare function BodyCellWrapper(props: BodyCellWrapperProps): JSX.Element;
16
+ export type BodyCellRenderCaseType = ReturnType<typeof useRenderCase>;
17
+ declare function useRenderCase(): "grouping" | "expanding" | "basic";
18
+ export {};
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import type { CellContext } from '@tanstack/react-table';
3
+ export type AggregatedCellProps<TData extends AnyObject> = CellContext<TData, unknown>;
4
+ export type AggregatedCellRenderCtxType<TData extends AnyObject> = AggregatedCellProps<TData> & {
5
+ /**
6
+ * 聚合值
7
+ * - 指聚合列的当前行值
8
+ */
9
+ groupingValue: unknown;
10
+ /** 聚合列的ID */
11
+ groupingColumnId: string;
12
+ /**
13
+ * 聚合列经聚合函数计算后聚合值
14
+ * - 例如聚合函数为 count,则聚合值为聚合列的行数
15
+ */
16
+ groupingColumnAggregatedValue: unknown;
17
+ /**
18
+ * 经处理后的聚合值
19
+ * - 会在为空值时自动展示为【空值】
20
+ */
21
+ displayValue: unknown;
22
+ /**
23
+ * 标签颜色
24
+ * - 内部随机生成的标签颜色样式配置
25
+ * - 会在单次挂载中保持稳定
26
+ */
27
+ color: {
28
+ back: string;
29
+ fore: string;
30
+ };
31
+ /** 默认的内部结构元素 */
32
+ dftEl: React.ReactElement;
33
+ };
34
+ declare const _default: <TData extends AnyObject>(props: AggregatedCellProps<TData>) => React.ReactElement;
35
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { AggregatedCellProps, AggregatedCellRenderCtxType } from './aggregated';
3
+ export type CustomCellType<TData extends AnyObject> = {
4
+ /**
5
+ * 聚合单元格【组件】
6
+ * - 获得全量的渲染能力,内部全部的聚合单元格均会使用此组件
7
+ * - 但使用难度较大,需自行实现内部的渲染判断逻辑
8
+ * - 若仅需自定义已知聚合单元格的渲染逻辑,请使用 renderAggregatedCell
9
+ */
10
+ aggregatedCell?: (props: AggregatedCellProps<TData>) => React.ReactElement | null;
11
+ /**
12
+ * 聚合单元格【渲染函数】
13
+ * - 用于自定义已知聚合单元格的渲染逻辑
14
+ * - 已知是指开启聚合后,页面已经展示的【有效聚合单元格】
15
+ * - 无需再判断单元格是否已经是聚合单元格,可以仅关心所需的渲染逻辑
16
+ * - 若需获取全量的渲染能力,请使用 aggregatedCell
17
+ */
18
+ renderAggregatedCell?: (ctx: AggregatedCellRenderCtxType<TData>) => React.ReactElement | null;
19
+ };
@@ -0,0 +1,47 @@
1
+ import type { FieldConfigType } from '@hi-ui/schema-core';
2
+ import type { Subscription } from '@hi-ui/use-subscription';
3
+ import type { EditableCaseProps } from '@hi-ui/schema-fields';
4
+ type ExecCellDepsCtxType<TData extends AnyObject = AnyObject> = {
5
+ /**
6
+ * 可编辑场景的组件属性
7
+ * - 所有的操作都围绕着它展开
8
+ */
9
+ fieldProps: EditableCaseProps;
10
+ /** 当前行数据 */
11
+ rowData: TData;
12
+ /** 当前行索引 */
13
+ rowIndex: number;
14
+ /** 当前字段的数据键 */
15
+ dataKey: string;
16
+ /** 变更的依赖值映射(按行索引) */
17
+ changedDepValues: Record<number, Partial<TData>>;
18
+ /** 变更的字段名列表 */
19
+ changedFieldNames: string[] | undefined;
20
+ /** 表格订阅对象 */
21
+ tableValue: Subscription<AnyObject[]>;
22
+ };
23
+ export declare function execCellDepsProcess<TData extends AnyObject>(ctx: ExecCellDepsCtxType<TData>): void;
24
+ /**
25
+ * Props依赖处理的上下文类型
26
+ */
27
+ export interface PropsDependencyContext<TData extends AnyObject = AnyObject> {
28
+ /** 字段配置 */
29
+ field: FieldConfigType<TData>;
30
+ /** 依赖值 */
31
+ depValues: Partial<TData>;
32
+ /** 所有值 */
33
+ allValues: TData;
34
+ /** 变更的依赖键列表 */
35
+ changedDepKeys: string[];
36
+ /** 表单引用 */
37
+ formRef: AnyType;
38
+ }
39
+ /**
40
+ * 处理表格单元格中的值依赖逻辑
41
+ */
42
+ export declare function execCellValueDepFn<TData extends AnyObject>(ctx: ExecCellDepsCtxType<TData>): void;
43
+ /**
44
+ * 处理表格单元格中的 Props 依赖逻辑
45
+ */
46
+ export declare function execCellPropsDepFn<TData extends AnyObject>(ctx: ExecCellDepsCtxType<TData>): void;
47
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { CellContext } from '@tanstack/react-table';
2
+ export declare function useEditingCellFormBinding<TData extends AnyObject>(props: CellContext<TData, unknown>): {
3
+ value: unknown;
4
+ onChange: (eventOrValue: unknown) => void;
5
+ onBlur: () => void;
6
+ invalid: undefined;
7
+ };
8
+ export declare function normalizeValueFromChange(eventOrValue: unknown): any;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { HeaderContext } from '@tanstack/react-table';
3
+ export type FooterCellProps<TData extends AnyObject = AnyObject> = Pick<HeaderContext<TData, unknown>, 'column' | 'table'>;
4
+ declare const _default: <TData extends AnyObject>(props: FooterCellProps<TData>) => React.ReactElement;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { HeaderContext } from '@tanstack/react-table';
3
+ type HeaderCellProps<TData extends AnyObject> = Pick<HeaderContext<TData, unknown>, 'column' | 'table'>;
4
+ declare const _default: <TData extends AnyObject>(props: HeaderCellProps<TData>) => React.ReactElement;
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import type { CellContext } from '@tanstack/react-table';
2
+ export default function DftCell<TData extends AnyObject>(props: CellContext<TData, unknown>): JSX.Element;
3
+ export { default as HeaderCell } from './header';
4
+ export { default as FooterCell } from './footer';
5
+ export { default as AggregatedCell } from './aggregated';
6
+ export { type CustomCellType } from './custom';
@@ -0,0 +1,11 @@
1
+ export declare const ROW_HEIGHT = 40;
2
+ export declare const ROW_SELECTION_COL_ID = "_row_selection_";
3
+ export declare const ROW_SELECTION_COL_WIDTH = 50;
4
+ export declare const ROW_INDEX_COL_ID = "_row_index_";
5
+ export declare const ROW_OPERATION_COL_ID = "_row_operation_";
6
+ export declare const ROW_OPERATION_COL_WIDTH = 160;
7
+ export declare function isSystemCol(id: string): id is "_row_index_";
8
+ export { dftPageSize as DFT_PAGINATION_PAGE_SIZE } from './features/pagination/use-opts';
9
+ export { dftSelectionType as DFT_ROW_SELECTION_TYPE } from './features/row-selection/const';
10
+ export declare const EMPTY_VALUE = "__EMPTY_VALUE__";
11
+ export declare const SELECTED_OPTION_RAW = "_selected_raw_option_";
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function NonVirtualContainer(props: React.PropsWithChildren<unknown>): JSX.Element;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { type ActionsProps } from '@hi-ui/schema-action-trigger';
3
+ import type { EditTableCtxType } from '../index';
4
+ type BottomRenderActionsType = ActionsProps<AnyObject[], BottomRenderCtxType>['actions'];
5
+ export type BottomRenderConfigType = {
6
+ left?: AnyGetter<CustomLeftActionRenderType>;
7
+ right?: AnyGetter<CustomLeftActionRenderType>;
8
+ };
9
+ type BuiltinActionsType = AnyObject & {
10
+ pagination: React.ReactElement | null;
11
+ rowSelectionIndicator: React.ReactElement | null;
12
+ };
13
+ type CustomLeftActionRenderType = (ctx: BottomRenderCtxType & {
14
+ builtin: BuiltinActionsType;
15
+ }) => BottomRenderActionsType;
16
+ export type BottomRenderCtxType = {
17
+ tableCtx: EditTableCtxType;
18
+ };
19
+ export declare function BottomRender(props: BottomRenderConfigType): JSX.Element;
20
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { VirtualItem } from '@tanstack/react-virtual';
2
+ export declare function TableColGroup(): JSX.Element;
3
+ type VirtualColGroupProps = {
4
+ virtualColumns: VirtualItem[];
5
+ virtualColPadding: {
6
+ start: number;
7
+ end: number;
8
+ };
9
+ };
10
+ export declare function VirtualColGroup({ virtualColumns, virtualColPadding }: VirtualColGroupProps): JSX.Element;
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { VirtualizerOptions } from './type';
3
+ type ColumnVirtualContainerProps = React.PropsWithChildren<{
4
+ options?: VirtualizerOptions;
5
+ }>;
6
+ export declare function ColumnVirtualContainer(props: ColumnVirtualContainerProps): JSX.Element;
7
+ export {};
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import type { VirtualItem } from '@tanstack/react-virtual';
3
+ export type TableContainerContextValue = {
4
+ headerRef: React.RefObject<HTMLDivElement>;
5
+ bodyRef: React.RefObject<HTMLDivElement>;
6
+ footerRef: React.RefObject<HTMLDivElement>;
7
+ colGroup: React.ReactElement;
8
+ /** 仅在开启虚拟化时存在,存储虚拟化相关数据 */
9
+ virtualize?: {
10
+ rows?: VirtualItem[];
11
+ columns?: VirtualItem[];
12
+ rowPadding?: {
13
+ top: number;
14
+ bottom: number;
15
+ };
16
+ colPadding?: {
17
+ left: number;
18
+ right: number;
19
+ };
20
+ };
21
+ };
22
+ export declare const TableContainerContext: React.Context<TableContainerContextValue | null>;
23
+ export declare function useTableContainer(): TableContainerContextValue;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { VirtualizerOptions } from './type';
3
+ type FullVirtualContainerProps = React.PropsWithChildren<{
4
+ rowOptions?: VirtualizerOptions;
5
+ columnOptions?: VirtualizerOptions;
6
+ }>;
7
+ export declare function FullVirtualContainer(props: FullVirtualContainerProps): JSX.Element;
8
+ export {};