@tanstack/table-core 8.0.0-alpha.25 → 8.0.0-alpha.26

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/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.25",
4
+ "version": "8.0.0-alpha.26",
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.tsx CHANGED
@@ -197,11 +197,14 @@ export type CoreColumnDef<TGenerics extends AnyGenerics> = {
197
197
  }
198
198
  // & GeneratedProperties<true>
199
199
 
200
+ export type CoreColumnDefType = 'data' | 'display' | 'group'
201
+
200
202
  export type CoreColumn<TGenerics extends AnyGenerics> = {
201
203
  id: string
202
204
  depth: number
203
205
  accessorFn?: AccessorFn<TGenerics['Row']>
204
206
  columnDef: ColumnDef<TGenerics>
207
+ columnDefType: CoreColumnDefType
205
208
  getWidth: () => number
206
209
  columns: Column<TGenerics>[]
207
210
  parent?: Column<TGenerics>
@@ -299,7 +302,11 @@ export function createTableInstance<TGenerics extends AnyGenerics>(
299
302
 
300
303
  getColumnDefs: () => instance.options.columns,
301
304
 
302
- createColumn: (columnDef, depth: number, parent) => {
305
+ createColumn: (
306
+ columnDef: ColumnDef<TGenerics> & { columnDefType?: CoreColumnDefType },
307
+ depth: number,
308
+ parent
309
+ ) => {
303
310
  const defaultColumn = instance.getDefaultColumn()
304
311
 
305
312
  let id =
@@ -335,6 +342,7 @@ export function createTableInstance<TGenerics extends AnyGenerics>(
335
342
  parent: parent as any,
336
343
  depth,
337
344
  columnDef,
345
+ columnDefType: columnDef.columnDefType as CoreColumnDefType,
338
346
  columns: [],
339
347
  getWidth: () => instance.getColumnWidth(column.id),
340
348
  getFlatColumns: memo(
@@ -133,11 +133,12 @@ function _createTable<TGenerics extends AnyGenerics>(
133
133
  },
134
134
  },
135
135
  createColumns: columns => columns,
136
- createDisplayColumn: column => column as any,
137
- createGroup: column => column as any,
136
+ createDisplayColumn: column => ({ ...column, columnDefType: 'display' }),
137
+ createGroup: column => ({ ...column, columnDefType: 'group' } as any),
138
138
  createDataColumn: (accessor, column): any => {
139
139
  column = {
140
140
  ...column,
141
+ columnDefType: 'data',
141
142
  id: column.id,
142
143
  }
143
144