@tanstack/table-core 9.0.0-alpha.47 → 9.0.0-alpha.49

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 (246) hide show
  1. package/README.md +10 -0
  2. package/dist/core/cells/coreCellsFeature.utils.cjs +11 -8
  3. package/dist/core/cells/coreCellsFeature.utils.cjs.map +1 -1
  4. package/dist/core/cells/coreCellsFeature.utils.d.cts +11 -8
  5. package/dist/core/cells/coreCellsFeature.utils.d.ts +11 -8
  6. package/dist/core/cells/coreCellsFeature.utils.js +11 -8
  7. package/dist/core/cells/coreCellsFeature.utils.js.map +1 -1
  8. package/dist/core/columns/coreColumnsFeature.types.d.cts +7 -6
  9. package/dist/core/columns/coreColumnsFeature.types.d.ts +7 -6
  10. package/dist/core/columns/coreColumnsFeature.utils.cjs +37 -27
  11. package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
  12. package/dist/core/columns/coreColumnsFeature.utils.d.cts +37 -27
  13. package/dist/core/columns/coreColumnsFeature.utils.d.ts +37 -27
  14. package/dist/core/columns/coreColumnsFeature.utils.js +37 -27
  15. package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
  16. package/dist/core/headers/coreHeadersFeature.types.d.cts +6 -4
  17. package/dist/core/headers/coreHeadersFeature.types.d.ts +6 -4
  18. package/dist/core/headers/coreHeadersFeature.utils.cjs +23 -18
  19. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  20. package/dist/core/headers/coreHeadersFeature.utils.d.cts +23 -18
  21. package/dist/core/headers/coreHeadersFeature.utils.d.ts +23 -18
  22. package/dist/core/headers/coreHeadersFeature.utils.js +23 -18
  23. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  24. package/dist/core/row-models/coreRowModelsFeature.utils.cjs +48 -36
  25. package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
  26. package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +48 -36
  27. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +48 -36
  28. package/dist/core/row-models/coreRowModelsFeature.utils.js +48 -36
  29. package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
  30. package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
  31. package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
  32. package/dist/core/rows/coreRowsFeature.utils.cjs +34 -28
  33. package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
  34. package/dist/core/rows/coreRowsFeature.utils.d.cts +34 -28
  35. package/dist/core/rows/coreRowsFeature.utils.d.ts +34 -28
  36. package/dist/core/rows/coreRowsFeature.utils.js +34 -28
  37. package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
  38. package/dist/core/table/coreTablesFeature.types.d.cts +6 -2
  39. package/dist/core/table/coreTablesFeature.types.d.ts +6 -2
  40. package/dist/core/table/coreTablesFeature.utils.cjs +2 -2
  41. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  42. package/dist/core/table/coreTablesFeature.utils.d.cts +2 -2
  43. package/dist/core/table/coreTablesFeature.utils.d.ts +2 -2
  44. package/dist/core/table/coreTablesFeature.utils.js +2 -2
  45. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  46. package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +16 -10
  47. package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +16 -10
  48. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +26 -18
  49. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
  50. package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +26 -18
  51. package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +26 -18
  52. package/dist/features/column-faceting/columnFacetingFeature.utils.js +26 -18
  53. package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
  54. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +21 -11
  55. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +21 -11
  56. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +39 -28
  57. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  58. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +39 -28
  59. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +39 -28
  60. package/dist/features/column-filtering/columnFilteringFeature.utils.js +39 -28
  61. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  62. package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +18 -14
  63. package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +18 -14
  64. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +55 -43
  65. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
  66. package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +55 -43
  67. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +55 -43
  68. package/dist/features/column-grouping/columnGroupingFeature.utils.js +55 -43
  69. package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
  70. package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +14 -5
  71. package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +14 -5
  72. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +30 -23
  73. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
  74. package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +30 -23
  75. package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +30 -23
  76. package/dist/features/column-ordering/columnOrderingFeature.utils.js +30 -23
  77. package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
  78. package/dist/features/column-pinning/columnPinningFeature.types.d.cts +43 -31
  79. package/dist/features/column-pinning/columnPinningFeature.types.d.ts +43 -31
  80. package/dist/features/column-pinning/columnPinningFeature.utils.cjs +111 -91
  81. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  82. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +111 -91
  83. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +111 -91
  84. package/dist/features/column-pinning/columnPinningFeature.utils.js +111 -91
  85. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  86. package/dist/features/column-resizing/columnResizingFeature.types.d.cts +9 -9
  87. package/dist/features/column-resizing/columnResizingFeature.types.d.ts +9 -9
  88. package/dist/features/column-resizing/columnResizingFeature.utils.cjs +29 -20
  89. package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
  90. package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +28 -19
  91. package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +28 -19
  92. package/dist/features/column-resizing/columnResizingFeature.utils.js +29 -20
  93. package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
  94. package/dist/features/column-sizing/columnSizingFeature.types.d.cts +19 -12
  95. package/dist/features/column-sizing/columnSizingFeature.types.d.ts +19 -12
  96. package/dist/features/column-sizing/columnSizingFeature.utils.cjs +52 -41
  97. package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
  98. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +52 -41
  99. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +52 -41
  100. package/dist/features/column-sizing/columnSizingFeature.utils.js +52 -41
  101. package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
  102. package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +16 -13
  103. package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +16 -13
  104. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +54 -42
  105. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
  106. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +54 -42
  107. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +54 -42
  108. package/dist/features/column-visibility/columnVisibilityFeature.utils.js +54 -42
  109. package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
  110. package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +10 -5
  111. package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +10 -5
  112. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +20 -14
  113. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  114. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +20 -14
  115. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +20 -14
  116. package/dist/features/global-filtering/globalFilteringFeature.utils.js +20 -14
  117. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  118. package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +16 -15
  119. package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +16 -15
  120. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +56 -41
  121. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
  122. package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +56 -41
  123. package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +56 -41
  124. package/dist/features/row-expanding/rowExpandingFeature.utils.js +56 -41
  125. package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
  126. package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +19 -12
  127. package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +19 -12
  128. package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +49 -32
  129. package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
  130. package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +49 -32
  131. package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +49 -32
  132. package/dist/features/row-pagination/rowPaginationFeature.utils.js +49 -32
  133. package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
  134. package/dist/features/row-pinning/rowPinningFeature.types.d.cts +12 -8
  135. package/dist/features/row-pinning/rowPinningFeature.types.d.ts +12 -8
  136. package/dist/features/row-pinning/rowPinningFeature.utils.cjs +39 -29
  137. package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
  138. package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +39 -29
  139. package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +39 -29
  140. package/dist/features/row-pinning/rowPinningFeature.utils.js +39 -29
  141. package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
  142. package/dist/features/row-selection/rowSelectionFeature.types.d.cts +30 -24
  143. package/dist/features/row-selection/rowSelectionFeature.types.d.ts +30 -24
  144. package/dist/features/row-selection/rowSelectionFeature.utils.cjs +89 -69
  145. package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
  146. package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +89 -69
  147. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +89 -69
  148. package/dist/features/row-selection/rowSelectionFeature.utils.js +89 -69
  149. package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
  150. package/dist/features/row-sorting/rowSortingFeature.types.d.cts +10 -8
  151. package/dist/features/row-sorting/rowSortingFeature.types.d.ts +10 -8
  152. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +62 -45
  153. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  154. package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +61 -44
  155. package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +61 -44
  156. package/dist/features/row-sorting/rowSortingFeature.utils.js +62 -45
  157. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  158. package/dist/fns/aggregationFns.cjs +33 -9
  159. package/dist/fns/aggregationFns.cjs.map +1 -1
  160. package/dist/fns/aggregationFns.d.cts +33 -9
  161. package/dist/fns/aggregationFns.d.ts +33 -9
  162. package/dist/fns/aggregationFns.js +33 -9
  163. package/dist/fns/aggregationFns.js.map +1 -1
  164. package/dist/fns/filterFns.cjs +48 -17
  165. package/dist/fns/filterFns.cjs.map +1 -1
  166. package/dist/fns/filterFns.d.cts +42 -15
  167. package/dist/fns/filterFns.d.ts +42 -15
  168. package/dist/fns/filterFns.js +48 -17
  169. package/dist/fns/filterFns.js.map +1 -1
  170. package/dist/helpers/columnHelper.cjs +9 -4
  171. package/dist/helpers/columnHelper.cjs.map +1 -1
  172. package/dist/helpers/columnHelper.d.cts +9 -4
  173. package/dist/helpers/columnHelper.d.ts +9 -4
  174. package/dist/helpers/columnHelper.js +9 -4
  175. package/dist/helpers/columnHelper.js.map +1 -1
  176. package/dist/helpers/tableOptions.cjs.map +1 -1
  177. package/dist/helpers/tableOptions.d.cts +12 -9
  178. package/dist/helpers/tableOptions.d.ts +12 -9
  179. package/dist/helpers/tableOptions.js.map +1 -1
  180. package/dist/types/ColumnDef.d.cts +38 -0
  181. package/dist/types/ColumnDef.d.ts +38 -0
  182. package/dist/types/TableOptions.d.cts +15 -0
  183. package/dist/types/TableOptions.d.ts +15 -0
  184. package/dist/types/TableState.d.cts +12 -0
  185. package/dist/types/TableState.d.ts +12 -0
  186. package/package.json +5 -3
  187. package/skills/column-definitions/SKILL.md +333 -0
  188. package/skills/column-layout/SKILL.md +328 -0
  189. package/skills/column-layout/references/subsystems.md +220 -0
  190. package/skills/customizing-feature-behavior/SKILL.md +416 -0
  191. package/skills/filtering/SKILL.md +357 -0
  192. package/skills/filtering/references/faceting-and-fuzzy.md +191 -0
  193. package/skills/grouping/SKILL.md +448 -0
  194. package/skills/migrate-v8-to-v9/SKILL.md +495 -0
  195. package/skills/pagination/SKILL.md +385 -0
  196. package/skills/row-expanding/SKILL.md +348 -0
  197. package/skills/row-pinning/SKILL.md +269 -0
  198. package/skills/row-selection/SKILL.md +391 -0
  199. package/skills/setup/SKILL.md +400 -0
  200. package/skills/sorting/SKILL.md +344 -0
  201. package/skills/state-management/SKILL.md +388 -0
  202. package/src/core/cells/coreCellsFeature.utils.ts +11 -8
  203. package/src/core/columns/coreColumnsFeature.types.ts +7 -6
  204. package/src/core/columns/coreColumnsFeature.utils.ts +37 -27
  205. package/src/core/headers/coreHeadersFeature.types.ts +6 -4
  206. package/src/core/headers/coreHeadersFeature.utils.ts +23 -18
  207. package/src/core/row-models/coreRowModelsFeature.utils.ts +48 -36
  208. package/src/core/rows/coreRowsFeature.types.ts +4 -4
  209. package/src/core/rows/coreRowsFeature.utils.ts +34 -28
  210. package/src/core/table/coreTablesFeature.types.ts +6 -2
  211. package/src/core/table/coreTablesFeature.utils.ts +2 -2
  212. package/src/features/column-faceting/columnFacetingFeature.types.ts +16 -10
  213. package/src/features/column-faceting/columnFacetingFeature.utils.ts +26 -18
  214. package/src/features/column-filtering/columnFilteringFeature.types.ts +21 -11
  215. package/src/features/column-filtering/columnFilteringFeature.utils.ts +39 -28
  216. package/src/features/column-grouping/columnGroupingFeature.types.ts +18 -14
  217. package/src/features/column-grouping/columnGroupingFeature.utils.ts +55 -43
  218. package/src/features/column-ordering/columnOrderingFeature.types.ts +14 -5
  219. package/src/features/column-ordering/columnOrderingFeature.utils.ts +30 -23
  220. package/src/features/column-pinning/columnPinningFeature.types.ts +43 -31
  221. package/src/features/column-pinning/columnPinningFeature.utils.ts +111 -91
  222. package/src/features/column-resizing/columnResizingFeature.types.ts +9 -9
  223. package/src/features/column-resizing/columnResizingFeature.utils.ts +29 -21
  224. package/src/features/column-sizing/columnSizingFeature.types.ts +19 -12
  225. package/src/features/column-sizing/columnSizingFeature.utils.ts +52 -41
  226. package/src/features/column-visibility/columnVisibilityFeature.types.ts +16 -13
  227. package/src/features/column-visibility/columnVisibilityFeature.utils.ts +54 -42
  228. package/src/features/global-filtering/globalFilteringFeature.types.ts +10 -5
  229. package/src/features/global-filtering/globalFilteringFeature.utils.ts +20 -14
  230. package/src/features/row-expanding/rowExpandingFeature.types.ts +16 -15
  231. package/src/features/row-expanding/rowExpandingFeature.utils.ts +56 -41
  232. package/src/features/row-pagination/rowPaginationFeature.types.ts +19 -12
  233. package/src/features/row-pagination/rowPaginationFeature.utils.ts +49 -32
  234. package/src/features/row-pinning/rowPinningFeature.types.ts +12 -8
  235. package/src/features/row-pinning/rowPinningFeature.utils.ts +39 -29
  236. package/src/features/row-selection/rowSelectionFeature.types.ts +30 -24
  237. package/src/features/row-selection/rowSelectionFeature.utils.ts +89 -69
  238. package/src/features/row-sorting/rowSortingFeature.types.ts +10 -8
  239. package/src/features/row-sorting/rowSortingFeature.utils.ts +62 -45
  240. package/src/fns/aggregationFns.ts +33 -9
  241. package/src/fns/filterFns.ts +48 -17
  242. package/src/helpers/columnHelper.ts +9 -4
  243. package/src/helpers/tableOptions.ts +12 -9
  244. package/src/types/ColumnDef.ts +38 -0
  245. package/src/types/TableOptions.ts +15 -0
  246. package/src/types/TableState.ts +12 -0
