@tanstack/table-core 9.0.0-beta.2 → 9.0.0-beta.7

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 (278) hide show
  1. package/dist/core/cells/coreCellsFeature.cjs +11 -20
  2. package/dist/core/cells/coreCellsFeature.cjs.map +1 -1
  3. package/dist/core/cells/coreCellsFeature.d.cts +4 -12
  4. package/dist/core/cells/coreCellsFeature.d.ts +4 -12
  5. package/dist/core/cells/coreCellsFeature.js +12 -20
  6. package/dist/core/cells/coreCellsFeature.js.map +1 -1
  7. package/dist/core/columns/coreColumnsFeature.cjs +59 -68
  8. package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
  9. package/dist/core/columns/coreColumnsFeature.d.cts +4 -12
  10. package/dist/core/columns/coreColumnsFeature.d.ts +4 -12
  11. package/dist/core/columns/coreColumnsFeature.js +60 -68
  12. package/dist/core/columns/coreColumnsFeature.js.map +1 -1
  13. package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
  14. package/dist/core/headers/buildHeaderGroups.js.map +1 -1
  15. package/dist/core/headers/coreHeadersFeature.cjs +44 -53
  16. package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
  17. package/dist/core/headers/coreHeadersFeature.d.cts +4 -12
  18. package/dist/core/headers/coreHeadersFeature.d.ts +4 -12
  19. package/dist/core/headers/coreHeadersFeature.js +45 -53
  20. package/dist/core/headers/coreHeadersFeature.js.map +1 -1
  21. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  22. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  23. package/dist/core/row-models/coreRowModelsFeature.cjs +17 -26
  24. package/dist/core/row-models/coreRowModelsFeature.cjs.map +1 -1
  25. package/dist/core/row-models/coreRowModelsFeature.d.cts +4 -12
  26. package/dist/core/row-models/coreRowModelsFeature.d.ts +4 -12
  27. package/dist/core/row-models/coreRowModelsFeature.js +18 -26
  28. package/dist/core/row-models/coreRowModelsFeature.js.map +1 -1
  29. package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -5
  30. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -5
  31. package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
  32. package/dist/core/row-models/createCoreRowModel.js.map +1 -1
  33. package/dist/core/rows/coreRowsFeature.cjs +27 -36
  34. package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
  35. package/dist/core/rows/coreRowsFeature.d.cts +4 -12
  36. package/dist/core/rows/coreRowsFeature.d.ts +4 -12
  37. package/dist/core/rows/coreRowsFeature.js +28 -36
  38. package/dist/core/rows/coreRowsFeature.js.map +1 -1
  39. package/dist/core/table/constructTable.cjs +2 -2
  40. package/dist/core/table/constructTable.cjs.map +1 -1
  41. package/dist/core/table/constructTable.js +2 -2
  42. package/dist/core/table/constructTable.js.map +1 -1
  43. package/dist/core/table/coreTablesFeature.cjs +7 -16
  44. package/dist/core/table/coreTablesFeature.cjs.map +1 -1
  45. package/dist/core/table/coreTablesFeature.d.cts +4 -12
  46. package/dist/core/table/coreTablesFeature.d.ts +4 -12
  47. package/dist/core/table/coreTablesFeature.js +8 -16
  48. package/dist/core/table/coreTablesFeature.js.map +1 -1
  49. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  50. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  51. package/dist/features/column-faceting/columnFacetingFeature.cjs +49 -61
  52. package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
  53. package/dist/features/column-faceting/columnFacetingFeature.d.cts +4 -15
  54. package/dist/features/column-faceting/columnFacetingFeature.d.ts +4 -15
  55. package/dist/features/column-faceting/columnFacetingFeature.js +50 -61
  56. package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
  57. package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
  58. package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
  59. package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
  60. package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
  61. package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
  62. package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
  63. package/dist/features/column-filtering/columnFilteringFeature.cjs +40 -53
  64. package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
  65. package/dist/features/column-filtering/columnFilteringFeature.d.cts +4 -16
  66. package/dist/features/column-filtering/columnFilteringFeature.d.ts +4 -16
  67. package/dist/features/column-filtering/columnFilteringFeature.js +41 -53
  68. package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
  69. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +3 -3
  70. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +3 -3
  71. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  72. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +1 -1
  73. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +1 -1
  74. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  75. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  76. package/dist/features/column-filtering/createFilteredRowModel.d.cts +1 -1
  77. package/dist/features/column-filtering/createFilteredRowModel.d.ts +1 -1
  78. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  79. package/dist/features/column-grouping/columnGroupingFeature.cjs +57 -69
  80. package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
  81. package/dist/features/column-grouping/columnGroupingFeature.d.cts +4 -15
  82. package/dist/features/column-grouping/columnGroupingFeature.d.ts +4 -15
  83. package/dist/features/column-grouping/columnGroupingFeature.js +58 -69
  84. package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
  85. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  86. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  87. package/dist/features/column-ordering/columnOrderingFeature.cjs +47 -59
  88. package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
  89. package/dist/features/column-ordering/columnOrderingFeature.d.cts +4 -15
  90. package/dist/features/column-ordering/columnOrderingFeature.d.ts +4 -15
  91. package/dist/features/column-ordering/columnOrderingFeature.js +48 -59
  92. package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
  93. package/dist/features/column-pinning/columnPinningFeature.cjs +209 -221
  94. package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
  95. package/dist/features/column-pinning/columnPinningFeature.d.cts +4 -15
  96. package/dist/features/column-pinning/columnPinningFeature.d.ts +4 -15
  97. package/dist/features/column-pinning/columnPinningFeature.js +210 -221
  98. package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
  99. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  100. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +12 -12
  101. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +12 -12
  102. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  103. package/dist/features/column-resizing/columnResizingFeature.cjs +31 -43
  104. package/dist/features/column-resizing/columnResizingFeature.cjs.map +1 -1
  105. package/dist/features/column-resizing/columnResizingFeature.d.cts +4 -15
  106. package/dist/features/column-resizing/columnResizingFeature.d.ts +4 -15
  107. package/dist/features/column-resizing/columnResizingFeature.js +32 -43
  108. package/dist/features/column-resizing/columnResizingFeature.js.map +1 -1
  109. package/dist/features/column-sizing/columnSizingFeature.cjs +112 -125
  110. package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
  111. package/dist/features/column-sizing/columnSizingFeature.d.cts +4 -16
  112. package/dist/features/column-sizing/columnSizingFeature.d.ts +4 -16
  113. package/dist/features/column-sizing/columnSizingFeature.js +113 -125
  114. package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
  115. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +3 -3
  116. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +3 -3
  117. package/dist/features/column-visibility/columnVisibilityFeature.cjs +83 -95
  118. package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
  119. package/dist/features/column-visibility/columnVisibilityFeature.d.cts +4 -15
  120. package/dist/features/column-visibility/columnVisibilityFeature.d.ts +4 -15
  121. package/dist/features/column-visibility/columnVisibilityFeature.js +84 -95
  122. package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
  123. package/dist/features/global-filtering/globalFilteringFeature.cjs +31 -43
  124. package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
  125. package/dist/features/global-filtering/globalFilteringFeature.d.cts +4 -15
  126. package/dist/features/global-filtering/globalFilteringFeature.d.ts +4 -15
  127. package/dist/features/global-filtering/globalFilteringFeature.js +32 -43
  128. package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
  129. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  130. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +4 -2
  131. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +4 -2
  132. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  133. package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
  134. package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
  135. package/dist/features/row-expanding/rowExpandingFeature.cjs +37 -49
  136. package/dist/features/row-expanding/rowExpandingFeature.cjs.map +1 -1
  137. package/dist/features/row-expanding/rowExpandingFeature.d.cts +4 -15
  138. package/dist/features/row-expanding/rowExpandingFeature.d.ts +4 -15
  139. package/dist/features/row-expanding/rowExpandingFeature.js +38 -49
  140. package/dist/features/row-expanding/rowExpandingFeature.js.map +1 -1
  141. package/dist/features/row-pagination/createPaginatedRowModel.cjs.map +1 -1
  142. package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
  143. package/dist/features/row-pagination/rowPaginationFeature.cjs +35 -47
  144. package/dist/features/row-pagination/rowPaginationFeature.cjs.map +1 -1
  145. package/dist/features/row-pagination/rowPaginationFeature.d.cts +4 -15
  146. package/dist/features/row-pagination/rowPaginationFeature.d.ts +4 -15
  147. package/dist/features/row-pagination/rowPaginationFeature.js +36 -47
  148. package/dist/features/row-pagination/rowPaginationFeature.js.map +1 -1
  149. package/dist/features/row-pinning/rowPinningFeature.cjs +55 -67
  150. package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
  151. package/dist/features/row-pinning/rowPinningFeature.d.cts +4 -15
  152. package/dist/features/row-pinning/rowPinningFeature.d.ts +4 -15
  153. package/dist/features/row-pinning/rowPinningFeature.js +56 -67
  154. package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
  155. package/dist/features/row-selection/rowSelectionFeature.cjs +65 -77
  156. package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
  157. package/dist/features/row-selection/rowSelectionFeature.d.cts +4 -15
  158. package/dist/features/row-selection/rowSelectionFeature.d.ts +4 -15
  159. package/dist/features/row-selection/rowSelectionFeature.js +66 -77
  160. package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
  161. package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
  162. package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
  163. package/dist/features/row-sorting/rowSortingFeature.cjs +45 -57
  164. package/dist/features/row-sorting/rowSortingFeature.cjs.map +1 -1
  165. package/dist/features/row-sorting/rowSortingFeature.d.cts +4 -15
  166. package/dist/features/row-sorting/rowSortingFeature.d.ts +4 -15
  167. package/dist/features/row-sorting/rowSortingFeature.js +46 -57
  168. package/dist/features/row-sorting/rowSortingFeature.js.map +1 -1
  169. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +8 -5
  170. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  171. package/dist/features/row-sorting/rowSortingFeature.utils.js +8 -5
  172. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  173. package/dist/fns/aggregationFns.cjs +18 -18
  174. package/dist/fns/aggregationFns.cjs.map +1 -1
  175. package/dist/fns/aggregationFns.d.cts +21 -19
  176. package/dist/fns/aggregationFns.d.ts +21 -19
  177. package/dist/fns/aggregationFns.js +18 -18
  178. package/dist/fns/aggregationFns.js.map +1 -1
  179. package/dist/fns/filterFns.cjs +51 -65
  180. package/dist/fns/filterFns.cjs.map +1 -1
  181. package/dist/fns/filterFns.d.cts +82 -28
  182. package/dist/fns/filterFns.d.ts +82 -28
  183. package/dist/fns/filterFns.js +51 -65
  184. package/dist/fns/filterFns.js.map +1 -1
  185. package/dist/fns/sortFns.cjs +18 -6
  186. package/dist/fns/sortFns.cjs.map +1 -1
  187. package/dist/fns/sortFns.d.cts +15 -13
  188. package/dist/fns/sortFns.d.ts +15 -13
  189. package/dist/fns/sortFns.js +18 -6
  190. package/dist/fns/sortFns.js.map +1 -1
  191. package/dist/index.cjs +0 -20
  192. package/dist/index.d.cts +34 -34
  193. package/dist/index.d.ts +34 -34
  194. package/dist/index.js +21 -21
  195. package/dist/types/Cell.d.cts +3 -8
  196. package/dist/types/Cell.d.ts +3 -8
  197. package/dist/types/Column.d.cts +3 -8
  198. package/dist/types/Column.d.ts +3 -8
  199. package/dist/types/ColumnDef.d.cts +3 -8
  200. package/dist/types/ColumnDef.d.ts +3 -8
  201. package/dist/types/Header.d.cts +3 -8
  202. package/dist/types/Header.d.ts +3 -8
  203. package/dist/types/HeaderGroup.d.cts +3 -8
  204. package/dist/types/HeaderGroup.d.ts +3 -8
  205. package/dist/types/Row.d.cts +3 -8
  206. package/dist/types/Row.d.ts +3 -8
  207. package/dist/types/RowModel.d.cts +4 -10
  208. package/dist/types/RowModel.d.ts +4 -10
  209. package/dist/types/RowModelFns.d.cts +3 -8
  210. package/dist/types/RowModelFns.d.ts +3 -8
  211. package/dist/types/Table.d.cts +3 -8
  212. package/dist/types/Table.d.ts +3 -8
  213. package/dist/types/TableFeatures.d.cts +13 -39
  214. package/dist/types/TableFeatures.d.ts +13 -39
  215. package/dist/types/TableOptions.d.cts +3 -4
  216. package/dist/types/TableOptions.d.ts +3 -4
  217. package/dist/types/TableState.d.cts +5 -10
  218. package/dist/types/TableState.d.ts +5 -10
  219. package/dist/utils.cjs.map +1 -1
  220. package/dist/utils.d.cts +1 -1
  221. package/dist/utils.d.ts +1 -1
  222. package/dist/utils.js.map +1 -1
  223. package/package.json +1 -1
  224. package/src/core/cells/coreCellsFeature.ts +17 -39
  225. package/src/core/columns/coreColumnsFeature.ts +56 -83
  226. package/src/core/headers/buildHeaderGroups.ts +1 -1
  227. package/src/core/headers/coreHeadersFeature.ts +42 -64
  228. package/src/core/headers/coreHeadersFeature.utils.ts +1 -1
  229. package/src/core/row-models/coreRowModelsFeature.ts +43 -64
  230. package/src/core/row-models/coreRowModelsFeature.types.ts +2 -6
  231. package/src/core/row-models/createCoreRowModel.ts +1 -1
  232. package/src/core/rows/coreRowsFeature.ts +45 -72
  233. package/src/core/table/constructTable.ts +10 -7
  234. package/src/core/table/coreTablesFeature.ts +13 -35
  235. package/src/core/table/coreTablesFeature.utils.ts +1 -1
  236. package/src/features/column-faceting/columnFacetingFeature.ts +71 -102
  237. package/src/features/column-faceting/createFacetedMinMaxValues.ts +1 -1
  238. package/src/features/column-faceting/createFacetedRowModel.ts +1 -1
  239. package/src/features/column-faceting/createFacetedUniqueValues.ts +1 -1
  240. package/src/features/column-filtering/columnFilteringFeature.ts +60 -103
  241. package/src/features/column-filtering/columnFilteringFeature.types.ts +3 -3
  242. package/src/features/column-filtering/columnFilteringFeature.utils.ts +4 -4
  243. package/src/features/column-filtering/createFilteredRowModel.ts +2 -2
  244. package/src/features/column-grouping/columnGroupingFeature.ts +82 -126
  245. package/src/features/column-grouping/createGroupedRowModel.ts +1 -1
  246. package/src/features/column-ordering/columnOrderingFeature.ts +52 -84
  247. package/src/features/column-pinning/columnPinningFeature.ts +268 -304
  248. package/src/features/column-pinning/columnPinningFeature.utils.ts +5 -5
  249. package/src/features/column-resizing/columnResizingFeature.ts +44 -78
  250. package/src/features/column-sizing/columnSizingFeature.ts +115 -152
  251. package/src/features/column-visibility/columnVisibilityFeature.ts +92 -129
  252. package/src/features/global-filtering/globalFilteringFeature.ts +45 -79
  253. package/src/features/global-filtering/globalFilteringFeature.utils.ts +4 -2
  254. package/src/features/row-expanding/createExpandedRowModel.ts +1 -1
  255. package/src/features/row-expanding/rowExpandingFeature.ts +65 -101
  256. package/src/features/row-pagination/createPaginatedRowModel.ts +1 -1
  257. package/src/features/row-pagination/rowPaginationFeature.ts +69 -103
  258. package/src/features/row-pinning/rowPinningFeature.ts +72 -104
  259. package/src/features/row-selection/rowSelectionFeature.ts +103 -135
  260. package/src/features/row-sorting/createSortedRowModel.ts +1 -1
  261. package/src/features/row-sorting/rowSortingFeature.ts +73 -114
  262. package/src/features/row-sorting/rowSortingFeature.utils.ts +8 -6
  263. package/src/fns/aggregationFns.ts +26 -42
  264. package/src/fns/filterFns.ts +231 -264
  265. package/src/fns/sortFns.ts +51 -29
  266. package/src/types/Cell.ts +3 -19
  267. package/src/types/Column.ts +2 -18
  268. package/src/types/ColumnDef.ts +2 -18
  269. package/src/types/Header.ts +2 -18
  270. package/src/types/HeaderGroup.ts +2 -13
  271. package/src/types/Row.ts +2 -17
  272. package/src/types/RowModel.ts +3 -25
  273. package/src/types/RowModelFns.ts +2 -17
  274. package/src/types/Table.ts +2 -17
  275. package/src/types/TableFeatures.ts +51 -112
  276. package/src/types/TableOptions.ts +1 -12
  277. package/src/types/TableState.ts +4 -30
  278. package/src/utils.ts +5 -4
