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

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 +28 -19
  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 +28 -19
  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 +61 -44
  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 +61 -44
  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 +28 -19
  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 +61 -44
  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
@@ -14,13 +14,14 @@ import type { ColumnSizingState } from '../column-sizing/columnSizingFeature.typ
14
14
  import type { columnResizingState } from './columnResizingFeature.types'
15
15
 
16
16
  /**
17
- * Returns the default column resizing state.
17
+ * Creates the default transient column resizing state.
18
18
  *
19
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
19
+ * The feature default represents no active drag interaction. Reset APIs use
20
+ * this value when `defaultState` is `true`.
20
21
  *
21
22
  * @example
22
23
  * ```ts
23
- * const initialValue = getDefaultColumnResizingState()
24
+ * const resizeInfo = getDefaultColumnResizingState()
24
25
  * ```
25
26
  */
26
27
  export function getDefaultColumnResizingState(): columnResizingState {
@@ -35,13 +36,14 @@ export function getDefaultColumnResizingState(): columnResizingState {
35
36
  }
36
37
 
37
38
  /**
38
- * Returns whether a column can use resize.
39
+ * Checks whether this column can start a resize interaction.
39
40
  *
40
- * This combines column options, table options, and any required accessor or feature state for the capability.
41
+ * Both `columnDef.enableResizing` and table `enableColumnResizing` default to
42
+ * `true`.
41
43
  *
42
44
  * @example
43
45
  * ```ts
44
- * const value = column_getCanResize(column)
46
+ * const canResize = column_getCanResize(column)
45
47
  * ```
46
48
  */
47
49
  export function column_getCanResize<
@@ -56,13 +58,13 @@ export function column_getCanResize<
56
58
  }
57
59
 
58
60
  /**
59
- * Returns is resizing for a column.
61
+ * Checks whether this column is the active column resize target.
60
62
  *
61
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
63
+ * The value is read from `state.columnResizing.isResizingColumn`.
62
64
  *
63
65
  * @example
64
66
  * ```ts
65
- * const value = column_getIsResizing(column)
67
+ * const isResizing = column_getIsResizing(column)
66
68
  * ```
67
69
  */
68
70
  export function column_getIsResizing<
@@ -76,9 +78,11 @@ export function column_getIsResizing<
76
78
  }
77
79
 
78
80
  /**
79
- * Returns resize handler for a header.
81
+ * Creates the pointer/touch start handler for resizing a header.
80
82
  *
81
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
83
+ * The handler records starting sizes for all leaf headers, tracks drag deltas,
84
+ * writes transient resize info, and commits column sizes on change or drag end
85
+ * depending on `columnResizeMode`.
82
86
  *
83
87
  * @example
84
88
  * ```ts
@@ -263,13 +267,14 @@ export function header_getResizeHandler<
263
267
  }
264
268
 
265
269
  /**
266
- * Updates the table's column resizing state slice.
270
+ * Routes a transient column resizing updater through the table's resize handler.
267
271
  *
268
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
272
+ * This state tracks the active drag interaction; committed widths live in
273
+ * `columnSizing`.
269
274
  *
270
275
  * @example
271
276
  * ```ts
272
- * table_setColumnResizing(table, (old) => old)
277
+ * table_setColumnResizing(table, (old) => ({ ...old, deltaOffset: 12 }))
273
278
  * ```
274
279
  */
275
280
  export function table_setColumnResizing<
@@ -283,9 +288,11 @@ export function table_setColumnResizing<
283
288
  }
284
289
 
