@tanstack/table-core 8.10.1 → 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 (62) 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.map +1 -1
  26. package/build/lib/features/RowSelection.d.ts +151 -16
  27. package/build/lib/features/RowSelection.js +5 -2
  28. package/build/lib/features/RowSelection.js.map +1 -1
  29. package/build/lib/features/Sorting.d.ts +187 -20
  30. package/build/lib/features/Sorting.js.map +1 -1
  31. package/build/lib/features/Visibility.d.ts +95 -12
  32. package/build/lib/features/Visibility.js.map +1 -1
  33. package/build/lib/filterFns.js.map +1 -1
  34. package/build/lib/index.esm.js +5 -2
  35. package/build/lib/index.esm.js.map +1 -1
  36. package/build/lib/index.mjs +5 -2
  37. package/build/lib/index.mjs.map +1 -1
  38. package/build/lib/utils.js.map +1 -1
  39. package/build/umd/index.development.js +5 -2
  40. package/build/umd/index.development.js.map +1 -1
  41. package/build/umd/index.production.js +1 -1
  42. package/build/umd/index.production.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/columnHelper.ts +2 -2
  45. package/src/core/cell.ts +36 -6
  46. package/src/core/column.ts +46 -3
  47. package/src/core/headers.ts +160 -11
  48. package/src/core/row.ts +88 -15
  49. package/src/core/table.ts +189 -28
  50. package/src/features/ColumnSizing.ts +143 -20
  51. package/src/features/Expanding.ts +126 -11
  52. package/src/features/Filters.ts +225 -24
  53. package/src/features/Grouping.ts +151 -17
  54. package/src/features/Ordering.ts +17 -2
  55. package/src/features/Pagination.ts +118 -16
  56. package/src/features/Pinning.ts +163 -13
  57. package/src/features/RowSelection.ts +154 -19
  58. package/src/features/Sorting.ts +187 -20
  59. package/src/features/Visibility.ts +98 -12
  60. package/src/filterFns.ts +2 -2
  61. package/src/types.ts +5 -5
  62. package/src/utils.ts +3 -3
@@ -21,8 +21,8 @@ import { isFunction, makeStateUpdater } from '../utils'
21
21
  export type SortDirection = 'asc' | 'desc'
22
22
 
23
23
  export interface ColumnSort {
24
- id: string
25
24
  desc: boolean
25
+ id: string
26
26
  }
27
27
 
28
28
  export type SortingState = ColumnSort[]
@@ -47,40 +47,187 @@ export type SortingFnOption<TData extends RowData> =
47
47
  | SortingFn<TData>
48
48
 
49
49
  export interface SortingColumnDef<TData extends RowData> {
50
- sortingFn?: SortingFnOption<TData>
51
- sortDescFirst?: boolean
52
- enableSorting?: boolean
50
+ /**
51
+ * Enables/Disables multi-sorting for this column.
52
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)
53
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
54
+ */
53
55
  enableMultiSort?: boolean
56
+ /**
57
+ * Enables/Disables sorting for this column.
58
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)
59
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
60
+ */
61
+ enableSorting?: boolean
62
+ /**
63
+ * Inverts the order of the sorting for this column. This is useful for values that have an inverted best/worst scale where lower numbers are better, eg. a ranking (1st, 2nd, 3rd) or golf-like scoring
64
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#invertsorting)
65
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
66
+ */
54
67
  invertSorting?: boolean
68
+ /**
69
+ * Set to `true` for sorting toggles on this column to start in the descending direction.
70
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)
71
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
72
+ */
73
+ sortDescFirst?: boolean
74
+ /**
75
+ * The sorting function to use with this column.
76
+ * - A `string` referencing a built-in sorting function
77
+ * - A custom sorting function
78
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortingfn)
79
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
80
+ */
81
+ sortingFn?: SortingFnOption<TData>
82
+ /**
83
+ * - `false`
84
+ * - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
85
+ * - `-1`
86
+ * - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
87
+ * - `1`
88
+ * - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)
89
+ */
55
90
  sortUndefined?: false | -1 | 1
56
91
  }
57
92
 
