@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,13 +2,14 @@ import { createCoreRowModel } from "./createCoreRowModel.js";
2
2
 
3
3
  //#region src/core/row-models/coreRowModelsFeature.utils.ts
4
4
  /**
5
- * Returns core row model for the table.
5
+ * Resolves the table's unmodified core row model.
6
6
  *
7
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
7
+ * The factory is created once per table, either from `options._rowModels.coreRowModel`
8
+ * or the built-in `createCoreRowModel()`, then reused for later calls.
8
9
  *
9
10
  * @example
10
11
  * ```ts
11
- * const value = table_getCoreRowModel(table)
12
+ * const coreRows = table_getCoreRowModel(table)
12
13
  * ```
13
14
  */
14
15
  function table_getCoreRowModel(table) {
@@ -19,26 +20,29 @@ function table_getCoreRowModel(table) {
19
20
  return table._rowModels.coreRowModel();
20
21
  }
21
22
  /**
22
- * Returns pre filtered row model for the table.
23
+ * Reads the row model immediately before column/global filtering.
23
24
  *
24
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
25
+ * Filtering is the first derived row-model stage, so this currently aliases
26
+ * `table.getCoreRowModel()`.
25
27
  *
26
28
  * @example
27
29
  * ```ts
28
- * const value = table_getPreFilteredRowModel(table)
30
+ * const rowsBeforeFiltering = table_getPreFilteredRowModel(table)
29
31
  * ```
30
32
  */
31
33
  function table_getPreFilteredRowModel(table) {
32
34
  return table.getCoreRowModel();
33
35
  }
34
36
  /**
35
- * Returns filtered row model for the table.
37
+ * Resolves the row model after column and global filtering.
36
38
  *
37
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
39
+ * When `manualFiltering` is enabled, or no filtered row-model factory was
40
+ * registered, this returns the pre-filtered row model because filtering is
41
+ * expected to happen outside the table.
38
42
  *
39
43
  * @example
40
44
  * ```ts
41
- * const value = table_getFilteredRowModel(table)
45
+ * const filteredRows = table_getFilteredRowModel(table)
42
46
  * ```
43
47
  */
44
48
  function table_getFilteredRowModel(table) {
@@ -50,26 +54,27 @@ function table_getFilteredRowModel(table) {
50
54
  return table._rowModels.filteredRowModel();
51
55
  }
52
56
  /**
53
- * Returns pre grouped row model for the table.
57
+ * Reads the row model immediately before grouping.
54
58
  *
55
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
59
+ * Grouping runs after filtering, so this aliases `table.getFilteredRowModel()`.
56
60
  *
57
61
  * @example
58
62
  * ```ts
59
- * const value = table_getPreGroupedRowModel(table)
63
+ * const rowsBeforeGrouping = table_getPreGroupedRowModel(table)
60
64
  * ```
61
65
  */
62
66
  function table_getPreGroupedRowModel(table) {
63
67
  return table.getFilteredRowModel();
64
68
  }
65
69
  /**
66
- * Returns grouped row model for the table.
70
+ * Resolves the row model after grouping has produced grouped and aggregated rows.
67
71
  *
68
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
72
+ * When `manualGrouping` is enabled, or no grouped row-model factory was
73
+ * registered, this returns the pre-grouped row model unchanged.
69
74
  *
70
75
  * @example
71
76
  * ```ts
72
- * const value = table_getGroupedRowModel(table)
77
+ * const groupedRows = table_getGroupedRowModel(table)
73
78
  * ```
74
79
  */
75
80
  function table_getGroupedRowModel(table) {
@@ -81,26 +86,28 @@ function table_getGroupedRowModel(table) {
81
86
  return table._rowModels.groupedRowModel();
82
87
  }
83
88
  /**
84
- * Returns pre sorted row model for the table.
89
+ * Reads the row model immediately before sorting.
85
90
  *
86
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
91
+ * Sorting runs after grouping, so this aliases `table.getGroupedRowModel()`.
87
92
  *
88
93
  * @example
89
94
  * ```ts
90
- * const value = table_getPreSortedRowModel(table)
95
+ * const rowsBeforeSorting = table_getPreSortedRowModel(table)
91
96
  * ```
92
97
  */
93
98
  function table_getPreSortedRowModel(table) {
94
99
  return table.getGroupedRowModel();
95
100
  }
96
101
  /**
97
- * Returns sorted row model for the table.
102
+ * Resolves the row model after sorting has been applied.
98
103
  *
99
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
104
+ * When `manualSorting` is enabled, or no sorted row-model factory was
105
+ * registered, this returns the pre-sorted row model because sorted data is
106
+ * expected to be supplied by the caller.
100
107
  *
101
108
  * @example
102
109
  * ```ts
103
- * const value = table_getSortedRowModel(table)
110
+ * const sortedRows = table_getSortedRowModel(table)
104
111
  * ```
105
112
  */
106
113
  function table_getSortedRowModel(table) {
@@ -112,26 +119,27 @@ function table_getSortedRowModel(table) {
112
119
  return table._rowModels.sortedRowModel();
113
120
  }
114
121
  /**
115
- * Returns pre expanded row model for the table.
122
+ * Reads the row model immediately before row expansion.
116
123
  *
117
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
124
+ * Expansion runs after sorting, so this aliases `table.getSortedRowModel()`.
118
125
  *
119
126
  * @example
120
127
  * ```ts
121
- * const value = table_getPreExpandedRowModel(table)
128
+ * const rowsBeforeExpansion = table_getPreExpandedRowModel(table)
122
129
  * ```
123
130
  */
124
131
  function table_getPreExpandedRowModel(table) {
125
132
  return table.getSortedRowModel();
126
133
  }
127
134
  /**
128
- * Returns expanded row model for the table.
135
+ * Resolves the row model after expanded rows have been flattened into view.
129
136
  *
130
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
137
+ * When `manualExpanding` is enabled, or no expanded row-model factory was
138
+ * registered, this returns the pre-expanded row model unchanged.
131
139
  *
132
140
  * @example
133
141
  * ```ts
134
- * const value = table_getExpandedRowModel(table)
142
+ * const expandedRows = table_getExpandedRowModel(table)
135
143
  * ```
136
144
  */
137
145
  function table_getExpandedRowModel(table) {
@@ -143,26 +151,29 @@ function table_getExpandedRowModel(table) {
143
151
  return table._rowModels.expandedRowModel();
144
152
  }
145
153
  /**
146
- * Returns pre paginated row model for the table.
154
+ * Reads the row model immediately before pagination.
147
155
  *
148
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
156
+ * Pagination is the final built-in row-model stage, so this aliases
157
+ * `table.getExpandedRowModel()`.
149
158
  *
150
159
  * @example
151
160
  * ```ts
152
- * const value = table_getPrePaginatedRowModel(table)
161
+ * const rowsBeforePagination = table_getPrePaginatedRowModel(table)
153
162
  * ```
154
163
  */
155
164
  function table_getPrePaginatedRowModel(table) {
156
165
  return table.getExpandedRowModel();
157
166
  }
158
167
  /**
159
- * Returns paginated row model for the table.
168
+ * Resolves the row model after pagination has sliced rows for the current page.
160
169
  *
161
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
170
+ * When `manualPagination` is enabled, or no paginated row-model factory was
171
+ * registered, this returns the pre-paginated row model because pagination is
172
+ * expected to happen before data reaches the table.
162
173
  *
163
174
  * @example
164
175
  * ```ts
165
- * const value = table_getPaginatedRowModel(table)
176
+ * const pageRows = table_getPaginatedRowModel(table)
166
177
  * ```
167
178
  */
168
179
  function table_getPaginatedRowModel(table) {
@@ -174,13 +185,14 @@ function table_getPaginatedRowModel(table) {
174
185
  return table._rowModels.paginatedRowModel();
175
186
  }
176
187
  /**
177
- * Returns row model for the table.
188
+ * Resolves the final row model consumed by renderers.
178
189
  *
179
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
190
+ * This is the end of the built-in row-model pipeline: core -> filtering ->
191
+ * grouping -> sorting -> expanding -> pagination.
180
192
  *
181
193
  * @example
182
194
  * ```ts
183
- * const value = table_getRowModel(table)
195
+ * const visibleRows = table_getRowModel(table)
184
196
  * ```
185
197
  */
186
198
  function table_getRowModel(table) {
@@ -1 +1 @@
1
- {"version":3,"file":"coreRowModelsFeature.utils.js","names":[],"sources":["../../../src/core/row-models/coreRowModelsFeature.utils.ts"],"sourcesContent":["import { createCoreRowModel } from './createCoreRowModel'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\nimport type { RowModel } from './coreRowModelsFeature.types'\n\n/**\n * Returns core 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_getCoreRowModel(table)\n * ```\n */\nexport function table_getCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.coreRowModel) {\n table._rowModels.coreRowModel =\n table.options._rowModels?.coreRowModel?.(table) ??\n createCoreRowModel<TFeatures, TData>()(table)\n }\n\n return table._rowModels.coreRowModel()\n}\n\n/**\n * Returns pre filtered 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_getPreFilteredRowModel(table)\n * ```\n */\nexport function table_getPreFilteredRowModel<\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 filtered 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_getFilteredRowModel(table)\n * ```\n */\nexport function table_getFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.filteredRowModel) {\n table._rowModels.filteredRowModel =\n table.options._rowModels?.filteredRowModel?.(table)\n }\n\n if (table.options.manualFiltering || !table._rowModels.filteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._rowModels.filteredRowModel()\n}\n\n/**\n * Returns pre grouped 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_getPreGroupedRowModel(table)\n * ```\n */\nexport function table_getPreGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getFilteredRowModel()\n}\n\n/**\n * Returns grouped 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_getGroupedRowModel(table)\n * ```\n */\nexport function table_getGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.groupedRowModel) {\n table._rowModels.groupedRowModel =\n table.options._rowModels?.groupedRowModel?.(table)\n }\n\n if (table.options.manualGrouping || !table._rowModels.groupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._rowModels.groupedRowModel()\n}\n\n/**\n * Returns pre sorted 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_getPreSortedRowModel(table)\n * ```\n */\nexport function table_getPreSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getGroupedRowModel()\n}\n\n/**\n * Returns sorted 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_getSortedRowModel(table)\n * ```\n */\nexport function table_getSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.sortedRowModel) {\n table._rowModels.sortedRowModel =\n table.options._rowModels?.sortedRowModel?.(table)\n }\n\n if (table.options.manualSorting || !table._rowModels.sortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._rowModels.sortedRowModel()\n}\n\n/**\n * Returns pre expanded 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_getPreExpandedRowModel(table)\n * ```\n */\nexport function table_getPreExpandedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getSortedRowModel()\n}\n\n/**\n * Returns expanded 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_getExpandedRowModel(table)\n * ```\n */\nexport function table_getExpandedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.expandedRowModel) {\n table._rowModels.expandedRowModel =\n table.options._rowModels?.expandedRowModel?.(table)\n }\n\n if (table.options.manualExpanding || !table._rowModels.expandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._rowModels.expandedRowModel()\n}\n\n/**\n * Returns pre paginated 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_getPrePaginatedRowModel(table)\n * ```\n */\nexport function table_getPrePaginatedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getExpandedRowModel()\n}\n\n/**\n * Returns paginated 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_getPaginatedRowModel(table)\n * ```\n */\nexport function table_getPaginatedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.paginatedRowModel) {\n table._rowModels.paginatedRowModel =\n table.options._rowModels?.paginatedRowModel?.(table)\n }\n\n if (table.options.manualPagination || !table._rowModels.paginatedRowModel) {\n return table.getPrePaginatedRowModel()\n }\n\n return table._rowModels.paginatedRowModel()\n}\n\n/**\n * Returns 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_getRowModel(table)\n * ```\n */\nexport function table_getRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getPaginatedRowModel()\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgB,sBAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,cAAc;;EAClC,MAAM,WAAW,yCACf,MAAM,QAAQ,4GAAY,0HAAe,MAAM,KAC/C,oBAAsC,CAAC,MAAM;;CAGjD,OAAO,MAAM,WAAW,cAAc;;;;;;;;;;;;AAaxC,SAAgB,6BAGd,OAAqE;CACrE,OAAO,MAAM,iBAAiB;;;;;;;;;;;;AAahC,SAAgB,0BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,kBAAkB;;EACtC,MAAM,WAAW,6CACf,MAAM,QAAQ,8GAAY,+HAAmB,MAAM;;CAGvD,IAAI,MAAM,QAAQ,mBAAmB,CAAC,MAAM,WAAW,kBACrD,OAAO,MAAM,wBAAwB;CAGvC,OAAO,MAAM,WAAW,kBAAkB;;;;;;;;;;;;AAa5C,SAAgB,4BAGd,OAAqE;CACrE,OAAO,MAAM,qBAAqB;;;;;;;;;;;;AAapC,SAAgB,yBAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,iBAAiB;;EACrC,MAAM,WAAW,4CACf,MAAM,QAAQ,8GAAY,8HAAkB,MAAM;;CAGtD,IAAI,MAAM,QAAQ,kBAAkB,CAAC,MAAM,WAAW,iBACpD,OAAO,MAAM,uBAAuB;CAGtC,OAAO,MAAM,WAAW,iBAAiB;;;;;;;;;;;;AAa3C,SAAgB,2BAGd,OAAqE;CACrE,OAAO,MAAM,oBAAoB;;;;;;;;;;;;AAanC,SAAgB,wBAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,gBAAgB;;EACpC,MAAM,WAAW,2CACf,MAAM,QAAQ,8GAAY,6HAAiB,MAAM;;CAGrD,IAAI,MAAM,QAAQ,iBAAiB,CAAC,MAAM,WAAW,gBACnD,OAAO,MAAM,sBAAsB;CAGrC,OAAO,MAAM,WAAW,gBAAgB;;;;;;;;;;;;AAa1C,SAAgB,6BAGd,OAAqE;CACrE,OAAO,MAAM,mBAAmB;;;;;;;;;;;;AAalC,SAAgB,0BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,kBAAkB;;EACtC,MAAM,WAAW,6CACf,MAAM,QAAQ,+GAAY,iIAAmB,MAAM;;CAGvD,IAAI,MAAM,QAAQ,mBAAmB,CAAC,MAAM,WAAW,kBACrD,OAAO,MAAM,wBAAwB;CAGvC,OAAO,MAAM,WAAW,kBAAkB;;;;;;;;;;;;AAa5C,SAAgB,8BAGd,OAAqE;CACrE,OAAO,MAAM,qBAAqB;;;;;;;;;;;;AAapC,SAAgB,2BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,mBAAmB;;EACvC,MAAM,WAAW,+CACf,MAAM,QAAQ,iHAAY,mIAAoB,MAAM;;CAGxD,IAAI,MAAM,QAAQ,oBAAoB,CAAC,MAAM,WAAW,mBACtD,OAAO,MAAM,yBAAyB;CAGxC,OAAO,MAAM,WAAW,mBAAmB;;;;;;;;;;;;AAa7C,SAAgB,kBAGd,OAAqE;CACrE,OAAO,MAAM,sBAAsB"}
1
+ {"version":3,"file":"coreRowModelsFeature.utils.js","names":[],"sources":["../../../src/core/row-models/coreRowModelsFeature.utils.ts"],"sourcesContent":["import { createCoreRowModel } from './createCoreRowModel'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\nimport type { RowModel } from './coreRowModelsFeature.types'\n\n/**\n * Resolves the table's unmodified core row model.\n *\n * The factory is created once per table, either from `options._rowModels.coreRowModel`\n * or the built-in `createCoreRowModel()`, then reused for later calls.\n *\n * @example\n * ```ts\n * const coreRows = table_getCoreRowModel(table)\n * ```\n */\nexport function table_getCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.coreRowModel) {\n table._rowModels.coreRowModel =\n table.options._rowModels?.coreRowModel?.(table) ??\n createCoreRowModel<TFeatures, TData>()(table)\n }\n\n return table._rowModels.coreRowModel()\n}\n\n/**\n * Reads the row model immediately before column/global filtering.\n *\n * Filtering is the first derived row-model stage, so this currently aliases\n * `table.getCoreRowModel()`.\n *\n * @example\n * ```ts\n * const rowsBeforeFiltering = table_getPreFilteredRowModel(table)\n * ```\n */\nexport function table_getPreFilteredRowModel<\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 * Resolves the row model after column and global filtering.\n *\n * When `manualFiltering` is enabled, or no filtered row-model factory was\n * registered, this returns the pre-filtered row model because filtering is\n * expected to happen outside the table.\n *\n * @example\n * ```ts\n * const filteredRows = table_getFilteredRowModel(table)\n * ```\n */\nexport function table_getFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.filteredRowModel) {\n table._rowModels.filteredRowModel =\n table.options._rowModels?.filteredRowModel?.(table)\n }\n\n if (table.options.manualFiltering || !table._rowModels.filteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._rowModels.filteredRowModel()\n}\n\n/**\n * Reads the row model immediately before grouping.\n *\n * Grouping runs after filtering, so this aliases `table.getFilteredRowModel()`.\n *\n * @example\n * ```ts\n * const rowsBeforeGrouping = table_getPreGroupedRowModel(table)\n * ```\n */\nexport function table_getPreGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getFilteredRowModel()\n}\n\n/**\n * Resolves the row model after grouping has produced grouped and aggregated rows.\n *\n * When `manualGrouping` is enabled, or no grouped row-model factory was\n * registered, this returns the pre-grouped row model unchanged.\n *\n * @example\n * ```ts\n * const groupedRows = table_getGroupedRowModel(table)\n * ```\n */\nexport function table_getGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.groupedRowModel) {\n table._rowModels.groupedRowModel =\n table.options._rowModels?.groupedRowModel?.(table)\n }\n\n if (table.options.manualGrouping || !table._rowModels.groupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._rowModels.groupedRowModel()\n}\n\n/**\n * Reads the row model immediately before sorting.\n *\n * Sorting runs after grouping, so this aliases `table.getGroupedRowModel()`.\n *\n * @example\n * ```ts\n * const rowsBeforeSorting = table_getPreSortedRowModel(table)\n * ```\n */\nexport function table_getPreSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getGroupedRowModel()\n}\n\n/**\n * Resolves the row model after sorting has been applied.\n *\n * When `manualSorting` is enabled, or no sorted row-model factory was\n * registered, this returns the pre-sorted row model because sorted data is\n * expected to be supplied by the caller.\n *\n * @example\n * ```ts\n * const sortedRows = table_getSortedRowModel(table)\n * ```\n */\nexport function table_getSortedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.sortedRowModel) {\n table._rowModels.sortedRowModel =\n table.options._rowModels?.sortedRowModel?.(table)\n }\n\n if (table.options.manualSorting || !table._rowModels.sortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._rowModels.sortedRowModel()\n}\n\n/**\n * Reads the row model immediately before row expansion.\n *\n * Expansion runs after sorting, so this aliases `table.getSortedRowModel()`.\n *\n * @example\n * ```ts\n * const rowsBeforeExpansion = table_getPreExpandedRowModel(table)\n * ```\n */\nexport function table_getPreExpandedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getSortedRowModel()\n}\n\n/**\n * Resolves the row model after expanded rows have been flattened into view.\n *\n * When `manualExpanding` is enabled, or no expanded row-model factory was\n * registered, this returns the pre-expanded row model unchanged.\n *\n * @example\n * ```ts\n * const expandedRows = table_getExpandedRowModel(table)\n * ```\n */\nexport function table_getExpandedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.expandedRowModel) {\n table._rowModels.expandedRowModel =\n table.options._rowModels?.expandedRowModel?.(table)\n }\n\n if (table.options.manualExpanding || !table._rowModels.expandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._rowModels.expandedRowModel()\n}\n\n/**\n * Reads the row model immediately before pagination.\n *\n * Pagination is the final built-in row-model stage, so this aliases\n * `table.getExpandedRowModel()`.\n *\n * @example\n * ```ts\n * const rowsBeforePagination = table_getPrePaginatedRowModel(table)\n * ```\n */\nexport function table_getPrePaginatedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getExpandedRowModel()\n}\n\n/**\n * Resolves the row model after pagination has sliced rows for the current page.\n *\n * When `manualPagination` is enabled, or no paginated row-model factory was\n * registered, this returns the pre-paginated row model because pagination is\n * expected to happen before data reaches the table.\n *\n * @example\n * ```ts\n * const pageRows = table_getPaginatedRowModel(table)\n * ```\n */\nexport function table_getPaginatedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.paginatedRowModel) {\n table._rowModels.paginatedRowModel =\n table.options._rowModels?.paginatedRowModel?.(table)\n }\n\n if (table.options.manualPagination || !table._rowModels.paginatedRowModel) {\n return table.getPrePaginatedRowModel()\n }\n\n return table._rowModels.paginatedRowModel()\n}\n\n/**\n * Resolves the final row model consumed by renderers.\n *\n * This is the end of the built-in row-model pipeline: core -> filtering ->\n * grouping -> sorting -> expanding -> pagination.\n *\n * @example\n * ```ts\n * const visibleRows = table_getRowModel(table)\n * ```\n */\nexport function table_getRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getPaginatedRowModel()\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,sBAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,cAAc;;EAClC,MAAM,WAAW,yCACf,MAAM,QAAQ,4GAAY,0HAAe,MAAM,KAC/C,oBAAsC,CAAC,MAAM;;CAGjD,OAAO,MAAM,WAAW,cAAc;;;;;;;;;;;;;AAcxC,SAAgB,6BAGd,OAAqE;CACrE,OAAO,MAAM,iBAAiB;;;;;;;;;;;;;;AAehC,SAAgB,0BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,kBAAkB;;EACtC,MAAM,WAAW,6CACf,MAAM,QAAQ,8GAAY,+HAAmB,MAAM;;CAGvD,IAAI,MAAM,QAAQ,mBAAmB,CAAC,MAAM,WAAW,kBACrD,OAAO,MAAM,wBAAwB;CAGvC,OAAO,MAAM,WAAW,kBAAkB;;;;;;;;;;;;AAa5C,SAAgB,4BAGd,OAAqE;CACrE,OAAO,MAAM,qBAAqB;;;;;;;;;;;;;AAcpC,SAAgB,yBAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,iBAAiB;;EACrC,MAAM,WAAW,4CACf,MAAM,QAAQ,8GAAY,8HAAkB,MAAM;;CAGtD,IAAI,MAAM,QAAQ,kBAAkB,CAAC,MAAM,WAAW,iBACpD,OAAO,MAAM,uBAAuB;CAGtC,OAAO,MAAM,WAAW,iBAAiB;;;;;;;;;;;;AAa3C,SAAgB,2BAGd,OAAqE;CACrE,OAAO,MAAM,oBAAoB;;;;;;;;;;;;;;AAenC,SAAgB,wBAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,gBAAgB;;EACpC,MAAM,WAAW,2CACf,MAAM,QAAQ,8GAAY,6HAAiB,MAAM;;CAGrD,IAAI,MAAM,QAAQ,iBAAiB,CAAC,MAAM,WAAW,gBACnD,OAAO,MAAM,sBAAsB;CAGrC,OAAO,MAAM,WAAW,gBAAgB;;;;;;;;;;;;AAa1C,SAAgB,6BAGd,OAAqE;CACrE,OAAO,MAAM,mBAAmB;;;;;;;;;;;;;AAclC,SAAgB,0BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,kBAAkB;;EACtC,MAAM,WAAW,6CACf,MAAM,QAAQ,+GAAY,iIAAmB,MAAM;;CAGvD,IAAI,MAAM,QAAQ,mBAAmB,CAAC,MAAM,WAAW,kBACrD,OAAO,MAAM,wBAAwB;CAGvC,OAAO,MAAM,WAAW,kBAAkB;;;;;;;;;;;;;AAc5C,SAAgB,8BAGd,OAAqE;CACrE,OAAO,MAAM,qBAAqB;;;;;;;;;;;;;;AAepC,SAAgB,2BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,mBAAmB;;EACvC,MAAM,WAAW,+CACf,MAAM,QAAQ,iHAAY,mIAAoB,MAAM;;CAGxD,IAAI,MAAM,QAAQ,oBAAoB,CAAC,MAAM,WAAW,mBACtD,OAAO,MAAM,yBAAyB;CAGxC,OAAO,MAAM,WAAW,mBAAmB;;;;;;;;;;;;;AAc7C,SAAgB,kBAGd,OAAqE;CACrE,OAAO,MAAM,sBAAsB"}
@@ -43,11 +43,11 @@ interface Row_CoreProperties<TFeatures extends TableFeatures, TData extends RowD
43
43
  }
44
44
  interface Row_Row<TFeatures extends TableFeatures, TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
45
45
  /**
46
- * Returns all of the cells for the row by column id.
46
+ * Builds a lookup of this row's cells keyed by leaf column id.
47
47
  */
48
48
  getAllCellsByColumnId: () => Record<string, Cell<TFeatures, TData, unknown>>;
49
49
  /**
50
- * Returns all of the cells for the row.
50
+ * Builds one cell for each leaf column, including cells for hidden columns.
51
51
  */
52
52
  getAllCells: () => Array<Cell<TFeatures, TData, unknown>>;
53
53
  /**
@@ -63,11 +63,11 @@ interface Row_Row<TFeatures extends TableFeatures, TData extends RowData> extend
63
63
  */
64
64
  getParentRows: () => Array<Row<TFeatures, TData>>;
65
65
  /**
66
- * Returns a unique array of values from the row for a given columnId.
66
+ * Reads the values this row contributes to faceting/grouping for a column.
67
67
  */
68
68
  getUniqueValues: <TValue>(columnId: string) => Array<TValue>;
69
69
  /**
70
- * Returns the value from the row for a given columnId.
70
+ * Reads this row's accessor value for a column id and caches the result.
71
71
  */
72
72
  getValue: <TValue>(columnId: string) => TValue;
73
73
  /**
@@ -43,11 +43,11 @@ interface Row_CoreProperties<TFeatures extends TableFeatures, TData extends RowD
43
43
  }
44
44
  interface Row_Row<TFeatures extends TableFeatures, TData extends RowData> extends Row_CoreProperties<TFeatures, TData> {
45
45
  /**
46
- * Returns all of the cells for the row by column id.
46
+ * Builds a lookup of this row's cells keyed by leaf column id.
47
47
  */
48
48
  getAllCellsByColumnId: () => Record<string, Cell<TFeatures, TData, unknown>>;
49
49
  /**
50
- * Returns all of the cells for the row.
50
+ * Builds one cell for each leaf column, including cells for hidden columns.
51
51
  */
52
52
  getAllCells: () => Array<Cell<TFeatures, TData, unknown>>;
53
53
  /**
@@ -63,11 +63,11 @@ interface Row_Row<TFeatures extends TableFeatures, TData extends RowData> extend
63
63
  */
64
64
  getParentRows: () => Array<Row<TFeatures, TData>>;
65
65
  /**
66
- * Returns a unique array of values from the row for a given columnId.
66
+ * Reads the values this row contributes to faceting/grouping for a column.
67
67
  */
68
68
  getUniqueValues: <TValue>(columnId: string) => Array<TValue>;
69
69
  /**
70
- * Returns the value from the row for a given columnId.
70
+ * Reads this row's accessor value for a column id and caches the result.
71
71
  */
72
72
  getValue: <TValue>(columnId: string) => TValue;
73
73
  /**
@@ -3,13 +3,14 @@ const require_constructCell = require('../cells/constructCell.cjs');
3
3
 
4
4
  //#region src/core/rows/coreRowsFeature.utils.ts
5
5
  /**
6
- * Returns value for a row.
6
+ * Reads and caches this row's value for a column.
7
7
  *
8
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
8
+ * The value is produced by the column accessor. Missing columns or display
9
+ * columns without an accessor return `undefined`.
9
10
  *
10
11
  * @example
11
12
  * ```ts
12
- * const value = row_getValue(row)
13
+ * const firstName = row_getValue(row, 'firstName')
13
14
  * ```
14
15
  */
15
16
  function row_getValue(row, columnId) {
@@ -20,13 +21,14 @@ function row_getValue(row, columnId) {
20
21
  return row._valuesCache[columnId];
21
22
  }
22
23
  /**
23
- * Returns unique values for a row.
24
+ * Reads and caches the values used by faceting/grouping for a column.
24
25
  *
25
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
26
+ * If the column defines `getUniqueValues`, that result is used. Otherwise the
27
+ * row's accessor value is wrapped in a single-item array.
26
28
  *
27
29
  * @example
28
30
  * ```ts
29
- * const value = row_getUniqueValues(row)
31
+ * const values = row_getUniqueValues(row, 'tags')
30
32
  * ```
31
33
  */
32
34
  function row_getUniqueValues(row, columnId) {
@@ -48,46 +50,47 @@ function row_getUniqueValues(row, columnId) {
48
50
  *
49
51
  * @example
50
52
  * ```ts
51
- * const value = row_renderValue(row)
53
+ * const value = row_renderValue(row, 'firstName')
52
54
  * ```
53
55
  */
54
56
  function row_renderValue(row, columnId) {
55
57
  return row.getValue(columnId) ?? row.table.options.renderFallbackValue;
56
58
  }
57
59
  /**
58
- * Returns leaf rows for a row.
60
+ * Flattens this row's descendant tree into leaf rows.
59
61
  *
60
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
62
+ * The row itself is not included; only nested `subRows` are walked.
61
63
  *
62
64
  * @example
63
65
  * ```ts
64
- * const value = row_getLeafRows(row)
66
+ * const descendants = row_getLeafRows(row)
65
67
  * ```
66
68
  */
67
69
  function row_getLeafRows(row) {
68
70
  return require_utils.flattenBy(row.subRows, (d) => d.subRows);
69
71
  }
70
72
  /**
71
- * Returns parent row for a row.
73
+ * Looks up this row's direct parent, if it has one.
72
74
  *
73
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
75
+ * Parent lookup searches the pre-pagination row model so parent relationships
76
+ * are available even when the parent is not on the current page.
74
77
  *
75
78
  * @example
76
79
  * ```ts
77
- * const value = row_getParentRow(row)
80
+ * const parent = row_getParentRow(row)
78
81
  * ```
79
82
  */
80
83
  function row_getParentRow(row) {
81
84
  return row.parentId ? row.table.getRow(row.parentId, true) : void 0;
82
85
  }
83
86
  /**
84
- * Returns parent rows for a row.
87
+ * Collects this row's ancestor chain from root to direct parent.
85
88
  *
86
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
89
+ * The current row is not included. Rows without a parent return an empty array.
87
90
  *
88
91
  * @example
89
92
  * ```ts
90
- * const value = row_getParentRows(row)
93
+ * const ancestors = row_getParentRows(row)
91
94
  * ```
92
95
  */
93
96
  function row_getParentRows(row) {
@@ -102,13 +105,14 @@ function row_getParentRows(row) {
102
105
  return parentRows.reverse();
103
106
  }
104
107
  /**
105
- * Returns all cells for a row.
108
+ * Constructs one cell for each leaf column in this row.
106
109
  *
107
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
110
+ * The result follows `table.getAllLeafColumns()` order and includes hidden
111
+ * columns; visibility-specific APIs filter this list later.
108
112
  *
109
113
  * @example
110
114
  * ```ts
111
- * const value = row_getAllCells(row)
115
+ * const cells = row_getAllCells(row)
112
116
  * ```
113
117
  */
114
118
  function row_getAllCells(row) {
@@ -118,13 +122,13 @@ function row_getAllCells(row) {
118
122
  return cells;
119
123
  }
120
124
  /**
121
- * Returns all cells by column id for a row.
125
+ * Builds a lookup map of this row's cells keyed by column id.
122
126
  *
123
- * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.
127
+ * This is the static implementation behind `row.getAllCellsByColumnId()`.
124
128
  *
125
129
  * @example
126
130
  * ```ts
127
- * const value = row_getAllCellsByColumnId(row)
131
+ * const cellsById = row_getAllCellsByColumnId(row)
128
132
  * ```
129
133
  */
130
134
  function row_getAllCellsByColumnId(row) {
@@ -137,13 +141,14 @@ function row_getAllCellsByColumnId(row) {
137
141
  return result;
138
142
  }
139
143
  /**
140
- * Returns row id for the table.
144
+ * Resolves the stable id for a row.
141
145
  *
142
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
146
+ * `options.getRowId` wins when provided. Otherwise root rows use their index
147
+ * and child rows append their index to the parent id, such as `0.2`.
143
148
  *
144
149
  * @example
145
150
  * ```ts
146
- * const value = table_getRowId(table)
151
+ * const id = table_getRowId(originalRow, table, index, parentRow)
147
152
  * ```
148
153
  */
149
154
  function table_getRowId(originalRow, table, index, parent) {
@@ -151,13 +156,14 @@ function table_getRowId(originalRow, table, index, parent) {
151
156
  return ((_table$options$getRow = (_table$options = table.options).getRowId) === null || _table$options$getRow === void 0 ? void 0 : _table$options$getRow.call(_table$options, originalRow, index, parent)) ?? `${parent ? [parent.id, index].join(".") : index}`;
152
157
  }
153
158
  /**
154
- * Returns row for the table.
159
+ * Looks up a row by id from the current or full row model.
155
160
  *
156
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
161
+ * By default this searches `table.getRowModel()`. Passing `searchAll` searches
162
+ * the pre-pagination model first, then falls back to the core model.
157
163
  *
158
164
  * @example
159
165
  * ```ts
160
- * const value = table_getRow(table)
166
+ * const row = table_getRow(table, rowId, true)
161
167
  * ```
162
168
  */
163
169
  function table_getRow(table, rowId, searchAll) {
@@ -1 +1 @@
1
- {"version":3,"file":"coreRowsFeature.utils.cjs","names":["flattenBy","constructCell"],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\n\n/**\n * Returns value 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_getValue(row)\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Returns unique values 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_getUniqueValues(row)\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row)\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Returns leaf rows 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_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Returns parent row 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_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Returns parent rows 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_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Returns all 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_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n cells[i] = constructCell(columns[i]!, row, row.table)\n }\n return cells\n}\n\n/**\n * Returns all 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_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result: Record<string, Cell<TFeatures, TData, unknown>> = {}\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Returns row id 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_getRowId(table)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Returns row 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_getRow(table)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,aAGd,KAA4B,UAAkB;CAC9C,IAAI,IAAI,aAAa,eAAe,SAAS,EAC3C,OAAO,IAAI,aAAa;CAG1B,MAAM,SAAS,IAAI,MAAM,UAAU,SAAS;CAE5C,IAAI,kDAAC,OAAQ,aACX;CAGF,IAAI,aAAa,YAAY,OAAO,WAAW,IAAI,UAAU,IAAI,MAAM;CAEvE,OAAO,IAAI,aAAa;;;;;;;;;;;;AAa1B,SAAgB,oBAGd,KAA4B,UAAkB;CAC9C,IAAI,IAAI,mBAAmB,eAAe,SAAS,EACjD,OAAO,IAAI,mBAAmB;CAGhC,MAAM,SAAS,IAAI,MAAM,UAAU,SAAS;CAE5C,IAAI,kDAAC,OAAQ,aACX;CAGF,IAAI,CAAC,OAAO,UAAU,iBAAiB;EACrC,IAAI,mBAAmB,YAAY,CAAC,IAAI,SAAS,SAAS,CAAC;EAC3D,OAAO,IAAI,mBAAmB;;CAGhC,IAAI,mBAAmB,YAAY,OAAO,UAAU,gBAClD,IAAI,UACJ,IAAI,MACL;CAED,OAAO,IAAI,mBAAmB;;;;;;;;;;;;;AAchC,SAAgB,gBAGd,KAA4B,UAAkB;CAC9C,OAAO,IAAI,SAAS,SAAS,IAAI,IAAI,MAAM,QAAQ;;;;;;;;;;;;AAarD,SAAgB,gBAGd,KAA0D;CAC1D,OAAOA,wBAAU,IAAI,UAAU,MAAM,EAAE,QAAQ;;;;;;;;;;;;AAajD,SAAgB,iBAGd,KAA4B;CAC5B,OAAO,IAAI,WAAW,IAAI,MAAM,OAAO,IAAI,UAAU,KAAK,GAAG;;;;;;;;;;;;AAa/D,SAAgB,kBAGd,KAA4B;CAC5B,MAAM,aAA2C,EAAE;CACnD,IAAI,aAAa;CAEjB,OAAO,MAAM;EACX,MAAM,YAAY,WAAW,cAAc;EAC3C,IAAI,CAAC,WAAW;EAChB,WAAW,KAAK,UAAU;EAC1B,aAAa;;CAEf,OAAO,WAAW,SAAS;;;;;;;;;;;;AAa7B,SAAgB,gBAGd,KAAoE;CACpE,MAAM,UAAU,IAAI,MAAM,mBAAmB;CAC7C,MAAM,QAAgD,IAAI,MACxD,QAAQ,OACT;CACD,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,MAAM,KAAKC,oCAAc,QAAQ,IAAK,KAAK,IAAI,MAAM;CAEvD,OAAO;;;;;;;;;;;;AAaT,SAAgB,0BAGd,KAA4B;CAC5B,MAAM,SAA0D,EAAE;CAClE,MAAM,QAAQ,IAAI,aAAa;CAC/B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,OAAO,KAAK,OAAO,MAAM;;CAE3B,OAAO;;;;;;;;;;;;AAaT,SAAgB,eAId,aACA,OACA,OACA,QACA;;CACA,mDACE,MAAM,SAAQ,6GAAW,aAAa,OAAO,OAAO,KACpD,GAAG,SAAS,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,IAAI,GAAG;;;;;;;;;;;;AAc/C,SAAgB,aAId,OACA,OACA,WACuB;CAEvB,IAAI,OAAO,YAAY,MAAM,yBAAyB,GAAG,MAAM,aAAa,EACzE,SAAS;CAEZ,IAAI,CAAC,KAAK;EACR,MAAM,MAAM,iBAAiB,CAAC,SAAS;EACvC,IAAI,CAAC,KAAK;GACR,IAAI,QAAQ,IAAI,aAAa,eAC3B,MAAM,IAAI,MAAM,sCAAsC,QAAQ;GAEhE,MAAM,IAAI,OAAO;;;CAIrB,OAAO"}
1
+ {"version":3,"file":"coreRowsFeature.utils.cjs","names":["flattenBy","constructCell"],"sources":["../../../src/core/rows/coreRowsFeature.utils.ts"],"sourcesContent":["import { flattenBy } from '../../utils'\nimport { constructCell } from '../cells/constructCell'\nimport type { Table_Internal } from '../../types/Table'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\n\n/**\n * Reads and caches this row's value for a column.\n *\n * The value is produced by the column accessor. Missing columns or display\n * columns without an accessor return `undefined`.\n *\n * @example\n * ```ts\n * const firstName = row_getValue(row, 'firstName')\n * ```\n */\nexport function row_getValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(row.original, row.index)\n\n return row._valuesCache[columnId]\n}\n\n/**\n * Reads and caches the values used by faceting/grouping for a column.\n *\n * If the column defines `getUniqueValues`, that result is used. Otherwise the\n * row's accessor value is wrapped in a single-item array.\n *\n * @example\n * ```ts\n * const values = row_getUniqueValues(row, 'tags')\n * ```\n */\nexport function row_getUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original,\n row.index,\n )\n\n return row._uniqueValuesCache[columnId]\n}\n\n/**\n * Returns a renderable row value for a column.\n *\n * If the accessor value is nullish, the table's `renderFallbackValue` is used\n * instead.\n *\n * @example\n * ```ts\n * const value = row_renderValue(row, 'firstName')\n * ```\n */\nexport function row_renderValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, columnId: string) {\n return row.getValue(columnId) ?? row.table.options.renderFallbackValue\n}\n\n/**\n * Flattens this row's descendant tree into leaf rows.\n *\n * The row itself is not included; only nested `subRows` are walked.\n *\n * @example\n * ```ts\n * const descendants = row_getLeafRows(row)\n * ```\n */\nexport function row_getLeafRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return flattenBy(row.subRows, (d) => d.subRows)\n}\n\n/**\n * Looks up this row's direct parent, if it has one.\n *\n * Parent lookup searches the pre-pagination row model so parent relationships\n * are available even when the parent is not on the current page.\n *\n * @example\n * ```ts\n * const parent = row_getParentRow(row)\n * ```\n */\nexport function row_getParentRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return row.parentId ? row.table.getRow(row.parentId, true) : undefined\n}\n\n/**\n * Collects this row's ancestor chain from root to direct parent.\n *\n * The current row is not included. Rows without a parent return an empty array.\n *\n * @example\n * ```ts\n * const ancestors = row_getParentRows(row)\n * ```\n */\nexport function row_getParentRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const parentRows: Array<Row<TFeatures, TData>> = []\n let currentRow = row\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n}\n\n/**\n * Constructs one cell for each leaf column in this row.\n *\n * The result follows `table.getAllLeafColumns()` order and includes hidden\n * columns; visibility-specific APIs filter this list later.\n *\n * @example\n * ```ts\n * const cells = row_getAllCells(row)\n * ```\n */\nexport function row_getAllCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const columns = row.table.getAllLeafColumns()\n const cells: Array<Cell<TFeatures, TData, unknown>> = new Array(\n columns.length,\n )\n for (let i = 0; i < columns.length; i++) {\n cells[i] = constructCell(columns[i]!, row, row.table)\n }\n return cells\n}\n\n/**\n * Builds a lookup map of this row's cells keyed by column id.\n *\n * This is the static implementation behind `row.getAllCellsByColumnId()`.\n *\n * @example\n * ```ts\n * const cellsById = row_getAllCellsByColumnId(row)\n * ```\n */\nexport function row_getAllCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const result: Record<string, Cell<TFeatures, TData, unknown>> = {}\n const cells = row.getAllCells()\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i]!\n result[cell.column.id] = cell\n }\n return result\n}\n\n/**\n * Resolves the stable id for a row.\n *\n * `options.getRowId` wins when provided. Otherwise root rows use their index\n * and child rows append their index to the parent id, such as `0.2`.\n *\n * @example\n * ```ts\n * const id = table_getRowId(originalRow, table, index, parentRow)\n * ```\n */\nexport function table_getRowId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n originalRow: TData,\n table: Table_Internal<TFeatures, TData>,\n index: number,\n parent?: Row<TFeatures, TData>,\n) {\n return (\n table.options.getRowId?.(originalRow, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`\n )\n}\n\n/**\n * Looks up a row by id from the current or full row model.\n *\n * By default this searches `table.getRowModel()`. Passing `searchAll` searches\n * the pre-pagination model first, then falls back to the core model.\n *\n * @example\n * ```ts\n * const row = table_getRow(table, rowId, true)\n * ```\n */\nexport function table_getRow<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n rowId: string,\n searchAll?: boolean,\n): Row<TFeatures, TData> {\n // TODO - simplify this across different row models\n let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())\n .rowsById[rowId]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[rowId]\n if (!row) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(`getRow could not find row with ID: ${rowId}`)\n }\n throw new Error()\n }\n }\n\n return row\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAgB,aAGd,KAA4B,UAAkB;CAC9C,IAAI,IAAI,aAAa,eAAe,SAAS,EAC3C,OAAO,IAAI,aAAa;CAG1B,MAAM,SAAS,IAAI,MAAM,UAAU,SAAS;CAE5C,IAAI,kDAAC,OAAQ,aACX;CAGF,IAAI,aAAa,YAAY,OAAO,WAAW,IAAI,UAAU,IAAI,MAAM;CAEvE,OAAO,IAAI,aAAa;;;;;;;;;;;;;AAc1B,SAAgB,oBAGd,KAA4B,UAAkB;CAC9C,IAAI,IAAI,mBAAmB,eAAe,SAAS,EACjD,OAAO,IAAI,mBAAmB;CAGhC,MAAM,SAAS,IAAI,MAAM,UAAU,SAAS;CAE5C,IAAI,kDAAC,OAAQ,aACX;CAGF,IAAI,CAAC,OAAO,UAAU,iBAAiB;EACrC,IAAI,mBAAmB,YAAY,CAAC,IAAI,SAAS,SAAS,CAAC;EAC3D,OAAO,IAAI,mBAAmB;;CAGhC,IAAI,mBAAmB,YAAY,OAAO,UAAU,gBAClD,IAAI,UACJ,IAAI,MACL;CAED,OAAO,IAAI,mBAAmB;;;;;;;;;;;;;AAchC,SAAgB,gBAGd,KAA4B,UAAkB;CAC9C,OAAO,IAAI,SAAS,SAAS,IAAI,IAAI,MAAM,QAAQ;;;;;;;;;;;;AAarD,SAAgB,gBAGd,KAA0D;CAC1D,OAAOA,wBAAU,IAAI,UAAU,MAAM,EAAE,QAAQ;;;;;;;;;;;;;AAcjD,SAAgB,iBAGd,KAA4B;CAC5B,OAAO,IAAI,WAAW,IAAI,MAAM,OAAO,IAAI,UAAU,KAAK,GAAG;;;;;;;;;;;;AAa/D,SAAgB,kBAGd,KAA4B;CAC5B,MAAM,aAA2C,EAAE;CACnD,IAAI,aAAa;CAEjB,OAAO,MAAM;EACX,MAAM,YAAY,WAAW,cAAc;EAC3C,IAAI,CAAC,WAAW;EAChB,WAAW,KAAK,UAAU;EAC1B,aAAa;;CAEf,OAAO,WAAW,SAAS;;;;;;;;;;;;;AAc7B,SAAgB,gBAGd,KAAoE;CACpE,MAAM,UAAU,IAAI,MAAM,mBAAmB;CAC7C,MAAM,QAAgD,IAAI,MACxD,QAAQ,OACT;CACD,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,MAAM,KAAKC,oCAAc,QAAQ,IAAK,KAAK,IAAI,MAAM;CAEvD,OAAO;;;;;;;;;;;;AAaT,SAAgB,0BAGd,KAA4B;CAC5B,MAAM,SAA0D,EAAE;CAClE,MAAM,QAAQ,IAAI,aAAa;CAC/B,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,OAAO,KAAK,OAAO,MAAM;;CAE3B,OAAO;;;;;;;;;;;;;AAcT,SAAgB,eAId,aACA,OACA,OACA,QACA;;CACA,mDACE,MAAM,SAAQ,6GAAW,aAAa,OAAO,OAAO,KACpD,GAAG,SAAS,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,IAAI,GAAG;;;;;;;;;;;;;AAe/C,SAAgB,aAId,OACA,OACA,WACuB;CAEvB,IAAI,OAAO,YAAY,MAAM,yBAAyB,GAAG,MAAM,aAAa,EACzE,SAAS;CAEZ,IAAI,CAAC,KAAK;EACR,MAAM,MAAM,iBAAiB,CAAC,SAAS;EACvC,IAAI,CAAC,KAAK;GACR,IAAI,QAAQ,IAAI,aAAa,eAC3B,MAAM,IAAI,MAAM,sCAAsC,QAAQ;GAEhE,MAAM,IAAI,OAAO;;;CAIrB,OAAO"}