@tanstack/table-core 9.0.0-beta.15 → 9.0.0-beta.17

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 (160) hide show
  1. package/dist/core/cells/constructCell.d.cts +2 -2
  2. package/dist/core/cells/constructCell.d.ts +2 -2
  3. package/dist/core/cells/coreCellsFeature.types.d.cts +2 -2
  4. package/dist/core/cells/coreCellsFeature.types.d.ts +2 -2
  5. package/dist/core/cells/coreCellsFeature.utils.d.cts +2 -2
  6. package/dist/core/cells/coreCellsFeature.utils.d.ts +2 -2
  7. package/dist/core/columns/constructColumn.d.cts +2 -2
  8. package/dist/core/columns/constructColumn.d.ts +2 -2
  9. package/dist/core/columns/coreColumnsFeature.types.d.cts +2 -2
  10. package/dist/core/columns/coreColumnsFeature.types.d.ts +2 -2
  11. package/dist/core/columns/coreColumnsFeature.utils.cjs +2 -2
  12. package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
  13. package/dist/core/columns/coreColumnsFeature.utils.d.cts +8 -8
  14. package/dist/core/columns/coreColumnsFeature.utils.d.ts +8 -8
  15. package/dist/core/columns/coreColumnsFeature.utils.js +3 -3
  16. package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
  17. package/dist/core/headers/buildHeaderGroups.d.cts +2 -2
  18. package/dist/core/headers/buildHeaderGroups.d.ts +2 -2
  19. package/dist/core/headers/constructHeader.d.cts +2 -2
  20. package/dist/core/headers/constructHeader.d.ts +2 -2
  21. package/dist/core/headers/coreHeadersFeature.utils.d.cts +6 -6
  22. package/dist/core/headers/coreHeadersFeature.utils.d.ts +6 -6
  23. package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +13 -13
  24. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +13 -13
  25. package/dist/core/row-models/createCoreRowModel.cjs +1 -1
  26. package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
  27. package/dist/core/row-models/createCoreRowModel.d.cts +2 -2
  28. package/dist/core/row-models/createCoreRowModel.d.ts +2 -2
  29. package/dist/core/row-models/createCoreRowModel.js +2 -2
  30. package/dist/core/row-models/createCoreRowModel.js.map +1 -1
  31. package/dist/core/rows/constructRow.cjs +3 -2
  32. package/dist/core/rows/constructRow.cjs.map +1 -1
  33. package/dist/core/rows/constructRow.d.cts +2 -2
  34. package/dist/core/rows/constructRow.d.ts +2 -2
  35. package/dist/core/rows/constructRow.js +4 -2
  36. package/dist/core/rows/constructRow.js.map +1 -1
  37. package/dist/core/rows/coreRowsFeature.types.d.cts +2 -2
  38. package/dist/core/rows/coreRowsFeature.types.d.ts +2 -2
  39. package/dist/core/rows/coreRowsFeature.utils.cjs +3 -3
  40. package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
  41. package/dist/core/rows/coreRowsFeature.utils.d.cts +3 -3
  42. package/dist/core/rows/coreRowsFeature.utils.d.ts +3 -3
  43. package/dist/core/rows/coreRowsFeature.utils.js +4 -4
  44. package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
  45. package/dist/core/table/coreTablesFeature.types.d.cts +1 -1
  46. package/dist/core/table/coreTablesFeature.types.d.ts +1 -1
  47. package/dist/core/table/coreTablesFeature.utils.d.cts +5 -5
  48. package/dist/core/table/coreTablesFeature.utils.d.ts +5 -5
  49. package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +8 -8
  50. package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +8 -8
  51. package/dist/features/column-filtering/columnFilteringFeature.cjs +2 -2
  52. package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
  53. package/dist/features/column-filtering/columnFilteringFeature.js +3 -3
  54. package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
  55. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +12 -12
  56. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +12 -12
  57. package/dist/features/column-filtering/createFilteredRowModel.cjs +8 -5
  58. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  59. package/dist/features/column-filtering/createFilteredRowModel.js +9 -6
  60. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  61. package/dist/features/column-filtering/filterRowsUtils.cjs +3 -2
  62. package/dist/features/column-filtering/filterRowsUtils.cjs.map +1 -1
  63. package/dist/features/column-filtering/filterRowsUtils.js +3 -2
  64. package/dist/features/column-filtering/filterRowsUtils.js.map +1 -1
  65. package/dist/features/column-grouping/columnGroupingFeature.cjs +1 -1
  66. package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
  67. package/dist/features/column-grouping/columnGroupingFeature.js +2 -2
  68. package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
  69. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +3 -3
  70. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
  71. package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +11 -11
  72. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +11 -11
  73. package/dist/features/column-grouping/columnGroupingFeature.utils.js +4 -4
  74. package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
  75. package/dist/features/column-grouping/createGroupedRowModel.cjs +4 -5
  76. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  77. package/dist/features/column-grouping/createGroupedRowModel.js +5 -6
  78. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  79. package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +9 -9
  80. package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +9 -9
  81. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +29 -29
  82. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +29 -29
  83. package/dist/features/column-resizing/columnResizingFeature.utils.cjs +2 -5
  84. package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
  85. package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +6 -6
  86. package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +6 -6
  87. package/dist/features/column-resizing/columnResizingFeature.utils.js +3 -6
  88. package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
  89. package/dist/features/column-sizing/columnSizingFeature.utils.cjs +11 -4
  90. package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
  91. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +12 -12
  92. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +12 -12
  93. package/dist/features/column-sizing/columnSizingFeature.utils.js +12 -5
  94. package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
  95. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +12 -9
  96. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
  97. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +14 -14
  98. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +14 -14
  99. package/dist/features/column-visibility/columnVisibilityFeature.utils.js +13 -10
  100. package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
  101. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +6 -6
  102. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +6 -6
  103. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +21 -12
  104. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
  105. package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +10 -10
  106. package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +10 -10
  107. package/dist/features/row-expanding/rowExpandingFeature.utils.js +22 -13
  108. package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
  109. package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +17 -17
  110. package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +17 -17
  111. package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +7 -7
  112. package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +7 -7
  113. package/dist/features/row-selection/rowSelectionFeature.utils.cjs +15 -12
  114. package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
  115. package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +27 -15
  116. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +27 -15
  117. package/dist/features/row-selection/rowSelectionFeature.utils.js +16 -13
  118. package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
  119. package/dist/features/row-sorting/createSortedRowModel.cjs +1 -1
  120. package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
  121. package/dist/features/row-sorting/createSortedRowModel.js +2 -2
  122. package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
  123. package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +16 -16
  124. package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +16 -16
  125. package/dist/index.cjs +2 -0
  126. package/dist/index.d.cts +4 -4
  127. package/dist/index.d.ts +4 -4
  128. package/dist/index.js +2 -2
  129. package/dist/types/Column.d.cts +2 -4
  130. package/dist/types/Column.d.ts +2 -4
  131. package/dist/types/Table.d.cts +3 -16
  132. package/dist/types/Table.d.ts +3 -16
  133. package/dist/types/TableFeatures.d.cts +7 -7
  134. package/dist/types/TableFeatures.d.ts +7 -7
  135. package/dist/utils.cjs +24 -2
  136. package/dist/utils.cjs.map +1 -1
  137. package/dist/utils.d.cts +16 -5
  138. package/dist/utils.d.ts +16 -5
  139. package/dist/utils.js +23 -3
  140. package/dist/utils.js.map +1 -1
  141. package/package.json +2 -2
  142. package/src/core/columns/coreColumnsFeature.utils.ts +3 -3
  143. package/src/core/headers/coreHeadersFeature.types.ts +2 -2
  144. package/src/core/row-models/createCoreRowModel.ts +2 -2
  145. package/src/core/rows/constructRow.ts +3 -2
  146. package/src/core/rows/coreRowsFeature.utils.ts +4 -4
  147. package/src/features/column-filtering/columnFilteringFeature.ts +3 -2
  148. package/src/features/column-filtering/createFilteredRowModel.ts +13 -10
  149. package/src/features/column-filtering/filterRowsUtils.ts +3 -2
  150. package/src/features/column-grouping/columnGroupingFeature.ts +2 -1
  151. package/src/features/column-grouping/columnGroupingFeature.utils.ts +2 -2
  152. package/src/features/column-grouping/createGroupedRowModel.ts +10 -5
  153. package/src/features/column-resizing/columnResizingFeature.utils.ts +5 -6
  154. package/src/features/column-sizing/columnSizingFeature.utils.ts +27 -5
  155. package/src/features/column-visibility/columnVisibilityFeature.utils.ts +31 -15
  156. package/src/features/row-expanding/rowExpandingFeature.utils.ts +38 -13
  157. package/src/features/row-selection/rowSelectionFeature.utils.ts +35 -13
  158. package/src/features/row-sorting/createSortedRowModel.ts +6 -9
  159. package/src/types/Column.ts +3 -1
  160. package/src/utils.ts +24 -2
