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