@tanstack/table-core 8.10.0 → 8.10.2

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 (63) hide show
  1. package/build/lib/columnHelper.js.map +1 -1
  2. package/build/lib/core/cell.d.ts +36 -6
  3. package/build/lib/core/cell.js.map +1 -1
  4. package/build/lib/core/column.d.ts +46 -3
  5. package/build/lib/core/column.js.map +1 -1
  6. package/build/lib/core/headers.d.ts +160 -11
  7. package/build/lib/core/headers.js.map +1 -1
  8. package/build/lib/core/row.d.ts +81 -11
  9. package/build/lib/core/row.js.map +1 -1
  10. package/build/lib/core/table.d.ts +189 -28
  11. package/build/lib/core/table.js.map +1 -1
  12. package/build/lib/features/ColumnSizing.d.ts +140 -20
  13. package/build/lib/features/ColumnSizing.js.map +1 -1
  14. package/build/lib/features/Expanding.d.ts +126 -11
  15. package/build/lib/features/Expanding.js.map +1 -1
  16. package/build/lib/features/Filters.d.ts +225 -23
  17. package/build/lib/features/Filters.js.map +1 -1
  18. package/build/lib/features/Grouping.d.ts +151 -16
  19. package/build/lib/features/Grouping.js.map +1 -1
  20. package/build/lib/features/Ordering.d.ts +17 -2
  21. package/build/lib/features/Ordering.js.map +1 -1
  22. package/build/lib/features/Pagination.d.ts +118 -16
  23. package/build/lib/features/Pagination.js.map +1 -1
  24. package/build/lib/features/Pinning.d.ts +163 -13
  25. package/build/lib/features/Pinning.js +2 -2
  26. package/build/lib/features/Pinning.js.map +1 -1
  27. package/build/lib/features/RowSelection.d.ts +151 -16
  28. package/build/lib/features/RowSelection.js +5 -2
  29. package/build/lib/features/RowSelection.js.map +1 -1
  30. package/build/lib/features/Sorting.d.ts +187 -20
  31. package/build/lib/features/Sorting.js.map +1 -1
  32. package/build/lib/features/Visibility.d.ts +95 -12
  33. package/build/lib/features/Visibility.js.map +1 -1
  34. package/build/lib/filterFns.js.map +1 -1
  35. package/build/lib/index.esm.js +7 -4
  36. package/build/lib/index.esm.js.map +1 -1
  37. package/build/lib/index.mjs +7 -4
  38. package/build/lib/index.mjs.map +1 -1
  39. package/build/lib/utils.js.map +1 -1
  40. package/build/umd/index.development.js +7 -4
  41. package/build/umd/index.development.js.map +1 -1
  42. package/build/umd/index.production.js +1 -1
  43. package/build/umd/index.production.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/columnHelper.ts +2 -2
  46. package/src/core/cell.ts +36 -6
  47. package/src/core/column.ts +46 -3
  48. package/src/core/headers.ts +160 -11
  49. package/src/core/row.ts +88 -15
  50. package/src/core/table.ts +189 -28
  51. package/src/features/ColumnSizing.ts +143 -20
  52. package/src/features/Expanding.ts +126 -11
  53. package/src/features/Filters.ts +225 -24
  54. package/src/features/Grouping.ts +151 -17
  55. package/src/features/Ordering.ts +17 -2
  56. package/src/features/Pagination.ts +118 -16
  57. package/src/features/Pinning.ts +168 -15
  58. package/src/features/RowSelection.ts +154 -19
  59. package/src/features/Sorting.ts +187 -20
  60. package/src/features/Visibility.ts +98 -12
  61. package/src/filterFns.ts +2 -2
  62. package/src/types.ts +5 -5
  63. package/src/utils.ts +3 -3
@@ -65,49 +65,196 @@ export type FilterFnOption<TData extends RowData> =
65
65
  | FilterFn<TData>
66
66
 
67
67
  export interface FiltersColumnDef<TData extends RowData> {
68
+ /**
69
+ * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.
70
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#filterfn)
71
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
72
+ */
68
73
  filterFn?: FilterFnOption<TData>
74
+ /**
75
+ * Enables/disables the **column** filter for this column.
76
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilter)
77
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
78
+ */
69
79
  enableColumnFilter?: boolean
80
+ /**
81
+ * Enables/disables the **global** filter for this column.
82
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enableglobalfilter)
83
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
84
+ */
70
85
  enableGlobalFilter?: boolean
71
86
  }
72
87
 