@@ -1,6 +1,6 @@
1
1
  import { RowData, Updater } from "../../types/type-utils.js";
2
2
  import { PaginationState } from "./rowPaginationFeature.types.js";
3
- import { Table_Internal } from "../../types/Table.js";
3
+ import { Table } from "../../types/Table.js";
4
4
  import { TableFeatures } from "../../types/TableFeatures.js";
5
5
 
6
6
  //#region src/features/row-pagination/rowPaginationFeature.utils.d.ts
@@ -28,7 +28,7 @@ declare function getDefaultPaginationState(): PaginationState;
28
28
  * table_autoResetPageIndex(table)
29
29
  * ```
30
30
  */
31
- declare function table_autoResetPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
31
+ declare function table_autoResetPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
32
32
  /**
33
33
  * Routes a pagination updater through the table's pagination change handler.
34
34
  *
@@ -41,7 +41,7 @@ declare function table_autoResetPageIndex<TFeatures extends TableFeatures, TData
41
41
  * table_setPagination(table, (old) => old)
42
42
  * ```
43
43
  */
44
- declare function table_setPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<PaginationState>): void | undefined;
44
+ declare function table_setPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<PaginationState>): void | undefined;
45
45
  /**
46
46
  * Resets `pagination` to the configured initial state or feature default.
47
47
  *
@@ -55,7 +55,7 @@ declare function table_setPagination<TFeatures extends TableFeatures, TData exte
55
55
  * table_resetPagination(table, true)
56
56
  * ```
57
57
  */
