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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +10 -0
  2. package/dist/core/cells/coreCellsFeature.utils.cjs +11 -8
  3. package/dist/core/cells/coreCellsFeature.utils.cjs.map +1 -1
  4. package/dist/core/cells/coreCellsFeature.utils.d.cts +11 -8
  5. package/dist/core/cells/coreCellsFeature.utils.d.ts +11 -8
  6. package/dist/core/cells/coreCellsFeature.utils.js +11 -8
  7. package/dist/core/cells/coreCellsFeature.utils.js.map +1 -1
  8. package/dist/core/columns/coreColumnsFeature.types.d.cts +7 -6
  9. package/dist/core/columns/coreColumnsFeature.types.d.ts +7 -6
  10. package/dist/core/columns/coreColumnsFeature.utils.cjs +37 -27
  11. package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
  12. package/dist/core/columns/coreColumnsFeature.utils.d.cts +37 -27
  13. package/dist/core/columns/coreColumnsFeature.utils.d.ts +37 -27
  14. package/dist/core/columns/coreColumnsFeature.utils.js +37 -27
  15. package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
  16. package/dist/core/headers/coreHeadersFeature.types.d.cts +6 -4
  17. package/dist/core/headers/coreHeadersFeature.types.d.ts +6 -4
  18. package/dist/core/headers/coreHeadersFeature.utils.cjs +23 -18
  19. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  20. package/dist/core/headers/coreHeadersFeature.utils.d.cts +23 -18
  21. package/dist/core/headers/coreHeadersFeature.utils.d.ts +23 -18
  22. package/dist/core/headers/coreHeadersFeature.utils.js +23 -18
  23. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  24. package/dist/core/row-models/coreRowModelsFeature.utils.cjs +48 -36
  25. package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
  26. package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +48 -36
  27. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +48 -36
  28. package/dist/core/row-models/coreRowModelsFeature.utils.js +48 -36
  29. package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
  30. package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
  31. package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
  32. package/dist/core/rows/coreRowsFeature.utils.cjs +34 -28
  33. package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
  34. package/dist/core/rows/coreRowsFeature.utils.d.cts +34 -28
  35. package/dist/core/rows/coreRowsFeature.utils.d.ts +34 -28
  36. package/dist/core/rows/coreRowsFeature.utils.js +34 -28
  37. package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
  38. package/dist/core/table/coreTablesFeature.types.d.cts +6 -2
  39. package/dist/core/table/coreTablesFeature.types.d.ts +6 -2
  40. package/dist/core/table/coreTablesFeature.utils.cjs +2 -2
  41. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  42. package/dist/core/table/coreTablesFeature.utils.d.cts +2 -2
  43. package/dist/core/table/coreTablesFeature.utils.d.ts +2 -2
  44. package/dist/core/table/coreTablesFeature.utils.js +2 -2
  45. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  46. package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +16 -10
  47. package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +16 -10
  48. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +26 -18
  49. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
  50. package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +26 -18
  51. package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +26 -18
  52. package/dist/features/column-faceting/columnFacetingFeature.utils.js +26 -18
  53. package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
  54. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +21 -11
  55. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +21 -11
  56. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +39 -28
  57. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  58. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +39 -28
  59. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +39 -28
  60. package/dist/features/column-filtering/columnFilteringFeature.utils.js +39 -28
  61. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  62. package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +18 -14
  63. package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +18 -14
  64. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +55 -43
  65. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
  66. package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +55 -43
  67. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +55 -43
  68. package/dist/features/column-grouping/columnGroupingFeature.utils.js +55 -43
  69. package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
  70. package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +14 -5
  71. package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +14 -5
  72. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +30 -23
  73. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
  74. package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +30 -23
  75. package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +30 -23
  76. package/dist/features/column-ordering/columnOrderingFeature.utils.js +30 -23
  77. package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
  78. package/dist/features/column-pinning/columnPinningFeature.types.d.cts +43 -31
  79. package/dist/features/column-pinning/columnPinningFeature.types.d.ts +43 -31
  80. package/dist/features/column-pinning/columnPinningFeature.utils.cjs +111 -91
  81. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  82. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +111 -91
  83. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +111 -91
  84. package/dist/features/column-pinning/columnPinningFeature.utils.js +111 -91
  85. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  86. package/dist/features/column-resizing/columnResizingFeature.types.d.cts +9 -9
  87. package/dist/features/column-resizing/columnResizingFeature.types.d.ts +9 -9
  88. package/dist/features/column-resizing/columnResizingFeature.utils.cjs +28 -19
  89. package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
  90. package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +28 -19
  91. package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +28 -19
  92. package/dist/features/column-resizing/columnResizingFeature.utils.js +28 -19
  93. package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
  94. package/dist/features/column-sizing/columnSizingFeature.types.d.cts +19 -12
  95. package/dist/features/column-sizing/columnSizingFeature.types.d.ts +19 -12
  96. package/dist/features/column-sizing/columnSizingFeature.utils.cjs +52 -41
  97. package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
  98. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +52 -41
  99. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +52 -41
  100. package/dist/features/column-sizing/columnSizingFeature.utils.js +52 -41
  101. package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
  102. package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +16 -13
  103. package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +16 -13
  104. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +54 -42
  105. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
  106. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +54 -42
  107. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +54 -42
  108. package/dist/features/column-visibility/columnVisibilityFeature.utils.js +54 -42
  109. package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
  110. package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +10 -5
  111. package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +10 -5
  112. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +20 -14
  113. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  114. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +20 -14
  115. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +20 -14
  116. package/dist/features/global-filtering/globalFilteringFeature.utils.js +20 -14
  117. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  118. package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +16 -15
  119. package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +16 -15
  120. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +56 -41
  121. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
  122. package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +56 -41
  123. package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +56 -41
  124. package/dist/features/row-expanding/rowExpandingFeature.utils.js +56 -41
  125. package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
  126. package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +19 -12
  127. package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +19 -12
  128. package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +49 -32
  129. package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
  130. package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +49 -32
  131. package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +49 -32
  132. package/dist/features/row-pagination/rowPaginationFeature.utils.js +49 -32
  133. package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
  134. package/dist/features/row-pinning/rowPinningFeature.types.d.cts +12 -8
  135. package/dist/features/row-pinning/rowPinningFeature.types.d.ts +12 -8
  136. package/dist/features/row-pinning/rowPinningFeature.utils.cjs +39 -29
  137. package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
  138. package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +39 -29
  139. package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +39 -29
  140. package/dist/features/row-pinning/rowPinningFeature.utils.js +39 -29
  141. package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
  142. package/dist/features/row-selection/rowSelectionFeature.types.d.cts +30 -24
  143. package/dist/features/row-selection/rowSelectionFeature.types.d.ts +30 -24
  144. package/dist/features/row-selection/rowSelectionFeature.utils.cjs +89 -69
  145. package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
  146. package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +89 -69
  147. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +89 -69
  148. package/dist/features/row-selection/rowSelectionFeature.utils.js +89 -69
  149. package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
  150. package/dist/features/row-sorting/rowSortingFeature.types.d.cts +10 -8
  151. package/dist/features/row-sorting/rowSortingFeature.types.d.ts +10 -8
  152. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +61 -44
  153. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  154. package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +61 -44
  155. package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +61 -44
  156. package/dist/features/row-sorting/rowSortingFeature.utils.js +61 -44
  157. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  158. package/dist/fns/aggregationFns.cjs +33 -9
  159. package/dist/fns/aggregationFns.cjs.map +1 -1
  160. package/dist/fns/aggregationFns.d.cts +33 -9
  161. package/dist/fns/aggregationFns.d.ts +33 -9
  162. package/dist/fns/aggregationFns.js +33 -9
  163. package/dist/fns/aggregationFns.js.map +1 -1
  164. package/dist/fns/filterFns.cjs +48 -17
  165. package/dist/fns/filterFns.cjs.map +1 -1
  166. package/dist/fns/filterFns.d.cts +42 -15
  167. package/dist/fns/filterFns.d.ts +42 -15
  168. package/dist/fns/filterFns.js +48 -17
  169. package/dist/fns/filterFns.js.map +1 -1
  170. package/dist/helpers/columnHelper.cjs +9 -4
  171. package/dist/helpers/columnHelper.cjs.map +1 -1
  172. package/dist/helpers/columnHelper.d.cts +9 -4
  173. package/dist/helpers/columnHelper.d.ts +9 -4
  174. package/dist/helpers/columnHelper.js +9 -4
  175. package/dist/helpers/columnHelper.js.map +1 -1
  176. package/dist/helpers/tableOptions.cjs.map +1 -1
  177. package/dist/helpers/tableOptions.d.cts +12 -9
  178. package/dist/helpers/tableOptions.d.ts +12 -9
  179. package/dist/helpers/tableOptions.js.map +1 -1
  180. package/dist/types/ColumnDef.d.cts +38 -0
  181. package/dist/types/ColumnDef.d.ts +38 -0
  182. package/dist/types/TableOptions.d.cts +15 -0
  183. package/dist/types/TableOptions.d.ts +15 -0
  184. package/dist/types/TableState.d.cts +12 -0
  185. package/dist/types/TableState.d.ts +12 -0
  186. package/package.json +5 -3
  187. package/skills/column-definitions/SKILL.md +333 -0
  188. package/skills/column-layout/SKILL.md +328 -0
  189. package/skills/column-layout/references/subsystems.md +220 -0
  190. package/skills/customizing-feature-behavior/SKILL.md +416 -0
  191. package/skills/filtering/SKILL.md +357 -0
  192. package/skills/filtering/references/faceting-and-fuzzy.md +191 -0
  193. package/skills/grouping/SKILL.md +448 -0
  194. package/skills/migrate-v8-to-v9/SKILL.md +495 -0
  195. package/skills/pagination/SKILL.md +385 -0
  196. package/skills/row-expanding/SKILL.md +348 -0
  197. package/skills/row-pinning/SKILL.md +269 -0
  198. package/skills/row-selection/SKILL.md +391 -0
  199. package/skills/setup/SKILL.md +400 -0
  200. package/skills/sorting/SKILL.md +344 -0
  201. package/skills/state-management/SKILL.md +388 -0
  202. package/src/core/cells/coreCellsFeature.utils.ts +11 -8
  203. package/src/core/columns/coreColumnsFeature.types.ts +7 -6
  204. package/src/core/columns/coreColumnsFeature.utils.ts +37 -27
  205. package/src/core/headers/coreHeadersFeature.types.ts +6 -4
  206. package/src/core/headers/coreHeadersFeature.utils.ts +23 -18
  207. package/src/core/row-models/coreRowModelsFeature.utils.ts +48 -36
  208. package/src/core/rows/coreRowsFeature.types.ts +4 -4
  209. package/src/core/rows/coreRowsFeature.utils.ts +34 -28
  210. package/src/core/table/coreTablesFeature.types.ts +6 -2
  211. package/src/core/table/coreTablesFeature.utils.ts +2 -2
  212. package/src/features/column-faceting/columnFacetingFeature.types.ts +16 -10
  213. package/src/features/column-faceting/columnFacetingFeature.utils.ts +26 -18
  214. package/src/features/column-filtering/columnFilteringFeature.types.ts +21 -11
  215. package/src/features/column-filtering/columnFilteringFeature.utils.ts +39 -28
  216. package/src/features/column-grouping/columnGroupingFeature.types.ts +18 -14
  217. package/src/features/column-grouping/columnGroupingFeature.utils.ts +55 -43
  218. package/src/features/column-ordering/columnOrderingFeature.types.ts +14 -5
  219. package/src/features/column-ordering/columnOrderingFeature.utils.ts +30 -23
  220. package/src/features/column-pinning/columnPinningFeature.types.ts +43 -31
  221. package/src/features/column-pinning/columnPinningFeature.utils.ts +111 -91
  222. package/src/features/column-resizing/columnResizingFeature.types.ts +9 -9
  223. package/src/features/column-resizing/columnResizingFeature.utils.ts +28 -19
  224. package/src/features/column-sizing/columnSizingFeature.types.ts +19 -12
  225. package/src/features/column-sizing/columnSizingFeature.utils.ts +52 -41
  226. package/src/features/column-visibility/columnVisibilityFeature.types.ts +16 -13
  227. package/src/features/column-visibility/columnVisibilityFeature.utils.ts +54 -42
  228. package/src/features/global-filtering/globalFilteringFeature.types.ts +10 -5
  229. package/src/features/global-filtering/globalFilteringFeature.utils.ts +20 -14
  230. package/src/features/row-expanding/rowExpandingFeature.types.ts +16 -15
  231. package/src/features/row-expanding/rowExpandingFeature.utils.ts +56 -41
  232. package/src/features/row-pagination/rowPaginationFeature.types.ts +19 -12
  233. package/src/features/row-pagination/rowPaginationFeature.utils.ts +49 -32
  234. package/src/features/row-pinning/rowPinningFeature.types.ts +12 -8
  235. package/src/features/row-pinning/rowPinningFeature.utils.ts +39 -29
  236. package/src/features/row-selection/rowSelectionFeature.types.ts +30 -24
  237. package/src/features/row-selection/rowSelectionFeature.utils.ts +89 -69
  238. package/src/features/row-sorting/rowSortingFeature.types.ts +10 -8
  239. package/src/features/row-sorting/rowSortingFeature.utils.ts +61 -44
  240. package/src/fns/aggregationFns.ts +33 -9
  241. package/src/fns/filterFns.ts +48 -17
  242. package/src/helpers/columnHelper.ts +9 -4
  243. package/src/helpers/tableOptions.ts +12 -9
  244. package/src/types/ColumnDef.ts +38 -0
  245. package/src/types/TableOptions.ts +15 -0
  246. package/src/types/TableState.ts +12 -0
