@tanstack/table-core 8.0.0-alpha.65 → 8.0.0-alpha.69
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/aggregationFns.js +25 -37
- package/build/cjs/aggregationFns.js.map +1 -1
- package/build/cjs/core.js +167 -48
- package/build/cjs/core.js.map +1 -1
- package/build/cjs/createTable.js +24 -40
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/Cells.js +28 -34
- package/build/cjs/features/Cells.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js +136 -225
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Columns.js +57 -84
- package/build/cjs/features/Columns.js.map +1 -1
- package/build/cjs/features/Expanding.js +79 -126
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +137 -288
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +71 -117
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js +125 -205
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Ordering.js +32 -44
- package/build/cjs/features/Ordering.js.map +1 -1
- package/build/cjs/features/Pagination.js +79 -82
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Pinning.js +99 -178
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js +133 -204
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Rows.js +32 -22
- package/build/cjs/features/Rows.js.map +1 -1
- package/build/cjs/features/Sorting.js +67 -136
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +56 -118
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterFns.js +48 -72
- package/build/cjs/filterFns.js.map +1 -1
- package/build/cjs/index.js +13 -13
- package/build/cjs/sortingFns.js +21 -21
- package/build/cjs/sortingFns.js.map +1 -1
- package/build/cjs/utils/filterRowsUtils.js +49 -55
- package/build/cjs/utils/filterRowsUtils.js.map +1 -1
- package/build/cjs/utils/getCoreRowModel.js +98 -0
- package/build/cjs/utils/getCoreRowModel.js.map +1 -0
- package/build/cjs/utils/getExpandedRowModel.js +18 -22
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getFacetedMinMaxValues.js +48 -0
- package/build/cjs/utils/getFacetedMinMaxValues.js.map +1 -0
- package/build/cjs/utils/getFacetedRowModel.js +50 -0
- package/build/cjs/utils/getFacetedRowModel.js.map +1 -0
- package/build/cjs/utils/getFacetedUniqueValues.js +48 -0
- package/build/cjs/utils/getFacetedUniqueValues.js.map +1 -0
- package/build/cjs/utils/getFilteredRowModel.js +130 -0
- package/build/cjs/utils/getFilteredRowModel.js.map +1 -0
- package/build/cjs/utils/getGroupedRowModel.js +126 -136
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/cjs/utils/getPaginationRowModel.js +39 -39
- package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
- package/build/cjs/utils/getSortedRowModel.js +112 -0
- package/build/cjs/utils/getSortedRowModel.js.map +1 -0
- package/build/cjs/utils.js +36 -207
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +2024 -2971
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +421 -481
- package/build/types/core.d.ts +3 -5
- package/build/types/features/Cells.d.ts +1 -1
- package/build/types/features/ColumnSizing.d.ts +4 -15
- package/build/types/features/Columns.d.ts +1 -1
- package/build/types/features/Expanding.d.ts +2 -7
- package/build/types/features/Filters.d.ts +24 -21
- package/build/types/features/Grouping.d.ts +5 -11
- package/build/types/features/Ordering.d.ts +1 -1
- package/build/types/features/Pagination.d.ts +3 -3
- package/build/types/features/Pinning.d.ts +1 -5
- package/build/types/features/RowSelection.d.ts +2 -8
- package/build/types/features/Rows.d.ts +4 -3
- package/build/types/features/Sorting.d.ts +5 -15
- package/build/types/features/Visibility.d.ts +1 -4
- package/build/types/index.d.ts +6 -4
- package/build/types/types.d.ts +3 -15
- package/build/types/utils/filterRowsUtils.d.ts +3 -3
- package/build/types/utils/getCoreRowModel.d.ts +2 -0
- package/build/types/utils/getFacetedMinMaxValues.d.ts +2 -0
- package/build/types/utils/getFacetedRowModel.d.ts +2 -0
- package/build/types/utils/getFacetedUniqueValues.d.ts +2 -0
- package/build/types/utils/{getCoreRowModelSync.d.ts → getFilteredRowModel.d.ts} +1 -1
- package/build/types/utils/getGroupedRowModel.d.ts +1 -1
- package/build/types/utils/getSortedRowModel.d.ts +2 -0
- package/build/types/utils.d.ts +1 -17
- package/build/umd/index.development.js +2053 -3002
- 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.ts +197 -47
- package/src/features/Cells.ts +7 -11
- package/src/features/ColumnSizing.ts +89 -139
- package/src/features/Columns.ts +10 -13
- package/src/features/Expanding.ts +62 -107
- package/src/features/Filters.ts +201 -308
- package/src/features/Grouping.ts +55 -81
- package/src/features/Headers.ts +18 -40
- package/src/features/Ordering.ts +6 -4
- package/src/features/Pagination.ts +31 -17
- package/src/features/Pinning.ts +79 -96
- package/src/features/RowSelection.ts +68 -118
- package/src/features/Rows.ts +21 -6
- package/src/features/Sorting.ts +47 -103
- package/src/features/Visibility.ts +24 -47
- package/src/filterFns.ts +9 -9
- package/src/index.ts +12 -4
- package/src/sortingFns.ts +11 -11
- package/src/types.ts +3 -18
- package/src/utils/filterRowsUtils.ts +47 -68
- package/src/utils/{getCoreRowModelSync.ts → getCoreRowModel.ts} +3 -9
- package/src/utils/getExpandedRowModel.ts +2 -2
- package/src/utils/getFacetedMinMaxValues.ts +37 -0
- package/src/utils/getFacetedRowModel.ts +50 -0
- package/src/utils/getFacetedUniqueValues.ts +37 -0
- package/src/utils/getFilteredRowModel.ts +150 -0
- package/src/utils/getGroupedRowModel.ts +53 -62
- package/src/utils/getPaginationRowModel.ts +1 -1
- package/src/utils/{getSortedRowModelSync.ts → getSortedRowModel.ts} +7 -7
- package/src/utils.ts +28 -236
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -112
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/utils/getCoreRowModelAsync.js +0 -125
- package/build/cjs/utils/getCoreRowModelAsync.js.map +0 -1
- package/build/cjs/utils/getCoreRowModelSync.js +0 -102
- package/build/cjs/utils/getCoreRowModelSync.js.map +0 -1
- package/build/cjs/utils/getFilteredRowModelSync.js +0 -130
- package/build/cjs/utils/getFilteredRowModelSync.js.map +0 -1
- package/build/cjs/utils/getSortedRowModelSync.js +0 -118
- package/build/cjs/utils/getSortedRowModelSync.js.map +0 -1
- package/build/types/utils/getCoreRowModelAsync.d.ts +0 -4
- package/build/types/utils/getFilteredRowModelAsync.d.ts +0 -4
- package/build/types/utils/getFilteredRowModelSync.d.ts +0 -2
- package/build/types/utils/getSortedRowModelAsync.d.ts +0 -13
- package/build/types/utils/getSortedRowModelSync.d.ts +0 -2
- package/src/utils/getCoreRowModelAsync.ts +0 -104
- package/src/utils/getFilteredRowModelAsync.ts +0 -49
- package/src/utils/getFilteredRowModelSync.ts +0 -150
- package/src/utils/getSortedRowModelAsync.ts +0 -200
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.
|
|
4
|
+
"version": "8.0.0-alpha.69",
|
|
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.ts
CHANGED
|
@@ -26,10 +26,9 @@ import { Sorting } from './features/Sorting'
|
|
|
26
26
|
import { Visibility } from './features/Visibility'
|
|
27
27
|
import { Headers } from './features/Headers'
|
|
28
28
|
//
|
|
29
|
-
import { mean } from './aggregationFns'
|
|
30
29
|
|
|
31
30
|
export type CoreTableState = {
|
|
32
|
-
coreProgress: number
|
|
31
|
+
// coreProgress: number
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export type CoreOptions<TGenerics extends TableGenerics> = {
|
|
@@ -45,27 +44,52 @@ export type CoreOptions<TGenerics extends TableGenerics> = {
|
|
|
45
44
|
initialState?: InitialTableState
|
|
46
45
|
autoResetAll?: boolean
|
|
47
46
|
mergeOptions?: <T>(defaultOptions: T, options: Partial<T>) => T
|
|
47
|
+
keepPreviousData?: boolean
|
|
48
48
|
meta?: TGenerics['TableMeta']
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export type
|
|
51
|
+
export type CoreInstance<TGenerics extends TableGenerics> = {
|
|
52
52
|
// generics: TGenerics
|
|
53
53
|
initialState: TableState
|
|
54
54
|
reset: () => void
|
|
55
55
|
options: RequiredKeys<TableOptions<TGenerics>, 'state'>
|
|
56
56
|
setOptions: (newOptions: Updater<TableOptions<TGenerics>>) => void
|
|
57
57
|
queue: (cb: () => void) => void
|
|
58
|
-
// willUpdate: () => void
|
|
59
58
|
getState: () => TableState
|
|
60
59
|
setState: (updater: Updater<TableState>) => void
|
|
61
60
|
render: <TProps>(
|
|
62
61
|
template: Renderable<TGenerics, TProps>,
|
|
63
62
|
props: TProps
|
|
64
63
|
) => string | null | TGenerics['Rendered']
|
|
65
|
-
getOverallProgress: () => number
|
|
64
|
+
// getOverallProgress: () => number
|
|
65
|
+
// getProgressStage: () =>
|
|
66
|
+
// | undefined
|
|
67
|
+
// | 'coreRowModel'
|
|
68
|
+
// | 'filteredRowModel'
|
|
69
|
+
// | 'facetedRowModel'
|
|
66
70
|
_features: readonly TableFeature[]
|
|
71
|
+
// createBatch: (priority: keyof CoreBatches) => Batch
|
|
72
|
+
// init: () => void
|
|
73
|
+
// willUpdate: () => void
|
|
74
|
+
// destroy: () => void
|
|
75
|
+
// batches: CoreBatches
|
|
67
76
|
}
|
|
68
77
|
|
|
78
|
+
// export type Batch = {
|
|
79
|
+
// id: number
|
|
80
|
+
// priority: keyof CoreBatches
|
|
81
|
+
// tasks: (() => void)[]
|
|
82
|
+
// schedule: (cb: () => void) => void
|
|
83
|
+
// cancel: () => void
|
|
84
|
+
// }
|
|
85
|
+
|
|
86
|
+
// type CoreBatches = {
|
|
87
|
+
// data: Batch[]
|
|
88
|
+
// facets: Batch[]
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
// export type TaskPriority = keyof CoreBatches
|
|
92
|
+
|
|
69
93
|
export function createTableInstance<TGenerics extends TableGenerics>(
|
|
70
94
|
options: TableOptions<TGenerics>
|
|
71
95
|
): TableInstance<TGenerics> {
|
|
@@ -73,24 +97,24 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
73
97
|
console.info('Creating Table Instance...')
|
|
74
98
|
}
|
|
75
99
|
|
|
76
|
-
let instance = {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
let instance = {
|
|
101
|
+
_features: [
|
|
102
|
+
Columns,
|
|
103
|
+
Rows,
|
|
104
|
+
Cells,
|
|
105
|
+
Headers,
|
|
106
|
+
Visibility,
|
|
107
|
+
Ordering,
|
|
108
|
+
Pinning,
|
|
109
|
+
Filters,
|
|
110
|
+
Sorting,
|
|
111
|
+
Grouping,
|
|
112
|
+
Expanding,
|
|
113
|
+
Pagination,
|
|
114
|
+
RowSelection,
|
|
115
|
+
ColumnSizing,
|
|
116
|
+
] as const,
|
|
117
|
+
} as unknown as CoreInstance<TGenerics>
|
|
94
118
|
|
|
95
119
|
const defaultOptions = instance._features.reduce((obj, feature) => {
|
|
96
120
|
return Object.assign(obj, feature.getDefaultOptions?.(instance))
|
|
@@ -107,13 +131,8 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
107
131
|
}
|
|
108
132
|
}
|
|
109
133
|
|
|
110
|
-
instance.options = {
|
|
111
|
-
...defaultOptions,
|
|
112
|
-
...options,
|
|
113
|
-
}
|
|
114
|
-
|
|
115
134
|
const coreInitialState: CoreTableState = {
|
|
116
|
-
coreProgress: 1,
|
|
135
|
+
// coreProgress: 1,
|
|
117
136
|
}
|
|
118
137
|
|
|
119
138
|
let initialState = {
|
|
@@ -128,11 +147,90 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
128
147
|
const queued: (() => void)[] = []
|
|
129
148
|
let queuedTimeout = false
|
|
130
149
|
|
|
131
|
-
|
|
150
|
+
// let workScheduled = false
|
|
151
|
+
// let working = false
|
|
152
|
+
// let latestCallback: ReturnType<typeof requestIdleCallback>
|
|
153
|
+
// let batchUid = 0
|
|
154
|
+
// const onProgress = () => {}
|
|
155
|
+
// const getBatch = () => {
|
|
156
|
+
// instance.batches.data = instance.batches.data.filter(d => d.tasks.length)
|
|
157
|
+
// instance.batches.facets = instance.batches.facets.filter(
|
|
158
|
+
// d => d.tasks.length
|
|
159
|
+
// )
|
|
160
|
+
|
|
161
|
+
// return (
|
|
162
|
+
// instance.batches.data.find(d => d.tasks.length) ??
|
|
163
|
+
// instance.batches.facets.find(d => d.tasks.length)
|
|
164
|
+
// )
|
|
165
|
+
// }
|
|
166
|
+
|
|
167
|
+
// const startWorkLoop = () => {
|
|
168
|
+
// working = true
|
|
169
|
+
|
|
170
|
+
// const workLoop = (deadline: IdleDeadline) => {
|
|
171
|
+
// const batch = getBatch()
|
|
172
|
+
|
|
173
|
+
// if (!batch) {
|
|
174
|
+
// working = false
|
|
175
|
+
// return
|
|
176
|
+
// }
|
|
177
|
+
// // Prioritize tasks
|
|
178
|
+
// while (deadline.timeRemaining() > 0 && batch.tasks.length) {
|
|
179
|
+
// batch.tasks.shift()!()
|
|
180
|
+
// }
|
|
181
|
+
|
|
182
|
+
// onProgress()
|
|
183
|
+
|
|
184
|
+
// if (working) {
|
|
185
|
+
// latestCallback = requestIdleCallback(workLoop, { timeout: 10000 })
|
|
186
|
+
// }
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// latestCallback = requestIdleCallback(workLoop, { timeout: 10000 })
|
|
190
|
+
// }
|
|
191
|
+
|
|
192
|
+
// const startWork = () => {
|
|
193
|
+
// if (getBatch() && !working) {
|
|
194
|
+
// if (
|
|
195
|
+
// (process.env.NODE_ENV === 'development' && instance.options.debugAll) ??
|
|
196
|
+
// instance.options.debugTable
|
|
197
|
+
// ) {
|
|
198
|
+
// console.info('Starting work...')
|
|
199
|
+
// }
|
|
200
|
+
// startWorkLoop()
|
|
201
|
+
// }
|
|
202
|
+
// }
|
|
203
|
+
|
|
204
|
+
// const stopWork = () => {
|
|
205
|
+
// if (working) {
|
|
206
|
+
// if (
|
|
207
|
+
// (process.env.NODE_ENV === 'development' && instance.options.debugAll) ??
|
|
208
|
+
// instance.options.debugTable
|
|
209
|
+
// ) {
|
|
210
|
+
// console.info('Stopping work...')
|
|
211
|
+
// }
|
|
212
|
+
|
|
213
|
+
// working = false
|
|
214
|
+
// cancelIdleCallback(latestCallback)
|
|
215
|
+
// }
|
|
216
|
+
// }
|
|
217
|
+
|
|
218
|
+
const midInstance: CoreInstance<TGenerics> = {
|
|
132
219
|
...instance,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
220
|
+
// init: () => {
|
|
221
|
+
// startWork()
|
|
222
|
+
// },
|
|
223
|
+
// willUpdate: () => {
|
|
224
|
+
// startWork()
|
|
225
|
+
// },
|
|
226
|
+
// destroy: () => {
|
|
227
|
+
// stopWork()
|
|
228
|
+
// },
|
|
229
|
+
options: {
|
|
230
|
+
...defaultOptions,
|
|
231
|
+
...options,
|
|
232
|
+
},
|
|
233
|
+
initialState,
|
|
136
234
|
queue: cb => {
|
|
137
235
|
queued.push(cb)
|
|
138
236
|
|
|
@@ -144,7 +242,6 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
144
242
|
Promise.resolve()
|
|
145
243
|
.then(() => {
|
|
146
244
|
while (queued.length) {
|
|
147
|
-
console.log('queue')
|
|
148
245
|
queued.shift()!()
|
|
149
246
|
}
|
|
150
247
|
queuedTimeout = false
|
|
@@ -156,8 +253,43 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
156
253
|
)
|
|
157
254
|
}
|
|
158
255
|
},
|
|
159
|
-
//
|
|
160
|
-
|
|
256
|
+
// batches: {
|
|
257
|
+
// data: [],
|
|
258
|
+
// facets: [],
|
|
259
|
+
// },
|
|
260
|
+
// createBatch: priority => {
|
|
261
|
+
// const batchId = batchUid++
|
|
262
|
+
// let canceled: boolean
|
|
263
|
+
|
|
264
|
+
// const batch: Batch = {
|
|
265
|
+
// id: batchId,
|
|
266
|
+
// priority,
|
|
267
|
+
// tasks: [],
|
|
268
|
+
// schedule: cb => {
|
|
269
|
+
// if (canceled) return
|
|
270
|
+
// batch.tasks.push(cb)
|
|
271
|
+
|
|
272
|
+
// if (!working && !workScheduled) {
|
|
273
|
+
// workScheduled = true
|
|
274
|
+
// instance.queue(() => {
|
|
275
|
+
// workScheduled = false
|
|
276
|
+
// instance.setState(old => ({ ...old }))
|
|
277
|
+
// })
|
|
278
|
+
// }
|
|
279
|
+
// },
|
|
280
|
+
// cancel: () => {
|
|
281
|
+
// canceled = true
|
|
282
|
+
// batch.tasks = []
|
|
283
|
+
// instance.batches[priority] = instance.batches[priority].filter(
|
|
284
|
+
// b => b.id !== batchId
|
|
285
|
+
// )
|
|
286
|
+
// },
|
|
287
|
+
// }
|
|
288
|
+
|
|
289
|
+
// instance.batches[priority].push(batch)
|
|
290
|
+
|
|
291
|
+
// return batch
|
|
292
|
+
// },
|
|
161
293
|
reset: () => {
|
|
162
294
|
instance.setState(instance.initialState)
|
|
163
295
|
},
|
|
@@ -185,19 +317,37 @@ export function createTableInstance<TGenerics extends TableGenerics>(
|
|
|
185
317
|
instance.options.onStateChange?.(updater)
|
|
186
318
|
},
|
|
187
319
|
|
|
188
|
-
getOverallProgress: () => {
|
|
189
|
-
|
|
190
|
-
|
|
320
|
+
// getOverallProgress: () => {
|
|
321
|
+
// const { coreProgress, filtersProgress, facetProgress } =
|
|
322
|
+
// instance.getState()
|
|
191
323
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
324
|
+
// return mean(() =>
|
|
325
|
+
// [coreProgress, filtersProgress].filter(d => d < 1)
|
|
326
|
+
// ) as number
|
|
327
|
+
// },
|
|
328
|
+
// getProgressStage: () => {
|
|
329
|
+
// const { coreProgress, filtersProgress, facetProgress } =
|
|
330
|
+
// instance.getState()
|
|
331
|
+
|
|
332
|
+
// if (coreProgress < 1) {
|
|
333
|
+
// return 'coreRowModel'
|
|
334
|
+
// }
|
|
335
|
+
|
|
336
|
+
// if (filtersProgress < 1) {
|
|
337
|
+
// return 'filteredRowModel'
|
|
338
|
+
// }
|
|
339
|
+
|
|
340
|
+
// if (Object.values(facetProgress).some(d => d < 1)) {
|
|
341
|
+
// return 'facetedRowModel'
|
|
342
|
+
// }
|
|
343
|
+
// },
|
|
198
344
|
}
|
|
199
345
|
|
|
200
|
-
instance = Object.assign(instance,
|
|
346
|
+
instance = Object.assign(instance, midInstance)
|
|
347
|
+
|
|
348
|
+
instance._features.forEach(feature => {
|
|
349
|
+
return Object.assign(instance, feature.createInstance?.(instance))
|
|
350
|
+
})
|
|
201
351
|
|
|
202
|
-
return instance
|
|
352
|
+
return instance as TableInstance<TGenerics>
|
|
203
353
|
}
|
package/src/features/Cells.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type CellsInstance<TGenerics extends TableGenerics> = {
|
|
|
17
17
|
createCell: (
|
|
18
18
|
row: Row<TGenerics>,
|
|
19
19
|
column: Column<TGenerics>,
|
|
20
|
-
|
|
20
|
+
columnId: string
|
|
21
21
|
) => Cell<TGenerics>
|
|
22
22
|
getCell: (rowId: string, columnId: string) => Cell<TGenerics>
|
|
23
23
|
}
|
|
@@ -34,15 +34,11 @@ export const Cells = {
|
|
|
34
34
|
() => [instance.getAllLeafColumns()],
|
|
35
35
|
leafColumns => {
|
|
36
36
|
return leafColumns.map(column => {
|
|
37
|
-
return instance.createCell(
|
|
38
|
-
row as Row<TGenerics>,
|
|
39
|
-
column,
|
|
40
|
-
row.values[column.id]
|
|
41
|
-
)
|
|
37
|
+
return instance.createCell(row as Row<TGenerics>, column, column.id)
|
|
42
38
|
})
|
|
43
39
|
},
|
|
44
40
|
{
|
|
45
|
-
key: process.env.NODE_ENV
|
|
41
|
+
key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
|
|
46
42
|
debug: () => instance.options.debugAll ?? instance.options.debugRows,
|
|
47
43
|
}
|
|
48
44
|
),
|
|
@@ -69,14 +65,14 @@ export const Cells = {
|
|
|
69
65
|
instance: TableInstance<TGenerics>
|
|
70
66
|
): CellsInstance<TGenerics> => {
|
|
71
67
|
return {
|
|
72
|
-
createCell: (row, column,
|
|
68
|
+
createCell: (row, column, columnId) => {
|
|
73
69
|
const cell: CoreCell<TGenerics> = {
|
|
74
70
|
id: `${row.id}_${column.id}`,
|
|
75
71
|
rowId: row.id,
|
|
76
|
-
columnId
|
|
72
|
+
columnId,
|
|
77
73
|
row,
|
|
78
74
|
column,
|
|
79
|
-
|
|
75
|
+
getValue: () => row.getValue(columnId),
|
|
80
76
|
renderCell: () =>
|
|
81
77
|
column.cell
|
|
82
78
|
? instance.render(column.cell, {
|
|
@@ -84,7 +80,7 @@ export const Cells = {
|
|
|
84
80
|
column,
|
|
85
81
|
row,
|
|
86
82
|
cell: cell as Cell<TGenerics>,
|
|
87
|
-
|
|
83
|
+
getValue: cell.getValue,
|
|
88
84
|
})
|
|
89
85
|
: null,
|
|
90
86
|
}
|