58
- declare function table_resetPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
58
+ declare function table_resetPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, defaultState?: boolean): void;
59
59
  /**
60
60
  * Updates `pagination.pageIndex` and clamps it to the known page range.
61
61
  *
@@ -67,7 +67,7 @@ declare function table_resetPagination<TFeatures extends TableFeatures, TData ex
67
67
  * table_setPageIndex(table, (old) => old)
68
68
  * ```
69
69
  */
70
- declare function table_setPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>): void;
70
+ declare function table_setPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<number>): void;
71
71
  /**
72
72
  * Resets only `pagination.pageIndex`.
73
73
  *
@@ -80,7 +80,7 @@ declare function table_setPageIndex<TFeatures extends TableFeatures, TData exten
80
80
  * table_resetPageIndex(table, true)
81
81
  * ```
82
82
  */
83
- declare function table_resetPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
83
+ declare function table_resetPageIndex<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, defaultState?: boolean): void;
84
84
  /**
85
85
  * Resets only `pagination.pageSize`.
86
86
  *
@@ -93,7 +93,7 @@ declare function table_resetPageIndex<TFeatures extends TableFeatures, TData ext
93
93
  * table_resetPageSize(table, true)
94
94
  * ```
95
95
  */
96
- declare function table_resetPageSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
96
+ declare function table_resetPageSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, defaultState?: boolean): void;
97
97
  /**
98
98
  * Updates `pagination.pageSize` while preserving the current top row.
99
99
  *
@@ -105,7 +105,7 @@ declare function table_resetPageSize<TFeatures extends TableFeatures, TData exte
105
105
  * table_setPageSize(table, (old) => old)
106
106
  * ```
107
107
  */
108
- declare function table_setPageSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<number>): void;
108
+ declare function table_setPageSize<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<number>): void;
109
109
  /**
110
110
  * Builds the zero-based page indexes available for the current page count.
111
111
  *
@@ -117,7 +117,7 @@ declare function table_setPageSize<TFeatures extends TableFeatures, TData extend
117
117
  * const pageIndexes = table_getPageOptions(table)
118
118
  * ```
119
119
  */
120
- declare function table_getPageOptions<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number[];
120
+ declare function table_getPageOptions<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): number[];
121
121
  /**
122
122
  * Checks whether the current page index can move backward.
123
123
  *
@@ -129,7 +129,7 @@ declare function table_getPageOptions<TFeatures extends TableFeatures, TData ext
129
129
  * const canGoBack = table_getCanPreviousPage(table)
130
130
  * ```
131
131
  */
132
- declare function table_getCanPreviousPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
132
+ declare function table_getCanPreviousPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): boolean;
133
133
  /**
134
134
  * Checks whether the current page index can move forward.
135
135
  *
@@ -141,7 +141,7 @@ declare function table_getCanPreviousPage<TFeatures extends TableFeatures, TData
141
141
  * const canGoForward = table_getCanNextPage(table)
142
142
  * ```
143
143
  */
144
- declare function table_getCanNextPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
144
+ declare function table_getCanNextPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): boolean;
145
145
  /**
146
146
  * Moves the table to the previous page.
147
147
  *
@@ -153,7 +153,7 @@ declare function table_getCanNextPage<TFeatures extends TableFeatures, TData ext
153
153
  * table_previousPage(table)
154
154
  * ```
155
155
  */
156
- declare function table_previousPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
156
+ declare function table_previousPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
157
157
  /**
158
158
  * Moves the table to the next page.
159
159
  *
@@ -165,7 +165,7 @@ declare function table_previousPage<TFeatures extends TableFeatures, TData exten
165
165
  * table_nextPage(table)
166
166
  * ```
167
167
  */
168
- declare function table_nextPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
168
+ declare function table_nextPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
169
169
  /**
170
170
  * Moves the table to the first page.
171
171
  *
@@ -176,7 +176,7 @@ declare function table_nextPage<TFeatures extends TableFeatures, TData extends R
176
176
  * table_firstPage(table)
177
177
  * ```
178
178
  */
179
- declare function table_firstPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
179
+ declare function table_firstPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
180
180
  /**
181
181
  * Moves the table to the last known page.
182
182
  *
@@ -187,7 +187,7 @@ declare function table_firstPage<TFeatures extends TableFeatures, TData extends
187
187
  * table_lastPage(table)
188
188
  * ```
189
189
  */
