@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
@@ -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
  /**
@@ -3,22 +3,24 @@ const require_columnPinningFeature_utils = require('../column-pinning/columnPinn
3
3
 
4
4
  //#region src/features/column-visibility/columnVisibilityFeature.utils.ts
5
5
  /**
6
- * Returns the default column visibility state.
6
+ * Creates the default column visibility state.
7
7
  *
8
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
8
+ * The feature default is an empty object, where missing column ids are treated
9
+ * as visible. Reset APIs use this value when `defaultState` is `true`.
9
10
  *
10
11
  * @example
11
12
  * ```ts
12
- * const initialValue = getDefaultColumnVisibilityState()
13
+ * const visibility = getDefaultColumnVisibilityState()
13
14
  * ```
14
15
  */
15
16
  function getDefaultColumnVisibilityState() {
16
17
  return {};
17
18
  }
18
19
  /**
19
- * Toggles visibility for a column.
20
+ * Updates this column's visibility when hiding is allowed.
20
21
  *
21
- * The update is applied through the owning table state slice and respects the feature options for that column.
22
+ * Passing `visible` stores that value. Omitting it flips the column's current
23
+ * visibility state. Columns that cannot hide are left unchanged.
22
24
  *
23
25
  * @example
24
26
  * ```ts
@@ -32,13 +34,15 @@ function column_toggleVisibility(column, visible) {
32
34
  }));
33
35
  }
34
36
  /**
35
- * Returns is visible for a column.
37
+ * Checks whether this column is visible.
36
38
  *
37
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
39
+ * Leaf columns read `state.columnVisibility[column.id]`, where missing entries
40
+ * default to visible. Parent columns are visible when at least one child column
41
+ * is visible.
38
42
  *
39
43
  * @example
40
44
  * ```ts
41
- * const value = column_getIsVisible(column)
45
+ * const visible = column_getIsVisible(column)
42
46
  * ```
43
47
  */