@@ -5,20 +5,23 @@ import { Table_Internal } from "../../types/Table.js";
5
5
 
6
6
  //#region src/features/row-pagination/rowPaginationFeature.utils.d.ts
7
7
  /**
8
- * Returns the default pagination state.
8
+ * Creates the default pagination state used by the pagination feature.
9
9
  *
10
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
10
+ * The feature default starts at the first page with a page size of 10. Reset
11
+ * APIs use this value when `defaultState` is `true`.
11
12
  *
12
13
  * @example
13
14
  * ```ts
14
- * const initialValue = getDefaultPaginationState()
15
+ * const pagination = getDefaultPaginationState()
15
16
  * ```
16
17
  */
17
18
  declare function getDefaultPaginationState(): PaginationState;
18
19
  /**
19
- * Schedules an automatic reset for page index.
20
+ * Resets the page index when a page-altering change should return to page 0.
20
21
  *
21
- * The reset only runs when the related feature options allow automatic resets for the current table state change.
22
+ * The reset runs when `autoResetAll`, `autoResetPageIndex`, or the default
23
+ * client-side pagination behavior allows it. Manual pagination opts out unless
24
+ * the reset options explicitly opt back in.
22
25
  *
23
26
  * @example
24
27
  * ```ts
@@ -27,9 +30,11 @@ declare function getDefaultPaginationState(): PaginationState;
27
30
  */
