@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
@@ -8,24 +8,27 @@ import { Table_Internal } from "../../types/Table.js";
8
8
 
9
9
  //#region src/features/column-sizing/columnSizingFeature.utils.d.ts
10
10
  /**
11
- * Returns the default column sizing state.
11
+ * Creates the default committed column sizing state.
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 is an empty map, so columns fall back to their column def
14
+ * size or the built-in sizing defaults.
14
15
  *
15
16
  * @example
16
17
  * ```ts
17
- * const initialValue = getDefaultColumnSizingState()
18
+ * const sizing = getDefaultColumnSizingState()
18
19
  * ```
19
20
  */
20
21
  declare function getDefaultColumnSizingState(): ColumnSizingState;
21
22
  /**
22
- * Returns the default column sizing column def.
23
+ * Creates the built-in sizing defaults for column definitions.
23
24
  *
24
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
25
+ * Columns default to `size: 150`, `minSize: 20`, and
26
+ * `maxSize: Number.MAX_SAFE_INTEGER` unless overridden by column definitions or
27
+ * table defaults.
25
28
  *
26
29
  * @example
27
30
  * ```ts
28
- * const initialValue = getDefaultColumnSizingColumnDef()
31
+ * const defaults = getDefaultColumnSizingColumnDef()
29
32
  * ```
30
33
  */
31
34
  declare function getDefaultColumnSizingColumnDef(): {
@@ -34,86 +37,94 @@ declare function getDefaultColumnSizingColumnDef(): {
34
37
  maxSize: number;
35
38
  };
36
39
  /**
37
- * Returns size for a column.
40
+ * Resolves a column's current pixel size.
38
41
  *
39
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
42
+ * Committed `state.columnSizing[column.id]` wins over `columnDef.size`, then the
43
+ * built-in default size. The result is clamped between min and max size.
40
44
  *
41
45
  * @example
42
46
  * ```ts
43
- * const value = column_getSize(column)
47
+ * const width = column_getSize(column)
44
48
  * ```
45
49
  */
46
50
  declare function column_getSize<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): number;
47
51
  /**
48
- * Returns start for a column.
52
+ * Computes the offset from the start edge of a pinning region to this column.
49
53
  *
50
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
54
+ * The value is the sum of all previous visible leaf column sizes in the
55
+ * requested `'left'`, `'center'`, or `'right'` region.
51
56
  *
52
57
  * @example
53
58
  * ```ts
54
- * const value = column_getStart(column)
59
+ * const leftOffset = column_getStart(column, 'left')
55
60
  * ```
56
61
  */
57
62
  declare function column_getStart<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, position: ColumnPinningPosition | 'center'): number;
58
63
  /**
59
- * Returns after for a column.
64
+ * Computes the offset from the end edge of a pinning region after this column.
60
65
  *
61
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
66
+ * The value is the sum of all following visible leaf column sizes in the
67
+ * requested region.
62
68
  *
63
69
  * @example
64
70
  * ```ts
65
- * const value = column_getAfter(column)
71
+ * const rightOffset = column_getAfter(column, 'right')
66
72
  * ```
67
73
  */
68
74
  declare function column_getAfter<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, position: ColumnPinningPosition | 'center'): number;
69
75
  /**
70
- * Reset Size. for a column.
76
+ * Removes this column's committed size override.
71
77
  *
72
- * This is the static implementation behind the matching column instance API.
78
+ * After reset, the column resolves size from `columnDef.size` or built-in
79
+ * defaults again.
73
80
  *
74
81
  * @example
75
82
  * ```ts
76
- * const value = column_resetSize(column)
83
+ * column_resetSize(column)
77
84
  * ```
78
85
  */
79
86
  declare function column_resetSize<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): void;
80
87
  /**
81
- * Returns size for a header.
88
+ * Computes a header's rendered size from its leaf headers.
82
89
  *
83
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
90
+ * Group headers sum the sizes of all descendant leaf columns. Leaf headers use
91
+ * their column's current size.
84
92
  *
85
93
  * @example
86
94
  * ```ts
87
- * const value = header_getSize(header)
95
+ * const width = header_getSize(header)
88
96
  * ```
89
97
  */
90
98
  declare function header_getSize<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(header: Header<TFeatures, TData, TValue>): number;
91
99
  /**
92
- * Returns start for a header.
100
+ * Computes a header's offset from the start of its header group.
93
101
  *
94
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
102
+ * The offset is the previous sibling header's start plus size, or `0` for the
103
+ * first header in the group.
95
104
  *
96
105
  * @example
97
106
  * ```ts
98
- * const value = header_getStart(header)
107
+ * const offset = header_getStart(header)
99
108
  * ```
100
109
  */