@@ -9,13 +9,14 @@ import type {
9
9
  } from './rowExpandingFeature.types'
10
10
 
11
11
  /**
12
- * Returns the default expanded state.
12
+ * Creates the default expanded state.
13
13
  *
14
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
14
+ * The feature default is an empty map, meaning no rows are expanded. Reset APIs
15
+ * use this value when `defaultState` is `true`.
15
16
  *
16
17
  * @example
17
18
  * ```ts
18
- * const initialValue = getDefaultExpandedState()
19
+ * const expanded = getDefaultExpandedState()
19
20
  * ```
20
21
  */
21
22
  export function getDefaultExpandedState(): ExpandedState {
@@ -23,9 +24,11 @@ export function getDefaultExpandedState(): ExpandedState {
23
24
  }
24
25
 
25
26
  /**
26
- * Schedules an automatic reset for expanded.
27
+ * Schedules an expanded-state reset after row-structure changes.
27
28
  *
28
- * The reset only runs when the related feature options allow automatic resets for the current table state change.
29
+ * The reset runs when `autoResetAll`, `autoResetExpanded`, or the default
30
+ * client-side expanding behavior allows it. Manual expanding opts out unless
31
+ * the reset options explicitly opt back in.
29
32
  *
30
33
  * @example
31
34
  * ```ts
@@ -46,13 +49,14 @@ export function table_autoResetExpanded<
46
49
  }
47
50
 
48
51
  /**
49
- * Updates the table's expanded state slice.
52
+ * Routes an expanded-state updater through the table's expanded change handler.
50
53
  *
51
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
54
+ * The updater may be `true`, a row-id map, or a function of the previous
55
+ * expanded state, matching the instance `table.setExpanded` behavior.
52
56
  *
53
57
  * @example
54
58
  * ```ts
55
- * table_setExpanded(table, (old) => old)
59
+ * table_setExpanded(table, (old) => ({ ...old, [rowId]: true }))
56
60
  * ```
57
61
  */
58
62
  export function table_setExpanded<
@@ -63,9 +67,11 @@ export function table_setExpanded<
63
67
  }