73
88
  export interface FiltersColumn<TData extends RowData> {
89
+ _getFacetedMinMaxValues?: () => undefined | [number, number]
90
+ _getFacetedRowModel?: () => RowModel<TData>
91
+ _getFacetedUniqueValues?: () => Map<any, number>
92
+ /**
93
+ * Returns an automatically calculated filter function for the column based off of the columns first known value.
94
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getautofilterfn)
95
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
96
+ */
74
97
  getAutoFilterFn: () => FilterFn<TData> | undefined
75
- getFilterFn: () => FilterFn<TData> | undefined
76
- setFilterValue: (updater: Updater<any>) => void
98
+ /**
99
+ * Returns whether or not the column can be **column** filtered.
100
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getcanfilter)
101
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
102
+ */
77
103
  getCanFilter: () => boolean
104
+ /**
105
+ * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.
106
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getcanglobalfilter)
107
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
108
+ */
78
109
  getCanGlobalFilter: () => boolean
110
+ /**
111
+ * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
112
+ * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.
113
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfacetedminmaxvalues)
114
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
115
+ */
116
+ getFacetedMinMaxValues: () => undefined | [number, number]
117
+ /**
118
+ * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.
119
+ * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.
120
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfacetedrowmodel)
121
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
122
+ */
79
123
  getFacetedRowModel: () => RowModel<TData>
80
- _getFacetedRowModel?: () => RowModel<TData>
81
- getIsFiltered: () => boolean
82
- getFilterValue: () => unknown
83
- getFilterIndex: () => number
124
+ /**
125
+ * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
126
+ * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.
127
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfaceteduniquevalues)
128
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
129
+ */
84
130
  getFacetedUniqueValues: () => Map<any, number>
85
- _getFacetedUniqueValues?: () => Map<any, number>
86
- getFacetedMinMaxValues: () => undefined | [number, number]
87
- _getFacetedMinMaxValues?: () => undefined | [number, number]
131
+ /**
132
+ * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.
133
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilterfn)
134
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
135
+ */
136
+ getFilterFn: () => FilterFn<TData> | undefined
137
+ /**
138
+ * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.
139
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilterindex)
140
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
141
+ */
142
+ getFilterIndex: () => number
143
+ /**
144
+ * Returns the current filter value for the column.
145
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfiltervalue)
146
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
147
+ */
148
+ getFilterValue: () => unknown
149
+ /**
150
+ * Returns whether or not the column is currently filtered.
151
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getisfiltered)
152
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
153
+ */
154
+ getIsFiltered: () => boolean
155
+ /**
156
+ * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.
157
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setfiltervalue)
158
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
159
+ */
160
+ setFilterValue: (updater: Updater<any>) => void
88
161
  }
89
162
 
90
163
  export interface FiltersRow<TData extends RowData> {
164
+ /**
165
+ * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.
166
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#columnfilters)
167
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
168
+ */
91
169
  columnFilters: Record<string, boolean>
170
+ /**
171
+ * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.
172
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#columnfiltersmeta)
173
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
174
+ */
92
175
  columnFiltersMeta: Record<string, FilterMeta>
93
176
  }
94
177
 