285
290
  /**
286
- * Resets the table's header size info state slice.
291
+ * Resets `columnResizing` to the configured initial state or feature default.
287
292
  *
288
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
293
+ * With no argument, the reset clones `table.initialState.columnResizing` when
294
+ * it exists. Passing `true` ignores initial state and resets to the no-drag
295
+ * default state.
289
296
  *
290
297
  * @example
291
298
  * ```ts
@@ -310,7 +317,8 @@ export function table_resetHeaderSizeInfo<
310
317
  /**
311
318
  * Detects whether the current environment supports passive event listeners.
312
319
  *
313
- * Column resizing uses this to register pointer and touch listeners with the safest available options.
320
+ * Column resizing uses this to register pointer and touch listeners with
321
+ * `passive: false` only when the environment understands passive options.
314
322
  *
315
323
  * @example
316
324
  * ```ts
@@ -343,9 +351,10 @@ export function passiveEventSupported() {
343
351
  }
344
352
 
345
353
  /**
346
- * Returns whether an event is a touch-start event.
354
+ * Narrows an unknown event to a `touchstart` event.
347
355
  *
348
- * Column resizing uses this to normalize mouse and touch resize interactions.
356
+ * Column resizing uses this before reading touch coordinates and installing
357
+ * touch-specific listeners.
349
358
  *
350
359
  * @example
351
360
  * ```ts
@@ -23,19 +23,19 @@ export type ColumnSizingDefaultOptions = Pick<
23
23
 
24
24
  export interface Table_ColumnSizing {
25
25
  /**
26
- * If pinning, returns the total size of the center portion of the table by calculating the sum of the sizes of all unpinned/center leaf-columns.
26
+ * Sums the current sizes of visible center-region leaf columns.
27
27
  */
28
28
  getCenterTotalSize: () => number
29
29
  /**
30
- * Returns the total size of the left portion of the table by calculating the sum of the sizes of all left leaf-columns.
30
+ * Sums the current sizes of visible left-pinned leaf columns.
31
31
  */
32
32
  getLeftTotalSize: () => number
33
33
  /**
34
- * Returns the total size of the right portion of the table by calculating the sum of the sizes of all right leaf-columns.
34
+ * Sums the current sizes of visible right-pinned leaf columns.
35
35
  */
36
36
  getRightTotalSize: () => number
37
37
  /**
38
- * Returns the total size of the table by calculating the sum of the sizes of all leaf-columns.
38
+ * Sums the current sizes of all visible leaf columns.
39
39
  */
40
40
  getTotalSize: () => number
41
41
  /**
@@ -44,37 +44,44 @@ export interface Table_ColumnSizing {
44
44
  */
45
45
  resetColumnSizing: (defaultState?: boolean) => void
46
46
  /**
47
- * Sets committed column sizing state using a value or updater.
47
+ * Updates committed column sizing state with a next map or updater function.
48
48
  */
49
49
  setColumnSizing: (updater: Updater<ColumnSizingState>) => void
50
50
  }
51
51
 
52
52
  export interface ColumnDef_ColumnSizing {
53
53
  /**
54
- * The maximum allowed size for the column
54
+ * Upper bound used when resolving this column's size.
55
55
  */
56
56
  maxSize?: number
57
57
  /**
58
- * The minimum allowed size for the column
58
+ * Lower bound used when resolving this column's size.
59
59
  */
60
60
  minSize?: number
61
61
  /**
62
- * The desired size for the column
62
+ * Initial size used before column sizing state overrides it.
63
63
  */
64
64
  size?: number
65
65
  }
66
66
 