58
93
  export interface SortingColumn<TData extends RowData> {
59
- getAutoSortingFn: () => SortingFn<TData>
94
+ /**
95
+ * Removes this column from the table's sorting state
96
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#clearsorting)
97
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
98
+ */
99
+ clearSorting: () => void
100
+ /**
101
+ * Returns a sort direction automatically inferred based on the columns values.
102
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortdir)
103
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
104
+ */
60
105
  getAutoSortDir: () => SortDirection
61
- getSortingFn: () => SortingFn<TData>
106
+ /**
107
+ * Returns a sorting function automatically inferred based on the columns values.
108
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getautosortingfn)
109
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
110
+ */
111
+ getAutoSortingFn: () => SortingFn<TData>
112
+ /**
113
+ * Returns whether this column can be multi-sorted.
114
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcanmultisort)
115
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
116
+ */
117
+ getCanMultiSort: () => boolean
118
+ /**
119
+ * Returns whether this column can be sorted.
120
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getcansort)
121
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
122
+ */
123
+ getCanSort: () => boolean
124
+ /**
125
+ * Returns the first direction that should be used when sorting this column.
126
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getfirstsortdir)
127
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
128
+ */
62
129
  getFirstSortDir: () => SortDirection
130
+ /**
131
+ * Returns the current sort direction of this column.
132
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getissorted)
133
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
134
+ */
135
+ getIsSorted: () => false | SortDirection
136
+ /**
137
+ * Returns the next sorting order.
138
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getnextsortingorder)
139
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
140
+ */
63
141
  getNextSortingOrder: () => SortDirection | false
64
- getCanSort: () => boolean
65
- getCanMultiSort: () => boolean
142
+ /**
143
+ * Returns the index position of this column's sorting within the sorting state
144
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortindex)
145
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
146
+ */
66
147
  getSortIndex: () => number
67
- getIsSorted: () => false | SortDirection
68
- clearSorting: () => void
69
- toggleSorting: (desc?: boolean, isMulti?: boolean) => void
148
+ /**
149
+ * Returns the resolved sorting function to be used for this column
150
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortingfn)
151
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
152
+ */
153
+ getSortingFn: () => SortingFn<TData>
154
+ /**
155
+ * Returns a function that can be used to toggle this column's sorting state. This is useful for attaching a click handler to the column header.
156
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#gettogglesortinghandler)
157
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
158
+ */
70
159
  getToggleSortingHandler: () => undefined | ((event: unknown) => void)
160
+ /**
161
+ * Toggles this columns sorting state. If `desc` is provided, it will force the sort direction to that value. If `isMulti` is provided, it will additivity multi-sort the column (or toggle it if it is already sorted).
162
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#togglesorting)
163
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
164
+ */
165
+ toggleSorting: (desc?: boolean, isMulti?: boolean) => void
71
166
  }
72
167
 
