@tanstack/table-core 8.19.2 → 9.0.0-alpha.10

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 (302) hide show
  1. package/dist/cjs/aggregationFns.cjs +94 -0
  2. package/dist/cjs/aggregationFns.cjs.map +1 -0
  3. package/dist/cjs/aggregationFns.d.cts +14 -0
  4. package/dist/cjs/columnHelper.cjs +19 -0
  5. package/dist/cjs/columnHelper.cjs.map +1 -0
  6. package/dist/cjs/columnHelper.d.cts +9 -0
  7. package/dist/cjs/core/cell.cjs +38 -0
  8. package/dist/cjs/core/cell.cjs.map +1 -0
  9. package/dist/cjs/core/cell.d.cts +50 -0
  10. package/dist/cjs/core/column.cjs +81 -0
  11. package/dist/cjs/core/column.cjs.map +1 -0
  12. package/dist/cjs/core/column.d.cts +56 -0
  13. package/dist/cjs/core/headers.cjs +310 -0
  14. package/dist/cjs/core/headers.cjs.map +1 -0
  15. package/dist/cjs/core/headers.d.cts +195 -0
  16. package/dist/cjs/core/row.cjs +92 -0
  17. package/dist/cjs/core/row.cjs.map +1 -0
  18. package/dist/cjs/core/row.d.cts +92 -0
  19. package/dist/cjs/core/table.cjs +232 -0
  20. package/dist/cjs/core/table.cjs.map +1 -0
  21. package/dist/cjs/core/table.d.cts +229 -0
  22. package/dist/cjs/features/ColumnFaceting.cjs +29 -0
  23. package/dist/cjs/features/ColumnFaceting.cjs.map +1 -0
  24. package/dist/cjs/features/ColumnFaceting.d.cts +35 -0
  25. package/dist/cjs/features/ColumnFiltering.cjs +137 -0
  26. package/dist/cjs/features/ColumnFiltering.cjs.map +1 -0
  27. package/dist/cjs/features/ColumnFiltering.d.cts +195 -0
  28. package/dist/cjs/features/ColumnGrouping.cjs +133 -0
  29. package/dist/cjs/features/ColumnGrouping.cjs.map +1 -0
  30. package/dist/cjs/features/ColumnGrouping.d.cts +202 -0
  31. package/dist/cjs/features/ColumnOrdering.cjs +76 -0
  32. package/dist/cjs/features/ColumnOrdering.cjs.map +1 -0
  33. package/dist/cjs/features/ColumnOrdering.d.cts +54 -0
  34. package/dist/cjs/features/ColumnPinning.cjs +145 -0
  35. package/dist/cjs/features/ColumnPinning.cjs.map +1 -0
  36. package/dist/cjs/features/ColumnPinning.d.cts +127 -0
  37. package/dist/cjs/features/ColumnSizing.cjs +307 -0
  38. package/dist/cjs/features/ColumnSizing.cjs.map +1 -0
  39. package/dist/cjs/features/ColumnSizing.d.cts +194 -0
  40. package/dist/cjs/features/ColumnVisibility.cjs +144 -0
  41. package/dist/cjs/features/ColumnVisibility.cjs.map +1 -0
  42. package/dist/cjs/features/ColumnVisibility.d.cts +130 -0
  43. package/dist/cjs/features/GlobalFaceting.cjs +29 -0
  44. package/dist/cjs/features/GlobalFaceting.cjs.map +1 -0
  45. package/dist/cjs/features/GlobalFaceting.d.cts +27 -0
  46. package/dist/cjs/features/GlobalFiltering.cjs +50 -0
  47. package/dist/cjs/features/GlobalFiltering.cjs.map +1 -0
  48. package/dist/cjs/features/GlobalFiltering.d.cts +80 -0
  49. package/dist/cjs/features/RowExpanding.cjs +152 -0
  50. package/dist/cjs/features/RowExpanding.cjs.map +1 -0
  51. package/dist/cjs/features/RowExpanding.d.cts +155 -0
  52. package/dist/cjs/features/RowPagination.cjs +161 -0
  53. package/dist/cjs/features/RowPagination.cjs.map +1 -0
  54. package/dist/cjs/features/RowPagination.d.cts +166 -0
  55. package/dist/cjs/features/RowPinning.cjs +132 -0
  56. package/dist/cjs/features/RowPinning.cjs.map +1 -0
  57. package/dist/cjs/features/RowPinning.d.cts +99 -0
  58. package/dist/cjs/features/RowSelection.cjs +296 -0
  59. package/dist/cjs/features/RowSelection.cjs.map +1 -0
  60. package/dist/cjs/features/RowSelection.d.cts +177 -0
  61. package/dist/cjs/features/RowSorting.cjs +200 -0
  62. package/dist/cjs/features/RowSorting.cjs.map +1 -0
  63. package/dist/cjs/features/RowSorting.d.cts +238 -0
  64. package/dist/cjs/filterFns.cjs +88 -0
  65. package/dist/cjs/filterFns.cjs.map +1 -0
  66. package/dist/cjs/filterFns.d.cts +14 -0
  67. package/{build/lib/index.js → dist/cjs/index.cjs} +41 -53
  68. package/dist/cjs/index.cjs.map +1 -0
  69. package/dist/cjs/index.d.cts +34 -0
  70. package/{build/lib/sortingFns.js → dist/cjs/sortingFns.cjs} +23 -52
  71. package/dist/cjs/sortingFns.cjs.map +1 -0
  72. package/dist/cjs/sortingFns.d.cts +12 -0
  73. package/dist/cjs/types.d.cts +120 -0
  74. package/{build/lib/utils/filterRowsUtils.js → dist/cjs/utils/filterRowsUtils.cjs} +34 -46
  75. package/dist/cjs/utils/filterRowsUtils.cjs.map +1 -0
  76. package/dist/cjs/utils/filterRowsUtils.d.cts +3 -0
  77. package/dist/cjs/utils/getCoreRowModel.cjs +54 -0
  78. package/dist/cjs/utils/getCoreRowModel.cjs.map +1 -0
  79. package/dist/cjs/utils/getCoreRowModel.d.cts +3 -0
  80. package/dist/cjs/utils/getExpandedRowModel.cjs +41 -0
  81. package/dist/cjs/utils/getExpandedRowModel.cjs.map +1 -0
  82. package/dist/cjs/utils/getExpandedRowModel.d.cts +8 -0
  83. package/dist/cjs/utils/getFacetedMinMaxValues.cjs +35 -0
  84. package/dist/cjs/utils/getFacetedMinMaxValues.cjs.map +1 -0
  85. package/dist/cjs/utils/getFacetedMinMaxValues.d.cts +3 -0
  86. package/dist/cjs/utils/getFacetedRowModel.cjs +35 -0
  87. package/dist/cjs/utils/getFacetedRowModel.cjs.map +1 -0
  88. package/dist/cjs/utils/getFacetedRowModel.d.cts +3 -0
  89. package/dist/cjs/utils/getFacetedUniqueValues.cjs +37 -0
  90. package/dist/cjs/utils/getFacetedUniqueValues.cjs.map +1 -0
  91. package/dist/cjs/utils/getFacetedUniqueValues.d.cts +3 -0
  92. package/dist/cjs/utils/getFilteredRowModel.cjs +116 -0
  93. package/dist/cjs/utils/getFilteredRowModel.cjs.map +1 -0
  94. package/dist/cjs/utils/getFilteredRowModel.d.cts +3 -0
  95. package/dist/cjs/utils/getGroupedRowModel.cjs +118 -0
  96. package/dist/cjs/utils/getGroupedRowModel.cjs.map +1 -0
  97. package/dist/cjs/utils/getGroupedRowModel.d.cts +3 -0
  98. package/dist/cjs/utils/getPaginationRowModel.cjs +49 -0
  99. package/dist/cjs/utils/getPaginationRowModel.cjs.map +1 -0
  100. package/dist/cjs/utils/getPaginationRowModel.d.cts +5 -0
  101. package/dist/cjs/utils/getSortedRowModel.cjs +88 -0
  102. package/dist/cjs/utils/getSortedRowModel.cjs.map +1 -0
  103. package/dist/cjs/utils/getSortedRowModel.d.cts +3 -0
  104. package/{build/lib/utils.js → dist/cjs/utils.cjs} +26 -39
  105. package/dist/cjs/utils.cjs.map +1 -0
  106. package/dist/cjs/utils.d.cts +39 -0
  107. package/{build/lib → dist/esm}/aggregationFns.d.ts +2 -1
  108. package/dist/esm/aggregationFns.js +94 -0
  109. package/dist/esm/aggregationFns.js.map +1 -0
  110. package/{build/lib → dist/esm}/columnHelper.d.ts +3 -2
  111. package/dist/esm/columnHelper.js +19 -0
  112. package/{build/lib → dist/esm}/columnHelper.js.map +1 -1
  113. package/{build/lib → dist/esm}/core/cell.d.ts +2 -1
  114. package/dist/esm/core/cell.js +38 -0
  115. package/dist/esm/core/cell.js.map +1 -0
  116. package/{build/lib → dist/esm}/core/column.d.ts +2 -1
  117. package/dist/esm/core/column.js +81 -0
  118. package/dist/esm/core/column.js.map +1 -0
  119. package/{build/lib → dist/esm}/core/headers.d.ts +1 -0
  120. package/dist/esm/core/headers.js +310 -0
  121. package/dist/esm/core/headers.js.map +1 -0
  122. package/{build/lib → dist/esm}/core/row.d.ts +2 -1
  123. package/dist/esm/core/row.js +92 -0
  124. package/dist/esm/core/row.js.map +1 -0
  125. package/{build/lib → dist/esm}/core/table.d.ts +10 -1
  126. package/dist/esm/core/table.js +232 -0
  127. package/dist/esm/core/table.js.map +1 -0
  128. package/{build/lib → dist/esm}/features/ColumnFaceting.d.ts +1 -0
  129. package/{build/lib → dist/esm}/features/ColumnFaceting.js +6 -19
  130. package/{build/lib → dist/esm}/features/ColumnFaceting.js.map +1 -1
  131. package/{build/lib → dist/esm}/features/ColumnFiltering.d.ts +1 -0
  132. package/dist/esm/features/ColumnFiltering.js +137 -0
  133. package/dist/esm/features/ColumnFiltering.js.map +1 -0
  134. package/{build/lib → dist/esm}/features/ColumnGrouping.d.ts +1 -0
  135. package/dist/esm/features/ColumnGrouping.js +133 -0
  136. package/dist/esm/features/ColumnGrouping.js.map +1 -0
  137. package/{build/lib → dist/esm}/features/ColumnOrdering.d.ts +1 -0
  138. package/dist/esm/features/ColumnOrdering.js +76 -0
  139. package/dist/esm/features/ColumnOrdering.js.map +1 -0
  140. package/{build/lib → dist/esm}/features/ColumnPinning.d.ts +1 -0
  141. package/dist/esm/features/ColumnPinning.js +145 -0
  142. package/dist/esm/features/ColumnPinning.js.map +1 -0
  143. package/{build/lib → dist/esm}/features/ColumnSizing.d.ts +2 -1
  144. package/dist/esm/features/ColumnSizing.js +307 -0
  145. package/dist/esm/features/ColumnSizing.js.map +1 -0
  146. package/{build/lib → dist/esm}/features/ColumnVisibility.d.ts +1 -0
  147. package/dist/esm/features/ColumnVisibility.js +144 -0
  148. package/dist/esm/features/ColumnVisibility.js.map +1 -0
  149. package/{build/lib → dist/esm}/features/GlobalFaceting.d.ts +1 -0
  150. package/{build/lib → dist/esm}/features/GlobalFaceting.js +8 -21
  151. package/dist/esm/features/GlobalFaceting.js.map +1 -0
  152. package/{build/lib → dist/esm}/features/GlobalFiltering.d.ts +1 -0
  153. package/dist/esm/features/GlobalFiltering.js +50 -0
  154. package/dist/esm/features/GlobalFiltering.js.map +1 -0
  155. package/{build/lib → dist/esm}/features/RowExpanding.d.ts +1 -0
  156. package/{build/lib → dist/esm}/features/RowExpanding.js +37 -58
  157. package/dist/esm/features/RowExpanding.js.map +1 -0
  158. package/{build/lib → dist/esm}/features/RowPagination.d.ts +1 -0
  159. package/dist/esm/features/RowPagination.js +161 -0
  160. package/dist/esm/features/RowPagination.js.map +1 -0
  161. package/{build/lib → dist/esm}/features/RowPinning.d.ts +1 -0
  162. package/dist/esm/features/RowPinning.js +132 -0
  163. package/dist/esm/features/RowPinning.js.map +1 -0
  164. package/{build/lib → dist/esm}/features/RowSelection.d.ts +1 -0
  165. package/dist/esm/features/RowSelection.js +296 -0
  166. package/dist/esm/features/RowSelection.js.map +1 -0
  167. package/{build/lib → dist/esm}/features/RowSorting.d.ts +1 -0
  168. package/dist/esm/features/RowSorting.js +200 -0
  169. package/dist/esm/features/RowSorting.js.map +1 -0
  170. package/{build/lib → dist/esm}/filterFns.d.ts +2 -1
  171. package/dist/esm/filterFns.js +88 -0
  172. package/dist/esm/filterFns.js.map +1 -0
  173. package/dist/esm/index.d.ts +34 -0
  174. package/dist/esm/index.js +88 -0
  175. package/dist/esm/index.js.map +1 -0
  176. package/{build/lib → dist/esm}/sortingFns.d.ts +2 -1
  177. package/dist/esm/sortingFns.js +91 -0
  178. package/dist/esm/sortingFns.js.map +1 -0
  179. package/{build/lib → dist/esm}/types.d.ts +29 -28
  180. package/{build/lib → dist/esm}/utils/filterRowsUtils.d.ts +1 -0
  181. package/dist/esm/utils/filterRowsUtils.js +99 -0
  182. package/dist/esm/utils/filterRowsUtils.js.map +1 -0
  183. package/{build/lib → dist/esm}/utils/getCoreRowModel.d.ts +1 -0
  184. package/dist/esm/utils/getCoreRowModel.js +54 -0
  185. package/dist/esm/utils/getCoreRowModel.js.map +1 -0
  186. package/{build/lib → dist/esm}/utils/getExpandedRowModel.d.ts +1 -0
  187. package/dist/esm/utils/getExpandedRowModel.js +41 -0
  188. package/dist/esm/utils/getExpandedRowModel.js.map +1 -0
  189. package/{build/lib → dist/esm}/utils/getFacetedMinMaxValues.d.ts +1 -0
  190. package/dist/esm/utils/getFacetedMinMaxValues.js +35 -0
  191. package/dist/esm/utils/getFacetedMinMaxValues.js.map +1 -0
  192. package/{build/lib → dist/esm}/utils/getFacetedRowModel.d.ts +1 -0
  193. package/dist/esm/utils/getFacetedRowModel.js +35 -0
  194. package/{build/lib → dist/esm}/utils/getFacetedRowModel.js.map +1 -1
  195. package/{build/lib → dist/esm}/utils/getFacetedUniqueValues.d.ts +1 -0
  196. package/dist/esm/utils/getFacetedUniqueValues.js +37 -0
  197. package/dist/esm/utils/getFacetedUniqueValues.js.map +1 -0
  198. package/{build/lib → dist/esm}/utils/getFilteredRowModel.d.ts +1 -0
  199. package/dist/esm/utils/getFilteredRowModel.js +116 -0
  200. package/{build/lib → dist/esm}/utils/getFilteredRowModel.js.map +1 -1
  201. package/{build/lib → dist/esm}/utils/getGroupedRowModel.d.ts +1 -0
  202. package/dist/esm/utils/getGroupedRowModel.js +118 -0
  203. package/dist/esm/utils/getGroupedRowModel.js.map +1 -0
  204. package/{build/lib → dist/esm}/utils/getPaginationRowModel.d.ts +1 -0
  205. package/dist/esm/utils/getPaginationRowModel.js +49 -0
  206. package/dist/esm/utils/getPaginationRowModel.js.map +1 -0
  207. package/{build/lib → dist/esm}/utils/getSortedRowModel.d.ts +1 -0
  208. package/dist/esm/utils/getSortedRowModel.js +88 -0
  209. package/{build/lib → dist/esm}/utils/getSortedRowModel.js.map +1 -1
  210. package/{build/lib → dist/esm}/utils.d.ts +2 -1
  211. package/dist/esm/utils.js +98 -0
  212. package/{build/lib → dist/esm}/utils.js.map +1 -1
  213. package/package.json +14 -10
  214. package/src/core/cell.ts +2 -2
  215. package/src/core/column.ts +2 -2
  216. package/src/core/headers.ts +5 -5
  217. package/src/core/row.ts +4 -4
  218. package/src/core/table.ts +43 -7
  219. package/src/features/ColumnFaceting.ts +1 -1
  220. package/src/features/ColumnFiltering.ts +6 -6
  221. package/src/features/ColumnGrouping.ts +7 -7
  222. package/src/features/ColumnOrdering.ts +4 -4
  223. package/src/features/ColumnPinning.ts +5 -5
  224. package/src/features/ColumnSizing.ts +6 -6
  225. package/src/features/ColumnVisibility.ts +5 -5
  226. package/src/features/GlobalFaceting.ts +1 -1
  227. package/src/features/GlobalFiltering.ts +4 -4
  228. package/src/features/RowExpanding.ts +4 -4
  229. package/src/features/RowPagination.ts +3 -3
  230. package/src/features/RowPinning.ts +4 -4
  231. package/src/features/RowSelection.ts +4 -4
  232. package/src/features/RowSorting.ts +5 -5
  233. package/src/types.ts +8 -8
  234. package/src/utils/filterRowsUtils.ts +3 -3
  235. package/src/utils/getCoreRowModel.ts +2 -2
  236. package/src/utils/getGroupedRowModel.ts +2 -2
  237. package/build/lib/aggregationFns.js +0 -108
  238. package/build/lib/aggregationFns.js.map +0 -1
  239. package/build/lib/columnHelper.js +0 -71
  240. package/build/lib/core/cell.js +0 -42
  241. package/build/lib/core/cell.js.map +0 -1
  242. package/build/lib/core/column.js +0 -80
  243. package/build/lib/core/column.js.map +0 -1
  244. package/build/lib/core/headers.js +0 -270
  245. package/build/lib/core/headers.js.map +0 -1
  246. package/build/lib/core/row.js +0 -89
  247. package/build/lib/core/row.js.map +0 -1
  248. package/build/lib/core/table.js +0 -212
  249. package/build/lib/core/table.js.map +0 -1
  250. package/build/lib/features/ColumnFiltering.js +0 -151
  251. package/build/lib/features/ColumnFiltering.js.map +0 -1
  252. package/build/lib/features/ColumnGrouping.js +0 -142
  253. package/build/lib/features/ColumnGrouping.js.map +0 -1
  254. package/build/lib/features/ColumnOrdering.js +0 -84
  255. package/build/lib/features/ColumnOrdering.js.map +0 -1
  256. package/build/lib/features/ColumnPinning.js +0 -130
  257. package/build/lib/features/ColumnPinning.js.map +0 -1
  258. package/build/lib/features/ColumnSizing.js +0 -270
  259. package/build/lib/features/ColumnSizing.js.map +0 -1
  260. package/build/lib/features/ColumnVisibility.js +0 -99
  261. package/build/lib/features/ColumnVisibility.js.map +0 -1
  262. package/build/lib/features/GlobalFaceting.js.map +0 -1
  263. package/build/lib/features/GlobalFiltering.js +0 -63
  264. package/build/lib/features/GlobalFiltering.js.map +0 -1
  265. package/build/lib/features/RowExpanding.js.map +0 -1
  266. package/build/lib/features/RowPagination.js +0 -169
  267. package/build/lib/features/RowPagination.js.map +0 -1
  268. package/build/lib/features/RowPinning.js +0 -145
  269. package/build/lib/features/RowPinning.js.map +0 -1
  270. package/build/lib/features/RowSelection.js +0 -391
  271. package/build/lib/features/RowSelection.js.map +0 -1
  272. package/build/lib/features/RowSorting.js +0 -226
  273. package/build/lib/features/RowSorting.js.map +0 -1
  274. package/build/lib/filterFns.js +0 -96
  275. package/build/lib/filterFns.js.map +0 -1
  276. package/build/lib/index.d.ts +0 -34
  277. package/build/lib/index.esm.js +0 -3522
  278. package/build/lib/index.esm.js.map +0 -1
  279. package/build/lib/index.js.map +0 -1
  280. package/build/lib/index.mjs +0 -3522
  281. package/build/lib/index.mjs.map +0 -1
  282. package/build/lib/sortingFns.js.map +0 -1
  283. package/build/lib/utils/filterRowsUtils.js.map +0 -1
  284. package/build/lib/utils/getCoreRowModel.js +0 -65
  285. package/build/lib/utils/getCoreRowModel.js.map +0 -1
  286. package/build/lib/utils/getExpandedRowModel.js +0 -46
  287. package/build/lib/utils/getExpandedRowModel.js.map +0 -1
  288. package/build/lib/utils/getFacetedMinMaxValues.js +0 -43
  289. package/build/lib/utils/getFacetedMinMaxValues.js.map +0 -1
  290. package/build/lib/utils/getFacetedRowModel.js +0 -36
  291. package/build/lib/utils/getFacetedUniqueValues.js +0 -39
  292. package/build/lib/utils/getFacetedUniqueValues.js.map +0 -1
  293. package/build/lib/utils/getFilteredRowModel.js +0 -111
  294. package/build/lib/utils/getGroupedRowModel.js +0 -150
  295. package/build/lib/utils/getGroupedRowModel.js.map +0 -1
  296. package/build/lib/utils/getPaginationRowModel.js +0 -60
  297. package/build/lib/utils/getPaginationRowModel.js.map +0 -1
  298. package/build/lib/utils/getSortedRowModel.js +0 -102
  299. package/build/umd/index.development.js +0 -3578
  300. package/build/umd/index.development.js.map +0 -1
  301. package/build/umd/index.production.js +0 -12
  302. package/build/umd/index.production.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"RowPagination.js","sources":["../../../src/features/RowPagination.ts"],"sourcesContent":["import {\n OnChangeFn,\n Table,\n RowModel,\n Updater,\n RowData,\n TableFeature,\n} from '../types'\nimport {\n functionalUpdate,\n getMemoOptions,\n makeStateUpdater,\n memo,\n} from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial<PaginationState>\n}\n\nexport interface PaginationOptions {\n /**\n * If set to `true`, pagination will be reset to the first page when page-altering state changes eg. `data` is updated, filters change, grouping changes, etc.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#autoresetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n autoResetPageIndex?: boolean\n /**\n * Returns the row model after pagination has taken place, but no further.\n *\n * Pagination columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel?: (table: Table<any>) => () => RowModel<any>\n /**\n * Enables manual pagination. If this option is set to `true`, the table will not automatically paginate rows using `getPaginationRowModel()` and instead will expect you to manually paginate the rows before passing them to the table. This is useful if you are doing server-side pagination and aggregation.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#manualpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n manualPagination?: boolean\n /**\n * If this function is provided, it will be called when the pagination state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.pagination` option.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#onpaginationchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n onPaginationChange?: OnChangeFn<PaginationState>\n /**\n * When manually controlling pagination, you can supply a total `pageCount` value to the table if you know it (Or supply a `rowCount` and `pageCount` will be calculated). If you do not know how many pages there are, you can set this to `-1`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#pagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n pageCount?: number\n /**\n * When manually controlling pagination, you can supply a total `rowCount` value to the table if you know it. The `pageCount` can be calculated from this value and the `pageSize`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#rowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n rowCount?: number\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn<PaginationState>\n}\n\nexport interface PaginationInstance<TData extends RowData> {\n _autoResetPageIndex: () => void\n _getPaginationRowModel?: () => RowModel<TData>\n /**\n * Returns whether the table can go to the next page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcannextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanNextPage: () => boolean\n /**\n * Returns whether the table can go to the previous page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getcanpreviouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getCanPreviousPage: () => boolean\n /**\n * Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpagecount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageCount: () => number\n /**\n * Returns the row count. If manually paginating or controlling the pagination state, this will come directly from the `options.rowCount` table option, otherwise it will be calculated from the table data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getrowcount)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getRowCount: () => number\n /**\n * Returns an array of page options (zero-index-based) for the current page size.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpageoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPageOptions: () => number[]\n /**\n * Returns the row model for the table after pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getpaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPaginationRowModel: () => RowModel<TData>\n /**\n * Returns the row model for the table before any pagination has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#getprepaginationrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n getPrePaginationRowModel: () => RowModel<TData>\n /**\n * Increments the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#nextpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n nextPage: () => void\n /**\n * Decrements the page index by one, if possible.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#previouspage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n previousPage: () => void\n /**\n * Sets the page index to `0`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#firstpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n firstPage: () => void\n /**\n * Sets the page index to the last page.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#lastpage)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n lastPage: () => void\n /**\n * Resets the page index to its initial state. If `defaultState` is `true`, the page index will be reset to `0` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageIndex: (defaultState?: boolean) => void\n /**\n * Resets the page size to its initial state. If `defaultState` is `true`, the page size will be reset to `10` regardless of initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPageSize: (defaultState?: boolean) => void\n /**\n * Resets the **pagination** state to `initialState.pagination`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#resetpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n resetPagination: (defaultState?: boolean) => void\n /**\n * @deprecated The page count no longer exists in the pagination state. Just pass as a table option instead.\n */\n setPageCount: (updater: Updater<number>) => void\n /**\n * Updates the page index using the provided function or value in the `state.pagination.pageIndex` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpageindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageIndex: (updater: Updater<number>) => void\n /**\n * Updates the page size using the provided function or value in the `state.pagination.pageSize` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagesize)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPageSize: (updater: Updater<number>) => void\n /**\n * Sets or updates the `state.pagination` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#setpagination)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)\n */\n setPagination: (updater: Updater<PaginationState>) => void\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const RowPagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: <TData extends RowData>(\n table: Table<TData>\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n let registered = false\n let queued = false\n\n table._autoResetPageIndex = () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n }\n table.setPagination = updater => {\n const safeUpdater: Updater<PaginationState> = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n }\n table.resetPagination = defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n }\n table.setPageIndex = updater => {\n table.setPagination(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 table.resetPageIndex = defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n }\n table.resetPageSize = defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n }\n table.setPageSize = updater => {\n table.setPagination(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 //deprecated\n table.setPageCount = updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n })\n\n table.getPageOptions = memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n getMemoOptions(table.options, 'debugTable', 'getPageOptions')\n )\n\n table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0\n\n table.getCanNextPage = () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\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 table.previousPage = () => {\n return table.setPageIndex(old => old - 1)\n }\n\n table.nextPage = () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n }\n\n table.firstPage = () => {\n return table.setPageIndex(0)\n }\n\n table.lastPage = () => {\n return table.setPageIndex(table.getPageCount() - 1)\n }\n\n table.getPrePaginationRowModel = () => table.getExpandedRowModel()\n table.getPaginationRowModel = () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n }\n\n table.getPageCount = () => {\n return (\n table.options.pageCount ??\n Math.ceil(table.getRowCount() / table.getState().pagination.pageSize)\n )\n }\n\n table.getRowCount = () => {\n return (\n table.options.rowCount ?? table.getPrePaginationRowModel().rows.length\n )\n }\n },\n}\n"],"names":["defaultPageIndex","defaultPageSize","getDefaultPaginationState","pageIndex","pageSize","RowPagination","getInitialState","state","pagination","getDefaultOptions","table","onPaginationChange","makeStateUpdater","createTable","registered","queued","_autoResetPageIndex","_ref","_table$options$autoRe","_queue","options","autoResetAll","autoResetPageIndex","manualPagination","resetPageIndex","setPagination","updater","safeUpdater","old","newState","functionalUpdate","resetPagination","defaultState","_table$initialState$p","initialState","setPageIndex","maxPageIndex","pageCount","Number","MAX_SAFE_INTEGER","Math","max","min","_table$initialState$p2","_table$initialState","resetPageSize","_table$initialState$p3","_table$initialState2","setPageSize","topRowIndex","floor","setPageCount","_table$options$pageCo","newPageCount","getPageOptions","memo","getPageCount","pageOptions","Array","fill","map","_","i","getMemoOptions","getCanPreviousPage","getState","getCanNextPage","previousPage","nextPage","firstPage","lastPage","getPrePaginationRowModel","getExpandedRowModel","getPaginationRowModel","_getPaginationRowModel","_table$options$pageCo2","ceil","getRowCount","_table$options$rowCou","rowCount","rows","length"],"mappings":";;;;;;;;;;;;;;AAwLA;;AAEA,MAAMA,gBAAgB,GAAG,CAAC,CAAA;AAC1B,MAAMC,eAAe,GAAG,EAAE,CAAA;AAE1B,MAAMC,yBAAyB,GAAGA,OAAwB;AACxDC,EAAAA,SAAS,EAAEH,gBAAgB;AAC3BI,EAAAA,QAAQ,EAAEH,eAAAA;AACZ,CAAC,CAAC,CAAA;AAEK,MAAMI,aAA2B,GAAG;EACzCC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;AACL,MAAA,GAAGA,KAAK;AACRC,MAAAA,UAAU,EAAE;QACV,GAAGN,yBAAyB,EAAE;AAC9B,QAAA,IAAGK,KAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEC,UAAU;AACtB,OAAA;KACD,CAAA;GACF;EAEDC,iBAAiB,EACfC,KAAmB,IACU;IAC7B,OAAO;AACLC,MAAAA,kBAAkB,EAAEC,sBAAgB,CAAC,YAAY,EAAEF,KAAK,CAAA;KACzD,CAAA;GACF;EAEDG,WAAW,EAA0BH,KAAmB,IAAW;IACjE,IAAII,UAAU,GAAG,KAAK,CAAA;IACtB,IAAIC,MAAM,GAAG,KAAK,CAAA;IAElBL,KAAK,CAACM,mBAAmB,GAAG,MAAM;MAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;MAChC,IAAI,CAACJ,UAAU,EAAE;QACfJ,KAAK,CAACS,MAAM,CAAC,MAAM;AACjBL,UAAAA,UAAU,GAAG,IAAI,CAAA;AACnB,SAAC,CAAC,CAAA;AACF,QAAA,OAAA;AACF,OAAA;MAEA,IAAAG,CAAAA,IAAA,GAAAC,CAAAA,qBAAA,GACER,KAAK,CAACU,OAAO,CAACC,YAAY,KAAAH,IAAAA,GAAAA,qBAAA,GAC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ACmE,WAAW,GAAG,MAAM;AAAA,MAAA,IAAAC,qBAAA,CAAA;AACxB,MAAA,OAAA,CAAAA,qBAAA,GACEpE,KAAK,CAACU,OAAO,CAAC2D,QAAQ,KAAAD,IAAAA,GAAAA,qBAAA,GAAIpE,KAAK,CAAC6D,wBAAwB,EAAE,CAACS,IAAI,CAACC,MAAM,CAAA;KAEzE,CAAA;AACH,GAAA;AACF;;;;"}
