@tanstack/react-table 8.0.0-alpha.73 → 8.0.0-alpha.74
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/table-core/build/esm/index.js +32 -137
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +32 -137
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +17 -17
- package/build/umd/index.development.js +32 -137
- 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 +2 -2
package/build/esm/index.js
CHANGED
|
@@ -3036,7 +3036,6 @@ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
|
|
|
3036
3036
|
// data: Batch[]
|
|
3037
3037
|
// facets: Batch[]
|
|
3038
3038
|
// }
|
|
3039
|
-
// export type TaskPriority = keyof CoreBatches
|
|
3040
3039
|
function createTableInstance(options) {
|
|
3041
3040
|
var _options$initialState;
|
|
3042
3041
|
|
|
@@ -3075,64 +3074,7 @@ function createTableInstance(options) {
|
|
|
3075
3074
|
});
|
|
3076
3075
|
|
|
3077
3076
|
const queued = [];
|
|
3078
|
-
let queuedTimeout = false;
|
|
3079
|
-
// let working = false
|
|
3080
|
-
// let latestCallback: ReturnType<typeof requestIdleCallback>
|
|
3081
|
-
// let batchUid = 0
|
|
3082
|
-
// const onProgress = () => {}
|
|
3083
|
-
// const getBatch = () => {
|
|
3084
|
-
// instance.batches.data = instance.batches.data.filter(d => d.tasks.length)
|
|
3085
|
-
// instance.batches.facets = instance.batches.facets.filter(
|
|
3086
|
-
// d => d.tasks.length
|
|
3087
|
-
// )
|
|
3088
|
-
// return (
|
|
3089
|
-
// instance.batches.data.find(d => d.tasks.length) ??
|
|
3090
|
-
// instance.batches.facets.find(d => d.tasks.length)
|
|
3091
|
-
// )
|
|
3092
|
-
// }
|
|
3093
|
-
// const startWorkLoop = () => {
|
|
3094
|
-
// working = true
|
|
3095
|
-
// const workLoop = (deadline: IdleDeadline) => {
|
|
3096
|
-
// const batch = getBatch()
|
|
3097
|
-
// if (!batch) {
|
|
3098
|
-
// working = false
|
|
3099
|
-
// return
|
|
3100
|
-
// }
|
|
3101
|
-
// // Prioritize tasks
|
|
3102
|
-
// while (deadline.timeRemaining() > 0 && batch.tasks.length) {
|
|
3103
|
-
// batch.tasks.shift()!()
|
|
3104
|
-
// }
|
|
3105
|
-
// onProgress()
|
|
3106
|
-
// if (working) {
|
|
3107
|
-
// latestCallback = requestIdleCallback(workLoop, { timeout: 10000 })
|
|
3108
|
-
// }
|
|
3109
|
-
// }
|
|
3110
|
-
// latestCallback = requestIdleCallback(workLoop, { timeout: 10000 })
|
|
3111
|
-
// }
|
|
3112
|
-
// const startWork = () => {
|
|
3113
|
-
// if (getBatch() && !working) {
|
|
3114
|
-
// if (
|
|
3115
|
-
// (process.env.NODE_ENV === 'development' && instance.options.debugAll) ??
|
|
3116
|
-
// instance.options.debugTable
|
|
3117
|
-
// ) {
|
|
3118
|
-
// console.info('Starting work...')
|
|
3119
|
-
// }
|
|
3120
|
-
// startWorkLoop()
|
|
3121
|
-
// }
|
|
3122
|
-
// }
|
|
3123
|
-
// const stopWork = () => {
|
|
3124
|
-
// if (working) {
|
|
3125
|
-
// if (
|
|
3126
|
-
// (process.env.NODE_ENV === 'development' && instance.options.debugAll) ??
|
|
3127
|
-
// instance.options.debugTable
|
|
3128
|
-
// ) {
|
|
3129
|
-
// console.info('Stopping work...')
|
|
3130
|
-
// }
|
|
3131
|
-
// working = false
|
|
3132
|
-
// cancelIdleCallback(latestCallback)
|
|
3133
|
-
// }
|
|
3134
|
-
// }
|
|
3135
|
-
|
|
3077
|
+
let queuedTimeout = false;
|
|
3136
3078
|
const midInstance = { ...instance,
|
|
3137
3079
|
// init: () => {
|
|
3138
3080
|
// startWork()
|
|
@@ -3165,39 +3107,6 @@ function createTableInstance(options) {
|
|
|
3165
3107
|
}));
|
|
3166
3108
|
}
|
|
3167
3109
|
},
|
|
3168
|
-
// batches: {
|
|
3169
|
-
// data: [],
|
|
3170
|
-
// facets: [],
|
|
3171
|
-
// },
|
|
3172
|
-
// createBatch: priority => {
|
|
3173
|
-
// const batchId = batchUid++
|
|
3174
|
-
// let canceled: boolean
|
|
3175
|
-
// const batch: Batch = {
|
|
3176
|
-
// id: batchId,
|
|
3177
|
-
// priority,
|
|
3178
|
-
// tasks: [],
|
|
3179
|
-
// schedule: cb => {
|
|
3180
|
-
// if (canceled) return
|
|
3181
|
-
// batch.tasks.push(cb)
|
|
3182
|
-
// if (!working && !workScheduled) {
|
|
3183
|
-
// workScheduled = true
|
|
3184
|
-
// instance.queue(() => {
|
|
3185
|
-
// workScheduled = false
|
|
3186
|
-
// instance.setState(old => ({ ...old }))
|
|
3187
|
-
// })
|
|
3188
|
-
// }
|
|
3189
|
-
// },
|
|
3190
|
-
// cancel: () => {
|
|
3191
|
-
// canceled = true
|
|
3192
|
-
// batch.tasks = []
|
|
3193
|
-
// instance.batches[priority] = instance.batches[priority].filter(
|
|
3194
|
-
// b => b.id !== batchId
|
|
3195
|
-
// )
|
|
3196
|
-
// },
|
|
3197
|
-
// }
|
|
3198
|
-
// instance.batches[priority].push(batch)
|
|
3199
|
-
// return batch
|
|
3200
|
-
// },
|
|
3201
3110
|
reset: () => {
|
|
3202
3111
|
instance.setState(instance.initialState);
|
|
3203
3112
|
},
|
|
@@ -3308,69 +3217,55 @@ function createTable$1(_, __, options) {
|
|
|
3308
3217
|
|
|
3309
3218
|
function getCoreRowModel() {
|
|
3310
3219
|
return instance => memo(() => [instance.options.data], data => {
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3220
|
+
const rowModel = {
|
|
3221
|
+
rows: [],
|
|
3222
|
+
flatRows: [],
|
|
3223
|
+
rowsById: {}
|
|
3224
|
+
};
|
|
3225
|
+
let rows;
|
|
3226
|
+
let row;
|
|
3227
|
+
let originalRow;
|
|
3316
3228
|
|
|
3317
|
-
const
|
|
3229
|
+
const accessRows = function (originalRows, depth, parent) {
|
|
3318
3230
|
if (depth === void 0) {
|
|
3319
3231
|
depth = 0;
|
|
3320
3232
|
}
|
|
3321
3233
|
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
if (!id) {
|
|
3325
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3326
|
-
throw new Error("getRowId expected an ID, but got " + id);
|
|
3327
|
-
}
|
|
3328
|
-
}
|
|
3329
|
-
|
|
3330
|
-
const values = {};
|
|
3331
|
-
|
|
3332
|
-
for (let i = 0; i < leafColumns.length; i++) {
|
|
3333
|
-
const column = leafColumns[i];
|
|
3334
|
-
|
|
3335
|
-
if (column && column.accessorFn) {
|
|
3336
|
-
values[column.id] = column.accessorFn(originalRow, rowIndex);
|
|
3337
|
-
}
|
|
3338
|
-
} // Make the row
|
|
3234
|
+
rows = [];
|
|
3339
3235
|
|
|
3236
|
+
for (let i = 0; i < originalRows.length; i++) {
|
|
3237
|
+
originalRow = originalRows[i]; // This could be an expensive check at scale, so we should move it somewhere else, but where?
|
|
3238
|
+
// if (!id) {
|
|
3239
|
+
// if (process.env.NODE_ENV !== 'production') {
|
|
3240
|
+
// throw new Error(`getRowId expected an ID, but got ${id}`)
|
|
3241
|
+
// }
|
|
3242
|
+
// }
|
|
3243
|
+
// Make the row
|
|
3340
3244
|
|
|
3341
|
-
|
|
3245
|
+
row = instance.createRow(instance.getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
|
|
3342
3246
|
|
|
3343
|
-
|
|
3247
|
+
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3344
3248
|
|
|
3345
|
-
|
|
3249
|
+
rowModel.rowsById[row.id] = row; // Push instance row into parent
|
|
3346
3250
|
|
|
3347
|
-
|
|
3251
|
+
rows.push(row); // Get the original subrows
|
|
3348
3252
|
|
|
3349
|
-
|
|
3350
|
-
|
|
3253
|
+
if (instance.options.getSubRows) {
|
|
3254
|
+
var _row$originalSubRows;
|
|
3351
3255
|
|
|
3352
|
-
|
|
3353
|
-
row.originalSubRows = originalSubRows;
|
|
3354
|
-
const subRows = [];
|
|
3256
|
+
row.originalSubRows = instance.options.getSubRows(originalRow, i); // Then recursively access them
|
|
3355
3257
|
|
|
3356
|
-
|
|
3357
|
-
|
|
3258
|
+
if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
|
|
3259
|
+
row.subRows = accessRows(row.originalSubRows, depth + 1, row);
|
|
3358
3260
|
}
|
|
3359
|
-
|
|
3360
|
-
row.subRows = subRows;
|
|
3361
3261
|
}
|
|
3362
3262
|
}
|
|
3363
|
-
};
|
|
3364
|
-
|
|
3365
|
-
for (let i = 0; i < data.length; i++) {
|
|
3366
|
-
accessRow(data[i], i, 0, rows);
|
|
3367
|
-
}
|
|
3368
3263
|
|
|
3369
|
-
|
|
3370
|
-
rows,
|
|
3371
|
-
flatRows,
|
|
3372
|
-
rowsById
|
|
3264
|
+
return rows;
|
|
3373
3265
|
};
|
|
3266
|
+
|
|
3267
|
+
rowModel.rows = accessRows(data);
|
|
3268
|
+
return rowModel;
|
|
3374
3269
|
}, {
|
|
3375
3270
|
key: process.env.NODE_ENV === 'development' && 'getRowModel',
|
|
3376
3271
|
debug: () => {
|