73
168
  interface SortingOptionsBase {
74
- manualSorting?: boolean
75
- onSortingChange?: OnChangeFn<SortingState>
76
- enableSorting?: boolean
77
- enableSortingRemoval?: boolean
169
+ /**
170
+ * Enables/disables the ability to remove multi-sorts
171
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultiremove)
172
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
173
+ */
78
174
  enableMultiRemove?: boolean
175
+ /**
176
+ * Enables/Disables multi-sorting for the table.
177
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablemultisort)
178
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
179
+ */
79
180
  enableMultiSort?: boolean
80
- sortDescFirst?: boolean
181
+ /**
182
+ * Enables/Disables sorting for the table.
183
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesorting)
184
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
185
+ */
186
+ enableSorting?: boolean
187
+ /**
188
+ * Enables/Disables the ability to remove sorting for the table.
189
+ * - If `true` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'none' -> ...
190
+ * - If `false` then changing sort order will circle like: 'none' -> 'desc' -> 'asc' -> 'desc' -> 'asc' -> ...
191
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#enablesortingremoval)
192
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
193
+ */
194
+ enableSortingRemoval?: boolean
195
+ /**
196
+ * This function is used to retrieve the sorted row model. If using server-side sorting, this function is not required. To use client-side sorting, pass the exported `getSortedRowModel()` from your adapter to your table or implement your own.
197
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)
198
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
199
+ */
81
200
  getSortedRowModel?: (table: Table<any>) => () => RowModel<any>
82
- maxMultiSortColCount?: number
201
+ /**
202
+ * Pass a custom function that will be used to determine if a multi-sort event should be triggered. It is passed the event from the sort toggle handler and should return `true` if the event should trigger a multi-sort.
203
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#ismultisortevent)
204
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
205
+ */
83
206
  isMultiSortEvent?: (e: unknown) => boolean
207
+ /**
208
+ * Enables manual sorting for the table. If this is `true`, you will be expected to sort your data before it is passed to the table. This is useful if you are doing server-side sorting.
209
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#manualsorting)
210
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
211
+ */
212
+ manualSorting?: boolean
213
+ /**
214
+ * Set a maximum number of columns that can be multi-sorted.
215
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#maxmultisortcolcount)
216
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
217
+ */
218
+ maxMultiSortColCount?: number
219
+ /**
220
+ * If provided, this function will be called with an `updaterFn` when `state.sorting` 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.
221
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#onsortingchange)
222
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
223
+ */
224
+ onSortingChange?: OnChangeFn<SortingState>
225
+ /**
226
+ * If `true`, all sorts will default to descending as their first toggle state.
227
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#sortdescfirst)
228
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
229
+ */
230
+ sortDescFirst?: boolean
84
231
  }
85
232
 
86
233
  type ResolvedSortingFns = keyof SortingFns extends never
@@ -96,11 +243,31 @@ export interface SortingOptions<TData extends RowData>
96
243
  ResolvedSortingFns {}
97
244
 
98
245
  export interface SortingInstance<TData extends RowData> {
99
- setSorting: (updater: Updater<SortingState>) => void
100
- resetSorting: (defaultState?: boolean) => void
246
+ _getSortedRowModel?: () => RowModel<TData>
247
+ /**
248
+ * Returns the row model for the table before any sorting has been applied.
249
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getpresortedrowmodel)
250
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
251
+ */
101
252
  getPreSortedRowModel: () => RowModel<TData>
253
+ /**
254
+ * Returns the row model for the table after sorting has been applied.
255
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#getsortedrowmodel)
256
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
257
+ */
102
258
  getSortedRowModel: () => RowModel<TData>
103
- _getSortedRowModel?: () => RowModel<TData>
259
+ /**
260
+ * Resets the **sorting** state to `initialState.sorting`, or `true` can be passed to force a default blank state reset to `[]`.
261
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#resetsorting)
262
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
263
+ */
264
+ resetSorting: (defaultState?: boolean) => void
265
+ /**
266
+ * Sets or updates the `state.sorting` state.
267
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#setsorting)
268
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
269
+ */
270
+ setSorting: (updater: Updater<SortingState>) => void
104
271
  }
105
272
 
106
273
  //
@@ -17,26 +17,87 @@ export interface VisibilityTableState {
17
17
  }
18
18
 
19
19
  export interface VisibilityOptions {
20
- onColumnVisibilityChange?: OnChangeFn<VisibilityState>
21
20
  enableHiding?: boolean
21
+ /**
22
+ * If provided, this function will be called with an `updaterFn` when `state.columnVisibility` 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.
23
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#oncolumnvisibilitychange)
24
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
25
+ */
26
+ onColumnVisibilityChange?: OnChangeFn<VisibilityState>
22
27
  }
23
28
 
24
- export interface VisibilityDefaultOptions {
25
- onColumnVisibilityChange: OnChangeFn<VisibilityState>
26
- }
29
+ export type VisibilityDefaultOptions = Pick<
30
+ VisibilityOptions,
31
+ 'onColumnVisibilityChange'
32
+ >
27
33
 
