@tanstack/table-core 8.0.0-alpha.72 → 8.0.0-alpha.73
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 +2 -2
- package/build/cjs/core.js.map +1 -1
- package/build/cjs/features/Cells.js +1 -1
- package/build/cjs/features/Cells.js.map +1 -1
- package/build/cjs/features/Expanding.js +4 -2
- package/build/cjs/features/Expanding.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 +2 -2
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Pagination.js +8 -9
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/utils/getGroupedRowModel.js +1 -1
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/esm/index.js +19 -18
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +305 -305
- package/build/types/core.d.ts +2 -3
- package/build/types/features/Pagination.d.ts +0 -1
- package/build/umd/index.development.js +19 -18
- 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 +6 -6
- package/src/features/Cells.ts +1 -1
- package/src/features/Expanding.ts +2 -2
- package/src/features/Grouping.ts +1 -1
- package/src/features/Headers.ts +2 -2
- package/src/features/Pagination.ts +6 -11
- package/src/utils/getGroupedRowModel.ts +1 -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.73",
|
|
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.ts
CHANGED
|
@@ -44,8 +44,8 @@ export type CoreOptions<TGenerics extends TableGenerics> = {
|
|
|
44
44
|
initialState?: InitialTableState
|
|
45
45
|
autoResetAll?: boolean
|
|
46
46
|
mergeOptions?: <T>(defaultOptions: T, options: Partial<T>) => T
|
|
47
|
-
keepPreviousData?: boolean
|
|
48
47
|
meta?: TGenerics['TableMeta']
|
|
48
|
+
// keepPreviousData?: boolean
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export type CoreInstance<TGenerics extends TableGenerics> = {
|
|
@@ -54,20 +54,20 @@ export type CoreInstance<TGenerics extends TableGenerics> = {
|
|
|
54
54
|
reset: () => void
|
|
55
55
|
options: RequiredKeys<TableOptions<TGenerics>, 'state'>
|
|
56
56
|
setOptions: (newOptions: Updater<TableOptions<TGenerics>>) => void
|
|
57
|
-
queue: (cb: () => void) => void
|
|
58
57
|
getState: () => TableState
|
|
59
58
|
setState: (updater: Updater<TableState>) => void
|
|
60
|
-
|
|
59
|
+
_queue: (cb: () => void) => void
|
|
60
|
+
_render: <TProps>(
|
|
61
61
|
template: Renderable<TGenerics, TProps>,
|
|
62
62
|
props: TProps
|
|
63
63
|
) => string | null | TGenerics['Rendered']
|
|
64
|
+
_features: readonly TableFeature[]
|
|
64
65
|
// getOverallProgress: () => number
|
|
65
66
|
// getProgressStage: () =>
|
|
66
67
|
// | undefined
|
|
67
68
|
// | 'coreRowModel'
|
|
68
69
|
// | 'filteredRowModel'
|
|
69
70
|
// | 'facetedRowModel'
|
|
70
|
-
_features: readonly TableFeature[]
|
|
71
71
|
// createBatch: (priority: keyof CoreBatches) => Batch
|
|
72
72
|
// init: () => void
|
|
73
73
|
// willUpdate: () => void
|
|
@@ -231,7 +231,7 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
231
231
|
...options,
|
|
232
232
|
},
|
|
233
233
|
initialState,
|
|
234
|
-
|
|
234
|
+
_queue: cb => {
|
|
235
235
|
queued.push(cb)
|
|
236
236
|
|
|
237
237
|
if (!queuedTimeout) {
|
|
@@ -297,7 +297,7 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
297
297
|
const newOptions = functionalUpdate(updater, instance.options)
|
|
298
298
|
instance.options = mergeOptions(newOptions)
|
|
299
299
|
},
|
|
300
|
-
|
|
300
|
+
_render: (template, props) => {
|
|
301
301
|
if (typeof instance.options.render === 'function') {
|
|
302
302
|
return instance.options.render(template, props)
|
|
303
303
|
}
|
package/src/features/Cells.ts
CHANGED
|
@@ -82,7 +82,7 @@ export const Expanding: TableFeature = {
|
|
|
82
82
|
return {
|
|
83
83
|
_autoResetExpanded: () => {
|
|
84
84
|
if (!registered) {
|
|
85
|
-
instance.
|
|
85
|
+
instance._queue(() => {
|
|
86
86
|
registered = true
|
|
87
87
|
})
|
|
88
88
|
return
|
|
@@ -98,7 +98,7 @@ export const Expanding: TableFeature = {
|
|
|
98
98
|
) {
|
|
99
99
|
if (queued) return
|
|
100
100
|
queued = true
|
|
101
|
-
instance.
|
|
101
|
+
instance._queue(() => {
|
|
102
102
|
instance.resetExpanded()
|
|
103
103
|
queued = false
|
|
104
104
|
})
|
package/src/features/Grouping.ts
CHANGED
package/src/features/Headers.ts
CHANGED
|
@@ -88,7 +88,7 @@ export const Headers = {
|
|
|
88
88
|
},
|
|
89
89
|
renderHeader: () =>
|
|
90
90
|
column.header
|
|
91
|
-
? instance.
|
|
91
|
+
? instance._render(column.header, {
|
|
92
92
|
instance,
|
|
93
93
|
header: header as Header<TGenerics>,
|
|
94
94
|
column,
|
|
@@ -96,7 +96,7 @@ export const Headers = {
|
|
|
96
96
|
: null,
|
|
97
97
|
renderFooter: () =>
|
|
98
98
|
column.footer
|
|
99
|
-
? instance.
|
|
99
|
+
? instance._render(column.footer, {
|
|
100
100
|
instance,
|
|
101
101
|
header: header as Header<TGenerics>,
|
|
102
102
|
column,
|
|
@@ -33,7 +33,6 @@ export type PaginationOptions<TGenerics extends TableGenerics> = {
|
|
|
33
33
|
|
|
34
34
|
export type PaginationDefaultOptions = {
|
|
35
35
|
onPaginationChange: OnChangeFn<PaginationState>
|
|
36
|
-
autoResetPageIndex: boolean
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export type PaginationInstance<TGenerics extends TableGenerics> = {
|
|
@@ -82,7 +81,6 @@ export const Pagination: TableFeature = {
|
|
|
82
81
|
): PaginationDefaultOptions => {
|
|
83
82
|
return {
|
|
84
83
|
onPaginationChange: makeStateUpdater('pagination', instance),
|
|
85
|
-
autoResetPageIndex: true,
|
|
86
84
|
}
|
|
87
85
|
},
|
|
88
86
|
|
|
@@ -95,23 +93,20 @@ export const Pagination: TableFeature = {
|
|
|
95
93
|
return {
|
|
96
94
|
_autoResetPageIndex: () => {
|
|
97
95
|
if (!registered) {
|
|
98
|
-
instance.
|
|
96
|
+
instance._queue(() => {
|
|
99
97
|
registered = true
|
|
100
98
|
})
|
|
101
99
|
return
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
if (instance.options.autoResetAll === false) {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
|
|
108
102
|
if (
|
|
109
|
-
instance.options.autoResetAll
|
|
110
|
-
instance.options.autoResetPageIndex
|
|
103
|
+
instance.options.autoResetAll ??
|
|
104
|
+
instance.options.autoResetPageIndex ??
|
|
105
|
+
!instance.options.manualPagination
|
|
111
106
|
) {
|
|
112
107
|
if (queued) return
|
|
113
108
|
queued = true
|
|
114
|
-
instance.
|
|
109
|
+
instance._queue(() => {
|
|
115
110
|
instance.resetPageIndex()
|
|
116
111
|
queued = false
|
|
117
112
|
})
|
|
@@ -138,7 +133,7 @@ export const Pagination: TableFeature = {
|
|
|
138
133
|
let pageIndex = functionalUpdate(updater, old.pageIndex)
|
|
139
134
|
|
|
140
135
|
const maxPageIndex =
|
|
141
|
-
|
|
136
|
+
typeof old.pageCount !== 'undefined'
|
|
142
137
|
? old.pageCount - 1
|
|
143
138
|
: Number.MAX_SAFE_INTEGER
|
|
144
139
|
|
|
@@ -155,7 +155,7 @@ export function getGroupedRowModel<TGenerics extends TableGenerics>(): (
|
|
|
155
155
|
key: process.env.NODE_ENV === 'development' && 'getGroupedRowModel',
|
|
156
156
|
debug: () => instance.options.debugAll ?? instance.options.debugTable,
|
|
157
157
|
onChange: () => {
|
|
158
|
-
instance.
|
|
158
|
+
instance._queue(() => {
|
|
159
159
|
instance._autoResetExpanded()
|
|
160
160
|
instance._autoResetPageIndex()
|
|
161
161
|
})
|