@tanstack/table-core 8.0.0-beta.0 → 8.0.0-beta.3
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/instance.js +2 -2
- package/build/cjs/core/instance.js.map +1 -1
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +1 -2
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +6 -3
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/utils/getGroupedRowModel.js +0 -5
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/esm/index.js +9 -12
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +314 -314
- package/build/types/core/instance.d.ts +1 -1
- package/build/types/createTable.d.ts +1 -1
- package/build/types/features/Expanding.d.ts +1 -1
- package/build/types/features/Filters.d.ts +1 -4
- package/build/types/features/Grouping.d.ts +1 -4
- package/build/types/features/Pagination.d.ts +1 -1
- package/build/types/features/Sorting.d.ts +1 -1
- package/build/umd/index.development.js +9 -12
- 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/instance.ts +2 -4
- package/src/createTable.ts +3 -3
- package/src/features/Expanding.ts +1 -3
- package/src/features/Filters.ts +6 -10
- package/src/features/Grouping.ts +7 -11
- package/src/features/Pagination.ts +1 -3
- package/src/features/Sorting.ts +1 -3
- package/src/utils/getGroupedRowModel.ts +0 -7
- package/src/.DS_Store +0 -0
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-beta.
|
|
4
|
+
"version": "8.0.0-beta.3",
|
|
5
5
|
"description": "Headless UI for building powerful tables & datagrids for TS/JS.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/table#readme",
|
package/src/core/instance.ts
CHANGED
|
@@ -73,9 +73,7 @@ export type CoreOptions<TGenerics extends TableGenerics> = {
|
|
|
73
73
|
autoResetAll?: boolean
|
|
74
74
|
mergeOptions?: <T>(defaultOptions: T, options: Partial<T>) => T
|
|
75
75
|
meta?: TGenerics['TableMeta']
|
|
76
|
-
getCoreRowModel: (
|
|
77
|
-
instance: TableInstance<TGenerics>
|
|
78
|
-
) => () => RowModel<TGenerics>
|
|
76
|
+
getCoreRowModel: (instance: TableInstance<any>) => () => RowModel<any>
|
|
79
77
|
getSubRows?: (
|
|
80
78
|
originalRow: TGenerics['Row'],
|
|
81
79
|
index: number
|
|
@@ -256,7 +254,7 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
256
254
|
return {
|
|
257
255
|
header: props => props.header.column.id,
|
|
258
256
|
footer: props => props.header.column.id,
|
|
259
|
-
cell: props => props.getValue()
|
|
257
|
+
cell: props => props.getValue()?.toString?.() ?? null,
|
|
260
258
|
...instance._features.reduce((obj, feature) => {
|
|
261
259
|
return Object.assign(obj, feature.getDefaultColumnDef?.())
|
|
262
260
|
}, {}),
|
package/src/createTable.ts
CHANGED
|
@@ -47,9 +47,9 @@ export type Table<TGenerics extends TableGenerics> = {
|
|
|
47
47
|
Overwrite<TGenerics, { FilterMeta: TFilterMeta }>
|
|
48
48
|
>
|
|
49
49
|
setOptions: <
|
|
50
|
-
TFilterFns extends Record<string, FilterFn<
|
|
51
|
-
TSortingFns extends Record<string, SortingFn<
|
|
52
|
-
TAggregationFns extends Record<string, AggregationFn<
|
|
50
|
+
TFilterFns extends Record<string, FilterFn<any>>,
|
|
51
|
+
TSortingFns extends Record<string, SortingFn<any>>,
|
|
52
|
+
TAggregationFns extends Record<string, AggregationFn<any>>
|
|
53
53
|
>(
|
|
54
54
|
options: CreateTableOptions<
|
|
55
55
|
any,
|
|
@@ -27,9 +27,7 @@ export type ExpandedOptions<TGenerics extends TableGenerics> = {
|
|
|
27
27
|
onExpandedChange?: OnChangeFn<ExpandedState>
|
|
28
28
|
autoResetExpanded?: boolean
|
|
29
29
|
enableExpanding?: boolean
|
|
30
|
-
getExpandedRowModel?: (
|
|
31
|
-
instance: TableInstance<TGenerics>
|
|
32
|
-
) => () => RowModel<TGenerics>
|
|
30
|
+
getExpandedRowModel?: (instance: TableInstance<any>) => () => RowModel<any>
|
|
33
31
|
getIsRowExpanded?: (row: Row<TGenerics>) => boolean
|
|
34
32
|
getRowCanExpand?: (row: Row<TGenerics>) => boolean
|
|
35
33
|
paginateExpandedRows?: boolean
|
package/src/features/Filters.ts
CHANGED
|
@@ -75,7 +75,6 @@ export type FiltersColumnDef<TGenerics extends TableGenerics> = {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export type FiltersColumn<TGenerics extends TableGenerics> = {
|
|
78
|
-
filterFn: FilterFnOption<Overwrite<TGenerics, { Value: any }>>
|
|
79
78
|
getAutoFilterFn: () => FilterFn<TGenerics> | undefined
|
|
80
79
|
getFilterFn: () => FilterFn<TGenerics> | undefined
|
|
81
80
|
setFilterValue: (updater: Updater<any>) => void
|
|
@@ -102,9 +101,7 @@ export type FiltersOptions<TGenerics extends TableGenerics> = {
|
|
|
102
101
|
manualFiltering?: boolean
|
|
103
102
|
filterFromLeafRows?: boolean
|
|
104
103
|
filterFns?: TGenerics['FilterFns']
|
|
105
|
-
getFilteredRowModel?: (
|
|
106
|
-
instance: TableInstance<TGenerics>
|
|
107
|
-
) => () => RowModel<TGenerics>
|
|
104
|
+
getFilteredRowModel?: (instance: TableInstance<any>) => () => RowModel<any>
|
|
108
105
|
|
|
109
106
|
// Column
|
|
110
107
|
onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>
|
|
@@ -199,7 +196,6 @@ export const Filters: TableFeature = {
|
|
|
199
196
|
instance: TableInstance<TGenerics>
|
|
200
197
|
): FiltersColumn<TGenerics> => {
|
|
201
198
|
return {
|
|
202
|
-
filterFn: column.filterFn,
|
|
203
199
|
getAutoFilterFn: () => {
|
|
204
200
|
const firstRow = instance.getCoreRowModel().flatRows[0]
|
|
205
201
|
|
|
@@ -230,15 +226,15 @@ export const Filters: TableFeature = {
|
|
|
230
226
|
getFilterFn: () => {
|
|
231
227
|
const userFilterFns = instance.options.filterFns
|
|
232
228
|
|
|
233
|
-
return isFunction(column.filterFn)
|
|
234
|
-
? column.filterFn
|
|
235
|
-
: column.filterFn === 'auto'
|
|
229
|
+
return isFunction(column.columnDef.filterFn)
|
|
230
|
+
? column.columnDef.filterFn
|
|
231
|
+
: column.columnDef.filterFn === 'auto'
|
|
236
232
|
? column.getAutoFilterFn()
|
|
237
233
|
: (userFilterFns as Record<string, any>)?.[
|
|
238
|
-
column.filterFn as string
|
|
234
|
+
column.columnDef.filterFn as string
|
|
239
235
|
] ??
|
|
240
236
|
(filterFns[
|
|
241
|
-
column.filterFn as BuiltInFilterFn
|
|
237
|
+
column.columnDef.filterFn as BuiltInFilterFn
|
|
242
238
|
] as FilterFn<TGenerics>)
|
|
243
239
|
},
|
|
244
240
|
getCanFilter: () => {
|
package/src/features/Grouping.ts
CHANGED
|
@@ -52,7 +52,6 @@ export type GroupingColumnDef<TGenerics extends TableGenerics> = {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export type GroupingColumn<TGenerics extends TableGenerics> = {
|
|
55
|
-
aggregationFn?: AggregationFnOption<Overwrite<TGenerics, { Value: any }>>
|
|
56
55
|
getCanGroup: () => boolean
|
|
57
56
|
getIsGrouped: () => boolean
|
|
58
57
|
getGroupedIndex: () => number
|
|
@@ -87,9 +86,7 @@ export type GroupingOptions<TGenerics extends TableGenerics> = {
|
|
|
87
86
|
aggregationFns?: TGenerics['AggregationFns']
|
|
88
87
|
onGroupingChange?: OnChangeFn<GroupingState>
|
|
89
88
|
enableGrouping?: boolean
|
|
90
|
-
getGroupedRowModel?: (
|
|
91
|
-
instance: TableInstance<TGenerics>
|
|
92
|
-
) => () => RowModel<TGenerics>
|
|
89
|
+
getGroupedRowModel?: (instance: TableInstance<any>) => () => RowModel<any>
|
|
93
90
|
groupedColumnMode?: false | 'reorder' | 'remove'
|
|
94
91
|
}
|
|
95
92
|
|
|
@@ -110,6 +107,7 @@ export const Grouping: TableFeature = {
|
|
|
110
107
|
TGenerics extends TableGenerics
|
|
111
108
|
>(): GroupingColumnDef<TGenerics> => {
|
|
112
109
|
return {
|
|
110
|
+
aggregatedCell: props => props.getValue()?.toString?.() ?? null,
|
|
113
111
|
aggregationFn: 'auto',
|
|
114
112
|
}
|
|
115
113
|
},
|
|
@@ -182,8 +180,6 @@ export const Grouping: TableFeature = {
|
|
|
182
180
|
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
183
181
|
return aggregationFns.extent
|
|
184
182
|
}
|
|
185
|
-
|
|
186
|
-
return aggregationFns.count
|
|
187
183
|
},
|
|
188
184
|
getAggregationFn: () => {
|
|
189
185
|
const userAggregationFns = instance.options.aggregationFns
|
|
@@ -192,15 +188,15 @@ export const Grouping: TableFeature = {
|
|
|
192
188
|
throw new Error()
|
|
193
189
|
}
|
|
194
190
|
|
|
195
|
-
return isFunction(column.aggregationFn)
|
|
196
|
-
? column.aggregationFn
|
|
197
|
-
: column.aggregationFn === 'auto'
|
|
191
|
+
return isFunction(column.columnDef.aggregationFn)
|
|
192
|
+
? column.columnDef.aggregationFn
|
|
193
|
+
: column.columnDef.aggregationFn === 'auto'
|
|
198
194
|
? column.getAutoAggregationFn()
|
|
199
195
|
: (userAggregationFns as Record<string, any>)?.[
|
|
200
|
-
column.aggregationFn as string
|
|
196
|
+
column.columnDef.aggregationFn as string
|
|
201
197
|
] ??
|
|
202
198
|
(aggregationFns[
|
|
203
|
-
column.aggregationFn as BuiltInAggregationFn
|
|
199
|
+
column.columnDef.aggregationFn as BuiltInAggregationFn
|
|
204
200
|
] as AggregationFn<TGenerics>)
|
|
205
201
|
},
|
|
206
202
|
}
|
|
@@ -26,9 +26,7 @@ export type PaginationOptions<TGenerics extends TableGenerics> = {
|
|
|
26
26
|
manualPagination?: boolean
|
|
27
27
|
onPaginationChange?: OnChangeFn<PaginationState>
|
|
28
28
|
autoResetPageIndex?: boolean
|
|
29
|
-
getPaginationRowModel?: (
|
|
30
|
-
instance: TableInstance<TGenerics>
|
|
31
|
-
) => () => RowModel<TGenerics>
|
|
29
|
+
getPaginationRowModel?: (instance: TableInstance<any>) => () => RowModel<any>
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
export type PaginationDefaultOptions = {
|
package/src/features/Sorting.ts
CHANGED
|
@@ -76,9 +76,7 @@ export type SortingOptions<TGenerics extends TableGenerics> = {
|
|
|
76
76
|
enableMultiRemove?: boolean
|
|
77
77
|
enableMultiSort?: boolean
|
|
78
78
|
sortDescFirst?: boolean
|
|
79
|
-
getSortedRowModel?: (
|
|
80
|
-
instance: TableInstance<TGenerics>
|
|
81
|
-
) => () => RowModel<TGenerics>
|
|
79
|
+
getSortedRowModel?: (instance: TableInstance<any>) => () => RowModel<any>
|
|
82
80
|
maxMultiSortColCount?: number
|
|
83
81
|
isMultiSortEvent?: (e: unknown) => boolean
|
|
84
82
|
}
|
|
@@ -93,13 +93,6 @@ export function getGroupedRowModel<TGenerics extends TableGenerics>(): (
|
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
return row._groupingValuesCache[columnId]
|
|
96
|
-
} else if (column.aggregationFn) {
|
|
97
|
-
console.info({ column })
|
|
98
|
-
throw new Error(
|
|
99
|
-
process.env.NODE_ENV !== 'production'
|
|
100
|
-
? `Table: Invalid column.aggregateType option for column listed above`
|
|
101
|
-
: ''
|
|
102
|
-
)
|
|
103
96
|
}
|
|
104
97
|
},
|
|
105
98
|
})
|
package/src/.DS_Store
DELETED
|
Binary file
|