67
67
  export interface Column_ColumnSizing {
68
68
  /**
69
- * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all succeeding (right) headers in relation to the current column.
69
+ * Measures the offset from this column's end edge to the end of its region.
70
+ *
71
+ * Pass a pinned region to measure within that region. The value is the sum
72
+ * of visible leaf column sizes after this column.
70
73
  */
71
74
  getAfter: (position?: ColumnPinningPosition | 'center') => number
72
75
  /**
73
- * Returns the current size of the column.
76
+ * Resolves the column's current size after state and min/max constraints.
74
77
  */
75
78
  getSize: () => number
76
79
  /**
77
- * Returns the offset measurement along the row-axis (usually the x-axis for standard tables) for the header. This is effectively a sum of the offset measurements of all preceding (left) headers in relation to the current column.
80
+ * Measures the offset from the start of this column's region to its start
81
+ * edge.
82
+ *
83
+ * Pass a pinned region to measure within that region. The value is the sum
84
+ * of visible leaf column sizes before this column.
78
85
  */
79
86
  getStart: (position?: ColumnPinningPosition | 'center') => number
80
87
  /**
@@ -85,7 +92,7 @@ export interface Column_ColumnSizing {
85
92
 
86
93
  export interface Header_ColumnSizing {
87
94
  /**
88
- * Returns the current size of the header.
95
+ * Computes this header's rendered size from its leaf columns.
89
96
  */
90
97
  getSize: () => number
91
98
  /**
@@ -15,13 +15,14 @@ import type { Column_Internal } from '../../types/Column'
15
15
  import type { ColumnSizingState } from './columnSizingFeature.types'
16
16
 
17
17
  /**
18
- * Returns the default column sizing state.
18
+ * Creates the default committed column sizing state.
19
19
  *
20
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
20
+ * The feature default is an empty map, so columns fall back to their column def
21
+ * size or the built-in sizing defaults.
21
22
  *
22
23
  * @example
23
24
  * ```ts
24
- * const initialValue = getDefaultColumnSizingState()
25
+ * const sizing = getDefaultColumnSizingState()
25
26
  * ```
26
27
  */
27
28
  export function getDefaultColumnSizingState(): ColumnSizingState {
@@ -29,13 +30,15 @@ export function getDefaultColumnSizingState(): ColumnSizingState {
29
30
  }
30
31
 
31
32
  /**
32
- * Returns the default column sizing column def.
33
+ * Creates the built-in sizing defaults for column definitions.
33
34
  *
34
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
35
+ * Columns default to `size: 150`, `minSize: 20`, and
36
+ * `maxSize: Number.MAX_SAFE_INTEGER` unless overridden by column definitions or
37
+ * table defaults.
35
38
  *
36
39
  * @example
37
40
  * ```ts
38
- * const initialValue = getDefaultColumnSizingColumnDef()
41
+ * const defaults = getDefaultColumnSizingColumnDef()
39
42
  * ```
40
43
  */
41
44
  export function getDefaultColumnSizingColumnDef() {
@@ -47,13 +50,14 @@ export function getDefaultColumnSizingColumnDef() {
47
50
  }
48
51
 
49
52
  /**
50
- * Returns size for a column.
53
+ * Resolves a column's current pixel size.
51
54
  *
52
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
55
+ * Committed `state.columnSizing[column.id]` wins over `columnDef.size`, then the
56
+ * built-in default size. The result is clamped between min and max size.
53
57
  *
54
58
  * @example
55
59
  * ```ts
56
- * const value = column_getSize(column)
60
+ * const width = column_getSize(column)
57
61
  * ```
58
62
  */
59
63
  export function column_getSize<
@@ -74,13 +78,14 @@ export function column_getSize<
74
78
  }
75
79
 
76
80
  /**
77
- * Returns start for a column.
81
+ * Computes the offset from the start edge of a pinning region to this column.
78
82
  *
79
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
83
+ * The value is the sum of all previous visible leaf column sizes in the
84
+ * requested `'left'`, `'center'`, or `'right'` region.
80
85
  *
81
86
  * @example
82
87
  * ```ts
83
- * const value = column_getStart(column)
88
+ * const leftOffset = column_getStart(column, 'left')
84
89
  * ```
85
90
  */
86
91
  export function column_getStart<
@@ -114,13 +119,14 @@ export function column_getStart<
114
119
  }
115
120
 
116
121
  /**
117
- * Returns after for a column.
122
+ * Computes the offset from the end edge of a pinning region after this column.
118
123
  *
119
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
124
+ * The value is the sum of all following visible leaf column sizes in the
125
+ * requested region.
120
126
  *
121
127
  * @example
122
128
  * ```ts
123
- * const value = column_getAfter(column)
129
+ * const rightOffset = column_getAfter(column, 'right')
124
130
  * ```
125
131
  */
126
132
  export function column_getAfter<
@@ -153,13 +159,14 @@ export function column_getAfter<
153
159
  }
154
160
 
155
161
  /**
156
- * Reset Size. for a column.
162
+ * Removes this column's committed size override.
157
163
  *
158
- * This is the static implementation behind the matching column instance API.
164
+ * After reset, the column resolves size from `columnDef.size` or built-in
165
+ * defaults again.
159
166
  *
160
167
  * @example
161
168
  * ```ts
162
- * const value = column_resetSize(column)
169
+ * column_resetSize(column)
163
170
  * ```
164
171
  */
