@tanstack/table-core 8.0.0-alpha.52 → 8.0.0-alpha.55

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 (94) hide show
  1. package/build/cjs/core.js +2 -2
  2. package/build/cjs/core.js.map +1 -1
  3. package/build/cjs/createTable.js.map +1 -1
  4. package/build/cjs/features/ColumnSizing.js.map +1 -1
  5. package/build/cjs/features/Expanding.js.map +1 -1
  6. package/build/cjs/features/Filters.js.map +1 -1
  7. package/build/cjs/features/Grouping.js.map +1 -1
  8. package/build/cjs/features/Headers.js.map +1 -1
  9. package/build/cjs/features/Ordering.js +1 -1
  10. package/build/cjs/features/Ordering.js.map +1 -1
  11. package/build/cjs/features/Pagination.js.map +1 -1
  12. package/build/cjs/features/Pinning.js.map +1 -1
  13. package/build/cjs/features/RowSelection.js.map +1 -1
  14. package/build/cjs/features/Sorting.js.map +1 -1
  15. package/build/cjs/features/Visibility.js.map +1 -1
  16. package/build/cjs/filterFns.js.map +1 -1
  17. package/build/cjs/sortingFns.js.map +1 -1
  18. package/build/cjs/utils/filterRowsUtils.js.map +1 -1
  19. package/build/cjs/utils/getColumnFilteredRowModelSync.js.map +1 -1
  20. package/build/cjs/utils/getCoreRowModelAsync.js.map +1 -1
  21. package/build/cjs/utils/getCoreRowModelSync.js.map +1 -1
  22. package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
  23. package/build/cjs/utils/getGlobalFilteredRowModelSync.js.map +1 -1
  24. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  25. package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
  26. package/build/cjs/utils/getSortedRowModelSync.js.map +1 -1
  27. package/build/cjs/utils.js +2 -2
  28. package/build/cjs/utils.js.map +1 -1
  29. package/build/esm/index.js +5 -5
  30. package/build/esm/index.js.map +1 -1
  31. package/build/stats-html.html +1 -1
  32. package/build/stats-react.json +295 -295
  33. package/build/types/core.d.ts +7 -7
  34. package/build/types/createTable.d.ts +4 -4
  35. package/build/types/features/ColumnSizing.d.ts +12 -12
  36. package/build/types/features/Expanding.d.ts +6 -6
  37. package/build/types/features/Filters.d.ts +14 -14
  38. package/build/types/features/Grouping.d.ts +16 -16
  39. package/build/types/features/Headers.d.ts +6 -6
  40. package/build/types/features/Ordering.d.ts +6 -6
  41. package/build/types/features/Pagination.d.ts +5 -5
  42. package/build/types/features/Pinning.d.ts +5 -5
  43. package/build/types/features/RowSelection.d.ts +8 -8
  44. package/build/types/features/Sorting.d.ts +12 -12
  45. package/build/types/features/Visibility.d.ts +6 -6
  46. package/build/types/filterFns.d.ts +10 -10
  47. package/build/types/sortingFns.d.ts +7 -7
  48. package/build/types/types.d.ts +22 -26
  49. package/build/types/utils/filterRowsUtils.d.ts +3 -3
  50. package/build/types/utils/getColumnFilteredRowModelAsync.d.ts +2 -2
  51. package/build/types/utils/getColumnFilteredRowModelSync.d.ts +2 -2
  52. package/build/types/utils/getCoreRowModelAsync.d.ts +2 -2
  53. package/build/types/utils/getCoreRowModelSync.d.ts +2 -2
  54. package/build/types/utils/getExpandedRowModel.d.ts +3 -3
  55. package/build/types/utils/getGlobalFilteredRowModelAsync.d.ts +2 -2
  56. package/build/types/utils/getGlobalFilteredRowModelSync.d.ts +2 -2
  57. package/build/types/utils/getGroupedRowModel.d.ts +2 -2
  58. package/build/types/utils/getPaginationRowModel.d.ts +2 -2
  59. package/build/types/utils/getSortedRowModelAsync.d.ts +4 -4
  60. package/build/types/utils/getSortedRowModelSync.d.ts +2 -2
  61. package/build/umd/index.development.js +5 -5
  62. package/build/umd/index.development.js.map +1 -1
  63. package/build/umd/index.production.js +1 -1
  64. package/build/umd/index.production.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/core.ts +9 -9
  67. package/src/createTable.ts +12 -5
  68. package/src/features/ColumnSizing.ts +14 -15
  69. package/src/features/Expanding.ts +6 -7
  70. package/src/features/Filters.ts +14 -15
  71. package/src/features/Grouping.ts +16 -17
  72. package/src/features/Headers.ts +7 -8
  73. package/src/features/Ordering.ts +11 -10
  74. package/src/features/Pagination.ts +5 -6
  75. package/src/features/Pinning.ts +5 -6
  76. package/src/features/RowSelection.ts +9 -10
  77. package/src/features/Sorting.ts +12 -13
  78. package/src/features/Visibility.ts +7 -8
  79. package/src/filterFns.ts +10 -10
  80. package/src/sortingFns.ts +7 -7
  81. package/src/types.ts +23 -29
  82. package/src/utils/filterRowsUtils.ts +3 -3
  83. package/src/utils/getColumnFilteredRowModelAsync.ts +2 -2
  84. package/src/utils/getColumnFilteredRowModelSync.ts +2 -2
  85. package/src/utils/getCoreRowModelAsync.ts +2 -2
  86. package/src/utils/getCoreRowModelSync.ts +2 -2
  87. package/src/utils/getExpandedRowModel.ts +3 -3
  88. package/src/utils/getGlobalFilteredRowModelAsync.ts +2 -2
  89. package/src/utils/getGlobalFilteredRowModelSync.ts +2 -2
  90. package/src/utils/getGroupedRowModel.ts +3 -3
  91. package/src/utils/getPaginationRowModel.ts +2 -2
  92. package/src/utils/getSortedRowModelAsync.ts +4 -4
  93. package/src/utils/getSortedRowModelSync.ts +2 -2
  94. package/src/utils.ts +2 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.0.0-alpha.52",
