@tanstack/table-core 8.0.0-alpha.19 → 8.0.0-alpha.22
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.map +1 -1
- package/build/cjs/createTable.js +1 -0
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js +7 -9
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js.map +1 -1
- 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 +6 -0
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterTypes.js.map +1 -1
- package/build/cjs/index.js +0 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/sortTypes.js.map +1 -1
- package/build/cjs/utils/columnFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/expandRowsFn.js +1 -2
- package/build/cjs/utils/expandRowsFn.js.map +1 -1
- package/build/cjs/utils/globalFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/groupRowsFn.js.map +1 -1
- package/build/cjs/utils/sortRowsFn.js.map +1 -1
- package/build/esm/index.js +17 -16
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +266 -284
- package/build/types/core.d.ts +1 -2
- package/build/types/createTable.d.ts +12 -13
- package/build/types/features/Expanding.d.ts +1 -0
- package/build/types/features/Pinning.d.ts +1 -0
- package/build/types/features/RowSelection.d.ts +2 -2
- package/build/types/types.d.ts +1 -5
- package/build/umd/index.development.js +16 -16
- 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.tsx +1 -2
- package/src/createTable.tsx +19 -43
- package/src/features/ColumnSizing.ts +1 -0
- package/src/features/Expanding.ts +9 -7
- package/src/features/Filters.ts +1 -0
- package/src/features/Grouping.ts +1 -0
- package/src/features/Headers.ts +1 -0
- package/src/features/Ordering.ts +1 -0
- package/src/features/Pagination.ts +4 -2
- package/src/features/Pinning.ts +8 -0
- package/src/features/RowSelection.ts +2 -2
- package/src/features/Sorting.ts +1 -0
- package/src/features/Visibility.ts +1 -0
- package/src/filterTypes.ts +1 -1
- package/src/sortTypes.ts +1 -1
- package/src/types.ts +19 -10
- package/src/utils/columnFilterRowsFn.ts +7 -1
- package/src/utils/expandRowsFn.ts +8 -4
- package/src/utils/globalFilterRowsFn.ts +7 -1
- package/src/utils/groupRowsFn.ts +8 -2
- package/src/utils/sortRowsFn.ts +7 -1
- package/build/cjs/types.js +0 -19
- package/build/cjs/types.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.
|
|
4
|
+
"version": "8.0.0-alpha.22",
|
|
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.tsx
CHANGED
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
CellProps,
|
|
27
27
|
TableInstance,
|
|
28
28
|
RowValues,
|
|
29
|
-
Please_use_the_create_table_column_utilities_to_define_columns,
|
|
30
29
|
PartialGenerics,
|
|
31
30
|
CoreCell,
|
|
32
31
|
Renderable,
|
|
@@ -197,8 +196,8 @@ export type CoreColumnDef<TGenerics extends PartialGenerics> = {
|
|
|
197
196
|
}
|
|
198
197
|
>
|
|
199
198
|
meta?: TGenerics['ColumnMeta']
|
|
200
|
-
[Please_use_the_create_table_column_utilities_to_define_columns]: true
|
|
201
199
|
}
|
|
200
|
+
// & GeneratedProperties<true>
|
|
202
201
|
|
|
203
202
|
export type CoreColumn<TGenerics extends PartialGenerics> = {
|
|
204
203
|
id: string
|
package/src/createTable.tsx
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { CustomFilterTypes } from './features/Filters'
|
|
2
2
|
import { CustomAggregationTypes } from './features/Grouping'
|
|
3
3
|
import { CustomSortingTypes } from './features/Sorting'
|
|
4
|
-
import {
|
|
5
|
-
ColumnDef,
|
|
6
|
-
AccessorFn,
|
|
7
|
-
PartialGenerics,
|
|
8
|
-
_NonGenerated,
|
|
9
|
-
AnyRender,
|
|
10
|
-
} from './types'
|
|
4
|
+
import { ColumnDef, AccessorFn, PartialGenerics, AnyRender } from './types'
|
|
11
5
|
import { Overwrite, PartialKeys } from './utils'
|
|
12
6
|
|
|
13
7
|
export type CreateTableFactory<TGenerics extends PartialGenerics> = <
|
|
@@ -35,42 +29,40 @@ export type CreateTableFactoryOptions<
|
|
|
35
29
|
}
|
|
36
30
|
|
|
37
31
|
export type Table<TGenerics extends PartialGenerics> = {
|
|
32
|
+
generics: TGenerics
|
|
38
33
|
__options: CreateTableFactoryOptions<any, any, any, any>
|
|
39
|
-
createColumns:
|
|
34
|
+
createColumns: <TColumnDef extends ColumnDef<any>>(
|
|
35
|
+
columns: TColumnDef[]
|
|
36
|
+
) => TColumnDef[]
|
|
40
37
|
createGroup: (
|
|
41
38
|
column: Overwrite<
|
|
42
39
|
| Overwrite<
|
|
43
|
-
|
|
40
|
+
ColumnDef<any>,
|
|
44
41
|
{
|
|
45
42
|
header: string
|
|
46
43
|
id?: string
|
|
47
44
|
}
|
|
48
45
|
>
|
|
49
46
|
| Overwrite<
|
|
50
|
-
|
|
47
|
+
ColumnDef<any>,
|
|
51
48
|
{
|
|
52
49
|
id: string
|
|
53
|
-
header?: string |
|
|
50
|
+
header?: string | ((...any: any) => any)
|
|
54
51
|
}
|
|
55
52
|
>,
|
|
56
53
|
{
|
|
57
54
|
accessorFn?: never
|
|
58
55
|
accessorKey?: never
|
|
59
|
-
// This is sketchy, but allows the column helper pattern we want.
|
|
60
|
-
// Someone smarter than me could probably do this better.
|
|
61
56
|
columns?: ColumnDef<any>[]
|
|
62
57
|
}
|
|
63
58
|
>
|
|
64
59
|
) => ColumnDef<TGenerics>
|
|
65
60
|
createDisplayColumn: (
|
|
66
|
-
column:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
columns?: ColumnDef<any>[]
|
|
72
|
-
}>,
|
|
73
|
-
'accessorFn' | 'accessorKey'
|
|
61
|
+
column: Overwrite<
|
|
62
|
+
PartialKeys<ColumnDef<TGenerics>, 'accessorFn' | 'accessorKey'>,
|
|
63
|
+
{
|
|
64
|
+
columns?: ColumnDef<any>[]
|
|
65
|
+
}
|
|
74
66
|
>
|
|
75
67
|
) => ColumnDef<TGenerics>
|
|
76
68
|
createDataColumn: <
|
|
@@ -80,16 +72,12 @@ export type Table<TGenerics extends PartialGenerics> = {
|
|
|
80
72
|
column: Overwrite<
|
|
81
73
|
TAccessor extends (...args: any[]) => any
|
|
82
74
|
? // Accessor Fn
|
|
83
|
-
|
|
84
|
-
ColumnDef<Overwrite<TGenerics, { Value: ReturnType<TAccessor> }>>
|
|
85
|
-
>
|
|
75
|
+
ColumnDef<Overwrite<TGenerics, { Value: ReturnType<TAccessor> }>>
|
|
86
76
|
: TAccessor extends keyof TGenerics['Row']
|
|
87
77
|
? // Accessor Key
|
|
88
78
|
Overwrite<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Overwrite<TGenerics, { Value: TGenerics['Row'][TAccessor] }>
|
|
92
|
-
>
|
|
79
|
+
ColumnDef<
|
|
80
|
+
Overwrite<TGenerics, { Value: TGenerics['Row'][TAccessor] }>
|
|
93
81
|
>,
|
|
94
82
|
{
|
|
95
83
|
id?: string
|
|
@@ -98,24 +86,11 @@ export type Table<TGenerics extends PartialGenerics> = {
|
|
|
98
86
|
: never,
|
|
99
87
|
{
|
|
100
88
|
accessorFn?: never
|
|
101
|
-
accessorKey?: never
|
|
102
|
-
// This is sketchy, but allows the column helper pattern we want.
|
|
103
|
-
// Someone smarter than me could probably do this better.
|
|
89
|
+
accessorKey?: never
|
|
104
90
|
columns?: ColumnDef<any>[]
|
|
105
91
|
}
|
|
106
92
|
>
|
|
107
|
-
) => ColumnDef<
|
|
108
|
-
Overwrite<
|
|
109
|
-
TGenerics,
|
|
110
|
-
{
|
|
111
|
-
Value: TAccessor extends (...args: any[]) => any
|
|
112
|
-
? ReturnType<TAccessor>
|
|
113
|
-
: TAccessor extends keyof TGenerics['Row']
|
|
114
|
-
? TGenerics['Row'][TAccessor]
|
|
115
|
-
: never
|
|
116
|
-
}
|
|
117
|
-
>
|
|
118
|
-
>
|
|
93
|
+
) => ColumnDef<TGenerics>
|
|
119
94
|
}
|
|
120
95
|
|
|
121
96
|
type InitTable<TRender extends AnyRender> = {
|
|
@@ -145,6 +120,7 @@ function _createTable<TGenerics extends PartialGenerics>(
|
|
|
145
120
|
__options?: CreateTableFactoryOptions<any, any, any, any>
|
|
146
121
|
): Table<TGenerics> {
|
|
147
122
|
return {
|
|
123
|
+
generics: undefined!,
|
|
148
124
|
__options: __options ?? {
|
|
149
125
|
render: () => {
|
|
150
126
|
throw new Error()
|
|
@@ -3,6 +3,7 @@ import { RowModel } from '..'
|
|
|
3
3
|
import {
|
|
4
4
|
Getter,
|
|
5
5
|
OnChangeFn,
|
|
6
|
+
AnyGenerics,
|
|
6
7
|
PartialGenerics,
|
|
7
8
|
PropGetterValue,
|
|
8
9
|
TableInstance,
|
|
@@ -61,6 +62,7 @@ export type ExpandedInstance<TGenerics extends PartialGenerics> = {
|
|
|
61
62
|
getToggleAllRowsExpandedProps: <TGetter extends Getter<ToggleExpandedProps>>(
|
|
62
63
|
userProps?: TGetter
|
|
63
64
|
) => undefined | PropGetterValue<ToggleExpandedProps, TGetter>
|
|
65
|
+
getIsSomeRowsExpanded: () => boolean
|
|
64
66
|
getIsAllRowsExpanded: () => boolean
|
|
65
67
|
getExpandedDepth: () => number
|
|
66
68
|
getExpandedRowModel: () => RowModel<TGenerics>
|
|
@@ -82,7 +84,6 @@ export const Expanding = {
|
|
|
82
84
|
return {
|
|
83
85
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
84
86
|
autoResetExpanded: true,
|
|
85
|
-
getIsRowExpanded: row => !!(row?.original as { expanded?: any }).expanded,
|
|
86
87
|
expandSubRows: true,
|
|
87
88
|
paginateExpandedRows: true,
|
|
88
89
|
}
|
|
@@ -160,7 +161,7 @@ export const Expanding = {
|
|
|
160
161
|
instance.setExpanded(instance.initialState?.expanded ?? {})
|
|
161
162
|
},
|
|
162
163
|
getIsRowExpanded: rowId => {
|
|
163
|
-
const row = instance.
|
|
164
|
+
const row = instance.getPreExpandedRowModel().rowsById[rowId]
|
|
164
165
|
|
|
165
166
|
if (!row) {
|
|
166
167
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -175,7 +176,7 @@ export const Expanding = {
|
|
|
175
176
|
|
|
176
177
|
return !!(
|
|
177
178
|
instance.options.getIsRowExpanded?.(row) ??
|
|
178
|
-
(expanded || expanded?.[rowId])
|
|
179
|
+
(expanded === true || expanded?.[rowId])
|
|
179
180
|
)
|
|
180
181
|
},
|
|
181
182
|
getRowCanExpand: rowId => {
|
|
@@ -229,6 +230,10 @@ export const Expanding = {
|
|
|
229
230
|
|
|
230
231
|
return propGetter(initialProps, userProps)
|
|
231
232
|
},
|
|
233
|
+
getIsSomeRowsExpanded: () => {
|
|
234
|
+
const expanded = instance.getState().expanded
|
|
235
|
+
return expanded === true || Object.values(expanded).some(Boolean)
|
|
236
|
+
},
|
|
232
237
|
getIsAllRowsExpanded: () => {
|
|
233
238
|
const expanded = instance.getState().expanded
|
|
234
239
|
|
|
@@ -276,7 +281,7 @@ export const Expanding = {
|
|
|
276
281
|
!expandRowsFn ||
|
|
277
282
|
// Do not expand if rows are not included in pagination
|
|
278
283
|
!paginateExpandedRows ||
|
|
279
|
-
!Object.keys(expanded ?? {}).length
|
|
284
|
+
(expanded !== true && !Object.keys(expanded ?? {}).length)
|
|
280
285
|
) {
|
|
281
286
|
return rowModel
|
|
282
287
|
}
|
|
@@ -286,9 +291,6 @@ export const Expanding = {
|
|
|
286
291
|
{
|
|
287
292
|
key: 'getExpandedRowModel',
|
|
288
293
|
debug: () => instance.options.debugAll ?? instance.options.debugTable,
|
|
289
|
-
onChange: () => {
|
|
290
|
-
instance._notifyPageIndexReset()
|
|
291
|
-
},
|
|
292
294
|
}
|
|
293
295
|
),
|
|
294
296
|
|
package/src/features/Filters.ts
CHANGED
package/src/features/Grouping.ts
CHANGED
package/src/features/Headers.ts
CHANGED
package/src/features/Ordering.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OnChangeFn,
|
|
3
|
+
AnyGenerics,
|
|
3
4
|
PartialGenerics,
|
|
4
5
|
TableInstance,
|
|
5
6
|
RowModel,
|
|
@@ -186,8 +187,9 @@ export const Pagination = {
|
|
|
186
187
|
getCanPreviousPage: () => instance.getState().pagination.pageIndex > 0,
|
|
187
188
|
|
|
188
189
|
getCanNextPage: () => {
|
|
189
|
-
const { pageIndex,
|
|
190
|
-
|
|
190
|
+
const { pageIndex, pageSize } = instance.getState().pagination
|
|
191
|
+
|
|
192
|
+
const pageCount = instance.getPageCount()
|
|
191
193
|
|
|
192
194
|
if (pageCount === -1) {
|
|
193
195
|
return true
|
package/src/features/Pinning.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Updater,
|
|
4
4
|
TableInstance,
|
|
5
5
|
Column,
|
|
6
|
+
AnyGenerics,
|
|
6
7
|
PartialGenerics,
|
|
7
8
|
} from '../types'
|
|
8
9
|
import { functionalUpdate, makeStateUpdater } from '../utils'
|
|
@@ -46,6 +47,7 @@ export type ColumnPinningInstance<TGenerics extends PartialGenerics> = {
|
|
|
46
47
|
getColumnCanPin: (columnId: string) => boolean
|
|
47
48
|
getColumnIsPinned: (columnId: string) => ColumnPinningPosition
|
|
48
49
|
getColumnPinnedIndex: (columnId: string) => number
|
|
50
|
+
getIsSomeColumnsPinned: () => boolean
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
//
|
|
@@ -172,6 +174,12 @@ export const Pinning = {
|
|
|
172
174
|
-1
|
|
173
175
|
: 0
|
|
174
176
|
},
|
|
177
|
+
|
|
178
|
+
getIsSomeColumnsPinned: () => {
|
|
179
|
+
const { left, right } = instance.getState().columnPinning
|
|
180
|
+
|
|
181
|
+
return Boolean(left?.length || right?.length)
|
|
182
|
+
},
|
|
175
183
|
}
|
|
176
184
|
},
|
|
177
185
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Getter,
|
|
3
3
|
OnChangeFn,
|
|
4
|
+
AnyGenerics,
|
|
4
5
|
PartialGenerics,
|
|
5
6
|
PropGetterValue,
|
|
6
7
|
TableInstance,
|
|
7
8
|
Row,
|
|
8
9
|
RowModel,
|
|
9
10
|
Updater,
|
|
10
|
-
AnyGenerics,
|
|
11
11
|
} from '../types'
|
|
12
12
|
import { functionalUpdate, makeStateUpdater, memo, propGetter } from '../utils'
|
|
13
13
|
|
|
@@ -581,7 +581,7 @@ const mutateRowIsSelected = <TGenerics extends PartialGenerics>(
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
|
|
584
|
-
export function selectRowsFn<TGenerics extends
|
|
584
|
+
export function selectRowsFn<TGenerics extends PartialGenerics>(
|
|
585
585
|
instance: TableInstance<TGenerics>,
|
|
586
586
|
rowModel: RowModel<TGenerics>
|
|
587
587
|
): RowModel<TGenerics> {
|
package/src/features/Sorting.ts
CHANGED
package/src/filterTypes.ts
CHANGED
package/src/sortTypes.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -94,7 +94,7 @@ export type UseRenderer<TGenerics extends PartialGenerics> =
|
|
|
94
94
|
export type PartialGenerics = Partial<DefaultGenerics>
|
|
95
95
|
|
|
96
96
|
export type AnyGenerics = {
|
|
97
|
-
[TKey in keyof PartialGenerics]
|
|
97
|
+
[TKey in keyof PartialGenerics]?: any
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export type TableInstance<TGenerics extends PartialGenerics> =
|
|
@@ -159,15 +159,24 @@ export type RowModel<TGenerics extends PartialGenerics> = {
|
|
|
159
159
|
|
|
160
160
|
export type AccessorFn<TData> = (originalRow: TData, index: number) => any
|
|
161
161
|
|
|
162
|
-
export
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
162
|
+
// export type UserColumnDef<TGenerics extends PartialGenerics> = Overwrite<
|
|
163
|
+
// ColumnDef<TGenerics>,
|
|
164
|
+
// GeneratedProperties<false>
|
|
165
|
+
// >
|
|
166
|
+
|
|
167
|
+
// type _GeneratedProperties = {
|
|
168
|
+
// ['Column definitions should be generated with the table.createColumn() (and related) utilities']: false
|
|
169
|
+
// }
|
|
170
|
+
|
|
171
|
+
// export type GeneratedProperties<T> = T extends true
|
|
172
|
+
// ? {
|
|
173
|
+
// [TKey in keyof _GeneratedProperties]: true
|
|
174
|
+
// }
|
|
175
|
+
// : T extends false
|
|
176
|
+
// ? {
|
|
177
|
+
// [TKey in keyof _GeneratedProperties]?: false
|
|
178
|
+
// }
|
|
179
|
+
// : never
|
|
171
180
|
|
|
172
181
|
export type Renderable<TGenerics extends PartialGenerics, TProps> =
|
|
173
182
|
| string
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AnyGenerics,
|
|
3
|
+
TableInstance,
|
|
4
|
+
Row,
|
|
5
|
+
RowModel,
|
|
6
|
+
PartialGenerics,
|
|
7
|
+
} from '../types'
|
|
2
8
|
|
|
3
9
|
export function columnFilterRowsFn<TGenerics extends AnyGenerics>(
|
|
4
10
|
instance: TableInstance<TGenerics>,
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TableInstance,
|
|
3
|
+
Row,
|
|
4
|
+
RowModel,
|
|
5
|
+
AnyGenerics,
|
|
6
|
+
PartialGenerics,
|
|
7
|
+
} from '../types'
|
|
2
8
|
|
|
3
9
|
export function expandRowsFn<TGenerics extends AnyGenerics>(
|
|
4
10
|
instance: TableInstance<TGenerics>,
|
|
@@ -6,13 +12,11 @@ export function expandRowsFn<TGenerics extends AnyGenerics>(
|
|
|
6
12
|
): RowModel<TGenerics> {
|
|
7
13
|
const expandedRows: Row<TGenerics>[] = []
|
|
8
14
|
|
|
9
|
-
const { expandSubRows } = instance.options
|
|
10
|
-
|
|
11
15
|
const handleRow = (row: Row<TGenerics>) => {
|
|
12
16
|
expandedRows.push(row)
|
|
13
17
|
|
|
14
18
|
if (
|
|
15
|
-
expandSubRows &&
|
|
19
|
+
instance.options.expandSubRows &&
|
|
16
20
|
row.subRows?.length &&
|
|
17
21
|
instance.getIsRowExpanded(row.id)
|
|
18
22
|
) {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TableInstance,
|
|
3
|
+
Row,
|
|
4
|
+
RowModel,
|
|
5
|
+
AnyGenerics,
|
|
6
|
+
PartialGenerics,
|
|
7
|
+
} from '../types'
|
|
2
8
|
|
|
3
9
|
export function globalFilterRowsFn<TGenerics extends AnyGenerics>(
|
|
4
10
|
instance: TableInstance<TGenerics>,
|
package/src/utils/groupRowsFn.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TableInstance,
|
|
3
|
+
Row,
|
|
4
|
+
RowModel,
|
|
5
|
+
AnyGenerics,
|
|
6
|
+
PartialGenerics,
|
|
7
|
+
} from '../types'
|
|
2
8
|
import { flattenBy } from '../utils'
|
|
3
9
|
|
|
4
10
|
export function groupRowsFn<TGenerics extends AnyGenerics>(
|
|
@@ -151,7 +157,7 @@ export function groupRowsFn<TGenerics extends AnyGenerics>(
|
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
|
|
154
|
-
function groupBy<TGenerics extends
|
|
160
|
+
function groupBy<TGenerics extends PartialGenerics>(
|
|
155
161
|
rows: Row<TGenerics>[],
|
|
156
162
|
columnId: string
|
|
157
163
|
) {
|
package/src/utils/sortRowsFn.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TableInstance,
|
|
3
|
+
Row,
|
|
4
|
+
RowModel,
|
|
5
|
+
AnyGenerics,
|
|
6
|
+
PartialGenerics,
|
|
7
|
+
} from '../types'
|
|
2
8
|
import { SortingFn } from '../features/Sorting'
|
|
3
9
|
|
|
4
10
|
export function sortRowsFn<TGenerics extends AnyGenerics>(
|
package/build/cjs/types.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* table-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
var Please_use_the_create_table_column_utilities_to_define_columns = Symbol();
|
|
17
|
-
|
|
18
|
-
exports.Please_use_the_create_table_column_utilities_to_define_columns = Please_use_the_create_table_column_utilities_to_define_columns;
|
|
19
|
-
//# sourceMappingURL=types.js.map
|
package/build/cjs/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import {\n CoreColumn,\n CoreColumnDef,\n CoreOptions,\n CoreRow,\n TableCore,\n} from './core'\nimport {\n VisibilityInstance,\n VisibilityTableState,\n VisibilityColumn as ColumnVisibilityColumn,\n VisibilityOptions,\n VisibilityColumnDef,\n VisibilityRow,\n} from './features/Visibility'\nimport {\n ColumnOrderInstance,\n ColumnOrderOptions,\n ColumnOrderTableState,\n} from './features/Ordering'\nimport {\n ColumnPinningColumn,\n ColumnPinningColumnDef,\n ColumnPinningInstance,\n ColumnPinningOptions,\n ColumnPinningTableState,\n} from './features/Pinning'\nimport { HeadersInstance, HeadersRow } from './features/Headers'\nimport {\n FiltersColumn,\n FiltersColumnDef,\n FiltersInstance,\n FiltersOptions,\n FiltersTableState,\n} from './features/Filters'\nimport {\n SortingColumn,\n SortingColumnDef,\n SortingInstance,\n SortingOptions,\n SortingTableState,\n} from './features/Sorting'\nimport {\n GroupingCell,\n GroupingColumn,\n GroupingColumnDef,\n GroupingInstance,\n GroupingOptions,\n GroupingRow,\n GroupingTableState,\n} from './features/Grouping'\nimport {\n ExpandedInstance,\n ExpandedOptions,\n ExpandedTableState,\n ExpandedRow,\n} from './features/Expanding'\nimport { Overwrite, PartialKeys } from './utils'\nimport {\n ColumnSizingColumn,\n ColumnSizingColumnDef,\n ColumnSizingHeader,\n ColumnSizingInstance,\n ColumnSizingOptions,\n ColumnSizingTableState,\n} from './features/ColumnSizing'\nimport {\n PaginationInstance,\n PaginationOptions,\n PaginationTableState,\n} from './features/Pagination'\nimport {\n RowSelectionInstance,\n RowSelectionOptions,\n RowSelectionRow,\n RowSelectionTableState,\n} from './features/RowSelection'\n\nexport type DefaultGenerics = {\n Row: unknown\n Value: unknown\n FilterFns: object\n SortingFns: object\n AggregationFns: object\n Render: unknown\n ColumnMeta: object\n}\n\nexport type AnyRender = (Comp: any, props: any) => any\n\nexport type UseRenderer<TGenerics extends PartialGenerics> =\n TGenerics['Render'] extends (...args: any) => any ? TGenerics['Render'] : any\n\nexport type PartialGenerics = Partial<DefaultGenerics>\n\nexport type AnyGenerics = {\n [TKey in keyof PartialGenerics]: any\n}\n\nexport type TableInstance<TGenerics extends PartialGenerics> =\n TableCore<TGenerics> &\n VisibilityInstance<TGenerics> &\n ColumnOrderInstance<TGenerics> &\n ColumnPinningInstance<TGenerics> &\n HeadersInstance<TGenerics> &\n FiltersInstance<TGenerics> &\n SortingInstance<TGenerics> &\n GroupingInstance<TGenerics> &\n ColumnSizingInstance<TGenerics> &\n ExpandedInstance<TGenerics> &\n PaginationInstance<TGenerics> &\n RowSelectionInstance<TGenerics>\n\n//\n\nexport type Options<TGenerics extends PartialGenerics> =\n CoreOptions<TGenerics> &\n VisibilityOptions &\n ColumnOrderOptions &\n ColumnPinningOptions &\n FiltersOptions<TGenerics> &\n SortingOptions<TGenerics> &\n GroupingOptions<TGenerics> &\n ExpandedOptions<TGenerics> &\n ColumnSizingOptions &\n PaginationOptions<TGenerics> &\n RowSelectionOptions<TGenerics>\n\nexport type Updater<T> = T | ((old: T) => T)\nexport type OnChangeFn<T> = (updaterOrValue: Updater<T>, value: T) => void\n\nexport type TableState = VisibilityTableState &\n ColumnOrderTableState &\n ColumnPinningTableState &\n FiltersTableState &\n SortingTableState &\n ExpandedTableState &\n GroupingTableState &\n ColumnSizingTableState &\n PaginationTableState &\n RowSelectionTableState\n\nexport type Row<TGenerics extends PartialGenerics> = CoreRow<TGenerics> &\n VisibilityRow<TGenerics> &\n HeadersRow<TGenerics> &\n GroupingRow &\n RowSelectionRow &\n ExpandedRow\n\nexport type RowValues = {\n [key: string]: any\n}\n\nexport type RowModel<TGenerics extends PartialGenerics> = {\n rows: Row<TGenerics>[]\n flatRows: Row<TGenerics>[]\n rowsById: Record<string, Row<TGenerics>>\n}\n\nexport type AccessorFn<TData> = (originalRow: TData, index: number) => any\n\nexport const Please_use_the_create_table_column_utilities_to_define_columns: unique symbol =\n Symbol()\n\nexport type _NonGenerated<T> = Overwrite<\n T,\n {\n [Please_use_the_create_table_column_utilities_to_define_columns]?: never\n }\n>\n\nexport type Renderable<TGenerics extends PartialGenerics, TProps> =\n | string\n | ((props: TProps) => ReturnType<UseRenderer<TGenerics>>)\n\nexport type ColumnDef<TGenerics extends PartialGenerics> =\n CoreColumnDef<TGenerics> &\n VisibilityColumnDef &\n ColumnPinningColumnDef &\n FiltersColumnDef<TGenerics> &\n SortingColumnDef<TGenerics> &\n GroupingColumnDef<TGenerics> &\n ColumnSizingColumnDef\n\nexport type Column<TGenerics extends PartialGenerics> = ColumnDef<TGenerics> &\n CoreColumn<TGenerics> &\n ColumnVisibilityColumn &\n ColumnPinningColumn &\n FiltersColumn<TGenerics> &\n SortingColumn<TGenerics> &\n GroupingColumn<TGenerics> &\n ColumnSizingColumn<TGenerics>\n\nexport type Cell<TGenerics extends PartialGenerics> = CoreCell<TGenerics> &\n GroupingCell<TGenerics>\n\nexport type CoreCell<TGenerics extends PartialGenerics> = {\n id: string\n rowId: string\n columnId: string\n value: TGenerics['Value']\n row: Row<TGenerics>\n column: Column<TGenerics>\n getCellProps: PropGetter<CellProps>\n renderCell: () => string | null | ReturnType<UseRenderer<TGenerics>>\n}\n\nexport type Header<TGenerics extends PartialGenerics> = CoreHeader<TGenerics> &\n ColumnSizingHeader<TGenerics>\n\nexport type CoreHeader<TGenerics extends PartialGenerics> = {\n id: string\n depth: number\n column: Column<TGenerics>\n getWidth: () => number\n subHeaders: Header<TGenerics>[]\n colSpan?: number\n rowSpan?: number\n getHeaderProps: PropGetter<HeaderProps>\n getFooterProps: PropGetter<HeaderProps>\n getLeafHeaders: () => Header<TGenerics>[]\n isPlaceholder?: boolean\n placeholderId?: string\n renderHeader: (options?: {\n renderPlaceholder?: boolean\n }) => string | null | ReturnType<UseRenderer<TGenerics>>\n renderFooter: (options?: {\n renderPlaceholder?: boolean\n }) => string | null | ReturnType<UseRenderer<TGenerics>>\n}\n\nexport type HeaderGroup<TGenerics extends PartialGenerics> = {\n id: string\n depth: number\n headers: Header<TGenerics>[]\n getHeaderGroupProps: PropGetter<HeaderGroupProps>\n getFooterGroupProps: PropGetter<FooterGroupProps>\n}\n\nexport type HeaderRenderProps<THeader> = {\n header: THeader\n}\n\nexport type FooterRenderProps<THeader> = {\n header: THeader\n}\n\nexport type CellRenderProps<TCell, TRow> = {\n cell: TCell\n row: TRow\n}\n\nexport type TableProps = {\n role: string\n}\n\nexport type TableBodyProps = {\n role: string\n}\n\nexport type TableHeadProps = {\n key: string\n role: string\n}\n\nexport type TableFooterProps = {\n key: string\n role: string\n}\n\nexport type HeaderGroupProps = {\n key: string\n role: string\n}\n\nexport type FooterGroupProps = {\n key: string\n role: string\n}\n\nexport type HeaderProps = {\n key: string\n role: string\n colSpan?: number\n rowSpan?: number\n}\n\nexport type FooterProps = {\n key: string\n role: string\n colSpan?: number\n rowSpan?: number\n}\n\nexport type RowProps = {\n key: string\n role: string\n}\n\nexport type CellProps = {\n key: string\n role: string\n}\n\n//\n\nexport type PropGetter<TBase> = <TGetter extends Getter<TBase>>(\n userProps?: TGetter\n) => PropGetterValue<TBase, TGetter>\n\nexport type Getter<TInitial> =\n | ((initial: TInitial) => object)\n | object\n | undefined\n\nexport type PropGetterValue<TBase, TGetter> = TGetter extends undefined\n ? TBase\n : TGetter extends (...args: any[]) => infer TReturn\n ? Overwrite<TBase, TReturn>\n : TGetter extends object\n ? Overwrite<TBase, TGetter>\n : never\n\nexport type NoInfer<A extends any> = [A][A extends any ? 0 : never]\n"],"names":["Please_use_the_create_table_column_utilities_to_define_columns","Symbol"],"mappings":";;;;;;;;;;;;;;AAiHA;IAgDaA,8DAA6E,GACxFC,MAAM;;;;"}
|