@tanstack/table-core 8.0.0-alpha.53 → 8.0.0-alpha.57
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.
- package/build/cjs/core.js +9 -384
- package/build/cjs/core.js.map +1 -1
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/Cells.js +122 -0
- package/build/cjs/features/Cells.js.map +1 -0
- package/build/cjs/features/ColumnSizing.js +90 -37
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Columns.js +216 -0
- package/build/cjs/features/Columns.js.map +1 -0
- package/build/cjs/features/Expanding.js +1 -1
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +1 -1
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +1 -1
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js +78 -153
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Ordering.js +2 -2
- package/build/cjs/features/Ordering.js.map +1 -1
- package/build/cjs/features/Pagination.js +1 -1
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Pinning.js +172 -2
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Rows.js +99 -0
- package/build/cjs/features/Rows.js.map +1 -0
- package/build/cjs/features/Sorting.js +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +51 -17
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterFns.js.map +1 -1
- package/build/cjs/sortingFns.js.map +1 -1
- package/build/cjs/utils/filterRowsUtils.js.map +1 -1
- package/build/cjs/utils/getColumnFilteredRowModelSync.js.map +1 -1
- package/build/cjs/utils/getCoreRowModelAsync.js.map +1 -1
- package/build/cjs/utils/getCoreRowModelSync.js.map +1 -1
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getGlobalFilteredRowModelSync.js.map +1 -1
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
- package/build/cjs/utils/getSortedRowModelSync.js.map +1 -1
- package/build/cjs/utils.js +2 -2
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +879 -693
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +420 -318
- package/build/types/core.d.ts +5 -82
- package/build/types/createTable.d.ts +4 -4
- package/build/types/features/Cells.d.ts +14 -0
- package/build/types/features/ColumnSizing.d.ts +31 -23
- package/build/types/features/Columns.d.ts +54 -0
- package/build/types/features/Expanding.d.ts +6 -6
- package/build/types/features/Filters.d.ts +14 -14
- package/build/types/features/Grouping.d.ts +16 -16
- package/build/types/features/Headers.d.ts +5 -13
- package/build/types/features/Ordering.d.ts +5 -5
- package/build/types/features/Pagination.d.ts +5 -5
- package/build/types/features/Pinning.d.ts +21 -7
- package/build/types/features/RowSelection.d.ts +8 -8
- package/build/types/features/Rows.d.ts +29 -0
- package/build/types/features/Sorting.d.ts +12 -12
- package/build/types/features/Visibility.d.ts +11 -6
- package/build/types/filterFns.d.ts +10 -10
- package/build/types/sortingFns.d.ts +7 -7
- package/build/types/types.d.ts +37 -33
- package/build/types/utils/filterRowsUtils.d.ts +3 -3
- package/build/types/utils/getColumnFilteredRowModelAsync.d.ts +2 -2
- package/build/types/utils/getColumnFilteredRowModelSync.d.ts +2 -2
- package/build/types/utils/getCoreRowModelAsync.d.ts +2 -2
- package/build/types/utils/getCoreRowModelSync.d.ts +2 -2
- package/build/types/utils/getExpandedRowModel.d.ts +3 -3
- package/build/types/utils/getGlobalFilteredRowModelAsync.d.ts +2 -2
- package/build/types/utils/getGlobalFilteredRowModelSync.d.ts +2 -2
- package/build/types/utils/getGroupedRowModel.d.ts +2 -2
- package/build/types/utils/getPaginationRowModel.d.ts +2 -2
- package/build/types/utils/getSortedRowModelAsync.d.ts +4 -4
- package/build/types/utils/getSortedRowModelSync.d.ts +2 -2
- package/build/types/utils.d.ts +0 -1
- package/build/umd/index.development.js +857 -671
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/core.ts +32 -554
- package/src/createTable.ts +12 -5
- package/src/features/Cells.ts +156 -0
- package/src/features/ColumnSizing.ts +109 -58
- package/src/features/Columns.ts +290 -0
- package/src/features/Expanding.ts +6 -7
- package/src/features/Filters.ts +14 -15
- package/src/features/Grouping.ts +16 -17
- package/src/features/Headers.ts +51 -142
- package/src/features/Ordering.ts +8 -7
- package/src/features/Pagination.ts +5 -6
- package/src/features/Pinning.ts +198 -8
- package/src/features/RowSelection.ts +9 -10
- package/src/features/Rows.ts +151 -0
- package/src/features/Sorting.ts +12 -13
- package/src/features/Visibility.ts +73 -27
- package/src/filterFns.ts +10 -10
- package/src/sortingFns.ts +7 -7
- package/src/types.ts +47 -65
- package/src/utils/filterRowsUtils.ts +3 -3
- package/src/utils/getColumnFilteredRowModelAsync.ts +2 -2
- package/src/utils/getColumnFilteredRowModelSync.ts +2 -2
- package/src/utils/getCoreRowModelAsync.ts +2 -2
- package/src/utils/getCoreRowModelSync.ts +2 -2
- package/src/utils/getExpandedRowModel.ts +3 -3
- package/src/utils/getGlobalFilteredRowModelAsync.ts +2 -2
- package/src/utils/getGlobalFilteredRowModelSync.ts +2 -2
- package/src/utils/getGroupedRowModel.ts +3 -3
- package/src/utils/getPaginationRowModel.ts +2 -2
- package/src/utils/getSortedRowModelAsync.ts +4 -4
- package/src/utils/getSortedRowModelSync.ts +2 -2
- package/src/utils.ts +3 -5
package/src/types.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
CoreColumnDef,
|
|
4
|
-
CoreOptions,
|
|
5
|
-
CoreRow,
|
|
6
|
-
CoreTableState,
|
|
7
|
-
TableCore,
|
|
8
|
-
} from './core'
|
|
1
|
+
import { CoreOptions, CoreTableState, TableCore } from './core'
|
|
2
|
+
import { ColumnsOptions, CoreColumn, CoreColumnDef } from './features/Columns'
|
|
9
3
|
import {
|
|
10
4
|
VisibilityInstance,
|
|
11
5
|
VisibilityTableState,
|
|
@@ -24,9 +18,11 @@ import {
|
|
|
24
18
|
ColumnPinningColumnDef,
|
|
25
19
|
ColumnPinningInstance,
|
|
26
20
|
ColumnPinningOptions,
|
|
21
|
+
ColumnPinningPosition,
|
|
22
|
+
ColumnPinningRow,
|
|
27
23
|
ColumnPinningTableState,
|
|
28
24
|
} from './features/Pinning'
|
|
29
|
-
import { HeadersInstance
|
|
25
|
+
import { HeadersInstance } from './features/Headers'
|
|
30
26
|
import {
|
|
31
27
|
FiltersColumn,
|
|
32
28
|
FiltersColumnDef,
|
|
@@ -56,7 +52,7 @@ import {
|
|
|
56
52
|
ExpandedTableState,
|
|
57
53
|
ExpandedRow,
|
|
58
54
|
} from './features/Expanding'
|
|
59
|
-
import { Overwrite
|
|
55
|
+
import { Overwrite } from './utils'
|
|
60
56
|
import {
|
|
61
57
|
ColumnSizingColumn,
|
|
62
58
|
ColumnSizingColumnDef,
|
|
@@ -76,41 +72,45 @@ import {
|
|
|
76
72
|
RowSelectionRow,
|
|
77
73
|
RowSelectionTableState,
|
|
78
74
|
} from './features/RowSelection'
|
|
75
|
+
import { ColumnsInstance } from './features/Columns'
|
|
76
|
+
import { CellsInstance, CellsRow } from './features/Cells'
|
|
77
|
+
import { CoreRow, RowsInstance, RowsOptions } from './features/Rows'
|
|
78
|
+
|
|
79
|
+
export type Updater<T> = T | ((old: T) => T)
|
|
80
|
+
export type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void
|
|
79
81
|
|
|
80
|
-
export type
|
|
81
|
-
Row
|
|
82
|
-
Value
|
|
83
|
-
FilterFns
|
|
84
|
-
SortingFns
|
|
85
|
-
AggregationFns
|
|
86
|
-
Render
|
|
87
|
-
ColumnMeta
|
|
88
|
-
TableMeta
|
|
82
|
+
export type TableGenerics = {
|
|
83
|
+
Row?: any
|
|
84
|
+
Value?: any
|
|
85
|
+
FilterFns?: any
|
|
86
|
+
SortingFns?: any
|
|
87
|
+
AggregationFns?: any
|
|
88
|
+
Render?: any
|
|
89
|
+
ColumnMeta?: any
|
|
90
|
+
TableMeta?: any
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
export type AnyRender = (Comp: any, props: any) => any
|
|
92
94
|
|
|
93
|
-
export type UseRenderer<TGenerics extends
|
|
95
|
+
export type UseRenderer<TGenerics extends TableGenerics> =
|
|
94
96
|
TGenerics['Render'] extends (...args: any) => any ? TGenerics['Render'] : any
|
|
95
97
|
|
|
96
|
-
export type PartialGenerics = Partial<DefaultGenerics>
|
|
97
|
-
|
|
98
|
-
export type AnyGenerics = {
|
|
99
|
-
[TKey in keyof PartialGenerics]?: any
|
|
100
|
-
}
|
|
101
|
-
|
|
102
98
|
export type TableFeature = {
|
|
103
99
|
getDefaultOptions?: (instance: any) => any
|
|
104
100
|
getInitialState?: () => any
|
|
105
|
-
|
|
101
|
+
createInstance?: (instance: any) => any
|
|
106
102
|
getDefaultColumn?: () => any
|
|
107
103
|
createColumn?: (column: any, instance: any) => any
|
|
104
|
+
createHeader?: (column: any, instance: any) => any
|
|
108
105
|
createCell?: (cell: any, column: any, row: any, instance: any) => any
|
|
109
106
|
createRow?: (row: any, instance: any) => any
|
|
110
107
|
}
|
|
111
108
|
|
|
112
|
-
export type TableInstance<TGenerics extends
|
|
109
|
+
export type TableInstance<TGenerics extends TableGenerics> =
|
|
113
110
|
TableCore<TGenerics> &
|
|
111
|
+
ColumnsInstance<TGenerics> &
|
|
112
|
+
RowsInstance<TGenerics> &
|
|
113
|
+
CellsInstance<TGenerics> &
|
|
114
114
|
VisibilityInstance<TGenerics> &
|
|
115
115
|
ColumnOrderInstance<TGenerics> &
|
|
116
116
|
ColumnPinningInstance<TGenerics> &
|
|
@@ -123,9 +123,9 @@ export type TableInstance<TGenerics extends AnyGenerics> =
|
|
|
123
123
|
PaginationInstance<TGenerics> &
|
|
124
124
|
RowSelectionInstance<TGenerics>
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
export type Options<TGenerics extends TableGenerics> = CoreOptions<TGenerics> &
|
|
127
|
+
ColumnsOptions<TGenerics> &
|
|
128
|
+
RowsOptions<TGenerics> &
|
|
129
129
|
VisibilityOptions &
|
|
130
130
|
ColumnOrderOptions &
|
|
131
131
|
ColumnPinningOptions &
|
|
@@ -137,9 +137,6 @@ export type Options<TGenerics extends AnyGenerics> = CoreOptions<TGenerics> &
|
|
|
137
137
|
PaginationOptions<TGenerics> &
|
|
138
138
|
RowSelectionOptions<TGenerics>
|
|
139
139
|
|
|
140
|
-
export type Updater<T> = T | ((old: T) => T)
|
|
141
|
-
export type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void
|
|
142
|
-
|
|
143
140
|
export type TableState = CoreTableState &
|
|
144
141
|
VisibilityTableState &
|
|
145
142
|
ColumnOrderTableState &
|
|
@@ -152,9 +149,10 @@ export type TableState = CoreTableState &
|
|
|
152
149
|
PaginationTableState &
|
|
153
150
|
RowSelectionTableState
|
|
154
151
|
|
|
155
|
-
export type Row<TGenerics extends
|
|
152
|
+
export type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> &
|
|
153
|
+
CellsRow<TGenerics> &
|
|
156
154
|
VisibilityRow<TGenerics> &
|
|
157
|
-
|
|
155
|
+
ColumnPinningRow<TGenerics> &
|
|
158
156
|
GroupingRow &
|
|
159
157
|
RowSelectionRow &
|
|
160
158
|
ExpandedRow
|
|
@@ -163,7 +161,7 @@ export type RowValues = {
|
|
|
163
161
|
[key: string]: any
|
|
164
162
|
}
|
|
165
163
|
|
|
166
|
-
export type RowModel<TGenerics extends
|
|
164
|
+
export type RowModel<TGenerics extends TableGenerics> = {
|
|
167
165
|
rows: Row<TGenerics>[]
|
|
168
166
|
flatRows: Row<TGenerics>[]
|
|
169
167
|
rowsById: Record<string, Row<TGenerics>>
|
|
@@ -171,30 +169,11 @@ export type RowModel<TGenerics extends AnyGenerics> = {
|
|
|
171
169
|
|
|
172
170
|
export type AccessorFn<TData> = (originalRow: TData, index: number) => any
|
|
173
171
|
|
|
174
|
-
|
|
175
|
-
// ColumnDef<TGenerics>,
|
|
176
|
-
// GeneratedProperties<false>
|
|
177
|
-
// >
|
|
178
|
-
|
|
179
|
-
// type _GeneratedProperties = {
|
|
180
|
-
// ['Column definitions should be generated with the table.createColumn() (and related) utilities']: false
|
|
181
|
-
// }
|
|
182
|
-
|
|
183
|
-
// export type GeneratedProperties<T> = T extends true
|
|
184
|
-
// ? {
|
|
185
|
-
// [TKey in keyof _GeneratedProperties]: true
|
|
186
|
-
// }
|
|
187
|
-
// : T extends false
|
|
188
|
-
// ? {
|
|
189
|
-
// [TKey in keyof _GeneratedProperties]?: false
|
|
190
|
-
// }
|
|
191
|
-
// : never
|
|
192
|
-
|
|
193
|
-
export type Renderable<TGenerics extends AnyGenerics, TProps> =
|
|
172
|
+
export type Renderable<TGenerics extends TableGenerics, TProps> =
|
|
194
173
|
| string
|
|
195
174
|
| ((props: TProps) => ReturnType<UseRenderer<TGenerics>>)
|
|
196
175
|
|
|
197
|
-
export type ColumnDef<TGenerics extends
|
|
176
|
+
export type ColumnDef<TGenerics extends TableGenerics> =
|
|
198
177
|
CoreColumnDef<TGenerics> &
|
|
199
178
|
VisibilityColumnDef &
|
|
200
179
|
ColumnPinningColumnDef &
|
|
@@ -203,7 +182,7 @@ export type ColumnDef<TGenerics extends AnyGenerics> =
|
|
|
203
182
|
GroupingColumnDef<TGenerics> &
|
|
204
183
|
ColumnSizingColumnDef
|
|
205
184
|
|
|
206
|
-
export type Column<TGenerics extends
|
|
185
|
+
export type Column<TGenerics extends TableGenerics> = ColumnDef<TGenerics> &
|
|
207
186
|
CoreColumn<TGenerics> &
|
|
208
187
|
ColumnVisibilityColumn &
|
|
209
188
|
ColumnPinningColumn &
|
|
@@ -212,10 +191,10 @@ export type Column<TGenerics extends AnyGenerics> = ColumnDef<TGenerics> &
|
|
|
212
191
|
GroupingColumn<TGenerics> &
|
|
213
192
|
ColumnSizingColumn<TGenerics>
|
|
214
193
|
|
|
215
|
-
export type Cell<TGenerics extends
|
|
194
|
+
export type Cell<TGenerics extends TableGenerics> = CoreCell<TGenerics> &
|
|
216
195
|
GroupingCell<TGenerics>
|
|
217
196
|
|
|
218
|
-
export type CoreCell<TGenerics extends
|
|
197
|
+
export type CoreCell<TGenerics extends TableGenerics> = {
|
|
219
198
|
id: string
|
|
220
199
|
rowId: string
|
|
221
200
|
columnId: string
|
|
@@ -226,14 +205,17 @@ export type CoreCell<TGenerics extends AnyGenerics> = {
|
|
|
226
205
|
renderCell: () => string | null | ReturnType<UseRenderer<TGenerics>>
|
|
227
206
|
}
|
|
228
207
|
|
|
229
|
-
export type Header<TGenerics extends
|
|
208
|
+
export type Header<TGenerics extends TableGenerics> = CoreHeader<TGenerics> &
|
|
230
209
|
ColumnSizingHeader<TGenerics>
|
|
231
210
|
|
|
232
|
-
export type CoreHeader<TGenerics extends
|
|
211
|
+
export type CoreHeader<TGenerics extends TableGenerics> = {
|
|
233
212
|
id: string
|
|
213
|
+
index: number
|
|
234
214
|
depth: number
|
|
235
215
|
column: Column<TGenerics>
|
|
236
|
-
|
|
216
|
+
getStart: () => number
|
|
217
|
+
getSize: () => number
|
|
218
|
+
headerGroup: HeaderGroup<TGenerics>
|
|
237
219
|
subHeaders: Header<TGenerics>[]
|
|
238
220
|
colSpan?: number
|
|
239
221
|
rowSpan?: number
|
|
@@ -250,7 +232,7 @@ export type CoreHeader<TGenerics extends AnyGenerics> = {
|
|
|
250
232
|
}) => string | null | ReturnType<UseRenderer<TGenerics>>
|
|
251
233
|
}
|
|
252
234
|
|
|
253
|
-
export type HeaderGroup<TGenerics extends
|
|
235
|
+
export type HeaderGroup<TGenerics extends TableGenerics> = {
|
|
254
236
|
id: string
|
|
255
237
|
depth: number
|
|
256
238
|
headers: Header<TGenerics>[]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableGenerics, Row, RowModel, TableInstance } from '../types'
|
|
2
2
|
|
|
3
|
-
export function filterRowModelFromLeafs<TGenerics extends
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
1
|
+
import { TableInstance, Row, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { getBatchGroups, incrementalMemo } from '../utils'
|
|
3
3
|
|
|
4
|
-
export function getCoreRowModelAsync<TGenerics extends
|
|
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,
|
|
1
|
+
import { TableInstance, Row, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { memo } from '../utils'
|
|
3
3
|
|
|
4
|
-
export function getCoreRowModelSync<TGenerics extends
|
|
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,
|
|
1
|
+
import { TableInstance, Row, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { memo } from '../utils'
|
|
3
3
|
|
|
4
|
-
export function getExpandedRowModel<TGenerics extends
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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 getGlobalFilteredRowModelSync<
|
|
9
|
-
TGenerics extends
|
|
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,
|
|
1
|
+
import { TableInstance, Row, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { flattenBy, memo } from '../utils'
|
|
3
3
|
|
|
4
|
-
export function getGroupedRowModelSync<TGenerics extends
|
|
4
|
+
export function getGroupedRowModelSync<TGenerics extends TableGenerics>(): (
|
|
5
5
|
instance: TableInstance<TGenerics>
|
|
6
6
|
) => () => RowModel<TGenerics> {
|
|
7
7
|
return instance =>
|
|
@@ -172,7 +172,7 @@ export function getGroupedRowModelSync<TGenerics extends AnyGenerics>(): (
|
|
|
172
172
|
)
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
function groupBy<TGenerics extends
|
|
175
|
+
function groupBy<TGenerics extends TableGenerics>(
|
|
176
176
|
rows: Row<TGenerics>[],
|
|
177
177
|
columnId: string
|
|
178
178
|
) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TableInstance, RowModel,
|
|
1
|
+
import { TableInstance, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { memo } from '../utils'
|
|
3
3
|
import { expandRows } from './getExpandedRowModel'
|
|
4
4
|
|
|
5
|
-
export function getPaginationRowModel<TGenerics extends
|
|
5
|
+
export function getPaginationRowModel<TGenerics extends TableGenerics>(opts?: {
|
|
6
6
|
initialSync: boolean
|
|
7
7
|
}): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
|
|
8
8
|
return instance =>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TableInstance, Row, RowModel,
|
|
1
|
+
import { TableInstance, Row, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { SortingFn } from '../features/Sorting'
|
|
3
3
|
import { incrementalMemo, memo } from '../utils'
|
|
4
4
|
|
|
5
|
-
export function getSortedRowModelSync<TGenerics extends
|
|
5
|
+
export function getSortedRowModelSync<TGenerics extends TableGenerics>(opts?: {
|
|
6
6
|
initialSync?: boolean
|
|
7
7
|
}): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
|
|
8
8
|
return instance =>
|
|
@@ -91,7 +91,7 @@ export function getSortedRowModelSync<TGenerics extends AnyGenerics>(opts?: {
|
|
|
91
91
|
)
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
type Sorter<TGenerics extends
|
|
94
|
+
type Sorter<TGenerics extends TableGenerics> = {
|
|
95
95
|
id: string
|
|
96
96
|
compare: (a: Row<TGenerics>, b: Row<TGenerics>) => number
|
|
97
97
|
desc?: boolean
|
|
@@ -99,7 +99,7 @@ type Sorter<TGenerics extends AnyGenerics> = {
|
|
|
99
99
|
invertSorting?: boolean
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
export function quicksort<TGenerics extends
|
|
102
|
+
export function quicksort<TGenerics extends TableGenerics>(
|
|
103
103
|
rows: Row<TGenerics>[],
|
|
104
104
|
sorters: Sorter<TGenerics>[]
|
|
105
105
|
): Row<TGenerics>[] {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TableInstance, Row, RowModel,
|
|
1
|
+
import { TableInstance, Row, RowModel, TableGenerics } from '../types'
|
|
2
2
|
import { SortingFn } from '../features/Sorting'
|
|
3
3
|
import { memo } from '../utils'
|
|
4
4
|
|
|
5
|
-
export function getSortedRowModelSync<TGenerics extends
|
|
5
|
+
export function getSortedRowModelSync<TGenerics extends TableGenerics>(): (
|
|
6
6
|
instance: TableInstance<TGenerics>
|
|
7
7
|
) => () => RowModel<TGenerics> {
|
|
8
8
|
return instance =>
|
package/src/utils.ts
CHANGED
|
@@ -12,20 +12,18 @@ export type Overwrite<T, U extends { [TKey in keyof T]?: any }> = Omit<
|
|
|
12
12
|
|
|
13
13
|
export type IfDefined<T, N> = 0 extends 1 & T ? N : T extends {} ? T : N
|
|
14
14
|
|
|
15
|
-
// export type DefinedGenericKeys<T extends
|
|
15
|
+
// export type DefinedGenericKeys<T extends TableGenerics> = {
|
|
16
16
|
// [K in keyof T]: 0 extends 1 & T[K] ? never : T[K] extends {} ? K : never
|
|
17
17
|
// }[keyof T]
|
|
18
18
|
|
|
19
|
-
// export type DefinedGenerics<T extends
|
|
19
|
+
// export type DefinedGenerics<T extends TableGenerics> = Pick<
|
|
20
20
|
// T,
|
|
21
21
|
// DefinedGenericKeys<T>
|
|
22
22
|
// >
|
|
23
23
|
|
|
24
|
-
export type DataUpdateFunction<T> = (input: T) => T
|
|
25
|
-
|
|
26
24
|
export function functionalUpdate<T>(updater: Updater<T>, input: T): T {
|
|
27
25
|
return typeof updater === 'function'
|
|
28
|
-
? (updater as
|
|
26
|
+
? (updater as (input: T) => T)(input)
|
|
29
27
|
: updater
|
|
30
28
|
}
|
|
31
29
|
|