@tanstack/table-core 9.0.0-beta.46 → 9.0.0-beta.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/core/row-models/coreRowModelsFeature.types.d.cts +1 -1
  2. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +1 -1
  3. package/dist/core/row-models/coreRowModelsFeature.utils.cjs +1 -1
  4. package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
  5. package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +1 -1
  6. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
  7. package/dist/core/row-models/coreRowModelsFeature.utils.js +1 -1
  8. package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
  9. package/dist/features/aggregation/aggregationFeature.cjs +38 -0
  10. package/dist/features/aggregation/aggregationFeature.cjs.map +1 -0
  11. package/dist/features/aggregation/aggregationFeature.d.cts +10 -0
  12. package/dist/features/aggregation/aggregationFeature.d.ts +10 -0
  13. package/dist/features/aggregation/aggregationFeature.js +38 -0
  14. package/dist/features/aggregation/aggregationFeature.js.map +1 -0
  15. package/dist/features/aggregation/aggregationFeature.types.cjs +13 -0
  16. package/dist/features/aggregation/aggregationFeature.types.cjs.map +1 -0
  17. package/dist/features/aggregation/aggregationFeature.types.d.cts +172 -0
  18. package/dist/features/aggregation/aggregationFeature.types.d.ts +172 -0
  19. package/dist/features/aggregation/aggregationFeature.types.js +12 -0
  20. package/dist/features/aggregation/aggregationFeature.types.js.map +1 -0
  21. package/dist/features/aggregation/aggregationFeature.utils.cjs +198 -0
  22. package/dist/features/aggregation/aggregationFeature.utils.cjs.map +1 -0
  23. package/dist/features/aggregation/aggregationFeature.utils.d.cts +33 -0
  24. package/dist/features/aggregation/aggregationFeature.utils.d.ts +33 -0
  25. package/dist/features/aggregation/aggregationFeature.utils.js +192 -0
  26. package/dist/features/aggregation/aggregationFeature.utils.js.map +1 -0
  27. package/dist/features/aggregation/aggregationFns.cjs +240 -0
  28. package/dist/features/aggregation/aggregationFns.cjs.map +1 -0
  29. package/dist/features/aggregation/aggregationFns.d.cts +67 -0
  30. package/dist/features/aggregation/aggregationFns.d.ts +67 -0
  31. package/dist/features/aggregation/aggregationFns.js +229 -0
  32. package/dist/features/aggregation/aggregationFns.js.map +1 -0
  33. package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +43 -3
  34. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +43 -3
  35. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +18 -9
  36. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  37. package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +6 -2
  38. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +6 -2
  39. package/dist/features/column-filtering/columnFilteringFeature.utils.js +18 -9
  40. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  41. package/dist/features/column-filtering/createFilteredRowModel.cjs +7 -2
  42. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  43. package/dist/features/column-filtering/createFilteredRowModel.d.cts +6 -2
  44. package/dist/features/column-filtering/createFilteredRowModel.d.ts +6 -2
  45. package/dist/features/column-filtering/createFilteredRowModel.js +7 -2
  46. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  47. package/dist/features/column-filtering/filterFns.cjs +399 -0
  48. package/dist/features/column-filtering/filterFns.cjs.map +1 -0
  49. package/dist/features/column-filtering/filterFns.d.cts +210 -0
  50. package/dist/features/column-filtering/filterFns.d.ts +210 -0
  51. package/dist/features/column-filtering/filterFns.js +375 -0
  52. package/dist/features/column-filtering/filterFns.js.map +1 -0
  53. package/dist/features/column-grouping/columnGroupingFeature.cjs +3 -12
  54. package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
  55. package/dist/features/column-grouping/columnGroupingFeature.d.cts +1 -1
  56. package/dist/features/column-grouping/columnGroupingFeature.d.ts +1 -1
  57. package/dist/features/column-grouping/columnGroupingFeature.js +4 -13
  58. package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
  59. package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -49
  60. package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -49
  61. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +0 -50
  62. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
  63. package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +2 -39
  64. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +2 -39
  65. package/dist/features/column-grouping/columnGroupingFeature.utils.js +2 -49
  66. package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
  67. package/dist/features/column-grouping/createGroupedRowModel.cjs +23 -13
  68. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  69. package/dist/features/column-grouping/createGroupedRowModel.d.cts +2 -3
  70. package/dist/features/column-grouping/createGroupedRowModel.d.ts +2 -3
  71. package/dist/features/column-grouping/createGroupedRowModel.js +25 -15
  72. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  73. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +4 -2
  74. package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
  75. package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +2 -6
  76. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +2 -6
  77. package/dist/features/global-filtering/globalFilteringFeature.utils.js +4 -2
  78. package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
  79. package/dist/features/row-sorting/createSortedRowModel.cjs +6 -2
  80. package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
  81. package/dist/features/row-sorting/createSortedRowModel.d.cts +6 -2
  82. package/dist/features/row-sorting/createSortedRowModel.d.ts +6 -2
  83. package/dist/features/row-sorting/createSortedRowModel.js +6 -2
  84. package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
  85. package/dist/features/row-sorting/rowSortingFeature.types.d.cts +32 -3
  86. package/dist/features/row-sorting/rowSortingFeature.types.d.ts +32 -3
  87. package/dist/features/row-sorting/rowSortingFeature.utils.cjs +20 -5
  88. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  89. package/dist/features/row-sorting/rowSortingFeature.utils.js +20 -5
  90. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  91. package/dist/{fns → features/row-sorting}/sortFns.cjs +69 -22
  92. package/dist/features/row-sorting/sortFns.cjs.map +1 -0
  93. package/dist/features/row-sorting/sortFns.d.cts +98 -0
  94. package/dist/features/row-sorting/sortFns.d.ts +98 -0
  95. package/dist/{fns → features/row-sorting}/sortFns.js +69 -23
  96. package/dist/features/row-sorting/sortFns.js.map +1 -0
  97. package/dist/features/stockFeatures.cjs +2 -0
  98. package/dist/features/stockFeatures.cjs.map +1 -1
  99. package/dist/features/stockFeatures.d.cts +2 -0
  100. package/dist/features/stockFeatures.d.ts +2 -0
  101. package/dist/features/stockFeatures.js +2 -0
  102. package/dist/features/stockFeatures.js.map +1 -1
  103. package/dist/helpers/tableFeatures.cjs +5 -4
  104. package/dist/helpers/tableFeatures.cjs.map +1 -1
  105. package/dist/helpers/tableFeatures.d.cts +5 -4
  106. package/dist/helpers/tableFeatures.d.ts +5 -4
  107. package/dist/helpers/tableFeatures.js +5 -4
  108. package/dist/helpers/tableFeatures.js.map +1 -1
  109. package/dist/index.cjs +18 -3
  110. package/dist/index.d.cts +10 -8
  111. package/dist/index.d.ts +10 -8
  112. package/dist/index.js +6 -4
  113. package/dist/static-functions.cjs +8 -3
  114. package/dist/static-functions.d.cts +3 -2
  115. package/dist/static-functions.d.ts +3 -2
  116. package/dist/static-functions.js +3 -2
  117. package/dist/types/Cell.d.cts +3 -1
  118. package/dist/types/Cell.d.ts +3 -1
  119. package/dist/types/Column.d.cts +4 -2
  120. package/dist/types/Column.d.ts +4 -2
  121. package/dist/types/ColumnDef.d.cts +5 -3
  122. package/dist/types/ColumnDef.d.ts +5 -3
  123. package/dist/types/Row.d.cts +3 -1
  124. package/dist/types/Row.d.ts +3 -1
  125. package/dist/types/RowModel.d.cts +1 -1
  126. package/dist/types/RowModel.d.ts +1 -1
  127. package/dist/types/RowModelFns.d.cts +3 -3
  128. package/dist/types/RowModelFns.d.ts +3 -3
  129. package/dist/types/Table.d.cts +1 -1
  130. package/dist/types/Table.d.ts +1 -1
  131. package/dist/types/TableFeatures.d.cts +19 -11
  132. package/dist/types/TableFeatures.d.ts +19 -11
  133. package/dist/types/TableOptions.d.cts +5 -3
  134. package/dist/types/TableOptions.d.ts +5 -3
  135. package/dist/types/TableState.d.cts +1 -1
  136. package/dist/types/TableState.d.ts +1 -1
  137. package/dist/types/type-utils.d.cts +8 -1
  138. package/dist/types/type-utils.d.ts +8 -1
  139. package/dist/worker/initTableWorker.cjs.map +1 -1
  140. package/dist/worker/initTableWorker.js.map +1 -1
  141. package/package.json +1 -1
  142. package/skills/aggregation/SKILL.md +131 -0
  143. package/skills/api-not-found/SKILL.md +1 -1
  144. package/skills/client-vs-server/SKILL.md +1 -1
  145. package/skills/column-faceting/SKILL.md +11 -5
  146. package/skills/column-filtering/SKILL.md +8 -3
  147. package/skills/column-ordering/SKILL.md +1 -1
  148. package/skills/column-pinning/SKILL.md +1 -1
  149. package/skills/column-resizing/SKILL.md +1 -1
  150. package/skills/column-sizing/SKILL.md +1 -1
  151. package/skills/column-visibility/SKILL.md +1 -1
  152. package/skills/core/SKILL.md +1 -1
  153. package/skills/custom-features/SKILL.md +1 -1
  154. package/skills/expanding/SKILL.md +1 -1
  155. package/skills/global-filtering/SKILL.md +3 -3
  156. package/skills/grouping/SKILL.md +12 -13
  157. package/skills/migrate-v8-to-v9/SKILL.md +21 -8
  158. package/skills/pagination/SKILL.md +1 -1
  159. package/skills/row-pinning/SKILL.md +1 -1
  160. package/skills/row-selection/SKILL.md +1 -1
  161. package/skills/sorting/SKILL.md +9 -3
  162. package/skills/table-features/SKILL.md +19 -13
  163. package/skills/typescript/SKILL.md +1 -1
  164. package/src/core/row-models/coreRowModelsFeature.utils.ts +1 -1
  165. package/src/features/aggregation/aggregationFeature.ts +59 -0
  166. package/src/features/aggregation/aggregationFeature.types.ts +312 -0
  167. package/src/features/aggregation/aggregationFeature.utils.ts +401 -0
  168. package/src/features/aggregation/aggregationFns.ts +336 -0
  169. package/src/features/column-filtering/columnFilteringFeature.types.ts +61 -1
  170. package/src/features/column-filtering/columnFilteringFeature.utils.ts +33 -19
  171. package/src/features/column-filtering/createFilteredRowModel.ts +13 -3
  172. package/src/features/column-filtering/filterFns.ts +533 -0
  173. package/src/features/column-grouping/columnGroupingFeature.ts +1 -20
  174. package/src/features/column-grouping/columnGroupingFeature.types.ts +4 -86
  175. package/src/features/column-grouping/columnGroupingFeature.utils.ts +1 -88
  176. package/src/features/column-grouping/createGroupedRowModel.ts +32 -38
  177. package/src/features/global-filtering/globalFilteringFeature.utils.ts +9 -1
  178. package/src/features/row-sorting/createSortedRowModel.ts +6 -2
  179. package/src/features/row-sorting/rowSortingFeature.types.ts +54 -2
  180. package/src/features/row-sorting/rowSortingFeature.utils.ts +46 -14
  181. package/src/{fns → features/row-sorting}/sortFns.ts +95 -81
  182. package/src/features/stockFeatures.ts +3 -0
  183. package/src/helpers/tableFeatures.ts +5 -4
  184. package/src/index.ts +7 -8
  185. package/src/static-functions.ts +1 -0
  186. package/src/types/Cell.ts +2 -0
  187. package/src/types/Column.ts +3 -1
  188. package/src/types/ColumnDef.ts +6 -3
  189. package/src/types/Row.ts +2 -0
  190. package/src/types/RowModelFns.ts +3 -3
  191. package/src/types/TableFeatures.ts +19 -11
  192. package/src/types/TableOptions.ts +5 -1
  193. package/src/types/type-utils.ts +8 -0
  194. package/src/worker/initTableWorker.ts +1 -1
  195. package/dist/fns/aggregationFns.cjs +0 -163
  196. package/dist/fns/aggregationFns.cjs.map +0 -1
  197. package/dist/fns/aggregationFns.d.cts +0 -85
  198. package/dist/fns/aggregationFns.d.ts +0 -85
  199. package/dist/fns/aggregationFns.js +0 -153
  200. package/dist/fns/aggregationFns.js.map +0 -1
  201. package/dist/fns/filterFns.cjs +0 -242
  202. package/dist/fns/filterFns.cjs.map +0 -1
  203. package/dist/fns/filterFns.d.cts +0 -178
  204. package/dist/fns/filterFns.d.ts +0 -178
  205. package/dist/fns/filterFns.js +0 -226
  206. package/dist/fns/filterFns.js.map +0 -1
  207. package/dist/fns/sortFns.cjs.map +0 -1
  208. package/dist/fns/sortFns.d.cts +0 -65
  209. package/dist/fns/sortFns.d.ts +0 -65
  210. package/dist/fns/sortFns.js.map +0 -1
  211. package/src/fns/aggregationFns.ts +0 -245
  212. package/src/fns/filterFns.ts +0 -455