4
+ "version": "8.0.0-alpha.55",
5
5
  "description": "Hooks for building lightweight, fast and extendable datagrids for React",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/react-table#readme",
package/src/core.ts CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  UseRenderer,
32
32
  RowModel,
33
33
  TableFeature,
34
- AnyGenerics,
34
+ TableGenerics,
35
35
  } from './types'
36
36
 
37
37
  import { ColumnSizing } from './features/ColumnSizing'
@@ -65,7 +65,7 @@ export type CoreTableState = {
65
65
  coreProgress: number
66
66
  }
67
67
 
68
- export type CoreOptions<TGenerics extends AnyGenerics> = {
68
+ export type CoreOptions<TGenerics extends TableGenerics> = {
69
69
  data: TGenerics['Row'][]
70
70
  columns: ColumnDef<TGenerics>[]
71
71
  state: Partial<TableState>
@@ -98,7 +98,7 @@ export type CoreOptions<TGenerics extends AnyGenerics> = {
98
98
  meta?: TGenerics['TableMeta']
99
99
  }
100
100
 
101
- export type TableCore<TGenerics extends AnyGenerics> = {
101
+ export type TableCore<TGenerics extends TableGenerics> = {
102
102
  initialState: TableState
103
103
  reset: () => void
104
104
  options: RequiredKeys<Options<TGenerics>, 'state'>
@@ -164,7 +164,7 @@ export type TableCore<TGenerics extends AnyGenerics> = {
164
164
  getOverallProgress: () => number
165
165
  }
166
166
 
167
- export type CoreRow<TGenerics extends AnyGenerics> = {
167
+ export type CoreRow<TGenerics extends TableGenerics> = {
168
168
  id: string
169
169
  index: number
170
170
  original?: TGenerics['Row']
@@ -178,7 +178,7 @@ export type CoreRow<TGenerics extends AnyGenerics> = {
178
178
  getAllCellsByColumnId: () => Record<string, Cell<TGenerics>>
179
179
  }
180
180
 
181
- export type CoreColumnDef<TGenerics extends AnyGenerics> = {
181
+ export type CoreColumnDef<TGenerics extends TableGenerics> = {
182
182
  id: string
183
183
  accessorKey?: string & keyof TGenerics['Row']
184
184
  accessorFn?: AccessorFn<TGenerics['Row']>
@@ -215,7 +215,7 @@ export type CoreColumnDef<TGenerics extends AnyGenerics> = {
215
215
 
216
216
  export type CoreColumnDefType = 'data' | 'display' | 'group'
217
217
 
218
- export type CoreColumn<TGenerics extends AnyGenerics> = {
218
+ export type CoreColumn<TGenerics extends TableGenerics> = {
219
219
  id: string
220
220
  depth: number
221
221
  accessorFn?: AccessorFn<TGenerics['Row']>
@@ -228,7 +228,7 @@ export type CoreColumn<TGenerics extends AnyGenerics> = {
228
228
  getLeafColumns: () => Column<TGenerics>[]
229
229
  }
230
230
 
231
- export function createTableInstance<TGenerics extends AnyGenerics>(
231
+ export function createTableInstance<TGenerics extends TableGenerics>(
232
232
  options: Options<TGenerics>
233
233
  ): TableInstance<TGenerics> {
234
234
  if (options.debugAll || options.debugTable) {
@@ -405,7 +405,7 @@ export function createTableInstance<TGenerics extends AnyGenerics>(
405
405
  }
406
406
  ),
407
407
  getLeafColumns: memo(
408
- () => [instance.getOrderColumnsFn()],
408
+ () => [instance._getOrderColumnsFn()],
409
409
  orderColumns => {
410
410
  if (column.columns?.length) {
411
411
  let leafColumns = column.columns.flatMap(column =>
@@ -488,7 +488,7 @@ export function createTableInstance<TGenerics extends AnyGenerics>(
488
488
  ),
489
489
 
490
490
  getAllLeafColumns: memo(
491
- () => [instance.getAllColumns(), instance.getOrderColumnsFn()],
491
+ () => [instance.getAllColumns(), instance._getOrderColumnsFn()],
492
492
  (allColumns, orderColumns) => {
493
493
  let leafColumns = allColumns.flatMap(column => column.getLeafColumns())
494
494
  return orderColumns(leafColumns)
@@ -1,17 +1,24 @@
1
1
  import { CustomFilterFns, FilterFn } from './features/Filters'
2
2
  import { AggregationFn, CustomAggregationFns } from './features/Grouping'
3
3
  import { CustomSortingFns, SortingFn } from './features/Sorting'
4
- import { ColumnDef, AccessorFn, AnyRender, AnyGenerics, Options } from './types'
4
+ import {
5
+ ColumnDef,
6
+ AccessorFn,
7
+ AnyRender,
8
+ TableGenerics,
9
+ Options,
10
+ } from './types'
5
11
  import { IfDefined, Overwrite, PartialKeys } from './utils'
6
12
 
7
- export type TableFactory<TGenerics extends AnyGenerics> = () => Table<TGenerics>
13
+ export type TableFactory<TGenerics extends TableGenerics> =
14
+ () => Table<TGenerics>
8
15
 
9
16
  export type CreateTableOptions<
10
17
  TRender extends AnyRender,
11
18
  TFilterFns extends CustomFilterFns<any>,
12
19
  TSortingFns extends CustomSortingFns<any>,
13
20
  TAggregationFns extends CustomAggregationFns<any>,
14
- TGenerics extends AnyGenerics
21
+ TGenerics extends TableGenerics
15
22
  > = Partial<
16
23
  {
17
24
  render?: TRender
@@ -21,7 +28,7 @@ export type CreateTableOptions<
21
28
  } & Omit<Options<TGenerics>, 'filterFns' | 'sortingFns' | 'aggregationFns'>
22
29
  >
23
30
 
24
- export type Table<TGenerics extends AnyGenerics> = {
31
+ export type Table<TGenerics extends TableGenerics> = {
25
32
  generics: TGenerics
26
33
  options: Partial<Options<TGenerics>>
27
34
  setRowType: <TRow>() => Table<Overwrite<TGenerics, { Row: TRow }>>
@@ -125,7 +132,7 @@ export function createTableFactory<TRender extends AnyRender>(opts: {
125
132
 
126
133
  // A lot of returns in here are `as any` for a reason. Unless you
127
134
  // can find a better way to do this, then don't worry about them
128
- function createTable<TGenerics extends AnyGenerics>(
135
+ function createTable<TGenerics extends TableGenerics>(
129
136
  _?: undefined,
130
137
  __?: undefined,
131
138
  options?: CreateTableOptions<any, any, any, any, TGenerics>
@@ -3,16 +3,20 @@ import {
3
3
  Getter,
4
4
  Header,
5
5
  OnChangeFn,
6
- AnyGenerics,
7
- PartialGenerics,
6
+ TableGenerics,
8
7
  PropGetterValue,
9
8
  TableInstance,
10
9
  Updater,
11
10
  } from '../types'
12
- import { functionalUpdate, makeStateUpdater, memo, propGetter } from '../utils'
11
+ import { makeStateUpdater, propGetter } from '../utils'
13
12
 
14
13
  //
15
14
 
15
+ export type ColumnSizingTableState = {
16
+ columnSizing: ColumnSizing
17
+ columnSizingInfo: ColumnSizingInfoState
18
+ }
19
+
16
20
  export type ColumnSizing = Record<string, number>
17
21
 
18
22
  export type ColumnSizingInfoState = {
@@ -24,11 +28,6 @@ export type ColumnSizingInfoState = {
24
28
  columnSizingStart: [string, number][]
25
29
  }
26
30
 
27
- export type ColumnSizingTableState = {
28
- columnSizing: ColumnSizing
29
- columnSizingInfo: ColumnSizingInfoState
30
- }
31
-
32
31
  export type ColumnResizeMode = 'onChange' | 'onEnd'
33
32
 
34
33
  export type ColumnSizingOptions = {
@@ -52,7 +51,7 @@ export type ColumnResizerProps = {
52
51
  role?: string
53
52
  }
54
53
 
55
- export type ColumnSizingInstance<TGenerics extends AnyGenerics> = {
54
+ export type ColumnSizingInstance<TGenerics extends TableGenerics> = {
56
55
  getColumnWidth: (columnId: string) => number
57
56
  setColumnSizing: (updater: Updater<ColumnSizing>) => void
58
57
  setColumnSizingInfo: (updater: Updater<ColumnSizingInfoState>) => void
@@ -78,13 +77,13 @@ export type ColumnSizingColumnDef = {
78
77
  maxWidth?: number
79
78
  }
80
79
 
81
- export type ColumnSizingColumn<TGenerics extends AnyGenerics> = {
80
+ export type ColumnSizingColumn<TGenerics extends TableGenerics> = {
82
81
  getCanResize: () => boolean
83
82
  getIsResizing: () => boolean
84
83
  resetSize: () => void
85
84
  }
86
85
 
87
- export type ColumnSizingHeader<TGenerics extends AnyGenerics> = {
86
+ export type ColumnSizingHeader<TGenerics extends TableGenerics> = {
88
87
  getCanResize: () => boolean
89
88
  getIsResizing: () => boolean
90
89
  getResizerProps: <TGetter extends Getter<ColumnResizerProps>>(
@@ -119,7 +118,7 @@ export const ColumnSizing = {
119
118
  }
120
119
  },
121
120
 
122
- getDefaultOptions: <TGenerics extends AnyGenerics>(
121
+ getDefaultOptions: <TGenerics extends TableGenerics>(
123
122
  instance: TableInstance<TGenerics>
124
123
  ): ColumnSizingDefaultOptions => {
125
124
  return {
@@ -129,7 +128,7 @@ export const ColumnSizing = {
129
128
  }
130
129
  },
131
130
 
132
- getInstance: <TGenerics extends AnyGenerics>(
131
+ getInstance: <TGenerics extends TableGenerics>(
133
132
  instance: TableInstance<TGenerics>
134
133
  ): ColumnSizingInstance<TGenerics> => {
135
134
  return {
@@ -391,7 +390,7 @@ export const ColumnSizing = {
391
390
  }
392
391
  },
393
392
 
394
- createColumn: <TGenerics extends AnyGenerics>(
393
+ createColumn: <TGenerics extends TableGenerics>(
395
394
  column: Column<TGenerics>,
396
395
  instance: TableInstance<TGenerics>
397
396
  ): ColumnSizingColumn<TGenerics> => {
@@ -402,7 +401,7 @@ export const ColumnSizing = {
402
401
  }
403
402
  },
404
403
 
405
- createHeader: <TGenerics extends AnyGenerics>(
404
+ createHeader: <TGenerics extends TableGenerics>(
406
405
  header: Header<TGenerics>,
407
406
  instance: TableInstance<TGenerics>
408
407
  ): ColumnSizingHeader<TGenerics> => {
@@ -2,8 +2,7 @@ import { RowModel } from '..'
2
2
  import {
3
3
  Getter,
4
4
  OnChangeFn,
5
- AnyGenerics,
6
- PartialGenerics,
5
+ TableGenerics,
7
6
  PropGetterValue,
8
7
  TableInstance,
9
8
  Row,
@@ -26,7 +25,7 @@ export type ExpandedRow = {
26
25
  ) => undefined | PropGetterValue<ToggleExpandedProps, TGetter>
27
26
  }
28
27
 
29
- export type ExpandedOptions<TGenerics extends AnyGenerics> = {
28
+ export type ExpandedOptions<TGenerics extends TableGenerics> = {
30
29
  onExpandedChange?: OnChangeFn<ExpandedState>
31
30
  autoResetExpanded?: boolean
32
31
  enableExpanded?: boolean
@@ -45,7 +44,7 @@ export type ToggleExpandedProps = {
45
44
  onClick?: (event: unknown) => void
46
45
  }
47
46
 
48
- export type ExpandedInstance<TGenerics extends AnyGenerics> = {
47
+ export type ExpandedInstance<TGenerics extends TableGenerics> = {
49
48
  queueResetExpanded: () => void
50
49
  setExpanded: (updater: Updater<ExpandedState>) => void
51
50
  toggleRowExpanded: (rowId: string, expanded?: boolean) => void
@@ -78,7 +77,7 @@ export const Expanding = {
78
77
  }
79
78
  },
80
79
 
81
- getDefaultOptions: <TGenerics extends AnyGenerics>(
80
+ getDefaultOptions: <TGenerics extends TableGenerics>(
82
81
  instance: TableInstance<TGenerics>
83
82
  ): ExpandedOptions<TGenerics> => {
84
83
  return {
@@ -89,7 +88,7 @@ export const Expanding = {
89
88
  }
90
89
  },
91
90
 
92
- getInstance: <TGenerics extends AnyGenerics>(
91
+ getInstance: <TGenerics extends TableGenerics>(
93
92
  instance: TableInstance<TGenerics>
94
93
  ): ExpandedInstance<TGenerics> => {
95
94
  let registered = false
@@ -291,7 +290,7 @@ export const Expanding = {
291
290
  }
292
291
  },
293
292
 
294
- createRow: <TGenerics extends AnyGenerics>(
293
+ createRow: <TGenerics extends TableGenerics>(
295
294
  row: Row<TGenerics>,
296
295
  instance: TableInstance<TGenerics>
297
296
  ): ExpandedRow => {
@@ -3,8 +3,7 @@ import { BuiltInFilterFn, filterFns } from '../filterFns'
3
3
  import {
4
4
  Column,
5
5
  OnChangeFn,
6
- AnyGenerics,
7
- PartialGenerics,
6
+ TableGenerics,
8
7
  TableInstance,
9
8
  Row,
10
9
  Updater,
@@ -35,28 +34,28 @@ export type ColumnFilter = {
35
34
  A filter function is any function that takes an array of rows and returns an array of rows. Because filter functions can be used for both column and global filters, they are passed an array of columnIds to filter on.
36
35
  */
37
36
 
38
- export type FilterFn<TGenerics extends AnyGenerics> = {
37
+ export type FilterFn<TGenerics extends TableGenerics> = {
39
38
  (rows: Row<TGenerics>[], columnIds: string[], filterValue: any): any
40
39
  autoRemove?: ColumnFilterAutoRemoveTestFn<TGenerics>
41
40
  }
42
41
 
43
- export type ColumnFilterAutoRemoveTestFn<TGenerics extends AnyGenerics> = (
42
+ export type ColumnFilterAutoRemoveTestFn<TGenerics extends TableGenerics> = (
44
43
  value: unknown,
45
44
  column?: Column<TGenerics>
46
45
  ) => boolean
47
46
 
48
- export type CustomFilterFns<TGenerics extends AnyGenerics> = Record<
47
+ export type CustomFilterFns<TGenerics extends TableGenerics> = Record<
49
48
  string,
50
49
  FilterFn<TGenerics>
51
50
  >
52
51
 
53
- export type FilterFnOption<TGenerics extends AnyGenerics> =
52
+ export type FilterFnOption<TGenerics extends TableGenerics> =
54
53
  | 'auto'
55
54
  | BuiltInFilterFn
56
55
  | keyof TGenerics['FilterFns']
57
56
  | FilterFn<TGenerics>
58
57
 
59
- export type FiltersColumnDef<TGenerics extends AnyGenerics> = {
58
+ export type FiltersColumnDef<TGenerics extends TableGenerics> = {
60
59
  filterFn?: FilterFnOption<Overwrite<TGenerics, { Value: any }>>
61
60
  enableAllFilters?: boolean
62
61
  enableColumnFilter?: boolean
@@ -66,7 +65,7 @@ export type FiltersColumnDef<TGenerics extends AnyGenerics> = {
66
65
  defaultCanGlobalFilter?: boolean
67
66
  }
68
67
 
69
- export type FiltersColumn<TGenerics extends AnyGenerics> = {
68
+ export type FiltersColumn<TGenerics extends TableGenerics> = {
70
69
  filterFn: FilterFnOption<Overwrite<TGenerics, { Value: any }>>
71
70
  getCanColumnFilter: () => boolean
72
71
  getCanGlobalFilter: () => boolean
@@ -79,7 +78,7 @@ export type FiltersColumn<TGenerics extends AnyGenerics> = {
79
78
  getPreFilteredMinMaxValues: () => [any, any]
80
79
  }
81
80
 
82
- export type FiltersOptions<TGenerics extends AnyGenerics> = {
81
+ export type FiltersOptions<TGenerics extends TableGenerics> = {
83
82
  filterFromLeafRows?: boolean
84
83
  filterFns?: TGenerics['FilterFns']
85
84
  enableFilters?: boolean
@@ -101,7 +100,7 @@ export type FiltersOptions<TGenerics extends AnyGenerics> = {
101
100
  getColumnCanGlobalFilterFn?: (column: Column<TGenerics>) => boolean
102
101
  }
103
102
 
104
- export type FiltersInstance<TGenerics extends AnyGenerics> = {
103
+ export type FiltersInstance<TGenerics extends TableGenerics> = {
105
104
  queueResetFilters: () => void
106
105
  getColumnAutoFilterFn: (columnId: string) => FilterFn<TGenerics> | undefined
107
106
 
@@ -136,7 +135,7 @@ export type FiltersInstance<TGenerics extends AnyGenerics> = {
136
135
 
137
136
  export const Filters = {
138
137
  getDefaultColumn: <
139
- TGenerics extends AnyGenerics
138
+ TGenerics extends TableGenerics
140
139
  >(): FiltersColumnDef<TGenerics> => {
141
140
  return {
142
141
  filterFn: 'auto',
@@ -152,7 +151,7 @@ export const Filters = {
152
151
  }
153
152
  },
154
153
 
155
- getDefaultOptions: <TGenerics extends AnyGenerics>(
154
+ getDefaultOptions: <TGenerics extends TableGenerics>(
156
155
  instance: TableInstance<TGenerics>
157
156
  ): FiltersOptions<TGenerics> => {
158
157
  return {
@@ -172,7 +171,7 @@ export const Filters = {
172
171
  }
173
172
  },
174
173
 
175
- createColumn: <TGenerics extends AnyGenerics>(
174
+ createColumn: <TGenerics extends TableGenerics>(
176
175
  column: Column<TGenerics>,
177
176
  instance: TableInstance<TGenerics>
178
177
  ): FiltersColumn<TGenerics> => {
@@ -231,7 +230,7 @@ export const Filters = {
231
230
  }
232
231
  },
233
232
 
234
- getInstance: <TGenerics extends AnyGenerics>(
233
+ getInstance: <TGenerics extends TableGenerics>(
235
234
  instance: TableInstance<TGenerics>
236
235
  ): FiltersInstance<TGenerics> => {
237
236
  let registered = false
@@ -498,7 +497,7 @@ export const Filters = {
498
497
  },
499
498
  }
500
499
 
501
- export function shouldAutoRemoveFilter<TGenerics extends AnyGenerics>(
500
+ export function shouldAutoRemoveFilter<TGenerics extends TableGenerics>(
502
501
  filterFn?: FilterFn<TGenerics>,
503
502
  value?: any,
504
503
  column?: Column<TGenerics>
@@ -9,10 +9,9 @@ import {
9
9
  TableInstance,
10
10
  Row,
11
11
  Updater,
12
- PartialGenerics,
13
12
  Renderable,
14
13
  UseRenderer,
15
- AnyGenerics,
14
+ TableGenerics,
16
15
  } from '../types'
17
16
  import {
18
17
  functionalUpdate,
@@ -25,17 +24,17 @@ import {
25
24
 
26
25
  export type GroupingState = string[]
27
26
 
28
- export type AggregationFn<TGenerics extends AnyGenerics> = (
27
+ export type AggregationFn<TGenerics extends TableGenerics> = (
29
28
  getLeafValues: () => TGenerics['Row'][],
30
29
  getChildValues: () => TGenerics['Row'][]
31
30
  ) => any
32
31
 
33
- export type CustomAggregationFns<TGenerics extends AnyGenerics> = Record<
32
+ export type CustomAggregationFns<TGenerics extends TableGenerics> = Record<
34
33
  string,
35
34
  AggregationFn<TGenerics>
36
35
  >
37
36
 
38
- export type AggregationFnOption<TGenerics extends AnyGenerics> =
37
+ export type AggregationFnOption<TGenerics extends TableGenerics> =
39
38
  | 'auto'
40
39
  | BuiltInAggregationFn
41
40
  | keyof TGenerics['AggregationFns']
@@ -45,7 +44,7 @@ export type GroupingTableState = {
45
44
  grouping: GroupingState
46
45
  }
47
46
 
48
- export type GroupingColumnDef<TGenerics extends AnyGenerics> = {
47
+ export type GroupingColumnDef<TGenerics extends TableGenerics> = {
49
48
  aggregationFn?: AggregationFnOption<Overwrite<TGenerics, { Value: any }>>
50
49
  aggregateValue?: (columnValue: unknown) => any
51
50
  aggregatedCell?: Renderable<
@@ -62,7 +61,7 @@ export type GroupingColumnDef<TGenerics extends AnyGenerics> = {
62
61
  defaultCanGroup?: boolean
63
62
  }
64
63
 
65
- export type GroupingColumn<TGenerics extends AnyGenerics> = {
64
+ export type GroupingColumn<TGenerics extends TableGenerics> = {
66
65
  aggregationFn?: AggregationFnOption<Overwrite<TGenerics, { Value: any }>>
67
66
  getCanGroup: () => boolean
68
67
  getIsGrouped: () => boolean
@@ -79,7 +78,7 @@ export type GroupingRow = {
79
78
  getIsGrouped: () => boolean
80
79
  }
81
80
 
82
- export type GroupingCell<TGenerics extends AnyGenerics> = {
81
+ export type GroupingCell<TGenerics extends TableGenerics> = {
83
82
  getIsGrouped: () => boolean
84
83
  getIsPlaceholder: () => boolean
85
84
  getIsAggregated: () => boolean
@@ -93,7 +92,7 @@ export type ColumnDefaultOptions = {
93
92
  enableGrouping: boolean
94
93
  }
95
94
 
96
- export type GroupingOptions<TGenerics extends AnyGenerics> = {
95
+ export type GroupingOptions<TGenerics extends TableGenerics> = {
97
96
  aggregationFns?: TGenerics['AggregationFns']
98
97
  onGroupingChange?: OnChangeFn<GroupingState>
99
98
  autoResetGrouping?: boolean
@@ -113,7 +112,7 @@ export type ToggleGroupingProps = {
113
112
  onClick?: (event: unknown) => void
114
113
  }
115
114
 
116
- export type GroupingInstance<TGenerics extends AnyGenerics> = {
115
+ export type GroupingInstance<TGenerics extends TableGenerics> = {
117
116
  queueResetGrouping: () => void
118
117
  getColumnAutoAggregationFn: (
119
118
  columnId: string
@@ -141,7 +140,7 @@ export type GroupingInstance<TGenerics extends AnyGenerics> = {
141
140
 
142
141
  export const Grouping = {
143
142
  getDefaultColumn: <
144
- TGenerics extends AnyGenerics
143
+ TGenerics extends TableGenerics
145
144
  >(): GroupingColumnDef<TGenerics> => {
146
145
  return {
147
146
  aggregationFn: 'auto',
@@ -154,7 +153,7 @@ export const Grouping = {
154
153
  }
155
154
  },
156
155
 
157
- getDefaultOptions: <TGenerics extends AnyGenerics>(
156
+ getDefaultOptions: <TGenerics extends TableGenerics>(
158
157
  instance: TableInstance<TGenerics>
159
158
  ): GroupingOptions<TGenerics> => {
160
159
  return {
@@ -164,7 +163,7 @@ export const Grouping = {
164
163
  }
165
164
  },
166
165
 
167
- createColumn: <TGenerics extends AnyGenerics>(
166
+ createColumn: <TGenerics extends TableGenerics>(
168
167
  column: Column<TGenerics>,
169
168
  instance: TableInstance<TGenerics>
170
169
  ): GroupingColumn<TGenerics> => {
@@ -179,7 +178,7 @@ export const Grouping = {
179
178
  }
180
179
  },
181
180
 
182
- getInstance: <TGenerics extends AnyGenerics>(
181
+ getInstance: <TGenerics extends TableGenerics>(
183
182
  instance: TableInstance<TGenerics>
184
183
  ): GroupingInstance<TGenerics> => {
185
184
  let registered = false
@@ -316,7 +315,7 @@ export const Grouping = {
316
315
  }
317
316
  },
318
317
 
319
- createRow: <TGenerics extends AnyGenerics>(
318
+ createRow: <TGenerics extends TableGenerics>(
320
319
  row: Row<TGenerics>,
321
320
  instance: TableInstance<TGenerics>
322
321
  ): GroupingRow => {
@@ -325,7 +324,7 @@ export const Grouping = {
325
324
  }
326
325
  },
327
326
 
328
- createCell: <TGenerics extends AnyGenerics>(
327
+ createCell: <TGenerics extends TableGenerics>(
329
328
  cell: Cell<TGenerics>,
330
329
  column: Column<TGenerics>,
331
330
  row: Row<TGenerics>,
@@ -355,7 +354,7 @@ export const Grouping = {
355
354
  }
356
355
  },
357
356
 
358
- orderColumns: <TGenerics extends AnyGenerics>(
357
+ orderColumns: <TGenerics extends TableGenerics>(
359
358
  leafColumns: Column<TGenerics>[],
360
359
  grouping: string[],
361
360
  groupedColumnMode?: GroupingColumnMode
@@ -9,8 +9,7 @@ import {
9
9
  HeaderGroup,
10
10
  HeaderGroupProps,
11
11
  HeaderProps,
12
- AnyGenerics,
13
- PartialGenerics,
12
+ TableGenerics,
14
13
  PropGetterValue,
15
14
  TableInstance,
16
15
  Row,
@@ -18,7 +17,7 @@ import {
18
17
  import { propGetter, memo } from '../utils'
19
18
  import { ColumnSizing } from './ColumnSizing'
20
19
 
21
- export type HeadersRow<TGenerics extends AnyGenerics> = {
20
+ export type HeadersRow<TGenerics extends TableGenerics> = {
22
21
  _getAllVisibleCells: () => Cell<TGenerics>[]
23
22
  getVisibleCells: () => Cell<TGenerics>[]
24
23
  getLeftVisibleCells: () => Cell<TGenerics>[]
@@ -26,7 +25,7 @@ export type HeadersRow<TGenerics extends AnyGenerics> = {
26
25
  getRightVisibleCells: () => Cell<TGenerics>[]
27
26
  }
28
27
 
29
- export type HeadersInstance<TGenerics extends AnyGenerics> = {
28
+ export type HeadersInstance<TGenerics extends TableGenerics> = {
30
29
  createHeader: (
31
30
  column: Column<TGenerics>,
32
31
  options: {
@@ -80,7 +79,7 @@ export type HeadersInstance<TGenerics extends AnyGenerics> = {
80
79
  //
81
80
 
82
81
  export const Headers = {
83
- createRow: <TGenerics extends AnyGenerics>(
82
+ createRow: <TGenerics extends TableGenerics>(
84
83
  row: Row<TGenerics>,
85
84
  instance: TableInstance<TGenerics>
86
85
  ): HeadersRow<TGenerics> => {
@@ -120,7 +119,7 @@ export const Headers = {
120
119
  instance.getState().columnPinning.right,
121
120
  ],
122
121
  (allCells, left, right) => {
123
- const leftAndRight = [...(left ?? []), ...(right ?? [])]
122
+ const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]
124
123
 
125
124
  return allCells.filter(d => !leftAndRight.includes(d.columnId))
126
125
  },
@@ -167,7 +166,7 @@ export const Headers = {
167
166
  }
168
167
  },
169
168
 
170
- getInstance: <TGenerics extends AnyGenerics>(
169
+ getInstance: <TGenerics extends TableGenerics>(
171
170
  instance: TableInstance<TGenerics>
172
171
  ): HeadersInstance<TGenerics> => {
173
172
  return {
@@ -607,7 +606,7 @@ export const Headers = {
607
606
  },
608
607
  }
609
608
 
610
- export function buildHeaderGroups<TGenerics extends AnyGenerics>(
609
+ export function buildHeaderGroups<TGenerics extends TableGenerics>(
611
610
  allColumns: Column<TGenerics>[],
612
611
  columnsToGroup: Column<TGenerics>[],
613
612
  instance: TableInstance<TGenerics>,
@@ -1,22 +1,21 @@
1
- import { functionalUpdate, makeStateUpdater, memo } from '../utils'
1
+ import { makeStateUpdater, memo } from '../utils'
2
2
 
3
3
  import {
4
4
  TableInstance,
5
5
  OnChangeFn,
6
6
  Updater,
7
7
  Column,
8
- AnyGenerics,
9
- PartialGenerics,
8
+ TableGenerics,
10
9
  } from '../types'
11
10
 
12
11
  import { Grouping } from './Grouping'
13
12
 
14
- export type ColumnOrderState = string[]
15
-
16
13
  export type ColumnOrderTableState = {
17
14
  columnOrder: ColumnOrderState
18
15
  }
19
16
 
17
+ export type ColumnOrderState = string[]
18
+
20
19
  export type ColumnOrderOptions = {
21
20
  onColumnOrderChange?: OnChangeFn<ColumnOrderState>
22
21
  }
@@ -25,10 +24,12 @@ export type ColumnOrderDefaultOptions = {
25
24
  onColumnOrderChange: OnChangeFn<ColumnOrderState>
26
25
  }
27
26
 
28
- export type ColumnOrderInstance<TGenerics extends AnyGenerics> = {
27
+ export type ColumnOrderInstance<TGenerics extends TableGenerics> = {
29
28
  setColumnOrder: (updater: Updater<ColumnOrderState>) => void
30
29
  resetColumnOrder: () => void
31
- getOrderColumnsFn: () => (columns: Column<TGenerics>[]) => Column<TGenerics>[]
30
+ _getOrderColumnsFn: () => (
31
+ columns: Column<TGenerics>[]
32
+ ) => Column<TGenerics>[]
32
33
  }
33
34
 
34
35
  //
@@ -40,7 +41,7 @@ export const Ordering = {
40
41
  }
41
42
  },
42
43
 
43
- getDefaultOptions: <TGenerics extends AnyGenerics>(
44
+ getDefaultOptions: <TGenerics extends TableGenerics>(
44
45
  instance: TableInstance<TGenerics>
45
46
  ): ColumnOrderDefaultOptions => {
46
47
  return {
@@ -48,7 +49,7 @@ export const Ordering = {
48
49
  }
49
50
  },
50
51
 
51
- getInstance: <TGenerics extends AnyGenerics>(
52
+ getInstance: <TGenerics extends TableGenerics>(
52
53
  instance: TableInstance<TGenerics>
53
54
  ): ColumnOrderInstance<TGenerics> => {
54
55
  return {
@@ -57,7 +58,7 @@ export const Ordering = {
57
58
  resetColumnOrder: () => {
58
59
  instance.setColumnOrder(instance.initialState.columnOrder ?? [])
59
60
  },
60
- getOrderColumnsFn: memo(
61
+ _getOrderColumnsFn: memo(
61
62
  () => [
62
63
  instance.getState().columnOrder,
63
64
  instance.getState().grouping,