@tanstack/table-core 8.0.0-alpha.42 → 8.0.0-alpha.45

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 (71) hide show
  1. package/build/cjs/{aggregationTypes.js → aggregationFns.js} +3 -3
  2. package/build/cjs/aggregationFns.js.map +1 -0
  3. package/build/cjs/core.js +6 -4
  4. package/build/cjs/core.js.map +1 -1
  5. package/build/cjs/createTable.js +25 -18
  6. package/build/cjs/createTable.js.map +1 -1
  7. package/build/cjs/features/Filters.js +13 -13
  8. package/build/cjs/features/Filters.js.map +1 -1
  9. package/build/cjs/features/Grouping.js +8 -8
  10. package/build/cjs/features/Grouping.js.map +1 -1
  11. package/build/cjs/features/RowSelection.js.map +1 -1
  12. package/build/cjs/features/Sorting.js +10 -10
  13. package/build/cjs/features/Sorting.js.map +1 -1
  14. package/build/cjs/{filterTypes.js → filterFns.js} +3 -3
  15. package/build/cjs/filterFns.js.map +1 -0
  16. package/build/cjs/index.js +1 -1
  17. package/build/cjs/{sortTypes.js → sortingFns.js} +3 -3
  18. package/build/cjs/sortingFns.js.map +1 -0
  19. package/build/cjs/utils/getColumnFilteredRowModelSync.js +3 -3
  20. package/build/cjs/utils/getColumnFilteredRowModelSync.js.map +1 -1
  21. package/build/cjs/utils/getExpandedRowModel.js +1 -1
  22. package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
  23. package/build/cjs/utils/getGlobalFilteredRowModelSync.js +1 -1
  24. package/build/cjs/utils/getGlobalFilteredRowModelSync.js.map +1 -1
  25. package/build/cjs/utils/getGroupedRowModel.js +2 -2
  26. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  27. package/build/cjs/utils/getPaginationRowModel.js +1 -1
  28. package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
  29. package/build/cjs/utils/getSortedRowModelSync.js +1 -1
  30. package/build/cjs/utils/getSortedRowModelSync.js.map +1 -1
  31. package/build/cjs/utils.js +7 -0
  32. package/build/cjs/utils.js.map +1 -1
  33. package/build/esm/index.js +75 -59
  34. package/build/esm/index.js.map +1 -1
  35. package/build/stats-html.html +1 -1
  36. package/build/stats-react.json +323 -323
  37. package/build/types/{aggregationTypes.d.ts → aggregationFns.d.ts} +2 -2
  38. package/build/types/createTable.d.ts +28 -25
  39. package/build/types/features/Filters.d.ts +5 -5
  40. package/build/types/features/Grouping.d.ts +4 -4
  41. package/build/types/features/Sorting.d.ts +4 -4
  42. package/build/types/{filterTypes.d.ts → filterFns.d.ts} +2 -2
  43. package/build/types/{sortTypes.d.ts → sortingFns.d.ts} +2 -2
  44. package/build/types/utils.d.ts +1 -0
  45. package/build/umd/index.development.js +75 -59
  46. package/build/umd/index.development.js.map +1 -1
  47. package/build/umd/index.production.js +1 -1
  48. package/build/umd/index.production.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/{aggregationTypes.ts → aggregationFns.ts} +2 -2
  51. package/src/core.ts +3 -3
  52. package/src/createTable.ts +73 -52
  53. package/src/features/Filters.ts +22 -22
  54. package/src/features/Grouping.ts +16 -16
  55. package/src/features/RowSelection.ts +1 -1
  56. package/src/features/Sorting.ts +17 -17
  57. package/src/{filterTypes.ts → filterFns.ts} +2 -2
  58. package/src/{sortTypes.ts → sortingFns.ts} +2 -2
  59. package/src/utils/getColumnFilteredRowModelAsync.ts +5 -2
  60. package/src/utils/getColumnFilteredRowModelSync.ts +6 -3
  61. package/src/utils/getExpandedRowModel.ts +1 -1
  62. package/src/utils/getGlobalFilteredRowModelAsync.ts +4 -1
  63. package/src/utils/getGlobalFilteredRowModelSync.ts +4 -1
  64. package/src/utils/getGroupedRowModel.ts +2 -2
  65. package/src/utils/getPaginationRowModel.ts +4 -1
  66. package/src/utils/getSortedRowModelAsync.ts +1 -1
  67. package/src/utils/getSortedRowModelSync.ts +1 -1
  68. package/src/utils.ts +12 -1
  69. package/build/cjs/aggregationTypes.js.map +0 -1
  70. package/build/cjs/filterTypes.js.map +0 -1
  71. package/build/cjs/sortTypes.js.map +0 -1
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.42",
4
+ "version": "8.0.0-alpha.45",
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",
@@ -1,4 +1,4 @@
1
- export const aggregationTypes = {
1
+ export const aggregationFns = {
2
2
  sum,
3
3
  min,
4
4
  max,
@@ -10,7 +10,7 @@ export const aggregationTypes = {
10
10
  count,
11
11
  }
12
12
 
13
- export type BuiltInAggregationType = keyof typeof aggregationTypes
13
+ export type BuiltInAggregationType = keyof typeof aggregationFns
14
14
 
15
15
  function sum(_getLeafValues: () => unknown[], getChildValues: () => unknown[]) {
16
16
  // It's faster to just add the aggregations together instead of
package/src/core.ts CHANGED
@@ -26,7 +26,6 @@ import {
26
26
  CellProps,
27
27
  TableInstance,
28
28
  RowValues,
29
- PartialGenerics,
30
29
  CoreCell,
31
30
  Renderable,
32
31
  UseRenderer,
@@ -46,7 +45,7 @@ import { RowSelection } from './features/RowSelection'
46
45
  import { Sorting } from './features/Sorting'
47
46
  import { Visibility } from './features/Visibility'
48
47
  import { Headers } from './features/Headers'
49
- import { mean } from './aggregationTypes'
48
+ import { mean } from './aggregationFns'
50
49
 
51
50
  const features: TableFeature[] = [
52
51
  Headers,
@@ -310,7 +309,8 @@ export function createTableInstance<TGenerics extends AnyGenerics>(
310
309
  return template
311
310
  },
312
311
 
313
- getRowId: (_: TGenerics['Row'], index: number, parent?: Row<TGenerics>) =>
312
+ getRowId: (row: TGenerics['Row'], index: number, parent?: Row<TGenerics>) =>
313
+ instance.options.getRowId?.(row, index, parent) ??
314
314
  `${parent ? [parent.id, index].join('.') : index}`,
315
315
 
316
316
  getState: () => {
@@ -1,38 +1,60 @@
1
- import { CustomFilterTypes } from './features/Filters'
2
- import { CustomAggregationTypes } from './features/Grouping'
3
- import { CustomSortingTypes } from './features/Sorting'
4
- import {
5
- ColumnDef,
6
- AccessorFn,
7
- PartialGenerics,
8
- AnyRender,
9
- AnyGenerics,
10
- } from './types'
11
- import { Overwrite, PartialKeys } from './utils'
1
+ import { CustomFilterTypes, FilterFn } from './features/Filters'
2
+ import { AggregationFn, CustomAggregationTypes } from './features/Grouping'
3
+ import { CustomSortingTypes, SortingFn } from './features/Sorting'
4
+ import { ColumnDef, AccessorFn, AnyRender, AnyGenerics, Options } from './types'
5
+ import { IfDefined, Overwrite, PartialKeys } from './utils'
12
6
 
13
- export type CreateTableFactory<TGenerics extends AnyGenerics> = <
14
- TSubGenerics extends {
15
- Row: any
16
- ColumnMeta?: object
17
- TableMeta?: object
18
- }
19
- >() => Table<Overwrite<TGenerics, TSubGenerics>>
7
+ export type TableFactory<TGenerics extends AnyGenerics> = () => Table<TGenerics>
20
8
 
21
- export type CreateTableFactoryOptions<
9
+ export type CreateTableOptions<
22
10
  TRender extends AnyRender,
23
11
  TFilterFns extends CustomFilterTypes<any>,
24
12
  TSortingFns extends CustomSortingTypes<any>,
25
- TAggregationFns extends CustomAggregationTypes<any>
26
- > = {
27
- render: TRender
28
- filterFns?: TFilterFns
29
- sortingFns?: TSortingFns
30
- aggregationFns?: TAggregationFns
31
- }
13
+ TAggregationFns extends CustomAggregationTypes<any>,
14
+ TGenerics extends AnyGenerics
15
+ > = Partial<
16
+ {
17
+ render?: TRender
18
+ filterFns?: TFilterFns
19
+ sortingFns?: TSortingFns
20
+ aggregationFns?: TAggregationFns
21
+ } & Omit<Options<TGenerics>, 'filterFns' | 'sortingFns' | 'aggregationFns'>
22
+ >
32
23
 
33
24
  export type Table<TGenerics extends AnyGenerics> = {
34
25
  generics: TGenerics
35
- __options: CreateTableFactoryOptions<any, any, any, any>
26
+ options: Partial<Options<TGenerics>>
27
+ setRowType: <TRow extends object>() => Table<
28
+ Overwrite<TGenerics, { Row: TRow }>
29
+ >
30
+ setTableMetaType: <TTableMeta extends object>() => Table<
31
+ Overwrite<TGenerics, { TableMeta: TTableMeta }>
32
+ >
33
+ setColumnMetaType: <TColumnMeta extends object>() => Table<
34
+ Overwrite<TGenerics, { ColumnMeta: TColumnMeta }>
35
+ >
36
+ setOptions: <
37
+ TFilterFns extends Record<string, FilterFn<any>>,
38
+ TSortingFns extends Record<string, SortingFn<any>>,
39
+ TAggregationFns extends Record<string, AggregationFn<any>>
40
+ >(
41
+ options: CreateTableOptions<
42
+ any,
43
+ TFilterFns,
44
+ TSortingFns,
45
+ TAggregationFns,
46
+ TGenerics
47
+ >
48
+ ) => Table<
49
+ Overwrite<
50
+ TGenerics,
51
+ {
52
+ FilterFns: IfDefined<TFilterFns, TGenerics['FilterFns']>
53
+ SortingFns: IfDefined<TSortingFns, TGenerics['SortingFns']>
54
+ AggregationFns: IfDefined<TAggregationFns, TGenerics['AggregationFns']>
55
+ }
56
+ >
57
+ >
36
58
  createColumns: <TColumnDef extends ColumnDef<any>>(
37
59
  columns: TColumnDef[]
38
60
  ) => TColumnDef[]
@@ -95,39 +117,36 @@ export type Table<TGenerics extends AnyGenerics> = {
95
117
  ) => ColumnDef<TGenerics>
96
118
  }
97
119
 
98
- type InitTable<TRender extends AnyRender> = {
99
- createTableFactory: <TGenerics extends AnyGenerics>(
100
- options: CreateTableFactoryOptions<TRender, any, any, any>
101
- ) => CreateTableFactory<Overwrite<TGenerics, { Render: TRender }>>
102
- createTable: CreateTableFactory<
103
- Overwrite<PartialGenerics, { Render: TRender }>
104
- >
105
- }
106
-
107
120
  //
108
121
 
109
- export function init<TRender extends AnyRender>(opts: {
122
+ export function createTableFactory<TRender extends AnyRender>(opts: {
110
123
  render: TRender
111
- }): InitTable<TRender> {
112
- return {
113
- createTableFactory: factoryOptions => () =>
114
- _createTable(undefined, undefined, { ...factoryOptions, ...opts }),
115
- createTable: () => _createTable(undefined, undefined, opts),
116
- }
124
+ }): () => Table<{ Render: TRender }> {
125
+ return () => createTable(undefined, undefined, opts)
117
126
  }
118
127
 
119
- function _createTable<TGenerics extends AnyGenerics>(
120
- _: undefined,
121
- __: undefined,
122
- __options: CreateTableFactoryOptions<any, any, any, any>
128
+ // A lot of returns in here are `as any` for a reason. Unless you
129
+ // can find a better way to do this, then don't worry about them
130
+ function createTable<TGenerics extends AnyGenerics>(
131
+ _?: undefined,
132
+ __?: undefined,
133
+ options?: CreateTableOptions<any, any, any, any, TGenerics>
123
134
  ): Table<TGenerics> {
124
- return {
135
+ const table: Table<TGenerics> = {
125
136
  generics: undefined!,
126
- __options: __options ?? {
127
- render: () => {
128
- throw new Error()
129
- },
137
+ options: options ?? {
138
+ render: (() => {
139
+ throw new Error('')
140
+ })(),
130
141
  },
142
+ setRowType: () => table as any,
143
+ setTableMetaType: () => table as any,
144
+ setColumnMetaType: () => table as any,
145
+ setOptions: newOptions =>
146
+ createTable(_, __, {
147
+ ...options,
148
+ ...newOptions,
149
+ } as any),
131
150
  createColumns: columns => columns,
132
151
  createDisplayColumn: column => ({ ...column, columnDefType: 'display' }),
133
152
  createGroup: column => ({ ...column, columnDefType: 'group' } as any),
@@ -156,4 +175,6 @@ function _createTable<TGenerics extends AnyGenerics>(
156
175
  throw new Error('Invalid accessor')
157
176
  },
158
177
  }
178
+
179
+ return table
159
180
  }
@@ -1,5 +1,5 @@
1
1
  import { RowModel } from '..'
2
- import { BuiltInFilterType, filterTypes } from '../filterTypes'
2
+ import { BuiltInFilterType, filterFns } from '../filterFns'
3
3
  import {
4
4
  Column,
5
5
  OnChangeFn,
@@ -49,11 +49,11 @@ export type FiltersTableState = {
49
49
  export type FilterType<TGenerics extends AnyGenerics> =
50
50
  | 'auto'
51
51
  | BuiltInFilterType
52
- | TGenerics['FilterFns']
52
+ | keyof TGenerics['FilterFns']
53
53
  | FilterFn<TGenerics>
54
54
 
55
55
  export type FiltersColumnDef<TGenerics extends AnyGenerics> = {
56
- filterType?: FilterType<Overwrite<TGenerics, { Value: any }>>
56
+ filterFn?: FilterType<Overwrite<TGenerics, { Value: any }>>
57
57
  enableAllFilters?: boolean
58
58
  enableColumnFilter?: boolean
59
59
  enableGlobalFilter?: boolean
@@ -63,7 +63,7 @@ export type FiltersColumnDef<TGenerics extends AnyGenerics> = {
63
63
  }
64
64
 
65
65
  export type FiltersColumn<TGenerics extends AnyGenerics> = {
66
- filterType: FilterType<Overwrite<TGenerics, { Value: any }>>
66
+ filterFn: FilterType<Overwrite<TGenerics, { Value: any }>>
67
67
  getCanColumnFilter: () => boolean
68
68
  getCanGlobalFilter: () => boolean
69
69
  getColumnFilterIndex: () => number
@@ -77,7 +77,7 @@ export type FiltersColumn<TGenerics extends AnyGenerics> = {
77
77
 
78
78
  export type FiltersOptions<TGenerics extends AnyGenerics> = {
79
79
  filterFromLeafRows?: boolean
80
- filterTypes?: TGenerics['FilterFns']
80
+ filterFns?: TGenerics['FilterFns']
81
81
  enableFilters?: boolean
82
82
  // Column
83
83
  onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>
@@ -139,7 +139,7 @@ export const Filters = {
139
139
  TGenerics extends AnyGenerics
140
140
  >(): FiltersColumnDef<TGenerics> => {
141
141
  return {
142
- filterType: 'auto',
142
+ filterFn: 'auto',
143
143
  }
144
144
  },
145
145
 
@@ -217,7 +217,7 @@ export const Filters = {
217
217
  )
218
218
 
219
219
  return {
220
- filterType: column.filterType,
220
+ filterFn: column.filterFn,
221
221
  getCanColumnFilter: () => instance.getColumnCanColumnFilter(column.id),
222
222
  getCanGlobalFilter: () => instance.getColumnCanGlobalFilter(column.id),
223
223
  getColumnFilterIndex: () => instance.getColumnFilterIndex(column.id),
@@ -269,48 +269,48 @@ export const Filters = {
269
269
  const value = firstRow?.values[columnId]
270
270
 
271
271
  if (typeof value === 'string') {
272
- return filterTypes.includesString
272
+ return filterFns.includesString
273
273
  }
274
274
 
275
275
  if (typeof value === 'number') {
276
- return filterTypes.betweenNumberRange
276
+ return filterFns.betweenNumberRange
277
277
  }
278
278
 
279
279
  if (value !== null && typeof value === 'object') {
280
- return filterTypes.equals
280
+ return filterFns.equals
281
281
  }
282
282
 
283
283
  if (Array.isArray(value)) {
284
- return filterTypes.arrIncludes
284
+ return filterFns.arrIncludes
285
285
  }
286
286
 
287
- return filterTypes.weakEquals
287
+ return filterFns.weakEquals
288
288
  },
289
289
  getGlobalAutoFilterFn: () => {
290
- return filterTypes.includesString
290
+ return filterFns.includesString
291
291
  },
292
292
  getColumnFilterFn: columnId => {
293
293
  const column = instance.getColumn(columnId)
294
- const userFilterTypes = instance.options.filterTypes
294
+ const userFilterTypes = instance.options.filterFns
295
295
 
296
296
  if (!column) {
297
297
  throw new Error()
298
298
  }
299
299
 
300
- return isFunction(column.filterType)
301
- ? column.filterType
302
- : column.filterType === 'auto'
300
+ return isFunction(column.filterFn)
301
+ ? column.filterFn
302
+ : column.filterFn === 'auto'
303
303
  ? instance.getColumnAutoFilterFn(columnId)
304
304
  : (userFilterTypes as Record<string, any>)?.[
305
- column.filterType as string
305
+ column.filterFn as string
306
306
  ] ??
307
- (filterTypes[
308
- column.filterType as BuiltInFilterType
307
+ (filterFns[
308
+ column.filterFn as BuiltInFilterType
309
309
  ] as FilterFn<TGenerics>)
310
310
  },
311
311
 
312
312
  getGlobalFilterFn: () => {
313
- const { filterTypes: userFilterTypes, globalFilterType } =
313
+ const { filterFns: userFilterTypes, globalFilterType } =
314
314
  instance.options
315
315
 
316
316
  return isFunction(globalFilterType)
@@ -320,7 +320,7 @@ export const Filters = {
320
320
  : (userFilterTypes as Record<string, any>)?.[
321
321
  globalFilterType as string
322
322
  ] ??
323
- (filterTypes[
323
+ (filterFns[
324
324
  globalFilterType as BuiltInFilterType
325
325
  ] as FilterFn<TGenerics>)
326
326
  },
@@ -1,5 +1,5 @@
1
1
  import { RowModel } from '..'
2
- import { BuiltInAggregationType, aggregationTypes } from '../aggregationTypes'
2
+ import { BuiltInAggregationType, aggregationFns } from '../aggregationFns'
3
3
  import {
4
4
  Cell,
5
5
  Column,
@@ -46,7 +46,7 @@ export type GroupingTableState = {
46
46
  }
47
47
 
48
48
  export type GroupingColumnDef<TGenerics extends AnyGenerics> = {
49
- aggregationType?: AggregationType<Overwrite<TGenerics, { Value: any }>>
49
+ aggregationFn?: AggregationType<Overwrite<TGenerics, { Value: any }>>
50
50
  aggregateValue?: (columnValue: unknown) => any
51
51
  aggregatedCell?: Renderable<
52
52
  TGenerics,
@@ -63,7 +63,7 @@ export type GroupingColumnDef<TGenerics extends AnyGenerics> = {
63
63
  }
64
64
 
65
65
  export type GroupingColumn<TGenerics extends AnyGenerics> = {
66
- aggregationType?: AggregationType<Overwrite<TGenerics, { Value: any }>>
66
+ aggregationFn?: AggregationType<Overwrite<TGenerics, { Value: any }>>
67
67
  getCanGroup: () => boolean
68
68
  getIsGrouped: () => boolean
69
69
  getGroupedIndex: () => number
@@ -94,7 +94,7 @@ export type ColumnDefaultOptions = {
94
94
  }
95
95
 
96
96
  export type GroupingOptions<TGenerics extends AnyGenerics> = {
97
- aggregationTypes?: TGenerics['AggregationFns']
97
+ aggregationFns?: TGenerics['AggregationFns']
98
98
  onGroupingChange?: OnChangeFn<GroupingState>
99
99
  autoResetGrouping?: boolean
100
100
  enableGrouping?: boolean
@@ -144,7 +144,7 @@ export const Grouping = {
144
144
  TGenerics extends AnyGenerics
145
145
  >(): GroupingColumnDef<TGenerics> => {
146
146
  return {
147
- aggregationType: 'auto',
147
+ aggregationFn: 'auto',
148
148
  }
149
149
  },
150
150
 
@@ -169,7 +169,7 @@ export const Grouping = {
169
169
  instance: TableInstance<TGenerics>
170
170
  ): GroupingColumn<TGenerics> => {
171
171
  return {
172
- aggregationType: column.aggregationType,
172
+ aggregationFn: column.aggregationFn,
173
173
  getCanGroup: () => instance.getColumnCanGroup(column.id),
174
174
  getGroupedIndex: () => instance.getColumnGroupedIndex(column.id),
175
175
  getIsGrouped: () => instance.getColumnIsGrouped(column.id),
@@ -210,32 +210,32 @@ export const Grouping = {
210
210
  const value = firstRow?.values[columnId]
211
211
 
212
212
  if (typeof value === 'number') {
213
- return aggregationTypes.sum
213
+ return aggregationFns.sum
214
214
  }
215
215
 
216
216
  if (Object.prototype.toString.call(value) === '[object Date]') {
217
- return aggregationTypes.extent
217
+ return aggregationFns.extent
218
218
  }
219
219
 
220
- return aggregationTypes.count
220
+ return aggregationFns.count
221
221
  },
222
222
  getColumnAggregationFn: columnId => {
223
223
  const column = instance.getColumn(columnId)
224
- const userAggregationTypes = instance.options.aggregationTypes
224
+ const userAggregationTypes = instance.options.aggregationFns
225
225
 
226
226
  if (!column) {
227
227
  throw new Error()
228
228
  }
229
229
 
230
- return isFunction(column.aggregationType)
231
- ? column.aggregationType
232
- : column.aggregationType === 'auto'
230
+ return isFunction(column.aggregationFn)
231
+ ? column.aggregationFn
232
+ : column.aggregationFn === 'auto'
233
233
  ? instance.getColumnAutoAggregationFn(columnId)
234
234
  : (userAggregationTypes as Record<string, any>)?.[
235
- column.aggregationType as string
235
+ column.aggregationFn as string
236
236
  ] ??
237
- (aggregationTypes[
238
- column.aggregationType as BuiltInAggregationType
237
+ (aggregationFns[
238
+ column.aggregationFn as BuiltInAggregationType
239
239
  ] as AggregationFn<TGenerics>)
240
240
  },
241
241
 
@@ -591,7 +591,7 @@ export function selectRowsFn<TGenerics extends AnyGenerics>(
591
591
  const newSelectedRowsById: Record<string, Row<TGenerics>> = {}
592
592
 
593
593
  // Filters top level and nested rows
594
- const recurseRows = (rows: Row<TGenerics>[], depth = 0) => {
594
+ const recurseRows = (rows: Row<TGenerics>[], depth = 0): Row<TGenerics>[] => {
595
595
  return rows
596
596
  .map(row => {
597
597
  const isSelected = isRowSelected(row, rowSelection, instance) === true
@@ -1,5 +1,5 @@
1
1
  import { RowModel } from '..'
2
- import { BuiltInSortType, reSplitAlphaNumeric, sortTypes } from '../sortTypes'
2
+ import { BuiltInSortType, reSplitAlphaNumeric, sortingFns } from '../sortingFns'
3
3
 
4
4
  import {
5
5
  Column,
@@ -52,7 +52,7 @@ export type SortType<TGenerics extends AnyGenerics> =
52
52
  | SortingFn<TGenerics>
53
53
 
54
54
  export type SortingColumnDef<TGenerics extends AnyGenerics> = {
55
- sortType?: SortType<Overwrite<TGenerics, { Value: any }>>
55
+ sortingFn?: SortType<Overwrite<TGenerics, { Value: any }>>
56
56
  sortDescFirst?: boolean
57
57
  enableSorting?: boolean
58
58
  enableMultiSort?: boolean
@@ -62,7 +62,7 @@ export type SortingColumnDef<TGenerics extends AnyGenerics> = {
62
62
  }
63
63
 
64
64
  export type SortingColumn<TGenerics extends AnyGenerics> = {
65
- sortType: SortType<Overwrite<TGenerics, { Value: any }>>
65
+ sortingFn: SortType<Overwrite<TGenerics, { Value: any }>>
66
66
  getCanSort: () => boolean
67
67
  getCanMultiSort: () => boolean
68
68
  getSortIndex: () => number
@@ -75,7 +75,7 @@ export type SortingColumn<TGenerics extends AnyGenerics> = {
75
75
  }
76
76
 
77
77
  export type SortingOptions<TGenerics extends AnyGenerics> = {
78
- sortTypes?: TGenerics['SortingFns']
78
+ sortingFns?: TGenerics['SortingFns']
79
79
  onSortingChange?: OnChangeFn<SortingState>
80
80
  autoResetSorting?: boolean
81
81
  enableSorting?: boolean
@@ -129,7 +129,7 @@ export const Sorting = {
129
129
  TGenerics extends AnyGenerics
130
130
  >(): SortingColumnDef<TGenerics> => {
131
131
  return {
132
- sortType: 'auto',
132
+ sortingFn: 'auto',
133
133
  }
134
134
  },
135
135
 
@@ -156,7 +156,7 @@ export const Sorting = {
156
156
  instance: TableInstance<TGenerics>
157
157
  ): SortingColumn<TGenerics> => {
158
158
  return {
159
- sortType: column.sortType,
159
+ sortingFn: column.sortingFn,
160
160
  getCanSort: () => instance.getColumnCanSort(column.id),
161
161
  getCanMultiSort: () => instance.getColumnCanMultiSort(column.id),
162
162
  getSortIndex: () => instance.getColumnSortIndex(column.id),
@@ -205,23 +205,23 @@ export const Sorting = {
205
205
  const value = row?.values[columnId]
206
206
 
207
207
  if (Object.prototype.toString.call(value) === '[object Date]') {
208
- return sortTypes.datetime
208
+ return sortingFns.datetime
209
209
  }
210
210
 
211
211
  if (typeof value === 'string') {
212
212
  isString = true
213
213
 
214
214
  if (value.split(reSplitAlphaNumeric).length > 1) {
215
- return sortTypes.alphanumeric
215
+ return sortingFns.alphanumeric
216
216
  }
217
217
  }
218
218
  }
219
219
 
220
220
  if (isString) {
221
- return sortTypes.text
221
+ return sortingFns.text
222
222
  }
223
223
 
224
- return sortTypes.basic
224
+ return sortingFns.basic
225
225
  },
226
226
  getColumnAutoSortDir: columnId => {
227
227
  const firstRow = instance.getGlobalFilteredRowModel().flatRows[0]
@@ -236,21 +236,21 @@ export const Sorting = {
236
236
  },
237
237
  getColumnSortingFn: columnId => {
238
238
  const column = instance.getColumn(columnId)
239
- const userSortTypes = instance.options.sortTypes
239
+ const userSortTypes = instance.options.sortingFns
240
240
 
241
241
  if (!column) {
242
242
  throw new Error()
243
243
  }
244
244
 
245
- return isFunction(column.sortType)
246
- ? column.sortType
247
- : column.sortType === 'auto'
245
+ return isFunction(column.sortingFn)
246
+ ? column.sortingFn
247
+ : column.sortingFn === 'auto'
248
248
  ? instance.getColumnAutoSortingFn(columnId)
249
249
  : (userSortTypes as Record<string, any>)?.[
250
- column.sortType as string
250
+ column.sortingFn as string
251
251
  ] ??
252
- (sortTypes[
253
- column.sortType as BuiltInSortType
252
+ (sortingFns[
253
+ column.sortingFn as BuiltInSortType
254
254
  ] as SortingFn<TGenerics>)
255
255
  },
256
256
 
@@ -1,6 +1,6 @@
1
1
  import { PartialGenerics, AnyGenerics, Row } from './types'
2
2
 
3
- export const filterTypes = {
3
+ export const filterFns = {
4
4
  includesString,
5
5
  includesStringSensitive,
6
6
  equalsString,
@@ -12,7 +12,7 @@ export const filterTypes = {
12
12
  betweenNumberRange,
13
13
  }
14
14
 
15
- export type BuiltInFilterType = keyof typeof filterTypes
15
+ export type BuiltInFilterType = keyof typeof filterFns
16
16
 
17
17
  function includesString<TGenerics extends AnyGenerics>(
18
18
  rows: Row<TGenerics>[],
@@ -2,7 +2,7 @@ import { PartialGenerics, AnyGenerics, Row } from './types'
2
2
 
3
3
  export const reSplitAlphaNumeric = /([0-9]+)/gm
4
4
 
5
- export const sortTypes = {
5
+ export const sortingFns = {
6
6
  alphanumeric,
7
7
  alphanumericCaseSensitive,
8
8
  text,
@@ -11,7 +11,7 @@ export const sortTypes = {
11
11
  basic,
12
12
  }
13
13
 
14
- export type BuiltInSortType = keyof typeof sortTypes
14
+ export type BuiltInSortType = keyof typeof sortingFns
15
15
 
16
16
  function alphanumeric<TGenerics extends AnyGenerics>(
17
17
  rowA: Row<TGenerics>,
@@ -12,7 +12,10 @@ export function getColumnFilteredRowModelAsync<
12
12
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
13
13
  return instance =>
14
14
  incrementalMemo(
15
- () => [instance.getState().columnFilters, instance.getCoreRowModel()],
15
+ () => [
16
+ instance.getState().columnFilters,
17
+ instance.getPreColumnFilteredRowModel(),
18
+ ],
16
19
  (_sorting, rowModel): RowModel<TGenerics> => {
17
20
  return {
18
21
  rows: rowModel.rows.slice(),
@@ -62,7 +65,7 @@ export function getColumnFilteredRowModelAsync<
62
65
  // if (!filterFn) {
63
66
  // if (process.env.NODE_ENV !== 'production') {
64
67
  // console.warn(
65
- // `Could not find a valid 'column.filterType' for column with the ID: ${column.id}.`
68
+ // `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`
66
69
  // )
67
70
  // }
68
71
  // continue
@@ -10,10 +10,13 @@ export function getColumnFilteredRowModelSync<
10
10
  >(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
11
11
  return instance =>
12
12
  memo(
13
- () => [instance.getState().columnFilters, instance.getCoreRowModel()],
13
+ () => [
14
+ instance.getState().columnFilters,
15
+ instance.getPreColumnFilteredRowModel(),
16
+ ],
14
17
  (columnFilters, rowModel) => {
15
18
  const columnFilteredRowModel: RowModel<TGenerics> = (() => {
16
- if (!rowModel.rows.length || !columnFilters) {
19
+ if (!rowModel.rows.length || !columnFilters?.length) {
17
20
  return rowModel
18
21
  }
19
22
 
@@ -47,7 +50,7 @@ export function getColumnFilteredRowModelSync<
47
50
  if (!filterFn) {
48
51
  if (process.env.NODE_ENV !== 'production') {
49
52
  console.warn(
50
- `Could not find a valid 'column.filterType' for column with the ID: ${column.id}.`
53
+ `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`
51
54
  )
52
55
  }
53
56
  continue
@@ -8,7 +8,7 @@ export function getExpandedRowModel<TGenerics extends AnyGenerics>(): (
8
8
  memo(
9
9
  () => [
10
10
  instance.getState().expanded,
11
- instance.getGroupedRowModel(),
11
+ instance.getPreExpandedRowModel(),
12
12
  instance.options.paginateExpandedRows,
13
13
  ],
14
14
  (expanded, rowModel, paginateExpandedRows) => {
@@ -12,7 +12,10 @@ export function getGlobalFilteredRowModelAsync<
12
12
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
13
13
  return instance =>
14
14
  incrementalMemo(
15
- () => [instance.getState().globalFilter, instance.getCoreRowModel()],
15
+ () => [
16
+ instance.getState().globalFilter,
17
+ instance.getPreGlobalFilteredRowModel(),
18
+ ],
16
19
  (_globalFilter, rowModel): RowModel<TGenerics> => {
17
20
  return {
18
21
  rows: rowModel.rows.slice(),
@@ -10,7 +10,10 @@ export function getGlobalFilteredRowModelSync<
10
10
  >(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
11
11
  return instance =>
12
12
  memo(
13
- () => [instance.getState().globalFilter, instance.getCoreRowModel()],
13
+ () => [
14
+ instance.getState().globalFilter,
15
+ instance.getPreGlobalFilteredRowModel(),
16
+ ],
14
17
  (globalFilter, rowModel) => {
15
18
  const globalFilteredRowModel: RowModel<TGenerics> = (() => {
16
19
  if (!rowModel.rows.length || !globalFilter) {