165
172
  export function column_resetSize<
@@ -173,13 +180,14 @@ export function column_resetSize<
173
180
  }
174
181
 
175
182
  /**
176
- * Returns size for a header.
183
+ * Computes a header's rendered size from its leaf headers.
177
184
  *
178
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
185
+ * Group headers sum the sizes of all descendant leaf columns. Leaf headers use
186
+ * their column's current size.
179
187
  *
180
188
  * @example
181
189
  * ```ts
182
- * const value = header_getSize(header)
190
+ * const width = header_getSize(header)
183
191
  * ```
184
192
  */
185
193
  export function header_getSize<
@@ -203,13 +211,14 @@ export function header_getSize<
203
211
  }
204
212
 
205
213
  /**
206
- * Returns start for a header.
214
+ * Computes a header's offset from the start of its header group.
207
215
  *
208
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
216
+ * The offset is the previous sibling header's start plus size, or `0` for the
217
+ * first header in the group.
209
218
  *
210
219
  * @example
211
220
  * ```ts
212
- * const value = header_getStart(header)
221
+ * const offset = header_getStart(header)
213
222
  * ```
214
223
  */
215
224
  export function header_getStart<
@@ -233,13 +242,14 @@ export function header_getStart<
233
242
  // Table APIs
234
243
 
235
244
  /**
236
- * Updates the table's column sizing state slice.
245
+ * Routes a committed column sizing updater through the table's sizing handler.
237
246
  *
238
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
247
+ * The updater may be a next size map or a function of the previous map,
248
+ * matching the instance `table.setColumnSizing` behavior.
239
249
  *
240
250
  * @example
241
251
  * ```ts
242
- * table_setColumnSizing(table, (old) => old)
252
+ * table_setColumnSizing(table, (old) => ({ ...old, age: 96 }))
243
253
  * ```
244
254
  */
245
255
  export function table_setColumnSizing<
@@ -253,9 +263,10 @@ export function table_setColumnSizing<
253
263
  }
254
264
 
255
265
  /**
256
- * Resets the table's column sizing state slice.
266
+ * Resets `columnSizing` to the configured initial state or feature default.
257
267
  *
258
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
268
+ * With no argument, the reset clones `table.initialState.columnSizing` when it
269
+ * exists. Passing `true` ignores initial state and resets to `{}`.
259
270
  *
260
271
  * @example
261
272
  * ```ts
@@ -274,13 +285,13 @@ export function table_resetColumnSizing<
274
285
  }
275
286
 
276
287
  /**
277
- * Returns total size for the table.
288
+ * Sums the rendered size of the full table header row.
278
289
  *
279
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
290
+ * This includes left, center, and right columns in the main header group.
280
291
  *
281
292
  * @example
282
293
  * ```ts
283
- * const value = table_getTotalSize(table)
294
+ * const width = table_getTotalSize(table)
284
295
  * ```
285
296
  */
286
297
  export function table_getTotalSize<
@@ -295,13 +306,13 @@ export function table_getTotalSize<
295
306
  }
296
307
 
297
308
  /**
298
- * Returns left total size for the table.
309
+ * Sums the rendered size of the left pinned header region.
299
310
  *
300
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
311
+ * An empty left pinning region returns `0`.
301
312
  *
302
313
  * @example
303
314
  * ```ts
304
- * const value = table_getLeftTotalSize(table)
315
+ * const width = table_getLeftTotalSize(table)
305
316
  * ```
306
317
  */
307
318
  export function table_getLeftTotalSize<
@@ -320,13 +331,13 @@ export function table_getLeftTotalSize<
320
331
  }
321
332
 
322
333
  /**
323
- * Returns center total size for the table.
334
+ * Sums the rendered size of the center, unpinned header region.
324
335
  *
325
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
336
+ * An empty center region returns `0`.
326
337
  *
327
338
  * @example
328
339
  * ```ts
329
- * const value = table_getCenterTotalSize(table)
340
+ * const width = table_getCenterTotalSize(table)
330
341
  * ```
331
342
  */
