@tanstack/table-core 8.0.0-alpha.83 → 8.0.0-alpha.84

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.
Files changed (93) hide show
  1. package/build/cjs/core/cell.js +38 -0
  2. package/build/cjs/core/cell.js.map +1 -0
  3. package/build/cjs/core/column.js +88 -0
  4. package/build/cjs/core/column.js.map +1 -0
  5. package/build/cjs/{features/Headers.js → core/headers.js} +54 -66
  6. package/build/cjs/core/headers.js.map +1 -0
  7. package/build/cjs/core/instance.js +255 -0
  8. package/build/cjs/core/instance.js.map +1 -0
  9. package/build/cjs/core/row.js +77 -0
  10. package/build/cjs/core/row.js.map +1 -0
  11. package/build/cjs/features/ColumnSizing.js.map +1 -1
  12. package/build/cjs/features/Expanding.js.map +1 -1
  13. package/build/cjs/features/Filters.js +1 -1
  14. package/build/cjs/features/Filters.js.map +1 -1
  15. package/build/cjs/features/Grouping.js.map +1 -1
  16. package/build/cjs/features/Ordering.js.map +1 -1
  17. package/build/cjs/features/Pagination.js.map +1 -1
  18. package/build/cjs/features/Pinning.js +3 -3
  19. package/build/cjs/features/Pinning.js.map +1 -1
  20. package/build/cjs/features/RowSelection.js.map +1 -1
  21. package/build/cjs/features/Sorting.js.map +1 -1
  22. package/build/cjs/features/Visibility.js.map +1 -1
  23. package/build/cjs/index.js +9 -5
  24. package/build/cjs/index.js.map +1 -1
  25. package/build/cjs/utils/filterRowsUtils.js +23 -21
  26. package/build/cjs/utils/filterRowsUtils.js.map +1 -1
  27. package/build/cjs/utils/getCoreRowModel.js +9 -8
  28. package/build/cjs/utils/getCoreRowModel.js.map +1 -1
  29. package/build/cjs/utils/getGroupedRowModel.js +12 -11
  30. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  31. package/build/esm/index.js +656 -761
  32. package/build/esm/index.js.map +1 -1
  33. package/build/stats-html.html +1 -1
  34. package/build/stats-react.json +391 -368
  35. package/build/types/core/cell.d.ts +9 -0
  36. package/build/types/{features/Columns.d.ts → core/column.d.ts} +3 -17
  37. package/build/types/{features/Headers.d.ts → core/headers.d.ts} +26 -11
  38. package/build/types/core/instance.d.ts +57 -0
  39. package/build/types/core/row.d.ts +15 -0
  40. package/build/types/features/ColumnSizing.d.ts +2 -1
  41. package/build/types/features/Expanding.d.ts +2 -1
  42. package/build/types/features/Filters.d.ts +2 -1
  43. package/build/types/features/Grouping.d.ts +2 -1
  44. package/build/types/features/Ordering.d.ts +2 -1
  45. package/build/types/features/Pagination.d.ts +2 -1
  46. package/build/types/features/Pinning.d.ts +2 -1
  47. package/build/types/features/RowSelection.d.ts +2 -1
  48. package/build/types/features/Sorting.d.ts +2 -1
  49. package/build/types/features/Visibility.d.ts +2 -1
  50. package/build/types/index.d.ts +4 -2
  51. package/build/types/sortingFns.d.ts +4 -4
  52. package/build/types/types.d.ts +10 -53
  53. package/build/umd/index.development.js +660 -759
  54. package/build/umd/index.development.js.map +1 -1
  55. package/build/umd/index.production.js +1 -1
  56. package/build/umd/index.production.js.map +1 -1
  57. package/package.json +1 -1
  58. package/src/core/cell.ts +47 -0
  59. package/src/core/column.ts +148 -0
  60. package/src/{features/Headers.ts → core/headers.ts} +98 -99
  61. package/src/core/instance.ts +361 -0
  62. package/src/core/row.ts +85 -0
  63. package/src/features/ColumnSizing.ts +1 -1
  64. package/src/features/Expanding.ts +1 -2
  65. package/src/features/Filters.ts +2 -2
  66. package/src/features/Grouping.ts +1 -1
  67. package/src/features/Ordering.ts +1 -1
  68. package/src/features/Pagination.ts +1 -1
  69. package/src/features/Pinning.ts +8 -4
  70. package/src/features/RowSelection.ts +1 -1
  71. package/src/features/Sorting.ts +1 -1
  72. package/src/features/Visibility.ts +1 -1
  73. package/src/index.ts +4 -8
  74. package/src/types.ts +9 -61
  75. package/src/utils/filterRowsUtils.ts +4 -2
  76. package/src/utils/getCoreRowModel.ts +4 -2
  77. package/src/utils/getGroupedRowModel.ts +6 -6
  78. package/build/cjs/core.js +0 -168
  79. package/build/cjs/core.js.map +0 -1
  80. package/build/cjs/features/Cells.js +0 -101
  81. package/build/cjs/features/Cells.js.map +0 -1
  82. package/build/cjs/features/Columns.js +0 -191
  83. package/build/cjs/features/Columns.js.map +0 -1
  84. package/build/cjs/features/Headers.js.map +0 -1
  85. package/build/cjs/features/Rows.js +0 -94
  86. package/build/cjs/features/Rows.js.map +0 -1
  87. package/build/types/core.d.ts +0 -30
  88. package/build/types/features/Cells.d.ts +0 -13
  89. package/build/types/features/Rows.d.ts +0 -28
  90. package/src/core.ts +0 -246
  91. package/src/features/Cells.ts +0 -128
  92. package/src/features/Columns.ts +0 -293
  93. package/src/features/Rows.ts +0 -142