@@ -1,4 +1,5 @@
1
1
  import { CellData, RowData, UnionToIntersection } from "./type-utils.js";
2
+ import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
2
3
  import { CellContext } from "../core/cells/coreCellsFeature.types.js";
3
4
  import { ColumnDef_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
4
5
  import { ColumnDef_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
@@ -6,7 +7,7 @@ import { ColumnDef_ColumnResizing } from "../features/column-resizing/columnResi
6
7
  import { HeaderContext } from "../core/headers/coreHeadersFeature.types.js";
7
8
  import { ColumnDef_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
8
9
  import { ColumnDef_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
9
- import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
10
+ import { ColumnDef_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
10
11
  import { ColumnDef_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
11
12
  import { ColumnDef_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.js";
12
13
  import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.js";
@@ -84,17 +85,18 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
84
85
  meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
85
86
  }
86
87
  interface ColumnDef_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData> {
88
+ aggregationFeature: ColumnDef_Aggregation<TFeatures, TData, TValue>;
87
89
  columnVisibilityFeature: ColumnDef_ColumnVisibility;
88
90
  columnPinningFeature: ColumnDef_ColumnPinning;
89
91
  columnFilteringFeature: ColumnDef_ColumnFiltering<TFeatures, TData>;
90
92
  globalFilteringFeature: ColumnDef_GlobalFiltering;
91
93
  rowSortingFeature: ColumnDef_RowSorting<TFeatures, TData>;
92
- columnGroupingFeature: ColumnDef_ColumnGrouping<TFeatures, TData, TValue>;
94
+ columnGroupingFeature: ColumnDef_ColumnGrouping<TFeatures, TData>;
93
95
  columnSizingFeature: ColumnDef_ColumnSizing;
94
96
  columnResizingFeature: ColumnDef_ColumnResizing;
95
97
  }
96
98
  type ColumnDefBase<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & ExtractFeatureMapTypes<TFeatures, ColumnDef_FeatureMap<TFeatures, TData, TValue>>;
97
- type ColumnDefBase_All<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & Partial<ColumnDef_ColumnVisibility & ColumnDef_ColumnPinning & ColumnDef_ColumnFiltering<TFeatures, TData> & ColumnDef_GlobalFiltering & ColumnDef_RowSorting<TFeatures, TData> & ColumnDef_ColumnGrouping<TFeatures, TData, TValue> & ColumnDef_ColumnSizing & ColumnDef_ColumnResizing>;
99
+ type ColumnDefBase_All<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & Partial<ColumnDef_Aggregation<TFeatures, TData, TValue> & ColumnDef_ColumnVisibility & ColumnDef_ColumnPinning & ColumnDef_ColumnFiltering<TFeatures, TData> & ColumnDef_GlobalFiltering & ColumnDef_RowSorting<TFeatures, TData> & ColumnDef_ColumnGrouping<TFeatures, TData> & ColumnDef_ColumnSizing & ColumnDef_ColumnResizing>;
98
100
  type IdentifiedColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase<TFeatures, TData, TValue> & {
99
101
  id?: string;
100
102
  header?: StringOrTemplateHeader<TFeatures, TData, TValue>;
@@ -1,6 +1,7 @@
1
1
  import { RowData } from "./type-utils.cjs";
2
- import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
3
2
  import { Row_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
3
+ import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
4
+ import { Row_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
4
5
  import { Row_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
5
6
  import { Row_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
6
7
  import { Row_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
@@ -12,6 +13,7 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
12
13
  //#region src/types/Row.d.ts
13
14
  interface Row_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_Row<TFeatures, TData> {}
14
15
  interface Row_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
16
+ aggregationFeature: Row_Aggregation;
15
17
  columnFilteringFeature: Row_ColumnFiltering<TFeatures, TData>;
16
18
  columnGroupingFeature: Row_ColumnGrouping;
17
19
  columnPinningFeature: Row_ColumnPinning<TFeatures, TData>;
@@ -1,6 +1,7 @@
1
1
  import { RowData } from "./type-utils.js";
2
- import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
3
2
  import { Row_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
3
+ import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
4
+ import { Row_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
4
5
  import { Row_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
5
6
  import { Row_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
6
7
  import { Row_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
@@ -12,6 +13,7 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
12
13
  //#region src/types/Row.d.ts
13
14
  interface Row_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_Row<TFeatures, TData> {}
14
15
  interface Row_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
16
+ aggregationFeature: Row_Aggregation;
15
17
  columnFilteringFeature: Row_ColumnFiltering<TFeatures, TData>;
16
18
  columnGroupingFeature: Row_ColumnGrouping;
17
19
  columnPinningFeature: Row_ColumnPinning<TFeatures, TData>;
@@ -1,6 +1,6 @@
1
1
  import { RowData } from "./type-utils.cjs";
2
- import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.cjs";
3
2
  import { CachedRowModel_Grouped } from "../features/column-grouping/columnGroupingFeature.types.cjs";
3
+ import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.cjs";
4
4
  import { CachedRowModel_Expanded } from "../features/row-expanding/rowExpandingFeature.types.cjs";
5
5
  import { CachedRowModel_Filtered } from "../features/column-filtering/columnFilteringFeature.types.cjs";
6
6
  import { CachedRowModel_Paginated } from "../features/row-pagination/rowPaginationFeature.types.cjs";
@@ -1,6 +1,6 @@
1
1
  import { RowData } from "./type-utils.js";
2
- import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.js";
3
2
  import { CachedRowModel_Grouped } from "../features/column-grouping/columnGroupingFeature.types.js";
3
+ import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.js";
4
4
  import { CachedRowModel_Expanded } from "../features/row-expanding/rowExpandingFeature.types.js";
5
5
  import { CachedRowModel_Filtered } from "../features/column-filtering/columnFilteringFeature.types.js";
6
6
  import { CachedRowModel_Paginated } from "../features/row-pagination/rowPaginationFeature.types.js";
@@ -1,18 +1,18 @@
1
1
  import { RowData } from "./type-utils.cjs";
2
2
  import { RowModelFns_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
3
- import { RowModelFns_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
3
+ import { RowModelFns_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
4
4
  import { RowModelFns_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.cjs";
5
5
  import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
6
6
 
7
7
  //#region src/types/RowModelFns.d.ts
8
8
  interface RowModelFns_Core {}
9
9
  interface RowModelFns_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
10
+ aggregationFeature: RowModelFns_Aggregation<TFeatures, TData>;
10
11
  columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>;
11
- columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>;
12
12
  rowSortingFeature: RowModelFns_RowSorting<TFeatures, TData>;
13
13
  }
14
14
  type RowModelFns<TFeatures extends TableFeatures, TData extends RowData> = Partial<ExtractFeatureMapTypes<TFeatures, RowModelFns_FeatureMap<TFeatures, TData>>>;
15
- interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_ColumnGrouping<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
15
+ interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_Aggregation<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
16
16
  //#endregion
17
17
  export { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap };
18
18
  //# sourceMappingURL=RowModelFns.d.cts.map
@@ -1,18 +1,18 @@
1
1
  import { RowData } from "./type-utils.js";
2
2
  import { RowModelFns_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
3
- import { RowModelFns_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
3
+ import { RowModelFns_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
4
4
  import { RowModelFns_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.js";
5
5
  import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
6
6
 
7
7
  //#region src/types/RowModelFns.d.ts
8
8
  interface RowModelFns_Core {}
9
9
  interface RowModelFns_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
10
+ aggregationFeature: RowModelFns_Aggregation<TFeatures, TData>;
10
11
  columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>;
11
- columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>;
12
12
  rowSortingFeature: RowModelFns_RowSorting<TFeatures, TData>;
13
13
  }
14
14
  type RowModelFns<TFeatures extends TableFeatures, TData extends RowData> = Partial<ExtractFeatureMapTypes<TFeatures, RowModelFns_FeatureMap<TFeatures, TData>>>;
15
- interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_ColumnGrouping<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
15
+ interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_Aggregation<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
16
16
  //#endregion
17
17
  export { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap };
18
18
  //# sourceMappingURL=RowModelFns.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import { RowData } from "./type-utils.cjs";
2
+ import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
2
3
  import { Table_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
3
4
  import { Table_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
4
5
  import { Table_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
5
6
  import { Table_Headers } from "../core/headers/coreHeadersFeature.types.cjs";
6
7
  import { Table_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
7
8
  import { Table_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
8
- import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
9
9
  import { Table_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
10
10
  import { Table_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
11
11
  import { Table_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
@@ -1,11 +1,11 @@
1
1
  import { RowData } from "./type-utils.js";
2
+ import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
2
3
  import { Table_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
3
4
  import { Table_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
4
5
  import { Table_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
5
6
  import { Table_Headers } from "../core/headers/coreHeadersFeature.types.js";
6
7
  import { Table_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
7
8
  import { Table_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
8
- import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
9
9
  import { Table_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
10
10
  import { Table_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
11
11
  import { Table_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
@@ -2,7 +2,7 @@ import { CellData, RowData, UnionToIntersection } from "./type-utils.cjs";
2
2
  import { CoreFeatures } from "../core/coreFeatures.cjs";
3
3
  import { SortFn } from "../features/row-sorting/rowSortingFeature.types.cjs";
4
4
  import { ColumnDefBase_All } from "./ColumnDef.cjs";
5
- import { AggregationFn } from "../features/column-grouping/columnGroupingFeature.types.cjs";
5
+ import { AggregationFnDef } from "../features/aggregation/aggregationFeature.types.cjs";
6
6
  import { Row } from "./Row.cjs";
7
7
  import { FilterFn } from "../features/column-filtering/columnFilteringFeature.types.cjs";
8
8
  import { RowModel } from "../core/row-models/coreRowModelsFeature.types.cjs";
@@ -61,9 +61,9 @@ type NonFeatureKeys = 'aggregationFns' | 'columnMeta' | 'coreRowModel' | 'expand
61
61
  */
62
62
  interface FeatureSlotPrereqs {
63
63
  /**
64
- * Named aggregation functions are only meaningful when grouping is enabled.
64
+ * Named aggregation functions require the independent aggregation feature.
65
65
  */
66
- aggregationFns: 'columnGroupingFeature';
66
+ aggregationFns: 'aggregationFeature';
67
67
  /**
68
68
  * Column resizing builds on the column sizing state and APIs.
69
69
  */
@@ -140,11 +140,13 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
140
140
  * Registry of aggregation functions available to this table by name.
141
141
  *
142
142
  * Keys registered here become the valid string values for `aggregationFn` on
143
- * column definitions, with full inference. Spread the exported
144
- * `aggregationFns` to register the built-in aggregation functions:
145
- * `aggregationFns: { ...aggregationFns, myCustomAggregationFn }`.
143
+ * column definitions, with full inference. Import the built-in aggregation
144
+ * functions you use individually and register them by their conventional
145
+ * names: `aggregationFns: { sum: aggregationFn_sum, myCustomAggregationFn }`.
146
+ * Spreading the exported `aggregationFns` registry also works, but puts
147
+ * every built-in aggregation function in your bundle.
146
148
  */
147
- aggregationFns?: Record<string, AggregationFn<any, any>>;
149
+ aggregationFns?: Record<string, AggregationFnDef<any, any, any, any>>;
148
150
  /**
149
151
  * Type-only slot for declaring the type of `columnDef.meta` for all columns
150
152
  * of this table.
@@ -196,8 +198,11 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
196
198
  *
197
199
  * Keys registered here become the valid string values for `filterFn` on
198
200
  * column definitions and the `globalFilterFn` option, with full inference.
199
- * Spread the exported `filterFns` to register the built-in filter functions:
200
- * `filterFns: { ...filterFns, myCustomFilterFn }`.
201
+ * Import the built-in filter functions you use individually and register
202
+ * them by their conventional names:
203
+ * `filterFns: { includesString: filterFn_includesString, myCustomFilterFn }`.
204
+ * Spreading the exported `filterFns` registry also works, but puts every
205
+ * built-in filter function in your bundle.
201
206
  */
202
207
  filterFns?: Record<string, FilterFn<any, any>>;
203
208
  /**
@@ -234,8 +239,11 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
234
239
  * Registry of sorting functions available to this table by name.
235
240
  *
236
241
  * Keys registered here become the valid string values for `sortFn` on column
237
- * definitions, with full inference. Spread the exported `sortFns` to register
238
- * the built-in sorting functions: `sortFns: { ...sortFns, myCustomSortFn }`.
242
+ * definitions, with full inference. Import the built-in sorting functions
243
+ * you use individually and register them by their conventional names:
244
+ * `sortFns: { alphanumeric: sortFn_alphanumeric, myCustomSortFn }`. Spreading
245
+ * the exported `sortFns` registry also works, but puts every built-in
246
+ * sorting function in your bundle.
239
247
  */
240
248
  sortFns?: Record<string, SortFn<any, any>>;
241
249
  /**
@@ -2,7 +2,7 @@ import { CellData, RowData, UnionToIntersection } from "./type-utils.js";
2
2
  import { CoreFeatures } from "../core/coreFeatures.js";
3
3
  import { SortFn } from "../features/row-sorting/rowSortingFeature.types.js";
4
4
  import { ColumnDefBase_All } from "./ColumnDef.js";
5
- import { AggregationFn } from "../features/column-grouping/columnGroupingFeature.types.js";
5
+ import { AggregationFnDef } from "../features/aggregation/aggregationFeature.types.js";
6
6
  import { Row } from "./Row.js";
7
7
  import { FilterFn } from "../features/column-filtering/columnFilteringFeature.types.js";
8
8
  import { RowModel } from "../core/row-models/coreRowModelsFeature.types.js";
@@ -61,9 +61,9 @@ type NonFeatureKeys = 'aggregationFns' | 'columnMeta' | 'coreRowModel' | 'expand
61
61
  */
62
62
  interface FeatureSlotPrereqs {
63
63
  /**
64
- * Named aggregation functions are only meaningful when grouping is enabled.
64
+ * Named aggregation functions require the independent aggregation feature.
65
65
  */
66
- aggregationFns: 'columnGroupingFeature';
66
+ aggregationFns: 'aggregationFeature';
67
67
  /**
68
68
  * Column resizing builds on the column sizing state and APIs.
69
69
  */
@@ -140,11 +140,13 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
140
140
  * Registry of aggregation functions available to this table by name.
141
141
  *
142
142
  * Keys registered here become the valid string values for `aggregationFn` on
143
- * column definitions, with full inference. Spread the exported
144
- * `aggregationFns` to register the built-in aggregation functions:
145
- * `aggregationFns: { ...aggregationFns, myCustomAggregationFn }`.
143
+ * column definitions, with full inference. Import the built-in aggregation
144
+ * functions you use individually and register them by their conventional
145
+ * names: `aggregationFns: { sum: aggregationFn_sum, myCustomAggregationFn }`.
146
+ * Spreading the exported `aggregationFns` registry also works, but puts
147
+ * every built-in aggregation function in your bundle.
146
148
  */
147
- aggregationFns?: Record<string, AggregationFn<any, any>>;
149
+ aggregationFns?: Record<string, AggregationFnDef<any, any, any, any>>;
148
150
  /**
149
151
  * Type-only slot for declaring the type of `columnDef.meta` for all columns
150
152
  * of this table.
@@ -196,8 +198,11 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
196
198
  *
197
199
  * Keys registered here become the valid string values for `filterFn` on
198
200
  * column definitions and the `globalFilterFn` option, with full inference.
199
- * Spread the exported `filterFns` to register the built-in filter functions:
200
- * `filterFns: { ...filterFns, myCustomFilterFn }`.
201
+ * Import the built-in filter functions you use individually and register
202
+ * them by their conventional names:
203
+ * `filterFns: { includesString: filterFn_includesString, myCustomFilterFn }`.
204
+ * Spreading the exported `filterFns` registry also works, but puts every
205
+ * built-in filter function in your bundle.
201
206
  */
202
207
  filterFns?: Record<string, FilterFn<any, any>>;
203
208
  /**
@@ -234,8 +239,11 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
234
239
  * Registry of sorting functions available to this table by name.
235
240
  *
236
241
  * Keys registered here become the valid string values for `sortFn` on column
237
- * definitions, with full inference. Spread the exported `sortFns` to register
238
- * the built-in sorting functions: `sortFns: { ...sortFns, myCustomSortFn }`.
242
+ * definitions, with full inference. Import the built-in sorting functions
243
+ * you use individually and register them by their conventional names:
244
+ * `sortFns: { alphanumeric: sortFn_alphanumeric, myCustomSortFn }`. Spreading
245
+ * the exported `sortFns` registry also works, but puts every built-in
246
+ * sorting function in your bundle.
239
247
  */
240
248
  sortFns?: Record<string, SortFn<any, any>>;
241
249
  /**
@@ -1,12 +1,13 @@
1
1
  import { RowData, UnionToIntersection } from "./type-utils.cjs";
2
2
  import { CoreFeatures } from "../core/coreFeatures.cjs";
3
+ import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
3
4
  import { TableOptions_Cell } from "../core/cells/coreCellsFeature.types.cjs";
4
5
  import { TableOptions_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
5
6
  import { TableOptions_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
6
7
  import { TableOptions_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
7
8
  import { TableOptions_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
8
9
  import { TableOptions_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
9
- import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
10
+ import { TableOptions_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
10
11
  import { TableOptions_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
11
12
  import { TableOptions_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
12
13
  import { TableOptions_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
@@ -36,6 +37,7 @@ type DebugOptions<TFeatures extends TableFeatures> = {
36
37
  debugTable?: boolean;
37
38
  } & DebugKeysFor<CoreFeatures & TFeatures>;
38
39
  interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
40
+ aggregationFeature: TableOptions_Aggregation;
39
41
  columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>;
40
42
  columnGroupingFeature: TableOptions_ColumnGrouping;
41
43
  columnOrderingFeature: TableOptions_ColumnOrdering;
@@ -50,7 +52,7 @@ interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out
50
52
  rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>;
51
53
  rowSortingFeature: TableOptions_RowSorting;
52
54
  }
53
- type TableOptions_StockFeatureKeys = 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
55
+ type TableOptions_StockFeatureKeys = 'aggregationFeature' | 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
54
56
  /**
55
57
  * Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
56
58
  * beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
@@ -69,7 +71,7 @@ type TableOptions<TFeatures extends TableFeatures, TData extends RowData> = Tabl
69
71
  * Internal broad option shape used where feature code may need to read options
70
72
  * from features that are not present in the current generic feature set.
71
73
  */
72
- type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
74
+ type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_Aggregation & TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
73
75
  //#endregion
74
76
  export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap };
75
77
  //# sourceMappingURL=TableOptions.d.cts.map
@@ -1,12 +1,13 @@
1
1
  import { RowData, UnionToIntersection } from "./type-utils.js";
2
2
  import { CoreFeatures } from "../core/coreFeatures.js";
3
+ import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
3
4
  import { TableOptions_Cell } from "../core/cells/coreCellsFeature.types.js";
4
5
  import { TableOptions_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
5
6
  import { TableOptions_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
6
7
  import { TableOptions_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
7
8
  import { TableOptions_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
8
9
  import { TableOptions_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
9
- import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
10
+ import { TableOptions_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
10
11
  import { TableOptions_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
11
12
  import { TableOptions_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
12
13
  import { TableOptions_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
@@ -36,6 +37,7 @@ type DebugOptions<TFeatures extends TableFeatures> = {
36
37
  debugTable?: boolean;
37
38
  } & DebugKeysFor<CoreFeatures & TFeatures>;
38
39
  interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
40
+ aggregationFeature: TableOptions_Aggregation;
39
41
  columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>;
40
42
  columnGroupingFeature: TableOptions_ColumnGrouping;
41
43
  columnOrderingFeature: TableOptions_ColumnOrdering;
@@ -50,7 +52,7 @@ interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out
50
52
  rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>;
51
53
  rowSortingFeature: TableOptions_RowSorting;
52
54
  }
53
- type TableOptions_StockFeatureKeys = 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
55
+ type TableOptions_StockFeatureKeys = 'aggregationFeature' | 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
54
56
  /**
55
57
  * Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
56
58
  * beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
@@ -69,7 +71,7 @@ type TableOptions<TFeatures extends TableFeatures, TData extends RowData> = Tabl
69
71
  * Internal broad option shape used where feature code may need to read options
70
72
  * from features that are not present in the current generic feature set.
71
73
  */
72
- type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
74
+ type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_Aggregation & TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
73
75
  //#endregion
74
76
  export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap };
75
77
  //# sourceMappingURL=TableOptions.d.ts.map
@@ -1,9 +1,9 @@
1
+ import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
1
2
  import { TableState_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
2
3
  import { TableState_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
3
4
  import { TableState_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
4
5
  import { TableState_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
5
6
  import { TableState_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
6
- import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
7
7
  import { TableState_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
8
8
  import { TableState_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
9
9
  import { TableState_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
@@ -1,9 +1,9 @@
1
+ import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
1
2
  import { TableState_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
2
3
  import { TableState_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
3
4
  import { TableState_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
4
5
  import { TableState_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
5
6
  import { TableState_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
6
- import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
7
7
  import { TableState_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
8
8
  import { TableState_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
9
9
  import { TableState_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
@@ -3,6 +3,13 @@ type Updater<T> = T | ((old: T) => T);
3
3
  type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
4
4
  type RowData = Record<string, any> | Array<any>;
5
5
  type CellData = unknown;
6
+ /**
7
+ * Normalizes a row's value before a filter or sort comparator sees it.
8
+ *
9
+ * Attach as `resolveDataValue` on filter/sort functions built with
10
+ * `constructFilterFn`/`constructSortFn` (e.g. to lowercase or strip diacritics).
11
+ */
12
+ type TransformDataValueFn = (dataValue: any) => any;
6
13
  type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7
14
  type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
8
15
  type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends ((x: infer R) => any) ? R : never;
@@ -19,5 +26,5 @@ type NoInfer<T> = [T][T extends any ? 0 : never];
19
26
  type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>;
20
27
  type Prettify<T> = { [K in keyof T]: T[K] } & unknown;
21
28
  //#endregion
22
- export { CellData, DeepKeys, DeepValue, Getter, NoInfer, OnChangeFn, PartialKeys, Prettify, RequiredKeys, RowData, UnionToIntersection, Updater };
29
+ export { CellData, DeepKeys, DeepValue, Getter, NoInfer, OnChangeFn, PartialKeys, Prettify, RequiredKeys, RowData, TransformDataValueFn, UnionToIntersection, Updater };
23
30
  //# sourceMappingURL=type-utils.d.cts.map
@@ -3,6 +3,13 @@ type Updater<T> = T | ((old: T) => T);
3
3
  type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
4
4
  type RowData = Record<string, any> | Array<any>;
5
5
  type CellData = unknown;
6
+ /**
7
+ * Normalizes a row's value before a filter or sort comparator sees it.
8
+ *
9
+ * Attach as `resolveDataValue` on filter/sort functions built with
10
+ * `constructFilterFn`/`constructSortFn` (e.g. to lowercase or strip diacritics).
11
+ */
12
+ type TransformDataValueFn = (dataValue: any) => any;
6
13
  type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7
14
  type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
8
15
  type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends ((x: infer R) => any) ? R : never;
@@ -19,5 +26,5 @@ type NoInfer<T> = [T][T extends any ? 0 : never];
19
26
  type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>;
20
27
  type Prettify<T> = { [K in keyof T]: T[K] } & unknown;
21
28
  //#endregion
22
- export { CellData, DeepKeys, DeepValue, Getter, NoInfer, OnChangeFn, PartialKeys, Prettify, RequiredKeys, RowData, UnionToIntersection, Updater };
29
+ export { CellData, DeepKeys, DeepValue, Getter, NoInfer, OnChangeFn, PartialKeys, Prettify, RequiredKeys, RowData, TransformDataValueFn, UnionToIntersection, Updater };
23
30
  //# sourceMappingURL=type-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initTableWorker.cjs","names":["makeObjectMap","constructTable","storeReactivityBindings","serializeRowModel"],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n // columnGroupingFeature injects default aggregatedCell/aggregationFn\n // into every resolved columnDef, so the resolved defs can't tell\n // explicit from default.\n aggregateColumnIds = flattenColumnDefs(config.columns as Array<any>)\n .filter(\n (def) => def.aggregationFn != null || def.aggregatedCell != null,\n )\n .map(\n (def) =>\n def.id ??\n (typeof def.accessorKey === 'string'\n ? def.accessorKey.replaceAll('.', '_')\n : undefined),\n )\n .filter((id): id is string => id != null)\n } else {\n table.setOptions((prev) => ({ ...prev, data: message.data }))\n }\n // Map row ids to data positions once per dataset; serialization uses it\n // to express every stage result in terms of core row positions.\n const coreFlatRows = table.getCoreRowModel().flatRows\n coreIndexById = makeObjectMap()\n for (let i = 0; i < coreFlatRows.length; i++) {\n coreIndexById[coreFlatRows[i]!.id] = i\n }\n return\n }\n\n if (!table) return\n\n const start = performance.now()\n\n // Apply the serializable state slices to the shadow table's base atoms.\n table._reactivity.batch(() => {\n for (const [key, value] of Object.entries(message.state)) {\n const baseAtom = (table!.baseAtoms as Record<string, any>)[key]\n if (baseAtom && value !== undefined) {\n baseAtom.set(value)\n }\n }\n })\n\n // Compute exactly the stages the main thread requested, skipping any this\n // shadow table has no row model factory for (the main thread warns).\n const stages: { [K in TableWorkerStage]?: TableWorkerStagePayload } = {}\n const transfer: Array<Transferable> = []\n\n for (const stage of message.stages) {\n if (!(config.features as Record<string, unknown>)[`${stage}RowModel`]) {\n continue\n }\n const model = (table as any)[`get${capitalize(stage)}RowModel`]()\n // Memoized getters return the same object when inputs are unchanged;\n // skip re-serializing (and the main thread skips rebuilding). Safe under\n // single-flight: results are never dropped within a dataVersion.\n if (lastSentModels[stage] === model) {\n stages[stage] = { kind: 'unchanged' }\n continue\n }\n lastSentModels[stage] = model\n stages[stage] = serializeRowModel(\n model,\n coreIndexById,\n aggregateColumnIds,\n transfer,\n )\n }\n\n const response: TableWorkerResult = {\n type: 'result',\n requestId: message.requestId,\n dataVersion,\n stages,\n computeMs: performance.now() - start,\n }\n postMessage(response, { transfer })\n }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,WAAW,OAAe;CACjC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;;AAGA,SAAS,kBAAkB,MAA8B;CACvD,OAAO,KAAK,SAAS,QACnB,IAAI,UAAU,kBAAkB,IAAI,OAAO,IAAI,CAAC,GAAG,CACrD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAGd,QAAmD;CACnD,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,gBAAwCA,4BAAc;CAC1D,IAAI,qBAAoC,CA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;GAIhE,IAAI,eAAe,WAAW,OAAO;IACnC,OAAO,SAAS,EAAE,MAAM,YAAY;IACpC;GACF;GACA,eAAe,SAAS;GACxB,OAAO,SAASG,4CACd,OACA,eACA,oBACA,QACF;EACF;EAEA,MAAM,WAA8B;GAClC,MAAM;GACN,WAAW,QAAQ;GACnB;GACA;GACA,WAAW,YAAY,IAAI,IAAI;EACjC;EACA,YAAY,UAAU,EAAE,SAAS,CAAC;CACpC;AACF"}
1
+ {"version":3,"file":"initTableWorker.cjs","names":["makeObjectMap","constructTable","storeReactivityBindings","serializeRowModel"],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n // aggregationFeature injects default aggregatedCell/aggregationFn\n // into every resolved columnDef, so the resolved defs can't tell\n // explicit from default.\n aggregateColumnIds = flattenColumnDefs(config.columns as Array<any>)\n .filter(\n (def) => def.aggregationFn != null || def.aggregatedCell != null,\n )\n .map(\n (def) =>\n def.id ??\n (typeof def.accessorKey === 'string'\n ? def.accessorKey.replaceAll('.', '_')\n : undefined),\n )\n .filter((id): id is string => id != null)\n } else {\n table.setOptions((prev) => ({ ...prev, data: message.data }))\n }\n // Map row ids to data positions once per dataset; serialization uses it\n // to express every stage result in terms of core row positions.\n const coreFlatRows = table.getCoreRowModel().flatRows\n coreIndexById = makeObjectMap()\n for (let i = 0; i < coreFlatRows.length; i++) {\n coreIndexById[coreFlatRows[i]!.id] = i\n }\n return\n }\n\n if (!table) return\n\n const start = performance.now()\n\n // Apply the serializable state slices to the shadow table's base atoms.\n table._reactivity.batch(() => {\n for (const [key, value] of Object.entries(message.state)) {\n const baseAtom = (table!.baseAtoms as Record<string, any>)[key]\n if (baseAtom && value !== undefined) {\n baseAtom.set(value)\n }\n }\n })\n\n // Compute exactly the stages the main thread requested, skipping any this\n // shadow table has no row model factory for (the main thread warns).\n const stages: { [K in TableWorkerStage]?: TableWorkerStagePayload } = {}\n const transfer: Array<Transferable> = []\n\n for (const stage of message.stages) {\n if (!(config.features as Record<string, unknown>)[`${stage}RowModel`]) {\n continue\n }\n const model = (table as any)[`get${capitalize(stage)}RowModel`]()\n // Memoized getters return the same object when inputs are unchanged;\n // skip re-serializing (and the main thread skips rebuilding). Safe under\n // single-flight: results are never dropped within a dataVersion.\n if (lastSentModels[stage] === model) {\n stages[stage] = { kind: 'unchanged' }\n continue\n }\n lastSentModels[stage] = model\n stages[stage] = serializeRowModel(\n model,\n coreIndexById,\n aggregateColumnIds,\n transfer,\n )\n }\n\n const response: TableWorkerResult = {\n type: 'result',\n requestId: message.requestId,\n dataVersion,\n stages,\n computeMs: performance.now() - start,\n }\n postMessage(response, { transfer })\n }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,WAAW,OAAe;CACjC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;;AAGA,SAAS,kBAAkB,MAA8B;CACvD,OAAO,KAAK,SAAS,QACnB,IAAI,UAAU,kBAAkB,IAAI,OAAO,IAAI,CAAC,GAAG,CACrD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAGd,QAAmD;CACnD,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,gBAAwCA,4BAAc;CAC1D,IAAI,qBAAoC,CAAC;CAIzC,IAAI,iBAAwD,CA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AAO;IACnC,OAAO,SAAS,EAAE,MAAM,YAAY;IACpC;GACF;GACA,eAAe,SAAS;GACxB,OAAO,SAASG,4CACd,OACA,eACA,oBACA,QACF;EACF;EAEA,MAAM,WAA8B;GAClC,MAAM;GACN,WAAW,QAAQ;GACnB;GACA;GACA,WAAW,YAAY,IAAI,IAAI;EACjC;EACA,YAAY,UAAU,EAAE,SAAS,CAAC;CACpC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"initTableWorker.js","names":[],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n // columnGroupingFeature injects default aggregatedCell/aggregationFn\n // into every resolved columnDef, so the resolved defs can't tell\n // explicit from default.\n aggregateColumnIds = flattenColumnDefs(config.columns as Array<any>)\n .filter(\n (def) => def.aggregationFn != null || def.aggregatedCell != null,\n )\n .map(\n (def) =>\n def.id ??\n (typeof def.accessorKey === 'string'\n ? def.accessorKey.replaceAll('.', '_')\n : undefined),\n )\n .filter((id): id is string => id != null)\n } else {\n table.setOptions((prev) => ({ ...prev, data: message.data }))\n }\n // Map row ids to data positions once per dataset; serialization uses it\n // to express every stage result in terms of core row positions.\n const coreFlatRows = table.getCoreRowModel().flatRows\n coreIndexById = makeObjectMap()\n for (let i = 0; i < coreFlatRows.length; i++) {\n coreIndexById[coreFlatRows[i]!.id] = i\n }\n return\n }\n\n if (!table) return\n\n const start = performance.now()\n\n // Apply the serializable state slices to the shadow table's base atoms.\n table._reactivity.batch(() => {\n for (const [key, value] of Object.entries(message.state)) {\n const baseAtom = (table!.baseAtoms as Record<string, any>)[key]\n if (baseAtom && value !== undefined) {\n baseAtom.set(value)\n }\n }\n })\n\n // Compute exactly the stages the main thread requested, skipping any this\n // shadow table has no row model factory for (the main thread warns).\n const stages: { [K in TableWorkerStage]?: TableWorkerStagePayload } = {}\n const transfer: Array<Transferable> = []\n\n for (const stage of message.stages) {\n if (!(config.features as Record<string, unknown>)[`${stage}RowModel`]) {\n continue\n }\n const model = (table as any)[`get${capitalize(stage)}RowModel`]()\n // Memoized getters return the same object when inputs are unchanged;\n // skip re-serializing (and the main thread skips rebuilding). Safe under\n // single-flight: results are never dropped within a dataVersion.\n if (lastSentModels[stage] === model) {\n stages[stage] = { kind: 'unchanged' }\n continue\n }\n lastSentModels[stage] = model\n stages[stage] = serializeRowModel(\n model,\n coreIndexById,\n aggregateColumnIds,\n transfer,\n )\n }\n\n const response: TableWorkerResult = {\n type: 'result',\n requestId: message.requestId,\n dataVersion,\n stages,\n computeMs: performance.now() - start,\n }\n postMessage(response, { transfer })\n }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,WAAW,OAAe;CACjC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;;AAGA,SAAS,kBAAkB,MAA8B;CACvD,OAAO,KAAK,SAAS,QACnB,IAAI,UAAU,kBAAkB,IAAI,OAAO,IAAI,CAAC,GAAG,CACrD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAGd,QAAmD;CACnD,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,gBAAwC,cAAc;CAC1D,IAAI,qBAAoC,CAAC;CAIzC,IAAI,iBAAwD,CAAC;CAE7D,KAAK,aAAa,UAAmD;EACnE,MAAM,UAAU,MAAM;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Ae,SAAS;GACxB,OAAO,SAAS,kBACd,OACA,eACA,oBACA,QACF;EACF;EAEA,MAAM,WAA8B;GAClC,MAAM;GACN,WAAW,QAAQ;GACnB;GACA;GACA,WAAW,YAAY,IAAI,IAAI;EACjC;EACA,YAAY,UAAU,EAAE,SAAS,CAAC;CACpC;AACF"}
1
+ {"version":3,"file":"initTableWorker.js","names":[],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n // aggregationFeature injects default aggregatedCell/aggregationFn\n // into every resolved columnDef, so the resolved defs can't tell\n // explicit from default.\n aggregateColumnIds = flattenColumnDefs(config.columns as Array<any>)\n .filter(\n (def) => def.aggregationFn != null || def.aggregatedCell != null,\n )\n .map(\n (def) =>\n def.id ??\n (typeof def.accessorKey === 'string'\n ? def.accessorKey.replaceAll('.', '_')\n : undefined),\n )\n .filter((id): id is string => id != null)\n } else {\n table.setOptions((prev) => ({ ...prev, data: message.data }))\n }\n // Map row ids to data positions once per dataset; serialization uses it\n // to express every stage result in terms of core row positions.\n const coreFlatRows = table.getCoreRowModel().flatRows\n coreIndexById = makeObjectMap()\n for (let i = 0; i < coreFlatRows.length; i++) {\n coreIndexById[coreFlatRows[i]!.id] = i\n }\n return\n }\n\n if (!table) return\n\n const start = performance.now()\n\n // Apply the serializable state slices to the shadow table's base atoms.\n table._reactivity.batch(() => {\n for (const [key, value] of Object.entries(message.state)) {\n const baseAtom = (table!.baseAtoms as Record<string, any>)[key]\n if (baseAtom && value !== undefined) {\n baseAtom.set(value)\n }\n }\n })\n\n // Compute exactly the stages the main thread requested, skipping any this\n // shadow table has no row model factory for (the main thread warns).\n const stages: { [K in TableWorkerStage]?: TableWorkerStagePayload } = {}\n const transfer: Array<Transferable> = []\n\n for (const stage of message.stages) {\n if (!(config.features as Record<string, unknown>)[`${stage}RowModel`]) {\n continue\n }\n const model = (table as any)[`get${capitalize(stage)}RowModel`]()\n // Memoized getters return the same object when inputs are unchanged;\n // skip re-serializing (and the main thread skips rebuilding). Safe under\n // single-flight: results are never dropped within a dataVersion.\n if (lastSentModels[stage] === model) {\n stages[stage] = { kind: 'unchanged' }\n continue\n }\n lastSentModels[stage] = model\n stages[stage] = serializeRowModel(\n model,\n coreIndexById,\n aggregateColumnIds,\n transfer,\n )\n }\n\n const response: TableWorkerResult = {\n type: 'result',\n requestId: message.requestId,\n dataVersion,\n stages,\n computeMs: performance.now() - start,\n }\n postMessage(response, { transfer })\n }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,WAAW,OAAe;CACjC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;;AAGA,SAAS,kBAAkB,MAA8B;CACvD,OAAO,KAAK,SAAS,QACnB,IAAI,UAAU,kBAAkB,IAAI,OAAO,IAAI,CAAC,GAAG,CACrD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAGd,QAAmD;CACnD,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,gBAAwC,cAAc;CAC1D,IAAI,qBAAoC,CAAC;CAIzC,IAAI,iBAAwD,CAAC;CAE7D,KAAK,aAAa,UAAmD;EACnE,MAAM,UAAU,MAAM;EAEtB,IAAI,QAAQ,SAAS,QAAQ;GAC3B,cAAc,QAAQ;GACtB,iBAAiB,CAAC;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8B;GAClC,MAAM;GACN,WAAW,QAAQ;GACnB;GACA;GACA,WAAW,YAAY,IAAI,IAAI;EACjC;EACA,YAAY,UAAU,EAAE,SAAS,CAAC;CACpC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
- "version": "9.0.0-beta.46",
3
+ "version": "9.0.0-beta.48",
4
4
  "description": "Headless UI for building powerful tables & datagrids for TS/JS.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",