@tanstack/table-core 9.0.0-beta.2 → 9.0.0-beta.7

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 (278) hide show
  1. package/dist/core/cells/coreCellsFeature.cjs +11 -20
  2. package/dist/core/cells/coreCellsFeature.cjs.map +1 -1
  3. package/dist/core/cells/coreCellsFeature.d.cts +4 -12
  4. package/dist/core/cells/coreCellsFeature.d.ts +4 -12
  5. package/dist/core/cells/coreCellsFeature.js +12 -20
  6. package/dist/core/cells/coreCellsFeature.js.map +1 -1
  7. package/dist/core/columns/coreColumnsFeature.cjs +59 -68
  8. package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
  9. package/dist/core/columns/coreColumnsFeature.d.cts +4 -12
  10. package/dist/core/columns/coreColumnsFeature.d.ts +4 -12
  11. package/dist/core/columns/coreColumnsFeature.js +60 -68
  12. package/dist/core/columns/coreColumnsFeature.js.map +1 -1
  13. package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
  14. package/dist/core/headers/buildHeaderGroups.js.map +1 -1
  15. package/dist/core/headers/coreHeadersFeature.cjs +44 -53
  16. package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
  17. package/dist/core/headers/coreHeadersFeature.d.cts +4 -12
  18. package/dist/core/headers/coreHeadersFeature.d.ts +4 -12
  19. package/dist/core/headers/coreHeadersFeature.js +45 -53
  20. package/dist/core/headers/coreHeadersFeature.js.map +1 -1
  21. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  22. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  23. package/dist/core/row-models/coreRowModelsFeature.cjs +17 -26
  24. package/dist/core/row-models/coreRowModelsFeature.cjs.map +1 -1
  25. package/dist/core/row-models/coreRowModelsFeature.d.cts +4 -12
  26. package/dist/core/row-models/coreRowModelsFeature.d.ts +4 -12
  27. package/dist/core/row-models/coreRowModelsFeature.js +18 -26
  28. package/dist/core/row-models/coreRowModelsFeature.js.map +1 -1
  29. package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -5
  30. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -5
  31. package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
  32. package/dist/core/row-models/createCoreRowModel.js.map +1 -1
  33. package/dist/core/rows/coreRowsFeature.cjs +27 -36
  34. package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
  35. package/dist/core/rows/coreRowsFeature.d.cts +4 -12
  36. package/dist/core/rows/coreRowsFeature.d.ts +4 -12
  37. package/dist/core/rows/coreRowsFeature.js +28 -36
  38. package/dist/core/rows/coreRowsFeature.js.map +1 -1
  39. package/dist/core/table/constructTable.cjs +2 -2
  40. package/dist/core/table/constructTable.cjs.map +1 -1
  41. package/dist/core/table/constructTable.js +2 -2
  42. package/dist/core/table/constructTable.js.map +1 -1
  43. package/dist/core/table/coreTablesFeature.cjs +7 -16
  44. package/dist/core/table/coreTablesFeature.cjs.map +1 -1
  45. package/dist/core/table/coreTablesFeature.d.cts +4 -12
  46. package/dist/core/table/coreTablesFeature.d.ts +4 -12
  47. package/dist/core/table/coreTablesFeature.js +8 -16
  48. package/dist/core/table/coreTablesFeature.js.map +1 -1
  49. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  50. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  51. package/dist/features/column-faceting/columnFacetingFeature.cjs +49 -61
  52. package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
  53. package/dist/features/column-faceting/columnFacetingFeature.d.cts +4 -15
  54. package/dist/features/column-faceting/columnFacetingFeature.d.ts +4 -15
  55. package/dist/features/column-faceting/columnFacetingFeature.js +50 -61
  56. package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
  57. package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
  58. package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
  59. package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
  60. package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
  61. package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
  62. package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
  63. package/dist/features/column-filtering/columnFilteringFeature.cjs +40 -53
  64. package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
  65. package/dist/features/column-filtering/columnFilteringFeature.d.cts +4 -16
  66. package/dist/features/column-filtering/columnFilteringFeature.d.ts +4 -16
  67. package/dist/features/column-filtering/columnFilteringFeature.js +41 -53
  68. package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
  69. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +3 -3
  70. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +3 -3
  71. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  72. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +1 -1
  73. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +1 -1
  74. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  75. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  76. package/dist/features/column-filtering/createFilteredRowModel.d.cts +1 -1
  77. package/dist/features/column-filtering/createFilteredRowModel.d.ts +1 -1
  78. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  79. package/dist/features/column-grouping/columnGroupingFeature.cjs +57 -69
  80. package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
  81. package/dist/features/column-grouping/columnGroupingFeature.d.cts +4 -15
  82. package/dist/features/column-grouping/columnGroupingFeature.d.ts +4 -15
  83. package/dist/features/column-grouping/columnGroupingFeature.js +58 -69
  84. package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
  85. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  86. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  87. package/dist/features/column-ordering/columnOrderingFeature.cjs +47 -59
  88. package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
  89. package/dist/features/column-ordering/columnOrderingFeature.d.cts +4 -15
  90. package/dist/features/column-ordering/columnOrderingFeature.d.ts +4 -15
  91. package/dist/features/column-ordering/columnOrderingFeature.js +48 -59
  92. package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
  93. package/dist/features/column-pinning/columnPinningFeature.cjs +209 -221
  94. package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
  95. package/dist/features/column-pinning/columnPinningFeature.d.cts +4 -15
  96. package/dist/features/column-pinning/columnPinningFeature.d.ts +4 -15
  97. package/dist/features/column-pinning/columnPinningFeature.js +210 -221
  98. package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
  99. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  100. package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +12 -12
  101. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +12 -12
  102. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  103. package/dist/features/column-resizing/columnResizingFeature.cjs +31 -43
  104. package/dist/features/column-resizing/columnResizingFeature.cjs.map +1 -1
  105. package/dist/features/column-resizing/columnResizingFeature.d.cts +4 -15
  106. package/dist/features/column-resizing/columnResizingFeature.d.ts +4 -15
  107. package/dist/features/column-resizing/columnResizingFeature.js +32 -43
  108. package/dist/features/column-resizing/columnResizingFeature.js.map +1 -1
  109. package/dist/features/column-sizing/columnSizingFeature.cjs +112 -125
  110. package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
  111. package/dist/features/column-sizing/columnSizingFeature.d.cts +4 -16
  112. package/dist/features/column-sizing/columnSizingFeature.d.ts +4 -16
  113. package/dist/features/column-sizing/columnSizingFeature.js +113 -125
  114. package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
  115. package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +3 -3
  116. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +3 -3
  117. package/dist/features/column-visibility/columnVisibilityFeature.cjs +83 -95
  118. package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
  119. package/dist/features/column-visibility/columnVisibilityFeature.d.cts +4 -15
  120. package/dist/features/column-visibility/columnVisibilityFeature.d.ts +4 -15
  121. package/dist/features/column-visibility/columnVisibilityFeature.js +84 -95
  122. package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
  123. package/dist/features/global-filtering/globalFilteringFeature.cjs +31 -43
  124. package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
  125. package/dist/features/global-filtering/globalFilteringFeature.d.cts +4 -15
  126. package/dist/features/global-filtering/globalFilteringFeature.d.ts +4 -15
  127. package/dist/features/global-filtering/globalFilteringFeature.js +32 -43
  128. package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
  129. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  130. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +4 -2
  131. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +4 -2
  132. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  133. package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
  134. package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
  135. package/dist/features/row-expanding/rowExpandingFeature.cjs +37 -49
  136. package/dist/features/row-expanding/rowExpandingFeature.cjs.map +1 -1
  137. package/dist/features/row-expanding/rowExpandingFeature.d.cts +4 -15
  138. package/dist/features/row-expanding/rowExpandingFeature.d.ts +4 -15
  139. package/dist/features/row-expanding/rowExpandingFeature.js +38 -49
  140. package/dist/features/row-expanding/rowExpandingFeature.js.map +1 -1
  141. package/dist/features/row-pagination/createPaginatedRowModel.cjs.map +1 -1
  142. package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
  143. package/dist/features/row-pagination/rowPaginationFeature.cjs +35 -47
  144. package/dist/features/row-pagination/rowPaginationFeature.cjs.map +1 -1
  145. package/dist/features/row-pagination/rowPaginationFeature.d.cts +4 -15
  146. package/dist/features/row-pagination/rowPaginationFeature.d.ts +4 -15
  147. package/dist/features/row-pagination/rowPaginationFeature.js +36 -47
  148. package/dist/features/row-pagination/rowPaginationFeature.js.map +1 -1
  149. package/dist/features/row-pinning/rowPinningFeature.cjs +55 -67
  150. package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
  151. package/dist/features/row-pinning/rowPinningFeature.d.cts +4 -15
  152. package/dist/features/row-pinning/rowPinningFeature.d.ts +4 -15
  153. package/dist/features/row-pinning/rowPinningFeature.js +56 -67
  154. package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
  155. package/dist/features/row-selection/rowSelectionFeature.cjs +65 -77
  156. package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
  157. package/dist/features/row-selection/rowSelectionFeature.d.cts +4 -15
  158. package/dist/features/row-selection/rowSelectionFeature.d.ts +4 -15
  159. package/dist/features/row-selection/rowSelectionFeature.js +66 -77
  160. package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
  161. package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
  162. package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
  163. package/dist/features/row-sorting/rowSortingFeature.cjs +45 -57
  164. package/dist/features/row-sorting/rowSortingFeature.cjs.map +1 -1
  165. package/dist/features/row-sorting/rowSortingFeature.d.cts +4 -15
  166. package/dist/features/row-sorting/rowSortingFeature.d.ts +4 -15
  167. package/dist/features/row-sorting/rowSortingFeature.js +46 -57
  168. package/dist/features/row-sorting/rowSortingFeature.js.map +1 -1
  169. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +8 -5
  170. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  171. package/dist/features/row-sorting/rowSortingFeature.utils.js +8 -5
  172. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  173. package/dist/fns/aggregationFns.cjs +18 -18
  174. package/dist/fns/aggregationFns.cjs.map +1 -1
  175. package/dist/fns/aggregationFns.d.cts +21 -19
  176. package/dist/fns/aggregationFns.d.ts +21 -19
  177. package/dist/fns/aggregationFns.js +18 -18
  178. package/dist/fns/aggregationFns.js.map +1 -1
  179. package/dist/fns/filterFns.cjs +51 -65
  180. package/dist/fns/filterFns.cjs.map +1 -1
  181. package/dist/fns/filterFns.d.cts +82 -28
  182. package/dist/fns/filterFns.d.ts +82 -28
  183. package/dist/fns/filterFns.js +51 -65
  184. package/dist/fns/filterFns.js.map +1 -1
  185. package/dist/fns/sortFns.cjs +18 -6
  186. package/dist/fns/sortFns.cjs.map +1 -1
  187. package/dist/fns/sortFns.d.cts +15 -13
  188. package/dist/fns/sortFns.d.ts +15 -13
  189. package/dist/fns/sortFns.js +18 -6
  190. package/dist/fns/sortFns.js.map +1 -1
  191. package/dist/index.cjs +0 -20
  192. package/dist/index.d.cts +34 -34
  193. package/dist/index.d.ts +34 -34
  194. package/dist/index.js +21 -21
  195. package/dist/types/Cell.d.cts +3 -8
  196. package/dist/types/Cell.d.ts +3 -8
  197. package/dist/types/Column.d.cts +3 -8
  198. package/dist/types/Column.d.ts +3 -8
  199. package/dist/types/ColumnDef.d.cts +3 -8
  200. package/dist/types/ColumnDef.d.ts +3 -8
  201. package/dist/types/Header.d.cts +3 -8
  202. package/dist/types/Header.d.ts +3 -8
  203. package/dist/types/HeaderGroup.d.cts +3 -8
  204. package/dist/types/HeaderGroup.d.ts +3 -8
  205. package/dist/types/Row.d.cts +3 -8
  206. package/dist/types/Row.d.ts +3 -8
  207. package/dist/types/RowModel.d.cts +4 -10
  208. package/dist/types/RowModel.d.ts +4 -10
  209. package/dist/types/RowModelFns.d.cts +3 -8
  210. package/dist/types/RowModelFns.d.ts +3 -8
  211. package/dist/types/Table.d.cts +3 -8
  212. package/dist/types/Table.d.ts +3 -8
  213. package/dist/types/TableFeatures.d.cts +13 -39
  214. package/dist/types/TableFeatures.d.ts +13 -39
  215. package/dist/types/TableOptions.d.cts +3 -4
  216. package/dist/types/TableOptions.d.ts +3 -4
  217. package/dist/types/TableState.d.cts +5 -10
  218. package/dist/types/TableState.d.ts +5 -10
  219. package/dist/utils.cjs.map +1 -1
  220. package/dist/utils.d.cts +1 -1
  221. package/dist/utils.d.ts +1 -1
  222. package/dist/utils.js.map +1 -1
  223. package/package.json +1 -1
  224. package/src/core/cells/coreCellsFeature.ts +17 -39
  225. package/src/core/columns/coreColumnsFeature.ts +56 -83
  226. package/src/core/headers/buildHeaderGroups.ts +1 -1
  227. package/src/core/headers/coreHeadersFeature.ts +42 -64
  228. package/src/core/headers/coreHeadersFeature.utils.ts +1 -1
  229. package/src/core/row-models/coreRowModelsFeature.ts +43 -64
  230. package/src/core/row-models/coreRowModelsFeature.types.ts +2 -6
  231. package/src/core/row-models/createCoreRowModel.ts +1 -1
  232. package/src/core/rows/coreRowsFeature.ts +45 -72
  233. package/src/core/table/constructTable.ts +10 -7
  234. package/src/core/table/coreTablesFeature.ts +13 -35
  235. package/src/core/table/coreTablesFeature.utils.ts +1 -1
  236. package/src/features/column-faceting/columnFacetingFeature.ts +71 -102
  237. package/src/features/column-faceting/createFacetedMinMaxValues.ts +1 -1
  238. package/src/features/column-faceting/createFacetedRowModel.ts +1 -1
  239. package/src/features/column-faceting/createFacetedUniqueValues.ts +1 -1
  240. package/src/features/column-filtering/columnFilteringFeature.ts +60 -103
  241. package/src/features/column-filtering/columnFilteringFeature.types.ts +3 -3
  242. package/src/features/column-filtering/columnFilteringFeature.utils.ts +4 -4
  243. package/src/features/column-filtering/createFilteredRowModel.ts +2 -2
  244. package/src/features/column-grouping/columnGroupingFeature.ts +82 -126
  245. package/src/features/column-grouping/createGroupedRowModel.ts +1 -1
  246. package/src/features/column-ordering/columnOrderingFeature.ts +52 -84
  247. package/src/features/column-pinning/columnPinningFeature.ts +268 -304
  248. package/src/features/column-pinning/columnPinningFeature.utils.ts +5 -5
  249. package/src/features/column-resizing/columnResizingFeature.ts +44 -78
  250. package/src/features/column-sizing/columnSizingFeature.ts +115 -152
  251. package/src/features/column-visibility/columnVisibilityFeature.ts +92 -129
  252. package/src/features/global-filtering/globalFilteringFeature.ts +45 -79
  253. package/src/features/global-filtering/globalFilteringFeature.utils.ts +4 -2
  254. package/src/features/row-expanding/createExpandedRowModel.ts +1 -1
  255. package/src/features/row-expanding/rowExpandingFeature.ts +65 -101
  256. package/src/features/row-pagination/createPaginatedRowModel.ts +1 -1
  257. package/src/features/row-pagination/rowPaginationFeature.ts +69 -103
  258. package/src/features/row-pinning/rowPinningFeature.ts +72 -104
  259. package/src/features/row-selection/rowSelectionFeature.ts +103 -135
  260. package/src/features/row-sorting/createSortedRowModel.ts +1 -1
  261. package/src/features/row-sorting/rowSortingFeature.ts +73 -114
  262. package/src/features/row-sorting/rowSortingFeature.utils.ts +8 -6
  263. package/src/fns/aggregationFns.ts +26 -42
  264. package/src/fns/filterFns.ts +231 -264
  265. package/src/fns/sortFns.ts +51 -29
  266. package/src/types/Cell.ts +3 -19
  267. package/src/types/Column.ts +2 -18
  268. package/src/types/ColumnDef.ts +2 -18
  269. package/src/types/Header.ts +2 -18
  270. package/src/types/HeaderGroup.ts +2 -13
  271. package/src/types/Row.ts +2 -17
  272. package/src/types/RowModel.ts +3 -25
  273. package/src/types/RowModelFns.ts +2 -17
  274. package/src/types/Table.ts +2 -17
  275. package/src/types/TableFeatures.ts +51 -112
  276. package/src/types/TableOptions.ts +1 -12
  277. package/src/types/TableState.ts +4 -30
  278. package/src/utils.ts +5 -4