64
68
 
65
69
  /**
66
- * Toggles all rows expanded for the table.
70
+ * Expands or collapses every row.
67
71
  *
68
- * This is the table-level convenience API used by UI controls that affect many columns or rows at once.
72
+ * Passing `true` stores the special expanded-all state. Passing `false` stores
73
+ * an empty map. Omitting the value toggles based on whether all rows are
74
+ * currently expanded.
69
75
  *
70
76
  * @example
71
77
  * ```ts
@@ -84,9 +90,10 @@ export function table_toggleAllRowsExpanded<
84
90
  }
85
91
 
86
92
  /**
87
- * Resets the table's expanded state slice.
93
+ * Resets `expanded` to the configured initial state or feature default.
88
94
  *
89
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
95
+ * With no argument, the reset clones `table.initialState.expanded` when it
96
+ * exists. Passing `true` ignores initial state and resets to `{}`.
90
97
  *
91
98
  * @example
92
99
  * ```ts
@@ -105,13 +112,14 @@ export function table_resetExpanded<
105
112
  }
106
113
 
107
114
  /**
108
- * Returns can some rows expand for the table.
115
+ * Checks whether at least one pre-paginated row can expand.
109
116
  *
110
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
117
+ * Pagination is intentionally ignored so controls can reflect expandable rows
118
+ * that may not be on the current page.
111
119
  *
112
120
  * @example
113
121
  * ```ts
114
- * const value = table_getCanSomeRowsExpand(table)
122
+ * const canExpand = table_getCanSomeRowsExpand(table)
115
123
  * ```
116
124
  */
