@tanstack/table-core 8.3.3 → 8.3.6
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/cell.js.map +1 -1
- package/build/cjs/core/row.js.map +1 -1
- package/build/cjs/core/table.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- 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/Ordering.js.map +1 -1
- package/build/cjs/features/Pagination.js.map +1 -1
- 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/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/utils/filterRowsUtils.js.map +1 -1
- package/build/cjs/utils/getCoreRowModel.js.map +1 -1
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getFacetedMinMaxValues.js.map +1 -1
- package/build/cjs/utils/getFacetedRowModel.js.map +1 -1
- package/build/cjs/utils/getFacetedUniqueValues.js.map +1 -1
- package/build/cjs/utils/getFilteredRowModel.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/getSortedRowModel.js.map +1 -1
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +313 -307
- package/build/types/index.d.ts +6 -12
- package/build/umd/index.development.js +1 -0
- 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 +1 -5
- package/src/core/row.ts +1 -1
- package/src/core/table.ts +1 -1
- package/src/features/ColumnSizing.ts +1 -9
- package/src/features/Expanding.ts +2 -12
- package/src/features/Filters.ts +0 -1
- package/src/features/Grouping.ts +0 -1
- package/src/features/Ordering.ts +1 -8
- package/src/features/Pagination.ts +1 -8
- package/src/features/Pinning.ts +0 -1
- package/src/features/RowSelection.ts +15 -14
- package/src/features/Sorting.ts +1 -9
- package/src/features/Visibility.ts +0 -1
- package/src/index.ts +1 -0
- package/src/types.ts +1 -10
- package/src/utils/filterRowsUtils.ts +1 -1
- package/src/utils/getCoreRowModel.ts +1 -1
- package/src/utils/getExpandedRowModel.ts +1 -1
- package/src/utils/getFacetedMinMaxValues.ts +1 -1
- package/src/utils/getFacetedRowModel.ts +1 -1
- package/src/utils/getFacetedUniqueValues.ts +1 -1
- package/src/utils/getFilteredRowModel.ts +1 -1
- package/src/utils/getGroupedRowModel.ts +1 -1
- package/src/utils/getPaginationRowModel.ts +1 -1
- package/src/utils/getSortedRowModel.ts +1 -1
- package/src/utils.ts +5 -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.3.
|
|
4
|
+
"version": "8.3.6",
|
|
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/cell.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { RowData, Cell, Column, Row, Table } from '../types'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type NoInfer<T> = [T][T extends any ? 0 : never]
|
|
5
|
-
|
|
6
|
-
type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>
|
|
2
|
+
import { Getter } from '../utils'
|
|
7
3
|
|
|
8
4
|
export type CellContext<TData extends RowData, TValue> = {
|
|
9
5
|
table: Table<TData>
|
package/src/core/row.ts
CHANGED
package/src/core/table.ts
CHANGED
|
@@ -76,7 +76,7 @@ export type CoreOptions<TData extends RowData> = {
|
|
|
76
76
|
defaultOptions: TableOptions<TData>,
|
|
77
77
|
options: Partial<TableOptions<TData>>
|
|
78
78
|
) => TableOptions<TData>
|
|
79
|
-
meta?: TableMeta
|
|
79
|
+
meta?: TableMeta<TData>
|
|
80
80
|
getCoreRowModel: (table: Table<any>) => () => RowModel<any>
|
|
81
81
|
getSubRows?: (originalRow: TData, index: number) => undefined | TData[]
|
|
82
82
|
getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { TableFeature } from '../core/table'
|
|
2
|
-
import {
|
|
3
|
-
RowData,
|
|
4
|
-
Column,
|
|
5
|
-
Header,
|
|
6
|
-
OnChangeFn,
|
|
7
|
-
TableGenerics,
|
|
8
|
-
Table,
|
|
9
|
-
Updater,
|
|
10
|
-
} from '../types'
|
|
2
|
+
import { RowData, Column, Header, OnChangeFn, Table, Updater } from '../types'
|
|
11
3
|
import { makeStateUpdater } from '../utils'
|
|
12
4
|
import { ColumnPinningPosition } from './Pinning'
|
|
13
5
|
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { RowModel } from '..'
|
|
2
2
|
import { TableFeature } from '../core/table'
|
|
3
|
-
import {
|
|
4
|
-
OnChangeFn,
|
|
5
|
-
TableGenerics,
|
|
6
|
-
Table,
|
|
7
|
-
Row,
|
|
8
|
-
Updater,
|
|
9
|
-
RowData,
|
|
10
|
-
} from '../types'
|
|
3
|
+
import { OnChangeFn, Table, Row, Updater, RowData } from '../types'
|
|
11
4
|
import { makeStateUpdater } from '../utils'
|
|
12
5
|
|
|
13
6
|
export type ExpandedStateList = Record<string, boolean>
|
|
@@ -219,10 +212,7 @@ export const Expanding: TableFeature = {
|
|
|
219
212
|
getCanExpand: () => {
|
|
220
213
|
return (
|
|
221
214
|
table.options.getRowCanExpand?.(row) ??
|
|
222
|
-
(
|
|
223
|
-
(table.options.enableExpanding ?? true) &&
|
|
224
|
-
!!row.subRows?.length
|
|
225
|
-
)
|
|
215
|
+
((table.options.enableExpanding ?? true) && !!row.subRows?.length)
|
|
226
216
|
)
|
|
227
217
|
},
|
|
228
218
|
getToggleExpandedHandler: () => {
|
package/src/features/Filters.ts
CHANGED
package/src/features/Grouping.ts
CHANGED
package/src/features/Ordering.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { makeStateUpdater, memo } from '../utils'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
Table,
|
|
5
|
-
OnChangeFn,
|
|
6
|
-
Updater,
|
|
7
|
-
Column,
|
|
8
|
-
TableGenerics,
|
|
9
|
-
RowData,
|
|
10
|
-
} from '../types'
|
|
3
|
+
import { Table, OnChangeFn, Updater, Column, RowData } from '../types'
|
|
11
4
|
|
|
12
5
|
import { Grouping, orderColumns } from './Grouping'
|
|
13
6
|
import { TableFeature } from '../core/table'
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { TableFeature } from '../core/table'
|
|
2
|
-
import {
|
|
3
|
-
OnChangeFn,
|
|
4
|
-
TableGenerics,
|
|
5
|
-
Table,
|
|
6
|
-
RowModel,
|
|
7
|
-
Updater,
|
|
8
|
-
RowData,
|
|
9
|
-
} from '../types'
|
|
2
|
+
import { OnChangeFn, Table, RowModel, Updater, RowData } from '../types'
|
|
10
3
|
import { functionalUpdate, makeStateUpdater, memo } from '../utils'
|
|
11
4
|
|
|
12
5
|
export type PaginationState = {
|
package/src/features/Pinning.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { TableFeature } from '../core/table'
|
|
2
|
-
import {
|
|
3
|
-
OnChangeFn,
|
|
4
|
-
TableGenerics,
|
|
5
|
-
Table,
|
|
6
|
-
Row,
|
|
7
|
-
RowModel,
|
|
8
|
-
Updater,
|
|
9
|
-
RowData,
|
|
10
|
-
} from '../types'
|
|
2
|
+
import { OnChangeFn, Table, Row, RowModel, Updater, RowData } from '../types'
|
|
11
3
|
import { makeStateUpdater, memo } from '../utils'
|
|
12
4
|
|
|
13
5
|
export type RowSelectionState = Record<string, boolean>
|
|
@@ -283,7 +275,11 @@ export const RowSelection: TableFeature = {
|
|
|
283
275
|
)
|
|
284
276
|
|
|
285
277
|
if (isAllRowsSelected) {
|
|
286
|
-
if (
|
|
278
|
+
if (
|
|
279
|
+
preFilteredFlatRows.some(
|
|
280
|
+
row => row.getCanSelect() && !rowSelection[row.id]
|
|
281
|
+
)
|
|
282
|
+
) {
|
|
287
283
|
isAllRowsSelected = false
|
|
288
284
|
}
|
|
289
285
|
}
|
|
@@ -308,8 +304,13 @@ export const RowSelection: TableFeature = {
|
|
|
308
304
|
},
|
|
309
305
|
|
|
310
306
|
getIsSomeRowsSelected: () => {
|
|
311
|
-
const totalSelected = Object.keys(
|
|
312
|
-
|
|
307
|
+
const totalSelected = Object.keys(
|
|
308
|
+
table.getState().rowSelection ?? {}
|
|
309
|
+
).length
|
|
310
|
+
return (
|
|
311
|
+
totalSelected > 0 &&
|
|
312
|
+
totalSelected < table.getCoreRowModel().flatRows.length
|
|
313
|
+
)
|
|
313
314
|
},
|
|
314
315
|
|
|
315
316
|
getIsSomePageRowsSelected: () => {
|
|
@@ -317,8 +318,8 @@ export const RowSelection: TableFeature = {
|
|
|
317
318
|
return table.getIsAllPageRowsSelected()
|
|
318
319
|
? false
|
|
319
320
|
: paginationFlatRows.some(
|
|
320
|
-
|
|
321
|
-
|
|
321
|
+
d => d.getIsSelected() || d.getIsSomeSelected()
|
|
322
|
+
)
|
|
322
323
|
},
|
|
323
324
|
|
|
324
325
|
getToggleAllRowsSelectedHandler: () => {
|
package/src/features/Sorting.ts
CHANGED
|
@@ -6,15 +6,7 @@ import {
|
|
|
6
6
|
sortingFns,
|
|
7
7
|
} from '../sortingFns'
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
Column,
|
|
11
|
-
OnChangeFn,
|
|
12
|
-
TableGenerics,
|
|
13
|
-
Table,
|
|
14
|
-
Row,
|
|
15
|
-
Updater,
|
|
16
|
-
RowData,
|
|
17
|
-
} from '../types'
|
|
9
|
+
import { Column, OnChangeFn, Table, Row, Updater, RowData } from '../types'
|
|
18
10
|
|
|
19
11
|
import { isFunction, makeStateUpdater, Overwrite } from '../utils'
|
|
20
12
|
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -77,7 +77,7 @@ import { CoreRow } from './core/row'
|
|
|
77
77
|
import { PartialKeys } from './utils'
|
|
78
78
|
import { CoreCell } from './core/cell'
|
|
79
79
|
|
|
80
|
-
export interface TableMeta {}
|
|
80
|
+
export interface TableMeta<TData extends RowData> {}
|
|
81
81
|
export interface ColumnMeta<TData extends RowData, TValue> {}
|
|
82
82
|
export interface FilterMeta {}
|
|
83
83
|
|
|
@@ -86,13 +86,6 @@ export type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void
|
|
|
86
86
|
|
|
87
87
|
export type RowData = unknown | object | any[]
|
|
88
88
|
|
|
89
|
-
export type TableGenerics = {
|
|
90
|
-
Row?: any
|
|
91
|
-
Value?: any
|
|
92
|
-
ColumnMeta?: any
|
|
93
|
-
TableMeta?: any
|
|
94
|
-
}
|
|
95
|
-
|
|
96
89
|
export type AnyRender = (Comp: any, props: any) => any
|
|
97
90
|
|
|
98
91
|
export type Table<TData extends RowData> = CoreInstance<TData> &
|
|
@@ -200,5 +193,3 @@ export type Header<TData extends RowData, TValue> = CoreHeader<TData, TValue> &
|
|
|
200
193
|
ColumnSizingHeader
|
|
201
194
|
|
|
202
195
|
export type HeaderGroup<TData extends RowData> = CoreHeaderGroup<TData>
|
|
203
|
-
|
|
204
|
-
export type NoInfer<A extends any> = [A][A extends any ? 0 : never]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRow } from '../core/row'
|
|
2
|
-
import { Table, Row, RowModel,
|
|
2
|
+
import { Table, Row, RowModel, RowData } from '../types'
|
|
3
3
|
import { memo } from '../utils'
|
|
4
4
|
|
|
5
5
|
export function getCoreRowModel<TData extends RowData>(): (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedColumnFilter } from '../features/Filters'
|
|
2
|
-
import { Table, RowModel,
|
|
2
|
+
import { Table, RowModel, Row, RowData } from '../types'
|
|
3
3
|
import { memo } from '../utils'
|
|
4
4
|
import { filterRows } from './filterRowsUtils'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRow } from '../core/row'
|
|
2
|
-
import { Table, Row, RowModel,
|
|
2
|
+
import { Table, Row, RowModel, RowData } from '../types'
|
|
3
3
|
import { flattenBy, memo } from '../utils'
|
|
4
4
|
|
|
5
5
|
export function getGroupedRowModel<TData extends RowData>(): (
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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> &
|
|
@@ -65,6 +65,10 @@ export type DeepValue<T, TProp> = T extends Record<string | number, any>
|
|
|
65
65
|
: T[TProp & string]
|
|
66
66
|
: never
|
|
67
67
|
|
|
68
|
+
export type NoInfer<T> = [T][T extends any ? 0 : never]
|
|
69
|
+
|
|
70
|
+
export type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>
|
|
71
|
+
|
|
68
72
|
///
|
|
69
73
|
|
|
70
74
|
export function functionalUpdate<T>(updater: Updater<T>, input: T): T {
|