95
178
  interface FiltersOptionsBase<TData extends RowData> {
179
+ /**
180
+ * Enables/disables all filtering for the table.
181
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablefilters)
182
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
183
+ */
96
184
  enableFilters?: boolean
97
- manualFiltering?: boolean
185
+ /**
186
+ * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).
187
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#filterfromleafrows)
188
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
189
+ */
98
190
  filterFromLeafRows?: boolean
99
- maxLeafRowFilterDepth?: number
191
+ /**
192
+ * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.
193
+ * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.
194
+ * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.
195
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilteredrowmodel)
196
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
197
+ */
100
198
  getFilteredRowModel?: (table: Table<any>) => () => RowModel<any>
199
+ /**
200
+ * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.
201
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#manualfiltering)
202
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
203
+ */
204
+ manualFiltering?: boolean
205
+ /**
206
+ * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.
207
+
208
+ * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.
209
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#maxleafrowfilterdepth)
210
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
211
+ */
212
+ maxLeafRowFilterDepth?: number
101
213
 
102
214
  // Column
103
- onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>
215
+ /**
216
+ * Enables/disables **column** filtering for all columns.
217
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilters)
218
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
219
+ */
104
220
  enableColumnFilters?: boolean
221
+ /**
222
+ * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
223
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#oncolumnfilterschange)
224
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
225
+ */
226
+ onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>
105
227
 
106
228
  // Global
107
- globalFilterFn?: FilterFnOption<TData>
108
- onGlobalFilterChange?: OnChangeFn<any>
229
+ /**
230
+ * Enables/disables **global** filtering for all columns.
231
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enableglobalfilter)
232
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
233
+ */
109
234
  enableGlobalFilter?: boolean
235
+ /**
236
+ * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.
237
+ *
238
+ * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).
239
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getcolumncanglobalfilter)
240
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
241
+ */
110
242
  getColumnCanGlobalFilter?: (column: Column<TData, unknown>) => boolean
243
+ /**
244
+ * The filter function to use for global filtering.
245
+ * - A `string` referencing a built-in filter function
246
+ * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option
247
+ * - A custom filter function
248
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#globalfilterfn)
249
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
250
+ */
251
+ globalFilterFn?: FilterFnOption<TData>
252
+ /**
253
+ * If provided, this function will be called with an `updaterFn` when `state.globalFilter` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
254
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#onglobalfilterchange)
255
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
256
+ */
257
+ onGlobalFilterChange?: OnChangeFn<any>
111
258
 
112
259
  // Faceting
113
260
  getFacetedRowModel?: (
@@ -137,26 +284,80 @@ export interface FiltersOptions<TData extends RowData>
137
284
  ResolvedFilterFns {}
138
285
 
139
286
  export interface FiltersInstance<TData extends RowData> {
287
+ /**
288
+ * Sets or updates the `state.columnFilters` state.
289
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setcolumnfilters)
290
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
291
+ */
140
292
  setColumnFilters: (updater: Updater<ColumnFiltersState>) => void
141
-
293
+ /**
294
+ * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.
295
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#resetcolumnfilters)
296
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
297
+ */
142
298
  resetColumnFilters: (defaultState?: boolean) => void
143
299
 
144
300
  // Column Filters
145
- getPreFilteredRowModel: () => RowModel<TData>
146
- getFilteredRowModel: () => RowModel<TData>
147
301
  _getFilteredRowModel?: () => RowModel<TData>
302
+ /**
303
+ * Returns the row model for the table after **column** filtering has been applied.
304
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilteredrowmodel)
305
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
306
+ */
307
+ getFilteredRowModel: () => RowModel<TData>
308
+ /**
309
+ * Returns the row model for the table before any **column** filtering has been applied.
310
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getprefilteredrowmodel)
311
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
312
+ */
313
+ getPreFilteredRowModel: () => RowModel<TData>
148
314
 
149
315
  // Global Filters
150
- setGlobalFilter: (updater: Updater<any>) => void
151
- resetGlobalFilter: (defaultState?: boolean) => void
152
- getGlobalAutoFilterFn: () => FilterFn<TData> | undefined
153
- getGlobalFilterFn: () => FilterFn<TData> | undefined
154
- getGlobalFacetedRowModel: () => RowModel<TData>
316
+ _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]
155
317
  _getGlobalFacetedRowModel?: () => RowModel<TData>
156
- getGlobalFacetedUniqueValues: () => Map<any, number>
157
318
  _getGlobalFacetedUniqueValues?: () => Map<any, number>
319
+ /**
320
+ * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.
321
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalautofilterfn)
322
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
323
+ */
324
+ getGlobalAutoFilterFn: () => FilterFn<TData> | undefined
325
+ /**
326
+ * Returns the faceted min and max values for the global filter.
327
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfacetedminmaxvalues)
328
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
329
+ */
158
330
  getGlobalFacetedMinMaxValues: () => undefined | [number, number]
159
- _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]
331
+ /**
332
+ * Returns the row model for the table after **global** filtering has been applied.
333
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfacetedrowmodel)
334
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
335
+ */
336
+ getGlobalFacetedRowModel: () => RowModel<TData>
337
+ /**
338
+ * Returns the faceted unique values for the global filter.
339
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfaceteduniquevalues)
340
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
341
+ */
342
+ getGlobalFacetedUniqueValues: () => Map<any, number>
343
+ /**
344
+ * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.
345
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfilterfn)
346
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
347
+ */
348
+ getGlobalFilterFn: () => FilterFn<TData> | undefined
349
+ /**
350
+ * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.
351
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#resetglobalfilter)
352
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
353
+ */
354
+ resetGlobalFilter: (defaultState?: boolean) => void
355
+ /**
356
+ * Sets or updates the `state.globalFilter` state.
357
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setglobalfilter)
358
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
359
+ */
360
+ setGlobalFilter: (updater: Updater<any>) => void
160
361
  }
161
362
 
162
363
  //
@@ -35,50 +35,164 @@ export type AggregationFnOption<TData extends RowData> =
35
35
  | AggregationFn<TData>
36
36
 