28
31
  declare function table_autoResetPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
29
32
  /**
30
- * Updates the table's pagination state slice.
33
+ * Routes a pagination updater through the table's pagination change handler.
31
34
  *
32
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
35
+ * The updater may be a next state object or a function of the previous
36
+ * `PaginationState`; controlled state and external atoms observe the same
37
+ * updater path as the instance API.
33
38
  *
34
39
  * @example
35
40
  * ```ts
@@ -38,9 +43,11 @@ declare function table_autoResetPageIndex<TFeatures extends TableFeatures, TData
38
43
  */
39
44
  declare function table_setPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<PaginationState>): void | undefined;
40
45
  /**
41
- * Resets the table's pagination state slice.
46
+ * Resets `pagination` to the configured initial state or feature default.
42
47
  *
43
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
48
+ * With no argument, the reset clones `table.initialState.pagination` when it
49
+ * exists. Passing `true` ignores initial state and resets to
50
+ * `{ pageIndex: 0, pageSize: 10 }`.
44
51
  *
45
52
  * @example
46
53
  * ```ts
@@ -50,9 +57,10 @@ declare function table_setPagination<TFeatures extends TableFeatures, TData exte
50
57
  */
51
58
  declare function table_resetPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
52
59
  /**
53
- * Updates the table's page index state slice.
60
+ * Updates `pagination.pageIndex` and clamps it to the known page range.
54
61
  *
55
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
62
+ * Unknown page counts (`undefined` or `-1`) allow any non-negative page index.
63
+ * Known page counts clamp the index between `0` and `pageCount - 1`.
56
64
  *
57
65
  * @example
58
66
  * ```ts
@@ -61,9 +69,10 @@ declare function table_resetPagination<TFeatures extends TableFeatures, TData ex
61
69
  */
62
70
  declare function table_setPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>): void;
63
71
  /**
64
- * Resets the table's page index state slice.
72
+ * Resets only `pagination.pageIndex`.
65
73
  *
66
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
74
+ * With no argument, the reset uses `table.initialState.pagination?.pageIndex`
75
+ * or `0`. Passing `true` always resets the page index to `0`.
67
76
  *
68
77
  * @example
69
78
  * ```ts
@@ -73,9 +82,10 @@ declare function table_setPageIndex<TFeatures extends TableFeatures, TData exten
73
82
  */
74
83
  declare function table_resetPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
75
84
  /**
76
- * Resets the table's page size state slice.
85
+ * Resets only `pagination.pageSize`.
77
86
  *
78
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
87
+ * With no argument, the reset uses `table.initialState.pagination?.pageSize`
88
+ * or `10`. Passing `true` always resets the page size to `10`.
79
89
  *
80
90
  * @example
81
91
  * ```ts
@@ -85,9 +95,10 @@ declare function table_resetPageIndex<TFeatures extends TableFeatures, TData ext
85
95
  */