117
125
  export function table_getCanSomeRowsExpand<
@@ -124,13 +132,14 @@ export function table_getCanSomeRowsExpand<
124
132
  }
125
133
 
126
134
  /**
127
- * Returns an event handler for all rows expanded handler.
135
+ * Creates an event handler that toggles all rows expanded.
128
136
  *
129
- * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.
137
+ * React-style synthetic events are persisted when present before the table state
138
+ * is toggled.
130
139
  *
131
140
  * @example
132
141
  * ```ts
133
- * const value = table_getToggleAllRowsExpandedHandler(table)
142
+ * const onClick = table_getToggleAllRowsExpandedHandler(table)
134
143
  * ```
135
144
  */
136
145
  export function table_getToggleAllRowsExpandedHandler<
@@ -144,13 +153,13 @@ export function table_getToggleAllRowsExpandedHandler<
144
153
  }
145
154
 
146
155
  /**
147
- * Returns is some rows expanded for the table.
156
+ * Checks whether any row is expanded.
148
157
  *
149
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
158
+ * The special expanded-all value `true` counts as some rows expanded.
150
159
  *
151
160
  * @example
152
161
  * ```ts
153
- * const value = table_getIsSomeRowsExpanded(table)
162
+ * const someExpanded = table_getIsSomeRowsExpanded(table)
154
163
  * ```
155
164
  */