37
37
  export interface GroupingColumnDef<TData extends RowData, TValue> {
38
- aggregationFn?: AggregationFnOption<TData>
38
+ /**
39
+ * The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).
40
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregatedcell)
41
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
42
+ */
39
43
  aggregatedCell?: ColumnDefTemplate<
40
44
  ReturnType<Cell<TData, TValue>['getContext']>
41
45
  >
46
+ /**
47
+ * The resolved aggregation function for the column.
48
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#aggregationfn)
49
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
50
+ */
51
+ aggregationFn?: AggregationFnOption<TData>
52
+ /**
53
+ * Enables/disables grouping for this column.
54
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)
55
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
56
+ */
42
57
  enableGrouping?: boolean
58
+ /**
59
+ * Specify a value to be used for grouping rows on this column. If this option is not specified, the value derived from `accessorKey` / `accessorFn` will be used instead.
60
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)
61
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
62
+ */
43
63
  getGroupingValue?: (row: TData) => any
44
64
  }
45
65
 
46
66
  export interface GroupingColumn<TData extends RowData> {
67
+ /**
68
+ * Returns the aggregation function for the column.
69
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getaggregationfn)
70
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
71
+ */
72
+ getAggregationFn: () => AggregationFn<TData> | undefined
73
+ /**
74
+ * Returns the automatically inferred aggregation function for the column.
75
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getautoaggregationfn)
76
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
77
+ */
78
+ getAutoAggregationFn: () => AggregationFn<TData> | undefined
79
+ /**
80
+ * Returns whether or not the column can be grouped.
81
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getcangroup)
82
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
83
+ */
47
84
  getCanGroup: () => boolean
48
- getIsGrouped: () => boolean
85
+ /**
86
+ * Returns the index of the column in the grouping state.
87
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedindex)
88
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
89
+ */
49
90
  getGroupedIndex: () => number
50
- toggleGrouping: () => void
91
+ /**
92
+ * Returns whether or not the column is currently grouped.
93
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)
94
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
95
+ */
96
+ getIsGrouped: () => boolean
97
+ /**
98
+ * Returns a function that toggles the grouping state of the column. This is useful for passing to the `onClick` prop of a button.
99
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#gettogglegroupinghandler)
100
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
101
+ */
51
102
  getToggleGroupingHandler: () => () => void
52
- getAutoAggregationFn: () => AggregationFn<TData> | undefined
53
- getAggregationFn: () => AggregationFn<TData> | undefined
103
+ /**
104
+ * Toggles the grouping state of the column.
105
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#togglegrouping)
106
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
107
+ */
108
+ toggleGrouping: () => void
54
109
  }
55
110
 
56
111
  export interface GroupingRow {
112
+ _groupingValuesCache: Record<string, any>
113
+ /**
114
+ * Returns the grouping value for any row and column (including leaf rows).
115
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupingvalue)
116
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
117
+ */
118
+ getGroupingValue: (columnId: string) => unknown
119
+ /**
120
+ * Returns whether or not the row is currently grouped.
121
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)
122
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
123
+ */
124
+ getIsGrouped: () => boolean
125
+ /**
126
+ * If this row is grouped, this is the id of the column that this row is grouped by.
127
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingcolumnid)
128
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
129
+ */
57
130
  groupingColumnId?: string
131
+ /**
132
+ * If this row is grouped, this is the unique/shared value for the `groupingColumnId` for all of the rows in this group.
133
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupingvalue)
134
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
135
+ */
58
136
  groupingValue?: unknown
59
- getIsGrouped: () => boolean
60
- getGroupingValue: (columnId: string) => unknown
61
- _groupingValuesCache: Record<string, any>
62
137
  }
63
138
 
64
139
  export interface GroupingCell {
140
+ /**
141
+ * Returns whether or not the cell is currently aggregated.
142
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisaggregated)
143
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
144
+ */
145
+ getIsAggregated: () => boolean
146
+ /**
147
+ * Returns whether or not the cell is currently grouped.
148
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisgrouped)
149
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
150
+ */
65
151
  getIsGrouped: () => boolean
152
+ /**
153
+ * Returns whether or not the cell is currently a placeholder cell.
154
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getisplaceholder)
155
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
156
+ */
66
157
  getIsPlaceholder: () => boolean
67
- getIsAggregated: () => boolean
68
158
  }
69
159
 
70
160
  export interface ColumnDefaultOptions {
71
- // Column
72
- onGroupingChange: OnChangeFn<GroupingState>
73
161
  enableGrouping: boolean
162
+ onGroupingChange: OnChangeFn<GroupingState>
74
163
  }
75
164
 