101
110
  declare function header_getStart<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(header: Header<TFeatures, TData, TValue>): number;
102
111
  /**
103
- * Updates the table's column sizing state slice.
112
+ * Routes a committed column sizing updater through the table's sizing handler.
104
113
  *
105
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
114
+ * The updater may be a next size map or a function of the previous map,
115
+ * matching the instance `table.setColumnSizing` behavior.
106
116
  *
107
117
  * @example
108
118
  * ```ts
109
- * table_setColumnSizing(table, (old) => old)
119
+ * table_setColumnSizing(table, (old) => ({ ...old, age: 96 }))
110
120
  * ```
111
121
  */
112
122
  declare function table_setColumnSizing<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<ColumnSizingState>): void;
113
123
  /**
114
- * Resets the table's column sizing state slice.
124
+ * Resets `columnSizing` to the configured initial state or feature default.
115
125
  *
116
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
126
+ * With no argument, the reset clones `table.initialState.columnSizing` when it
127
+ * exists. Passing `true` ignores initial state and resets to `{}`.
117
128
  *
118
129
  * @example
119
130
  * ```ts
@@ -123,46 +134,46 @@ declare function table_setColumnSizing<TFeatures extends TableFeatures, TData ex
123
134
  */
124
135
  declare function table_resetColumnSizing<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
125
136
  /**
126
- * Returns total size for the table.
137
+ * Sums the rendered size of the full table header row.
127
138
  *
128
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
139
+ * This includes left, center, and right columns in the main header group.
129
140
  *
130
141
  * @example
131
142
  * ```ts
132
- * const value = table_getTotalSize(table)
143
+ * const width = table_getTotalSize(table)
133
144
  * ```
134
145
  */
135
146
  declare function table_getTotalSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number;
136
147
  /**
137
- * Returns left total size for the table.
148
+ * Sums the rendered size of the left pinned header region.
138
149
  *
139
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
150
+ * An empty left pinning region returns `0`.
140
151
  *
141
152
  * @example
142
153
  * ```ts
143
- * const value = table_getLeftTotalSize(table)
154
+ * const width = table_getLeftTotalSize(table)
144
155
  * ```
145
156
  */
146
157
  declare function table_getLeftTotalSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): any;
147
158
  /**
148
- * Returns center total size for the table.
159
+ * Sums the rendered size of the center, unpinned header region.
149
160
  *
150
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
161
+ * An empty center region returns `0`.
151
162
  *
152
163
  * @example
153
164
  * ```ts
154
- * const value = table_getCenterTotalSize(table)
165
+ * const width = table_getCenterTotalSize(table)
155
166
  * ```
156
167
  */
157
168
  declare function table_getCenterTotalSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): any;
158
169
  /**
159
- * Returns right total size for the table.
170
+ * Sums the rendered size of the right pinned header region.
160
171
  *
161
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
172
+ * An empty right pinning region returns `0`.
162
173
  *
163
174
  * @example
164
175
  * ```ts
165
- * const value = table_getRightTotalSize(table)
176
+ * const width = table_getRightTotalSize(table)
166
177
  * ```
167
178
  */
168
179
  declare function table_getRightTotalSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): any;
@@ -4,26 +4,29 @@ import { column_getIndex } from "../column-ordering/columnOrderingFeature.utils.
4
4
 
5
5
  //#region src/features/column-sizing/columnSizingFeature.utils.ts
6
6
  /**
7
- * Returns the default column sizing state.
7
+ * Creates the default committed column sizing state.
8
8
  *
9
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
9
+ * The feature default is an empty map, so columns fall back to their column def
10
+ * size or the built-in sizing defaults.
10
11
  *
11
12
  * @example
12
13
  * ```ts
13
- * const initialValue = getDefaultColumnSizingState()
14
+ * const sizing = getDefaultColumnSizingState()
14
15
  * ```
15
16
  */
16
17
  function getDefaultColumnSizingState() {
17
18
  return {};
18
19
  }
19
20
  /**
20
- * Returns the default column sizing column def.
21
+ * Creates the built-in sizing defaults for column definitions.
21
22
  *
22
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
23
+ * Columns default to `size: 150`, `minSize: 20`, and
24
+ * `maxSize: Number.MAX_SAFE_INTEGER` unless overridden by column definitions or
25
+ * table defaults.
23
26
  *
24
27
  * @example
25
28
  * ```ts
26
- * const initialValue = getDefaultColumnSizingColumnDef()
29
+ * const defaults = getDefaultColumnSizingColumnDef()
27
30
  * ```
28
31
  */