86
96
  declare function table_resetPageSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
87
97
  /**
88
- * Updates the table's page size state slice.
98
+ * Updates `pagination.pageSize` while preserving the current top row.
89
99
  *
90
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
100
+ * The new size is clamped to at least `1`, and `pageIndex` is recalculated so
101
+ * the row that was previously at the top of the page remains in view.
91
102
  *
92
103
  * @example
93
104
  * ```ts
@@ -96,35 +107,38 @@ declare function table_resetPageSize<TFeatures extends TableFeatures, TData exte
96
107
  */
97
108
  declare function table_setPageSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>): void;
98
109
  /**
99
- * Returns page options for the table.
110
+ * Builds the zero-based page indexes available for the current page count.
100
111
  *
101
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
112
+ * Unknown or empty page counts return an empty array; otherwise the result is
113
+ * `[0, 1, ...pageCount - 1]`.
102
114
  *
103
115
  * @example
104
116
  * ```ts
105
- * const value = table_getPageOptions(table)
117
+ * const pageIndexes = table_getPageOptions(table)
106
118
  * ```
107
119
  */
108
120
  declare function table_getPageOptions<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number[];
109
121
  /**
110
- * Returns can previous page for the table.
122
+ * Checks whether the current page index can move backward.
111
123
  *
112
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
124
+ * The first page is page index `0`, so only positive page indexes can navigate
125
+ * to a previous page.
113
126
  *
114
127
  * @example
115
128
  * ```ts
116
- * const value = table_getCanPreviousPage(table)
129
+ * const canGoBack = table_getCanPreviousPage(table)
117
130
  * ```
118
131
  */
119
132
  declare function table_getCanPreviousPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
120
133
  /**
121
- * Returns can next page for the table.
134
+ * Checks whether the current page index can move forward.
122
135
  *
123
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
136
+ * A `pageCount` of `-1` means the caller does not know the total page count, so
137
+ * this returns `true`. A page count of `0` returns `false`.
124
138
  *
125
139
  * @example
126
140
  * ```ts
127
- * const value = table_getCanNextPage(table)
141
+ * const canGoForward = table_getCanNextPage(table)
128
142
  * ```
129
143
  */
130
144
  declare function table_getCanNextPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
@@ -175,24 +189,27 @@ declare function table_firstPage<TFeatures extends TableFeatures, TData extends
175
189
  */
176
190
  declare function table_lastPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
177
191
  /**
178
- * Returns page count for the table.
192
+ * Resolves the number of pages for the current pagination state.
179
193
  *
180
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
194
+ * `options.pageCount` wins for manual pagination. Otherwise the value is
195
+ * calculated from `table_getRowCount(table)` and the current `pageSize`.
181
196
  *
182
197
  * @example
183
198
  * ```ts
184
- * const value = table_getPageCount(table)
199
+ * const pages = table_getPageCount(table)
185
200
  * ```
186
201
  */
187
202
  declare function table_getPageCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number;
188
203
  /**
189
- * Returns row count for the table.
204
+ * Resolves the total row count used for pagination math.
190
205
  *
191
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
206
+ * `options.rowCount` wins for manual pagination. Otherwise the count comes
207
+ * from the pre-paginated row model so filtering, grouping, sorting, and
208
+ * expansion are reflected before the page slice is applied.
192
209
  *
193
210
  * @example
194
211
  * ```ts
195
- * const value = table_getRowCount(table)
212
+ * const rows = table_getRowCount(table)
196
213
  * ```
197
214
  */
198
215
  declare function table_getRowCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number;
@@ -4,13 +4,14 @@ import { cloneState, functionalUpdate } from "../../utils.js";
4
4
  const defaultPageIndex = 0;
5
5
  const defaultPageSize = 10;
6
6
  /**
7
- * Returns the default pagination state.
7
+ * Creates the default pagination state used by the pagination feature.
8
8
  *
9
- * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
9
+ * The feature default starts at the first page with a page size of 10. Reset
10
+ * APIs use this value when `defaultState` is `true`.
10
11
  *
11
12
  * @example
12
13
  * ```ts
13
- * const initialValue = getDefaultPaginationState()
14
+ * const pagination = getDefaultPaginationState()
14
15
  * ```
15
16
  */
16
17
  function getDefaultPaginationState() {
@@ -20,9 +21,11 @@ function getDefaultPaginationState() {
20
21
  };
21
22
  }