156
165
  export function table_getIsSomeRowsExpanded<
@@ -162,13 +171,14 @@ export function table_getIsSomeRowsExpanded<
162
171
  }
163
172
 
164
173
  /**
165
- * Returns is all rows expanded for the table.
174
+ * Checks whether every row in the current row model is expanded.
166
175
  *
167
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
176
+ * The special expanded-all value `true` returns true immediately. Empty
177
+ * expanded state returns false.
168
178
  *
169
179
  * @example
170
180
  * ```ts
171
- * const value = table_getIsAllRowsExpanded(table)
181
+ * const allExpanded = table_getIsAllRowsExpanded(table)
172
182
  * ```
173
183
  */
174
184
  export function table_getIsAllRowsExpanded<
@@ -196,13 +206,14 @@ export function table_getIsAllRowsExpanded<
196
206
  }
197
207
 
198
208
  /**
199
- * Returns expanded depth for the table.
209
+ * Computes the deepest expanded row id depth.
200
210
  *
201
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
211
+ * Row ids are split on `.`; expanded-all state scans the current row model,
212
+ * while explicit expanded state scans its expanded id keys.
202
213
  *
203
214
  * @example
204
215
  * ```ts
205
- * const value = table_getExpandedDepth(table)
216
+ * const depth = table_getExpandedDepth(table)
206
217
  * ```
207
218
  */
208
219
  export function table_getExpandedDepth<
@@ -225,9 +236,11 @@ export function table_getExpandedDepth<
225
236
  }
226
237
 
227
238
  /**
228
- * Toggles expanded for a row.
239
+ * Expands or collapses this row.
229
240
  *
230
- * The update is routed through the table state updater for the owning feature state slice.
241
+ * Omitting `expanded` toggles the row. If the current state is expanded-all,
242
+ * the function first materializes that state into a row-id map before applying
243
+ * the row-specific change.
231
244
  *
232
245
  * @example
233
246
  * ```ts
@@ -270,13 +283,14 @@ export function row_toggleExpanded<
270
283
  }
271
284
 
272
285
  /**
273
- * Returns is expanded for a row.
286
+ * Checks whether this row is expanded.
274
287
  *
275
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
288
+ * `options.getIsRowExpanded` can override state-derived behavior. Otherwise
289
+ * the row is expanded when expanded state is `true` or contains this row id.
276
290
  *
277
291
  * @example
278
292
  * ```ts
279
- * const value = row_getIsExpanded(row)
293
+ * const expanded = row_getIsExpanded(row)
280
294
  * ```
281
295
  */
282
296
  export function row_getIsExpanded<
@@ -292,13 +306,14 @@ export function row_getIsExpanded<
292
306
  }
293
307
 
294
308
  /**
295
- * Returns whether a row can use expand.
309
+ * Checks whether this row can be expanded.
296
310
  *
297
- * This evaluates row data, table options, and feature-specific enablement rules.
311
+ * `options.getRowCanExpand` wins when provided. Otherwise rows can expand when
312
+ * expanding is enabled and the row has subRows.
298
313
  *
299
314
  * @example
300
315
  * ```ts
301
- * const value = row_getCanExpand(row)
316
+ * const canExpand = row_getCanExpand(row)
302
317
  * ```
303
318
  */
304
319
  export function row_getCanExpand<
@@ -312,13 +327,13 @@ export function row_getCanExpand<
312
327
  }
313
328
 
314
329
  /**
315
- * Returns is all parents expanded for a row.
330
+ * Checks whether every ancestor of this row is expanded.
316
331
  *
317
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
332
+ * The current row is not considered; only its parent chain is walked.
318
333
  *
319
334
  * @example
320
335
  * ```ts
321
- * const value = row_getIsAllParentsExpanded(row)
336
+ * const parentsExpanded = row_getIsAllParentsExpanded(row)
322
337
  * ```
323
338
  */
324
339
  export function row_getIsAllParentsExpanded<