29
32
  function getDefaultColumnSizingColumnDef() {
@@ -34,13 +37,14 @@ function getDefaultColumnSizingColumnDef() {
34
37
  };
35
38
  }
36
39
  /**
37
- * Returns size for a column.
40
+ * Resolves a column's current pixel size.
38
41
  *
39
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
42
+ * Committed `state.columnSizing[column.id]` wins over `columnDef.size`, then the
43
+ * built-in default size. The result is clamped between min and max size.
40
44
  *
41
45
  * @example
42
46
  * ```ts
43
- * const value = column_getSize(column)
47
+ * const width = column_getSize(column)
44
48
  * ```
45
49
  */
46
50
  function column_getSize(column) {
@@ -50,13 +54,14 @@ function column_getSize(column) {
50
54
  return Math.min(Math.max(column.columnDef.minSize ?? defaultSizes.minSize, columnSize ?? column.columnDef.size ?? defaultSizes.size), column.columnDef.maxSize ?? defaultSizes.maxSize);
51
55
  }
52
56
  /**
53
- * Returns start for a column.
57
+ * Computes the offset from the start edge of a pinning region to this column.
54
58
  *
55
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
59
+ * The value is the sum of all previous visible leaf column sizes in the
60
+ * requested `'left'`, `'center'`, or `'right'` region.
56
61
  *
57
62
  * @example
58
63
  * ```ts
59
- * const value = column_getStart(column)
64
+ * const leftOffset = column_getStart(column, 'left')
60
65
  * ```
61
66
  */
62
67
  function column_getStart(column, position) {
@@ -66,13 +71,14 @@ function column_getStart(column, position) {
66
71
  return callMemoOrStaticFn(prevColumn, "getStart", column_getStart, position) + callMemoOrStaticFn(prevColumn, "getSize", column_getSize);
67
72
  }
68
73
  /**
69
- * Returns after for a column.
74
+ * Computes the offset from the end edge of a pinning region after this column.
70
75
  *
71
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
76
+ * The value is the sum of all following visible leaf column sizes in the
77
+ * requested region.
72
78
  *
73
79
  * @example
74
80
  * ```ts
75
- * const value = column_getAfter(column)
81
+ * const rightOffset = column_getAfter(column, 'right')
76
82
  * ```
77
83
  */
78
84
  function column_getAfter(column, position) {
@@ -83,13 +89,14 @@ function column_getAfter(column, position) {
83
89
  return callMemoOrStaticFn(nextColumn, "getSize", column_getSize) + callMemoOrStaticFn(nextColumn, "getAfter", column_getAfter, position);
84
90
  }
85
91
  /**
86
- * Reset Size. for a column.
92
+ * Removes this column's committed size override.
87
93
  *
88
- * This is the static implementation behind the matching column instance API.
94
+ * After reset, the column resolves size from `columnDef.size` or built-in
95
+ * defaults again.
89
96
  *
90
97
  * @example
91
98
  * ```ts
92
- * const value = column_resetSize(column)
99
+ * column_resetSize(column)
93
100
  * ```
94
101
  */
95
102
  function column_resetSize(column) {
@@ -98,13 +105,14 @@ function column_resetSize(column) {
98
105
  });
99
106
  }
100
107
  /**
101
- * Returns size for a header.
108
+ * Computes a header's rendered size from its leaf headers.
102
109
  *
103
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
110
+ * Group headers sum the sizes of all descendant leaf columns. Leaf headers use
111
+ * their column's current size.
104
112
  *
105
113
  * @example
106
114
  * ```ts
107
- * const value = header_getSize(header)
115
+ * const width = header_getSize(header)
108
116
  * ```
109
117
  */
110
118
  function header_getSize(header) {
@@ -117,13 +125,14 @@ function header_getSize(header) {
117
125
  return sum;
118
126
  }
119
127
  /**
120
- * Returns start for a header.
128
+ * Computes a header's offset from the start of its header group.
121
129
  *
122
- * This is the static implementation behind the matching header instance API and can account for nested header groups.
130
+ * The offset is the previous sibling header's start plus size, or `0` for the
131
+ * first header in the group.
123
132
  *
124
133
  * @example
125
134
  * ```ts
126
- * const value = header_getStart(header)
135
+ * const offset = header_getStart(header)
127
136
  * ```
128
137
  */
129
138
  function header_getStart(header) {
@@ -135,13 +144,14 @@ function header_getStart(header) {
135
144
  return 0;
136
145
  }
137
146
  /**
138
- * Updates the table's column sizing state slice.
147
+ * Routes a committed column sizing updater through the table's sizing handler.
139
148
  *
140
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
149
+ * The updater may be a next size map or a function of the previous map,
150
+ * matching the instance `table.setColumnSizing` behavior.
141
151
  *
142
152
  * @example
143
153
  * ```ts
144
- * table_setColumnSizing(table, (old) => old)
154
+ * table_setColumnSizing(table, (old) => ({ ...old, age: 96 }))
145
155
  * ```
146
156
  */
147
157
  function table_setColumnSizing(table, updater) {
@@ -149,9 +159,10 @@ function table_setColumnSizing(table, updater) {
149
159
  (_table$options$onColu = (_table$options = table.options).onColumnSizingChange) === null || _table$options$onColu === void 0 || _table$options$onColu.call(_table$options, updater);
150
160
  }
151
161
  /**
152
- * Resets the table's column sizing state slice.
162
+ * Resets `columnSizing` to the configured initial state or feature default.
153
163
  *
154
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
164
+ * With no argument, the reset clones `table.initialState.columnSizing` when it
165
+ * exists. Passing `true` ignores initial state and resets to `{}`.
155
166
  *
156
167
  * @example
157
168
  * ```ts
@@ -163,13 +174,13 @@ function table_resetColumnSizing(table, defaultState) {
163
174
  table_setColumnSizing(table, defaultState ? {} : cloneState(table.initialState.columnSizing ?? {}));
164
175
  }
165
176
  /**
166
- * Returns total size for the table.
177
+ * Sums the rendered size of the full table header row.
167
178
  *
168
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
179
+ * This includes left, center, and right columns in the main header group.
169
180
  *
170
181
  * @example
171
182
  * ```ts
172
- * const value = table_getTotalSize(table)
183
+ * const width = table_getTotalSize(table)
173
184
  * ```
174
185
  */
175
186
  function table_getTotalSize(table) {
@@ -179,13 +190,13 @@ function table_getTotalSize(table) {
179
190
  }, 0)) ?? 0;
180
191
  }
181
192
  /**
182
- * Returns left total size for the table.
193
+ * Sums the rendered size of the left pinned header region.
183
194
  *
184
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
195
+ * An empty left pinning region returns `0`.
185
196
  *
186
197
  * @example
187
198
  * ```ts
188
- * const value = table_getLeftTotalSize(table)
199
+ * const width = table_getLeftTotalSize(table)
189
200
  * ```
190
201
  */
191
202
  function table_getLeftTotalSize(table) {
@@ -195,13 +206,13 @@ function table_getLeftTotalSize(table) {
195
206
  }, 0)) ?? 0;
196
207
  }
197
208
  /**
198
- * Returns center total size for the table.
209
+ * Sums the rendered size of the center, unpinned header region.
199
210
  *
200
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
211
+ * An empty center region returns `0`.
201
212
  *
202
213
  * @example
203
214
  * ```ts
204
- * const value = table_getCenterTotalSize(table)
215
+ * const width = table_getCenterTotalSize(table)
205
216
  * ```
206
217
  */
207
218
  function table_getCenterTotalSize(table) {
@@ -211,13 +222,13 @@ function table_getCenterTotalSize(table) {
211
222
  }, 0)) ?? 0;