22
23
  /**
23
- * Schedules an automatic reset for page index.
24
+ * Resets the page index when a page-altering change should return to page 0.
24
25
  *
25
- * The reset only runs when the related feature options allow automatic resets for the current table state change.
26
+ * The reset runs when `autoResetAll`, `autoResetPageIndex`, or the default
27
+ * client-side pagination behavior allows it. Manual pagination opts out unless
28
+ * the reset options explicitly opt back in.
26
29
  *
27
30
  * @example
28
31
  * ```ts
@@ -33,9 +36,11 @@ function table_autoResetPageIndex(table) {
33
36
  if (table.options.autoResetAll ?? table.options.autoResetPageIndex ?? !table.options.manualPagination) table_resetPageIndex(table);
34
37
  }
35
38
  /**
36
- * Updates the table's pagination state slice.
39
+ * Routes a pagination updater through the table's pagination change handler.
37
40
  *
38
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
41
+ * The updater may be a next state object or a function of the previous
42
+ * `PaginationState`; controlled state and external atoms observe the same
43
+ * updater path as the instance API.
39
44
  *
40
45
  * @example
41
46
  * ```ts
@@ -50,9 +55,11 @@ function table_setPagination(table, updater) {
50
55
  return (_table$options$onPagi = (_table$options = table.options).onPaginationChange) === null || _table$options$onPagi === void 0 ? void 0 : _table$options$onPagi.call(_table$options, safeUpdater);
51
56
  }
52
57
  /**
53
- * Resets the table's pagination state slice.
58
+ * Resets `pagination` to the configured initial state or feature default.
54
59
  *
55
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
60
+ * With no argument, the reset clones `table.initialState.pagination` when it
61
+ * exists. Passing `true` ignores initial state and resets to
62
+ * `{ pageIndex: 0, pageSize: 10 }`.
56
63
  *
57
64
  * @example
58
65
  * ```ts
@@ -64,9 +71,10 @@ function table_resetPagination(table, defaultState) {
64
71
  table_setPagination(table, defaultState ? getDefaultPaginationState() : cloneState(table.initialState.pagination ?? getDefaultPaginationState()));
65
72
  }
66
73
  /**
67
- * Updates the table's page index state slice.
74
+ * Updates `pagination.pageIndex` and clamps it to the known page range.
68
75
  *
69
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
76
+ * Unknown page counts (`undefined` or `-1`) allow any non-negative page index.
77
+ * Known page counts clamp the index between `0` and `pageCount - 1`.
70
78
  *
71
79
  * @example
72
80
  * ```ts
@@ -85,9 +93,10 @@ function table_setPageIndex(table, updater) {
85
93
  });
86
94
  }
87
95
  /**
88
- * Resets the table's page index state slice.
96
+ * Resets only `pagination.pageIndex`.
89
97
  *
90
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
98
+ * With no argument, the reset uses `table.initialState.pagination?.pageIndex`
99
+ * or `0`. Passing `true` always resets the page index to `0`.
91
100
  *
92
101
  * @example
93
102
  * ```ts
@@ -103,9 +112,10 @@ function table_resetPageIndex(table, defaultState) {
103
112
  table_setPageIndex(table, newPageIndex);
104
113
  }
105
114
  /**
106
- * Resets the table's page size state slice.
115
+ * Resets only `pagination.pageSize`.
107
116
  *
108
- * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
117
+ * With no argument, the reset uses `table.initialState.pagination?.pageSize`
118
+ * or `10`. Passing `true` always resets the page size to `10`.
109
119
  *
110
120
  * @example
111
121
  * ```ts
@@ -121,9 +131,10 @@ function table_resetPageSize(table, defaultState) {
121
131
  table_setPageSize(table, newPageSize);
122
132
  }
123
133
  /**
124
- * Updates the table's page size state slice.
134
+ * Updates `pagination.pageSize` while preserving the current top row.
125
135
  *
126
- * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
136
+ * The new size is clamped to at least `1`, and `pageIndex` is recalculated so
137
+ * the row that was previously at the top of the page remains in view.
127
138
  *
128
139
  * @example
129
140
  * ```ts
@@ -143,13 +154,14 @@ function table_setPageSize(table, updater) {
143
154
  });
144
155
  }
145
156
  /**
146
- * Returns page options for the table.
157
+ * Builds the zero-based page indexes available for the current page count.
147
158
  *
148
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
159
+ * Unknown or empty page counts return an empty array; otherwise the result is
160
+ * `[0, 1, ...pageCount - 1]`.
149
161
  *
150
162
  * @example
151
163
  * ```ts
152
- * const value = table_getPageOptions(table)
164
+ * const pageIndexes = table_getPageOptions(table)
153
165
  * ```
154
166
  */
