@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
@@ -2,26 +2,28 @@ const require_utils = require('../../utils.cjs');
2
2
 
3
3
  //#region src/features/row-selection/rowSelectionFeature.utils.ts
4
4
  /**
5
- * Returns the default row selection state.
5
+ * Creates the default row selection state.
6
6
  *
7
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
7
+ * The feature default is an empty map, meaning no rows are selected. Reset APIs
8
+ * use this value when `defaultState` is `true`.
8
9
  *
9
10
  * @example
10
11
  * ```ts
11
- * const initialValue = getDefaultRowSelectionState()
12
+ * const selection = getDefaultRowSelectionState()
12
13
  * ```
13
14
  */
14
15
  function getDefaultRowSelectionState() {
15
16
  return {};
16
17
  }
17
18
  /**
18
- * Updates the table's row selection state slice.
19
+ * Routes a row selection updater through the table's selection change handler.
19
20
  *
20
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
21
+ * The updater may be a next selection map or a function of the previous map,
22
+ * matching the instance `table.setRowSelection` behavior.
21
23
  *
22
24
  * @example
23
25
  * ```ts
24
- * table_setRowSelection(table, (old) => old)
26
+ * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))
25
27
  * ```
26
28
  */
27
29
  function table_setRowSelection(table, updater) {
@@ -29,9 +31,10 @@ function table_setRowSelection(table, updater) {
29
31
  (_table$options$onRowS = (_table$options = table.options).onRowSelectionChange) === null || _table$options$onRowS === void 0 || _table$options$onRowS.call(_table$options, updater);
30
32
  }
31
33
  /**
32
- * Resets the table's row selection state slice.
34
+ * Resets `rowSelection` to the configured initial state or feature default.
33
35
  *
34
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
36
+ * With no argument, the reset clones `table.initialState.rowSelection` when it
37
+ * exists. Passing `true` ignores initial state and resets to `{}`.
35
38
  *
36
39
  * @example
37
40
  * ```ts
@@ -43,9 +46,10 @@ function table_resetRowSelection(table, defaultState) {
43
46
  table_setRowSelection(table, defaultState ? {} : require_utils.cloneState(table.initialState.rowSelection ?? {}));
44
47
  }
45
48
  /**
46
- * Toggles all rows selected for the table.
49
+ * Selects or deselects every selectable row before grouping.
47
50
  *
48
- * This is the table-level convenience API used by UI controls that affect many columns or rows at once.
51
+ * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.
52
+ * Deselecting removes matching ids from the existing selection map.
49
53
  *
50
54
  * @example
51
55
  * ```ts
@@ -68,9 +72,10 @@ function table_toggleAllRowsSelected(table, value) {
68
72
  });
69
73
  }
70
74
  /**
71
- * Toggles all page rows selected for the table.
75
+ * Selects or deselects every selectable row on the current page.
72
76
  *
73
- * This is the table-level convenience API used by UI controls that affect many columns or rows at once.
77
+ * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.
78
+ * Child rows are included when sub-row selection allows it.
74
79
  *
75
80
  * @example
76
81
  * ```ts
@@ -88,26 +93,28 @@ function table_toggleAllPageRowsSelected(table, value) {
88
93
  });
89
94
  }
90
95
  /**
91
- * Returns pre selected row model for the table.
96
+ * Reads the row model before row selection is projected into selected rows.
92
97
  *
93
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
98
+ * Selection does not alter the base row pipeline, so this returns the core row
99
+ * model.
94
100
  *
95
101
  * @example
96
102
  * ```ts
97
- * const value = table_getPreSelectedRowModel(table)
103
+ * const rowsBeforeSelection = table_getPreSelectedRowModel(table)
98
104
  * ```
99
105
  */
100
106
  function table_getPreSelectedRowModel(table) {
101
107
  return table.getCoreRowModel();
102
108
  }
103
109
  /**
104
- * Returns selected row model for the table.
110
+ * Builds a row model containing selected rows from the core row model.
105
111
  *
106
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
112
+ * If no row ids are selected, an empty row model is returned without walking
113
+ * the rows.
107
114
  *
108
115
  * @example
109
116
  * ```ts
110
- * const value = table_getSelectedRowModel(table)
117
+ * const selectedRows = table_getSelectedRowModel(table)
111
118
  * ```
112
119
  */
113
120
  function table_getSelectedRowModel(table) {
@@ -121,13 +128,14 @@ function table_getSelectedRowModel(table) {
121
128
  return selectRowsFn(rowModel);
122
129
  }
123
130
  /**
124
- * Returns filtered selected row model for the table.
131
+ * Builds a row model containing selected rows from the filtered row model.
125
132
  *
126
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
133
+ * If no row ids are selected, an empty row model is returned without walking
134
+ * the rows.
127
135
  *
128
136
  * @example
129
137
  * ```ts
130
- * const value = table_getFilteredSelectedRowModel(table)
138
+ * const selectedRows = table_getFilteredSelectedRowModel(table)
131
139
  * ```
132
140
  */
133
141
  function table_getFilteredSelectedRowModel(table) {
@@ -141,13 +149,14 @@ function table_getFilteredSelectedRowModel(table) {
141
149
  return selectRowsFn(rowModel);
142
150
  }
143
151
  /**
144
- * Returns grouped selected row model for the table.
152
+ * Builds a row model containing selected rows from the grouped row model.
145
153
  *
146
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
154
+ * If no row ids are selected, an empty row model is returned without walking
155
+ * the rows.
147
156
  *
148
157
  * @example
149
158
  * ```ts
150
- * const value = table_getGroupedSelectedRowModel(table)
159
+ * const selectedRows = table_getGroupedSelectedRowModel(table)
151
160
  * ```
152
161
  */
153
162
  function table_getGroupedSelectedRowModel(table) {
@@ -161,13 +170,14 @@ function table_getGroupedSelectedRowModel(table) {
161
170
  return selectRowsFn(rowModel);
162
171
  }
163
172
  /**
164
- * Returns is all rows selected for the table.
173
+ * Checks whether every selectable filtered row is selected.
165
174
  *
166
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
175
+ * The result is false when there are no filtered rows or when selection state is
176
+ * empty.
167
177
  *
168
178
  * @example
169
179
  * ```ts
170
- * const value = table_getIsAllRowsSelected(table)
180
+ * const allSelected = table_getIsAllRowsSelected(table)
171
181
  * ```
172
182
  */
173
183
  function table_getIsAllRowsSelected(table) {
@@ -181,13 +191,13 @@ function table_getIsAllRowsSelected(table) {
181
191
  return isAllRowsSelected;
182
192
  }
183
193
  /**
184
- * Returns is all page rows selected for the table.
194
+ * Checks whether every selectable row on the current page is selected.
185
195
  *
186
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
196
+ * Non-selectable rows are ignored for this calculation.
187
197
  *
188
198
  * @example
189
199
  * ```ts
190
- * const value = table_getIsAllPageRowsSelected(table)
200
+ * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)
191
201
  * ```
192
202
  */
193
203
  function table_getIsAllPageRowsSelected(table) {
@@ -199,13 +209,14 @@ function table_getIsAllPageRowsSelected(table) {
199
209
  return isAllPageRowsSelected;
200
210
  }
201
211
  /**
202
- * Returns is some rows selected for the table.
212
+ * Checks whether selection is partially applied across filtered rows.
203
213
  *
204
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
214
+ * The result is true when at least one row id is selected but fewer ids are
215
+ * selected than the current filtered flat row count.
205
216
  *
206
217
  * @example
207
218
  * ```ts
208
- * const value = table_getIsSomeRowsSelected(table)
219
+ * const someRowsSelected = table_getIsSomeRowsSelected(table)
209
220
  * ```
210
221
  */
211
222
  function table_getIsSomeRowsSelected(table) {
@@ -214,13 +225,14 @@ function table_getIsSomeRowsSelected(table) {
214
225
  return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
215
226
  }
216
227
  /**
217
- * Returns is some page rows selected for the table.
228
+ * Checks whether the current page has a partial selection.
218
229
  *
219
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
230
+ * This is false when all selectable page rows are selected. Otherwise it is true
231
+ * if any selectable page row or descendant is selected.
220
232
  *
221
233
  * @example
222
234
  * ```ts
223
- * const value = table_getIsSomePageRowsSelected(table)
235
+ * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)
224
236
  * ```
225
237
  */
226
238
  function table_getIsSomePageRowsSelected(table) {
@@ -228,13 +240,14 @@ function table_getIsSomePageRowsSelected(table) {
228
240
  return table_getIsAllPageRowsSelected(table) ? false : paginationFlatRows.filter((row) => row_getCanSelect(row)).some((row) => row_getIsSelected(row) || row_getIsSomeSelected(row));
229
241
  }
230
242
  /**
231
- * Returns an event handler for all rows selected handler.
243
+ * Creates a checkbox-style handler that selects or deselects all rows.
232
244
  *
233
- * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.
245
+ * The handler reads `event.target.checked`, so it is intended for controls whose
246
+ * checked state means "all rows selected".
234
247
  *
235
248
  * @example
236
249
  * ```ts
237
- * const value = table_getToggleAllRowsSelectedHandler(table)
250
+ * const onChange = table_getToggleAllRowsSelectedHandler(table)
238
251
  * ```
239
252
  */
240
253
  function table_getToggleAllRowsSelectedHandler(table) {
@@ -243,13 +256,14 @@ function table_getToggleAllRowsSelectedHandler(table) {
243
256
  };
244
257
  }
245
258
  /**
246
- * Returns an event handler for all page rows selected handler.
259
+ * Creates a checkbox-style handler that selects or deselects current page rows.
247
260
  *
248
- * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.
261
+ * The handler reads `event.target.checked`, so it is intended for controls whose
262
+ * checked state means "all page rows selected".
249
263
  *
250
264
  * @example
251
265
  * ```ts
252
- * const value = table_getToggleAllPageRowsSelectedHandler(table)
266
+ * const onChange = table_getToggleAllPageRowsSelectedHandler(table)
253
267
  * ```
254
268
  */
255
269
  function table_getToggleAllPageRowsSelectedHandler(table) {
@@ -258,9 +272,10 @@ function table_getToggleAllPageRowsSelectedHandler(table) {
258
272
  };
259
273
  }
260
274
  /**
261
- * Toggles selected for a row.
275
+ * Selects or deselects this row.
262
276
  *
263
- * The update is routed through the table state updater for the owning feature state slice.
277
+ * Omitting `value` toggles the row. Child rows are selected recursively unless
278
+ * `opts.selectChildren` is `false` or sub-row selection is disabled.
264
279
  *
265
280
  * @example
266
281
  * ```ts
@@ -278,52 +293,53 @@ function row_toggleSelected(row, value, opts) {
278
293
  });
279
294
  }
280
295
  /**
281
- * Returns is selected for a row.
296
+ * Checks whether this row id is selected in `state.rowSelection`.
282
297
  *
283
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
298
+ * Missing row ids are treated as not selected.
284
299
  *
285
300
  * @example
286
301
  * ```ts
287
- * const value = row_getIsSelected(row)
302
+ * const selected = row_getIsSelected(row)
288
303
  * ```
289
304
  */
290
305
  function row_getIsSelected(row) {
291
306
  return isRowSelected(row);
292
307
  }
293
308
  /**
294
- * Returns is some selected for a row.
309
+ * Checks whether some, but not all, selectable descendants are selected.
295
310
  *
296
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
311
+ * This supports indeterminate selection UI for parent rows.
297
312
  *
298
313
  * @example
299
314
  * ```ts
300
- * const value = row_getIsSomeSelected(row)
315
+ * const partial = row_getIsSomeSelected(row)
301
316
  * ```
302
317
  */
303
318
  function row_getIsSomeSelected(row) {
304
319
  return isSubRowSelected(row) === "some";
305
320
  }
306
321
  /**
307
- * Returns is all sub rows selected for a row.
322
+ * Checks whether all selectable descendants are selected.
308
323
  *
309
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
324
+ * Rows without selectable descendants return false.
310
325
  *
311
326
  * @example
312
327
  * ```ts
313
- * const value = row_getIsAllSubRowsSelected(row)
328
+ * const allChildrenSelected = row_getIsAllSubRowsSelected(row)
314
329
  * ```
315
330
  */
316
331
  function row_getIsAllSubRowsSelected(row) {
317
332
  return isSubRowSelected(row) === "all";
318
333
  }
319
334
  /**
320
- * Returns whether a row can use select.
335
+ * Checks whether this row can be selected.
321
336
  *
322
- * This evaluates row data, table options, and feature-specific enablement rules.
337
+ * `options.enableRowSelection` may be a boolean or a row predicate; it defaults
338
+ * to `true`.
323
339
  *
324
340
  * @example
325
341
  * ```ts
326
- * const value = row_getCanSelect(row)
342
+ * const canSelect = row_getCanSelect(row)
327
343
  * ```
328
344
  */
329
345
  function row_getCanSelect(row) {
@@ -332,13 +348,14 @@ function row_getCanSelect(row) {
332
348
  return options.enableRowSelection ?? true;
333
349
  }
334
350
  /**
335
- * Returns whether a row can use select sub rows.
351
+ * Checks whether selecting this row should also select its subRows.
336
352
  *
337
- * This evaluates row data, table options, and feature-specific enablement rules.
353
+ * `options.enableSubRowSelection` may be a boolean or a row predicate; it
354
+ * defaults to `true`.
338
355
  *
339
356
  * @example
340
357
  * ```ts
341
- * const value = row_getCanSelectSubRows(row)
358
+ * const canSelectChildren = row_getCanSelectSubRows(row)
342
359
  * ```
343
360
  */
344
361
  function row_getCanSelectSubRows(row) {
@@ -347,13 +364,14 @@ function row_getCanSelectSubRows(row) {
347
364
  return options.enableSubRowSelection ?? true;
348
365
  }
349
366
  /**
350
- * Returns whether a row can use multi select.
367
+ * Checks whether this row can be selected alongside other rows.
351
368
  *
352
- * This evaluates row data, table options, and feature-specific enablement rules.
369
+ * `options.enableMultiRowSelection` may be a boolean or a row predicate; it
370
+ * defaults to `true`.
353
371
  *
354
372
  * @example
355
373
  * ```ts
356
- * const value = row_getCanMultiSelect(row)
374
+ * const canMultiSelect = row_getCanMultiSelect(row)
357
375
  * ```
358
376
  */
359
377
  function row_getCanMultiSelect(row) {
@@ -362,13 +380,14 @@ function row_getCanMultiSelect(row) {
362
380
  return options.enableMultiRowSelection ?? true;
363
381
  }
364
382
  /**
365
- * Returns an event handler for toggling selected handler.
383
+ * Creates a checkbox-style handler that selects or deselects this row.
366
384
  *
367
- * The handler is intended for direct use in row-level controls such as expansion or selection buttons.
385
+ * The handler is a no-op when the row cannot be selected and reads
386
+ * `event.target.checked`.
368
387
  *
369
388
  * @example
370
389
  * ```ts
371
- * const value = row_getToggleSelectedHandler(row)
390
+ * const onChange = row_getToggleSelectedHandler(row)
372
391
  * ```
373
392
  */
374
393
  function row_getToggleSelectedHandler(row) {
@@ -389,11 +408,12 @@ const mutateRowIsSelected = (selectedRowIds, rowId, value, includeChildren, tabl
389
408
  /**
390
409
  * Builds a row model containing rows selected by the current row selection state.
391
410
  *
392
- * The result is derived from the supplied row model, so selected ids absent from the current data are not materialized as rows.
411
+ * The result is derived from the supplied row model, so selected ids absent from
412
+ * that model are not materialized as rows.
393
413
  *
394
414
  * @example
395
415
  * ```ts
396
- * const selectedRows = selectRowsFn(table, rowModel)
416
+ * const selectedRows = selectRowsFn(rowModel)
397
417
  * ```
398
418
  */
399
419
  function selectRowsFn(rowModel) {
@@ -427,7 +447,7 @@ function selectRowsFn(rowModel) {
427
447
  *
428
448
  * @example
429
449
  * ```ts
430
- * const selected = isRowSelected(row, selection)
450
+ * const selected = isRowSelected(row)
431
451
  * ```
432
452
  */
433
453
  function isRowSelected(row) {
@@ -441,7 +461,7 @@ function isRowSelected(row) {
441
461
  *
442
462
  * @example
443
463
  * ```ts
444
- * const selectedState = isSubRowSelected(row, selection, table)
464
+ * const selectedState = isSubRowSelected(row)
445
465
  * ```
446
466
  */
447
467
  function isSubRowSelected(row) {
@@ -1 +1 @@
1
- {"version":3,"file":"rowSelectionFeature.utils.cjs","names":["cloneState"],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import { cloneState } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowSelectionState } from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Returns the default row selection 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 = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return {}\n}\n\n/**\n * Updates the table's row selection 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_setRowSelection(table, (old) => old)\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets the table's row selection 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_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setRowSelection(\n table,\n defaultState ? {} : cloneState(table.initialState.rowSelection ?? {}),\n )\n}\n\n// Table APIs\n\n/**\n * Toggles all rows selected 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_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined' ? value : !table_getIsAllRowsSelected(table)\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (!row_getCanSelect(row)) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Toggles all page rows selected 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_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table_getIsAllPageRowsSelected(table)\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Returns pre selected row model 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_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Returns selected row model 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_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Returns filtered selected row model 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_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Returns grouped selected row model 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_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Returns is all rows selected 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_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !rowSelection[row.id],\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Returns is all page rows selected 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_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Returns is some rows selected 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_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const totalSelected = Object.keys(\n table.atoms.rowSelection?.get() ?? {},\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n}\n\n/**\n * Returns is some page rows selected 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_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table.getPaginatedRowModel().flatRows\n return table_getIsAllPageRowsSelected(table)\n ? false\n : paginationFlatRows\n .filter((row) => row_getCanSelect(row))\n .some((row) => row_getIsSelected(row) || row_getIsSomeSelected(row))\n}\n\n/**\n * Returns an event handler for all rows selected 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_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Returns an event handler for all page rows selected 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_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Toggles selected for a row.\n *\n * The update is routed through the table state updater for the owning feature state slice.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n row: Row<TFeatures, TData>,\n value?: boolean,\n opts?: {\n selectChildren?: boolean\n },\n) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row_getCanSelect(row) && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return selectedRowIds\n })\n}\n\n/**\n * Returns is selected 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_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isRowSelected(row)\n}\n\n/**\n * Returns is some selected 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_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Returns is all sub rows selected 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_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Returns whether a row can use select.\n *\n * This evaluates row data, table options, and feature-specific enablement rules.\n *\n * @example\n * ```ts\n * const value = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Returns whether a row can use select sub rows.\n *\n * This evaluates row data, table options, and feature-specific enablement rules.\n *\n * @example\n * ```ts\n * const value = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Returns whether a row can use multi select.\n *\n * This evaluates row data, table options, and feature-specific enablement rules.\n *\n * @example\n * ```ts\n * const value = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Returns an event handler for toggling selected handler.\n *\n * The handler is intended for direct use in row-level controls such as expansion or selection buttons.\n *\n * @example\n * ```ts\n * const value = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n row_toggleSelected(\n row,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n selectedRowIds: Record<string, boolean | undefined>,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n) => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(selectedRowIds).forEach((key) => delete selectedRowIds[key])\n }\n if (row_getCanSelect(row)) {\n selectedRowIds[rowId] = true\n }\n } else {\n delete selectedRowIds[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(selectedRowIds, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from the current data are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(table, rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(rowModel: RowModel<TFeatures, TData>): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById: Record<string, Row<TFeatures, TData>> = {}\n\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n let row = rows[i]!\n const isSelected = isRowSelected(row)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row, selection)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean {\n return (row.table.atoms.rowSelection?.get() ?? {})[row.id] ?? false\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row, selection, table)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach((subRow) => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAgB,8BAAiD;CAC/D,OAAO,EAAE;;;;;;;;;;;;AAaX,SAAgB,sBAId,OACA,SACA;;CACA,iDAAM,SAAQ,iHAAuB,QAAQ;;;;;;;;;;;;;AAc/C,SAAgB,wBAGd,OAAyC,cAAwB;CACjE,sBACE,OACA,eAAe,EAAE,GAAGA,yBAAW,MAAM,aAAa,gBAAgB,EAAE,CAAC,CACtE;;;;;;;;;;;;AAeH,SAAgB,4BAGd,OAAyC,OAAiB;CAC1D,sBAAsB,QAAQ,QAAQ;EACpC,QACE,OAAO,UAAU,cAAc,QAAQ,CAAC,2BAA2B,MAAM;EAE3E,MAAM,eAAe,EAAE,GAAG,KA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KAAsD;CACtD,IAAI,CAAC,IAAI,QAAQ,QAAQ,OAAO;CAEhC,IAAI,sBAAsB;CAC1B,IAAI,eAAe;CAEnB,IAAI,QAAQ,SAAS,WAAW;EAE9B,IAAI,gBAAgB,CAAC,qBACnB;EAGF,IAAI,iBAAiB,OAAO,EAC1B,IAAI,cAAc,OAAO,EACvB,eAAe;OAEf,sBAAsB;EAK1B,IAAI,OAAO,QAAQ,QAAQ;GACzB,MAAM,yBAAyB,iBAAiB,OAAO;GACvD,IAAI,2BAA2B,OAC7B,eAAe;QACV,IAAI,2BAA2B,QAAQ;IAC5C,eAAe;IACf,sBAAsB;UAEtB,sBAAsB;;GAG1B;CAGF,OAAO,sBAAsB,QAAQ,eAAe,SAAS"}
1
+ {"version":3,"file":"rowSelectionFeature.utils.cjs","names":["cloneState"],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import { cloneState } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowSelectionState } from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return {}\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setRowSelection(\n table,\n defaultState ? {} : cloneState(table.initialState.rowSelection ?? {}),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined' ? value : !table_getIsAllRowsSelected(table)\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (!row_getCanSelect(row)) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table_getIsAllPageRowsSelected(table)\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !rowSelection[row.id],\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected but fewer ids are\n * selected than the current filtered flat row count.\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const totalSelected = Object.keys(\n table.atoms.rowSelection?.get() ?? {},\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * This is false when all selectable page rows are selected. Otherwise it is true\n * if any selectable page row or descendant is selected.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table.getPaginatedRowModel().flatRows\n return table_getIsAllPageRowsSelected(table)\n ? false\n : paginationFlatRows\n .filter((row) => row_getCanSelect(row))\n .some((row) => row_getIsSelected(row) || row_getIsSomeSelected(row))\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n row: Row<TFeatures, TData>,\n value?: boolean,\n opts?: {\n selectChildren?: boolean\n },\n) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row_getCanSelect(row) && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return selectedRowIds\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isRowSelected(row)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n row_toggleSelected(\n row,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n selectedRowIds: Record<string, boolean | undefined>,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n) => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(selectedRowIds).forEach((key) => delete selectedRowIds[key])\n }\n if (row_getCanSelect(row)) {\n selectedRowIds[rowId] = true\n }\n } else {\n delete selectedRowIds[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(selectedRowIds, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(rowModel: RowModel<TFeatures, TData>): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById: Record<string, Row<TFeatures, TData>> = {}\n\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n let row = rows[i]!\n const isSelected = isRowSelected(row)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean {\n return (row.table.atoms.rowSelection?.get() ?? {})[row.id] ?? false\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach((subRow) => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,8BAAiD;CAC/D,OAAO,EAAE;;;;;;;;;;;;;AAcX,SAAgB,sBAId,OACA,SACA;;CACA,iDAAM,SAAQ,iHAAuB,QAAQ;;;;;;;;;;;;;;AAe/C,SAAgB,wBAGd,OAAyC,cAAwB;CACjE,sBACE,OACA,eAAe,EAAE,GAAGA,yBAAW,MAAM,aAAa,gBAAgB,EAAE,CAAC,CACtE;;;;;;;;;;;;;AAgBH,SAAgB,4BAGd,OAAyC,OAAiB;CAC1D,sBAAsB,QA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