@@ -0,0 +1,361 @@
1
+ import { flattenBy, functionalUpdate, memo, RequiredKeys } from '../utils'
2
+
3
+ import {
4
+ Updater,
5
+ TableOptionsResolved,
6
+ TableState,
7
+ TableInstance,
8
+ Renderable,
9
+ TableGenerics,
10
+ InitialTableState,
11
+ Row,
12
+ Column,
13
+ RowModel,
14
+ ColumnDef,
15
+ } from '../types'
16
+
17
+ //
18
+ import { createColumn } from './column'
19
+ import { Headers } from './headers'
20
+ //
21
+
22
+ import { ColumnSizing } from '../features/ColumnSizing'
23
+ import { Expanding } from '../features/Expanding'
24
+ import { Filters } from '../features/Filters'
25
+ import { Grouping } from '../features/Grouping'
26
+ import { Ordering } from '../features/Ordering'
27
+ import { Pagination } from '../features/Pagination'
28
+ import { Pinning } from '../features/Pinning'
29
+ import { RowSelection } from '../features/RowSelection'
30
+ import { Sorting } from '../features/Sorting'
31
+ import { Visibility } from '../features/Visibility'
32
+
33
+ export type TableFeature = {
34
+ getDefaultOptions?: (instance: any) => any
35
+ getInitialState?: (initialState?: InitialTableState) => any
36
+ createInstance?: (instance: any) => any
37
+ getDefaultColumnDef?: () => any
38
+ createColumn?: (column: any, instance: any) => any
39
+ createHeader?: (column: any, instance: any) => any
40
+ createCell?: (cell: any, column: any, row: any, instance: any) => any
41
+ createRow?: (row: any, instance: any) => any
42
+ }
43
+
44
+ const features = [
45
+ Headers,
46
+ Visibility,
47
+ Ordering,
48
+ Pinning,
49
+ Filters,
50
+ Sorting,
51
+ Grouping,
52
+ Expanding,
53
+ Pagination,
54
+ RowSelection,
55
+ ColumnSizing,
56
+ ] as const
57
+
58
+ //
59
+
60
+ export type CoreTableState = {}
61
+
62
+ export type CoreOptions<TGenerics extends TableGenerics> = {
63
+ data: TGenerics['Row'][]
64
+ state: Partial<TableState>
65
+ onStateChange: (updater: Updater<TableState>) => void
66
+ render: TGenerics['Renderer']
67
+ debugAll?: boolean
68
+ debugTable?: boolean
69
+ debugHeaders?: boolean
70
+ debugColumns?: boolean
71
+ debugRows?: boolean
72
+ initialState?: InitialTableState
73
+ autoResetAll?: boolean
74
+ mergeOptions?: <T>(defaultOptions: T, options: Partial<T>) => T
75
+ meta?: TGenerics['TableMeta']
76
+ getCoreRowModel: (
77
+ instance: TableInstance<TGenerics>
78
+ ) => () => RowModel<TGenerics>
79
+ getSubRows?: (
80
+ originalRow: TGenerics['Row'],
81
+ index: number
82
+ ) => undefined | TGenerics['Row'][]
83
+ getRowId?: (
84
+ originalRow: TGenerics['Row'],
85
+ index: number,
86
+ parent?: Row<TGenerics>
87
+ ) => string
88
+ columns: ColumnDef<TGenerics>[]
89
+ defaultColumn?: Partial<ColumnDef<TGenerics>>
90
+ }
91
+
92
+ export type CoreInstance<TGenerics extends TableGenerics> = {
93
+ initialState: TableState
94
+ reset: () => void
95
+ options: RequiredKeys<TableOptionsResolved<TGenerics>, 'state'>
96
+ setOptions: (newOptions: Updater<TableOptionsResolved<TGenerics>>) => void
97
+ getState: () => TableState
98
+ setState: (updater: Updater<TableState>) => void
99
+ _features: readonly TableFeature[]
100
+ _queue: (cb: () => void) => void
101
+ _render: <TProps>(
102
+ template: Renderable<TGenerics, TProps>,
103
+ props: TProps
104
+ ) => string | null | TGenerics['Rendered']
105
+ _getRowId: (
106
+ _: TGenerics['Row'],
107
+ index: number,
108
+ parent?: Row<TGenerics>
109
+ ) => string
110
+ getCoreRowModel: () => RowModel<TGenerics>
111
+ _getCoreRowModel?: () => RowModel<TGenerics>
112
+ getRowModel: () => RowModel<TGenerics>
113
+ getRow: (id: string) => Row<TGenerics>
114
+ _getDefaultColumnDef: () => Partial<ColumnDef<TGenerics>>
115
+ _getColumnDefs: () => ColumnDef<TGenerics>[]
116
+ _getAllFlatColumnsById: () => Record<string, Column<TGenerics>>
117
+ getAllColumns: () => Column<TGenerics>[]
118
+ getAllFlatColumns: () => Column<TGenerics>[]
119
+ getAllLeafColumns: () => Column<TGenerics>[]
120
+ getColumn: (columnId: string) => Column<TGenerics>
121
+ }
122
+
123
+ export function createTableInstance<TGenerics extends TableGenerics>(
124
+ options: TableOptionsResolved<TGenerics>
125
+ ): TableInstance<TGenerics> {
126
+ if (options.debugAll || options.debugTable) {
127
+ console.info('Creating Table Instance...')
128
+ }
129
+
130
+ let instance = { _features: features } as unknown as TableInstance<TGenerics>
131
+
132
+ const defaultOptions = instance._features.reduce((obj, feature) => {
133
+ return Object.assign(obj, feature.getDefaultOptions?.(instance))
134
+ }, {}) as TableOptionsResolved<TGenerics>
135
+
136
+ const mergeOptions = (options: TableOptionsResolved<TGenerics>) => {
137
+ if (instance.options.mergeOptions) {
138
+ return instance.options.mergeOptions(defaultOptions, options)
139
+ }
140
+
141
+ return {
142
+ ...defaultOptions,
143
+ ...options,
144
+ }
145
+ }
146
+
147
+ const coreInitialState: CoreTableState = {}
148
+
149
+ let initialState = {
150
+ ...coreInitialState,
151
+ ...(options.initialState ?? {}),
152
+ } as TableState
153
+
154
+ instance._features.forEach(feature => {
155
+ initialState = feature.getInitialState?.(initialState) ?? initialState
156
+ })
157
+
158
+ const queued: (() => void)[] = []
159
+ let queuedTimeout = false
160
+
161
+ const coreInstance: CoreInstance<TGenerics> = {
162
+ _features: features,
163
+ options: {
164
+ ...defaultOptions,
165
+ ...options,
166
+ },
167
+ initialState,
168
+ _queue: cb => {
169
+ queued.push(cb)
170
+
171
+ if (!queuedTimeout) {
172
+ queuedTimeout = true
173
+
174
+ // Schedule a microtask to run the queued callbacks after
175
+ // the current call stack (render, etc) has finished.
176
+ Promise.resolve()
177
+ .then(() => {
178
+ while (queued.length) {
179
+ queued.shift()!()
180
+ }
181
+ queuedTimeout = false
182
+ })
183
+ .catch(error =>
184
+ setTimeout(() => {
185
+ throw error
186
+ })
187
+ )
188
+ }
189
+ },
190
+ reset: () => {
191
+ instance.setState(instance.initialState)
192
+ },
193
+ setOptions: updater => {
194
+ const newOptions = functionalUpdate(updater, instance.options)
195
+ instance.options = mergeOptions(newOptions)
196
+ },
197
+ _render: (template, props) => {
198
+ if (typeof instance.options.render === 'function') {
199
+ return instance.options.render(template, props)
200
+ }
201
+
202
+ if (typeof template === 'function') {
203
+ return (template as Function)(props)
204
+ }
205
+
206
+ return template
207
+ },
208
+
209
+ getState: () => {
210
+ return instance.options.state as TableState
211
+ },
212
+
213
+ setState: (updater: Updater<TableState>) => {
214
+ instance.options.onStateChange?.(updater)
215
+ },
216
+
217
+ _getRowId: (
218
+ row: TGenerics['Row'],
219
+ index: number,
220
+ parent?: Row<TGenerics>
221
+ ) =>
222
+ instance.options.getRowId?.(row, index, parent) ??
223
+ `${parent ? [parent.id, index].join('.') : index}`,
224
+
225
+ getCoreRowModel: () => {
226
+ if (!instance._getCoreRowModel) {
227
+ instance._getCoreRowModel = instance.options.getCoreRowModel(instance)
228
+ }
229
+
230
+ return instance._getCoreRowModel()
231
+ },
232
+
233
+ // The final calls start at the bottom of the model,
234
+ // expanded rows, which then work their way up
235
+
236
+ getRowModel: () => {
237
+ return instance.getPaginationRowModel()
238
+ },
239
+ getRow: (id: string) => {
240
+ const row = instance.getRowModel().rowsById[id]
241
+
242
+ if (!row) {
243
+ if (process.env.NODE_ENV !== 'production') {
244
+ throw new Error(`getRow expected an ID, but got ${id}`)
245
+ }
246
+ throw new Error()
247
+ }
248
+
249
+ return row
250
+ },
251
+ _getDefaultColumnDef: memo(
252
+ () => [instance.options.defaultColumn],
253
+ defaultColumn => {
254
+ defaultColumn = (defaultColumn ?? {}) as Partial<ColumnDef<TGenerics>>
255
+
256
+ return {
257
+ header: props => props.header.column.id,
258
+ footer: props => props.header.column.id,
259
+ cell: props => props.getValue().toString?.() ?? null,
260
+ ...instance._features.reduce((obj, feature) => {
261
+ return Object.assign(obj, feature.getDefaultColumnDef?.())
262
+ }, {}),
263
+ ...defaultColumn,
264
+ } as Partial<ColumnDef<TGenerics>>
265
+ },
266
+ {
267
+ debug: () => instance.options.debugAll ?? instance.options.debugColumns,
268
+ key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef',
269
+ }
270
+ ),
271
+
272
+ _getColumnDefs: () => instance.options.columns,
273
+
274
+ getAllColumns: memo(
275
+ () => [instance._getColumnDefs()],
276
+ columnDefs => {
277
+ const recurseColumns = (
278
+ columnDefs: ColumnDef<TGenerics>[],
279
+ parent?: Column<TGenerics>,
280
+ depth = 0
281
+ ): Column<TGenerics>[] => {
282
+ return columnDefs.map(columnDef => {
283
+ const column = createColumn(instance, columnDef, depth, parent)
284
+
285
+ column.columns = columnDef.columns
286
+ ? recurseColumns(columnDef.columns, column, depth + 1)
287
+ : []
288
+
289
+ return column
290
+ })
291
+ }
292
+
293
+ return recurseColumns(columnDefs)
294
+ },
295
+ {
296
+ key: process.env.NODE_ENV === 'development' && 'getAllColumns',
297
+ debug: () => instance.options.debugAll ?? instance.options.debugColumns,
298
+ }
299
+ ),
300
+
301
+ getAllFlatColumns: memo(
302
+ () => [instance.getAllColumns()],
303
+ allColumns => {
304
+ return allColumns.flatMap(column => {
305
+ return column.getFlatColumns()
306
+ })
307
+ },
308
+ {
309
+ key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',
310
+ debug: () => instance.options.debugAll ?? instance.options.debugColumns,
311
+ }
312
+ ),
313
+
314
+ _getAllFlatColumnsById: memo(
315
+ () => [instance.getAllFlatColumns()],
316
+ flatColumns => {
317
+ return flatColumns.reduce((acc, column) => {
318
+ acc[column.id] = column
319
+ return acc
320
+ }, {} as Record<string, Column<TGenerics>>)
321
+ },
322
+ {
323
+ key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',
324
+ debug: () => instance.options.debugAll ?? instance.options.debugColumns,
325
+ }
326
+ ),
327
+
328
+ getAllLeafColumns: memo(
329
+ () => [instance.getAllColumns(), instance._getOrderColumnsFn()],
330
+ (allColumns, orderColumns) => {
331
+ let leafColumns = allColumns.flatMap(column => column.getLeafColumns())
332
+ return orderColumns(leafColumns)
333
+ },
334
+ {
335
+ key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',
336
+ debug: () => instance.options.debugAll ?? instance.options.debugColumns,
337
+ }
338
+ ),
339
+
340
+ getColumn: columnId => {
341
+ const column = instance._getAllFlatColumnsById()[columnId]
342
+
343
+ if (!column) {
344
+ if (process.env.NODE_ENV !== 'production') {
345
+ console.warn(`[Table] Column with id ${columnId} does not exist.`)
346
+ }
347
+ throw new Error()
348
+ }
349
+
350
+ return column
351
+ },
352
+ }
353
+
354
+ Object.assign(instance, coreInstance)
355
+
356
+ instance._features.forEach(feature => {
357
+ return Object.assign(instance, feature.createInstance?.(instance))
358
+ })
359
+
360
+ return instance
361
+ }
@@ -0,0 +1,85 @@
1
+ import { Cell, Row, TableGenerics, TableInstance } from '../types'
2
+ import { flattenBy, memo } from '../utils'
3
+ import { createCell } from './cell'
4
+
5
+ export type CoreRow<TGenerics extends TableGenerics> = {
6
+ id: string
7
+ index: number
8
+ original?: TGenerics['Row']
9
+ depth: number
10
+ _valuesCache: Record<string, any>
11
+ getValue: (columnId: string) => any
12
+ subRows: Row<TGenerics>[]
13
+ getLeafRows: () => Row<TGenerics>[]
14
+ originalSubRows?: TGenerics['Row'][]
15
+ getAllCells: () => Cell<TGenerics>[]
16
+ _getAllCellsByColumnId: () => Record<string, Cell<TGenerics>>
17
+ }
18
+
19
+ export const createRow = <TGenerics extends TableGenerics>(
20
+ instance: TableInstance<TGenerics>,
21
+ id: string,
22
+ original: TGenerics['Row'] | undefined,
23
+ rowIndex: number,
24
+ depth: number,
25
+ subRows?: Row<TGenerics>[]
26
+ ): Row<TGenerics> => {
27
+ let row: CoreRow<TGenerics> = {
28
+ id,
29
+ index: rowIndex,
30
+ original,
31
+ depth,
32
+ _valuesCache: {},
33
+ getValue: columnId => {
34
+ if (row._valuesCache.hasOwnProperty(columnId)) {
35
+ return row._valuesCache[columnId]
36
+ }
37
+
38
+ const column = instance.getColumn(columnId)
39
+
40
+ if (!column.accessorFn) {
41
+ return undefined
42
+ }
43
+
44
+ row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex)
45
+
46
+ return row._valuesCache[columnId]
47
+ },
48
+ subRows: subRows ?? [],
49
+ getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
50
+ getAllCells: memo(
51
+ () => [instance.getAllLeafColumns()],
52
+ leafColumns => {
53
+ return leafColumns.map(column => {
54
+ return createCell(instance, row as Row<TGenerics>, column, column.id)
55
+ })
56
+ },
57
+ {
58
+ key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
59
+ debug: () => instance.options.debugAll ?? instance.options.debugRows,
60
+ }
61
+ ),
62
+
63
+ _getAllCellsByColumnId: memo(
64
+ () => [row.getAllCells()],
65
+ allCells => {
66
+ return allCells.reduce((acc, cell) => {
67
+ acc[cell.column.id] = cell
68
+ return acc
69
+ }, {} as Record<string, Cell<TGenerics>>)
70
+ },
71
+ {
72
+ key:
73
+ process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',
74
+ debug: () => instance.options.debugAll ?? instance.options.debugRows,
75
+ }
76
+ ),
77
+ }
78
+
79
+ for (let i = 0; i < instance._features.length; i++) {
80
+ const feature = instance._features[i]
81
+ Object.assign(row, feature?.createRow?.(row, instance))
82
+ }
83
+
84
+ return row as Row<TGenerics>
85
+ }
@@ -1,3 +1,4 @@
1
+ import { TableFeature } from '../core/instance'
1
2
  import {
2
3
  Column,
3
4
  Header,
@@ -5,7 +6,6 @@ import {
5
6
  TableGenerics,
6
7
  TableInstance,
7
8
  Updater,
8
- TableFeature,
9
9
  } from '../types'
10
10
  import { makeStateUpdater } from '../utils'
11
11
  import { ColumnPinningPosition } from './Pinning'
@@ -1,14 +1,13 @@
1
1
  import { RowModel } from '..'
2
+ import { TableFeature } from '../core/instance'
2
3
  import {
3
4
  OnChangeFn,
4
5
  TableGenerics,
5
6
  TableInstance,
6
7
  Row,
7
8
  Updater,
8
- TableFeature,
9
9
  } from '../types'
10
10
  import { makeStateUpdater } from '../utils'
11
- import { Rows } from './Rows'
12
11
 
13
12
  export type ExpandedStateList = Record<string, boolean>
14
13
  export type ExpandedState = true | Record<string, boolean>
@@ -1,4 +1,5 @@
1
1
  import { RowModel } from '..'
2
+ import { TableFeature } from '../core/instance'
2
3
  import { BuiltInFilterFn, filterFns } from '../filterFns'
3
4
  import {
4
5
  Column,
@@ -7,7 +8,6 @@ import {
7
8
  TableInstance,
8
9
  Row,
9
10
  Updater,
10
- TableFeature,
11
11
  } from '../types'
12
12
  import {
13
13
  functionalUpdate,
@@ -190,7 +190,7 @@ export const Filters: TableFeature = {
190
190
  getColumnCanGlobalFilter: column => {
191
191
  const value = instance
192
192
  .getCoreRowModel()
193
- .flatRows[0]?.getAllCellsByColumnId()
193
+ .flatRows[0]?._getAllCellsByColumnId()
194
194
  [column.id]?.getValue()
195
195
 
196
196
  return typeof value === 'string'
@@ -1,5 +1,6 @@
1
1
  import { RowModel } from '..'
2
2
  import { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'
3
+ import { TableFeature } from '../core/instance'
3
4
  import {
4
5
  Cell,
5
6
  Column,
@@ -9,7 +10,6 @@ import {
9
10
  Updater,
10
11
  Renderable,
11
12
  TableGenerics,
12
- TableFeature,
13
13
  } from '../types'
14
14
  import { isFunction, makeStateUpdater, Overwrite } from '../utils'
15
15
 
@@ -6,10 +6,10 @@ import {
6
6
  Updater,
7
7
  Column,
8
8
  TableGenerics,
9
- TableFeature,
10
9
  } from '../types'
11
10
 
12
11
  import { Grouping, orderColumns } from './Grouping'
12
+ import { TableFeature } from '../core/instance'
13
13
 
14
14
  export type ColumnOrderTableState = {
15
15
  columnOrder: ColumnOrderState
@@ -1,10 +1,10 @@
1
+ import { TableFeature } from '../core/instance'
1
2
  import {
2
3
  OnChangeFn,
3
4
  TableGenerics,
4
5
  TableInstance,
5
6
  RowModel,
6
7
  Updater,
7
- TableFeature,
8
8
  } from '../types'
9
9
  import { functionalUpdate, makeStateUpdater, memo } from '../utils'
10
10
 
@@ -1,3 +1,4 @@
1
+ import { TableFeature } from '../core/instance'
1
2
  import {
2
3
  OnChangeFn,
3
4
  Updater,
@@ -6,7 +7,6 @@ import {
6
7
  TableGenerics,
7
8
  Row,
8
9
  Cell,
9
- TableFeature,
10
10
  } from '../types'
11
11
  import { makeStateUpdater, memo } from '../utils'
12
12
 
@@ -164,7 +164,7 @@ export const Pinning: TableFeature = {
164
164
  (allCells, left, right) => {
165
165
  const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]
166
166
 
167
- return allCells.filter(d => !leftAndRight.includes(d.columnId))
167
+ return allCells.filter(d => !leftAndRight.includes(d.column.id))
168
168
  },
169
169
  {
170
170
  key:
@@ -181,7 +181,9 @@ export const Pinning: TableFeature = {
181
181
  ],
182
182
  (allCells, left) => {
183
183
  const cells = (left ?? [])
184
- .map(columnId => allCells.find(cell => cell.columnId === columnId)!)
184
+ .map(
185
+ columnId => allCells.find(cell => cell.column.id === columnId)!
186
+ )
185
187
  .filter(Boolean)
186
188
  .map(d => ({ ...d, position: 'left' } as Cell<TGenerics>))
187
189
 
@@ -200,7 +202,9 @@ export const Pinning: TableFeature = {
200
202
  ],
201
203
  (allCells, right) => {
202
204
  const cells = (right ?? [])
203
- .map(columnId => allCells.find(cell => cell.columnId === columnId)!)
205
+ .map(
206
+ columnId => allCells.find(cell => cell.column.id === columnId)!
207
+ )
204
208
  .filter(Boolean)
205
209
  .map(d => ({ ...d, position: 'left' } as Cell<TGenerics>))
206
210
 
@@ -1,3 +1,4 @@
1
+ import { TableFeature } from '../core/instance'
1
2
  import {
2
3
  OnChangeFn,
3
4
  TableGenerics,
@@ -5,7 +6,6 @@ import {
5
6
  Row,
6
7
  RowModel,
7
8
  Updater,
8
- TableFeature,
9
9
  } from '../types'
10
10
  import { makeStateUpdater, memo } from '../utils'
11
11
 
@@ -1,4 +1,5 @@
1
1
  import { RowModel } from '..'
2
+ import { TableFeature } from '../core/instance'
2
3
  import {
3
4
  BuiltInSortingFn,
4
5
  reSplitAlphaNumeric,
@@ -12,7 +13,6 @@ import {
12
13
  TableInstance,
13
14
  Row,
14
15
  Updater,
15
- TableFeature,
16
16
  } from '../types'
17
17
 
18
18
  import { isFunction, makeStateUpdater, Overwrite } from '../utils'
@@ -1,3 +1,4 @@
1
+ import { TableFeature } from '../core/instance'
1
2
  import {
2
3
  Cell,
3
4
  Column,
@@ -6,7 +7,6 @@ import {
6
7
  TableInstance,
7
8
  Updater,
8
9
  Row,
9
- TableFeature,
10
10
  } from '../types'
11
11
  import { makeStateUpdater, memo } from '../utils'
12
12
 
package/src/index.ts CHANGED
@@ -1,12 +1,14 @@
1
- export * from './core'
1
+ export * from './core/instance'
2
2
  export * from './types'
3
3
  export * from './createTable'
4
+ export * from './core/column'
5
+ export * from './core/headers'
6
+ export * from './core/row'
4
7
  export * from './features/ColumnSizing'
5
8
  export * from './features/ColumnSizing'
6
9
  export * from './features/Expanding'
7
10
  export * from './features/Filters'
8
11
  export * from './features/Grouping'
9
- export * from './features/Headers'
10
12
  export * from './features/Ordering'
11
13
  export * from './features/Pagination'
12
14
  export * from './features/Pinning'
@@ -27,9 +29,3 @@ export * from './utils/getSortedRowModel'
27
29
  export * from './utils/getGroupedRowModel'
28
30
  export * from './utils/getExpandedRowModel'
29
31
  export * from './utils/getPaginationRowModel'
30
- // Experimental Async
31
- // export * from './utils/getCoreRowModelAsync'
32
- // export * from './utils/getFilteredRowModelAsync'
33
- // export * from './utils/getFacetedRowModelAsync'
34
- // export * from './utils/getFacetedUniqueValuesAsync'
35
- // export * from './utils/getFacetedMinMaxValuesAsync'