@@ -3,33 +3,25 @@ import { table_getCoreRowModel, table_getExpandedRowModel, table_getFilteredRowM
3
3
 
4
4
  //#region src/core/row-models/coreRowModelsFeature.ts
5
5
  /**
6
- * Creates the stock core row models feature.
7
- *
8
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
6
+ * Core feature that wires table row-model accessors and row-model caches.
9
7
  */
10
- function constructCoreRowModelsFeature() {
11
- return { constructTableAPIs: (table) => {
12
- assignTableAPIs("coreRowModelsFeature", table, {
13
- table_getCoreRowModel: { fn: () => table_getCoreRowModel(table) },
14
- table_getPreFilteredRowModel: { fn: () => table_getPreFilteredRowModel(table) },
15
- table_getFilteredRowModel: { fn: () => table_getFilteredRowModel(table) },
16
- table_getPreGroupedRowModel: { fn: () => table_getPreGroupedRowModel(table) },
17
- table_getGroupedRowModel: { fn: () => table_getGroupedRowModel(table) },
18
- table_getPreSortedRowModel: { fn: () => table_getPreSortedRowModel(table) },
19
- table_getSortedRowModel: { fn: () => table_getSortedRowModel(table) },
20
- table_getPreExpandedRowModel: { fn: () => table_getPreExpandedRowModel(table) },
21
- table_getExpandedRowModel: { fn: () => table_getExpandedRowModel(table) },
22
- table_getPrePaginatedRowModel: { fn: () => table_getPrePaginatedRowModel(table) },
23
- table_getPaginatedRowModel: { fn: () => table_getPaginatedRowModel(table) },
24
- table_getRowModel: { fn: () => table_getRowModel(table) }
25
- });
26
- } };
27
- }
28
- /**
29
- * The Core Row Models feature provides the core row model functionality.
30
- */
31
- const coreRowModelsFeature = constructCoreRowModelsFeature();
8
+ const coreRowModelsFeature = { constructTableAPIs: (table) => {
9
+ assignTableAPIs("coreRowModelsFeature", table, {
10
+ table_getCoreRowModel: { fn: () => table_getCoreRowModel(table) },
11
+ table_getPreFilteredRowModel: { fn: () => table_getPreFilteredRowModel(table) },
12
+ table_getFilteredRowModel: { fn: () => table_getFilteredRowModel(table) },
13
+ table_getPreGroupedRowModel: { fn: () => table_getPreGroupedRowModel(table) },
14
+ table_getGroupedRowModel: { fn: () => table_getGroupedRowModel(table) },
15
+ table_getPreSortedRowModel: { fn: () => table_getPreSortedRowModel(table) },
16
+ table_getSortedRowModel: { fn: () => table_getSortedRowModel(table) },
17
+ table_getPreExpandedRowModel: { fn: () => table_getPreExpandedRowModel(table) },
18
+ table_getExpandedRowModel: { fn: () => table_getExpandedRowModel(table) },
19
+ table_getPrePaginatedRowModel: { fn: () => table_getPrePaginatedRowModel(table) },
20
+ table_getPaginatedRowModel: { fn: () => table_getPaginatedRowModel(table) },
21
+ table_getRowModel: { fn: () => table_getRowModel(table) }
22
+ });
23
+ } };
32
24
 
33
25
  //#endregion
34
- export { constructCoreRowModelsFeature, coreRowModelsFeature };
26
+ export { coreRowModelsFeature };
35
27
  //# sourceMappingURL=coreRowModelsFeature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coreRowModelsFeature.js","names":[],"sources":["../../../src/core/row-models/coreRowModelsFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport {\n table_getCoreRowModel,\n table_getExpandedRowModel,\n table_getFilteredRowModel,\n table_getGroupedRowModel,\n table_getPaginatedRowModel,\n table_getPreExpandedRowModel,\n table_getPreFilteredRowModel,\n table_getPreGroupedRowModel,\n table_getPrePaginatedRowModel,\n table_getPreSortedRowModel,\n table_getRowModel,\n table_getSortedRowModel,\n} from './coreRowModelsFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type { Table_RowModels } from './coreRowModelsFeature.types'\n\nexport interface CoreRowModelsFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Table: Table_RowModels<TFeatures, TData>\n}\n\n/**\n * Creates the stock core row models feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructCoreRowModelsFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreRowModelsFeatureConstructors<TFeatures, TData>> {\n return {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowModelsFeature', table, {\n table_getCoreRowModel: {\n fn: () => table_getCoreRowModel(table),\n },\n table_getPreFilteredRowModel: {\n fn: () => table_getPreFilteredRowModel(table),\n },\n table_getFilteredRowModel: {\n fn: () => table_getFilteredRowModel(table),\n },\n table_getPreGroupedRowModel: {\n fn: () => table_getPreGroupedRowModel(table),\n },\n table_getGroupedRowModel: {\n fn: () => table_getGroupedRowModel(table),\n },\n table_getPreSortedRowModel: {\n fn: () => table_getPreSortedRowModel(table),\n },\n table_getSortedRowModel: {\n fn: () => table_getSortedRowModel(table),\n },\n table_getPreExpandedRowModel: {\n fn: () => table_getPreExpandedRowModel(table),\n },\n table_getExpandedRowModel: {\n fn: () => table_getExpandedRowModel(table),\n },\n table_getPrePaginatedRowModel: {\n fn: () => table_getPrePaginatedRowModel(table),\n },\n table_getPaginatedRowModel: {\n fn: () => table_getPaginatedRowModel(table),\n },\n table_getRowModel: {\n fn: () => table_getRowModel(table),\n },\n })\n },\n }\n}\n\n/**\n * The Core Row Models feature provides the core row model functionality.\n */\nexport const coreRowModelsFeature = constructCoreRowModelsFeature()\n"],"mappings":";;;;;;;;;AA+BA,SAAgB,gCAGsD;CACpE,OAAO,EACL,qBAAqB,UAAU;EAC7B,gBAAgB,wBAAwB,OAAO;GAC7C,uBAAuB,EACrB,UAAU,sBAAsB,KAAK,EACvC;GACA,8BAA8B,EAC5B,UAAU,6BAA6B,KAAK,EAC9C;GACA,2BAA2B,EACzB,UAAU,0BAA0B,KAAK,EAC3C;GACA,6BAA6B,EAC3B,UAAU,4BAA4B,KAAK,EAC7C;GACA,0BAA0B,EACxB,UAAU,yBAAyB,KAAK,EAC1C;GACA,4BAA4B,EAC1B,UAAU,2BAA2B,KAAK,EAC5C;GACA,yBAAyB,EACvB,UAAU,wBAAwB,KAAK,EACzC;GACA,8BAA8B,EAC5B,UAAU,6BAA6B,KAAK,EAC9C;GACA,2BAA2B,EACzB,UAAU,0BAA0B,KAAK,EAC3C;GACA,+BAA+B,EAC7B,UAAU,8BAA8B,KAAK,EAC/C;GACA,4BAA4B,EAC1B,UAAU,2BAA2B,KAAK,EAC5C;GACA,mBAAmB,EACjB,UAAU,kBAAkB,KAAK,EACnC;EACF,CAAC;CACH,EACF;AACF;;;;AAKA,MAAa,uBAAuB,8BAA8B"}
1
+ {"version":3,"file":"coreRowModelsFeature.js","names":[],"sources":["../../../src/core/row-models/coreRowModelsFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport {\n table_getCoreRowModel,\n table_getExpandedRowModel,\n table_getFilteredRowModel,\n table_getGroupedRowModel,\n table_getPaginatedRowModel,\n table_getPreExpandedRowModel,\n table_getPreFilteredRowModel,\n table_getPreGroupedRowModel,\n table_getPrePaginatedRowModel,\n table_getPreSortedRowModel,\n table_getRowModel,\n table_getSortedRowModel,\n} from './coreRowModelsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that wires table row-model accessors and row-model caches.\n */\nexport const coreRowModelsFeature: TableFeature = {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowModelsFeature', table, {\n table_getCoreRowModel: {\n fn: () => table_getCoreRowModel(table),\n },\n table_getPreFilteredRowModel: {\n fn: () => table_getPreFilteredRowModel(table),\n },\n table_getFilteredRowModel: {\n fn: () => table_getFilteredRowModel(table),\n },\n table_getPreGroupedRowModel: {\n fn: () => table_getPreGroupedRowModel(table),\n },\n table_getGroupedRowModel: {\n fn: () => table_getGroupedRowModel(table),\n },\n table_getPreSortedRowModel: {\n fn: () => table_getPreSortedRowModel(table),\n },\n table_getSortedRowModel: {\n fn: () => table_getSortedRowModel(table),\n },\n table_getPreExpandedRowModel: {\n fn: () => table_getPreExpandedRowModel(table),\n },\n table_getExpandedRowModel: {\n fn: () => table_getExpandedRowModel(table),\n },\n table_getPrePaginatedRowModel: {\n fn: () => table_getPrePaginatedRowModel(table),\n },\n table_getPaginatedRowModel: {\n fn: () => table_getPaginatedRowModel(table),\n },\n table_getRowModel: {\n fn: () => table_getRowModel(table),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAoBA,MAAa,uBAAqC,EAChD,qBAAqB,UAAU;CAC7B,gBAAgB,wBAAwB,OAAO;EAC7C,uBAAuB,EACrB,UAAU,sBAAsB,KAAK,EACvC;EACA,8BAA8B,EAC5B,UAAU,6BAA6B,KAAK,EAC9C;EACA,2BAA2B,EACzB,UAAU,0BAA0B,KAAK,EAC3C;EACA,6BAA6B,EAC3B,UAAU,4BAA4B,KAAK,EAC7C;EACA,0BAA0B,EACxB,UAAU,yBAAyB,KAAK,EAC1C;EACA,4BAA4B,EAC1B,UAAU,2BAA2B,KAAK,EAC5C;EACA,yBAAyB,EACvB,UAAU,wBAAwB,KAAK,EACzC;EACA,8BAA8B,EAC5B,UAAU,6BAA6B,KAAK,EAC9C;EACA,2BAA2B,EACzB,UAAU,0BAA0B,KAAK,EAC3C;EACA,+BAA+B,EAC7B,UAAU,8BAA8B,KAAK,EAC/C;EACA,4BAA4B,EAC1B,UAAU,2BAA2B,KAAK,EAC5C;EACA,mBAAmB,EACjB,UAAU,kBAAkB,KAAK,EACnC;CACF,CAAC;AACH,EACF"}
@@ -15,16 +15,14 @@ interface RowModel<TFeatures extends TableFeatures, TData extends RowData> {
15
15
  flatRows: Array<Row<TFeatures, TData>>;
16
16
  rowsById: Record<string, Row<TFeatures, TData>>;
17
17
  }
18
- interface CreateRowModel_Plugins {}
19
- interface CreateRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> extends CreateRowModel_Plugins {
18
+ interface CreateRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> {
20
19
  /**
21
20
  * Optional factory for the core row model. When omitted, the built-in
22
21
  * `createCoreRowModel()` factory is used.
23
22
  */
24
23
  coreRowModel?: (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
25
24
  }
26
- interface CachedRowModel_Plugins {}
27
- interface CachedRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> extends CachedRowModel_Plugins {
25
+ interface CachedRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> {
28
26
  coreRowModel: () => RowModel<TFeatures, TData>;
29
27
  }
30
28
  interface Table_RowModels_Core<TFeatures extends TableFeatures, TData extends RowData> {
@@ -39,5 +37,5 @@ interface Table_RowModels_Core<TFeatures extends TableFeatures, TData extends Ro
39
37
  }
40
38
  type Table_RowModels<TFeatures extends TableFeatures, TData extends RowData> = Table_RowModels_Core<TFeatures, TData> & Table_RowModels_Faceted<TFeatures, TData> & Table_RowModels_Filtered<TFeatures, TData> & Table_RowModels_Grouped<TFeatures, TData> & Table_RowModels_Expanded<TFeatures, TData> & Table_RowModels_Paginated<TFeatures, TData> & Table_RowModels_Sorted<TFeatures, TData>;
41
39
  //#endregion
42
- export { CachedRowModel_Core, CachedRowModel_Plugins, CreateRowModel_Core, CreateRowModel_Plugins, RowModel, Table_RowModels, Table_RowModels_Core };
40
+ export { CachedRowModel_Core, CreateRowModel_Core, RowModel, Table_RowModels, Table_RowModels_Core };
43
41
  //# sourceMappingURL=coreRowModelsFeature.types.d.cts.map
@@ -15,16 +15,14 @@ interface RowModel<TFeatures extends TableFeatures, TData extends RowData> {
15
15
  flatRows: Array<Row<TFeatures, TData>>;
16
16
  rowsById: Record<string, Row<TFeatures, TData>>;
17
17
  }
18
- interface CreateRowModel_Plugins {}
19
- interface CreateRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> extends CreateRowModel_Plugins {
18
+ interface CreateRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> {
20
19
  /**
21
20
  * Optional factory for the core row model. When omitted, the built-in
22
21
  * `createCoreRowModel()` factory is used.
23
22
  */
24
23
  coreRowModel?: (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
25
24
  }
26
- interface CachedRowModel_Plugins {}
27
- interface CachedRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> extends CachedRowModel_Plugins {
25
+ interface CachedRowModel_Core<TFeatures extends TableFeatures, TData extends RowData> {
28
26
  coreRowModel: () => RowModel<TFeatures, TData>;
29
27
  }
30
28
  interface Table_RowModels_Core<TFeatures extends TableFeatures, TData extends RowData> {
@@ -39,5 +37,5 @@ interface Table_RowModels_Core<TFeatures extends TableFeatures, TData extends Ro
39
37
  }
40
38
  type Table_RowModels<TFeatures extends TableFeatures, TData extends RowData> = Table_RowModels_Core<TFeatures, TData> & Table_RowModels_Faceted<TFeatures, TData> & Table_RowModels_Filtered<TFeatures, TData> & Table_RowModels_Grouped<TFeatures, TData> & Table_RowModels_Expanded<TFeatures, TData> & Table_RowModels_Paginated<TFeatures, TData> & Table_RowModels_Sorted<TFeatures, TData>;
41
39
  //#endregion
42
- export { CachedRowModel_Core, CachedRowModel_Plugins, CreateRowModel_Core, CreateRowModel_Plugins, RowModel, Table_RowModels, Table_RowModels_Core };
40
+ export { CachedRowModel_Core, CreateRowModel_Core, RowModel, Table_RowModels, Table_RowModels_Core };
43
41
  //# sourceMappingURL=coreRowModelsFeature.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createCoreRowModel.cjs","names":["tableMemo","table_autoResetPageIndex","constructRow"],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: ReadonlyArray<TData>,\n depth = 0,\n parentRow?: Row<TFeatures, TData>,\n ): Array<Row<TFeatures, TData>> => {\n const rows = [] as Array<Row<TFeatures, TData>>\n\n for (let i = 0; i < originalRows.length; i++) {\n const originalRow = originalRows[i]!\n // Make the row\n const row = constructRow(\n table,\n table.getRowId(originalRow, i, parentRow),\n originalRow,\n i,\n depth,\n undefined,\n parentRow?.id,\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(originalRow, i)\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,qBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB,CAAC,MAAM,QAAQ,IAAI;GACnC,UAAU,oBAAoB,OAAO,MAAM,QAAQ,IAAI;GACvD,qBAAqBC,4DAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;CACA,MAAM,WAAuC;EAC3C,MAAM,CAAC;EACP,UAAU,CAAC;EACX,UAAU,CAAC;CACb;CAEA,MAAM,cACJ,cACA,QAAQ,GACR,cACiC;EACjC,MAAM,OAAO,CAAC;EAEd,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;GAC5C,MAAM,cAAc,aAAa;GAEjC,MAAM,MAAMC,kCACV,OACA,MAAM,SAAS,aAAa,GAAG,SAAS,GACxC,aACA,GACA,OACA,8DACA,UAAW,EACb;GAGA,SAAS,SAAS,KAAK,GAAG;GAE1B,SAAS,SAAS,IAAI,MAAM;GAE5B,KAAK,KAAK,GAAG;GAGb,IAAI,MAAM,QAAQ,YAAY;;IAC5B,IAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;IAG7D,4BAAI,IAAI,6FAAiB,QACvB,IAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;GAEhE;EACF;EAEA,OAAO;CACT;CAEA,SAAS,OAAO,WAAW,IAAI;CAE/B,OAAO;AACT"}
1
+ {"version":3,"file":"createCoreRowModel.cjs","names":["tableMemo","table_autoResetPageIndex","constructRow"],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: ReadonlyArray<TData>,\n depth = 0,\n parentRow?: Row<TFeatures, TData>,\n ): Array<Row<TFeatures, TData>> => {\n const rows = [] as Array<Row<TFeatures, TData>>\n\n for (let i = 0; i < originalRows.length; i++) {\n const originalRow = originalRows[i]!\n // Make the row\n const row = constructRow(\n table,\n table.getRowId(originalRow, i, parentRow),\n originalRow,\n i,\n depth,\n undefined,\n parentRow?.id,\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(originalRow, i)\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,qBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAAQ;EACd,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB,CAAC,MAAM,QAAQ,IAAI;GACnC,UAAU,oBAAoB,OAAO,MAAM,QAAQ,IAAI;GACvD,qBAAqBC,4DAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;CACA,MAAM,WAAuC;EAC3C,MAAM,CAAC;EACP,UAAU,CAAC;EACX,UAAU,CAAC;CACb;CAEA,MAAM,cACJ,cACA,QAAQ,GACR,cACiC;EACjC,MAAM,OAAO,CAAC;EAEd,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;GAC5C,MAAM,cAAc,aAAa;GAEjC,MAAM,MAAMC,kCACV,OACA,MAAM,SAAS,aAAa,GAAG,SAAS,GACxC,aACA,GACA,OACA,8DACA,UAAW,EACb;GAGA,SAAS,SAAS,KAAK,GAAG;GAE1B,SAAS,SAAS,IAAI,MAAM;GAE5B,KAAK,KAAK,GAAG;GAGb,IAAI,MAAM,QAAQ,YAAY;;IAC5B,IAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;IAG7D,4BAAI,IAAI,6FAAiB,QACvB,IAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;GAEhE;EACF;EAEA,OAAO;CACT;CAEA,SAAS,OAAO,WAAW,IAAI;CAE/B,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"createCoreRowModel.js","names":[],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: ReadonlyArray<TData>,\n depth = 0,\n parentRow?: Row<TFeatures, TData>,\n ): Array<Row<TFeatures, TData>> => {\n const rows = [] as Array<Row<TFeatures, TData>>\n\n for (let i = 0; i < originalRows.length; i++) {\n const originalRow = originalRows[i]!\n // Make the row\n const row = constructRow(\n table,\n table.getRowId(originalRow, i, parentRow),\n originalRow,\n i,\n depth,\n undefined,\n parentRow?.id,\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(originalRow, i)\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,qBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB,CAAC,MAAM,QAAQ,IAAI;GACnC,UAAU,oBAAoB,OAAO,MAAM,QAAQ,IAAI;GACvD,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;CACA,MAAM,WAAuC;EAC3C,MAAM,CAAC;EACP,UAAU,CAAC;EACX,UAAU,CAAC;CACb;CAEA,MAAM,cACJ,cACA,QAAQ,GACR,cACiC;EACjC,MAAM,OAAO,CAAC;EAEd,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;GAC5C,MAAM,cAAc,aAAa;GAEjC,MAAM,MAAM,aACV,OACA,MAAM,SAAS,aAAa,GAAG,SAAS,GACxC,aACA,GACA,OACA,8DACA,UAAW,EACb;GAGA,SAAS,SAAS,KAAK,GAAG;GAE1B,SAAS,SAAS,IAAI,MAAM;GAE5B,KAAK,KAAK,GAAG;GAGb,IAAI,MAAM,QAAQ,YAAY;;IAC5B,IAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;IAG7D,4BAAI,IAAI,6FAAiB,QACvB,IAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;GAEhE;EACF;EAEA,OAAO;CACT;CAEA,SAAS,OAAO,WAAW,IAAI;CAE/B,OAAO;AACT"}
1
+ {"version":3,"file":"createCoreRowModel.js","names":[],"sources":["../../../src/core/row-models/createCoreRowModel.ts"],"sourcesContent":["import { constructRow } from '../rows/constructRow'\nimport { tableMemo } from '../../utils'\nimport { table_autoResetPageIndex } from '../../features/row-pagination/rowPaginationFeature.utils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { RowModel } from './coreRowModelsFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized core row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'coreRowModelsFeature',\n table,\n fnName: 'table.getCoreRowModel',\n memoDeps: () => [table.options.data],\n fn: () => _createCoreRowModel(table, table.options.data),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createCoreRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n data: ReadonlyArray<TData>,\n): {\n rows: Array<Row<TFeatures, TData>>\n flatRows: Array<Row<TFeatures, TData>>\n rowsById: Record<string, Row<TFeatures, TData>>\n} {\n const rowModel: RowModel<TFeatures, TData> = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: ReadonlyArray<TData>,\n depth = 0,\n parentRow?: Row<TFeatures, TData>,\n ): Array<Row<TFeatures, TData>> => {\n const rows = [] as Array<Row<TFeatures, TData>>\n\n for (let i = 0; i < originalRows.length; i++) {\n const originalRow = originalRows[i]!\n // Make the row\n const row = constructRow(\n table,\n table.getRowId(originalRow, i, parentRow),\n originalRow,\n i,\n depth,\n undefined,\n parentRow?.id,\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(originalRow, i)\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,qBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAAQ;EACd,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB,CAAC,MAAM,QAAQ,IAAI;GACnC,UAAU,oBAAoB,OAAO,MAAM,QAAQ,IAAI;GACvD,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,oBAIP,OACA,MAKA;CACA,MAAM,WAAuC;EAC3C,MAAM,CAAC;EACP,UAAU,CAAC;EACX,UAAU,CAAC;CACb;CAEA,MAAM,cACJ,cACA,QAAQ,GACR,cACiC;EACjC,MAAM,OAAO,CAAC;EAEd,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;GAC5C,MAAM,cAAc,aAAa;GAEjC,MAAM,MAAM,aACV,OACA,MAAM,SAAS,aAAa,GAAG,SAAS,GACxC,aACA,GACA,OACA,8DACA,UAAW,EACb;GAGA,SAAS,SAAS,KAAK,GAAG;GAE1B,SAAS,SAAS,IAAI,MAAM;GAE5B,KAAK,KAAK,GAAG;GAGb,IAAI,MAAM,QAAQ,YAAY;;IAC5B,IAAI,kBAAkB,MAAM,QAAQ,WAAW,aAAa,CAAC;IAG7D,4BAAI,IAAI,6FAAiB,QACvB,IAAI,UAAU,WAAW,IAAI,iBAAiB,QAAQ,GAAG,GAAG;GAEhE;EACF;EAEA,OAAO;CACT;CAEA,SAAS,OAAO,WAAW,IAAI;CAE/B,OAAO;AACT"}
@@ -3,44 +3,35 @@ const require_coreRowsFeature_utils = require('./coreRowsFeature.utils.cjs');
3
3
 
4
4
  //#region src/core/rows/coreRowsFeature.ts
5
5
  /**
6
- * Creates the stock core rows feature.
7
- *
8
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
6
+ * Core feature that creates row APIs for values, cells, and tree traversal.
9
7
  */
10
- function constructCoreRowsFeature() {
11
- return {
12
- assignRowPrototype: (prototype, table) => {
13
- require_utils.assignPrototypeAPIs("coreRowsFeature", prototype, table, {
14
- row_getAllCellsByColumnId: {
15
- fn: (row) => require_coreRowsFeature_utils.row_getAllCellsByColumnId(row),
16
- memoDeps: (row) => [row.getAllCells()]
17
- },
18
- row_getAllCells: {
19
- fn: (row) => require_coreRowsFeature_utils.row_getAllCells(row),
20
- memoDeps: (row) => [row.table.getAllLeafColumns()]
21
- },
22
- row_getLeafRows: { fn: (row) => require_coreRowsFeature_utils.row_getLeafRows(row) },
23
- row_getParentRow: { fn: (row) => require_coreRowsFeature_utils.row_getParentRow(row) },
24
- row_getParentRows: { fn: (row) => require_coreRowsFeature_utils.row_getParentRows(row) },
25
- row_getUniqueValues: { fn: (row, columnId) => require_coreRowsFeature_utils.row_getUniqueValues(row, columnId) },
26
- row_getValue: { fn: (row, columnId) => require_coreRowsFeature_utils.row_getValue(row, columnId) },
27
- row_renderValue: { fn: (row, columnId) => require_coreRowsFeature_utils.row_renderValue(row, columnId) }
28
- });
29
- },
30
- constructTableAPIs: (table) => {
31
- require_utils.assignTableAPIs("coreRowsFeature", table, {
32
- table_getRowId: { fn: (originalRow, index, parent) => require_coreRowsFeature_utils.table_getRowId(originalRow, table, index, parent) },
33
- table_getRow: { fn: (id, searchAll) => require_coreRowsFeature_utils.table_getRow(table, id, searchAll) }
34
- });
35
- }
36
- };
37
- }
38
- /**
39
- * The Core Rows feature provides the core row functionality.
40
- */
41
- const coreRowsFeature = constructCoreRowsFeature();
8
+ const coreRowsFeature = {
9
+ assignRowPrototype: (prototype, table) => {
10
+ require_utils.assignPrototypeAPIs("coreRowsFeature", prototype, table, {
11
+ row_getAllCellsByColumnId: {
12
+ fn: (row) => require_coreRowsFeature_utils.row_getAllCellsByColumnId(row),
13
+ memoDeps: (row) => [row.getAllCells()]
14
+ },
15
+ row_getAllCells: {
16
+ fn: (row) => require_coreRowsFeature_utils.row_getAllCells(row),
17
+ memoDeps: (row) => [row.table.getAllLeafColumns()]
18
+ },
19
+ row_getLeafRows: { fn: (row) => require_coreRowsFeature_utils.row_getLeafRows(row) },
20
+ row_getParentRow: { fn: (row) => require_coreRowsFeature_utils.row_getParentRow(row) },
21
+ row_getParentRows: { fn: (row) => require_coreRowsFeature_utils.row_getParentRows(row) },
22
+ row_getUniqueValues: { fn: (row, columnId) => require_coreRowsFeature_utils.row_getUniqueValues(row, columnId) },
23
+ row_getValue: { fn: (row, columnId) => require_coreRowsFeature_utils.row_getValue(row, columnId) },
24
+ row_renderValue: { fn: (row, columnId) => require_coreRowsFeature_utils.row_renderValue(row, columnId) }
25
+ });
26
+ },
27
+ constructTableAPIs: (table) => {
28
+ require_utils.assignTableAPIs("coreRowsFeature", table, {
29
+ table_getRowId: { fn: (originalRow, index, parent) => require_coreRowsFeature_utils.table_getRowId(originalRow, table, index, parent) },
30
+ table_getRow: { fn: (id, searchAll) => require_coreRowsFeature_utils.table_getRow(table, id, searchAll) }
31
+ });
32
+ }
33
+ };
42
34
 
43
35
  //#endregion
44
- exports.constructCoreRowsFeature = constructCoreRowsFeature;
45
36
  exports.coreRowsFeature = coreRowsFeature;
46
37
  //# sourceMappingURL=coreRowsFeature.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"coreRowsFeature.cjs","names":["row_getAllCellsByColumnId","row_getAllCells","row_getLeafRows","row_getParentRow","row_getParentRows","row_getUniqueValues","row_getValue","row_renderValue","table_getRowId","table_getRow"],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n} from './coreRowsFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type {\n// Row_Row,\n// TableOptions_Rows,\n// Table_Rows,\n// } from './coreRowsFeature.types'\n\nexport interface CoreRowsFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Row: Row_Row<TFeatures, TData>\n // TableOptions: TableOptions_Rows<TFeatures, TData>\n // Table: Table_Rows<TFeatures, TData>\n}\n\n/**\n * Creates the stock core rows feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructCoreRowsFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreRowsFeatureConstructors<TFeatures, TData>> {\n return {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n }\n}\n\n/**\n * The Core Rows feature provides the core row functionality.\n */\nexport const coreRowsFeature = constructCoreRowsFeature()\n"],"mappings":";;;;;;;;;AAmCA,SAAgB,2BAGiD;CAC/D,OAAO;EACL,qBAAqB,WAAW,UAAU;GACxC,kCAAoB,mBAAmB,WAAW,OAAO;IACvD,2BAA2B;KACzB,KAAK,QAAQA,wDAA0B,GAAG;KAC1C,WAAW,QAAQ,CAAC,IAAI,YAAY,CAAC;IACvC;IACA,iBAAiB;KACf,KAAK,QAAQC,8CAAgB,GAAG;KAChC,WAAW,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC;IACnD;IACA,iBAAiB,EACf,KAAK,QAAQC,8CAAgB,GAAG,EAClC;IACA,kBAAkB,EAChB,KAAK,QAAQC,+CAAiB,GAAG,EACnC;IACA,mBAAmB,EACjB,KAAK,QAAQC,gDAAkB,GAAG,EACpC;IACA,qBAAqB,EACnB,KAAK,KAAK,aAAaC,kDAAoB,KAAK,QAAQ,EAC1D;IACA,cAAc,EACZ,KAAK,KAAK,aAAaC,2CAAa,KAAK,QAAQ,EACnD;IACA,iBAAiB,EACf,KAAK,KAAK,aAAaC,8CAAgB,KAAK,QAAQ,EACtD;GACF,CAAC;EACH;EACA,qBAAqB,UAAU;GAC7B,8BAAgB,mBAAmB,OAAO;IACxC,gBAAgB,EACd,KAAK,aAAa,OAAO,WACvBC,6CAAe,aAAa,OAAO,OAAO,MAAM,EACpD;IACA,cAAc,EACZ,KAAK,IAAY,cACfC,2CAAa,OAAO,IAAI,SAAS,EACrC;GACF,CAAC;EACH;CACF;AACF;;;;AAKA,MAAa,kBAAkB,yBAAyB"}
1
+ {"version":3,"file":"coreRowsFeature.cjs","names":["row_getAllCellsByColumnId","row_getAllCells","row_getLeafRows","row_getParentRow","row_getParentRows","row_getUniqueValues","row_getValue","row_renderValue","table_getRowId","table_getRow"],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n} from './coreRowsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that creates row APIs for values, cells, and tree traversal.\n */\nexport const coreRowsFeature: TableFeature = {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,kBAAgC;CAC3C,qBAAqB,WAAW,UAAU;EACxC,kCAAoB,mBAAmB,WAAW,OAAO;GACvD,2BAA2B;IACzB,KAAK,QAAQA,wDAA0B,GAAG;IAC1C,WAAW,QAAQ,CAAC,IAAI,YAAY,CAAC;GACvC;GACA,iBAAiB;IACf,KAAK,QAAQC,8CAAgB,GAAG;IAChC,WAAW,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC;GACnD;GACA,iBAAiB,EACf,KAAK,QAAQC,8CAAgB,GAAG,EAClC;GACA,kBAAkB,EAChB,KAAK,QAAQC,+CAAiB,GAAG,EACnC;GACA,mBAAmB,EACjB,KAAK,QAAQC,gDAAkB,GAAG,EACpC;GACA,qBAAqB,EACnB,KAAK,KAAK,aAAaC,kDAAoB,KAAK,QAAQ,EAC1D;GACA,cAAc,EACZ,KAAK,KAAK,aAAaC,2CAAa,KAAK,QAAQ,EACnD;GACA,iBAAiB,EACf,KAAK,KAAK,aAAaC,8CAAgB,KAAK,QAAQ,EACtD;EACF,CAAC;CACH;CACA,qBAAqB,UAAU;EAC7B,8BAAgB,mBAAmB,OAAO;GACxC,gBAAgB,EACd,KAAK,aAAa,OAAO,WACvBC,6CAAe,aAAa,OAAO,OAAO,MAAM,EACpD;GACA,cAAc,EACZ,KAAK,IAAY,cACfC,2CAAa,OAAO,IAAI,SAAS,EACrC;EACF,CAAC;CACH;AACF"}
@@ -1,18 +1,10 @@
1
- import { RowData } from "../../types/type-utils.cjs";
2
- import { TableFeature, TableFeatures } from "../../types/TableFeatures.cjs";
1
+ import { TableFeature } from "../../types/TableFeatures.cjs";
3
2
 
4
3
  //#region src/core/rows/coreRowsFeature.d.ts
5
- interface CoreRowsFeatureConstructors<TFeatures extends TableFeatures, TData extends RowData> {}
6
4
  /**
7
- * Creates the stock core rows feature.
8
- *
9
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
5
+ * Core feature that creates row APIs for values, cells, and tree traversal.
10
6
  */
11
- declare function constructCoreRowsFeature<TFeatures extends TableFeatures, TData extends RowData>(): TableFeature<CoreRowsFeatureConstructors<TFeatures, TData>>;
12
- /**
13
- * The Core Rows feature provides the core row functionality.
14
- */
15
- declare const coreRowsFeature: TableFeature<CoreRowsFeatureConstructors<TableFeatures, RowData>>;
7
+ declare const coreRowsFeature: TableFeature;
16
8
  //#endregion
17
- export { CoreRowsFeatureConstructors, constructCoreRowsFeature, coreRowsFeature };
9
+ export { coreRowsFeature };
18
10
  //# sourceMappingURL=coreRowsFeature.d.cts.map
@@ -1,18 +1,10 @@
1
- import { RowData } from "../../types/type-utils.js";
2
- import { TableFeature, TableFeatures } from "../../types/TableFeatures.js";
1
+ import { TableFeature } from "../../types/TableFeatures.js";
3
2
 
4
3
  //#region src/core/rows/coreRowsFeature.d.ts
5
- interface CoreRowsFeatureConstructors<TFeatures extends TableFeatures, TData extends RowData> {}
6
4
  /**
7
- * Creates the stock core rows feature.
8
- *
9
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
5
+ * Core feature that creates row APIs for values, cells, and tree traversal.
10
6
  */
11
- declare function constructCoreRowsFeature<TFeatures extends TableFeatures, TData extends RowData>(): TableFeature<CoreRowsFeatureConstructors<TFeatures, TData>>;
12
- /**
13
- * The Core Rows feature provides the core row functionality.
14
- */
15
- declare const coreRowsFeature: TableFeature<CoreRowsFeatureConstructors<TableFeatures, RowData>>;
7
+ declare const coreRowsFeature: TableFeature;
16
8
  //#endregion
17
- export { CoreRowsFeatureConstructors, constructCoreRowsFeature, coreRowsFeature };
9
+ export { coreRowsFeature };
18
10
  //# sourceMappingURL=coreRowsFeature.d.ts.map
@@ -3,43 +3,35 @@ import { row_getAllCells, row_getAllCellsByColumnId, row_getLeafRows, row_getPar
3
3
 
4
4
  //#region src/core/rows/coreRowsFeature.ts
5
5
  /**
6
- * Creates the stock core rows feature.
7
- *
8
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
6
+ * Core feature that creates row APIs for values, cells, and tree traversal.
9
7
  */
10
- function constructCoreRowsFeature() {
11
- return {
12
- assignRowPrototype: (prototype, table) => {
13
- assignPrototypeAPIs("coreRowsFeature", prototype, table, {
14
- row_getAllCellsByColumnId: {
15
- fn: (row) => row_getAllCellsByColumnId(row),
16
- memoDeps: (row) => [row.getAllCells()]
17
- },
18
- row_getAllCells: {
19
- fn: (row) => row_getAllCells(row),
20
- memoDeps: (row) => [row.table.getAllLeafColumns()]
21
- },
22
- row_getLeafRows: { fn: (row) => row_getLeafRows(row) },
23
- row_getParentRow: { fn: (row) => row_getParentRow(row) },
24
- row_getParentRows: { fn: (row) => row_getParentRows(row) },
25
- row_getUniqueValues: { fn: (row, columnId) => row_getUniqueValues(row, columnId) },
26
- row_getValue: { fn: (row, columnId) => row_getValue(row, columnId) },
27
- row_renderValue: { fn: (row, columnId) => row_renderValue(row, columnId) }
28
- });
29
- },
30
- constructTableAPIs: (table) => {
31
- assignTableAPIs("coreRowsFeature", table, {
32
- table_getRowId: { fn: (originalRow, index, parent) => table_getRowId(originalRow, table, index, parent) },
33
- table_getRow: { fn: (id, searchAll) => table_getRow(table, id, searchAll) }
34
- });
35
- }
36
- };
37
- }
38
- /**
39
- * The Core Rows feature provides the core row functionality.
40
- */
41
- const coreRowsFeature = constructCoreRowsFeature();
8
+ const coreRowsFeature = {
9
+ assignRowPrototype: (prototype, table) => {
10
+ assignPrototypeAPIs("coreRowsFeature", prototype, table, {
11
+ row_getAllCellsByColumnId: {
12
+ fn: (row) => row_getAllCellsByColumnId(row),
13
+ memoDeps: (row) => [row.getAllCells()]
14
+ },
15
+ row_getAllCells: {
16
+ fn: (row) => row_getAllCells(row),
17
+ memoDeps: (row) => [row.table.getAllLeafColumns()]
18
+ },
19
+ row_getLeafRows: { fn: (row) => row_getLeafRows(row) },
20
+ row_getParentRow: { fn: (row) => row_getParentRow(row) },
21
+ row_getParentRows: { fn: (row) => row_getParentRows(row) },
22
+ row_getUniqueValues: { fn: (row, columnId) => row_getUniqueValues(row, columnId) },
23
+ row_getValue: { fn: (row, columnId) => row_getValue(row, columnId) },
24
+ row_renderValue: { fn: (row, columnId) => row_renderValue(row, columnId) }
25
+ });
26
+ },
27
+ constructTableAPIs: (table) => {
28
+ assignTableAPIs("coreRowsFeature", table, {
29
+ table_getRowId: { fn: (originalRow, index, parent) => table_getRowId(originalRow, table, index, parent) },
30
+ table_getRow: { fn: (id, searchAll) => table_getRow(table, id, searchAll) }
31
+ });
32
+ }
33
+ };
42
34
 
43
35
  //#endregion
44
- export { constructCoreRowsFeature, coreRowsFeature };
36
+ export { coreRowsFeature };
45
37
  //# sourceMappingURL=coreRowsFeature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coreRowsFeature.js","names":[],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n} from './coreRowsFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type {\n// Row_Row,\n// TableOptions_Rows,\n// Table_Rows,\n// } from './coreRowsFeature.types'\n\nexport interface CoreRowsFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Row: Row_Row<TFeatures, TData>\n // TableOptions: TableOptions_Rows<TFeatures, TData>\n // Table: Table_Rows<TFeatures, TData>\n}\n\n/**\n * Creates the stock core rows feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructCoreRowsFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreRowsFeatureConstructors<TFeatures, TData>> {\n return {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n }\n}\n\n/**\n * The Core Rows feature provides the core row functionality.\n */\nexport const coreRowsFeature = constructCoreRowsFeature()\n"],"mappings":";;;;;;;;;AAmCA,SAAgB,2BAGiD;CAC/D,OAAO;EACL,qBAAqB,WAAW,UAAU;GACxC,oBAAoB,mBAAmB,WAAW,OAAO;IACvD,2BAA2B;KACzB,KAAK,QAAQ,0BAA0B,GAAG;KAC1C,WAAW,QAAQ,CAAC,IAAI,YAAY,CAAC;IACvC;IACA,iBAAiB;KACf,KAAK,QAAQ,gBAAgB,GAAG;KAChC,WAAW,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC;IACnD;IACA,iBAAiB,EACf,KAAK,QAAQ,gBAAgB,GAAG,EAClC;IACA,kBAAkB,EAChB,KAAK,QAAQ,iBAAiB,GAAG,EACnC;IACA,mBAAmB,EACjB,KAAK,QAAQ,kBAAkB,GAAG,EACpC;IACA,qBAAqB,EACnB,KAAK,KAAK,aAAa,oBAAoB,KAAK,QAAQ,EAC1D;IACA,cAAc,EACZ,KAAK,KAAK,aAAa,aAAa,KAAK,QAAQ,EACnD;IACA,iBAAiB,EACf,KAAK,KAAK,aAAa,gBAAgB,KAAK,QAAQ,EACtD;GACF,CAAC;EACH;EACA,qBAAqB,UAAU;GAC7B,gBAAgB,mBAAmB,OAAO;IACxC,gBAAgB,EACd,KAAK,aAAa,OAAO,WACvB,eAAe,aAAa,OAAO,OAAO,MAAM,EACpD;IACA,cAAc,EACZ,KAAK,IAAY,cACf,aAAa,OAAO,IAAI,SAAS,EACrC;GACF,CAAC;EACH;CACF;AACF;;;;AAKA,MAAa,kBAAkB,yBAAyB"}
1
+ {"version":3,"file":"coreRowsFeature.js","names":[],"sources":["../../../src/core/rows/coreRowsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n row_getAllCells,\n row_getAllCellsByColumnId,\n row_getLeafRows,\n row_getParentRow,\n row_getParentRows,\n row_getUniqueValues,\n row_getValue,\n row_renderValue,\n table_getRow,\n table_getRowId,\n} from './coreRowsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that creates row APIs for values, cells, and tree traversal.\n */\nexport const coreRowsFeature: TableFeature = {\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreRowsFeature', prototype, table, {\n row_getAllCellsByColumnId: {\n fn: (row) => row_getAllCellsByColumnId(row),\n memoDeps: (row) => [row.getAllCells()],\n },\n row_getAllCells: {\n fn: (row) => row_getAllCells(row),\n memoDeps: (row) => [row.table.getAllLeafColumns()],\n },\n row_getLeafRows: {\n fn: (row) => row_getLeafRows(row),\n },\n row_getParentRow: {\n fn: (row) => row_getParentRow(row),\n },\n row_getParentRows: {\n fn: (row) => row_getParentRows(row),\n },\n row_getUniqueValues: {\n fn: (row, columnId) => row_getUniqueValues(row, columnId),\n },\n row_getValue: {\n fn: (row, columnId) => row_getValue(row, columnId),\n },\n row_renderValue: {\n fn: (row, columnId) => row_renderValue(row, columnId),\n },\n })\n },\n constructTableAPIs: (table) => {\n assignTableAPIs('coreRowsFeature', table, {\n table_getRowId: {\n fn: (originalRow, index, parent) =>\n table_getRowId(originalRow, table, index, parent),\n },\n table_getRow: {\n fn: (id: string, searchAll?: boolean) =>\n table_getRow(table, id, searchAll),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,kBAAgC;CAC3C,qBAAqB,WAAW,UAAU;EACxC,oBAAoB,mBAAmB,WAAW,OAAO;GACvD,2BAA2B;IACzB,KAAK,QAAQ,0BAA0B,GAAG;IAC1C,WAAW,QAAQ,CAAC,IAAI,YAAY,CAAC;GACvC;GACA,iBAAiB;IACf,KAAK,QAAQ,gBAAgB,GAAG;IAChC,WAAW,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC;GACnD;GACA,iBAAiB,EACf,KAAK,QAAQ,gBAAgB,GAAG,EAClC;GACA,kBAAkB,EAChB,KAAK,QAAQ,iBAAiB,GAAG,EACnC;GACA,mBAAmB,EACjB,KAAK,QAAQ,kBAAkB,GAAG,EACpC;GACA,qBAAqB,EACnB,KAAK,KAAK,aAAa,oBAAoB,KAAK,QAAQ,EAC1D;GACA,cAAc,EACZ,KAAK,KAAK,aAAa,aAAa,KAAK,QAAQ,EACnD;GACA,iBAAiB,EACf,KAAK,KAAK,aAAa,gBAAgB,KAAK,QAAQ,EACtD;EACF,CAAC;CACH;CACA,qBAAqB,UAAU;EAC7B,gBAAgB,mBAAmB,OAAO;GACxC,gBAAgB,EACd,KAAK,aAAa,OAAO,WACvB,eAAe,aAAa,OAAO,OAAO,MAAM,EACpD;GACA,cAAc,EACZ,KAAK,IAAY,cACf,aAAa,OAAO,IAAI,SAAS,EACrC;EACF,CAAC;CACH;AACF"}
@@ -78,8 +78,8 @@ function constructTable(tableOptions) {
78
78
  const key = stateKeys[i];
79
79
  table.baseAtoms[key] = _reactivity.createWritableAtom(table.initialState[key], { debugName: `table/baseAtoms/${key}` });
80
80
  table.atoms[key] = _reactivity.createReadonlyAtom(() => {
81
- var _table$options$atoms;
82
- const externalAtom = (_table$options$atoms = table.options.atoms) === null || _table$options$atoms === void 0 ? void 0 : _table$options$atoms[key];
81
+ const externalAtoms = table.options.atoms;
82
+ const externalAtom = externalAtoms === null || externalAtoms === void 0 ? void 0 : externalAtoms[key];
83
83
  if (externalAtom) return externalAtom.get();
84
84
  return table.baseAtoms[key].get();
85
85
  }, { debugName: `table/atoms/${key}` });
@@ -1 +1 @@
1
- {"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions.features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature<{}>> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtom = table.options.atoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key].get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key].get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options.rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions.features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState_All\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtoms = table.options.atoms as\n | Partial<Record<keyof TableState_All, Atom<unknown>>>\n | undefined\n const externalAtom = externalAtoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key]!.get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures> & TableState_All\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key]!.get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options.rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":"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"}
@@ -78,8 +78,8 @@ function constructTable(tableOptions) {
78
78
  const key = stateKeys[i];
79
79
  table.baseAtoms[key] = _reactivity.createWritableAtom(table.initialState[key], { debugName: `table/baseAtoms/${key}` });
80
80
  table.atoms[key] = _reactivity.createReadonlyAtom(() => {
81
- var _table$options$atoms;
82
- const externalAtom = (_table$options$atoms = table.options.atoms) === null || _table$options$atoms === void 0 ? void 0 : _table$options$atoms[key];
81
+ const externalAtoms = table.options.atoms;
82
+ const externalAtom = externalAtoms === null || externalAtoms === void 0 ? void 0 : externalAtoms[key];
83
83
  if (externalAtom) return externalAtom.get();
84
84
  return table.baseAtoms[key].get();
85
85
  }, { debugName: `table/atoms/${key}` });
@@ -1 +1 @@
1
- {"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions.features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature<{}>> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtom = table.options.atoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key].get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key].get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options.rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions.features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState_All\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtoms = table.options.atoms as\n | Partial<Record<keyof TableState_All, Atom<unknown>>>\n | undefined\n const externalAtom = externalAtoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key]!.get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures> & TableState_All\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key]!.get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options.rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,CAAC,CAAC,SAAS,YAAY;;EAC3C,yCAAe,QAAQ,6GAAkB,YAAY,MAAK;CAC5D,CAAC;CACD,OAAO,WAAW,YAAY;AAChC;;;;;;AAOA,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,SAAS;CAE1C,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAG;GAAc,GAAG,aAAa;EAAS;EACvD,YAAY,CAAC;EACb,cAAc,CAAC;EACf,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAEA,MAAM,eAAoC,OAAO,OAAO,MAAM,SAAS;CAMvE,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;;GAC3D,OAAO,OAAO,OAAO,8BAAK,QAAQ,oHAAyB,KAAK,CAAC;EACnE,GAAG,CAAC,CAEoC;EAAG,GAAG;CAAa;CAE3D,IAAI,YAAY,qBAAqB,cAAc,OACjD,KAAK,MAAM,CAAC,SAAS,UAAU,OAAO,QAAQ,cAAc,KAAK,GAAG;EAClE,MAAM,OAAO;EACb,MAAM,cAAc,YAAY,mBAAmB,KAAK,IAAI,GAAG,EAC7D,WAAW,gBAAgB,UAC7B,CAAC;EACA,AAAC,cAAc,MAAc,WAAW;EAEzC,IAAI,eAAe;EACnB,MAAM,uBAAuB,KAAK,WAAW,UAAU;GACrD,IAAI,cAAc;GAClB,YAAY,IAAI,KAAK;EACvB,CAAC;EACD,MAAM,uBAAuB,YAAY,WAAW,UAAU;GAC5D,eAAe;GACf,KAAK,IAAI,KAAK;GACd,eAAe;EACjB,CAAC;EACD,YAAY,gBAAgB,oBAAoB;EAChD,YAAY,gBAAgB,oBAAoB;CAClD;CAGF,IAAI,YAAY,oBAAoB;EAElC,MAAM,eAAe,YAAY,mBAE/B,eAAe,EAAE,WAAW,qBAAqB,CAAC;EACpD,OAAO,eAAe,OAAO,WAAW;GACtC,cAAc;GACd,YAAY;GACZ,MAAM;IACJ,OAAO,MAAM,aAAc,IAAI;GACjC;GACA,IAAI,OAAO;IACT,MAAM,aAAc,UAAU,KAAK;GACrC;EACF,CAAC;CACH,OACE,MAAM,UAAU;CAGlB,MAAM,eAAe,qBACnB,MAAM,WACN,MAAM,QAAQ,YAChB;CAEA,MAAM,YAAY,OAAO,KAAK,MAAM,YAAY;CAIhD,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;EACzC,MAAM,MAAM,UAAU;EACtB,MAAM,UAAU,OAAO,YAAY,mBACjC,MAAM,aAAa,MACnB,EACE,WAAW,mBAAmB,MAChC,CACF;EAGC,AAAC,MAAM,MAAc,OAAO,YAAY,yBACjC;GACJ,MAAM,gBAAgB,MAAM,QAAQ;GAGpC,MAAM,6EAAe,cAAgB;GACrC,IAAI,cACF,OAAO,aAAa,IAAI;GAE1B,OAAO,MAAM,UAAU,IAAI,CAAE,IAAI;EACnC,GACA,EAAE,WAAW,eAAe,MAAM,CACpC;CACF;CAEA,mCAAmC,KAAK;CAExC,MAAM,QAAQ,YACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,CAAC;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACrB,AAAC,SAAqC,OAAO,MAAM,MAAM,IAAI,CAAE,IAAI;EACtE;EACA,OAAO;CACT,GACA,EAAE,WAAW,cAAc,CAC7B,CACF;CAEA,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,SAAS;EAC5C,MAAM,YAAY,OAAO,KAAK,MAAM,QAAQ,aAAa,CAAC,CAAC;EAC3D,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY;EAE7C,QAAQ,IACN;;gBAEU,SAAS,KAAK,kBAAkB,EAAE;;gBAElC,UAAU,SAAS,UAAU,KAAK,kBAAkB,IAAI,SAAS;;gBAEjE,OAAO,KAAK,kBAAkB,EAAE,KAC1C,EAAE,MAAM,CACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,KAAK;CAC7C;CAEA,OAAO;AACT"}
@@ -3,24 +3,15 @@ const require_coreTablesFeature_utils = require('./coreTablesFeature.utils.cjs')
3
3
 
4
4
  //#region src/core/table/coreTablesFeature.ts
5
5
  /**
6
- * Creates the stock core tables feature.
7
- *
8
- * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
6
+ * Core feature that adds base table instance APIs such as reset and setOptions.
9
7
  */
10
- function constructCoreTablesFeature() {
11
- return { constructTableAPIs: (table) => {
12
- require_utils.assignTableAPIs("coreTablesFeature", table, {
13
- table_reset: { fn: () => require_coreTablesFeature_utils.table_reset(table) },
14
- table_setOptions: { fn: (updater) => require_coreTablesFeature_utils.table_setOptions(table, updater) }
15
- });
16
- } };
17
- }
18
- /**
19
- * The Core Tables feature provides the core table functionality for handling state and options.
20
- */
21
- const coreTablesFeature = constructCoreTablesFeature();
8
+ const coreTablesFeature = { constructTableAPIs: (table) => {
9
+ require_utils.assignTableAPIs("coreTablesFeature", table, {
10
+ table_reset: { fn: () => require_coreTablesFeature_utils.table_reset(table) },
11
+ table_setOptions: { fn: (updater) => require_coreTablesFeature_utils.table_setOptions(table, updater) }
12
+ });
13
+ } };
22
14
 
23
15
  //#endregion
24
- exports.constructCoreTablesFeature = constructCoreTablesFeature;
25
16
  exports.coreTablesFeature = coreTablesFeature;
26
17
  //# sourceMappingURL=coreTablesFeature.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"coreTablesFeature.cjs","names":["table_reset","table_setOptions"],"sources":["../../../src/core/table/coreTablesFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport { table_reset, table_setOptions } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type { TableOptions_Table, Table_Table } from './coreTablesFeature.types'\n\nexport interface CoreTablesFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Table: Table_Table<TFeatures, TData>\n // TableOptions: TableOptions_Table<TFeatures, TData>\n}\n\n/**\n * Creates the stock core tables feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructCoreTablesFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>> {\n return {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreTablesFeature', table, {\n table_reset: {\n fn: () => table_reset(table),\n },\n table_setOptions: {\n fn: (updater) => table_setOptions(table, updater),\n },\n })\n },\n }\n}\n\n/**\n * The Core Tables feature provides the core table functionality for handling state and options.\n */\nexport const coreTablesFeature = constructCoreTablesFeature()\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,6BAGmD;CACjE,OAAO,EACL,qBAAqB,UAAU;EAC7B,8BAAgB,qBAAqB,OAAO;GAC1C,aAAa,EACX,UAAUA,4CAAY,KAAK,EAC7B;GACA,kBAAkB,EAChB,KAAK,YAAYC,iDAAiB,OAAO,OAAO,EAClD;EACF,CAAC;CACH,EACF;AACF;;;;AAKA,MAAa,oBAAoB,2BAA2B"}
1
+ {"version":3,"file":"coreTablesFeature.cjs","names":["table_reset","table_setOptions"],"sources":["../../../src/core/table/coreTablesFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport { table_reset, table_setOptions } from './coreTablesFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that adds base table instance APIs such as reset and setOptions.\n */\nexport const coreTablesFeature: TableFeature = {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreTablesFeature', table, {\n table_reset: {\n fn: () => table_reset(table),\n },\n table_setOptions: {\n fn: (updater) => table_setOptions(table, updater),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAOA,MAAa,oBAAkC,EAC7C,qBAAqB,UAAU;CAC7B,8BAAgB,qBAAqB,OAAO;EAC1C,aAAa,EACX,UAAUA,4CAAY,KAAK,EAC7B;EACA,kBAAkB,EAChB,KAAK,YAAYC,iDAAiB,OAAO,OAAO,EAClD;CACF,CAAC;AACH,EACF"}