332
343
  export function table_getCenterTotalSize<
@@ -345,13 +356,13 @@ export function table_getCenterTotalSize<
345
356
  }
346
357
 
347
358
  /**
348
- * Returns right total size for the table.
359
+ * Sums the rendered size of the right pinned header region.
349
360
  *
350
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
361
+ * An empty right pinning region returns `0`.
351
362
  *
352
363
  * @example
353
364
  * ```ts
354
- * const value = table_getRightTotalSize(table)
365
+ * const width = table_getRightTotalSize(table)
355
366
  * ```
356
367
  */
357
368
  export function table_getRightTotalSize<
@@ -32,31 +32,34 @@ export interface Table_ColumnVisibility<
32
32
  TData extends RowData,
33
33
  > {
34
34
  /**
35
- * Returns whether all columns are visible
35
+ * Checks whether every leaf column is currently visible.
36
36
  */
37
37
  getIsAllColumnsVisible: () => boolean
38
38
  /**
39
- * Returns whether any columns are visible
39
+ * Checks whether at least one leaf column is currently visible.
40
40
  */
41
41
  getIsSomeColumnsVisible: () => boolean
42
42
  /**
43
- * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.
43
+ * Creates a checkbox-style handler that shows or hides all columns.
44
44
  */
45
45
  getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void
46
46
  /**
47
- * Returns a flat array of columns that are visible, including parent columns.
47
+ * Lists visible columns in flat table order, including parent columns that
48
+ * have visible descendants.
48
49
  */
49
50
  getVisibleFlatColumns: () => Array<Column<TFeatures, TData, unknown>>
50
51
  /**
51
- * Returns a flat array of leaf-node columns that are visible.
52
+ * Lists visible leaf columns in the order used for row cells and headers.
52
53
  */
53
54
  getVisibleLeafColumns: () => Array<Column<TFeatures, TData, unknown>>
54
55
  /**
55
- * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`
56
+ * Resets `columnVisibility` to `initialState.columnVisibility`.
57
+ *
58
+ * Pass `true` to ignore initial state and reset to `{}`.
56
59
  */
57
60
  resetColumnVisibility: (defaultState?: boolean) => void
58
61
  /**
59
- * Sets column visibility state using a value or updater.
62
+ * Updates column visibility state with a next map or updater function.
60
63
  */
61
64
  setColumnVisibility: (updater: Updater<ColumnVisibilityState>) => void
62
65
  /**
@@ -67,7 +70,7 @@ export interface Table_ColumnVisibility<
67
70
 
68
71
  export interface ColumnDef_ColumnVisibility {
69
72
  /**
70
- * Enables/disables column hiding for this column. Defaults to `true`.
73
+ * Allows this column to be hidden. Defaults to `true`.
71
74
  */
72
75
  enableHiding?: boolean
73
76
  }
@@ -77,11 +80,11 @@ export interface Row_ColumnVisibility<
77
80
  TData extends RowData,
78
81
  > {
79
82
  /**
80
- * Returns an array of cells that account for column visibility for the row.
83
+ * Gets this row's cells for currently visible columns.
81
84
  */
82
85
  getVisibleCells: () => Array<Cell<TFeatures, TData, unknown>>
83
86
  /**
84
- * Returns visible cells by column id for the row.
87
+ * Maps this row's currently visible cells by column id.
85
88
  */
86
89
  getVisibleCellsByColumnId: () => Record<
87
90
  string,
@@ -91,15 +94,15 @@ export interface Row_ColumnVisibility<
91
94
 
92
95
  export interface Column_ColumnVisibility {
93
96
  /**
94
- * Returns whether the column can be hidden
97
+ * Checks whether this column is allowed to be hidden.
95
98
  */
96
99
  getCanHide: () => boolean
97
100
  /**
98
- * Returns whether the column is visible
101
+ * Checks whether this column is currently visible.
99
102
  */
100
103
  getIsVisible: () => boolean
101
104
  /**
102
- * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.
105
+ * Creates a checkbox-style handler that toggles this column's visibility.
103
106
  */
104
107
  getToggleVisibilityHandler: () => (event: unknown) => void
105
108
  /**