@@ -1,145 +0,0 @@
1
- /**
2
- * table-core
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- 'use strict';
12
-
13
- var utils = require('../utils.js');
14
-
15
- //
16
-
17
- const getDefaultRowPinningState = () => ({
18
- top: [],
19
- bottom: []
20
- });
21
- const RowPinning = {
22
- getInitialState: state => {
23
- return {
24
- rowPinning: getDefaultRowPinningState(),
25
- ...state
26
- };
27
- },
28
- getDefaultOptions: table => {
29
- return {
30
- onRowPinningChange: utils.makeStateUpdater('rowPinning', table)
31
- };
32
- },
33
- createRow: (row, table) => {
34
- row.pin = (position, includeLeafRows, includeParentRows) => {
35
- const leafRowIds = includeLeafRows ? row.getLeafRows().map(_ref => {
36
- let {
37
- id
38
- } = _ref;
39
- return id;
40
- }) : [];
41
- const parentRowIds = includeParentRows ? row.getParentRows().map(_ref2 => {
42
- let {
43
- id
44
- } = _ref2;
45
- return id;
46
- }) : [];
47
- const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds]);
48
- table.setRowPinning(old => {
49
- var _old$top3, _old$bottom3;
50
- if (position === 'bottom') {
51
- var _old$top, _old$bottom;
52
- return {
53
- top: ((_old$top = old == null ? void 0 : old.top) != null ? _old$top : []).filter(d => !(rowIds != null && rowIds.has(d))),
54
- bottom: [...((_old$bottom = old == null ? void 0 : old.bottom) != null ? _old$bottom : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)]
55
- };
56
- }
57
- if (position === 'top') {
58
- var _old$top2, _old$bottom2;
59
- return {
60
- top: [...((_old$top2 = old == null ? void 0 : old.top) != null ? _old$top2 : []).filter(d => !(rowIds != null && rowIds.has(d))), ...Array.from(rowIds)],
61
- bottom: ((_old$bottom2 = old == null ? void 0 : old.bottom) != null ? _old$bottom2 : []).filter(d => !(rowIds != null && rowIds.has(d)))
62
- };
63
- }
64
- return {
65
- top: ((_old$top3 = old == null ? void 0 : old.top) != null ? _old$top3 : []).filter(d => !(rowIds != null && rowIds.has(d))),
66
- bottom: ((_old$bottom3 = old == null ? void 0 : old.bottom) != null ? _old$bottom3 : []).filter(d => !(rowIds != null && rowIds.has(d)))
67
- };
68
- });
69
- };
70
- row.getCanPin = () => {
71
- var _ref3;
72
- const {
73
- enableRowPinning,
74
- enablePinning
75
- } = table.options;
76
- if (typeof enableRowPinning === 'function') {
77
- return enableRowPinning(row);
78
- }
79
- return (_ref3 = enableRowPinning != null ? enableRowPinning : enablePinning) != null ? _ref3 : true;
80
- };
81
- row.getIsPinned = () => {
82
- const rowIds = [row.id];
83
- const {
84
- top,
85
- bottom
86
- } = table.getState().rowPinning;
87
- const isTop = rowIds.some(d => top == null ? void 0 : top.includes(d));
88
- const isBottom = rowIds.some(d => bottom == null ? void 0 : bottom.includes(d));
89
- return isTop ? 'top' : isBottom ? 'bottom' : false;
90
- };
91
- row.getPinnedIndex = () => {
92
- var _ref4, _visiblePinnedRowIds$;
93
- const position = row.getIsPinned();
94
- if (!position) return -1;
95
- const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {
96
- let {
97
- id
98
- } = _ref5;
99
- return id;
100
- });
101
- return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
102
- };
103
- },
104
- createTable: table => {
105
- table.setRowPinning = updater => table.options.onRowPinningChange == null ? void 0 : table.options.onRowPinningChange(updater);
106
- table.resetRowPinning = defaultState => {
107
- var _table$initialState$r, _table$initialState;
108
- return table.setRowPinning(defaultState ? getDefaultRowPinningState() : (_table$initialState$r = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.rowPinning) != null ? _table$initialState$r : getDefaultRowPinningState());
109
- };
110
- table.getIsSomeRowsPinned = position => {
111
- var _pinningState$positio;
112
- const pinningState = table.getState().rowPinning;
113
- if (!position) {
114
- var _pinningState$top, _pinningState$bottom;
115
- return Boolean(((_pinningState$top = pinningState.top) == null ? void 0 : _pinningState$top.length) || ((_pinningState$bottom = pinningState.bottom) == null ? void 0 : _pinningState$bottom.length));
116
- }
117
- return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
118
- };
119
- table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {
120
- var _table$options$keepPi;
121
- const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?
122
- //get all rows that are pinned even if they would not be otherwise visible
123
- //account for expanded parent rows, but not pagination or filtering
124
- (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => {
125
- const row = table.getRow(rowId, true);
126
- return row.getIsAllParentsExpanded() ? row : null;
127
- }) :
128
- //else get only visible rows that are pinned
129
- (pinnedRowIds != null ? pinnedRowIds : []).map(rowId => visibleRows.find(row => row.id === rowId));
130
- return rows.filter(Boolean).map(d => ({
131
- ...d,
132
- position
133
- }));
134
- };
135
- table.getTopRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), utils.getMemoOptions(table.options, 'debugRows', 'getTopRows'));
136
- table.getBottomRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), utils.getMemoOptions(table.options, 'debugRows', 'getBottomRows'));
137
- table.getCenterRows = utils.memo(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
138
- const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);
139
- return allRows.filter(d => !topAndBottom.has(d.id));
140
- }, utils.getMemoOptions(table.options, 'debugRows', 'getCenterRows'));
141
- }
142
- };
143
-
144
- exports.RowPinning = RowPinning;
145
- //# sourceMappingURL=RowPinning.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RowPinning.js","sources":["../../../src/features/RowPinning.ts"],"sourcesContent":["import {\n OnChangeFn,\n Updater,\n Table,\n Row,\n RowData,\n TableFeature,\n} from '../types'\nimport { getMemoOptions, makeStateUpdater, memo } from '../utils'\n\nexport type RowPinningPosition = false | 'top' | 'bottom'\n\nexport interface RowPinningState {\n bottom?: string[]\n top?: string[]\n}\n\nexport interface RowPinningTableState {\n rowPinning: RowPinningState\n}\n\nexport interface RowPinningOptions<TData extends RowData> {\n /**\n * Enables/disables row pinning for the table. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#enablerowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n enableRowPinning?: boolean | ((row: Row<TData>) => boolean)\n /**\n * When `false`, pinned rows will not be visible if they are filtered or paginated out of the table. When `true`, pinned rows will always be visible regardless of filtering or pagination. Defaults to `true`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#keeppinnedrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n keepPinnedRows?: boolean\n /**\n * If provided, this function will be called with an `updaterFn` when `state.rowPinning` changes. This overrides the default internal state management, so you will also need to supply `state.rowPinning` from your own managed state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#onrowpinningchange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/onrowpinningchange)\n */\n onRowPinningChange?: OnChangeFn<RowPinningState>\n}\n\nexport interface RowPinningDefaultOptions {\n onRowPinningChange: OnChangeFn<RowPinningState>\n}\n\nexport interface RowPinningRow {\n /**\n * Returns whether or not the row can be pinned.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcanpin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCanPin: () => boolean\n /**\n * Returns the pinned position of the row. (`'top'`, `'bottom'` or `false`)\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getispinned-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsPinned: () => RowPinningPosition\n /**\n * Returns the numeric pinned index of the row within a pinned row group.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getpinnedindex-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getPinnedIndex: () => number\n /**\n * Pins a row to the `'top'` or `'bottom'`, or unpins the row to the center if `false` is passed.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#pin-1)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n pin: (\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean\n ) => void\n}\n\nexport interface RowPinningInstance<TData extends RowData> {\n _getPinnedRows: (\n visiblePinnedRows: Array<Row<TData>>,\n pinnedRowIds: Array<string> | undefined,\n position: 'top' | 'bottom'\n ) => Row<TData>[]\n /**\n * Returns all bottom pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getbottomrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getBottomRows: () => Row<TData>[]\n /**\n * Returns all rows that are not pinned to the top or bottom.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getcenterrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getCenterRows: () => Row<TData>[]\n /**\n * Returns whether or not any rows are pinned. Optionally specify to only check for pinned rows in either the `top` or `bottom` position.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#getissomerowspinned)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean\n /**\n * Returns all top pinned rows.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#gettoprows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n getTopRows: () => Row<TData>[]\n /**\n * Resets the **rowPinning** state to `initialState.rowPinning`, or `true` can be passed to force a default blank state reset to `{ top: [], bottom: [], }`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#resetrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n resetRowPinning: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.rowPinning` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#setrowpinning)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)\n */\n setRowPinning: (updater: Updater<RowPinningState>) => void\n}\n\n//\n\nconst getDefaultRowPinningState = (): RowPinningState => ({\n top: [],\n bottom: [],\n})\n\nexport const RowPinning: TableFeature = {\n getInitialState: (state): RowPinningTableState => {\n return {\n rowPinning: getDefaultRowPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: <TData extends RowData>(\n table: Table<TData>\n ): RowPinningDefaultOptions => {\n return {\n onRowPinningChange: makeStateUpdater('rowPinning', table),\n }\n },\n\n createRow: <TData extends RowData>(\n row: Row<TData>,\n table: Table<TData>\n ): void => {\n row.pin = (position, includeLeafRows, includeParentRows) => {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table.setRowPinning(old => {\n if (position === 'bottom') {\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: [\n ...(old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [\n ...(old?.top ?? []).filter(d => !rowIds?.has(d)),\n ...Array.from(rowIds),\n ],\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n }\n\n return {\n top: (old?.top ?? []).filter(d => !rowIds?.has(d)),\n bottom: (old?.bottom ?? []).filter(d => !rowIds?.has(d)),\n }\n })\n }\n row.getCanPin = () => {\n const { enableRowPinning, enablePinning } = table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? enablePinning ?? true\n }\n row.getIsPinned = () => {\n const rowIds = [row.id]\n\n const { top, bottom } = table.getState().rowPinning\n\n const isTop = rowIds.some(d => top?.includes(d))\n const isBottom = rowIds.some(d => bottom?.includes(d))\n\n return isTop ? 'top' : isBottom ? 'bottom' : false\n }\n row.getPinnedIndex = () => {\n const position = row.getIsPinned()\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top' ? table.getTopRows() : table.getBottomRows()\n )?.map(({ id }) => id)\n\n return visiblePinnedRowIds?.indexOf(row.id) ?? -1\n }\n },\n\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n table.setRowPinning = updater => table.options.onRowPinningChange?.(updater)\n\n table.resetRowPinning = defaultState =>\n table.setRowPinning(\n defaultState\n ? getDefaultRowPinningState()\n : table.initialState?.rowPinning ?? getDefaultRowPinningState()\n )\n\n table.getIsSomeRowsPinned = position => {\n const pinningState = table.getState().rowPinning\n\n if (!position) {\n return Boolean(pinningState.top?.length || pinningState.bottom?.length)\n }\n return Boolean(pinningState[position]?.length)\n }\n\n table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {\n const rows =\n table.options.keepPinnedRows ?? true\n ? //get all rows that are pinned even if they would not be otherwise visible\n //account for expanded parent rows, but not pagination or filtering\n (pinnedRowIds ?? []).map(rowId => {\n const row = table.getRow(rowId, true)\n return row.getIsAllParentsExpanded() ? row : null\n })\n : //else get only visible rows that are pinned\n (pinnedRowIds ?? []).map(\n rowId => visibleRows.find(row => row.id === rowId)!\n )\n\n return rows.filter(Boolean).map(d => ({ ...d, position })) as Row<TData>[]\n }\n\n table.getTopRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.top],\n (allRows, topPinnedRowIds) =>\n table._getPinnedRows(allRows, topPinnedRowIds, 'top'),\n getMemoOptions(table.options, 'debugRows', 'getTopRows')\n )\n\n table.getBottomRows = memo(\n () => [table.getRowModel().rows, table.getState().rowPinning.bottom],\n (allRows, bottomPinnedRowIds) =>\n table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'),\n getMemoOptions(table.options, 'debugRows', 'getBottomRows')\n )\n\n table.getCenterRows = memo(\n () => [\n table.getRowModel().rows,\n table.getState().rowPinning.top,\n table.getState().rowPinning.bottom,\n ],\n (allRows, top, bottom) => {\n const topAndBottom = new Set([...(top ?? []), ...(bottom ?? [])])\n return allRows.filter(d => !topAndBottom.has(d.id))\n },\n getMemoOptions(table.options, 'debugRows', 'getCenterRows')\n )\n },\n}\n"],"names":["getDefaultRowPinningState","top","bottom","RowPinning","getInitialState","state","rowPinning","getDefaultOptions","table","onRowPinningChange","makeStateUpdater","createRow","row","pin","position","includeLeafRows","includeParentRows","leafRowIds","getLeafRows","map","_ref","id","parentRowIds","getParentRows","_ref2","rowIds","Set","setRowPinning","old","_old$top3","_old$bottom3","_old$top","_old$bottom","filter","d","has","Array","from","_old$top2","_old$bottom2","getCanPin","_ref3","enableRowPinning","enablePinning","options","getIsPinned","getState","isTop","some","includes","isBottom","getPinnedIndex","_ref4","_visiblePinnedRowIds$","visiblePinnedRowIds","getTopRows","getBottomRows","_ref5","indexOf","createTable","updater","resetRowPinning","defaultState","_table$initialState$r","_table$initialState","initialState","getIsSomeRowsPinned","_pinningState$positio","pinningState","_pinningState$top","_pinningState$bottom","Boolean","length","_getPinnedRows","visibleRows","pinnedRowIds","_table$options$keepPi","rows","keepPinnedRows","rowId","getRow","getIsAllParentsExpanded","find","memo","getRowModel","allRows","topPinnedRowIds","getMemoOptions","bottomPinnedRowIds","getCenterRows","topAndBottom"],"mappings":";;;;;;;;;;;;;;AAyHA;;AAEA,MAAMA,yBAAyB,GAAGA,OAAwB;AACxDC,EAAAA,GAAG,EAAE,EAAE;AACPC,EAAAA,MAAM,EAAE,EAAA;AACV,CAAC,CAAC,CAAA;AAEK,MAAMC,UAAwB,GAAG;EACtCC,eAAe,EAAGC,KAAK,IAA2B;IAChD,OAAO;MACLC,UAAU,EAAEN,yBAAyB,EAAE;MACvC,GAAGK,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACU;IAC7B,OAAO;AACLC,MAAAA,kBAAkB,EAAEC,sBAAgB,CAAC,YAAY,EAAEF,KAAK,CAAA;KACzD,CAAA;GACF;AAEDG,EAAAA,SAAS,EAAEA,CACTC,GAAe,EACfJ,KAAmB,KACV;IACTI,GAAG,CAACC,GAAG,GAAG,CAACC,QAAQ,EAAEC,eAAe,EAAEC,iBAAiB,KAAK;AAC1D,MAAA,MAAMC,UAAU,GAAGF,eAAe,GAC9BH,GAAG,CAACM,WAAW,EAAE,CAACC,GAAG,CAACC,IAAA,IAAA;QAAA,IAAC;AAAEC,UAAAA,EAAAA;AAAG,SAAC,GAAAD,IAAA,CAAA;AAAA,QAAA,OAAKC,EAAE,CAAA;AAAA,OAAA,CAAC,GACrC,EAAE,CAAA;AACN,MAAA,MAAMC,YAAY,GAAGN,iBAAiB,GAClCJ,GAAG,CAACW,aAAa,EAAE,CAACJ,GAAG,CAACK,KAAA,IAAA;QAAA,IAAC;AAAEH,UAAAA,EAAAA;AAAG,SAAC,GAAAG,KAAA,CAAA;AAAA,QAAA,OAAKH,EAAE,CAAA;AAAA,OAAA,CAAC,GACvC,EAAE,CAAA;AACN,MAAA,MAAMI,MAAM,GAAG,IAAIC,GAAG,CAAC,CAAC,GAAGJ,YAAY,EA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AC,IAAI,CAACwD,YAAY,CAACvD,GAAG,CAACD,CAAC,CAACb,EAAE,CAAC,CAAC,CAAA;KACpD,EACDkE,oBAAc,CAAC/E,KAAK,CAACoC,OAAO,EAAE,WAAW,EAAE,eAAe,CAC5D,CAAC,CAAA;AACH,GAAA;AACF;;;;"}
@@ -1,391 +0,0 @@
1
- /**
2
- * table-core
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- 'use strict';
12
-
13
- var utils = require('../utils.js');
14
-
15
- //
16
-
17
- const RowSelection = {
18
- getInitialState: state => {
19
- return {
20
- rowSelection: {},
21
- ...state
22
- };
23
- },
24
- getDefaultOptions: table => {
25
- return {
26
- onRowSelectionChange: utils.makeStateUpdater('rowSelection', table),
27
- enableRowSelection: true,
28
- enableMultiRowSelection: true,
29
- enableSubRowSelection: true
30
- // enableGroupingRowSelection: false,
31
- // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
32
- // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
33
- };
34
- },
35
- createTable: table => {
36
- table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);
37
- table.resetRowSelection = defaultState => {
38
- var _table$initialState$r;
39
- return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
40
- };
41
- table.toggleAllRowsSelected = value => {
42
- table.setRowSelection(old => {
43
- value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
44
- const rowSelection = {
45
- ...old
46
- };
47
- const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
48
-
49
- // We don't use `mutateRowIsSelected` here for performance reasons.
50
- // All of the rows are flat already, so it wouldn't be worth it
51
- if (value) {
52
- preGroupedFlatRows.forEach(row => {
53
- if (!row.getCanSelect()) {
54
- return;
55
- }
56
- rowSelection[row.id] = true;
57
- });
58
- } else {
59
- preGroupedFlatRows.forEach(row => {
60
- delete rowSelection[row.id];
61
- });
62
- }
63
- return rowSelection;
64
- });
65
- };
66
- table.toggleAllPageRowsSelected = value => table.setRowSelection(old => {
67
- const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
68
- const rowSelection = {
69
- ...old
70
- };
71
- table.getRowModel().rows.forEach(row => {
72
- mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table);
73
- });
74
- return rowSelection;
75
- });
76
-
77
- // addRowSelectionRange: rowId => {
78
- // const {
79
- // rows,
80
- // rowsById,
81
- // options: { selectGroupingRows, selectSubRows },
82
- // } = table
83
-
84
- // const findSelectedRow = (rows: Row[]) => {
85
- // let found
86
- // rows.find(d => {
87
- // if (d.getIsSelected()) {
88
- // found = d
89
- // return true
90
- // }
91
- // const subFound = findSelectedRow(d.subRows || [])
92
- // if (subFound) {
93
- // found = subFound
94
- // return true
95
- // }
96
- // return false
97
- // })
98
- // return found
99
- // }
100
-
101
- // const firstRow = findSelectedRow(rows) || rows[0]
102
- // const lastRow = rowsById[rowId]
103
-
104
- // let include = false
105
- // const selectedRowIds = {}
106
-
107
- // const addRow = (row: Row) => {
108
- // mutateRowIsSelected(selectedRowIds, row.id, true, {
109
- // rowsById,
110
- // selectGroupingRows: selectGroupingRows!,
111
- // selectSubRows: selectSubRows!,
112
- // })
113
- // }
114
-
115
- // table.rows.forEach(row => {
116
- // const isFirstRow = row.id === firstRow.id
117
- // const isLastRow = row.id === lastRow.id
118
-
119
- // if (isFirstRow || isLastRow) {
120
- // if (!include) {
121
- // include = true
122
- // } else if (include) {
123
- // addRow(row)
124
- // include = false
125
- // }
126
- // }
127
-
128
- // if (include) {
129
- // addRow(row)
130
- // }
131
- // })
132
-
133
- // table.setRowSelection(selectedRowIds)
134
- // },
135
- table.getPreSelectedRowModel = () => table.getCoreRowModel();
136
- table.getSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
137
- if (!Object.keys(rowSelection).length) {
138
- return {
139
- rows: [],
140
- flatRows: [],
141
- rowsById: {}
142
- };
143
- }
144
- return selectRowsFn(table, rowModel);
145
- }, utils.getMemoOptions(table.options, 'debugTable', 'getSelectedRowModel'));
146
- table.getFilteredSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
147
- if (!Object.keys(rowSelection).length) {
148
- return {
149
- rows: [],
150
- flatRows: [],
151
- rowsById: {}
152
- };
153
- }
154
- return selectRowsFn(table, rowModel);
155
- }, utils.getMemoOptions(table.options, 'debugTable', 'getFilteredSelectedRowModel'));
156
- table.getGroupedSelectedRowModel = utils.memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
157
- if (!Object.keys(rowSelection).length) {
158
- return {
159
- rows: [],
160
- flatRows: [],
161
- rowsById: {}
162
- };
163
- }
164
- return selectRowsFn(table, rowModel);
165
- }, utils.getMemoOptions(table.options, 'debugTable', 'getGroupedSelectedRowModel'));
166
-
167
- ///
168
-
169
- // getGroupingRowCanSelect: rowId => {
170
- // const row = table.getRow(rowId)
171
-
172
- // if (!row) {
173
- // throw new Error()
174
- // }
175
-
176
- // if (typeof table.options.enableGroupingRowSelection === 'function') {
177
- // return table.options.enableGroupingRowSelection(row)
178
- // }
179
-
180
- // return table.options.enableGroupingRowSelection ?? false
181
- // },
182
-
183
- table.getIsAllRowsSelected = () => {
184
- const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
185
- const {
186
- rowSelection
187
- } = table.getState();
188
- let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
189
- if (isAllRowsSelected) {
190
- if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
191
- isAllRowsSelected = false;
192
- }
193
- }
194
- return isAllRowsSelected;
195
- };
196
- table.getIsAllPageRowsSelected = () => {
197
- const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());
198
- const {
199
- rowSelection
200
- } = table.getState();
201
- let isAllPageRowsSelected = !!paginationFlatRows.length;
202
- if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
203
- isAllPageRowsSelected = false;
204
- }
205
- return isAllPageRowsSelected;
206
- };
207
- table.getIsSomeRowsSelected = () => {
208
- var _table$getState$rowSe;
209
- const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
210
- return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
211
- };
212
- table.getIsSomePageRowsSelected = () => {
213
- const paginationFlatRows = table.getPaginationRowModel().flatRows;
214
- return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());
215
- };
216
- table.getToggleAllRowsSelectedHandler = () => {
217
- return e => {
218
- table.toggleAllRowsSelected(e.target.checked);
219
- };
220
- };
221
- table.getToggleAllPageRowsSelectedHandler = () => {
222
- return e => {
223
- table.toggleAllPageRowsSelected(e.target.checked);
224
- };
225
- };
226
- },
227
- createRow: (row, table) => {
228
- row.toggleSelected = (value, opts) => {
229
- const isSelected = row.getIsSelected();
230
- table.setRowSelection(old => {
231
- var _opts$selectChildren;
232
- value = typeof value !== 'undefined' ? value : !isSelected;
233
- if (row.getCanSelect() && isSelected === value) {
234
- return old;
235
- }
236
- const selectedRowIds = {
237
- ...old
238
- };
239
- mutateRowIsSelected(selectedRowIds, row.id, value, (_opts$selectChildren = opts == null ? void 0 : opts.selectChildren) != null ? _opts$selectChildren : true, table);
240
- return selectedRowIds;
241
- });
242
- };
243
- row.getIsSelected = () => {
244
- const {
245
- rowSelection
246
- } = table.getState();
247
- return isRowSelected(row, rowSelection);
248
- };
249
- row.getIsSomeSelected = () => {
250
- const {
251
- rowSelection
252
- } = table.getState();
253
- return isSubRowSelected(row, rowSelection) === 'some';
254
- };
255
- row.getIsAllSubRowsSelected = () => {
256
- const {
257
- rowSelection
258
- } = table.getState();
259
- return isSubRowSelected(row, rowSelection) === 'all';
260
- };
261
- row.getCanSelect = () => {
262
- var _table$options$enable;
263
- if (typeof table.options.enableRowSelection === 'function') {
264
- return table.options.enableRowSelection(row);
265
- }
266
- return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
267
- };
268
- row.getCanSelectSubRows = () => {
269
- var _table$options$enable2;
270
- if (typeof table.options.enableSubRowSelection === 'function') {
271
- return table.options.enableSubRowSelection(row);
272
- }
273
- return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
274
- };
275
- row.getCanMultiSelect = () => {
276
- var _table$options$enable3;
277
- if (typeof table.options.enableMultiRowSelection === 'function') {
278
- return table.options.enableMultiRowSelection(row);
279
- }
280
- return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
281
- };
282
- row.getToggleSelectedHandler = () => {
283
- const canSelect = row.getCanSelect();
284
- return e => {
285
- var _target;
286
- if (!canSelect) return;
287
- row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
288
- };
289
- };
290
- }
291
- };
292
- const mutateRowIsSelected = (selectedRowIds, id, value, includeChildren, table) => {
293
- var _row$subRows;
294
- const row = table.getRow(id, true);
295
-
296
- // const isGrouped = row.getIsGrouped()
297
-
298
- // if ( // TODO: enforce grouping row selection rules
299
- // !isGrouped ||
300
- // (isGrouped && table.options.enableGroupingRowSelection)
301
- // ) {
302
- if (value) {
303
- if (!row.getCanMultiSelect()) {
304
- Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
305
- }
306
- if (row.getCanSelect()) {
307
- selectedRowIds[id] = true;
308
- }
309
- } else {
310
- delete selectedRowIds[id];
311
- }
312
- // }
313
-
314
- if (includeChildren && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
315
- row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, includeChildren, table));
316
- }
317
- };
318
- function selectRowsFn(table, rowModel) {
319
- const rowSelection = table.getState().rowSelection;
320
- const newSelectedFlatRows = [];
321
- const newSelectedRowsById = {};
322
-
323
- // Filters top level and nested rows
324
- const recurseRows = function (rows, depth) {
325
- return rows.map(row => {
326
- var _row$subRows2;
327
- const isSelected = isRowSelected(row, rowSelection);
328
- if (isSelected) {
329
- newSelectedFlatRows.push(row);
330
- newSelectedRowsById[row.id] = row;
331
- }
332
- if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
333
- row = {
334
- ...row,
335
- subRows: recurseRows(row.subRows)
336
- };
337
- }
338
- if (isSelected) {
339
- return row;
340
- }
341
- }).filter(Boolean);
342
- };
343
- return {
344
- rows: recurseRows(rowModel.rows),
345
- flatRows: newSelectedFlatRows,
346
- rowsById: newSelectedRowsById
347
- };
348
- }
349
- function isRowSelected(row, selection) {
350
- var _selection$row$id;
351
- return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
352
- }
353
- function isSubRowSelected(row, selection, table) {
354
- var _row$subRows3;
355
- if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;
356
- let allChildrenSelected = true;
357
- let someSelected = false;
358
- row.subRows.forEach(subRow => {
359
- // Bail out early if we know both of these
360
- if (someSelected && !allChildrenSelected) {
361
- return;
362
- }
363
- if (subRow.getCanSelect()) {
364
- if (isRowSelected(subRow, selection)) {
365
- someSelected = true;
366
- } else {
367
- allChildrenSelected = false;
368
- }
369
- }
370
-
371
- // Check row selection of nested subrows
372
- if (subRow.subRows && subRow.subRows.length) {
373
- const subRowChildrenSelected = isSubRowSelected(subRow, selection);
374
- if (subRowChildrenSelected === 'all') {
375
- someSelected = true;
376
- } else if (subRowChildrenSelected === 'some') {
377
- someSelected = true;
378
- allChildrenSelected = false;
379
- } else {
380
- allChildrenSelected = false;
381
- }
382
- }
383
- });
384
- return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
385
- }
386
-
387
- exports.RowSelection = RowSelection;
388
- exports.isRowSelected = isRowSelected;
389
- exports.isSubRowSelected = isSubRowSelected;
390
- exports.selectRowsFn = selectRowsFn;
391
- //# sourceMappingURL=RowSelection.js.map