190
- declare function table_lastPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
190
+ declare function table_lastPage<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
191
191
  /**
192
192
  * Resolves the number of pages for the current pagination state.
193
193
  *
@@ -199,7 +199,7 @@ declare function table_lastPage<TFeatures extends TableFeatures, TData extends R
199
199
  * const pages = table_getPageCount(table)
200
200
  * ```
201
201
  */
202
- declare function table_getPageCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number;
202
+ declare function table_getPageCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): number;
203
203
  /**
204
204
  * Resolves the total row count used for pagination math.
205
205
  *
@@ -212,7 +212,7 @@ declare function table_getPageCount<TFeatures extends TableFeatures, TData exten
212
212
  * const rows = table_getRowCount(table)
213
213
  * ```
214
214
  */
215
- declare function table_getRowCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): number;
215
+ declare function table_getRowCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): number;
216
216
  //#endregion
217
217
  export { getDefaultPaginationState, table_autoResetPageIndex, table_firstPage, table_getCanNextPage, table_getCanPreviousPage, table_getPageCount, table_getPageOptions, table_getRowCount, table_lastPage, table_nextPage, table_previousPage, table_resetPageIndex, table_resetPageSize, table_resetPagination, table_setPageIndex, table_setPageSize, table_setPagination };
218
218
  //# sourceMappingURL=rowPaginationFeature.utils.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { RowData, Updater } from "../../types/type-utils.cjs";
2
2
  import { RowPinningPosition, RowPinningState } from "./rowPinningFeature.types.cjs";
3
3
  import { Row } from "../../types/Row.cjs";
4
- import { Table_Internal } from "../../types/Table.cjs";
4
+ import { Table } from "../../types/Table.cjs";
5
5
  import { TableFeatures } from "../../types/TableFeatures.cjs";
6
6
 
7
7
  //#region src/features/row-pinning/rowPinningFeature.utils.d.ts
@@ -28,7 +28,7 @@ declare function getDefaultRowPinningState(): RowPinningState;
28
28
  * table_setRowPinning(table, (old) => ({ ...old, top: [rowId] }))
29
29
  * ```
30
30
  */
31
- declare function table_setRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<RowPinningState>): void;
31
+ declare function table_setRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<RowPinningState>): void;
32
32
  /**
33
33
  * Resets `rowPinning` to the configured initial state or feature default.
34
34
  *
@@ -42,7 +42,7 @@ declare function table_setRowPinning<TFeatures extends TableFeatures, TData exte
42
42
  * table_resetRowPinning(table, true)
43
43
  * ```
44
44
  */
45
- declare function table_resetRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
45
+ declare function table_resetRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, defaultState?: boolean): void;
46
46
  /**
47
47
  * Checks whether any rows are pinned.
48
48
  *
@@ -54,7 +54,7 @@ declare function table_resetRowPinning<TFeatures extends TableFeatures, TData ex
54
54
  * const hasPinnedRows = table_getIsSomeRowsPinned(table)
55
55
  * ```
56
56
  */
57
- declare function table_getIsSomeRowsPinned<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, position?: RowPinningPosition): boolean;
57
+ declare function table_getIsSomeRowsPinned<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, position?: RowPinningPosition): boolean;
58
58
  /**
59
59
  * Resolves the visible rows pinned to the top region.
60
60
  *
@@ -66,7 +66,7 @@ declare function table_getIsSomeRowsPinned<TFeatures extends TableFeatures, TDat
66
66
  * const rows = table_getTopRows(table)
67
67
  * ```
68
68
  */
69
- declare function table_getTopRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>>;
69
+ declare function table_getTopRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Row<TFeatures, TData>>;
70
70
  /**
71
71
  * Resolves the visible rows pinned to the bottom region.
72
72
  *
@@ -78,7 +78,7 @@ declare function table_getTopRows<TFeatures extends TableFeatures, TData extends
78
78
  * const rows = table_getBottomRows(table)
79
79
  * ```
80
80
  */
81
- declare function table_getBottomRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>>;
81
+ declare function table_getBottomRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Row<TFeatures, TData>>;
82
82
  /**
83
83
  * Resolves rows that are not pinned to top or bottom.
84
84
  *
@@ -90,7 +90,7 @@ declare function table_getBottomRows<TFeatures extends TableFeatures, TData exte
90
90
  * const rows = table_getCenterRows(table)
91
91
  * ```
92
92
  */