76
165
  interface GroupingOptionsBase {
77
- manualGrouping?: boolean
78
- onGroupingChange?: OnChangeFn<GroupingState>
166
+ /**
167
+ * Enables/disables grouping for the table.
168
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#enablegrouping)
169
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
170
+ */
79
171
  enableGrouping?: boolean
172
+ /**
173
+ * Returns the row model after grouping has taken place, but no further.
174
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)
175
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
176
+ */
80
177
  getGroupedRowModel?: (table: Table<any>) => () => RowModel<any>
178
+ /**
179
+ * Grouping columns are automatically reordered by default to the start of the columns list. If you would rather remove them or leave them as-is, set the appropriate mode here.
180
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#groupedcolumnmode)
181
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
182
+ */
81
183
  groupedColumnMode?: false | 'reorder' | 'remove'
184
+ /**
185
+ * Enables manual grouping. If this option is set to `true`, the table will not automatically group rows using `getGroupedRowModel()` and instead will expect you to manually group the rows before passing them to the table. This is useful if you are doing server-side grouping and aggregation.
186
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#manualgrouping)
187
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
188
+ */
189
+ manualGrouping?: boolean
190
+ /**
191
+ * If this function is provided, it will be called when the grouping state changes and you will be expected to manage the state yourself. You can pass the managed state back to the table via the `tableOptions.state.grouping` option.
192
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#ongroupingchange)
193
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
194
+ */
195
+ onGroupingChange?: OnChangeFn<GroupingState>
82
196
  }
83
197
 
84
198
  type ResolvedAggregationFns = keyof AggregationFns extends never
@@ -96,11 +210,31 @@ export interface GroupingOptions
96
210
  export type GroupingColumnMode = false | 'reorder' | 'remove'
97
211
 
98
212
  export interface GroupingInstance<TData extends RowData> {
99
- setGrouping: (updater: Updater<GroupingState>) => void
100
- resetGrouping: (defaultState?: boolean) => void
101
- getPreGroupedRowModel: () => RowModel<TData>
102
- getGroupedRowModel: () => RowModel<TData>
103
213
  _getGroupedRowModel?: () => RowModel<TData>
214
+ /**
215
+ * Returns the row model for the table after grouping has been applied.
216
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getgroupedrowmodel)
217
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
218
+ */
219
+ getGroupedRowModel: () => RowModel<TData>
220
+ /**
221
+ * Returns the row model for the table before any grouping has been applied.
222
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#getpregroupedrowmodel)
223
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
224
+ */
225
+ getPreGroupedRowModel: () => RowModel<TData>
226
+ /**
227
+ * Resets the **grouping** state to `initialState.grouping`, or `true` can be passed to force a default blank state reset to `[]`.
228
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#resetgrouping)
229
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
230
+ */
231
+ resetGrouping: (defaultState?: boolean) => void
232
+ /**
233
+ * Updates the grouping state of the table via an update function or value.
234
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#setgrouping)
235
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
236
+ */
237
+ setGrouping: (updater: Updater<GroupingState>) => void
104
238
  }
105
239
 
106
240
  //
@@ -12,6 +12,11 @@ export interface ColumnOrderTableState {
12
12
  export type ColumnOrderState = string[]
13
13
 
14
14
  export interface ColumnOrderOptions {
15
+ /**
16
+ * If provided, this function will be called with an `updaterFn` when `state.columnOrder` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
17
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#oncolumnorderchange)
18
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)
19
+ */
15
20
  onColumnOrderChange?: OnChangeFn<ColumnOrderState>
16
21
  }
17
22
 
@@ -20,11 +25,21 @@ export interface ColumnOrderDefaultOptions {
20
25
  }
21
26
 
22
27
  export interface ColumnOrderInstance<TData extends RowData> {
23
- setColumnOrder: (updater: Updater<ColumnOrderState>) => void
24
- resetColumnOrder: (defaultState?: boolean) => void
25
28
  _getOrderColumnsFn: () => (
26
29
  columns: Column<TData, unknown>[]
27
30
  ) => Column<TData, unknown>[]
31
+ /**
32
+ * Resets the **columnOrder** state to `initialState.columnOrder`, or `true` can be passed to force a default blank state reset to `[]`.
33
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#resetcolumnorder)
34
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)
35
+ */
36
+ resetColumnOrder: (defaultState?: boolean) => void
37
+ /**
38
+ * Sets or updates the `state.columnOrder` state.
39
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-ordering#setcolumnorder)
40
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-ordering)
41
+ */
42
+ setColumnOrder: (updater: Updater<ColumnOrderState>) => void
28
43
  }
29
44
 
30
45
  //