44
48
  function column_getIsVisible(column) {
@@ -47,26 +51,27 @@ function column_getIsVisible(column) {
47
51
  return (childColumns.length ? childColumns.some((childColumn) => require_utils.callMemoOrStaticFn(childColumn, "getIsVisible", column_getIsVisible)) : (_column$table$atoms$c = column.table.atoms.columnVisibility) === null || _column$table$atoms$c === void 0 || (_column$table$atoms$c = _column$table$atoms$c.get()) === null || _column$table$atoms$c === void 0 ? void 0 : _column$table$atoms$c[column.id]) ?? true;
48
52
  }
49
53
  /**
50
- * Returns whether a column can use hide.
54
+ * Checks whether this column is allowed to be hidden.
51
55
  *
52
- * This combines column options, table options, and any required accessor or feature state for the capability.
56
+ * Both `columnDef.enableHiding` and table `enableHiding` default to `true`.
53
57
  *
54
58
  * @example
55
59
  * ```ts
56
- * const value = column_getCanHide(column)
60
+ * const canHide = column_getCanHide(column)
57
61
  * ```
58
62
  */
59
63
  function column_getCanHide(column) {
60
64
  return (column.columnDef.enableHiding ?? true) && (column.table.options.enableHiding ?? true);
61
65
  }
62
66
  /**
63
- * Returns an event handler for toggling visibility handler.
67
+ * Creates a checkbox-style handler that writes this column's visibility.
64
68
  *
65
- * The handler is intended for direct use in column header controls such as buttons or checkboxes.
69
+ * The handler reads `event.target.checked`, so it is intended for visibility
70
+ * controls whose checked state means "visible".
66
71
  *
67
72
  * @example
68
73
  * ```ts
69
- * const value = column_getToggleVisibilityHandler(column)
74
+ * const onChange = column_getToggleVisibilityHandler(column)
70
75
  * ```
71
76
  */
72
77
  function column_getToggleVisibilityHandler(column) {
@@ -75,13 +80,14 @@ function column_getToggleVisibilityHandler(column) {
75
80
  };
76
81
  }
77
82
  /**
78
- * Returns visible cells for a row.
83
+ * Collects the cells from this row whose columns are visible.
79
84
  *
80
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
85
+ * When column pinning is active, the result is ordered as left-pinned cells,
86
+ * center cells, then right-pinned cells.
81
87
  *
82
88
  * @example
83
89
  * ```ts
84
- * const value = row_getVisibleCells(row)
90
+ * const visibleCells = row_getVisibleCells(row)
85
91
  * ```
86
92
  */
87
93
  function row_getVisibleCells(row) {
@@ -118,13 +124,13 @@ function row_getVisibleCells(row) {
118
124
  ];
119
125
  }
120
126
  /**
121
- * Returns visible cells by column id for a row.
127
+ * Builds a lookup map of this row's visible cells keyed by column id.
122
128
  *
123
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
129
+ * Hidden columns are omitted from the map.
124
130
  *
125
131
  * @example
126
132
  * ```ts
127
- * const value = row_getVisibleCellsByColumnId(row)
133
+ * const visibleCellsById = row_getVisibleCellsByColumnId(row)
128
134
  * ```
129
135
  */
130
136
  function row_getVisibleCellsByColumnId(row) {
@@ -137,39 +143,42 @@ function row_getVisibleCellsByColumnId(row) {
137
143
  return result;
138
144
  }
139
145
  /**
140
- * Returns visible flat columns for the table.
146
+ * Filters the flat column list down to visible columns.
141
147
  *
142
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
148
+ * Parent/group columns are included when `column_getIsVisible` considers them
149
+ * visible.
143
150
  *
144
151
  * @example
145
152
  * ```ts
146
- * const value = table_getVisibleFlatColumns(table)
153
+ * const columns = table_getVisibleFlatColumns(table)
147
154
  * ```
148
155
  */
149
156
  function table_getVisibleFlatColumns(table) {
150
157
  return table.getAllFlatColumns().filter((column) => require_utils.callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
151
158
  }
152
159
  /**
153
- * Returns visible leaf columns for the table.
160
+ * Filters leaf columns down to those currently visible.
154
161
  *
155
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
162
+ * This is the column list most row rendering code uses before pinning-specific
163
+ * partitioning.
156
164
  *
157
165
  * @example
158
166
  * ```ts
159
- * const value = table_getVisibleLeafColumns(table)
167
+ * const columns = table_getVisibleLeafColumns(table)
160
168
  * ```
161
169
  */
162
170
  function table_getVisibleLeafColumns(table) {
163
171
  return table.getAllLeafColumns().filter((column) => require_utils.callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
164
172
  }
165
173
  /**
166
- * Updates the table's column visibility state slice.
174
+ * Routes a column visibility updater through the table's visibility change handler.
167
175
  *
168
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
176
+ * The updater may be a next visibility map or a function of the previous map,
177
+ * matching the instance `table.setColumnVisibility` behavior.
169
178
  *
170
179
  * @example
171
180
  * ```ts
172
- * table_setColumnVisibility(table, (old) => old)
181
+ * table_setColumnVisibility(table, (old) => ({ ...old, age: false }))
173
182
  * ```
174
183
  */
175
184
  function table_setColumnVisibility(table, updater) {
@@ -177,9 +186,10 @@ function table_setColumnVisibility(table, updater) {
177
186
  (_table$options$onColu = (_table$options = table.options).onColumnVisibilityChange) === null || _table$options$onColu === void 0 || _table$options$onColu.call(_table$options, updater);
178
187
  }
179
188
  /**
180
- * Resets the table's column visibility state slice.
189
+ * Resets `columnVisibility` to the configured initial state or feature default.
181
190
  *
182
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
191
+ * With no argument, the reset clones `table.initialState.columnVisibility` when
192
+ * it exists. Passing `true` ignores initial state and resets to `{}`.
183
193
  *
184
194
  * @example
185
195
  * ```ts
@@ -191,9 +201,9 @@ function table_resetColumnVisibility(table, defaultState) {
191
201
  table_setColumnVisibility(table, defaultState ? {} : require_utils.cloneState(table.initialState.columnVisibility ?? {}));
192
202
  }
193
203
  /**
194
- * Toggles all columns visible for the table.
204
+ * Shows or hides every hideable leaf column.
195
205
  *
196
- * This is the table-level convenience API used by UI controls that affect many columns or rows at once.
206
+ * Columns that cannot hide stay visible when toggling all columns off.
197
207
  *
198
208
  * @example
199
209
  * ```ts
@@ -211,39 +221,41 @@ function table_toggleAllColumnsVisible(table, value) {
211
221
  table_setColumnVisibility(table, visibility);
212
222
  }
213
223
  /**
214
- * Returns is all columns visible for the table.
224
+ * Checks whether every leaf column is currently visible.
215
225
  *
216
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
226
+ * Non-hideable columns are naturally visible because missing visibility entries
227
+ * default to `true`.
217
228
  *
218
229
  * @example
219
230
  * ```ts
220
- * const value = table_getIsAllColumnsVisible(table)
231
+ * const allVisible = table_getIsAllColumnsVisible(table)
221
232
  * ```
222
233
  */
223
234
  function table_getIsAllColumnsVisible(table) {
224
235
  return !table.getAllLeafColumns().some((column) => !require_utils.callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
225
236
  }
226
237
  /**
227
- * Returns is some columns visible for the table.
238
+ * Checks whether at least one leaf column is currently visible.
228
239
  *
229
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
240
+ * This is useful for tri-state "show all columns" controls.
230
241
  *
231
242
  * @example
232
243
  * ```ts
233
- * const value = table_getIsSomeColumnsVisible(table)
244
+ * const someVisible = table_getIsSomeColumnsVisible(table)
234
245
  * ```
235
246
  */
236
247
  function table_getIsSomeColumnsVisible(table) {
237
248
  return table.getAllLeafColumns().some((column) => require_utils.callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
238
249
  }
239
250
  /**
240
- * Returns an event handler for all columns visibility handler.
251
+ * Creates a checkbox-style handler that shows or hides all columns.
241
252
  *
242
- * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.
253
+ * The handler reads `event.target.checked`, so it is intended for controls whose
254
+ * checked state means "all columns visible".
243
255
  *
244
256
  * @example
245
257
  * ```ts
246
- * const value = table_getToggleAllColumnsVisibilityHandler(table)
258
+ * const onChange = table_getToggleAllColumnsVisibilityHandler(table)
247
259
  * ```
248
260
  */
249
261
  function table_getToggleAllColumnsVisibilityHandler(table) {
@@ -1 +1 @@
1
- {"version":3,"file":"columnVisibilityFeature.utils.cjs","names":["callMemoOrStaticFn","getDefaultColumnPinningState","cloneState"],"sources":["../../../src/features/column-visibility/columnVisibilityFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, cloneState } from '../../utils'\nimport { getDefaultColumnPinningState } from '../column-pinning/columnPinningFeature.utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Cell } from '../../types/Cell'\nimport type { Column_Internal } from '../../types/Column'\nimport type { ColumnVisibilityState } from './columnVisibilityFeature.types'\nimport type { Row } from '../../types/Row'\n\n/**\n * Returns the default column visibility 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 = getDefaultColumnVisibilityState()\n * ```\n */\nexport function getDefaultColumnVisibilityState(): ColumnVisibilityState {\n return {}\n}\n\n/**\n * Toggles visibility for a column.\n *\n * The update is applied through the owning table state slice and respects the feature options for that column.\n *\n * @example\n * ```ts\n * column_toggleVisibility(column)\n * ```\n */\nexport function column_toggleVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, visible?: boolean): void {\n if (column_getCanHide(column)) {\n table_setColumnVisibility(column.table, (old) => ({\n ...old,\n [column.id]:\n visible ??\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n }))\n }\n}\n\n/**\n * Returns is visible 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_getIsVisible(column)\n * ```\n */\nexport function column_getIsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some((childColumn) =>\n callMemoOrStaticFn(childColumn, 'getIsVisible', column_getIsVisible),\n )\n : column.table.atoms.columnVisibility?.get()?.[column.id]) ?? true\n )\n}\n\n/**\n * Returns whether a column can use hide.\n *\n * This combines column options, table options, and any required accessor or feature state for the capability.\n *\n * @example\n * ```ts\n * const value = column_getCanHide(column)\n * ```\n */\nexport function column_getCanHide<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (column.table.options.enableHiding ?? true)\n )\n}\n\n/**\n * Returns an event handler for toggling visibility handler.\n *\n * The handler is intended for direct use in column header controls such as buttons or checkboxes.\n *\n * @example\n * ```ts\n * const value = column_getToggleVisibilityHandler(column)\n * ```\n */\nexport function column_getToggleVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (e: unknown) => {\n column_toggleVisibility(\n column,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Returns visible cells for a row.\n *\n * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.\n *\n * @example\n * ```ts\n * const value = row_getVisibleCells(row)\n * ```\n */\nexport function row_getVisibleCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const allCells = row.getAllCells()\n const visibleCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n visibleCells.push(cell)\n }\n }\n\n const { left, right } =\n row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()\n if (!left.length && !right.length) return visibleCells // no pinning, return early\n\n const visibleCellsByColumnId = callMemoOrStaticFn(\n row,\n 'getVisibleCellsByColumnId',\n row_getVisibleCellsByColumnId,\n )\n\n const leftCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < left.length; i++) {\n const cell = visibleCellsByColumnId[left[i]!]\n if (cell) leftCells.push(cell)\n }\n\n const rightCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < right.length; i++) {\n const cell = visibleCellsByColumnId[right[i]!]\n if (cell) rightCells.push(cell)\n }\n\n // Center cells: visible cells in natural column order, minus pinned ones.\n const centerCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < visibleCells.length; i++) {\n const cell = visibleCells[i]!\n const id = cell.column.id\n if (!left.includes(id) && !right.includes(id)) centerCells.push(cell)\n }\n\n return [...leftCells, ...centerCells, ...rightCells]\n}\n\n/**\n * Returns visible cells by column id for a row.\n *\n * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.\n *\n * @example\n * ```ts\n * const value = row_getVisibleCellsByColumnId(row)\n * ```\n */\nexport function row_getVisibleCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Record<string, Cell<TFeatures, TData, unknown>> {\n const result: Record<string, Cell<TFeatures, TData, unknown>> = {}\n const allCells = row.getAllCells()\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n result[cell.column.id] = cell\n }\n }\n return result\n}\n\n/**\n * Returns visible flat columns 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_getVisibleFlatColumns(table)\n * ```\n */\nexport function table_getVisibleFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllFlatColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Returns visible leaf columns 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_getVisibleLeafColumns(table)\n * ```\n */\nexport function table_getVisibleLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Updates the table's column visibility 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_setColumnVisibility(table, (old) => old)\n * ```\n */\nexport function table_setColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnVisibilityState>,\n) {\n table.options.onColumnVisibilityChange?.(updater)\n}\n\n/**\n * Resets the table's column visibility 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_resetColumnVisibility(table)\n * table_resetColumnVisibility(table, true)\n * ```\n */\nexport function table_resetColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnVisibility(\n table,\n defaultState ? {} : cloneState(table.initialState.columnVisibility ?? {}),\n )\n}\n\n/**\n * Toggles all columns visible for the table.\n *\n * This is the table-level convenience API used by UI controls that affect many columns or rows at once.\n *\n * @example\n * ```ts\n * table_toggleAllColumnsVisible(table)\n * ```\n */\nexport function table_toggleAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n value = value ?? !table_getIsAllColumnsVisible(table)\n\n const visibility: Record<string, boolean> = {}\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n visibility[column.id] = !value ? !column_getCanHide(column) : value\n }\n\n table_setColumnVisibility(table, visibility)\n}\n\n/**\n * Returns is all columns visible 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_getIsAllColumnsVisible(table)\n * ```\n */\nexport function table_getIsAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return !table\n .getAllLeafColumns()\n .some(\n (column) =>\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Returns is some columns visible 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_getIsSomeColumnsVisible(table)\n * ```\n */\nexport function table_getIsSomeColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .some((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Returns an event handler for all columns visibility handler.\n *\n * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.\n *\n * @example\n * ```ts\n * const value = table_getToggleAllColumnsVisibilityHandler(table)\n * ```\n */\nexport function table_getToggleAllColumnsVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllColumnsVisible(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"columnVisibilityFeature.utils.cjs","names":["callMemoOrStaticFn","getDefaultColumnPinningState","cloneState"],"sources":["../../../src/features/column-visibility/columnVisibilityFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, cloneState } from '../../utils'\nimport { getDefaultColumnPinningState } from '../column-pinning/columnPinningFeature.utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Cell } from '../../types/Cell'\nimport type { Column_Internal } from '../../types/Column'\nimport type { ColumnVisibilityState } from './columnVisibilityFeature.types'\nimport type { Row } from '../../types/Row'\n\n/**\n * Creates the default column visibility state.\n *\n * The feature default is an empty object, where missing column ids are treated\n * as visible. Reset APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const visibility = getDefaultColumnVisibilityState()\n * ```\n */\nexport function getDefaultColumnVisibilityState(): ColumnVisibilityState {\n return {}\n}\n\n/**\n * Updates this column's visibility when hiding is allowed.\n *\n * Passing `visible` stores that value. Omitting it flips the column's current\n * visibility state. Columns that cannot hide are left unchanged.\n *\n * @example\n * ```ts\n * column_toggleVisibility(column)\n * ```\n */\nexport function column_toggleVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, visible?: boolean): void {\n if (column_getCanHide(column)) {\n table_setColumnVisibility(column.table, (old) => ({\n ...old,\n [column.id]:\n visible ??\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n }))\n }\n}\n\n/**\n * Checks whether this column is visible.\n *\n * Leaf columns read `state.columnVisibility[column.id]`, where missing entries\n * default to visible. Parent columns are visible when at least one child column\n * is visible.\n *\n * @example\n * ```ts\n * const visible = column_getIsVisible(column)\n * ```\n */\nexport function column_getIsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some((childColumn) =>\n callMemoOrStaticFn(childColumn, 'getIsVisible', column_getIsVisible),\n )\n : column.table.atoms.columnVisibility?.get()?.[column.id]) ?? true\n )\n}\n\n/**\n * Checks whether this column is allowed to be hidden.\n *\n * Both `columnDef.enableHiding` and table `enableHiding` default to `true`.\n *\n * @example\n * ```ts\n * const canHide = column_getCanHide(column)\n * ```\n */\nexport function column_getCanHide<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (column.table.options.enableHiding ?? true)\n )\n}\n\n/**\n * Creates a checkbox-style handler that writes this column's visibility.\n *\n * The handler reads `event.target.checked`, so it is intended for visibility\n * controls whose checked state means \"visible\".\n *\n * @example\n * ```ts\n * const onChange = column_getToggleVisibilityHandler(column)\n * ```\n */\nexport function column_getToggleVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (e: unknown) => {\n column_toggleVisibility(\n column,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Collects the cells from this row whose columns are visible.\n *\n * When column pinning is active, the result is ordered as left-pinned cells,\n * center cells, then right-pinned cells.\n *\n * @example\n * ```ts\n * const visibleCells = row_getVisibleCells(row)\n * ```\n */\nexport function row_getVisibleCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const allCells = row.getAllCells()\n const visibleCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n visibleCells.push(cell)\n }\n }\n\n const { left, right } =\n row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()\n if (!left.length && !right.length) return visibleCells // no pinning, return early\n\n const visibleCellsByColumnId = callMemoOrStaticFn(\n row,\n 'getVisibleCellsByColumnId',\n row_getVisibleCellsByColumnId,\n )\n\n const leftCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < left.length; i++) {\n const cell = visibleCellsByColumnId[left[i]!]\n if (cell) leftCells.push(cell)\n }\n\n const rightCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < right.length; i++) {\n const cell = visibleCellsByColumnId[right[i]!]\n if (cell) rightCells.push(cell)\n }\n\n // Center cells: visible cells in natural column order, minus pinned ones.\n const centerCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < visibleCells.length; i++) {\n const cell = visibleCells[i]!\n const id = cell.column.id\n if (!left.includes(id) && !right.includes(id)) centerCells.push(cell)\n }\n\n return [...leftCells, ...centerCells, ...rightCells]\n}\n\n/**\n * Builds a lookup map of this row's visible cells keyed by column id.\n *\n * Hidden columns are omitted from the map.\n *\n * @example\n * ```ts\n * const visibleCellsById = row_getVisibleCellsByColumnId(row)\n * ```\n */\nexport function row_getVisibleCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Record<string, Cell<TFeatures, TData, unknown>> {\n const result: Record<string, Cell<TFeatures, TData, unknown>> = {}\n const allCells = row.getAllCells()\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n result[cell.column.id] = cell\n }\n }\n return result\n}\n\n/**\n * Filters the flat column list down to visible columns.\n *\n * Parent/group columns are included when `column_getIsVisible` considers them\n * visible.\n *\n * @example\n * ```ts\n * const columns = table_getVisibleFlatColumns(table)\n * ```\n */\nexport function table_getVisibleFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllFlatColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Filters leaf columns down to those currently visible.\n *\n * This is the column list most row rendering code uses before pinning-specific\n * partitioning.\n *\n * @example\n * ```ts\n * const columns = table_getVisibleLeafColumns(table)\n * ```\n */\nexport function table_getVisibleLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Routes a column visibility updater through the table's visibility change handler.\n *\n * The updater may be a next visibility map or a function of the previous map,\n * matching the instance `table.setColumnVisibility` behavior.\n *\n * @example\n * ```ts\n * table_setColumnVisibility(table, (old) => ({ ...old, age: false }))\n * ```\n */\nexport function table_setColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnVisibilityState>,\n) {\n table.options.onColumnVisibilityChange?.(updater)\n}\n\n/**\n * Resets `columnVisibility` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnVisibility` when\n * it exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetColumnVisibility(table)\n * table_resetColumnVisibility(table, true)\n * ```\n */\nexport function table_resetColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnVisibility(\n table,\n defaultState ? {} : cloneState(table.initialState.columnVisibility ?? {}),\n )\n}\n\n/**\n * Shows or hides every hideable leaf column.\n *\n * Columns that cannot hide stay visible when toggling all columns off.\n *\n * @example\n * ```ts\n * table_toggleAllColumnsVisible(table)\n * ```\n */\nexport function table_toggleAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n value = value ?? !table_getIsAllColumnsVisible(table)\n\n const visibility: Record<string, boolean> = {}\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n visibility[column.id] = !value ? !column_getCanHide(column) : value\n }\n\n table_setColumnVisibility(table, visibility)\n}\n\n/**\n * Checks whether every leaf column is currently visible.\n *\n * Non-hideable columns are naturally visible because missing visibility entries\n * default to `true`.\n *\n * @example\n * ```ts\n * const allVisible = table_getIsAllColumnsVisible(table)\n * ```\n */\nexport function table_getIsAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return !table\n .getAllLeafColumns()\n .some(\n (column) =>\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Checks whether at least one leaf column is currently visible.\n *\n * This is useful for tri-state \"show all columns\" controls.\n *\n * @example\n * ```ts\n * const someVisible = table_getIsSomeColumnsVisible(table)\n * ```\n */\nexport function table_getIsSomeColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .some((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Creates a checkbox-style handler that shows or hides all columns.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all columns visible\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllColumnsVisibilityHandler(table)\n * ```\n */\nexport function table_getToggleAllColumnsVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllColumnsVisible(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n"],"mappings":"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"}
@@ -7,20 +7,22 @@ import { Table_Internal } from "../../types/Table.cjs";
7
7
  import { Cell } from "../../types/Cell.cjs";
8
8
  //#region src/features/column-visibility/columnVisibilityFeature.utils.d.ts
9
9
  /**
10
- * Returns the default column visibility state.
10
+ * Creates the default column visibility state.
11
11
  *
12
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
12
+ * The feature default is an empty object, where missing column ids are treated
13
+ * as visible. Reset APIs use this value when `defaultState` is `true`.
13
14
  *
14
15
  * @example
15
16
  * ```ts
16
- * const initialValue = getDefaultColumnVisibilityState()
17
+ * const visibility = getDefaultColumnVisibilityState()
17
18
  * ```
18
19
  */
19
20
  declare function getDefaultColumnVisibilityState(): ColumnVisibilityState;
20
21
  /**
21
- * Toggles visibility for a column.
22
+ * Updates this column's visibility when hiding is allowed.
22
23
  *
23
- * The update is applied through the owning table state slice and respects the feature options for that column.
24
+ * Passing `visible` stores that value. Omitting it flips the column's current
25
+ * visibility state. Columns that cannot hide are left unchanged.
24
26
  *
25
27
  * @example
26
28
  * ```ts
@@ -29,97 +31,105 @@ declare function getDefaultColumnVisibilityState(): ColumnVisibilityState;
29
31
  */
30
32
  declare function column_toggleVisibility<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, visible?: boolean): void;
31
33
  /**
32
- * Returns is visible for a column.
34
+ * Checks whether this column is visible.
33
35
  *
34
- * This derives the value from the column definition, table options, and the feature state atoms registered on the table.
36
+ * Leaf columns read `state.columnVisibility[column.id]`, where missing entries
37
+ * default to visible. Parent columns are visible when at least one child column
38
+ * is visible.
35
39
  *
36
40
  * @example
37
41
  * ```ts
38
- * const value = column_getIsVisible(column)
42
+ * const visible = column_getIsVisible(column)
39
43
  * ```
40
44
  */
41
45
  declare function column_getIsVisible<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
42
46
  /**
43
- * Returns whether a column can use hide.
47
+ * Checks whether this column is allowed to be hidden.
44
48
  *
45
- * This combines column options, table options, and any required accessor or feature state for the capability.
49
+ * Both `columnDef.enableHiding` and table `enableHiding` default to `true`.
46
50
  *
47
51
  * @example
48
52
  * ```ts
49
- * const value = column_getCanHide(column)
53
+ * const canHide = column_getCanHide(column)
50
54
  * ```
51
55
  */
52
56
  declare function column_getCanHide<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
53
57
  /**
54
- * Returns an event handler for toggling visibility handler.
58
+ * Creates a checkbox-style handler that writes this column's visibility.
55
59
  *
56
- * The handler is intended for direct use in column header controls such as buttons or checkboxes.
60
+ * The handler reads `event.target.checked`, so it is intended for visibility
61
+ * controls whose checked state means "visible".
57
62
  *
58
63
  * @example
59
64
  * ```ts
60
- * const value = column_getToggleVisibilityHandler(column)
65
+ * const onChange = column_getToggleVisibilityHandler(column)
61
66
  * ```
62
67
  */
63
68
  declare function column_getToggleVisibilityHandler<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): (e: unknown) => void;
64
69
  /**
65
- * Returns visible cells for a row.
70
+ * Collects the cells from this row whose columns are visible.
66
71
  *
67
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
72
+ * When column pinning is active, the result is ordered as left-pinned cells,
73
+ * center cells, then right-pinned cells.
68
74
  *
69
75
  * @example
70
76
  * ```ts
71
- * const value = row_getVisibleCells(row)
77
+ * const visibleCells = row_getVisibleCells(row)
72
78
  * ```
73
79
  */
74
80
  declare function row_getVisibleCells<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>>;
75
81
  /**
76
- * Returns visible cells by column id for a row.
82
+ * Builds a lookup map of this row's visible cells keyed by column id.
77
83
  *
78
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
84
+ * Hidden columns are omitted from the map.
79
85
  *
80
86
  * @example
81
87
  * ```ts
82
- * const value = row_getVisibleCellsByColumnId(row)
88
+ * const visibleCellsById = row_getVisibleCellsByColumnId(row)
83
89
  * ```
84
90
  */
85
91
  declare function row_getVisibleCellsByColumnId<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): Record<string, Cell<TFeatures, TData, unknown>>;
86
92
  /**
87
- * Returns visible flat columns for the table.
93
+ * Filters the flat column list down to visible columns.
88
94
  *
89
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
95
+ * Parent/group columns are included when `column_getIsVisible` considers them
96
+ * visible.
90
97
  *
91
98
  * @example
92
99
  * ```ts
93
- * const value = table_getVisibleFlatColumns(table)
100
+ * const columns = table_getVisibleFlatColumns(table)
94
101
  * ```
95
102
  */
96
103
  declare function table_getVisibleFlatColumns<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Column<TFeatures, TData, unknown>[];
97
104
  /**
98
- * Returns visible leaf columns for the table.
105
+ * Filters leaf columns down to those currently visible.
99
106
  *
100
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
107
+ * This is the column list most row rendering code uses before pinning-specific
108
+ * partitioning.
101
109
  *
102
110
  * @example
103
111
  * ```ts
104
- * const value = table_getVisibleLeafColumns(table)
112
+ * const columns = table_getVisibleLeafColumns(table)
105
113
  * ```
106
114
  */
107
115
  declare function table_getVisibleLeafColumns<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Column<TFeatures, TData, unknown>[];
108
116
  /**
109
- * Updates the table's column visibility state slice.
117
+ * Routes a column visibility updater through the table's visibility change handler.
110
118
  *
111
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
119
+ * The updater may be a next visibility map or a function of the previous map,
120
+ * matching the instance `table.setColumnVisibility` behavior.
112
121
  *
113
122
  * @example
114
123
  * ```ts
115
- * table_setColumnVisibility(table, (old) => old)
124
+ * table_setColumnVisibility(table, (old) => ({ ...old, age: false }))
116
125
  * ```
117
126
  */
118
127
  declare function table_setColumnVisibility<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<ColumnVisibilityState>): void;
119
128
  /**
120
- * Resets the table's column visibility state slice.
129
+ * Resets `columnVisibility` to the configured initial state or feature default.
121
130
  *
122
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
131
+ * With no argument, the reset clones `table.initialState.columnVisibility` when
132
+ * it exists. Passing `true` ignores initial state and resets to `{}`.
123
133
  *
124
134
  * @example
125
135
  * ```ts
@@ -129,9 +139,9 @@ declare function table_setColumnVisibility<TFeatures extends TableFeatures, TDat
129
139
  */
130
140
  declare function table_resetColumnVisibility<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
131
141
  /**
132
- * Toggles all columns visible for the table.
142
+ * Shows or hides every hideable leaf column.
133
143
  *
134
- * This is the table-level convenience API used by UI controls that affect many columns or rows at once.
144
+ * Columns that cannot hide stay visible when toggling all columns off.
135
145
  *
136
146
  * @example
137
147
  * ```ts
@@ -140,35 +150,37 @@ declare function table_resetColumnVisibility<TFeatures extends TableFeatures, TD
140
150
  */
141
151
  declare function table_toggleAllColumnsVisible<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, value?: boolean): void;
142
152
  /**
143
- * Returns is all columns visible for the table.
153
+ * Checks whether every leaf column is currently visible.
144
154
  *
145
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
155
+ * Non-hideable columns are naturally visible because missing visibility entries
156
+ * default to `true`.
146
157
  *
147
158
  * @example
148
159
  * ```ts
149
- * const value = table_getIsAllColumnsVisible(table)
160
+ * const allVisible = table_getIsAllColumnsVisible(table)
150
161
  * ```
151
162
  */
152
163
  declare function table_getIsAllColumnsVisible<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
153
164
  /**
154
- * Returns is some columns visible for the table.
165
+ * Checks whether at least one leaf column is currently visible.
155
166
  *
156
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
167
+ * This is useful for tri-state "show all columns" controls.
157
168
  *
158
169
  * @example
159
170
  * ```ts
160
- * const value = table_getIsSomeColumnsVisible(table)
171
+ * const someVisible = table_getIsSomeColumnsVisible(table)
161
172
  * ```
162
173
  */
163
174
  declare function table_getIsSomeColumnsVisible<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
164
175
  /**
165
- * Returns an event handler for all columns visibility handler.
176
+ * Creates a checkbox-style handler that shows or hides all columns.
166
177
  *
167
- * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.
178
+ * The handler reads `event.target.checked`, so it is intended for controls whose
179
+ * checked state means "all columns visible".
168
180
  *
169
181
  * @example
170
182
  * ```ts
171
- * const value = table_getToggleAllColumnsVisibilityHandler(table)
183
+ * const onChange = table_getToggleAllColumnsVisibilityHandler(table)
172
184
  * ```
173
185
  */
174
186
  declare function table_getToggleAllColumnsVisibilityHandler<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): (e: unknown) => void;