93
- declare function table_getCenterRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>>;
93
+ declare function table_getCenterRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Row<TFeatures, TData>>;
94
94
  /**
95
95
  * Checks whether this row can be pinned.
96
96
  *
@@ -1,7 +1,7 @@
1
1
  import { RowData, Updater } from "../../types/type-utils.js";
2
2
  import { RowPinningPosition, RowPinningState } from "./rowPinningFeature.types.js";
3
3
  import { Row } from "../../types/Row.js";
4
- import { Table_Internal } from "../../types/Table.js";
4
+ import { Table } from "../../types/Table.js";
5
5
  import { TableFeatures } from "../../types/TableFeatures.js";
6
6
 
7
7
  //#region src/features/row-pinning/rowPinningFeature.utils.d.ts
@@ -28,7 +28,7 @@ declare function getDefaultRowPinningState(): RowPinningState;
28
28
  * table_setRowPinning(table, (old) => ({ ...old, top: [rowId] }))
29
29
  * ```
30
30
  */
31
- declare function table_setRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<RowPinningState>): void;
31
+ declare function table_setRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<RowPinningState>): void;
32
32
  /**
33
33
  * Resets `rowPinning` to the configured initial state or feature default.
34
34
  *
@@ -42,7 +42,7 @@ declare function table_setRowPinning<TFeatures extends TableFeatures, TData exte
42
42
  * table_resetRowPinning(table, true)
43
43
  * ```
44
44
  */
45
- declare function table_resetRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
45
+ declare function table_resetRowPinning<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, defaultState?: boolean): void;
46
46
  /**
47
47
  * Checks whether any rows are pinned.
48
48
  *
@@ -54,7 +54,7 @@ declare function table_resetRowPinning<TFeatures extends TableFeatures, TData ex
54
54
  * const hasPinnedRows = table_getIsSomeRowsPinned(table)
55
55
  * ```
56
56
  */
57
- declare function table_getIsSomeRowsPinned<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, position?: RowPinningPosition): boolean;
57
+ declare function table_getIsSomeRowsPinned<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, position?: RowPinningPosition): boolean;
58
58
  /**
59
59
  * Resolves the visible rows pinned to the top region.
60
60
  *
@@ -66,7 +66,7 @@ declare function table_getIsSomeRowsPinned<TFeatures extends TableFeatures, TDat
66
66
  * const rows = table_getTopRows(table)
67
67
  * ```
68
68
  */
69
- declare function table_getTopRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>>;
69
+ declare function table_getTopRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Row<TFeatures, TData>>;
70
70
  /**
71
71
  * Resolves the visible rows pinned to the bottom region.
72
72
  *
@@ -78,7 +78,7 @@ declare function table_getTopRows<TFeatures extends TableFeatures, TData extends
78
78
  * const rows = table_getBottomRows(table)
79
79
  * ```
80
80
  */
81
- declare function table_getBottomRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>>;
81
+ declare function table_getBottomRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Row<TFeatures, TData>>;
82
82
  /**
83
83
  * Resolves rows that are not pinned to top or bottom.
84
84
  *
@@ -90,7 +90,7 @@ declare function table_getBottomRows<TFeatures extends TableFeatures, TData exte
90
90
  * const rows = table_getCenterRows(table)
91
91
  * ```
92
92
  */
93
- declare function table_getCenterRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>>;
93
+ declare function table_getCenterRows<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Row<TFeatures, TData>>;
94
94
  /**
95
95
  * Checks whether this row can be pinned.
96
96
  *
@@ -13,7 +13,7 @@ const require_utils = require('../../utils.cjs');
13
13
  * ```
14
14
  */
15
15
  function getDefaultRowSelectionState() {
16
- return {};
16
+ return require_utils.makeObjectMap();
17
17
  }
18
18
  /**
19
19
  * Routes a row selection updater through the table's selection change handler.
@@ -43,7 +43,7 @@ function table_setRowSelection(table, updater) {
43
43
  * ```
44
44
  */
45
45
  function table_resetRowSelection(table, defaultState) {
46
- table_setRowSelection(table, defaultState ? {} : require_utils.cloneState(table.initialState.rowSelection ?? {}));
46
+ table_setRowSelection(table, defaultState ? require_utils.makeObjectMap() : Object.assign(require_utils.makeObjectMap(), require_utils.cloneState(table.initialState.rowSelection ?? {})));
47
47
  }