@@ -337,13 +352,13 @@ export function row_getIsAllParentsExpanded<
337
352
  }
338
353
 
339
354
  /**
340
- * Returns an event handler for toggling expanded handler.
355
+ * Creates a row control handler that toggles this row's expanded state.
341
356
  *
342
- * The handler is intended for direct use in row-level controls such as expansion or selection buttons.
357
+ * The handler is a no-op when the row cannot expand.
343
358
  *
344
359
  * @example
345
360
  * ```ts
346
- * const value = row_getToggleExpandedHandler(row)
361
+ * const onClick = row_getToggleExpandedHandler(row)
347
362
  * ```
348
363
  */
349
364
  export function row_getToggleExpandedHandler<
@@ -47,23 +47,26 @@ export interface Table_RowPagination<
47
47
  > {
48
48
  _autoResetPageIndex: () => void
49
49
  /**
50
- * Returns whether the table can go to the next page.
50
+ * Checks whether the current page index can move forward.
51
51
  */
52
52
  getCanNextPage: () => boolean
53
53
  /**
54
- * Returns whether the table can go to the previous page.
54
+ * Checks whether the current page index can move backward.
55
55
  */
56
56
  getCanPreviousPage: () => boolean
57
57
  /**
58
- * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.
58
+ * Resolves the current page count from `options.pageCount` or row count and
59
+ * page size.
59
60
  */
60
61
  getPageCount: () => number
61
62
  /**
62
- * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.
63
+ * Resolves the row count used for pagination math.
64
+ *
65
+ * `options.rowCount` wins; otherwise the pre-paginated row model is counted.
63
66
  */
64
67
  getRowCount: () => number
65
68
  /**
66
- * Returns an array of page options (zero-index-based) for the current page size.
69
+ * Builds zero-based page indexes for the current page count.
67
70
  */
68
71
  getPageOptions: () => Array<number>
69
72
  /**
@@ -83,16 +86,20 @@ export interface Table_RowPagination<
83
86
  */
84
87
  lastPage: () => void
85
88
  /**
86
- * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.
89
+ * Resets `pagination.pageIndex` to initial state, or to `0` when
90
+ * `defaultState` is `true`.
87
91
  */
88
92
  resetPageIndex: (defaultState?: boolean) => void
89
93
  /**
90
- * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.
94
+ * Resets `pagination.pageSize` to initial state, or to `10` when
95
+ * `defaultState` is `true`.
91
96
  */
92
97
  resetPageSize: (defaultState?: boolean) => void
93
98
  /**
94
- * Resets pagination state to `initialState.pagination`. Pass `true` to reset
95
- * to the feature default of `{ pageIndex: 0, pageSize: 10 }`.
99
+ * Resets `pagination` to `initialState.pagination`.
100
+ *
101
+ * Pass `true` to ignore initial state and reset to
102
+ * `{ pageIndex: 0, pageSize: 10 }`.
96
103
  */
97
104
  resetPagination: (defaultState?: boolean) => void
98
105
  /**
@@ -104,7 +111,7 @@ export interface Table_RowPagination<
104
111
  */
105
112
  setPageSize: (updater: Updater<number>) => void
106
113
  /**
107
- * Sets pagination state using a value or updater.
114
+ * Updates pagination state with a next state or updater function.
108
115
  */
109
116
  setPagination: (updater: Updater<PaginationState>) => void
110
117
  }
@@ -114,11 +121,11 @@ export interface Table_RowModels_Paginated<
114
121
  TData extends RowData,
115
122
  > {
116
123
  /**
117
- * Returns the row model for the table after pagination has been applied.
124
+ * Resolves the row model after pagination has sliced the current page.
118
125
  */
119
126
  getPaginatedRowModel: () => RowModel<TFeatures, TData>
120
127
  /**
121
- * Returns the row model for the table before any pagination has been applied.
128
+ * Reads the row model immediately before pagination.
122
129
  */
123
130
  getPrePaginatedRowModel: () => RowModel<TFeatures, TData>
124
131
  }
@@ -8,13 +8,14 @@ const defaultPageIndex = 0
8
8
  const defaultPageSize = 10
9
9
 
10
10
  /**
11
- * Returns the default pagination state.
11
+ * Creates the default pagination state used by the pagination feature.
12
12
  *
13
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
13
+ * The feature default starts at the first page with a page size of 10. Reset
14
+ * APIs use this value when `defaultState` is `true`.
14
15
  *
15
16
  * @example
16
17
  * ```ts
17
- * const initialValue = getDefaultPaginationState()
18
+ * const pagination = getDefaultPaginationState()
18
19
  * ```
19
20
  */