@@ -7,22 +7,10 @@ import type { TableOptions_All } from './TableOptions'
7
7
  import type { TableState_All } from './TableState'
8
8
  import type { StockFeatures } from '../features/stockFeatures'
9
9
 
10
- export type ExtractFeatureTypes<
11
- TKey extends keyof FeatureConstructors,
12
- TFeatures extends TableFeatures,
13
- > = UnionToIntersection<
14
- {
15
- [K in keyof TFeatures]: K extends 'coreReativityFeature'
16
- ? never
17
- : TFeatures[K] extends TableFeature<infer FeatureConstructorOptions>
18
- ? TKey extends keyof FeatureConstructorOptions
19
- ? FeatureConstructorOptions[TKey]
20
- : never
21
- : any
22
- }[keyof TFeatures]
23
- >
24
-
25
10
  type IsAny<T> = 0 extends 1 & T ? true : false
11
+ type UnionToIntersectionOrEmpty<T> = [T] extends [never]
12
+ ? {}
13
+ : UnionToIntersection<T> & {}
26
14
 
27
15
  export type ExtractFeatureMapTypes<
28
16
  TFeatures extends TableFeatures,
@@ -30,133 +18,84 @@ export type ExtractFeatureMapTypes<
30
18
  > =
31
19
  IsAny<TFeatures> extends true