155
167
  function table_getPageOptions(table) {
@@ -159,13 +171,14 @@ function table_getPageOptions(table) {
159
171
  return pageOptions;
160
172
  }
161
173
  /**
162
- * Returns can previous page for the table.
174
+ * Checks whether the current page index can move backward.
163
175
  *
164
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
176
+ * The first page is page index `0`, so only positive page indexes can navigate
177
+ * to a previous page.
165
178
  *
166
179
  * @example
167
180
  * ```ts
168
- * const value = table_getCanPreviousPage(table)
181
+ * const canGoBack = table_getCanPreviousPage(table)
169
182
  * ```
170
183
  */
171
184
  function table_getCanPreviousPage(table) {
@@ -173,13 +186,14 @@ function table_getCanPreviousPage(table) {
173
186
  return (((_table$atoms$paginati3 = table.atoms.pagination) === null || _table$atoms$paginati3 === void 0 || (_table$atoms$paginati3 = _table$atoms$paginati3.get()) === null || _table$atoms$paginati3 === void 0 ? void 0 : _table$atoms$paginati3.pageIndex) ?? 0) > 0;
174
187
  }
175
188
  /**
176
- * Returns can next page for the table.
189
+ * Checks whether the current page index can move forward.
177
190
  *
178
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
191
+ * A `pageCount` of `-1` means the caller does not know the total page count, so
192
+ * this returns `true`. A page count of `0` returns `false`.
179
193
  *
180
194
  * @example
181
195
  * ```ts
182
- * const value = table_getCanNextPage(table)
196
+ * const canGoForward = table_getCanNextPage(table)
183
197
  * ```
184
198
  */
185
199
  function table_getCanNextPage(table) {
@@ -247,13 +261,14 @@ function table_lastPage(table) {
247
261
  return table_setPageIndex(table, table_getPageCount(table) - 1);
248
262
  }
249
263
  /**
250
- * Returns page count for the table.
264
+ * Resolves the number of pages for the current pagination state.
251
265
  *
252
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
266
+ * `options.pageCount` wins for manual pagination. Otherwise the value is
267
+ * calculated from `table_getRowCount(table)` and the current `pageSize`.
253
268
  *
254
269
  * @example
255
270
  * ```ts
256
- * const value = table_getPageCount(table)
271
+ * const pages = table_getPageCount(table)
257
272
  * ```
258
273
  */
259
274
  function table_getPageCount(table) {
@@ -261,13 +276,15 @@ function table_getPageCount(table) {
261
276
  return table.options.pageCount ?? Math.ceil(table_getRowCount(table) / (((_table$atoms$paginati5 = table.atoms.pagination) === null || _table$atoms$paginati5 === void 0 || (_table$atoms$paginati5 = _table$atoms$paginati5.get()) === null || _table$atoms$paginati5 === void 0 ? void 0 : _table$atoms$paginati5.pageSize) ?? defaultPageSize));
262
277
  }
263
278
  /**
264
- * Returns row count for the table.
279
+ * Resolves the total row count used for pagination math.
265
280
  *
266
- * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.
281
+ * `options.rowCount` wins for manual pagination. Otherwise the count comes
282
+ * from the pre-paginated row model so filtering, grouping, sorting, and
283
+ * expansion are reflected before the page slice is applied.
267
284
  *
268
285
  * @example
269
286
  * ```ts
270
- * const value = table_getRowCount(table)
287
+ * const rows = table_getRowCount(table)
271
288
  * ```
272
289
  */
273
290
  function table_getRowCount(table) {
@@ -1 +1 @@
1
- {"version":3,"file":"rowPaginationFeature.utils.js","names":[],"sources":["../../../src/features/row-pagination/rowPaginationFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { PaginationState } from './rowPaginationFeature.types'\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\n/**\n * Returns the default pagination 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 = getDefaultPaginationState()\n * ```\n */\nexport function getDefaultPaginationState(): PaginationState {\n return {\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n }\n}\n\n/**\n * Schedules an automatic reset for page index.\n *\n * The reset only runs when the related feature options allow automatic resets for the current table state change.\n *\n * @example\n * ```ts\n * table_autoResetPageIndex(table)\n * ```\n */\nexport function table_autoResetPageIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n table_resetPageIndex(table)\n }\n}\n\n/**\n * Updates the table's pagination 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_setPagination(table, (old) => old)\n * ```\n */\nexport function table_setPagination<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<PaginationState>) {\n const safeUpdater: Updater<PaginationState> = (old) => {\n const newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n}\n\n/**\n * Resets the table's pagination 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_resetPagination(table)\n * table_resetPagination(table, true)\n * ```\n */\nexport function table_resetPagination<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setPagination(\n table,\n defaultState\n ? getDefaultPaginationState()\n : cloneState(\n table.initialState.pagination ?? getDefaultPaginationState(),\n ),\n )\n}\n\n/**\n * Updates the table's page index 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_setPageIndex(table, (old) => old)\n * ```\n */\nexport function table_setPageIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>) {\n table_setPagination(table, (old) => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n}\n\n/**\n * Resets the table's page index 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_resetPageIndex(table)\n * table_resetPageIndex(table, true)\n * ```\n */\nexport function table_resetPageIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n const currentPageIndex =\n table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex\n const newPageIndex = defaultState\n ? defaultPageIndex\n : (table.initialState.pagination?.pageIndex ?? defaultPageIndex)\n if (newPageIndex === currentPageIndex) return\n table_setPageIndex(table, newPageIndex)\n}\n\n/**\n * Resets the table's page size 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_resetPageSize(table)\n * table_resetPageSize(table, true)\n * ```\n */\nexport function table_resetPageSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n const currentPageSize =\n table.atoms.pagination?.get()?.pageSize ?? defaultPageSize\n const newPageSize = defaultState\n ? defaultPageSize\n : (table.initialState.pagination?.pageSize ?? defaultPageSize)\n if (newPageSize === currentPageSize) return\n table_setPageSize(table, newPageSize)\n}\n\n/**\n * Updates the table's page size 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_setPageSize(table, (old) => old)\n * ```\n */\nexport function table_setPageSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>) {\n table_setPagination(table, (old) => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n}\n\n/**\n * Returns page options 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_getPageOptions(table)\n * ```\n */\nexport function table_getPageOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const pageCount = table_getPageCount(table)\n let pageOptions: Array<number> = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n}\n\n/**\n * Returns can previous page 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_getCanPreviousPage(table)\n * ```\n */\nexport function table_getCanPreviousPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (table.atoms.pagination?.get()?.pageIndex ?? 0) > 0\n}\n\n/**\n * Returns can next page 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_getCanNextPage(table)\n * ```\n */\nexport function table_getCanNextPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const pageIndex = table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex\n\n const pageCount = table_getPageCount(table)\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n}\n\n/**\n * Moves the table to the previous page.\n *\n * This delegates to `table_setPageIndex` so pagination state ownership and\n * updater semantics remain consistent.\n *\n * @example\n * ```ts\n * table_previousPage(table)\n * ```\n */\nexport function table_previousPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, (old) => old - 1)\n}\n\n/**\n * Moves the table to the next page.\n *\n * This delegates to `table_setPageIndex` so pagination state ownership and\n * updater semantics remain consistent.\n *\n * @example\n * ```ts\n * table_nextPage(table)\n * ```\n */\nexport function table_nextPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, (old) => {\n return old + 1\n })\n}\n\n/**\n * Moves the table to the first page.\n *\n * This is a convenience wrapper around `table_setPageIndex(table, 0)`.\n *\n * @example\n * ```ts\n * table_firstPage(table)\n * ```\n */\nexport function table_firstPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, 0)\n}\n\n/**\n * Moves the table to the last known page.\n *\n * The target page is derived from `table_getPageCount(table) - 1`.\n *\n * @example\n * ```ts\n * table_lastPage(table)\n * ```\n */\nexport function table_lastPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, table_getPageCount(table) - 1)\n}\n\n/**\n * Returns page count 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_getPageCount(table)\n * ```\n */\nexport function table_getPageCount<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n table.options.pageCount ??\n Math.ceil(\n table_getRowCount(table) /\n (table.atoms.pagination?.get()?.pageSize ?? defaultPageSize),\n )\n )\n}\n\n/**\n * Returns row count 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_getRowCount(table)\n * ```\n */\nexport function table_getRowCount<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table.options.rowCount ?? table.getPrePaginatedRowModel().rows.length\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"rowPaginationFeature.utils.js","names":[],"sources":["../../../src/features/row-pagination/rowPaginationFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { PaginationState } from './rowPaginationFeature.types'\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\n/**\n * Creates the default pagination state used by the pagination feature.\n *\n * The feature default starts at the first page with a page size of 10. Reset\n * APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const pagination = getDefaultPaginationState()\n * ```\n */\nexport function getDefaultPaginationState(): PaginationState {\n return {\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n }\n}\n\n/**\n * Resets the page index when a page-altering change should return to page 0.\n *\n * The reset runs when `autoResetAll`, `autoResetPageIndex`, or the default\n * client-side pagination behavior allows it. Manual pagination opts out unless\n * the reset options explicitly opt back in.\n *\n * @example\n * ```ts\n * table_autoResetPageIndex(table)\n * ```\n */\nexport function table_autoResetPageIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n table_resetPageIndex(table)\n }\n}\n\n/**\n * Routes a pagination updater through the table's pagination change handler.\n *\n * The updater may be a next state object or a function of the previous\n * `PaginationState`; controlled state and external atoms observe the same\n * updater path as the instance API.\n *\n * @example\n * ```ts\n * table_setPagination(table, (old) => old)\n * ```\n */\nexport function table_setPagination<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<PaginationState>) {\n const safeUpdater: Updater<PaginationState> = (old) => {\n const newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n}\n\n/**\n * Resets `pagination` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.pagination` when it\n * exists. Passing `true` ignores initial state and resets to\n * `{ pageIndex: 0, pageSize: 10 }`.\n *\n * @example\n * ```ts\n * table_resetPagination(table)\n * table_resetPagination(table, true)\n * ```\n */\nexport function table_resetPagination<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setPagination(\n table,\n defaultState\n ? getDefaultPaginationState()\n : cloneState(\n table.initialState.pagination ?? getDefaultPaginationState(),\n ),\n )\n}\n\n/**\n * Updates `pagination.pageIndex` and clamps it to the known page range.\n *\n * Unknown page counts (`undefined` or `-1`) allow any non-negative page index.\n * Known page counts clamp the index between `0` and `pageCount - 1`.\n *\n * @example\n * ```ts\n * table_setPageIndex(table, (old) => old)\n * ```\n */\nexport function table_setPageIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>) {\n table_setPagination(table, (old) => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n}\n\n/**\n * Resets only `pagination.pageIndex`.\n *\n * With no argument, the reset uses `table.initialState.pagination?.pageIndex`\n * or `0`. Passing `true` always resets the page index to `0`.\n *\n * @example\n * ```ts\n * table_resetPageIndex(table)\n * table_resetPageIndex(table, true)\n * ```\n */\nexport function table_resetPageIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n const currentPageIndex =\n table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex\n const newPageIndex = defaultState\n ? defaultPageIndex\n : (table.initialState.pagination?.pageIndex ?? defaultPageIndex)\n if (newPageIndex === currentPageIndex) return\n table_setPageIndex(table, newPageIndex)\n}\n\n/**\n * Resets only `pagination.pageSize`.\n *\n * With no argument, the reset uses `table.initialState.pagination?.pageSize`\n * or `10`. Passing `true` always resets the page size to `10`.\n *\n * @example\n * ```ts\n * table_resetPageSize(table)\n * table_resetPageSize(table, true)\n * ```\n */\nexport function table_resetPageSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n const currentPageSize =\n table.atoms.pagination?.get()?.pageSize ?? defaultPageSize\n const newPageSize = defaultState\n ? defaultPageSize\n : (table.initialState.pagination?.pageSize ?? defaultPageSize)\n if (newPageSize === currentPageSize) return\n table_setPageSize(table, newPageSize)\n}\n\n/**\n * Updates `pagination.pageSize` while preserving the current top row.\n *\n * The new size is clamped to at least `1`, and `pageIndex` is recalculated so\n * the row that was previously at the top of the page remains in view.\n *\n * @example\n * ```ts\n * table_setPageSize(table, (old) => old)\n * ```\n */\nexport function table_setPageSize<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>) {\n table_setPagination(table, (old) => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n}\n\n/**\n * Builds the zero-based page indexes available for the current page count.\n *\n * Unknown or empty page counts return an empty array; otherwise the result is\n * `[0, 1, ...pageCount - 1]`.\n *\n * @example\n * ```ts\n * const pageIndexes = table_getPageOptions(table)\n * ```\n */\nexport function table_getPageOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const pageCount = table_getPageCount(table)\n let pageOptions: Array<number> = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n}\n\n/**\n * Checks whether the current page index can move backward.\n *\n * The first page is page index `0`, so only positive page indexes can navigate\n * to a previous page.\n *\n * @example\n * ```ts\n * const canGoBack = table_getCanPreviousPage(table)\n * ```\n */\nexport function table_getCanPreviousPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (table.atoms.pagination?.get()?.pageIndex ?? 0) > 0\n}\n\n/**\n * Checks whether the current page index can move forward.\n *\n * A `pageCount` of `-1` means the caller does not know the total page count, so\n * this returns `true`. A page count of `0` returns `false`.\n *\n * @example\n * ```ts\n * const canGoForward = table_getCanNextPage(table)\n * ```\n */\nexport function table_getCanNextPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const pageIndex = table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex\n\n const pageCount = table_getPageCount(table)\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n}\n\n/**\n * Moves the table to the previous page.\n *\n * This delegates to `table_setPageIndex` so pagination state ownership and\n * updater semantics remain consistent.\n *\n * @example\n * ```ts\n * table_previousPage(table)\n * ```\n */\nexport function table_previousPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, (old) => old - 1)\n}\n\n/**\n * Moves the table to the next page.\n *\n * This delegates to `table_setPageIndex` so pagination state ownership and\n * updater semantics remain consistent.\n *\n * @example\n * ```ts\n * table_nextPage(table)\n * ```\n */\nexport function table_nextPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, (old) => {\n return old + 1\n })\n}\n\n/**\n * Moves the table to the first page.\n *\n * This is a convenience wrapper around `table_setPageIndex(table, 0)`.\n *\n * @example\n * ```ts\n * table_firstPage(table)\n * ```\n */\nexport function table_firstPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, 0)\n}\n\n/**\n * Moves the table to the last known page.\n *\n * The target page is derived from `table_getPageCount(table) - 1`.\n *\n * @example\n * ```ts\n * table_lastPage(table)\n * ```\n */\nexport function table_lastPage<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table_setPageIndex(table, table_getPageCount(table) - 1)\n}\n\n/**\n * Resolves the number of pages for the current pagination state.\n *\n * `options.pageCount` wins for manual pagination. Otherwise the value is\n * calculated from `table_getRowCount(table)` and the current `pageSize`.\n *\n * @example\n * ```ts\n * const pages = table_getPageCount(table)\n * ```\n */\nexport function table_getPageCount<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n table.options.pageCount ??\n Math.ceil(\n table_getRowCount(table) /\n (table.atoms.pagination?.get()?.pageSize ?? defaultPageSize),\n )\n )\n}\n\n/**\n * Resolves the total row count used for pagination math.\n *\n * `options.rowCount` wins for manual pagination. Otherwise the count comes\n * from the pre-paginated row model so filtering, grouping, sorting, and\n * expansion are reflected before the page slice is applied.\n *\n * @example\n * ```ts\n * const rows = table_getRowCount(table)\n * ```\n */\nexport function table_getRowCount<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table.options.rowCount ?? table.getPrePaginatedRowModel().rows.length\n}\n"],"mappings":"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"}
@@ -13,7 +13,9 @@ interface TableState_RowPinning {
13
13
  }