20
21
  export function getDefaultPaginationState(): PaginationState {
@@ -25,9 +26,11 @@ export function getDefaultPaginationState(): PaginationState {
25
26
  }
26
27
 
27
28
  /**
28
- * Schedules an automatic reset for page index.
29
+ * Resets the page index when a page-altering change should return to page 0.
29
30
  *
30
- * The reset only runs when the related feature options allow automatic resets for the current table state change.
31
+ * The reset runs when `autoResetAll`, `autoResetPageIndex`, or the default
32
+ * client-side pagination behavior allows it. Manual pagination opts out unless
33
+ * the reset options explicitly opt back in.
31
34
  *
32
35
  * @example
33
36
  * ```ts
@@ -48,9 +51,11 @@ export function table_autoResetPageIndex<
48
51
  }
49
52
 
50
53
  /**
51
- * Updates the table's pagination state slice.
54
+ * Routes a pagination updater through the table's pagination change handler.
52
55
  *
53
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
56
+ * The updater may be a next state object or a function of the previous
57
+ * `PaginationState`; controlled state and external atoms observe the same
58
+ * updater path as the instance API.
54
59
  *
55
60
  * @example
56
61
  * ```ts
@@ -71,9 +76,11 @@ export function table_setPagination<
71
76
  }
72
77
 
73
78
  /**
74
- * Resets the table's pagination state slice.
79
+ * Resets `pagination` to the configured initial state or feature default.
75
80
  *
76
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
81
+ * With no argument, the reset clones `table.initialState.pagination` when it
82
+ * exists. Passing `true` ignores initial state and resets to
83
+ * `{ pageIndex: 0, pageSize: 10 }`.
77
84
  *
78
85
  * @example
79
86
  * ```ts
@@ -96,9 +103,10 @@ export function table_resetPagination<
96
103
  }
97
104
 
98
105
  /**
99
- * Updates the table's page index state slice.
106
+ * Updates `pagination.pageIndex` and clamps it to the known page range.
100
107
  *
101
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
108
+ * Unknown page counts (`undefined` or `-1`) allow any non-negative page index.
109
+ * Known page counts clamp the index between `0` and `pageCount - 1`.
102
110
  *
103
111
  * @example
104
112
  * ```ts
@@ -128,9 +136,10 @@ export function table_setPageIndex<
128
136
  }
129
137
 
130
138
  /**
131
- * Resets the table's page index state slice.
139
+ * Resets only `pagination.pageIndex`.
132
140
  *
133
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
141
+ * With no argument, the reset uses `table.initialState.pagination?.pageIndex`
142
+ * or `0`. Passing `true` always resets the page index to `0`.
134
143
  *
135
144
  * @example
136
145
  * ```ts
@@ -152,9 +161,10 @@ export function table_resetPageIndex<
152
161
  }
153
162
 
154
163
  /**
155
- * Resets the table's page size state slice.
164
+ * Resets only `pagination.pageSize`.
156
165
  *
157
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
166
+ * With no argument, the reset uses `table.initialState.pagination?.pageSize`
167
+ * or `10`. Passing `true` always resets the page size to `10`.
158
168
  *
159
169
  * @example
160
170
  * ```ts
@@ -176,9 +186,10 @@ export function table_resetPageSize<
176
186
  }
177
187
 
178
188
  /**
179
- * Updates the table's page size state slice.
189
+ * Updates `pagination.pageSize` while preserving the current top row.
180
190
  *
181
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
191
+ * The new size is clamped to at least `1`, and `pageIndex` is recalculated so
192
+ * the row that was previously at the top of the page remains in view.
182
193
  *
183
194
  * @example
184
195
  * ```ts
@@ -203,13 +214,14 @@ export function table_setPageSize<
203
214
  }
204
215
 
205
216
  /**
206
- * Returns page options for the table.
217
+ * Builds the zero-based page indexes available for the current page count.
207
218
  *
208
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
219
+ * Unknown or empty page counts return an empty array; otherwise the result is
220
+ * `[0, 1, ...pageCount - 1]`.
209
221
  *
210
222
  * @example
211
223
  * ```ts
212
- * const value = table_getPageOptions(table)
224
+ * const pageIndexes = table_getPageOptions(table)
213
225
  * ```
214
226
  */
215
227
  export function table_getPageOptions<
@@ -225,13 +237,14 @@ export function table_getPageOptions<
225
237
  }
226
238
 