32
20
  ? UnionToIntersection<TFeatureMap[keyof TFeatureMap]>
33
- : UnionToIntersection<
21
+ : UnionToIntersectionOrEmpty<
34
22
  TFeatureMap[Extract<keyof TFeatures, keyof TFeatureMap>]
35
23
  >
36
24
 
37
- export interface FeatureConstructors {
38
- CachedRowModel?: any
39
- Cell?: any
40
- Column?: any
41
- ColumnDef?: any
42
- CreateRowModels?: any
43
- Header?: any
44
- HeaderGroup?: any
45
- Row?: any
46
- RowModelFns?: any
47
- Table?: any
48
- TableOptions?: any
49
- TableState?: any
50
- }
51
-
52
25
  export interface Plugins {}
53
26
 
54
27
  export interface TableFeatures
55
28
  extends Partial<CoreFeatures>, Partial<StockFeatures>, Partial<Plugins> {}
56
29
 
57
- export type ConstructTableAPIs<TConstructors extends FeatureConstructors> = <
58
- TFeatures extends TableFeatures,
59
- TData extends RowData,
60
- >(
61
- table: Table_Internal<TFeatures, TData> &
62
- Partial<TConstructors['Table']> & {
63
- options: Partial<TConstructors['TableOptions']>
64
- },
65
- ) => void
66
-
67
- export type GetDefaultColumnDef<TConstructors extends FeatureConstructors> = <
68
- TFeatures extends TableFeatures,
69
- TData extends RowData,
70
- TValue extends CellData = CellData,
71
- >() => ColumnDefBase_All<TFeatures, TData, TValue> &
72
- Partial<TConstructors['ColumnDef']>
73
-
74
- export type GetDefaultTableOptions<TConstructors extends FeatureConstructors> =
75
- <TFeatures extends TableFeatures, TData extends RowData>(
76
- table: Table_Internal<TFeatures, TData> & Partial<TConstructors['Table']>,
77
- ) => Partial<TableOptions_All<TFeatures, TData>> &
78
- Partial<TConstructors['TableOptions']>
79
-
80
- export type GetInitialState<TConstructors extends FeatureConstructors> = (
81
- initialState: Partial<TableState_All> & Partial<TConstructors['TableState']>,
82
- ) => TableState_All & Partial<TConstructors['TableState']>
83
-
84
- export type GetDefaultStateSelector<TConstructors extends FeatureConstructors> =
85
- (
86
- state: TableState_All,
87
- ) => Partial<TableState_All> & Partial<TConstructors['TableState']>
88
-
89
- export type AssignCellPrototype<TConstructors extends FeatureConstructors> = <
90
- TFeatures extends TableFeatures,
91
- TData extends RowData,
92
- >(
93
- prototype: Record<string, any>,
94
- table: Table_Internal<TFeatures, TData>,
95
- ) => void
96
-
97
- export type AssignColumnPrototype<TConstructors extends FeatureConstructors> = <
98
- TFeatures extends TableFeatures,
99
- TData extends RowData,
100
- >(
101
- prototype: Record<string, any>,
102
- table: Table_Internal<TFeatures, TData>,
103
- ) => void
104
-
105
- export type AssignHeaderPrototype<TConstructors extends FeatureConstructors> = <
106
- TFeatures extends TableFeatures,
107
- TData extends RowData,
108
- >(
109
- prototype: Record<string, any>,
110
- table: Table_Internal<TFeatures, TData>,
111
- ) => void
112
-
113
- export type AssignRowPrototype<TConstructors extends FeatureConstructors> = <
114
- TFeatures extends TableFeatures,
115
- TData extends RowData,
116
- >(
117
- prototype: Record<string, any>,
118
- table: Table_Internal<TFeatures, TData>,
119
- ) => void
120
-
121
- export type InitRowInstanceData<TConstructors extends FeatureConstructors> = <
122
- TFeatures extends TableFeatures,
123
- TData extends RowData,
124
- >(
125
- row: Row<TFeatures, TData> & Partial<TConstructors['Row']>,
126
- ) => void
127
-
128
- export interface TableFeature<TConstructors extends FeatureConstructors> {
30
+ export interface TableFeature {
129
31
  /**
130
32
  * Assigns Cell APIs to the cell prototype for memory-efficient method sharing.
131
33
  * This is called once per table to build a shared prototype for all cells.
132
34
  */
133
- assignCellPrototype?: AssignCellPrototype<TConstructors>
35
+ assignCellPrototype?: <
36
+ TFeatures extends TableFeatures,
37
+ TData extends RowData,
38
+ >(
39
+ prototype: Record<string, any>,
40
+ table: Table_Internal<TFeatures, TData>,
41
+ ) => void
134
42
  /**
135
43
  * Assigns Column APIs to the column prototype for memory-efficient method sharing.
136
44
  * This is called once per table to build a shared prototype for all columns.
137
45
  */
138
- assignColumnPrototype?: AssignColumnPrototype<TConstructors>
46
+ assignColumnPrototype?: <
47
+ TFeatures extends TableFeatures,
48
+ TData extends RowData,
49
+ >(
50
+ prototype: Record<string, any>,
51
+ table: Table_Internal<TFeatures, TData>,
52
+ ) => void
139
53
  /**
140
54
  * Assigns Header APIs to the header prototype for memory-efficient method sharing.
141
55
  * This is called once per table to build a shared prototype for all headers.
142
56
  */
143
- assignHeaderPrototype?: AssignHeaderPrototype<TConstructors>
57
+ assignHeaderPrototype?: <
58
+ TFeatures extends TableFeatures,
59
+ TData extends RowData,
60
+ >(
61
+ prototype: Record<string, any>,
62
+ table: Table_Internal<TFeatures, TData>,
63
+ ) => void
144
64
  /**
145
65
  * Assigns Row APIs to the row prototype for memory-efficient method sharing.
146
66
  * This is called once per table to build a shared prototype for all rows.
147
67
  */
148
- assignRowPrototype?: AssignRowPrototype<TConstructors>
68
+ assignRowPrototype?: <TFeatures extends TableFeatures, TData extends RowData>(
69
+ prototype: Record<string, any>,
70
+ table: Table_Internal<TFeatures, TData>,
71
+ ) => void
149
72
  /**
150
73
  * Assigns Table APIs to the table instance.
151
74
  * Unlike row/cell/column/header, the table is a singleton so methods are assigned directly.
152
75
  */
153
- constructTableAPIs?: ConstructTableAPIs<TConstructors>
154
- getDefaultColumnDef?: GetDefaultColumnDef<TConstructors>
155
- getDefaultTableOptions?: GetDefaultTableOptions<TConstructors>
156
- getInitialState?: GetInitialState<TConstructors>
76
+ constructTableAPIs?: <TFeatures extends TableFeatures, TData extends RowData>(
77
+ table: Table_Internal<TFeatures, TData>,
78
+ ) => void
79
+ getDefaultColumnDef?: <
80
+ TFeatures extends TableFeatures,
81
+ TData extends RowData,
82
+ TValue extends CellData = CellData,
83
+ >() => ColumnDefBase_All<TFeatures, TData, TValue>
84
+ getDefaultTableOptions?: <
85
+ TFeatures extends TableFeatures,
86
+ TData extends RowData,
87
+ >(
88
+ table: Table_Internal<TFeatures, TData>,
89
+ ) => Partial<TableOptions_All<TFeatures, TData>>
90
+ getInitialState?: (initialState: Partial<TableState_All>) => TableState_All
157
91
  /**
158
92
  * Initializes instance-specific data on each row (e.g., caches).
159
93
  * Methods should be assigned via assignRowPrototype instead.
160
94
  */
161
- initRowInstanceData?: InitRowInstanceData<TConstructors>
95
+ initRowInstanceData?: <
96
+ TFeatures extends TableFeatures,
97
+ TData extends RowData,
98
+ >(
99
+ row: Row<TFeatures, TData>,
100
+ ) => void
162
101
  }
@@ -17,16 +17,7 @@ import type { TableOptions_RowPinning } from '../features/row-pinning/rowPinning
17
17
  import type { TableOptions_RowSelection } from '../features/row-selection/rowSelectionFeature.types'
18
18
  import type { TableOptions_RowSorting } from '../features/row-sorting/rowSortingFeature.types'
19
19
  import type { RowData, UnionToIntersection } from './type-utils'
20
- import type {
21
- ExtractFeatureMapTypes,
22
- ExtractFeatureTypes,
23
- TableFeatures,
24
- } from './TableFeatures'
25
-
26
- export interface TableOptions_Plugins<
27
- TFeatures extends TableFeatures,
28
- TData extends RowData,
29
- > {}
20
+ import type { ExtractFeatureMapTypes, TableFeatures } from './TableFeatures'
30
21
 
31
22
  /**
32
23
  * Core options that are always available on a table, before optional feature
@@ -97,8 +88,6 @@ export type TableOptions<
97
88
  TData extends RowData,
98
89
  > = TableOptions_Core<TFeatures, TData> &
99
90
  ExtractFeatureMapTypes<TFeatures, TableOptions_FeatureMap<TFeatures, TData>> &
100
- ExtractFeatureTypes<'TableOptions', TFeatures> &
101
- TableOptions_Plugins<TFeatures, TData> &
102
91
  DebugOptions<TFeatures>
103
92
 
104
93
  /**
@@ -11,17 +11,7 @@ import type { TableState_RowPagination } from '../features/row-pagination/rowPag
11
11
  import type { TableState_RowPinning } from '../features/row-pinning/rowPinningFeature.types'
12
12
  import type { TableState_RowSelection } from '../features/row-selection/rowSelectionFeature.types'
13
13
  import type { TableState_RowSorting } from '../features/row-sorting/rowSortingFeature.types'
14
- import type {
15
- ExtractFeatureMapTypes,
16
- ExtractFeatureTypes,
17
- TableFeatures,
18
- } from './TableFeatures'
19
-
20
- /**
21
- * Use this interface as a target for declaration merging to add your own state properties.
22
- * Note: This will affect the types of all tables in your project.
23
- */
24
- export interface TableState_Plugins<TFeatures extends TableFeatures> {}
14
+ import type { ExtractFeatureMapTypes, TableFeatures } from './TableFeatures'
25
15
 
26
16
  export interface TableState_FeatureMap {
27
17
  columnFilteringFeature: TableState_ColumnFiltering
@@ -46,28 +36,12 @@ export interface TableState_FeatureMap {
46
36
  * then custom feature/plugin state is mixed in.
47
37
  */
48
38
  export type TableState<TFeatures extends TableFeatures> =
49
- ExtractFeatureMapTypes<TFeatures, TableState_FeatureMap> &
50
- ExtractFeatureTypes<'TableState', TFeatures> &
51
- TableState_Plugins<TFeatures>
39
+ ExtractFeatureMapTypes<TFeatures, TableState_FeatureMap>
52
40
 
53
41
  /**
54
- * Internal broad state shape containing every stock feature state slice.
42
+ * Internal broad state shape containing every registered feature state slice.
55
43
  *
56
44
  * Feature internals use this when they may need to inspect optional slices owned
57
45
  * by other features.
58
46
  */
59
- export type TableState_All = Partial<
60
- TableState_ColumnFiltering &
61
- TableState_ColumnGrouping &
62
- TableState_ColumnOrdering &
63
- TableState_ColumnPinning &
64
- TableState_ColumnResizing &
65
- TableState_ColumnSizing &
66
- TableState_ColumnVisibility &
67
- TableState_GlobalFiltering &
68
- TableState_RowExpanding &
69
- TableState_RowPagination &
70
- TableState_RowPinning &
71
- TableState_RowSelection &
72
- TableState_RowSorting
73
- >
47
+ export type TableState_All = Partial<TableState<TableFeatures>>
package/src/utils.ts CHANGED
@@ -427,13 +427,14 @@ export function assignPrototypeAPIs<
427
427
  */
428
428
  export function callMemoOrStaticFn<
429
429
  TObject extends Record<string, any>,
430
- TStaticFn extends AnyFunction,
430
+ TArgs extends Array<any>,
431
+ TReturn,
431
432
  >(
432
433
  obj: TObject,
433
434
  fnKey: string,
434
- staticFn: TStaticFn,
435
- ...args: Parameters<TStaticFn> extends [any, ...infer Rest] ? Rest : never
436
- ): ReturnType<TStaticFn> {
435
+ staticFn: (obj: TObject, ...args: TArgs) => TReturn,
436
+ ...args: TArgs
437
+ ): TReturn {
437
438
  return (
438
439
  (obj[fnKey] as Function | undefined)?.(...args) ?? staticFn(obj, ...args)
439
440
  )