48
48
  /**
49
49
  * Selects or deselects every selectable row before grouping.
@@ -59,7 +59,7 @@ function table_resetRowSelection(table, defaultState) {
59
59
  function table_toggleAllRowsSelected(table, value) {
60
60
  table_setRowSelection(table, (old) => {
61
61
  value = typeof value !== "undefined" ? value : !table_getIsAllRowsSelected(table);
62
- const rowSelection = { ...old };
62
+ const rowSelection = Object.assign(require_utils.makeObjectMap(), old);
63
63
  const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
64
64
  if (value) preGroupedFlatRows.forEach((row) => {
65
65
  if (!row_getCanSelect(row)) return;
@@ -85,7 +85,7 @@ function table_toggleAllRowsSelected(table, value) {
85
85
  function table_toggleAllPageRowsSelected(table, value) {
86
86
  table_setRowSelection(table, (old) => {
87
87
  const resolvedValue = typeof value !== "undefined" ? value : !table_getIsAllPageRowsSelected(table);
88
- const rowSelection = { ...old };
88
+ const rowSelection = Object.assign(require_utils.makeObjectMap(), old);
89
89
  table.getRowModel().rows.forEach((row) => {
90
90
  mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table);
91
91
  });
@@ -123,7 +123,7 @@ function table_getSelectedRowModel(table) {
123
123
  if (!Object.keys(((_table$atoms$rowSelec = table.atoms.rowSelection) === null || _table$atoms$rowSelec === void 0 ? void 0 : _table$atoms$rowSelec.get()) ?? {}).length) return {
124
124
  rows: [],
125
125
  flatRows: [],
126
- rowsById: {}
126
+ rowsById: require_utils.makeObjectMap()
127
127
  };
128
128
  return selectRowsFn(rowModel);
129
129
  }
@@ -144,7 +144,7 @@ function table_getFilteredSelectedRowModel(table) {
144
144
  if (!Object.keys(((_table$atoms$rowSelec2 = table.atoms.rowSelection) === null || _table$atoms$rowSelec2 === void 0 ? void 0 : _table$atoms$rowSelec2.get()) ?? {}).length) return {
145
145
  rows: [],
146
146
  flatRows: [],
147
- rowsById: {}
147
+ rowsById: require_utils.makeObjectMap()
148
148
  };
149
149
  return selectRowsFn(rowModel);
150
150
  }
@@ -165,7 +165,7 @@ function table_getGroupedSelectedRowModel(table) {
165
165
  if (!Object.keys(((_table$atoms$rowSelec3 = table.atoms.rowSelection) === null || _table$atoms$rowSelec3 === void 0 ? void 0 : _table$atoms$rowSelec3.get()) ?? {}).length) return {
166
166
  rows: [],
167
167
  flatRows: [],
168
- rowsById: {}
168
+ rowsById: require_utils.makeObjectMap()
169
169
  };
170
170
  return selectRowsFn(rowModel);
171
171
  }
@@ -186,7 +186,7 @@ function table_getIsAllRowsSelected(table) {
186
186
  const rowSelection = ((_table$atoms$rowSelec4 = table.atoms.rowSelection) === null || _table$atoms$rowSelec4 === void 0 ? void 0 : _table$atoms$rowSelec4.get()) ?? {};
187
187
  let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
188
188
  if (isAllRowsSelected) {
189
- if (preGroupedFlatRows.some((row) => row_getCanSelect(row) && !rowSelection[row.id])) isAllRowsSelected = false;
189
+ if (preGroupedFlatRows.some((row) => row_getCanSelect(row) && !isRowIdSelected(rowSelection, row.id))) isAllRowsSelected = false;
190
190
  }
191
191
  return isAllRowsSelected;
192
192
  }
@@ -205,7 +205,7 @@ function table_getIsAllPageRowsSelected(table) {
205
205
  const paginationFlatRows = table.getPaginatedRowModel().flatRows.filter((row) => row_getCanSelect(row));
206
206
  const rowSelection = ((_table$atoms$rowSelec5 = table.atoms.rowSelection) === null || _table$atoms$rowSelec5 === void 0 ? void 0 : _table$atoms$rowSelec5.get()) ?? {};
207
207
  let isAllPageRowsSelected = !!paginationFlatRows.length;
208
- if (isAllPageRowsSelected && paginationFlatRows.some((row) => !rowSelection[row.id])) isAllPageRowsSelected = false;
208
+ if (isAllPageRowsSelected && paginationFlatRows.some((row) => !isRowIdSelected(rowSelection, row.id))) isAllPageRowsSelected = false;
209
209
  return isAllPageRowsSelected;
210
210
  }
211
211
  /**
@@ -287,7 +287,7 @@ function row_toggleSelected(row, value, opts) {
287
287
  table_setRowSelection(row.table, (old) => {
288
288
  value = typeof value !== "undefined" ? value : !isSelected;
289
289
  if (row_getCanSelect(row) && isSelected === value) return old;
290
- const selectedRowIds = { ...old };
290
+ const selectedRowIds = Object.assign(require_utils.makeObjectMap(), old);
291
291
  mutateRowIsSelected(selectedRowIds, row.id, value, (opts === null || opts === void 0 ? void 0 : opts.selectChildren) ?? true, row.table);
292
292
  return selectedRowIds;
293
293
  });
@@ -418,7 +418,7 @@ const mutateRowIsSelected = (selectedRowIds, rowId, value, includeChildren, tabl
418
418
  */