14
14
  interface TableOptions_RowPinning<TFeatures extends TableFeatures, TData extends RowData> {
15
15
  /**
16
- * Enables/disables row pinning for the table. Defaults to `true`.
16
+ * Allows rows to be pinned to top or bottom regions.
17
+ *
18
+ * Provide a predicate to decide per row. Defaults to `true`.
17
19
  */
18
20
  enableRowPinning?: boolean | ((row: Row<TFeatures, TData>) => boolean);
19
21
  /**
@@ -32,7 +34,7 @@ interface RowPinningDefaultOptions {
32
34
  }
33
35
  interface Row_RowPinning {
34
36
  /**
35
- * Returns whether or not the row can be pinned.
37
+ * Checks whether this row can be pinned.
36
38
  */
37
39
  getCanPin: () => boolean;
38
40
  /**
@@ -50,27 +52,29 @@ interface Row_RowPinning {
50
52
  }
51
53
  interface Table_RowPinning<TFeatures extends TableFeatures, TData extends RowData> {
52
54
  /**
53
- * Returns all bottom pinned rows.
55
+ * Gets rows pinned to the bottom region.
54
56
  */
55
57
  getBottomRows: () => Array<Row<TFeatures, TData>>;
56
58
  /**
57
- * Returns all rows that are not pinned to the top or bottom.
59
+ * Gets rows that are not pinned to the top or bottom region.
58
60
  */
59
61
  getCenterRows: () => Array<Row<TFeatures, TData>>;
60
62
  /**
61
- * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.
63
+ * Checks whether any rows are pinned, optionally limited to one region.
62
64
  */
63
65
  getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean;
64
66
  /**
65
- * Returns all top pinned rows.
67
+ * Gets rows pinned to the top region.
66
68
  */
67
69
  getTopRows: () => Array<Row<TFeatures, TData>>;
68
70
  /**
69
- * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.
71
+ * Resets `rowPinning` to `initialState.rowPinning`.
72
+ *
73
+ * Pass `true` to ignore initial state and reset to empty top/bottom arrays.
70
74
  */
71
75
  resetRowPinning: (defaultState?: boolean) => void;
72
76
  /**
73
- * Sets row pinning state using a value or updater.
77
+ * Updates row pinning state with a next state or updater function.
74
78
  */
75
79
  setRowPinning: (updater: Updater<RowPinningState>) => void;
76
80
  }