28
34
  export interface VisibilityInstance<TData extends RowData> {
29
- getVisibleFlatColumns: () => Column<TData, unknown>[]
30
- getVisibleLeafColumns: () => Column<TData, unknown>[]
31
- getLeftVisibleLeafColumns: () => Column<TData, unknown>[]
32
- getRightVisibleLeafColumns: () => Column<TData, unknown>[]
35
+ /**
36
+ * If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.
37
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcentervisibleleafcolumns)
38
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
39
+ */
33
40
  getCenterVisibleLeafColumns: () => Column<TData, unknown>[]
34
- setColumnVisibility: (updater: Updater<VisibilityState>) => void
35
- resetColumnVisibility: (defaultState?: boolean) => void
36
- toggleAllColumnsVisible: (value?: boolean) => void
41
+ /**
42
+ * Returns whether all columns are visible
43
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisallcolumnsvisible)
44
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
45
+ */
37
46
  getIsAllColumnsVisible: () => boolean
47
+ /**
48
+ * Returns whether any columns are visible
49
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getissomecolumnsvisible)
50
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
51
+ */
38
52
  getIsSomeColumnsVisible: () => boolean
53
+ /**
54
+ * If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.
55
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getleftvisibleleafcolumns)
56
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
57
+ */
58
+ getLeftVisibleLeafColumns: () => Column<TData, unknown>[]
59
+ /**
60
+ * If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.
61
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getrightvisibleleafcolumns)
62
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
63
+ */
64
+ getRightVisibleLeafColumns: () => Column<TData, unknown>[]
65
+ /**
66
+ * Returns a handler for toggling the visibility of all columns, meant to be bound to a `input[type=checkbox]` element.
67
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettoggleallcolumnsvisibilityhandler)
68
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
69
+ */
39
70
  getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void
71
+ /**
72
+ * Returns a flat array of columns that are visible, including parent columns.
73
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleflatcolumns)
74
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
75
+ */
76
+ getVisibleFlatColumns: () => Column<TData, unknown>[]
77
+ /**
78
+ * Returns a flat array of leaf-node columns that are visible.
79
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisibleleafcolumns)
80
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
81
+ */
82
+ getVisibleLeafColumns: () => Column<TData, unknown>[]
83
+ /**
84
+ * Resets the column visibility state to the initial state. If `defaultState` is provided, the state will be reset to `{}`
85
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#resetcolumnvisibility)
86
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
87
+ */
88
+ resetColumnVisibility: (defaultState?: boolean) => void
89
+ /**
90
+ * Sets or updates the `state.columnVisibility` state.
91
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#setcolumnvisibility)
92
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
93
+ */
94
+ setColumnVisibility: (updater: Updater<VisibilityState>) => void
95
+ /**
96
+ * Toggles the visibility of all columns.
97
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#toggleallcolumnsvisible)
98
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
99
+ */
100
+ toggleAllColumnsVisible: (value?: boolean) => void
40
101
  }
41
102
 
