@tanstack/table-core 8.5.1 → 8.5.2
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/columnHelper.js.map +1 -1
- package/build/cjs/core/table.js +14 -2
- package/build/cjs/core/table.js.map +1 -1
- package/build/esm/index.js +14 -2
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +310 -310
- package/build/types/index.d.ts +3 -1
- package/build/umd/index.development.js +14 -2
- 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/columnHelper.ts +13 -4
- package/src/core/table.ts +16 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/table-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.5.
|
|
4
|
+
"version": "8.5.2",
|
|
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/columnHelper.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CoreColumnDefDisplay,
|
|
3
|
+
CoreColumnDefDisplayWithStringHeader,
|
|
4
|
+
} from './core/column'
|
|
5
|
+
import { GroupingColumnDef } from './features/Grouping'
|
|
1
6
|
import { AccessorFn, ColumnDef, RowData } from './types'
|
|
2
7
|
import { DeepKeys, DeepValue, RequiredKeys } from './utils'
|
|
3
8
|
|
|
@@ -60,10 +65,14 @@ export type ColumnHelper<TData extends RowData> = {
|
|
|
60
65
|
>
|
|
61
66
|
) => ColumnDef<TData, unknown>
|
|
62
67
|
group: (
|
|
63
|
-
column:
|
|
64
|
-
|
|
65
|
-
'id' | 'columns'
|
|
66
|
-
>
|
|
68
|
+
column: Omit<
|
|
69
|
+
ColumnDef<TData, unknown>,
|
|
70
|
+
'id' | 'header' | 'accessorKey' | 'accessorFn' | 'columns'
|
|
71
|
+
> &
|
|
72
|
+
(
|
|
73
|
+
| CoreColumnDefDisplayWithStringHeader<TData, unknown>
|
|
74
|
+
| CoreColumnDefDisplay<TData, unknown>
|
|
75
|
+
) & { columns: ColumnDef<TData, any>[] }
|
|
67
76
|
) => ColumnDef<TData, unknown>
|
|
68
77
|
}
|
|
69
78
|
|
package/src/core/table.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from '../types'
|
|
18
18
|
|
|
19
19
|
//
|
|
20
|
-
import { createColumn } from './column'
|
|
20
|
+
import { CoreColumnDefResolved, createColumn } from './column'
|
|
21
21
|
import { Headers } from './headers'
|
|
22
22
|
//
|
|
23
23
|
|
|
@@ -232,8 +232,21 @@ export function createTable<TData extends RowData>(
|
|
|
232
232
|
>
|
|
233
233
|
|
|
234
234
|
return {
|
|
235
|
-
header: props =>
|
|
236
|
-
|
|
235
|
+
header: props => {
|
|
236
|
+
const resolvedColumnDef = props.header.column
|
|
237
|
+
.columnDef as CoreColumnDefResolved<TData>
|
|
238
|
+
|
|
239
|
+
if (resolvedColumnDef.accessorKey) {
|
|
240
|
+
return resolvedColumnDef.accessorKey
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (resolvedColumnDef.accessorFn) {
|
|
244
|
+
return resolvedColumnDef.id
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return null
|
|
248
|
+
},
|
|
249
|
+
// footer: props => props.header.column.id,
|
|
237
250
|
cell: props => props.renderValue<any>()?.toString?.() ?? null,
|
|
238
251
|
...table._features.reduce((obj, feature) => {
|
|
239
252
|
return Object.assign(obj, feature.getDefaultColumnDef?.())
|