@@ -13,7 +13,9 @@ interface TableState_RowPinning {
13
13
  }
14
14
  interface TableOptions_RowPinning<TFeatures extends TableFeatures, TData extends RowData> {
15
15
  /**
16
- * Enables/disables row pinning for the table. Defaults to `true`.
16
+ * Allows rows to be pinned to top or bottom regions.
17
+ *
18
+ * Provide a predicate to decide per row. Defaults to `true`.
17
19
  */
18
20
  enableRowPinning?: boolean | ((row: Row<TFeatures, TData>) => boolean);
19
21
  /**
@@ -32,7 +34,7 @@ interface RowPinningDefaultOptions {
32
34
  }
33
35
  interface Row_RowPinning {
34
36
  /**
35
- * Returns whether or not the row can be pinned.
37
+ * Checks whether this row can be pinned.
36
38
  */
37
39
  getCanPin: () => boolean;
38
40
  /**
@@ -50,27 +52,29 @@ interface Row_RowPinning {
50
52
  }
51
53
  interface Table_RowPinning<TFeatures extends TableFeatures, TData extends RowData> {
52
54
  /**
53
- * Returns all bottom pinned rows.
55
+ * Gets rows pinned to the bottom region.
54
56
  */
55
57
  getBottomRows: () => Array<Row<TFeatures, TData>>;
56
58
  /**
57
- * Returns all rows that are not pinned to the top or bottom.
59
+ * Gets rows that are not pinned to the top or bottom region.
58
60
  */
59
61
  getCenterRows: () => Array<Row<TFeatures, TData>>;
60
62
  /**
61
- * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.
63
+ * Checks whether any rows are pinned, optionally limited to one region.
62
64
  */
63
65
  getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean;
64
66
  /**
65
- * Returns all top pinned rows.
67
+ * Gets rows pinned to the top region.
66
68
  */
67
69
  getTopRows: () => Array<Row<TFeatures, TData>>;
68
70
  /**
69
- * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.
71
+ * Resets `rowPinning` to `initialState.rowPinning`.
72
+ *
73
+ * Pass `true` to ignore initial state and reset to empty top/bottom arrays.
70
74
  */
71
75
  resetRowPinning: (defaultState?: boolean) => void;
72
76
  /**
73
- * Sets row pinning state using a value or updater.
77
+ * Updates row pinning state with a next state or updater function.
74
78
  */
75
79
  setRowPinning: (updater: Updater<RowPinningState>) => void;
76
80
  }