42
103
  export interface VisibilityColumnDef {
@@ -45,14 +106,39 @@ export interface VisibilityColumnDef {
45
106
 
46
107
  export interface VisibilityRow<TData extends RowData> {
47
108
  _getAllVisibleCells: () => Cell<TData, unknown>[]
109
+ /**
110
+ * Returns an array of cells that account for column visibility for the row.
111
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getvisiblecells)
112
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
113
+ */
48
114
  getVisibleCells: () => Cell<TData, unknown>[]
49
115
  }
50
116
 
51
117
  export interface VisibilityColumn {
118
+ /**
119
+ * Returns whether the column can be hidden
120
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getcanhide)
121
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
122
+ */
52
123
  getCanHide: () => boolean
124
+ /**
125
+ * Returns whether the column is visible
126
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#getisvisible)
127
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
128
+ */
53
129
  getIsVisible: () => boolean
54
- toggleVisibility: (value?: boolean) => void
130
+ /**
131
+ * Returns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.
132
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#gettogglevisibilityhandler)
133
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
134
+ */
55
135
  getToggleVisibilityHandler: () => (event: unknown) => void
136
+ /**
137
+ * Toggles the visibility of the column.
138
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#togglevisibility)
139
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
140
+ */
141
+ toggleVisibility: (value?: boolean) => void
56
142
  }
57
143
 
58
144
  //
package/src/filterFns.ts CHANGED
@@ -69,8 +69,8 @@ const arrIncludesSome: FilterFn<any> = (
69
69
  columnId: string,
70
70
  filterValue: unknown[]
71
71
  ) => {
72
- return filterValue.some(val =>
73
- row.getValue<unknown[]>(columnId)?.includes(val)
72
+ return filterValue.some(
73
+ val => row.getValue<unknown[]>(columnId)?.includes(val)
74
74
  )
75
75
  }
76
76
 
package/src/types.ts CHANGED
@@ -242,7 +242,7 @@ export interface IdentifiedColumnDef<TData extends RowData, TValue = unknown>
242
242
 
243
243
  export type DisplayColumnDef<
244
244
  TData extends RowData,
245
- TValue = unknown
245
+ TValue = unknown,
246
246
  > = ColumnDefBase<TData, TValue> & ColumnIdentifiers<TData, TValue>
247
247
 
248
248
  interface GroupColumnDefBase<TData extends RowData, TValue = unknown>
@@ -252,7 +252,7 @@ interface GroupColumnDefBase<TData extends RowData, TValue = unknown>
252
252
 
253
253
  export type GroupColumnDef<
254
254
  TData extends RowData,
255
- TValue = unknown
255
+ TValue = unknown,
256
256
  > = GroupColumnDefBase<TData, TValue> & ColumnIdentifiers<TData, TValue>
257
257
 
258
258
  interface AccessorFnColumnDefBase<TData extends RowData, TValue = unknown>
@@ -262,7 +262,7 @@ interface AccessorFnColumnDefBase<TData extends RowData, TValue = unknown>
262
262
 
263
263
  export type AccessorFnColumnDef<
264
264
  TData extends RowData,
265
- TValue = unknown
265
+ TValue = unknown,
266
266
  > = AccessorFnColumnDefBase<TData, TValue> & ColumnIdentifiers<TData, TValue>
267
267
 
268
268
  interface AccessorKeyColumnDefBase<TData extends RowData, TValue = unknown>
@@ -273,7 +273,7 @@ interface AccessorKeyColumnDefBase<TData extends RowData, TValue = unknown>
273
273
 
274
274
  export type AccessorKeyColumnDef<
275
275
  TData extends RowData,
276
- TValue = unknown
276
+ TValue = unknown,
277
277
  > = AccessorKeyColumnDefBase<TData, TValue> &
278
278
  Partial<ColumnIdentifiers<TData, TValue>>
279
279
 
@@ -290,7 +290,7 @@ export type ColumnDef<TData extends RowData, TValue = unknown> =
290
290
 
291
291
  export type ColumnDefResolved<
292
292
  TData extends RowData,
293
- TValue = unknown
293
+ TValue = unknown,
294
294
  > = Partial<UnionToIntersection<ColumnDef<TData, TValue>>> & {
295
295
  accessorKey?: string
296
296
  }
package/src/utils.ts CHANGED
@@ -20,7 +20,7 @@ export type IsKnown<T, Y, N> = unknown extends T ? N : Y
20
20
 
21
21
  type ComputeRange<
22
22
  N extends number,
23
- Result extends Array<unknown> = []
23
+ Result extends Array<unknown> = [],
24
24
  > = Result['length'] extends N
25
25
  ? Result
26
26
  : ComputeRange<N, [...Result, Result['length']]>
@@ -36,7 +36,7 @@ type IsTuple<T> = T extends readonly any[] & { length: infer Length }
36
36
  // If this type is a tuple, what indices are allowed?
37
37
  type AllowedIndexes<
38
38
  Tuple extends ReadonlyArray<any>,
39
- Keys extends number = never
39
+ Keys extends number = never,
40
40
  > = Tuple extends readonly []
41
41
  ? Keys
42
42
  : Tuple extends readonly [infer _, ...infer Tail]
@@ -62,7 +62,7 @@ export type DeepKeys<T, TDepth extends any[] = []> = TDepth['length'] extends 5
62
62
  type DeepKeysPrefix<
63
63
  T,
64
64
  TPrefix,
65
- TDepth extends any[]
65
+ TDepth extends any[],
66
66
  > = TPrefix extends keyof T & (number | string)
67
67
  ? `${TPrefix}.${DeepKeys<T[TPrefix], [...TDepth, any]> & string}`
68
68
  : never