419
419
  function selectRowsFn(rowModel) {
420
420
  const newSelectedFlatRows = [];
421
- const newSelectedRowsById = {};
421
+ const newSelectedRowsById = require_utils.makeObjectMap();
422
422
  const recurseRows = (rows, depth = 0) => {
423
423
  const result = [];
424
424
  for (let i = 0; i < rows.length; i++) {
@@ -456,7 +456,10 @@ function selectRowsFn(rowModel) {
456
456
  */
457
457
  function isRowSelected(row) {
458
458
  var _row$table$atoms$rowS;
459
- return (((_row$table$atoms$rowS = row.table.atoms.rowSelection) === null || _row$table$atoms$rowS === void 0 ? void 0 : _row$table$atoms$rowS.get()) ?? {})[row.id] ?? false;
459
+ return isRowIdSelected((_row$table$atoms$rowS = row.table.atoms.rowSelection) === null || _row$table$atoms$rowS === void 0 ? void 0 : _row$table$atoms$rowS.get(), row.id);
460
+ }
461
+ function isRowIdSelected(rowSelection, rowId) {
462
+ return !!(rowSelection && require_utils.hasOwn(rowSelection, rowId) && rowSelection[rowId]);
460
463
  }
461
464
  /**
462
465
  * Returns whether all, some, or none of a row's selectable descendants are selected.
@@ -1 +1 @@
1
- {"version":3,"file":"rowSelectionFeature.utils.cjs","names":["cloneState"],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import { cloneState } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowSelectionState } from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return {}\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setRowSelection(\n table,\n defaultState ? {} : cloneState(table.initialState.rowSelection ?? {}),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined' ? value : !table_getIsAllRowsSelected(table)\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (!row_getCanSelect(row)) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table_getIsAllPageRowsSelected(table)\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !rowSelection[row.id],\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected but fewer ids are\n * selected than the current filtered flat row count.\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const totalSelected = Object.keys(\n table.atoms.rowSelection?.get() ?? {},\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * This is false when all selectable page rows are selected. Otherwise it is true\n * if any selectable page row or descendant is selected.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table.getPaginatedRowModel().flatRows\n return table_getIsAllPageRowsSelected(table)\n ? false\n : paginationFlatRows\n .filter((row) => row_getCanSelect(row))\n .some((row) => row_getIsSelected(row) || row_getIsSomeSelected(row))\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n row: Row<TFeatures, TData>,\n value?: boolean,\n opts?: {\n selectChildren?: boolean\n },\n) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row_getCanSelect(row) && isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return selectedRowIds\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isRowSelected(row)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n row_toggleSelected(\n row,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n selectedRowIds: Record<string, boolean | undefined>,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n) => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(selectedRowIds).forEach((key) => delete selectedRowIds[key])\n }\n if (row_getCanSelect(row)) {\n selectedRowIds[rowId] = true\n }\n } else {\n delete selectedRowIds[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(selectedRowIds, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(rowModel: RowModel<TFeatures, TData>): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById: Record<string, Row<TFeatures, TData>> = {}\n\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]!\n const isSelected = isRowSelected(row)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n // Always recurse — selected descendants of unselected parents must\n // still be collected into flatRows/rowsById.\n const newSubRows = recurseRows(row.subRows, depth + 1)\n\n if (isSelected) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n Object.assign(cloned, row)\n cloned.subRows = newSubRows\n result.push(cloned)\n }\n } else if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean {\n return (row.table.atoms.rowSelection?.get() ?? {})[row.id] ?? false\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach((subRow) => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,8BAAiD;CAC/D,OAAO,CAAC;AACV;;;;;;;;;;;;AAaA,SAAgB,sBAId,OACA,SACA;;CACA,iDAAM,SAAQ,iHAAuB,OAAO;AAC9C;;;;;;;;;;;;;AAcA,SAAgB,wBAGd,OAAyC,cAAwB;CACjE,sBACE,OACA,eAAe,CAAC,IAAIA,yBAAW,MAAM,aAAa,gBAAgB,CAAC,CAAC,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AAI,YAAY;IACd,oBAAoB,KAAK,GAAG;IAC5B,oBAAoB,IAAI,MAAM;GAChC;GAEA,IAAI,IAAI,QAAQ,QAAQ;IAGtB,MAAM,aAAa,YAAY,IAAI,SAAS,QAAQ,CAAC;IAErD,IAAI,YAAY;KAEd,MAAM,SAAS,OAAO,OAAO,OAAO,eAAe,GAAG,CAAC;KACvD,OAAO,OAAO,QAAQ,GAAG;KACzB,OAAO,UAAU;KACjB,OAAO,KAAK,MAAM;IACpB;GACF,OAAO,IAAI,YACT,OAAO,KAAK,GAAG;EAEnB;EACA,OAAO;CACT;CAEA,OAAO;EACL,MAAM,YAAY,SAAS,IAAI;EAC/B,UAAU;EACV,UAAU;CACZ;AACF;;;;;;;;;AAUA,SAAgB,cAGd,KAAqC;;CACrC,kCAAQ,IAAI,MAAM,MAAM,4FAAc,IAAI,MAAK,CAAC,EAAC,CAAE,IAAI,OAAO;AAChE;;;;;;;;;;;AAYA,SAAgB,iBAGd,KAAsD;CACtD,IAAI,CAAC,IAAI,QAAQ,QAAQ,OAAO;CAEhC,IAAI,sBAAsB;CAC1B,IAAI,eAAe;CAEnB,IAAI,QAAQ,SAAS,WAAW;EAE9B,IAAI,gBAAgB,CAAC,qBACnB;EAGF,IAAI,iBAAiB,MAAM,GACzB,IAAI,cAAc,MAAM,GACtB,eAAe;OAEf,sBAAsB;EAK1B,IAAI,OAAO,QAAQ,QAAQ;GACzB,MAAM,yBAAyB,iBAAiB,MAAM;GACtD,IAAI,2BAA2B,OAC7B,eAAe;QACV,IAAI,2BAA2B,QAAQ;IAC5C,eAAe;IACf,sBAAsB;GACxB,OACE,sBAAsB;EAE1B;CACF,CAAC;CAGD,OAAO,sBAAsB,QAAQ,eAAe,SAAS;AAC/D"}
1
+ {"version":3,"file":"rowSelectionFeature.utils.cjs","names":["makeObjectMap","cloneState","hasOwn"],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import { cloneState, hasOwn, makeObjectMap } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowSelectionState } from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return makeObjectMap()\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setRowSelection(\n table,\n defaultState\n ? makeObjectMap()\n : Object.assign(\n makeObjectMap<boolean | undefined>(),\n cloneState(table.initialState.rowSelection ?? {}),\n ),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined' ? value : !table_getIsAllRowsSelected(table)\n\n const rowSelection = Object.assign(\n makeObjectMap<boolean | undefined>(),\n old,\n )\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (!row_getCanSelect(row)) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table_getIsAllPageRowsSelected(table)\n\n const rowSelection: RowSelectionState = Object.assign(\n makeObjectMap<boolean | undefined>(),\n old,\n )\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (!Object.keys(table.atoms.rowSelection?.get() ?? {}).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel)\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) =>\n row_getCanSelect(row) && !isRowIdSelected(rowSelection, row.id),\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection: RowSelectionState = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !isRowIdSelected(rowSelection, row.id))\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected but fewer ids are\n * selected than the current filtered flat row count.\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const totalSelected = Object.keys(\n table.atoms.rowSelection?.get() ?? {},\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * This is false when all selectable page rows are selected. Otherwise it is true\n * if any selectable page row or descendant is selected.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table.getPaginatedRowModel().flatRows\n return table_getIsAllPageRowsSelected(table)\n ? false\n : paginationFlatRows\n .filter((row) => row_getCanSelect(row))\n .some((row) => row_getIsSelected(row) || row_getIsSomeSelected(row))\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n row: Row<TFeatures, TData>,\n value?: boolean,\n opts?: {\n selectChildren?: boolean\n },\n) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (row_getCanSelect(row) && isSelected === value) {\n return old\n }\n\n const selectedRowIds = Object.assign(\n makeObjectMap<boolean | undefined>(),\n old,\n )\n\n mutateRowIsSelected(\n selectedRowIds,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return selectedRowIds\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isRowSelected(row)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n row_toggleSelected(\n row,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n selectedRowIds: Record<string, boolean | undefined>,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n) => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(selectedRowIds).forEach((key) => delete selectedRowIds[key])\n }\n if (row_getCanSelect(row)) {\n selectedRowIds[rowId] = true\n }\n } else {\n delete selectedRowIds[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(selectedRowIds, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(rowModel: RowModel<TFeatures, TData>): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById = makeObjectMap<Row<TFeatures, TData>>()\n\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]!\n const isSelected = isRowSelected(row)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n // Always recurse — selected descendants of unselected parents must\n // still be collected into flatRows/rowsById.\n const newSubRows = recurseRows(row.subRows, depth + 1)\n\n if (isSelected) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n Object.assign(cloned, row)\n cloned.subRows = newSubRows\n result.push(cloned)\n }\n } else if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean {\n return isRowIdSelected(row.table.atoms.rowSelection?.get(), row.id)\n}\n\nfunction isRowIdSelected(\n rowSelection: RowSelectionState | undefined,\n rowId: string,\n): boolean {\n return !!(rowSelection && hasOwn(rowSelection, rowId) && rowSelection[rowId])\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach((subRow) => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n })\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,8BAAiD;CAC/D,OAAOA,4BAAc;AACvB;;;;;;;;;;;;AAaA,SAAgB,sBAId,OACA,SACA;;CACA,iDAAM,SAAQ,iHAAuB,OAAO;AAC9C;;;;;;;;;;;;;AAcA,SAAgB,wBAGd,OAAyC,cAAwB;CACjE,sBACE,OACA,eACIA,4BAAc,IACd,OAAO,OACLA,4BAAmC,GACnCC,yBAAW,MAAM,aAAa,gBAAgB,CAAC,CAAC,CAClD,CACN;AACF;;;;;;;;;;;;AAeA,SAAgB,4BAGd,OAAyC,OAAiB;CAC1D,sBAAsB,QAAQ,QAAQ;EACpC,QACE,OAAO,UAAU,cAAc,QAAQ,CAAC,2B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