@tanstack/table-core 8.11.8 → 8.13.0
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/lib/core/cell.js +1 -4
- package/build/lib/core/cell.js.map +1 -1
- package/build/lib/core/column.js +2 -14
- package/build/lib/core/column.js.map +1 -1
- package/build/lib/core/headers.js +17 -112
- package/build/lib/core/headers.js.map +1 -1
- package/build/lib/core/row.js +2 -14
- package/build/lib/core/row.js.map +1 -1
- package/build/lib/core/table.d.ts +6 -0
- package/build/lib/core/table.js +5 -35
- package/build/lib/core/table.js.map +1 -1
- package/build/lib/features/ColumnSizing.d.ts +6 -2
- package/build/lib/features/ColumnSizing.js +3 -9
- package/build/lib/features/ColumnSizing.js.map +1 -1
- package/build/lib/features/Ordering.d.ts +21 -0
- package/build/lib/features/Ordering.js +15 -4
- package/build/lib/features/Ordering.js.map +1 -1
- package/build/lib/features/Pagination.d.ts +26 -4
- package/build/lib/features/Pagination.js +13 -8
- package/build/lib/features/Pagination.js.map +1 -1
- package/build/lib/features/Pinning.js +10 -58
- package/build/lib/features/Pinning.js.map +1 -1
- package/build/lib/features/RowSelection.js +3 -21
- package/build/lib/features/RowSelection.js.map +1 -1
- package/build/lib/features/Visibility.d.ts +8 -1
- package/build/lib/features/Visibility.js +7 -21
- package/build/lib/features/Visibility.js.map +1 -1
- package/build/lib/index.esm.js +102 -384
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +2 -0
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +102 -384
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/types.d.ts +2 -2
- package/build/lib/utils/filterRowsUtils.d.ts +0 -2
- package/build/lib/utils/filterRowsUtils.js +0 -2
- package/build/lib/utils/filterRowsUtils.js.map +1 -1
- package/build/lib/utils/getCoreRowModel.js +1 -10
- package/build/lib/utils/getCoreRowModel.js.map +1 -1
- package/build/lib/utils/getExpandedRowModel.js +1 -7
- package/build/lib/utils/getExpandedRowModel.js.map +1 -1
- package/build/lib/utils/getFacetedMinMaxValues.js +1 -8
- package/build/lib/utils/getFacetedMinMaxValues.js.map +1 -1
- package/build/lib/utils/getFacetedRowModel.js +1 -8
- package/build/lib/utils/getFacetedRowModel.js.map +1 -1
- package/build/lib/utils/getFacetedUniqueValues.js +1 -8
- package/build/lib/utils/getFacetedUniqueValues.js.map +1 -1
- package/build/lib/utils/getFilteredRowModel.js +1 -10
- package/build/lib/utils/getFilteredRowModel.js.map +1 -1
- package/build/lib/utils/getGroupedRowModel.js +6 -13
- package/build/lib/utils/getGroupedRowModel.js.map +1 -1
- package/build/lib/utils/getPaginationRowModel.js +1 -7
- package/build/lib/utils/getPaginationRowModel.js.map +1 -1
- package/build/lib/utils/getSortedRowModel.js +1 -10
- package/build/lib/utils/getSortedRowModel.js.map +1 -1
- package/build/lib/utils.d.ts +8 -3
- package/build/lib/utils.js +13 -2
- package/build/lib/utils.js.map +1 -1
- package/build/umd/index.development.js +103 -383
- 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/cell.ts +2 -5
- package/src/core/column.ts +3 -9
- package/src/core/headers.ts +19 -65
- package/src/core/row.ts +3 -10
- package/src/core/table.ts +12 -21
- package/src/features/ColumnSizing.ts +33 -20
- package/src/features/Ordering.ts +74 -35
- package/src/features/Pagination.ts +49 -13
- package/src/features/Pinning.ts +35 -61
- package/src/features/RowSelection.ts +4 -16
- package/src/features/Visibility.ts +23 -13
- package/src/types.ts +3 -1
- package/src/utils/filterRowsUtils.ts +2 -2
- package/src/utils/getCoreRowModel.ts +4 -8
- package/src/utils/getExpandedRowModel.ts +2 -5
- package/src/utils/getFacetedMinMaxValues.ts +2 -8
- package/src/utils/getFacetedRowModel.ts +2 -8
- package/src/utils/getFacetedUniqueValues.ts +6 -8
- package/src/utils/getFilteredRowModel.ts +4 -8
- package/src/utils/getGroupedRowModel.ts +7 -11
- package/src/utils/getPaginationRowModel.ts +2 -5
- package/src/utils/getSortedRowModel.ts +4 -8
- package/src/utils.ts +25 -6
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableState, Updater } from './types'
|
|
1
|
+
import { TableOptionsResolved, TableState, Updater } from './types'
|
|
2
2
|
|
|
3
3
|
export type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
|
|
4
4
|
export type RequiredKeys<T, K extends keyof T> = Omit<T, K> &
|
|
@@ -134,23 +134,23 @@ export function flattenBy<TNode>(
|
|
|
134
134
|
return flat
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export function memo<TDeps extends readonly any[], TResult>(
|
|
138
|
-
getDeps: () => [...TDeps],
|
|
137
|
+
export function memo<TDeps extends readonly any[], TDepArgs, TResult>(
|
|
138
|
+
getDeps: (depArgs?: TDepArgs) => [...TDeps],
|
|
139
139
|
fn: (...args: NoInfer<[...TDeps]>) => TResult,
|
|
140
140
|
opts: {
|
|
141
141
|
key: any
|
|
142
142
|
debug?: () => any
|
|
143
143
|
onChange?: (result: TResult) => void
|
|
144
144
|
}
|
|
145
|
-
): () => TResult {
|
|
145
|
+
): (depArgs?: TDepArgs) => TResult {
|
|
146
146
|
let deps: any[] = []
|
|
147
147
|
let result: TResult | undefined
|
|
148
148
|
|
|
149
|
-
return
|
|
149
|
+
return depArgs => {
|
|
150
150
|
let depTime: number
|
|
151
151
|
if (opts.key && opts.debug) depTime = Date.now()
|
|
152
152
|
|
|
153
|
-
const newDeps = getDeps()
|
|
153
|
+
const newDeps = getDeps(depArgs)
|
|
154
154
|
|
|
155
155
|
const depsChanged =
|
|
156
156
|
newDeps.length !== deps.length ||
|
|
@@ -199,3 +199,22 @@ export function memo<TDeps extends readonly any[], TResult>(
|
|
|
199
199
|
return result!
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
+
|
|
203
|
+
export function getMemoOptions(
|
|
204
|
+
tableOptions: Partial<TableOptionsResolved<any>>,
|
|
205
|
+
debugLevel:
|
|
206
|
+
| 'debugAll'
|
|
207
|
+
| 'debugCells'
|
|
208
|
+
| 'debugTable'
|
|
209
|
+
| 'debugColumns'
|
|
210
|
+
| 'debugRows'
|
|
211
|
+
| 'debugHeaders',
|
|
212
|
+
key: string,
|
|
213
|
+
onChange?: (result: any) => void
|
|
214
|
+
) {
|
|
215
|
+
return {
|
|
216
|
+
debug: () => tableOptions?.debugAll ?? tableOptions[debugLevel],
|
|
217
|
+
key: process.env.NODE_ENV === 'development' && key,
|
|
218
|
+
onChange,
|
|
219
|
+
}
|
|
220
|
+
}
|