212
223
  }
213
224
  /**
214
- * Returns right total size for the table.
225
+ * Sums the rendered size of the right pinned header region.
215
226
  *
216
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
227
+ * An empty right pinning region returns `0`.
217
228
  *
218
229
  * @example
219
230
  * ```ts
220
- * const value = table_getRightTotalSize(table)
231
+ * const width = table_getRightTotalSize(table)
221
232
  * ```
222
233
  */
223
234
  function table_getRightTotalSize(table) {
@@ -1 +1 @@
1
- {"version":3,"file":"columnSizingFeature.utils.js","names":[],"sources":["../../../src/features/column-sizing/columnSizingFeature.utils.ts"],"sourcesContent":["import {\n table_getCenterHeaderGroups,\n table_getLeftHeaderGroups,\n table_getPinnedVisibleLeafColumns,\n table_getRightHeaderGroups,\n} from '../column-pinning/columnPinningFeature.utils'\nimport { column_getIndex } from '../column-ordering/columnOrderingFeature.utils'\nimport { callMemoOrStaticFn, cloneState } from '../../utils'\nimport type { ColumnPinningPosition } from '../column-pinning/columnPinningFeature.types'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Header } from '../../types/Header'\nimport type { Column_Internal } from '../../types/Column'\nimport type { ColumnSizingState } from './columnSizingFeature.types'\n\n/**\n * Returns the default column sizing state.\n *\n * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.\n *\n * @example\n * ```ts\n * const initialValue = getDefaultColumnSizingState()\n * ```\n */\nexport function getDefaultColumnSizingState(): ColumnSizingState {\n return {}\n}\n\n/**\n * Returns the default column sizing column def.\n *\n * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.\n *\n * @example\n * ```ts\n * const initialValue = getDefaultColumnSizingColumnDef()\n * ```\n */\nexport function getDefaultColumnSizingColumnDef() {\n return {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n }\n}\n\n/**\n * Returns size for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getSize(column)\n * ```\n */\nexport function column_getSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n const defaultSizes = getDefaultColumnSizingColumnDef()\n const columnSize = column.table.atoms.columnSizing?.get()?.[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultSizes.minSize,\n columnSize ?? column.columnDef.size ?? defaultSizes.size,\n ),\n column.columnDef.maxSize ?? defaultSizes.maxSize,\n )\n}\n\n/**\n * Returns start for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getStart(column)\n * ```\n */\nexport function column_getStart<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n position: ColumnPinningPosition | 'center',\n): number {\n const index = callMemoOrStaticFn(\n column,\n 'getIndex',\n column_getIndex,\n position,\n )\n if (index <= 0) return 0\n\n const visibleLeafColumns = callMemoOrStaticFn(\n column.table,\n 'getPinnedVisibleLeafColumns',\n table_getPinnedVisibleLeafColumns,\n position,\n )\n\n const prevColumn = visibleLeafColumns[index - 1]!\n return (\n callMemoOrStaticFn(prevColumn, 'getStart', column_getStart, position) +\n callMemoOrStaticFn(prevColumn, 'getSize', column_getSize)\n )\n}\n\n/**\n * Returns after for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getAfter(column)\n * ```\n */\nexport function column_getAfter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n position: ColumnPinningPosition | 'center',\n): number {\n const visibleLeafColumns = callMemoOrStaticFn(\n column.table,\n 'getPinnedVisibleLeafColumns',\n table_getPinnedVisibleLeafColumns,\n position,\n )\n const index = callMemoOrStaticFn(\n column,\n 'getIndex',\n column_getIndex,\n position,\n )\n if (index < 0 || index >= visibleLeafColumns.length - 1) return 0\n\n const nextColumn = visibleLeafColumns[index + 1]!\n return (\n callMemoOrStaticFn(nextColumn, 'getSize', column_getSize) +\n callMemoOrStaticFn(nextColumn, 'getAfter', column_getAfter, position)\n )\n}\n\n/**\n * Reset Size. for a column.\n *\n * This is the static implementation behind the matching column instance API.\n *\n * @example\n * ```ts\n * const value = column_resetSize(column)\n * ```\n */\nexport function column_resetSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n table_setColumnSizing(column.table, ({ [column.id]: _, ...rest }) => {\n return rest\n })\n}\n\n/**\n * Returns size for a header.\n *\n * This is the static implementation behind the matching header instance API and can account for nested header groups.\n *\n * @example\n * ```ts\n * const value = header_getSize(header)\n * ```\n */\nexport function header_getSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(header: Header<TFeatures, TData, TValue>) {\n let sum = 0\n\n const recurse = (h: Header<TFeatures, TData, TValue>) => {\n if (h.subHeaders.length) {\n h.subHeaders.forEach(recurse)\n } else {\n sum += column_getSize(h.column)\n }\n }\n\n recurse(header)\n\n return sum\n}\n\n/**\n * Returns start for a header.\n *\n * This is the static implementation behind the matching header instance API and can account for nested header groups.\n *\n * @example\n * ```ts\n * const value = header_getStart(header)\n * ```\n */\nexport function header_getStart<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(header: Header<TFeatures, TData, TValue>): number {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup?.headers[header.index - 1]\n if (prevSiblingHeader) {\n return (\n callMemoOrStaticFn(prevSiblingHeader, 'getStart', header_getStart) +\n callMemoOrStaticFn(prevSiblingHeader, 'getSize', header_getSize)\n )\n }\n }\n\n return 0\n}\n\n// Table APIs\n\n/**\n * Updates the table's column sizing state slice.\n *\n * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.\n *\n * @example\n * ```ts\n * table_setColumnSizing(table, (old) => old)\n * ```\n */\nexport function table_setColumnSizing<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnSizingState>,\n) {\n table.options.onColumnSizingChange?.(updater)\n}\n\n/**\n * Resets the table's column sizing state slice.\n *\n * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.\n *\n * @example\n * ```ts\n * table_resetColumnSizing(table)\n * table_resetColumnSizing(table, true)\n * ```\n */\nexport function table_resetColumnSizing<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnSizing(\n table,\n defaultState ? {} : cloneState(table.initialState.columnSizing ?? {}),\n )\n}\n\n/**\n * Returns total size for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getTotalSize(table)\n * ```\n */\nexport function table_getTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n\n/**\n * Returns left total size for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getLeftTotalSize(table)\n * ```\n */\nexport function table_getLeftTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(\n table,\n 'getLeftHeaderGroups',\n table_getLeftHeaderGroups,\n )[0]?.headers.reduce((sum: number, header: Header<TFeatures, TData>) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n\n/**\n * Returns center total size for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getCenterTotalSize(table)\n * ```\n */\nexport function table_getCenterTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(\n table,\n 'getCenterHeaderGroups',\n table_getCenterHeaderGroups,\n )[0]?.headers.reduce((sum: number, header: Header<TFeatures, TData>) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n\n/**\n * Returns right total size for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getRightTotalSize(table)\n * ```\n */\nexport function table_getRightTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(\n table,\n 'getRightHeaderGroups',\n table_getRightHeaderGroups,\n )[0]?.headers.reduce((sum: number, header: Header<TFeatures, TData>) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"columnSizingFeature.utils.js","names":[],"sources":["../../../src/features/column-sizing/columnSizingFeature.utils.ts"],"sourcesContent":["import {\n table_getCenterHeaderGroups,\n table_getLeftHeaderGroups,\n table_getPinnedVisibleLeafColumns,\n table_getRightHeaderGroups,\n} from '../column-pinning/columnPinningFeature.utils'\nimport { column_getIndex } from '../column-ordering/columnOrderingFeature.utils'\nimport { callMemoOrStaticFn, cloneState } from '../../utils'\nimport type { ColumnPinningPosition } from '../column-pinning/columnPinningFeature.types'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Header } from '../../types/Header'\nimport type { Column_Internal } from '../../types/Column'\nimport type { ColumnSizingState } from './columnSizingFeature.types'\n\n/**\n * Creates the default committed column sizing state.\n *\n * The feature default is an empty map, so columns fall back to their column def\n * size or the built-in sizing defaults.\n *\n * @example\n * ```ts\n * const sizing = getDefaultColumnSizingState()\n * ```\n */\nexport function getDefaultColumnSizingState(): ColumnSizingState {\n return {}\n}\n\n/**\n * Creates the built-in sizing defaults for column definitions.\n *\n * Columns default to `size: 150`, `minSize: 20`, and\n * `maxSize: Number.MAX_SAFE_INTEGER` unless overridden by column definitions or\n * table defaults.\n *\n * @example\n * ```ts\n * const defaults = getDefaultColumnSizingColumnDef()\n * ```\n */\nexport function getDefaultColumnSizingColumnDef() {\n return {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n }\n}\n\n/**\n * Resolves a column's current pixel size.\n *\n * Committed `state.columnSizing[column.id]` wins over `columnDef.size`, then the\n * built-in default size. The result is clamped between min and max size.\n *\n * @example\n * ```ts\n * const width = column_getSize(column)\n * ```\n */\nexport function column_getSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n const defaultSizes = getDefaultColumnSizingColumnDef()\n const columnSize = column.table.atoms.columnSizing?.get()?.[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultSizes.minSize,\n columnSize ?? column.columnDef.size ?? defaultSizes.size,\n ),\n column.columnDef.maxSize ?? defaultSizes.maxSize,\n )\n}\n\n/**\n * Computes the offset from the start edge of a pinning region to this column.\n *\n * The value is the sum of all previous visible leaf column sizes in the\n * requested `'left'`, `'center'`, or `'right'` region.\n *\n * @example\n * ```ts\n * const leftOffset = column_getStart(column, 'left')\n * ```\n */\nexport function column_getStart<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n position: ColumnPinningPosition | 'center',\n): number {\n const index = callMemoOrStaticFn(\n column,\n 'getIndex',\n column_getIndex,\n position,\n )\n if (index <= 0) return 0\n\n const visibleLeafColumns = callMemoOrStaticFn(\n column.table,\n 'getPinnedVisibleLeafColumns',\n table_getPinnedVisibleLeafColumns,\n position,\n )\n\n const prevColumn = visibleLeafColumns[index - 1]!\n return (\n callMemoOrStaticFn(prevColumn, 'getStart', column_getStart, position) +\n callMemoOrStaticFn(prevColumn, 'getSize', column_getSize)\n )\n}\n\n/**\n * Computes the offset from the end edge of a pinning region after this column.\n *\n * The value is the sum of all following visible leaf column sizes in the\n * requested region.\n *\n * @example\n * ```ts\n * const rightOffset = column_getAfter(column, 'right')\n * ```\n */\nexport function column_getAfter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n position: ColumnPinningPosition | 'center',\n): number {\n const visibleLeafColumns = callMemoOrStaticFn(\n column.table,\n 'getPinnedVisibleLeafColumns',\n table_getPinnedVisibleLeafColumns,\n position,\n )\n const index = callMemoOrStaticFn(\n column,\n 'getIndex',\n column_getIndex,\n position,\n )\n if (index < 0 || index >= visibleLeafColumns.length - 1) return 0\n\n const nextColumn = visibleLeafColumns[index + 1]!\n return (\n callMemoOrStaticFn(nextColumn, 'getSize', column_getSize) +\n callMemoOrStaticFn(nextColumn, 'getAfter', column_getAfter, position)\n )\n}\n\n/**\n * Removes this column's committed size override.\n *\n * After reset, the column resolves size from `columnDef.size` or built-in\n * defaults again.\n *\n * @example\n * ```ts\n * column_resetSize(column)\n * ```\n */\nexport function column_resetSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n table_setColumnSizing(column.table, ({ [column.id]: _, ...rest }) => {\n return rest\n })\n}\n\n/**\n * Computes a header's rendered size from its leaf headers.\n *\n * Group headers sum the sizes of all descendant leaf columns. Leaf headers use\n * their column's current size.\n *\n * @example\n * ```ts\n * const width = header_getSize(header)\n * ```\n */\nexport function header_getSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(header: Header<TFeatures, TData, TValue>) {\n let sum = 0\n\n const recurse = (h: Header<TFeatures, TData, TValue>) => {\n if (h.subHeaders.length) {\n h.subHeaders.forEach(recurse)\n } else {\n sum += column_getSize(h.column)\n }\n }\n\n recurse(header)\n\n return sum\n}\n\n/**\n * Computes a header's offset from the start of its header group.\n *\n * The offset is the previous sibling header's start plus size, or `0` for the\n * first header in the group.\n *\n * @example\n * ```ts\n * const offset = header_getStart(header)\n * ```\n */\nexport function header_getStart<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(header: Header<TFeatures, TData, TValue>): number {\n if (header.index > 0) {\n const prevSiblingHeader = header.headerGroup?.headers[header.index - 1]\n if (prevSiblingHeader) {\n return (\n callMemoOrStaticFn(prevSiblingHeader, 'getStart', header_getStart) +\n callMemoOrStaticFn(prevSiblingHeader, 'getSize', header_getSize)\n )\n }\n }\n\n return 0\n}\n\n// Table APIs\n\n/**\n * Routes a committed column sizing updater through the table's sizing handler.\n *\n * The updater may be a next size map or a function of the previous map,\n * matching the instance `table.setColumnSizing` behavior.\n *\n * @example\n * ```ts\n * table_setColumnSizing(table, (old) => ({ ...old, age: 96 }))\n * ```\n */\nexport function table_setColumnSizing<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnSizingState>,\n) {\n table.options.onColumnSizingChange?.(updater)\n}\n\n/**\n * Resets `columnSizing` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnSizing` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetColumnSizing(table)\n * table_resetColumnSizing(table, true)\n * ```\n */\nexport function table_resetColumnSizing<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnSizing(\n table,\n defaultState ? {} : cloneState(table.initialState.columnSizing ?? {}),\n )\n}\n\n/**\n * Sums the rendered size of the full table header row.\n *\n * This includes left, center, and right columns in the main header group.\n *\n * @example\n * ```ts\n * const width = table_getTotalSize(table)\n * ```\n */\nexport function table_getTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n\n/**\n * Sums the rendered size of the left pinned header region.\n *\n * An empty left pinning region returns `0`.\n *\n * @example\n * ```ts\n * const width = table_getLeftTotalSize(table)\n * ```\n */\nexport function table_getLeftTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(\n table,\n 'getLeftHeaderGroups',\n table_getLeftHeaderGroups,\n )[0]?.headers.reduce((sum: number, header: Header<TFeatures, TData>) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n\n/**\n * Sums the rendered size of the center, unpinned header region.\n *\n * An empty center region returns `0`.\n *\n * @example\n * ```ts\n * const width = table_getCenterTotalSize(table)\n * ```\n */\nexport function table_getCenterTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(\n table,\n 'getCenterHeaderGroups',\n table_getCenterHeaderGroups,\n )[0]?.headers.reduce((sum: number, header: Header<TFeatures, TData>) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n\n/**\n * Sums the rendered size of the right pinned header region.\n *\n * An empty right pinning region returns `0`.\n *\n * @example\n * ```ts\n * const width = table_getRightTotalSize(table)\n * ```\n */\nexport function table_getRightTotalSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(\n table,\n 'getRightHeaderGroups',\n table_getRightHeaderGroups,\n )[0]?.headers.reduce((sum: number, header: Header<TFeatures, TData>) => {\n return sum + header_getSize(header)\n }, 0) ?? 0\n )\n}\n"],"mappings":"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"}
@@ -23,31 +23,34 @@ interface TableOptions_ColumnVisibility {
23
23
  type VisibilityDefaultOptions = Pick<TableOptions_ColumnVisibility, 'onColumnVisibilityChange'>;
24
24
  interface Table_ColumnVisibility<TFeatures extends TableFeatures, TData extends RowData> {
25
25
  /**
26
- * Returns whether all columns are visible
26
+ * Checks whether every leaf column is currently visible.
27
27
  */
28
28
  getIsAllColumnsVisible: () => boolean;
29
29
  /**
30
- * Returns whether any columns are visible
30
+ * Checks whether at least one leaf column is currently visible.
31
31
  */
32
32
  getIsSomeColumnsVisible: () => boolean;
33
33
  /**
34
- * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.
34
+ * Creates a checkbox-style handler that shows or hides all columns.
35
35
  */
36
36
  getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void;
37
37
  /**
38
- * Returns a flat array of columns that are visible, including parent columns.
38
+ * Lists visible columns in flat table order, including parent columns that
39
+ * have visible descendants.
39
40
  */
40
41
  getVisibleFlatColumns: () => Array<Column<TFeatures, TData, unknown>>;
41
42
  /**
42
- * Returns a flat array of leaf-node columns that are visible.
43
+ * Lists visible leaf columns in the order used for row cells and headers.
43
44
  */
44
45
  getVisibleLeafColumns: () => Array<Column<TFeatures, TData, unknown>>;
45
46
  /**
46
- * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`
47
+ * Resets `columnVisibility` to `initialState.columnVisibility`.
48
+ *
49
+ * Pass `true` to ignore initial state and reset to `{}`.
47
50
  */
48
51
  resetColumnVisibility: (defaultState?: boolean) => void;
49
52
  /**
50
- * Sets column visibility state using a value or updater.
53
+ * Updates column visibility state with a next map or updater function.
51
54
  */
52
55
  setColumnVisibility: (updater: Updater<ColumnVisibilityState>) => void;
53
56
  /**
@@ -57,31 +60,31 @@ interface Table_ColumnVisibility<TFeatures extends TableFeatures, TData extends
57
60
  }
58
61
  interface ColumnDef_ColumnVisibility {
59
62
  /**
60
- * Enables/disables column hiding for this column. Defaults to `true`.
63
+ * Allows this column to be hidden. Defaults to `true`.
61
64
  */
62
65
  enableHiding?: boolean;
63
66
  }
64
67
  interface Row_ColumnVisibility<TFeatures extends TableFeatures, TData extends RowData> {
65
68
  /**
66
- * Returns an array of cells that account for column visibility for the row.
69
+ * Gets this row's cells for currently visible columns.
67
70
  */
68
71
  getVisibleCells: () => Array<Cell<TFeatures, TData, unknown>>;
69
72
  /**
70
- * Returns visible cells by column id for the row.
73
+ * Maps this row's currently visible cells by column id.
71
74
  */
72
75
  getVisibleCellsByColumnId: () => Record<string, Cell<TFeatures, TData, unknown>>;
73
76
  }
74
77
  interface Column_ColumnVisibility {
75
78
  /**
76
- * Returns whether the column can be hidden
79
+ * Checks whether this column is allowed to be hidden.
77
80
  */
78
81
  getCanHide: () => boolean;
79
82
  /**
80
- * Returns whether the column is visible
83
+ * Checks whether this column is currently visible.
81
84
  */
82
85
  getIsVisible: () => boolean;
83
86
  /**
84
- * 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.
87
+ * Creates a checkbox-style handler that toggles this column's visibility.
85
88
  */
86
89
  getToggleVisibilityHandler: () => (event: unknown) => void;
87
90
  /**