227
239
  /**
228
- * Returns can previous page for the table.
240
+ * Checks whether the current page index can move backward.
229
241
  *
230
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
242
+ * The first page is page index `0`, so only positive page indexes can navigate
243
+ * to a previous page.
231
244
  *
232
245
  * @example
233
246
  * ```ts
234
- * const value = table_getCanPreviousPage(table)
247
+ * const canGoBack = table_getCanPreviousPage(table)
235
248
  * ```
236
249
  */
237
250
  export function table_getCanPreviousPage<
@@ -242,13 +255,14 @@ export function table_getCanPreviousPage<
242
255
  }
243
256
 
244
257
  /**
245
- * Returns can next page for the table.
258
+ * Checks whether the current page index can move forward.
246
259
  *
247
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
260
+ * A `pageCount` of `-1` means the caller does not know the total page count, so
261
+ * this returns `true`. A page count of `0` returns `false`.
248
262
  *
249
263
  * @example
250
264
  * ```ts
251
- * const value = table_getCanNextPage(table)
265
+ * const canGoForward = table_getCanNextPage(table)
252
266
  * ```
253
267
  */
254
268
  export function table_getCanNextPage<
@@ -343,13 +357,14 @@ export function table_lastPage<
343
357
  }
344
358
 
345
359
  /**
346
- * Returns page count for the table.
360
+ * Resolves the number of pages for the current pagination state.
347
361
  *
348
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
362
+ * `options.pageCount` wins for manual pagination. Otherwise the value is
363
+ * calculated from `table_getRowCount(table)` and the current `pageSize`.
349
364
  *
350
365
  * @example
351
366
  * ```ts
352
- * const value = table_getPageCount(table)
367
+ * const pages = table_getPageCount(table)
353
368
  * ```
354
369
  */
355
370
  export function table_getPageCount<
@@ -366,13 +381,15 @@ export function table_getPageCount<
366
381
  }
367
382
 
368
383
  /**
369
- * Returns row count for the table.
384
+ * Resolves the total row count used for pagination math.
370
385
  *
371
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
386
+ * `options.rowCount` wins for manual pagination. Otherwise the count comes
387
+ * from the pre-paginated row model so filtering, grouping, sorting, and
388
+ * expansion are reflected before the page slice is applied.
372
389
  *
373
390
  * @example
374
391
  * ```ts
375
- * const value = table_getRowCount(table)
392
+ * const rows = table_getRowCount(table)
376
393
  * ```
377
394
  */
378
395
  export function table_getRowCount<
@@ -18,7 +18,9 @@ export interface TableOptions_RowPinning<
18
18
  TData extends RowData,
19
19
  > {
20
20
  /**
21
- * Enables/disables row pinning for the table. Defaults to `true`.
21
+ * Allows rows to be pinned to top or bottom regions.
22
+ *
23
+ * Provide a predicate to decide per row. Defaults to `true`.
22
24
  */
23
25
  enableRowPinning?: boolean | ((row: Row<TFeatures, TData>) => boolean)
24
26
  /**
@@ -39,7 +41,7 @@ export interface RowPinningDefaultOptions {
39
41
 
40
42
  export interface Row_RowPinning {
41
43
  /**
42
- * Returns whether or not the row can be pinned.
44
+ * Checks whether this row can be pinned.
43
45
  */
44
46
  getCanPin: () => boolean
45
47
  /**
@@ -65,27 +67,29 @@ export interface Table_RowPinning<
65
67
  TData extends RowData,
66
68
  > {
67
69
  /**
68
- * Returns all bottom pinned rows.
70
+ * Gets rows pinned to the bottom region.
69
71
  */
70
72
  getBottomRows: () => Array<Row<TFeatures, TData>>
71
73
  /**
72
- * Returns all rows that are not pinned to the top or bottom.
74
+ * Gets rows that are not pinned to the top or bottom region.
73
75
  */
74
76
  getCenterRows: () => Array<Row<TFeatures, TData>>
75
77
  /**
76
- * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.
78
+ * Checks whether any rows are pinned, optionally limited to one region.
77
79
  */
78
80
  getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean
79
81
  /**
80
- * Returns all top pinned rows.
82
+ * Gets rows pinned to the top region.
81
83
  */
82
84
  getTopRows: () => Array<Row<TFeatures, TData>>
83
85
  /**
84
- * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.
86
+ * Resets `rowPinning` to `initialState.rowPinning`.
87
+ *
88
+ * Pass `true` to ignore initial state and reset to empty top/bottom arrays.
85
89
  */
86
90
  resetRowPinning: (defaultState?: boolean) => void
87
91
  /**
88
- * Sets row pinning state using a value or updater.
92
+ * Updates row pinning state with a next state or updater function.
89
93
  */
90
94
  setRowPinning: (updater: Updater<RowPinningState>) => void
91
95
  }