@tanstack/table-core 8.0.0-alpha.53 → 8.0.0-alpha.54

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 +8 -8
  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 +5 -5
  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 +9 -10
  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 +6 -7
  73. package/src/features/Ordering.ts +8 -7
  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
@@ -3,8 +3,7 @@ import {
3
3
  Updater,
4
4
  TableInstance,
5
5
  Column,
6
- AnyGenerics,
7
- PartialGenerics,
6
+ TableGenerics,
8
7
  } from '../types'
9
8
  import { functionalUpdate, makeStateUpdater } from '../utils'
10
9
 
@@ -40,7 +39,7 @@ export type ColumnPinningColumn = {
40
39
  pin: (position: ColumnPinningPosition) => void
41
40
  }
42
41
 
43
- export type ColumnPinningInstance<TGenerics extends AnyGenerics> = {
42
+ export type ColumnPinningInstance<TGenerics extends TableGenerics> = {
44
43
  setColumnPinning: (updater: Updater<ColumnPinningState>) => void
45
44
  resetColumnPinning: () => void
46
45
  pinColumn: (columnId: string, position: ColumnPinningPosition) => void
@@ -62,7 +61,7 @@ export const Pinning = {
62
61
  }
63
62
  },
64
63
 
65
- getDefaultOptions: <TGenerics extends AnyGenerics>(
64
+ getDefaultOptions: <TGenerics extends TableGenerics>(
66
65
  instance: TableInstance<TGenerics>
67
66
  ): ColumnPinningDefaultOptions => {
68
67
  return {
@@ -70,7 +69,7 @@ export const Pinning = {
70
69
  }
71
70
  },
72
71
 
73
- createColumn: <TGenerics extends AnyGenerics>(
72
+ createColumn: <TGenerics extends TableGenerics>(
74
73
  column: Column<TGenerics>,
75
74
  instance: TableInstance<TGenerics>
76
75
  ): ColumnPinningColumn => {
@@ -82,7 +81,7 @@ export const Pinning = {
82
81
  }
83
82
  },
84
83
 
85
- getInstance: <TGenerics extends AnyGenerics>(
84
+ getInstance: <TGenerics extends TableGenerics>(
86
85
  instance: TableInstance<TGenerics>
87
86
  ): ColumnPinningInstance<TGenerics> => {
88
87
  return {
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  Getter,
3
3
  OnChangeFn,
4
- AnyGenerics,
5
- PartialGenerics,
4
+ TableGenerics,
6
5
  PropGetterValue,
7
6
  TableInstance,
8
7
  Row,
@@ -17,7 +16,7 @@ export type RowSelectionTableState = {
17
16
  rowSelection: RowSelectionState
18
17
  }
19
18
 
20
- export type RowSelectionOptions<TGenerics extends AnyGenerics> = {
19
+ export type RowSelectionOptions<TGenerics extends TableGenerics> = {
21
20
  onRowSelectionChange?: OnChangeFn<RowSelectionState>
22
21
  autoResetRowSelection?: boolean
23
22
  enableRowSelection?: boolean | ((row: Row<TGenerics>) => boolean)
@@ -60,7 +59,7 @@ export type RowSelectionRow = {
60
59
  ) => undefined | PropGetterValue<ToggleRowSelectedProps, TGetter>
61
60
  }
62
61
 
63
- export type RowSelectionInstance<TGenerics extends AnyGenerics> = {
62
+ export type RowSelectionInstance<TGenerics extends TableGenerics> = {
64
63
  queueResetRowSelection: () => void
65
64
  getToggleRowSelectedProps: <TGetter extends Getter<ToggleRowSelectedProps>>(
66
65
  rowId: string,
@@ -106,7 +105,7 @@ export const RowSelection = {
106
105
  }
107
106
  },
108
107
 
109
- getDefaultOptions: <TGenerics extends AnyGenerics>(
108
+ getDefaultOptions: <TGenerics extends TableGenerics>(
110
109
  instance: TableInstance<TGenerics>
111
110
  ): RowSelectionOptions<TGenerics> => {
112
111
  return {
@@ -121,7 +120,7 @@ export const RowSelection = {
121
120
  }
122
121
  },
123
122
 
124
- getInstance: <TGenerics extends AnyGenerics>(
123
+ getInstance: <TGenerics extends TableGenerics>(
125
124
  instance: TableInstance<TGenerics>
126
125
  ): RowSelectionInstance<TGenerics> => {
127
126
  let registered = false
@@ -536,7 +535,7 @@ export const RowSelection = {
536
535
  }
537
536
  },
538
537
 
539
- createRow: <TGenerics extends AnyGenerics>(
538
+ createRow: <TGenerics extends TableGenerics>(
540
539
  row: Row<TGenerics>,
541
540
  instance: TableInstance<TGenerics>
542
541
  ): RowSelectionRow => {
@@ -552,7 +551,7 @@ export const RowSelection = {
552
551
  },
553
552
  }
554
553
 
555
- const mutateRowIsSelected = <TGenerics extends AnyGenerics>(
554
+ const mutateRowIsSelected = <TGenerics extends TableGenerics>(
556
555
  selectedRowIds: Record<string, boolean>,
557
556
  id: string,
558
557
  value: boolean,
@@ -580,7 +579,7 @@ const mutateRowIsSelected = <TGenerics extends AnyGenerics>(
580
579
  }
581
580
  }
582
581
 
583
- export function selectRowsFn<TGenerics extends AnyGenerics>(
582
+ export function selectRowsFn<TGenerics extends TableGenerics>(
584
583
  instance: TableInstance<TGenerics>,
585
584
  rowModel: RowModel<TGenerics>
586
585
  ): RowModel<TGenerics> {
@@ -621,7 +620,7 @@ export function selectRowsFn<TGenerics extends AnyGenerics>(
621
620
  }
622
621
  }
623
622
 
624
- export function isRowSelected<TGenerics extends AnyGenerics>(
623
+ export function isRowSelected<TGenerics extends TableGenerics>(
625
624
  row: Row<TGenerics>,
626
625
  selection: Record<string, boolean>,
627
626
  instance: TableInstance<TGenerics>
@@ -10,8 +10,7 @@ import {
10
10
  Getter,
11
11
  Header,
12
12
  OnChangeFn,
13
- AnyGenerics,
14
- PartialGenerics,
13
+ TableGenerics,
15
14
  PropGetterValue,
16
15
  TableInstance,
17
16
  Row,
@@ -36,11 +35,11 @@ export type ColumnSort = {
36
35
 
37
36
  export type SortingState = ColumnSort[]
38
37
 
39
- export type SortingFn<TGenerics extends AnyGenerics> = {
38
+ export type SortingFn<TGenerics extends TableGenerics> = {
40
39
  (rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number
41
40
  }
42
41
 
43
- export type CustomSortingFns<TGenerics extends AnyGenerics> = Record<
42
+ export type CustomSortingFns<TGenerics extends TableGenerics> = Record<
44
43
  string,
45
44
  SortingFn<TGenerics>
46
45
  >
@@ -49,13 +48,13 @@ export type SortingTableState = {
49
48
  sorting: SortingState
50
49
  }
51
50
 
52
- export type SortingFnOption<TGenerics extends AnyGenerics> =
51
+ export type SortingFnOption<TGenerics extends TableGenerics> =
53
52
  | 'auto'
54
53
  | BuiltInSortingFn
55
54
  | keyof TGenerics['SortingFns']
56
55
  | SortingFn<TGenerics>
57
56
 
58
- export type SortingColumnDef<TGenerics extends AnyGenerics> = {
57
+ export type SortingColumnDef<TGenerics extends TableGenerics> = {
59
58
  sortingFn?: SortingFnOption<Overwrite<TGenerics, { Value: any }>>
60
59
  sortDescFirst?: boolean
61
60
  enableSorting?: boolean
@@ -65,7 +64,7 @@ export type SortingColumnDef<TGenerics extends AnyGenerics> = {
65
64
  sortUndefined?: false | -1 | 1
66
65
  }
67
66
 
68
- export type SortingColumn<TGenerics extends AnyGenerics> = {
67
+ export type SortingColumn<TGenerics extends TableGenerics> = {
69
68
  sortingFn: SortingFnOption<Overwrite<TGenerics, { Value: any }>>
70
69
  getCanSort: () => boolean
71
70
  getCanMultiSort: () => boolean
@@ -78,7 +77,7 @@ export type SortingColumn<TGenerics extends AnyGenerics> = {
78
77
  ) => undefined | PropGetterValue<ToggleSortingProps, TGetter>
79
78
  }
80
79
 
81
- export type SortingOptions<TGenerics extends AnyGenerics> = {
80
+ export type SortingOptions<TGenerics extends TableGenerics> = {
82
81
  sortingFns?: TGenerics['SortingFns']
83
82
  onSortingChange?: OnChangeFn<SortingState>
84
83
  autoResetSorting?: boolean
@@ -99,7 +98,7 @@ export type ToggleSortingProps = {
99
98
  onClick?: (event: unknown) => void
100
99
  }
101
100
 
102
- export type SortingInstance<TGenerics extends AnyGenerics> = {
101
+ export type SortingInstance<TGenerics extends TableGenerics> = {
103
102
  queueResetSorting: () => void
104
103
  getColumnAutoSortingFn: (columnId: string) => SortingFn<TGenerics> | undefined
105
104
  getColumnAutoSortDir: (columnId: string) => SortDirection
@@ -130,7 +129,7 @@ export type SortingInstance<TGenerics extends AnyGenerics> = {
130
129
 
131
130
  export const Sorting = {
132
131
  getDefaultColumn: <
133
- TGenerics extends AnyGenerics
132
+ TGenerics extends TableGenerics
134
133
  >(): SortingColumnDef<TGenerics> => {
135
134
  return {
136
135
  sortingFn: 'auto',
@@ -143,7 +142,7 @@ export const Sorting = {
143
142
  }
144
143
  },
145
144
 
146
- getDefaultOptions: <TGenerics extends AnyGenerics>(
145
+ getDefaultOptions: <TGenerics extends TableGenerics>(
147
146
  instance: TableInstance<TGenerics>
148
147
  ): SortingOptions<TGenerics> => {
149
148
  return {
@@ -155,7 +154,7 @@ export const Sorting = {
155
154
  }
156
155
  },
157
156
 
158
- createColumn: <TGenerics extends AnyGenerics>(
157
+ createColumn: <TGenerics extends TableGenerics>(
159
158
  column: Column<TGenerics>,
160
159
  instance: TableInstance<TGenerics>
161
160
  ): SortingColumn<TGenerics> => {
@@ -173,7 +172,7 @@ export const Sorting = {
173
172
  }
174
173
  },
175
174
 
176
- getInstance: <TGenerics extends AnyGenerics>(
175
+ getInstance: <TGenerics extends TableGenerics>(
177
176
  instance: TableInstance<TGenerics>
178
177
  ): SortingInstance<TGenerics> => {
179
178
  let registered = false
@@ -3,13 +3,12 @@ import {
3
3
  Column,
4
4
  Getter,
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, memo, propGetter } from '../utils'
13
12
 
14
13
  export type VisibilityOptions = {
15
14
  onColumnVisibilityChange?: OnChangeFn<VisibilityState>
@@ -26,7 +25,7 @@ export type VisibilityTableState = {
26
25
  columnVisibility: VisibilityState
27
26
  }
28
27
 
29
- export type VisibilityInstance<TGenerics extends AnyGenerics> = {
28
+ export type VisibilityInstance<TGenerics extends TableGenerics> = {
30
29
  getVisibleFlatColumns: () => Column<TGenerics>[]
31
30
  getVisibleLeafColumns: () => Column<TGenerics>[]
32
31
  setColumnVisibility: (updater: Updater<VisibilityState>) => void
@@ -52,7 +51,7 @@ export type VisibilityColumnDef = {
52
51
  defaultIsVisible?: boolean
53
52
  }
54
53
 
55
- export type VisibilityRow<TGenerics extends AnyGenerics> = {
54
+ export type VisibilityRow<TGenerics extends TableGenerics> = {
56
55
  getVisibleCells: () => Cell<TGenerics>[]
57
56
  }
58
57
 
@@ -74,7 +73,7 @@ export const Visibility = {
74
73
  }
75
74
  },
76
75
 
77
- getDefaultOptions: <TGenerics extends AnyGenerics>(
76
+ getDefaultOptions: <TGenerics extends TableGenerics>(
78
77
  instance: TableInstance<TGenerics>
79
78
  ): VisibilityDefaultOptions => {
80
79
  return {
@@ -88,7 +87,7 @@ export const Visibility = {
88
87
  }
89
88
  },
90
89
 
91
- createColumn: <TGenerics extends AnyGenerics>(
90
+ createColumn: <TGenerics extends TableGenerics>(
92
91
  column: Column<TGenerics>,
93
92
  instance: TableInstance<TGenerics>
94
93
  ): VisibilityColumn => {
@@ -114,7 +113,7 @@ export const Visibility = {
114
113
  }
115
114
  },
116
115
 
117
- getInstance: <TGenerics extends AnyGenerics>(
116
+ getInstance: <TGenerics extends TableGenerics>(
118
117
  instance: TableInstance<TGenerics>
119
118
  ): VisibilityInstance<TGenerics> => {
120
119
  return {
package/src/filterFns.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PartialGenerics, AnyGenerics, Row } from './types'
1
+ import { TableGenerics, Row } from './types'
2
2
 
3
3
  export const filterFns = {
4
4
  includesString,
@@ -14,7 +14,7 @@ export const filterFns = {
14
14
 
15
15
  export type BuiltInFilterFn = keyof typeof filterFns
16
16
 
17
- function includesString<TGenerics extends AnyGenerics>(
17
+ function includesString<TGenerics extends TableGenerics>(
18
18
  rows: Row<TGenerics>[],
19
19
  columnIds: string[],
20
20
  filterValue: unknown
@@ -31,7 +31,7 @@ function includesString<TGenerics extends AnyGenerics>(
31
31
 
32
32
  includesString.autoRemove = (val: any) => testFalsey(val)
33
33
 
34
- function includesStringSensitive<TGenerics extends AnyGenerics>(
34
+ function includesStringSensitive<TGenerics extends TableGenerics>(
35
35
  rows: Row<TGenerics>[],
36
36
  columnIds: string[],
37
37
  filterValue: unknown
@@ -48,7 +48,7 @@ function includesStringSensitive<TGenerics extends AnyGenerics>(
48
48
 
49
49
  includesStringSensitive.autoRemove = (val: any) => testFalsey(val)
50
50
 
51
- function equalsString<TGenerics extends AnyGenerics>(
51
+ function equalsString<TGenerics extends TableGenerics>(
52
52
  rows: Row<TGenerics>[],
53
53
  columnIds: string[],
54
54
  filterValue: unknown
@@ -67,7 +67,7 @@ function equalsString<TGenerics extends AnyGenerics>(
67
67
 
68
68
  equalsString.autoRemove = (val: any) => testFalsey(val)
69
69
 
70
- function equalsStringSensitive<TGenerics extends AnyGenerics>(
70
+ function equalsStringSensitive<TGenerics extends TableGenerics>(
71
71
  rows: Row<TGenerics>[],
72
72
  columnIds: string[],
73
73
  filterValue: unknown
@@ -83,7 +83,7 @@ function equalsStringSensitive<TGenerics extends AnyGenerics>(
83
83
 
84
84
  equalsStringSensitive.autoRemove = (val: any) => testFalsey(val)
85
85
 
86
- function arrIncludes<TGenerics extends AnyGenerics>(
86
+ function arrIncludes<TGenerics extends TableGenerics>(
87
87
  rows: Row<TGenerics>[],
88
88
  columnIds: string[],
89
89
  filterValue: unknown
@@ -98,7 +98,7 @@ function arrIncludes<TGenerics extends AnyGenerics>(
98
98
 
99
99
  arrIncludes.autoRemove = (val: any) => testFalsey(val) || !val?.length
100
100
 
101
- function arrIncludesAll<TGenerics extends AnyGenerics>(
101
+ function arrIncludesAll<TGenerics extends TableGenerics>(
102
102
  rows: Row<TGenerics>[],
103
103
  columnIds: string[],
104
104
  filterValue: unknown[]
@@ -117,7 +117,7 @@ function arrIncludesAll<TGenerics extends AnyGenerics>(
117
117
 
118
118
  arrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length
119
119
 
120
- function equals<TGenerics extends AnyGenerics>(
120
+ function equals<TGenerics extends TableGenerics>(
121
121
  rows: Row<TGenerics>[],
122
122
  columnIds: string[],
123
123
  filterValue: unknown
@@ -132,7 +132,7 @@ function equals<TGenerics extends AnyGenerics>(
132
132
 
133
133
  equals.autoRemove = (val: any) => testFalsey(val)
134
134
 
135
- function weakEquals<TGenerics extends AnyGenerics>(
135
+ function weakEquals<TGenerics extends TableGenerics>(
136
136
  rows: Row<TGenerics>[],
137
137
  columnIds: string[],
138
138
  filterValue: unknown
@@ -148,7 +148,7 @@ function weakEquals<TGenerics extends AnyGenerics>(
148
148
 
149
149
  weakEquals.autoRemove = (val: any) => testFalsey(val)
150
150
 
151
- function betweenNumberRange<TGenerics extends AnyGenerics>(
151
+ function betweenNumberRange<TGenerics extends TableGenerics>(
152
152
  rows: Row<TGenerics>[],
153
153
  columnIds: string[],
154
154
  filterValue: [unknown, unknown]
package/src/sortingFns.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnyGenerics, Row } from './types'
1
+ import { TableGenerics, Row } from './types'
2
2
 
3
3
  export const reSplitAlphaNumeric = /([0-9]+)/gm
4
4
 
@@ -13,7 +13,7 @@ export const sortingFns = {
13
13
 
14
14
  export type BuiltInSortingFn = keyof typeof sortingFns
15
15
 
16
- function alphanumeric<TGenerics extends AnyGenerics>(
16
+ function alphanumeric<TGenerics extends TableGenerics>(
17
17
  rowA: Row<TGenerics>,
18
18
  rowB: Row<TGenerics>,
19
19
  columnId: string
@@ -24,7 +24,7 @@ function alphanumeric<TGenerics extends AnyGenerics>(
24
24
  )
25
25
  }
26
26
 
27
- function alphanumericCaseSensitive<TGenerics extends AnyGenerics>(
27
+ function alphanumericCaseSensitive<TGenerics extends TableGenerics>(
28
28
  rowA: Row<TGenerics>,
29
29
  rowB: Row<TGenerics>,
30
30
  columnId: string
@@ -84,7 +84,7 @@ function compareAlphanumeric(aStr: string, bStr: string) {
84
84
 
85
85
  // The text filter is more basic (less numeric support)
86
86
  // but is much faster
87
- function text<TGenerics extends AnyGenerics>(
87
+ function text<TGenerics extends TableGenerics>(
88
88
  rowA: Row<TGenerics>,
89
89
  rowB: Row<TGenerics>,
90
90
  columnId: string
@@ -97,7 +97,7 @@ function text<TGenerics extends AnyGenerics>(
97
97
 
98
98
  // The text filter is more basic (less numeric support)
99
99
  // but is much faster
100
- function textCaseSensitive<TGenerics extends AnyGenerics>(
100
+ function textCaseSensitive<TGenerics extends TableGenerics>(
101
101
  rowA: Row<TGenerics>,
102
102
  rowB: Row<TGenerics>,
103
103
  columnId: string
@@ -108,7 +108,7 @@ function textCaseSensitive<TGenerics extends AnyGenerics>(
108
108
  )
109
109
  }
110
110
 
111
- function datetime<TGenerics extends AnyGenerics>(
111
+ function datetime<TGenerics extends TableGenerics>(
112
112
  rowA: Row<TGenerics>,
113
113
  rowB: Row<TGenerics>,
114
114
  columnId: string
@@ -119,7 +119,7 @@ function datetime<TGenerics extends AnyGenerics>(
119
119
  )
120
120
  }
121
121
 
122
- function basic<TGenerics extends AnyGenerics>(
122
+ function basic<TGenerics extends TableGenerics>(
123
123
  rowA: Row<TGenerics>,
124
124
  rowB: Row<TGenerics>,
125
125
  columnId: string
package/src/types.ts CHANGED
@@ -77,28 +77,22 @@ import {
77
77
  RowSelectionTableState,
78
78
  } from './features/RowSelection'
79
79
 
80
- export type DefaultGenerics = {
81
- Row: unknown
82
- Value: unknown
83
- FilterFns: object
84
- SortingFns: object
85
- AggregationFns: object
86
- Render: unknown
87
- ColumnMeta: object
88
- TableMeta: object
80
+ export type TableGenerics = {
81
+ Row?: any
82
+ Value?: any
83
+ FilterFns?: any
84
+ SortingFns?: any
85
+ AggregationFns?: any
86
+ Render?: any
87
+ ColumnMeta?: any
88
+ TableMeta?: any
89
89
  }
90
90
 
91
91
  export type AnyRender = (Comp: any, props: any) => any
92
92
 
93
- export type UseRenderer<TGenerics extends AnyGenerics> =
93
+ export type UseRenderer<TGenerics extends TableGenerics> =
94
94
  TGenerics['Render'] extends (...args: any) => any ? TGenerics['Render'] : any
95
95
 
96
- export type PartialGenerics = Partial<DefaultGenerics>
97
-
98
- export type AnyGenerics = {
99
- [TKey in keyof PartialGenerics]?: any
100
- }
101
-
102
96
  export type TableFeature = {
103
97
  getDefaultOptions?: (instance: any) => any
104
98
  getInitialState?: () => any
@@ -109,7 +103,7 @@ export type TableFeature = {
109
103
  createRow?: (row: any, instance: any) => any
110
104
  }
111
105
 
112
- export type TableInstance<TGenerics extends AnyGenerics> =
106
+ export type TableInstance<TGenerics extends TableGenerics> =
113
107
  TableCore<TGenerics> &
114
108
  VisibilityInstance<TGenerics> &
115
109
  ColumnOrderInstance<TGenerics> &
@@ -125,7 +119,7 @@ export type TableInstance<TGenerics extends AnyGenerics> =
125
119
 
126
120
  //
127
121
 
128
- export type Options<TGenerics extends AnyGenerics> = CoreOptions<TGenerics> &
122
+ export type Options<TGenerics extends TableGenerics> = CoreOptions<TGenerics> &
129
123
  VisibilityOptions &
130
124
  ColumnOrderOptions &
131
125
  ColumnPinningOptions &
@@ -152,7 +146,7 @@ export type TableState = CoreTableState &
152
146
  PaginationTableState &
153
147
  RowSelectionTableState
154
148
 
155
- export type Row<TGenerics extends AnyGenerics> = CoreRow<TGenerics> &
149
+ export type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> &
156
150
  VisibilityRow<TGenerics> &
157
151
  HeadersRow<TGenerics> &
158
152
  GroupingRow &
@@ -163,7 +157,7 @@ export type RowValues = {
163
157
  [key: string]: any
164
158
  }
165
159
 
166
- export type RowModel<TGenerics extends AnyGenerics> = {
160
+ export type RowModel<TGenerics extends TableGenerics> = {
167
161
  rows: Row<TGenerics>[]
168
162
  flatRows: Row<TGenerics>[]
169
163
  rowsById: Record<string, Row<TGenerics>>
@@ -171,7 +165,7 @@ export type RowModel<TGenerics extends AnyGenerics> = {
171
165
 
172
166
  export type AccessorFn<TData> = (originalRow: TData, index: number) => any
173
167
 
174
- // export type UserColumnDef<TGenerics extends AnyGenerics> = Overwrite<
168
+ // export type UserColumnDef<TGenerics extends TableGenerics> = Overwrite<
175
169
  // ColumnDef<TGenerics>,
176
170
  // GeneratedProperties<false>
177
171
  // >
@@ -190,11 +184,11 @@ export type AccessorFn<TData> = (originalRow: TData, index: number) => any
190
184
  // }
191
185
  // : never
192
186
 
193
- export type Renderable<TGenerics extends AnyGenerics, TProps> =
187
+ export type Renderable<TGenerics extends TableGenerics, TProps> =
194
188
  | string
195
189
  | ((props: TProps) => ReturnType<UseRenderer<TGenerics>>)
196
190
 
197
- export type ColumnDef<TGenerics extends AnyGenerics> =
191
+ export type ColumnDef<TGenerics extends TableGenerics> =
198
192
  CoreColumnDef<TGenerics> &
199
193
  VisibilityColumnDef &
200
194
  ColumnPinningColumnDef &
@@ -203,7 +197,7 @@ export type ColumnDef<TGenerics extends AnyGenerics> =
203
197
  GroupingColumnDef<TGenerics> &
204
198
  ColumnSizingColumnDef
205
199
 
206
- export type Column<TGenerics extends AnyGenerics> = ColumnDef<TGenerics> &
200
+ export type Column<TGenerics extends TableGenerics> = ColumnDef<TGenerics> &
207
201
  CoreColumn<TGenerics> &
208
202
  ColumnVisibilityColumn &
209
203
  ColumnPinningColumn &
@@ -212,10 +206,10 @@ export type Column<TGenerics extends AnyGenerics> = ColumnDef<TGenerics> &
212
206
  GroupingColumn<TGenerics> &
213
207
  ColumnSizingColumn<TGenerics>
214
208
 
215
- export type Cell<TGenerics extends AnyGenerics> = CoreCell<TGenerics> &
209
+ export type Cell<TGenerics extends TableGenerics> = CoreCell<TGenerics> &
216
210
  GroupingCell<TGenerics>
217
211
 
218
- export type CoreCell<TGenerics extends AnyGenerics> = {
212
+ export type CoreCell<TGenerics extends TableGenerics> = {
219
213
  id: string
220
214
  rowId: string
221
215
  columnId: string
@@ -226,10 +220,10 @@ export type CoreCell<TGenerics extends AnyGenerics> = {
226
220
  renderCell: () => string | null | ReturnType<UseRenderer<TGenerics>>
227
221
  }
228
222
 
229
- export type Header<TGenerics extends AnyGenerics> = CoreHeader<TGenerics> &
223
+ export type Header<TGenerics extends TableGenerics> = CoreHeader<TGenerics> &
230
224
  ColumnSizingHeader<TGenerics>
231
225
 
232
- export type CoreHeader<TGenerics extends AnyGenerics> = {
226
+ export type CoreHeader<TGenerics extends TableGenerics> = {
233
227
  id: string
234
228
  depth: number
235
229
  column: Column<TGenerics>
@@ -250,7 +244,7 @@ export type CoreHeader<TGenerics extends AnyGenerics> = {
250
244
  }) => string | null | ReturnType<UseRenderer<TGenerics>>
251
245
  }
252
246
 
253
- export type HeaderGroup<TGenerics extends AnyGenerics> = {
247
+ export type HeaderGroup<TGenerics extends TableGenerics> = {
254
248
  id: string
255
249
  depth: number
256
250
  headers: Header<TGenerics>[]
@@ -1,6 +1,6 @@
1
- import { AnyGenerics, Row, RowModel, TableInstance } from '../types'
1
+ import { TableGenerics, Row, RowModel, TableInstance } from '../types'
2
2
 
3
- export function filterRowModelFromLeafs<TGenerics extends AnyGenerics>(
3
+ export function filterRowModelFromLeafs<TGenerics extends TableGenerics>(
4
4
  rowsToFilter: Row<TGenerics>[],
5
5
  filterRows: (
6
6
  rowsToFilter: Row<TGenerics>[],
@@ -56,7 +56,7 @@ export function filterRowModelFromLeafs<TGenerics extends AnyGenerics>(
56
56
  }
57
57
  }
58
58
 
59
- export function filterRowModelFromRoot<TGenerics extends AnyGenerics>(
59
+ export function filterRowModelFromRoot<TGenerics extends TableGenerics>(
60
60
  rowsToFilter: Row<TGenerics>[],
61
61
  filterRows: (
62
62
  rowsToFilter: Row<TGenerics>[],
@@ -1,4 +1,4 @@
1
- import { TableInstance, RowModel, AnyGenerics, Row } from '../types'
1
+ import { TableInstance, RowModel, TableGenerics, Row } from '../types'
2
2
  import { incrementalMemo, memo } from '../utils'
3
3
  import {
4
4
  filterRowModelFromLeafs,
@@ -6,7 +6,7 @@ import {
6
6
  } from './filterRowsUtils'
7
7
 
8
8
  export function getColumnFilteredRowModelAsync<
9
- TGenerics extends AnyGenerics
9
+ TGenerics extends TableGenerics
10
10
  >(opts?: {
11
11
  initialSync?: boolean
12
12
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
@@ -1,4 +1,4 @@
1
- import { TableInstance, RowModel, AnyGenerics, Row } from '../types'
1
+ import { TableInstance, RowModel, TableGenerics, Row } from '../types'
2
2
  import { memo } from '../utils'
3
3
  import {
4
4
  filterRowModelFromLeafs,
@@ -6,7 +6,7 @@ import {
6
6
  } from './filterRowsUtils'
7
7
 
8
8
  export function getColumnFilteredRowModelSync<
9
- TGenerics extends AnyGenerics
9
+ TGenerics extends TableGenerics
10
10
  >(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
11
11
  return instance =>
12
12
  memo(
@@ -1,7 +1,7 @@
1
- import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
1
+ import { TableInstance, Row, RowModel, TableGenerics } from '../types'
2
2
  import { getBatchGroups, incrementalMemo } from '../utils'
3
3
 
4
- export function getCoreRowModelAsync<TGenerics extends AnyGenerics>(opts?: {
4
+ export function getCoreRowModelAsync<TGenerics extends TableGenerics>(opts?: {
5
5
  initialSync: boolean
6
6
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
7
7
  return instance =>
@@ -1,7 +1,7 @@
1
- import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
1
+ import { TableInstance, Row, RowModel, TableGenerics } from '../types'
2
2
  import { memo } from '../utils'
3
3
 
4
- export function getCoreRowModelSync<TGenerics extends AnyGenerics>(): (
4
+ export function getCoreRowModelSync<TGenerics extends TableGenerics>(): (
5
5
  instance: TableInstance<TGenerics>
6
6
  ) => () => RowModel<TGenerics> {
7
7
  return instance =>
@@ -1,7 +1,7 @@
1
- import { TableInstance, Row, RowModel, AnyGenerics } from '../types'
1
+ import { TableInstance, Row, RowModel, TableGenerics } from '../types'
2
2
  import { memo } from '../utils'
3
3
 
4
- export function getExpandedRowModel<TGenerics extends AnyGenerics>(): (
4
+ export function getExpandedRowModel<TGenerics extends TableGenerics>(): (
5
5
  instance: TableInstance<TGenerics>
6
6
  ) => () => RowModel<TGenerics> {
7
7
  return instance =>
@@ -30,7 +30,7 @@ export function getExpandedRowModel<TGenerics extends AnyGenerics>(): (
30
30
  )
31
31
  }
32
32
 
33
- export function expandRows<TGenerics extends AnyGenerics>(
33
+ export function expandRows<TGenerics extends TableGenerics>(
34
34
  rowModel: RowModel<TGenerics>,
35
35
  instance: TableInstance<TGenerics>
36
36
  ) {
@@ -1,4 +1,4 @@
1
- import { TableInstance, RowModel, AnyGenerics, Row } from '../types'
1
+ import { TableInstance, RowModel, TableGenerics, Row } from '../types'
2
2
  import { incrementalMemo, memo } from '../utils'
3
3
  import {
4
4
  filterRowModelFromLeafs,
@@ -6,7 +6,7 @@ import {
6
6
  } from './filterRowsUtils'
7
7
 
8
8
  export function getGlobalFilteredRowModelAsync<
9
- TGenerics extends AnyGenerics
9
+ TGenerics extends TableGenerics
10
10
  >(opts?: {
11
11
  initialSync?: boolean
12
12
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {