@tanstack/react-table 8.0.12 → 8.1.0
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/react-table/src/index.js +16 -21
- package/build/cjs/react-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +586 -678
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +597 -693
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +19 -19
- package/build/types/index.d.ts +19 -15
- package/build/umd/index.development.js +599 -696
- 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/src/index.tsx +19 -43
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
}
|
|
50
50
|
function noop() {//
|
|
51
51
|
}
|
|
52
|
-
function makeStateUpdater(key,
|
|
52
|
+
function makeStateUpdater(key, table) {
|
|
53
53
|
return updater => {
|
|
54
|
-
|
|
54
|
+
table.setState(old => {
|
|
55
55
|
return { ...old,
|
|
56
56
|
[key]: functionalUpdate(updater, old[key])
|
|
57
57
|
};
|
|
@@ -121,36 +121,35 @@
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function createColumn(
|
|
125
|
-
var _ref,
|
|
124
|
+
function createColumn(table, columnDef, depth, parent) {
|
|
125
|
+
var _ref, _resolvedColumnDef$id;
|
|
126
126
|
|
|
127
|
-
const defaultColumn =
|
|
127
|
+
const defaultColumn = table._getDefaultColumnDef();
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
const resolvedColumnDef = { ...defaultColumn,
|
|
130
130
|
...columnDef
|
|
131
131
|
};
|
|
132
|
-
let id = (_ref = (
|
|
132
|
+
let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : resolvedColumnDef.accessorKey) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
|
|
133
133
|
let accessorFn;
|
|
134
134
|
|
|
135
|
-
if (
|
|
136
|
-
accessorFn =
|
|
137
|
-
} else if (
|
|
138
|
-
accessorFn = originalRow => originalRow[
|
|
135
|
+
if (resolvedColumnDef.accessorFn) {
|
|
136
|
+
accessorFn = resolvedColumnDef.accessorFn;
|
|
137
|
+
} else if (resolvedColumnDef.accessorKey) {
|
|
138
|
+
accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
if (!id) {
|
|
142
142
|
{
|
|
143
|
-
throw new Error(
|
|
143
|
+
throw new Error(resolvedColumnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
let column = {
|
|
148
|
-
id: "" + id,
|
|
148
|
+
id: "" + String(id),
|
|
149
149
|
accessorFn,
|
|
150
150
|
parent: parent,
|
|
151
151
|
depth,
|
|
152
|
-
columnDef,
|
|
153
|
-
columnDefType: columnDef.columnDefType,
|
|
152
|
+
columnDef: resolvedColumnDef,
|
|
154
153
|
columns: [],
|
|
155
154
|
getFlatColumns: memo(() => [true], () => {
|
|
156
155
|
var _column$columns;
|
|
@@ -159,12 +158,12 @@
|
|
|
159
158
|
}, {
|
|
160
159
|
key: "development" === 'production' ,
|
|
161
160
|
debug: () => {
|
|
162
|
-
var
|
|
161
|
+
var _table$options$debugA;
|
|
163
162
|
|
|
164
|
-
return (
|
|
163
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
|
|
165
164
|
}
|
|
166
165
|
}),
|
|
167
|
-
getLeafColumns: memo(() => [
|
|
166
|
+
getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
|
|
168
167
|
var _column$columns2;
|
|
169
168
|
|
|
170
169
|
if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
|
|
@@ -176,21 +175,21 @@
|
|
|
176
175
|
}, {
|
|
177
176
|
key: "development" === 'production' ,
|
|
178
177
|
debug: () => {
|
|
179
|
-
var
|
|
178
|
+
var _table$options$debugA2;
|
|
180
179
|
|
|
181
|
-
return (
|
|
180
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
|
|
182
181
|
}
|
|
183
182
|
})
|
|
184
183
|
};
|
|
185
|
-
column =
|
|
186
|
-
return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column,
|
|
187
|
-
}, column); // Yes, we have to convert
|
|
184
|
+
column = table._features.reduce((obj, feature) => {
|
|
185
|
+
return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, table));
|
|
186
|
+
}, column); // Yes, we have to convert table to uknown, because we know more than the compiler here.
|
|
188
187
|
|
|
189
188
|
return column;
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
//
|
|
193
|
-
function createHeader(
|
|
192
|
+
function createHeader(table, column, options) {
|
|
194
193
|
var _options$id;
|
|
195
194
|
|
|
196
195
|
const id = (_options$id = options.id) != null ? _options$id : column.id;
|
|
@@ -219,174 +218,169 @@
|
|
|
219
218
|
recurseHeader(header);
|
|
220
219
|
return leafHeaders;
|
|
221
220
|
},
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
getContext: () => ({
|
|
222
|
+
table,
|
|
224
223
|
header: header,
|
|
225
224
|
column
|
|
226
|
-
})
|
|
227
|
-
renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
|
|
228
|
-
instance,
|
|
229
|
-
header: header,
|
|
230
|
-
column
|
|
231
|
-
}) : null
|
|
225
|
+
})
|
|
232
226
|
};
|
|
233
227
|
|
|
234
|
-
|
|
235
|
-
Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header,
|
|
228
|
+
table._features.forEach(feature => {
|
|
229
|
+
Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, table));
|
|
236
230
|
});
|
|
237
231
|
|
|
238
232
|
return header;
|
|
239
233
|
}
|
|
240
234
|
|
|
241
235
|
const Headers = {
|
|
242
|
-
|
|
236
|
+
createTable: table => {
|
|
243
237
|
return {
|
|
244
238
|
// Header Groups
|
|
245
|
-
getHeaderGroups: memo(() => [
|
|
239
|
+
getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
246
240
|
var _left$map$filter, _right$map$filter;
|
|
247
241
|
|
|
248
242
|
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
249
243
|
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
250
244
|
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
251
|
-
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns],
|
|
245
|
+
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
|
|
252
246
|
return headerGroups;
|
|
253
247
|
}, {
|
|
254
248
|
key: 'getHeaderGroups',
|
|
255
249
|
debug: () => {
|
|
256
|
-
var
|
|
250
|
+
var _table$options$debugA;
|
|
257
251
|
|
|
258
|
-
return (
|
|
252
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
|
|
259
253
|
}
|
|
260
254
|
}),
|
|
261
|
-
getCenterHeaderGroups: memo(() => [
|
|
255
|
+
getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
262
256
|
leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
263
|
-
return buildHeaderGroups(allColumns, leafColumns,
|
|
257
|
+
return buildHeaderGroups(allColumns, leafColumns, table, 'center');
|
|
264
258
|
}, {
|
|
265
259
|
key: 'getCenterHeaderGroups',
|
|
266
260
|
debug: () => {
|
|
267
|
-
var
|
|
261
|
+
var _table$options$debugA2;
|
|
268
262
|
|
|
269
|
-
return (
|
|
263
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
|
|
270
264
|
}
|
|
271
265
|
}),
|
|
272
|
-
getLeftHeaderGroups: memo(() => [
|
|
266
|
+
getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
273
267
|
var _left$map$filter2;
|
|
274
268
|
|
|
275
269
|
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
276
|
-
return buildHeaderGroups(allColumns, orderedLeafColumns,
|
|
270
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
|
|
277
271
|
}, {
|
|
278
272
|
key: 'getLeftHeaderGroups',
|
|
279
273
|
debug: () => {
|
|
280
|
-
var
|
|
274
|
+
var _table$options$debugA3;
|
|
281
275
|
|
|
282
|
-
return (
|
|
276
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
|
|
283
277
|
}
|
|
284
278
|
}),
|
|
285
|
-
getRightHeaderGroups: memo(() => [
|
|
279
|
+
getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
286
280
|
var _right$map$filter2;
|
|
287
281
|
|
|
288
282
|
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
289
|
-
return buildHeaderGroups(allColumns, orderedLeafColumns,
|
|
283
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
|
|
290
284
|
}, {
|
|
291
285
|
key: 'getRightHeaderGroups',
|
|
292
286
|
debug: () => {
|
|
293
|
-
var
|
|
287
|
+
var _table$options$debugA4;
|
|
294
288
|
|
|
295
|
-
return (
|
|
289
|
+
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
|
|
296
290
|
}
|
|
297
291
|
}),
|
|
298
292
|
// Footer Groups
|
|
299
|
-
getFooterGroups: memo(() => [
|
|
293
|
+
getFooterGroups: memo(() => [table.getHeaderGroups()], headerGroups => {
|
|
300
294
|
return [...headerGroups].reverse();
|
|
301
295
|
}, {
|
|
302
296
|
key: 'getFooterGroups',
|
|
303
297
|
debug: () => {
|
|
304
|
-
var
|
|
298
|
+
var _table$options$debugA5;
|
|
305
299
|
|
|
306
|
-
return (
|
|
300
|
+
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
|
|
307
301
|
}
|
|
308
302
|
}),
|
|
309
|
-
getLeftFooterGroups: memo(() => [
|
|
303
|
+
getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
|
|
310
304
|
return [...headerGroups].reverse();
|
|
311
305
|
}, {
|
|
312
306
|
key: 'getLeftFooterGroups',
|
|
313
307
|
debug: () => {
|
|
314
|
-
var
|
|
308
|
+
var _table$options$debugA6;
|
|
315
309
|
|
|
316
|
-
return (
|
|
310
|
+
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
|
|
317
311
|
}
|
|
318
312
|
}),
|
|
319
|
-
getCenterFooterGroups: memo(() => [
|
|
313
|
+
getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
|
|
320
314
|
return [...headerGroups].reverse();
|
|
321
315
|
}, {
|
|
322
316
|
key: 'getCenterFooterGroups',
|
|
323
317
|
debug: () => {
|
|
324
|
-
var
|
|
318
|
+
var _table$options$debugA7;
|
|
325
319
|
|
|
326
|
-
return (
|
|
320
|
+
return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
|
|
327
321
|
}
|
|
328
322
|
}),
|
|
329
|
-
getRightFooterGroups: memo(() => [
|
|
323
|
+
getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
|
|
330
324
|
return [...headerGroups].reverse();
|
|
331
325
|
}, {
|
|
332
326
|
key: 'getRightFooterGroups',
|
|
333
327
|
debug: () => {
|
|
334
|
-
var
|
|
328
|
+
var _table$options$debugA8;
|
|
335
329
|
|
|
336
|
-
return (
|
|
330
|
+
return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
|
|
337
331
|
}
|
|
338
332
|
}),
|
|
339
333
|
// Flat Headers
|
|
340
|
-
getFlatHeaders: memo(() => [
|
|
334
|
+
getFlatHeaders: memo(() => [table.getHeaderGroups()], headerGroups => {
|
|
341
335
|
return headerGroups.map(headerGroup => {
|
|
342
336
|
return headerGroup.headers;
|
|
343
337
|
}).flat();
|
|
344
338
|
}, {
|
|
345
339
|
key: 'getFlatHeaders',
|
|
346
340
|
debug: () => {
|
|
347
|
-
var
|
|
341
|
+
var _table$options$debugA9;
|
|
348
342
|
|
|
349
|
-
return (
|
|
343
|
+
return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
|
|
350
344
|
}
|
|
351
345
|
}),
|
|
352
|
-
getLeftFlatHeaders: memo(() => [
|
|
346
|
+
getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], left => {
|
|
353
347
|
return left.map(headerGroup => {
|
|
354
348
|
return headerGroup.headers;
|
|
355
349
|
}).flat();
|
|
356
350
|
}, {
|
|
357
351
|
key: 'getLeftFlatHeaders',
|
|
358
352
|
debug: () => {
|
|
359
|
-
var
|
|
353
|
+
var _table$options$debugA10;
|
|
360
354
|
|
|
361
|
-
return (
|
|
355
|
+
return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
|
|
362
356
|
}
|
|
363
357
|
}),
|
|
364
|
-
getCenterFlatHeaders: memo(() => [
|
|
358
|
+
getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], left => {
|
|
365
359
|
return left.map(headerGroup => {
|
|
366
360
|
return headerGroup.headers;
|
|
367
361
|
}).flat();
|
|
368
362
|
}, {
|
|
369
363
|
key: 'getCenterFlatHeaders',
|
|
370
364
|
debug: () => {
|
|
371
|
-
var
|
|
365
|
+
var _table$options$debugA11;
|
|
372
366
|
|
|
373
|
-
return (
|
|
367
|
+
return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
|
|
374
368
|
}
|
|
375
369
|
}),
|
|
376
|
-
getRightFlatHeaders: memo(() => [
|
|
370
|
+
getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], left => {
|
|
377
371
|
return left.map(headerGroup => {
|
|
378
372
|
return headerGroup.headers;
|
|
379
373
|
}).flat();
|
|
380
374
|
}, {
|
|
381
375
|
key: 'getRightFlatHeaders',
|
|
382
376
|
debug: () => {
|
|
383
|
-
var
|
|
377
|
+
var _table$options$debugA12;
|
|
384
378
|
|
|
385
|
-
return (
|
|
379
|
+
return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
|
|
386
380
|
}
|
|
387
381
|
}),
|
|
388
382
|
// Leaf Headers
|
|
389
|
-
getCenterLeafHeaders: memo(() => [
|
|
383
|
+
getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
|
|
390
384
|
return flatHeaders.filter(header => {
|
|
391
385
|
var _header$subHeaders;
|
|
392
386
|
|
|
@@ -395,12 +389,12 @@
|
|
|
395
389
|
}, {
|
|
396
390
|
key: 'getCenterLeafHeaders',
|
|
397
391
|
debug: () => {
|
|
398
|
-
var
|
|
392
|
+
var _table$options$debugA13;
|
|
399
393
|
|
|
400
|
-
return (
|
|
394
|
+
return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
|
|
401
395
|
}
|
|
402
396
|
}),
|
|
403
|
-
getLeftLeafHeaders: memo(() => [
|
|
397
|
+
getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
|
|
404
398
|
return flatHeaders.filter(header => {
|
|
405
399
|
var _header$subHeaders2;
|
|
406
400
|
|
|
@@ -409,12 +403,12 @@
|
|
|
409
403
|
}, {
|
|
410
404
|
key: 'getLeftLeafHeaders',
|
|
411
405
|
debug: () => {
|
|
412
|
-
var
|
|
406
|
+
var _table$options$debugA14;
|
|
413
407
|
|
|
414
|
-
return (
|
|
408
|
+
return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
|
|
415
409
|
}
|
|
416
410
|
}),
|
|
417
|
-
getRightLeafHeaders: memo(() => [
|
|
411
|
+
getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
|
|
418
412
|
return flatHeaders.filter(header => {
|
|
419
413
|
var _header$subHeaders3;
|
|
420
414
|
|
|
@@ -423,12 +417,12 @@
|
|
|
423
417
|
}, {
|
|
424
418
|
key: 'getRightLeafHeaders',
|
|
425
419
|
debug: () => {
|
|
426
|
-
var
|
|
420
|
+
var _table$options$debugA15;
|
|
427
421
|
|
|
428
|
-
return (
|
|
422
|
+
return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
|
|
429
423
|
}
|
|
430
424
|
}),
|
|
431
|
-
getLeafHeaders: memo(() => [
|
|
425
|
+
getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
432
426
|
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
433
427
|
|
|
434
428
|
return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
|
|
@@ -437,15 +431,15 @@
|
|
|
437
431
|
}, {
|
|
438
432
|
key: 'getLeafHeaders',
|
|
439
433
|
debug: () => {
|
|
440
|
-
var
|
|
434
|
+
var _table$options$debugA16;
|
|
441
435
|
|
|
442
|
-
return (
|
|
436
|
+
return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
|
|
443
437
|
}
|
|
444
438
|
})
|
|
445
439
|
};
|
|
446
440
|
}
|
|
447
441
|
};
|
|
448
|
-
function buildHeaderGroups(allColumns, columnsToGroup,
|
|
442
|
+
function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
449
443
|
var _headerGroups$0$heade, _headerGroups$;
|
|
450
444
|
|
|
451
445
|
// Find the max depth of the columns:
|
|
@@ -499,12 +493,12 @@
|
|
|
499
493
|
isPlaceholder = true;
|
|
500
494
|
}
|
|
501
495
|
|
|
502
|
-
if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
|
|
496
|
+
if (latestPendingParentHeader && (latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
|
|
503
497
|
// This column is repeated. Add it as a sub header to the next batch
|
|
504
498
|
latestPendingParentHeader.subHeaders.push(headerToGroup);
|
|
505
499
|
} else {
|
|
506
500
|
// This is a new header. Let's create it
|
|
507
|
-
const header = createHeader(
|
|
501
|
+
const header = createHeader(table, column, {
|
|
508
502
|
id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
|
|
509
503
|
isPlaceholder,
|
|
510
504
|
placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
|
|
@@ -528,7 +522,7 @@
|
|
|
528
522
|
}
|
|
529
523
|
};
|
|
530
524
|
|
|
531
|
-
const bottomHeaders = columnsToGroup.map((column, index) => createHeader(
|
|
525
|
+
const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
|
|
532
526
|
depth: maxDepth,
|
|
533
527
|
index
|
|
534
528
|
}));
|
|
@@ -600,23 +594,23 @@
|
|
|
600
594
|
...state
|
|
601
595
|
};
|
|
602
596
|
},
|
|
603
|
-
getDefaultOptions:
|
|
597
|
+
getDefaultOptions: table => {
|
|
604
598
|
return {
|
|
605
599
|
columnResizeMode: 'onEnd',
|
|
606
|
-
onColumnSizingChange: makeStateUpdater('columnSizing',
|
|
607
|
-
onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo',
|
|
600
|
+
onColumnSizingChange: makeStateUpdater('columnSizing', table),
|
|
601
|
+
onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table)
|
|
608
602
|
};
|
|
609
603
|
},
|
|
610
|
-
createColumn: (column,
|
|
604
|
+
createColumn: (column, table) => {
|
|
611
605
|
return {
|
|
612
606
|
getSize: () => {
|
|
613
607
|
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
614
608
|
|
|
615
|
-
const columnSize =
|
|
609
|
+
const columnSize = table.getState().columnSizing[column.id];
|
|
616
610
|
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
617
611
|
},
|
|
618
612
|
getStart: position => {
|
|
619
|
-
const columns = !position ?
|
|
613
|
+
const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
|
|
620
614
|
const index = columns.findIndex(d => d.id === column.id);
|
|
621
615
|
|
|
622
616
|
if (index > 0) {
|
|
@@ -627,7 +621,7 @@
|
|
|
627
621
|
return 0;
|
|
628
622
|
},
|
|
629
623
|
resetSize: () => {
|
|
630
|
-
|
|
624
|
+
table.setColumnSizing(_ref2 => {
|
|
631
625
|
let {
|
|
632
626
|
[column.id]: _,
|
|
633
627
|
...rest
|
|
@@ -636,16 +630,16 @@
|
|
|
636
630
|
});
|
|
637
631
|
},
|
|
638
632
|
getCanResize: () => {
|
|
639
|
-
var _column$columnDef$ena,
|
|
633
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
640
634
|
|
|
641
|
-
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((
|
|
635
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
|
|
642
636
|
},
|
|
643
637
|
getIsResizing: () => {
|
|
644
|
-
return
|
|
638
|
+
return table.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
645
639
|
}
|
|
646
640
|
};
|
|
647
641
|
},
|
|
648
|
-
createHeader: (header,
|
|
642
|
+
createHeader: (header, table) => {
|
|
649
643
|
return {
|
|
650
644
|
getSize: () => {
|
|
651
645
|
let sum = 0;
|
|
@@ -672,7 +666,7 @@
|
|
|
672
666
|
return 0;
|
|
673
667
|
},
|
|
674
668
|
getResizeHandler: () => {
|
|
675
|
-
const column =
|
|
669
|
+
const column = table.getColumn(header.column.id);
|
|
676
670
|
const canResize = column.getCanResize();
|
|
677
671
|
return e => {
|
|
678
672
|
if (!canResize) {
|
|
@@ -697,7 +691,7 @@
|
|
|
697
691
|
}
|
|
698
692
|
|
|
699
693
|
let newColumnSizing = {};
|
|
700
|
-
|
|
694
|
+
table.setColumnSizingInfo(old => {
|
|
701
695
|
var _old$startOffset, _old$startSize;
|
|
702
696
|
|
|
703
697
|
const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
|
|
@@ -712,8 +706,8 @@
|
|
|
712
706
|
};
|
|
713
707
|
});
|
|
714
708
|
|
|
715
|
-
if (
|
|
716
|
-
|
|
709
|
+
if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
|
|
710
|
+
table.setColumnSizing(old => ({ ...old,
|
|
717
711
|
...newColumnSizing
|
|
718
712
|
}));
|
|
719
713
|
}
|
|
@@ -723,7 +717,7 @@
|
|
|
723
717
|
|
|
724
718
|
const onEnd = clientXPos => {
|
|
725
719
|
updateOffset('end', clientXPos);
|
|
726
|
-
|
|
720
|
+
table.setColumnSizingInfo(old => ({ ...old,
|
|
727
721
|
isResizingColumn: false,
|
|
728
722
|
startOffset: null,
|
|
729
723
|
startSize: null,
|
|
@@ -750,7 +744,7 @@
|
|
|
750
744
|
document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
|
|
751
745
|
}
|
|
752
746
|
|
|
753
|
-
|
|
747
|
+
table.setColumnSizingInfo(old => ({ ...old,
|
|
754
748
|
startOffset: clientX,
|
|
755
749
|
startSize,
|
|
756
750
|
deltaOffset: 0,
|
|
@@ -762,47 +756,47 @@
|
|
|
762
756
|
}
|
|
763
757
|
};
|
|
764
758
|
},
|
|
765
|
-
|
|
759
|
+
createTable: table => {
|
|
766
760
|
return {
|
|
767
|
-
setColumnSizing: updater =>
|
|
768
|
-
setColumnSizingInfo: updater =>
|
|
761
|
+
setColumnSizing: updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater),
|
|
762
|
+
setColumnSizingInfo: updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater),
|
|
769
763
|
resetColumnSizing: defaultState => {
|
|
770
|
-
var
|
|
764
|
+
var _table$initialState$c;
|
|
771
765
|
|
|
772
|
-
|
|
766
|
+
table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
|
|
773
767
|
},
|
|
774
768
|
resetHeaderSizeInfo: defaultState => {
|
|
775
|
-
var
|
|
769
|
+
var _table$initialState$c2;
|
|
776
770
|
|
|
777
|
-
|
|
771
|
+
table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
|
|
778
772
|
},
|
|
779
773
|
getTotalSize: () => {
|
|
780
|
-
var
|
|
774
|
+
var _table$getHeaderGroup, _table$getHeaderGroup2;
|
|
781
775
|
|
|
782
|
-
return (
|
|
776
|
+
return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
|
|
783
777
|
return sum + header.getSize();
|
|
784
|
-
}, 0)) != null ?
|
|
778
|
+
}, 0)) != null ? _table$getHeaderGroup : 0;
|
|
785
779
|
},
|
|
786
780
|
getLeftTotalSize: () => {
|
|
787
|
-
var
|
|
781
|
+
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
|
|
788
782
|
|
|
789
|
-
return (
|
|
783
|
+
return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
|
|
790
784
|
return sum + header.getSize();
|
|
791
|
-
}, 0)) != null ?
|
|
785
|
+
}, 0)) != null ? _table$getLeftHeaderG : 0;
|
|
792
786
|
},
|
|
793
787
|
getCenterTotalSize: () => {
|
|
794
|
-
var
|
|
788
|
+
var _table$getCenterHeade, _table$getCenterHeade2;
|
|
795
789
|
|
|
796
|
-
return (
|
|
790
|
+
return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
|
|
797
791
|
return sum + header.getSize();
|
|
798
|
-
}, 0)) != null ?
|
|
792
|
+
}, 0)) != null ? _table$getCenterHeade : 0;
|
|
799
793
|
},
|
|
800
794
|
getRightTotalSize: () => {
|
|
801
|
-
var
|
|
795
|
+
var _table$getRightHeader, _table$getRightHeader2;
|
|
802
796
|
|
|
803
|
-
return (
|
|
797
|
+
return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
|
|
804
798
|
return sum + header.getSize();
|
|
805
|
-
}, 0)) != null ?
|
|
799
|
+
}, 0)) != null ? _table$getRightHeader : 0;
|
|
806
800
|
}
|
|
807
801
|
};
|
|
808
802
|
}
|
|
@@ -845,65 +839,65 @@
|
|
|
845
839
|
...state
|
|
846
840
|
};
|
|
847
841
|
},
|
|
848
|
-
getDefaultOptions:
|
|
842
|
+
getDefaultOptions: table => {
|
|
849
843
|
return {
|
|
850
|
-
onExpandedChange: makeStateUpdater('expanded',
|
|
844
|
+
onExpandedChange: makeStateUpdater('expanded', table),
|
|
851
845
|
paginateExpandedRows: true
|
|
852
846
|
};
|
|
853
847
|
},
|
|
854
|
-
|
|
848
|
+
createTable: table => {
|
|
855
849
|
let registered = false;
|
|
856
850
|
let queued = false;
|
|
857
851
|
return {
|
|
858
852
|
_autoResetExpanded: () => {
|
|
859
|
-
var _ref,
|
|
853
|
+
var _ref, _table$options$autoRe;
|
|
860
854
|
|
|
861
855
|
if (!registered) {
|
|
862
|
-
|
|
856
|
+
table._queue(() => {
|
|
863
857
|
registered = true;
|
|
864
858
|
});
|
|
865
859
|
|
|
866
860
|
return;
|
|
867
861
|
}
|
|
868
862
|
|
|
869
|
-
if ((_ref = (
|
|
863
|
+
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
|
|
870
864
|
if (queued) return;
|
|
871
865
|
queued = true;
|
|
872
866
|
|
|
873
|
-
|
|
874
|
-
|
|
867
|
+
table._queue(() => {
|
|
868
|
+
table.resetExpanded();
|
|
875
869
|
queued = false;
|
|
876
870
|
});
|
|
877
871
|
}
|
|
878
872
|
},
|
|
879
|
-
setExpanded: updater =>
|
|
873
|
+
setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
|
|
880
874
|
toggleAllRowsExpanded: expanded => {
|
|
881
|
-
if (expanded != null ? expanded : !
|
|
882
|
-
|
|
875
|
+
if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
|
|
876
|
+
table.setExpanded(true);
|
|
883
877
|
} else {
|
|
884
|
-
|
|
878
|
+
table.setExpanded({});
|
|
885
879
|
}
|
|
886
880
|
},
|
|
887
881
|
resetExpanded: defaultState => {
|
|
888
|
-
var
|
|
882
|
+
var _table$initialState$e, _table$initialState;
|
|
889
883
|
|
|
890
|
-
|
|
884
|
+
table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
|
|
891
885
|
},
|
|
892
886
|
getCanSomeRowsExpand: () => {
|
|
893
|
-
return
|
|
887
|
+
return table.getRowModel().flatRows.some(row => row.getCanExpand());
|
|
894
888
|
},
|
|
895
889
|
getToggleAllRowsExpandedHandler: () => {
|
|
896
890
|
return e => {
|
|
897
891
|
e.persist == null ? void 0 : e.persist();
|
|
898
|
-
|
|
892
|
+
table.toggleAllRowsExpanded();
|
|
899
893
|
};
|
|
900
894
|
},
|
|
901
895
|
getIsSomeRowsExpanded: () => {
|
|
902
|
-
const expanded =
|
|
896
|
+
const expanded = table.getState().expanded;
|
|
903
897
|
return expanded === true || Object.values(expanded).some(Boolean);
|
|
904
898
|
},
|
|
905
899
|
getIsAllRowsExpanded: () => {
|
|
906
|
-
const expanded =
|
|
900
|
+
const expanded = table.getState().expanded; // If expanded is true, save some cycles and return true
|
|
907
901
|
|
|
908
902
|
if (typeof expanded === 'boolean') {
|
|
909
903
|
return expanded === true;
|
|
@@ -914,7 +908,7 @@
|
|
|
914
908
|
} // If any row is not expanded, return false
|
|
915
909
|
|
|
916
910
|
|
|
917
|
-
if (
|
|
911
|
+
if (table.getRowModel().flatRows.some(row => row.getIsExpanded())) {
|
|
918
912
|
return false;
|
|
919
913
|
} // They must all be expanded :shrug:
|
|
920
914
|
|
|
@@ -923,38 +917,38 @@
|
|
|
923
917
|
},
|
|
924
918
|
getExpandedDepth: () => {
|
|
925
919
|
let maxDepth = 0;
|
|
926
|
-
const rowIds =
|
|
920
|
+
const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
|
|
927
921
|
rowIds.forEach(id => {
|
|
928
922
|
const splitId = id.split('.');
|
|
929
923
|
maxDepth = Math.max(maxDepth, splitId.length);
|
|
930
924
|
});
|
|
931
925
|
return maxDepth;
|
|
932
926
|
},
|
|
933
|
-
getPreExpandedRowModel: () =>
|
|
927
|
+
getPreExpandedRowModel: () => table.getSortedRowModel(),
|
|
934
928
|
getExpandedRowModel: () => {
|
|
935
|
-
if (!
|
|
936
|
-
|
|
929
|
+
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
|
|
930
|
+
table._getExpandedRowModel = table.options.getExpandedRowModel(table);
|
|
937
931
|
}
|
|
938
932
|
|
|
939
|
-
if (
|
|
940
|
-
return
|
|
933
|
+
if (table.options.manualExpanding || !table._getExpandedRowModel) {
|
|
934
|
+
return table.getPreExpandedRowModel();
|
|
941
935
|
}
|
|
942
936
|
|
|
943
|
-
return
|
|
937
|
+
return table._getExpandedRowModel();
|
|
944
938
|
}
|
|
945
939
|
};
|
|
946
940
|
},
|
|
947
|
-
createRow: (row,
|
|
941
|
+
createRow: (row, table) => {
|
|
948
942
|
return {
|
|
949
943
|
toggleExpanded: expanded => {
|
|
950
|
-
|
|
944
|
+
table.setExpanded(old => {
|
|
951
945
|
var _expanded;
|
|
952
946
|
|
|
953
947
|
const exists = old === true ? true : !!(old != null && old[row.id]);
|
|
954
948
|
let oldExpanded = {};
|
|
955
949
|
|
|
956
950
|
if (old === true) {
|
|
957
|
-
Object.keys(
|
|
951
|
+
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
|
|
958
952
|
oldExpanded[rowId] = true;
|
|
959
953
|
});
|
|
960
954
|
} else {
|
|
@@ -981,15 +975,15 @@
|
|
|
981
975
|
});
|
|
982
976
|
},
|
|
983
977
|
getIsExpanded: () => {
|
|
984
|
-
var
|
|
978
|
+
var _table$options$getIsR;
|
|
985
979
|
|
|
986
|
-
const expanded =
|
|
987
|
-
return !!((
|
|
980
|
+
const expanded = table.getState().expanded;
|
|
981
|
+
return !!((_table$options$getIsR = table.options.getIsRowExpanded == null ? void 0 : table.options.getIsRowExpanded(row)) != null ? _table$options$getIsR : expanded === true || (expanded == null ? void 0 : expanded[row.id]));
|
|
988
982
|
},
|
|
989
983
|
getCanExpand: () => {
|
|
990
|
-
var
|
|
984
|
+
var _table$options$getRow, _table$options$enable, _row$subRows;
|
|
991
985
|
|
|
992
|
-
return ((
|
|
986
|
+
return ((_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : true) && ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
993
987
|
},
|
|
994
988
|
getToggleExpandedHandler: () => {
|
|
995
989
|
const canExpand = row.getCanExpand();
|
|
@@ -1125,24 +1119,24 @@
|
|
|
1125
1119
|
...state
|
|
1126
1120
|
};
|
|
1127
1121
|
},
|
|
1128
|
-
getDefaultOptions:
|
|
1122
|
+
getDefaultOptions: table => {
|
|
1129
1123
|
return {
|
|
1130
|
-
onColumnFiltersChange: makeStateUpdater('columnFilters',
|
|
1131
|
-
onGlobalFilterChange: makeStateUpdater('globalFilter',
|
|
1124
|
+
onColumnFiltersChange: makeStateUpdater('columnFilters', table),
|
|
1125
|
+
onGlobalFilterChange: makeStateUpdater('globalFilter', table),
|
|
1132
1126
|
filterFromLeafRows: false,
|
|
1133
1127
|
globalFilterFn: 'auto',
|
|
1134
1128
|
getColumnCanGlobalFilter: column => {
|
|
1135
|
-
var
|
|
1129
|
+
var _table$getCoreRowMode, _table$getCoreRowMode2;
|
|
1136
1130
|
|
|
1137
|
-
const value = (
|
|
1131
|
+
const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
|
|
1138
1132
|
return typeof value === 'string';
|
|
1139
1133
|
}
|
|
1140
1134
|
};
|
|
1141
1135
|
},
|
|
1142
|
-
createColumn: (column,
|
|
1136
|
+
createColumn: (column, table) => {
|
|
1143
1137
|
return {
|
|
1144
1138
|
getAutoFilterFn: () => {
|
|
1145
|
-
const firstRow =
|
|
1139
|
+
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
1146
1140
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1147
1141
|
|
|
1148
1142
|
if (typeof value === 'string') {
|
|
@@ -1168,34 +1162,31 @@
|
|
|
1168
1162
|
return filterFns.weakEquals;
|
|
1169
1163
|
},
|
|
1170
1164
|
getFilterFn: () => {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
const userFilterFns = instance.options.filterFns;
|
|
1174
|
-
return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.columnDef.filterFn]) != null ? _ref : filterFns[column.columnDef.filterFn];
|
|
1165
|
+
return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : filterFns[column.columnDef.filterFn];
|
|
1175
1166
|
},
|
|
1176
1167
|
getCanFilter: () => {
|
|
1177
|
-
var _column$columnDef$ena,
|
|
1168
|
+
var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
|
|
1178
1169
|
|
|
1179
|
-
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((
|
|
1170
|
+
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnFilters) != null ? _table$options$enable : true) && ((_table$options$enable2 = table.options.enableFilters) != null ? _table$options$enable2 : true) && !!column.accessorFn;
|
|
1180
1171
|
},
|
|
1181
1172
|
getCanGlobalFilter: () => {
|
|
1182
|
-
var _column$columnDef$ena2,
|
|
1173
|
+
var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
|
|
1183
1174
|
|
|
1184
|
-
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((
|
|
1175
|
+
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_table$options$enable3 = table.options.enableGlobalFilter) != null ? _table$options$enable3 : true) && ((_table$options$enable4 = table.options.enableFilters) != null ? _table$options$enable4 : true) && ((_table$options$getCol = table.options.getColumnCanGlobalFilter == null ? void 0 : table.options.getColumnCanGlobalFilter(column)) != null ? _table$options$getCol : true) && !!column.accessorFn;
|
|
1185
1176
|
},
|
|
1186
1177
|
getIsFiltered: () => column.getFilterIndex() > -1,
|
|
1187
1178
|
getFilterValue: () => {
|
|
1188
|
-
var
|
|
1179
|
+
var _table$getState$colum, _table$getState$colum2;
|
|
1189
1180
|
|
|
1190
|
-
return (
|
|
1181
|
+
return (_table$getState$colum = table.getState().columnFilters) == null ? void 0 : (_table$getState$colum2 = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum2.value;
|
|
1191
1182
|
},
|
|
1192
1183
|
getFilterIndex: () => {
|
|
1193
|
-
var
|
|
1184
|
+
var _table$getState$colum3, _table$getState$colum4;
|
|
1194
1185
|
|
|
1195
|
-
return (
|
|
1186
|
+
return (_table$getState$colum3 = (_table$getState$colum4 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum4.findIndex(d => d.id === column.id)) != null ? _table$getState$colum3 : -1;
|
|
1196
1187
|
},
|
|
1197
1188
|
setFilterValue: value => {
|
|
1198
|
-
|
|
1189
|
+
table.setColumnFilters(old => {
|
|
1199
1190
|
const filterFn = column.getFilterFn();
|
|
1200
1191
|
const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
1201
1192
|
const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined); //
|
|
@@ -1230,15 +1221,15 @@
|
|
|
1230
1221
|
return [newFilterObj];
|
|
1231
1222
|
});
|
|
1232
1223
|
},
|
|
1233
|
-
_getFacetedRowModel:
|
|
1224
|
+
_getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id),
|
|
1234
1225
|
getFacetedRowModel: () => {
|
|
1235
1226
|
if (!column._getFacetedRowModel) {
|
|
1236
|
-
return
|
|
1227
|
+
return table.getPreFilteredRowModel();
|
|
1237
1228
|
}
|
|
1238
1229
|
|
|
1239
1230
|
return column._getFacetedRowModel();
|
|
1240
1231
|
},
|
|
1241
|
-
_getFacetedUniqueValues:
|
|
1232
|
+
_getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
|
|
1242
1233
|
getFacetedUniqueValues: () => {
|
|
1243
1234
|
if (!column._getFacetedUniqueValues) {
|
|
1244
1235
|
return new Map();
|
|
@@ -1246,7 +1237,7 @@
|
|
|
1246
1237
|
|
|
1247
1238
|
return column._getFacetedUniqueValues();
|
|
1248
1239
|
},
|
|
1249
|
-
_getFacetedMinMaxValues:
|
|
1240
|
+
_getFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id),
|
|
1250
1241
|
getFacetedMinMaxValues: () => {
|
|
1251
1242
|
if (!column._getFacetedMinMaxValues) {
|
|
1252
1243
|
return undefined;
|
|
@@ -1258,28 +1249,25 @@
|
|
|
1258
1249
|
|
|
1259
1250
|
};
|
|
1260
1251
|
},
|
|
1261
|
-
createRow: (row,
|
|
1252
|
+
createRow: (row, table) => {
|
|
1262
1253
|
return {
|
|
1263
1254
|
columnFilters: {},
|
|
1264
1255
|
columnFiltersMeta: {}
|
|
1265
1256
|
};
|
|
1266
1257
|
},
|
|
1267
|
-
|
|
1258
|
+
createTable: table => {
|
|
1268
1259
|
return {
|
|
1269
1260
|
getGlobalAutoFilterFn: () => {
|
|
1270
1261
|
return filterFns.includesString;
|
|
1271
1262
|
},
|
|
1272
1263
|
getGlobalFilterFn: () => {
|
|
1273
|
-
var _ref2;
|
|
1274
|
-
|
|
1275
1264
|
const {
|
|
1276
|
-
filterFns: userFilterFns,
|
|
1277
1265
|
globalFilterFn: globalFilterFn
|
|
1278
|
-
} =
|
|
1279
|
-
return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ?
|
|
1266
|
+
} = table.options;
|
|
1267
|
+
return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : filterFns[globalFilterFn];
|
|
1280
1268
|
},
|
|
1281
1269
|
setColumnFilters: updater => {
|
|
1282
|
-
const leafColumns =
|
|
1270
|
+
const leafColumns = table.getAllLeafColumns();
|
|
1283
1271
|
|
|
1284
1272
|
const updateFn = old => {
|
|
1285
1273
|
var _functionalUpdate;
|
|
@@ -1299,51 +1287,51 @@
|
|
|
1299
1287
|
});
|
|
1300
1288
|
};
|
|
1301
1289
|
|
|
1302
|
-
|
|
1290
|
+
table.options.onColumnFiltersChange == null ? void 0 : table.options.onColumnFiltersChange(updateFn);
|
|
1303
1291
|
},
|
|
1304
1292
|
setGlobalFilter: updater => {
|
|
1305
|
-
|
|
1293
|
+
table.options.onGlobalFilterChange == null ? void 0 : table.options.onGlobalFilterChange(updater);
|
|
1306
1294
|
},
|
|
1307
1295
|
resetGlobalFilter: defaultState => {
|
|
1308
|
-
|
|
1296
|
+
table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
|
|
1309
1297
|
},
|
|
1310
1298
|
resetColumnFilters: defaultState => {
|
|
1311
|
-
var
|
|
1299
|
+
var _table$initialState$c, _table$initialState;
|
|
1312
1300
|
|
|
1313
|
-
|
|
1301
|
+
table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
|
|
1314
1302
|
},
|
|
1315
|
-
getPreFilteredRowModel: () =>
|
|
1316
|
-
_getFilteredRowModel:
|
|
1303
|
+
getPreFilteredRowModel: () => table.getCoreRowModel(),
|
|
1304
|
+
_getFilteredRowModel: table.options.getFilteredRowModel && table.options.getFilteredRowModel(table),
|
|
1317
1305
|
getFilteredRowModel: () => {
|
|
1318
|
-
if (
|
|
1319
|
-
return
|
|
1306
|
+
if (table.options.manualFiltering || !table._getFilteredRowModel) {
|
|
1307
|
+
return table.getPreFilteredRowModel();
|
|
1320
1308
|
}
|
|
1321
1309
|
|
|
1322
|
-
return
|
|
1310
|
+
return table._getFilteredRowModel();
|
|
1323
1311
|
},
|
|
1324
|
-
_getGlobalFacetedRowModel:
|
|
1312
|
+
_getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
|
|
1325
1313
|
getGlobalFacetedRowModel: () => {
|
|
1326
|
-
if (
|
|
1327
|
-
return
|
|
1314
|
+
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
|
|
1315
|
+
return table.getPreFilteredRowModel();
|
|
1328
1316
|
}
|
|
1329
1317
|
|
|
1330
|
-
return
|
|
1318
|
+
return table._getGlobalFacetedRowModel();
|
|
1331
1319
|
},
|
|
1332
|
-
_getGlobalFacetedUniqueValues:
|
|
1320
|
+
_getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
|
|
1333
1321
|
getGlobalFacetedUniqueValues: () => {
|
|
1334
|
-
if (!
|
|
1322
|
+
if (!table._getGlobalFacetedUniqueValues) {
|
|
1335
1323
|
return new Map();
|
|
1336
1324
|
}
|
|
1337
1325
|
|
|
1338
|
-
return
|
|
1326
|
+
return table._getGlobalFacetedUniqueValues();
|
|
1339
1327
|
},
|
|
1340
|
-
_getGlobalFacetedMinMaxValues:
|
|
1328
|
+
_getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
|
|
1341
1329
|
getGlobalFacetedMinMaxValues: () => {
|
|
1342
|
-
if (!
|
|
1330
|
+
if (!table._getGlobalFacetedMinMaxValues) {
|
|
1343
1331
|
return;
|
|
1344
1332
|
}
|
|
1345
1333
|
|
|
1346
|
-
return
|
|
1334
|
+
return table._getGlobalFacetedMinMaxValues();
|
|
1347
1335
|
}
|
|
1348
1336
|
};
|
|
1349
1337
|
}
|
|
@@ -1464,9 +1452,9 @@
|
|
|
1464
1452
|
getDefaultColumnDef: () => {
|
|
1465
1453
|
return {
|
|
1466
1454
|
aggregatedCell: props => {
|
|
1467
|
-
var
|
|
1455
|
+
var _toString, _props$getValue;
|
|
1468
1456
|
|
|
1469
|
-
return (
|
|
1457
|
+
return (_toString = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _toString : null;
|
|
1470
1458
|
},
|
|
1471
1459
|
aggregationFn: 'auto'
|
|
1472
1460
|
};
|
|
@@ -1477,16 +1465,16 @@
|
|
|
1477
1465
|
...state
|
|
1478
1466
|
};
|
|
1479
1467
|
},
|
|
1480
|
-
getDefaultOptions:
|
|
1468
|
+
getDefaultOptions: table => {
|
|
1481
1469
|
return {
|
|
1482
|
-
onGroupingChange: makeStateUpdater('grouping',
|
|
1470
|
+
onGroupingChange: makeStateUpdater('grouping', table),
|
|
1483
1471
|
groupedColumnMode: 'reorder'
|
|
1484
1472
|
};
|
|
1485
1473
|
},
|
|
1486
|
-
createColumn: (column,
|
|
1474
|
+
createColumn: (column, table) => {
|
|
1487
1475
|
return {
|
|
1488
1476
|
toggleGrouping: () => {
|
|
1489
|
-
|
|
1477
|
+
table.setGrouping(old => {
|
|
1490
1478
|
// Find any existing grouping for this column
|
|
1491
1479
|
if (old != null && old.includes(column.id)) {
|
|
1492
1480
|
return old.filter(d => d !== column.id);
|
|
@@ -1498,17 +1486,17 @@
|
|
|
1498
1486
|
getCanGroup: () => {
|
|
1499
1487
|
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1500
1488
|
|
|
1501
|
-
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 :
|
|
1489
|
+
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : table.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
|
|
1502
1490
|
},
|
|
1503
1491
|
getIsGrouped: () => {
|
|
1504
|
-
var
|
|
1492
|
+
var _table$getState$group;
|
|
1505
1493
|
|
|
1506
|
-
return (
|
|
1494
|
+
return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
|
|
1507
1495
|
},
|
|
1508
1496
|
getGroupedIndex: () => {
|
|
1509
|
-
var
|
|
1497
|
+
var _table$getState$group2;
|
|
1510
1498
|
|
|
1511
|
-
return (
|
|
1499
|
+
return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
|
|
1512
1500
|
},
|
|
1513
1501
|
getToggleGroupingHandler: () => {
|
|
1514
1502
|
const canGroup = column.getCanGroup();
|
|
@@ -1518,7 +1506,7 @@
|
|
|
1518
1506
|
};
|
|
1519
1507
|
},
|
|
1520
1508
|
getAutoAggregationFn: () => {
|
|
1521
|
-
const firstRow =
|
|
1509
|
+
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
1522
1510
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1523
1511
|
|
|
1524
1512
|
if (typeof value === 'number') {
|
|
@@ -1530,37 +1518,33 @@
|
|
|
1530
1518
|
}
|
|
1531
1519
|
},
|
|
1532
1520
|
getAggregationFn: () => {
|
|
1533
|
-
var _ref4;
|
|
1534
|
-
|
|
1535
|
-
const userAggregationFns = instance.options.aggregationFns;
|
|
1536
|
-
|
|
1537
1521
|
if (!column) {
|
|
1538
1522
|
throw new Error();
|
|
1539
1523
|
}
|
|
1540
1524
|
|
|
1541
|
-
return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() :
|
|
1525
|
+
return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : aggregationFns[column.columnDef.aggregationFn];
|
|
1542
1526
|
}
|
|
1543
1527
|
};
|
|
1544
1528
|
},
|
|
1545
|
-
|
|
1529
|
+
createTable: table => {
|
|
1546
1530
|
return {
|
|
1547
|
-
setGrouping: updater =>
|
|
1531
|
+
setGrouping: updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater),
|
|
1548
1532
|
resetGrouping: defaultState => {
|
|
1549
|
-
var
|
|
1533
|
+
var _table$initialState$g, _table$initialState;
|
|
1550
1534
|
|
|
1551
|
-
|
|
1535
|
+
table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
|
|
1552
1536
|
},
|
|
1553
|
-
getPreGroupedRowModel: () =>
|
|
1537
|
+
getPreGroupedRowModel: () => table.getFilteredRowModel(),
|
|
1554
1538
|
getGroupedRowModel: () => {
|
|
1555
|
-
if (!
|
|
1556
|
-
|
|
1539
|
+
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
|
|
1540
|
+
table._getGroupedRowModel = table.options.getGroupedRowModel(table);
|
|
1557
1541
|
}
|
|
1558
1542
|
|
|
1559
|
-
if (
|
|
1560
|
-
return
|
|
1543
|
+
if (table.options.manualGrouping || !table._getGroupedRowModel) {
|
|
1544
|
+
return table.getPreGroupedRowModel();
|
|
1561
1545
|
}
|
|
1562
1546
|
|
|
1563
|
-
return
|
|
1547
|
+
return table._getGroupedRowModel();
|
|
1564
1548
|
}
|
|
1565
1549
|
};
|
|
1566
1550
|
},
|
|
@@ -1570,12 +1554,7 @@
|
|
|
1570
1554
|
_groupingValuesCache: {}
|
|
1571
1555
|
};
|
|
1572
1556
|
},
|
|
1573
|
-
createCell: (cell, column, row,
|
|
1574
|
-
const getRenderValue = () => {
|
|
1575
|
-
var _cell$getValue;
|
|
1576
|
-
|
|
1577
|
-
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
1578
|
-
};
|
|
1557
|
+
createCell: (cell, column, row, table) => {
|
|
1579
1558
|
|
|
1580
1559
|
return {
|
|
1581
1560
|
getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
|
|
@@ -1584,22 +1563,6 @@
|
|
|
1584
1563
|
var _row$subRows;
|
|
1585
1564
|
|
|
1586
1565
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
1587
|
-
},
|
|
1588
|
-
renderAggregatedCell: () => {
|
|
1589
|
-
{
|
|
1590
|
-
if (!column.columnDef.aggregatedCell) {
|
|
1591
|
-
console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
const template = column.columnDef.aggregatedCell || column.columnDef.cell;
|
|
1596
|
-
return template ? instance._render(template, {
|
|
1597
|
-
instance,
|
|
1598
|
-
column,
|
|
1599
|
-
row,
|
|
1600
|
-
cell,
|
|
1601
|
-
getValue: getRenderValue
|
|
1602
|
-
}) : null;
|
|
1603
1566
|
}
|
|
1604
1567
|
};
|
|
1605
1568
|
}
|
|
@@ -1627,20 +1590,20 @@
|
|
|
1627
1590
|
...state
|
|
1628
1591
|
};
|
|
1629
1592
|
},
|
|
1630
|
-
getDefaultOptions:
|
|
1593
|
+
getDefaultOptions: table => {
|
|
1631
1594
|
return {
|
|
1632
|
-
onColumnOrderChange: makeStateUpdater('columnOrder',
|
|
1595
|
+
onColumnOrderChange: makeStateUpdater('columnOrder', table)
|
|
1633
1596
|
};
|
|
1634
1597
|
},
|
|
1635
|
-
|
|
1598
|
+
createTable: table => {
|
|
1636
1599
|
return {
|
|
1637
|
-
setColumnOrder: updater =>
|
|
1600
|
+
setColumnOrder: updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater),
|
|
1638
1601
|
resetColumnOrder: defaultState => {
|
|
1639
|
-
var
|
|
1602
|
+
var _table$initialState$c;
|
|
1640
1603
|
|
|
1641
|
-
|
|
1604
|
+
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
|
|
1642
1605
|
},
|
|
1643
|
-
_getOrderColumnsFn: memo(() => [
|
|
1606
|
+
_getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
|
|
1644
1607
|
// Sort grouped columns to the start of the column list
|
|
1645
1608
|
// before the headers are built
|
|
1646
1609
|
let orderedColumns = []; // If there is no order, return the normal columns
|
|
@@ -1668,7 +1631,7 @@
|
|
|
1668
1631
|
|
|
1669
1632
|
return orderColumns(orderedColumns, grouping, groupedColumnMode);
|
|
1670
1633
|
}, {
|
|
1671
|
-
key: 'getOrderColumnsFn' // debug: () =>
|
|
1634
|
+
key: 'getOrderColumnsFn' // debug: () => table.options.debugAll ?? table.options.debugTable,
|
|
1672
1635
|
|
|
1673
1636
|
})
|
|
1674
1637
|
};
|
|
@@ -1692,32 +1655,32 @@
|
|
|
1692
1655
|
}
|
|
1693
1656
|
};
|
|
1694
1657
|
},
|
|
1695
|
-
getDefaultOptions:
|
|
1658
|
+
getDefaultOptions: table => {
|
|
1696
1659
|
return {
|
|
1697
|
-
onPaginationChange: makeStateUpdater('pagination',
|
|
1660
|
+
onPaginationChange: makeStateUpdater('pagination', table)
|
|
1698
1661
|
};
|
|
1699
1662
|
},
|
|
1700
|
-
|
|
1663
|
+
createTable: table => {
|
|
1701
1664
|
let registered = false;
|
|
1702
1665
|
let queued = false;
|
|
1703
1666
|
return {
|
|
1704
1667
|
_autoResetPageIndex: () => {
|
|
1705
|
-
var _ref,
|
|
1668
|
+
var _ref, _table$options$autoRe;
|
|
1706
1669
|
|
|
1707
1670
|
if (!registered) {
|
|
1708
|
-
|
|
1671
|
+
table._queue(() => {
|
|
1709
1672
|
registered = true;
|
|
1710
1673
|
});
|
|
1711
1674
|
|
|
1712
1675
|
return;
|
|
1713
1676
|
}
|
|
1714
1677
|
|
|
1715
|
-
if ((_ref = (
|
|
1678
|
+
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
|
|
1716
1679
|
if (queued) return;
|
|
1717
1680
|
queued = true;
|
|
1718
1681
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1682
|
+
table._queue(() => {
|
|
1683
|
+
table.resetPageIndex();
|
|
1721
1684
|
queued = false;
|
|
1722
1685
|
});
|
|
1723
1686
|
}
|
|
@@ -1728,17 +1691,17 @@
|
|
|
1728
1691
|
return newState;
|
|
1729
1692
|
};
|
|
1730
1693
|
|
|
1731
|
-
return
|
|
1694
|
+
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
|
|
1732
1695
|
},
|
|
1733
1696
|
resetPagination: defaultState => {
|
|
1734
|
-
var
|
|
1697
|
+
var _table$initialState$p;
|
|
1735
1698
|
|
|
1736
|
-
|
|
1699
|
+
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
|
|
1737
1700
|
},
|
|
1738
1701
|
setPageIndex: updater => {
|
|
1739
|
-
|
|
1702
|
+
table.setPagination(old => {
|
|
1740
1703
|
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
1741
|
-
const maxPageIndex = typeof
|
|
1704
|
+
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
|
|
1742
1705
|
pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
|
|
1743
1706
|
return { ...old,
|
|
1744
1707
|
pageIndex
|
|
@@ -1746,17 +1709,17 @@
|
|
|
1746
1709
|
});
|
|
1747
1710
|
},
|
|
1748
1711
|
resetPageIndex: defaultState => {
|
|
1749
|
-
var
|
|
1712
|
+
var _table$initialState$p2, _table$initialState, _table$initialState$p3;
|
|
1750
1713
|
|
|
1751
|
-
|
|
1714
|
+
table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null ? void 0 : (_table$initialState$p3 = _table$initialState.pagination) == null ? void 0 : _table$initialState$p3.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
|
|
1752
1715
|
},
|
|
1753
1716
|
resetPageSize: defaultState => {
|
|
1754
|
-
var
|
|
1717
|
+
var _table$initialState$p4, _table$initialState2, _table$initialState2$;
|
|
1755
1718
|
|
|
1756
|
-
|
|
1719
|
+
table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p4 = (_table$initialState2 = table.initialState) == null ? void 0 : (_table$initialState2$ = _table$initialState2.pagination) == null ? void 0 : _table$initialState2$.pageSize) != null ? _table$initialState$p4 : defaultPageSize);
|
|
1757
1720
|
},
|
|
1758
1721
|
setPageSize: updater => {
|
|
1759
|
-
|
|
1722
|
+
table.setPagination(old => {
|
|
1760
1723
|
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
|
|
1761
1724
|
const topRowIndex = old.pageSize * old.pageIndex;
|
|
1762
1725
|
const pageIndex = Math.floor(topRowIndex / pageSize);
|
|
@@ -1766,10 +1729,10 @@
|
|
|
1766
1729
|
};
|
|
1767
1730
|
});
|
|
1768
1731
|
},
|
|
1769
|
-
setPageCount: updater =>
|
|
1770
|
-
var
|
|
1732
|
+
setPageCount: updater => table.setPagination(old => {
|
|
1733
|
+
var _table$options$pageCo;
|
|
1771
1734
|
|
|
1772
|
-
let newPageCount = functionalUpdate(updater, (
|
|
1735
|
+
let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
|
|
1773
1736
|
|
|
1774
1737
|
if (typeof newPageCount === 'number') {
|
|
1775
1738
|
newPageCount = Math.max(-1, newPageCount);
|
|
@@ -1779,7 +1742,7 @@
|
|
|
1779
1742
|
pageCount: newPageCount
|
|
1780
1743
|
};
|
|
1781
1744
|
}),
|
|
1782
|
-
getPageOptions: memo(() => [
|
|
1745
|
+
getPageOptions: memo(() => [table.getPageCount()], pageCount => {
|
|
1783
1746
|
let pageOptions = [];
|
|
1784
1747
|
|
|
1785
1748
|
if (pageCount && pageCount > 0) {
|
|
@@ -1790,17 +1753,17 @@
|
|
|
1790
1753
|
}, {
|
|
1791
1754
|
key: 'getPageOptions',
|
|
1792
1755
|
debug: () => {
|
|
1793
|
-
var
|
|
1756
|
+
var _table$options$debugA;
|
|
1794
1757
|
|
|
1795
|
-
return (
|
|
1758
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
1796
1759
|
}
|
|
1797
1760
|
}),
|
|
1798
|
-
getCanPreviousPage: () =>
|
|
1761
|
+
getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
|
|
1799
1762
|
getCanNextPage: () => {
|
|
1800
1763
|
const {
|
|
1801
1764
|
pageIndex
|
|
1802
|
-
} =
|
|
1803
|
-
const pageCount =
|
|
1765
|
+
} = table.getState().pagination;
|
|
1766
|
+
const pageCount = table.getPageCount();
|
|
1804
1767
|
|
|
1805
1768
|
if (pageCount === -1) {
|
|
1806
1769
|
return true;
|
|
@@ -1813,29 +1776,29 @@
|
|
|
1813
1776
|
return pageIndex < pageCount - 1;
|
|
1814
1777
|
},
|
|
1815
1778
|
previousPage: () => {
|
|
1816
|
-
return
|
|
1779
|
+
return table.setPageIndex(old => old - 1);
|
|
1817
1780
|
},
|
|
1818
1781
|
nextPage: () => {
|
|
1819
|
-
return
|
|
1782
|
+
return table.setPageIndex(old => {
|
|
1820
1783
|
return old + 1;
|
|
1821
1784
|
});
|
|
1822
1785
|
},
|
|
1823
|
-
getPrePaginationRowModel: () =>
|
|
1786
|
+
getPrePaginationRowModel: () => table.getExpandedRowModel(),
|
|
1824
1787
|
getPaginationRowModel: () => {
|
|
1825
|
-
if (!
|
|
1826
|
-
|
|
1788
|
+
if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
|
|
1789
|
+
table._getPaginationRowModel = table.options.getPaginationRowModel(table);
|
|
1827
1790
|
}
|
|
1828
1791
|
|
|
1829
|
-
if (
|
|
1830
|
-
return
|
|
1792
|
+
if (table.options.manualPagination || !table._getPaginationRowModel) {
|
|
1793
|
+
return table.getPrePaginationRowModel();
|
|
1831
1794
|
}
|
|
1832
1795
|
|
|
1833
|
-
return
|
|
1796
|
+
return table._getPaginationRowModel();
|
|
1834
1797
|
},
|
|
1835
1798
|
getPageCount: () => {
|
|
1836
|
-
var
|
|
1799
|
+
var _table$options$pageCo2;
|
|
1837
1800
|
|
|
1838
|
-
return (
|
|
1801
|
+
return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
|
|
1839
1802
|
}
|
|
1840
1803
|
};
|
|
1841
1804
|
}
|
|
@@ -1854,16 +1817,16 @@
|
|
|
1854
1817
|
...state
|
|
1855
1818
|
};
|
|
1856
1819
|
},
|
|
1857
|
-
getDefaultOptions:
|
|
1820
|
+
getDefaultOptions: table => {
|
|
1858
1821
|
return {
|
|
1859
|
-
onColumnPinningChange: makeStateUpdater('columnPinning',
|
|
1822
|
+
onColumnPinningChange: makeStateUpdater('columnPinning', table)
|
|
1860
1823
|
};
|
|
1861
1824
|
},
|
|
1862
|
-
createColumn: (column,
|
|
1825
|
+
createColumn: (column, table) => {
|
|
1863
1826
|
return {
|
|
1864
1827
|
pin: position => {
|
|
1865
1828
|
const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
|
|
1866
|
-
|
|
1829
|
+
table.setColumnPinning(old => {
|
|
1867
1830
|
var _old$left3, _old$right3;
|
|
1868
1831
|
|
|
1869
1832
|
if (position === 'right') {
|
|
@@ -1893,9 +1856,9 @@
|
|
|
1893
1856
|
getCanPin: () => {
|
|
1894
1857
|
const leafColumns = column.getLeafColumns();
|
|
1895
1858
|
return leafColumns.some(d => {
|
|
1896
|
-
var _d$columnDef$enablePi,
|
|
1859
|
+
var _d$columnDef$enablePi, _table$options$enable;
|
|
1897
1860
|
|
|
1898
|
-
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((
|
|
1861
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
|
|
1899
1862
|
});
|
|
1900
1863
|
},
|
|
1901
1864
|
getIsPinned: () => {
|
|
@@ -1903,33 +1866,33 @@
|
|
|
1903
1866
|
const {
|
|
1904
1867
|
left,
|
|
1905
1868
|
right
|
|
1906
|
-
} =
|
|
1869
|
+
} = table.getState().columnPinning;
|
|
1907
1870
|
const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
|
|
1908
1871
|
const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
|
|
1909
1872
|
return isLeft ? 'left' : isRight ? 'right' : false;
|
|
1910
1873
|
},
|
|
1911
1874
|
getPinnedIndex: () => {
|
|
1912
|
-
var
|
|
1875
|
+
var _table$getState$colum, _table$getState$colum2, _table$getState$colum3;
|
|
1913
1876
|
|
|
1914
1877
|
const position = column.getIsPinned();
|
|
1915
|
-
return position ? (
|
|
1878
|
+
return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null ? void 0 : (_table$getState$colum3 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum3.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
|
|
1916
1879
|
}
|
|
1917
1880
|
};
|
|
1918
1881
|
},
|
|
1919
|
-
createRow: (row,
|
|
1882
|
+
createRow: (row, table) => {
|
|
1920
1883
|
return {
|
|
1921
|
-
getCenterVisibleCells: memo(() => [row._getAllVisibleCells(),
|
|
1884
|
+
getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
1922
1885
|
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
1923
1886
|
return allCells.filter(d => !leftAndRight.includes(d.column.id));
|
|
1924
1887
|
}, {
|
|
1925
1888
|
key: "development" === 'production' ,
|
|
1926
1889
|
debug: () => {
|
|
1927
|
-
var
|
|
1890
|
+
var _table$options$debugA;
|
|
1928
1891
|
|
|
1929
|
-
return (
|
|
1892
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
|
|
1930
1893
|
}
|
|
1931
1894
|
}),
|
|
1932
|
-
getLeftVisibleCells: memo(() => [row._getAllVisibleCells(),
|
|
1895
|
+
getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
|
|
1933
1896
|
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
|
|
1934
1897
|
position: 'left'
|
|
1935
1898
|
}));
|
|
@@ -1937,12 +1900,12 @@
|
|
|
1937
1900
|
}, {
|
|
1938
1901
|
key: "development" === 'production' ,
|
|
1939
1902
|
debug: () => {
|
|
1940
|
-
var
|
|
1903
|
+
var _table$options$debugA2;
|
|
1941
1904
|
|
|
1942
|
-
return (
|
|
1905
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
|
|
1943
1906
|
}
|
|
1944
1907
|
}),
|
|
1945
|
-
getRightVisibleCells: memo(() => [row._getAllVisibleCells(),
|
|
1908
|
+
getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
1946
1909
|
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
|
|
1947
1910
|
position: 'left'
|
|
1948
1911
|
}));
|
|
@@ -1950,25 +1913,25 @@
|
|
|
1950
1913
|
}, {
|
|
1951
1914
|
key: "development" === 'production' ,
|
|
1952
1915
|
debug: () => {
|
|
1953
|
-
var
|
|
1916
|
+
var _table$options$debugA3;
|
|
1954
1917
|
|
|
1955
|
-
return (
|
|
1918
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
|
|
1956
1919
|
}
|
|
1957
1920
|
})
|
|
1958
1921
|
};
|
|
1959
1922
|
},
|
|
1960
|
-
|
|
1923
|
+
createTable: table => {
|
|
1961
1924
|
return {
|
|
1962
|
-
setColumnPinning: updater =>
|
|
1925
|
+
setColumnPinning: updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater),
|
|
1963
1926
|
resetColumnPinning: defaultState => {
|
|
1964
|
-
var
|
|
1927
|
+
var _table$initialState$c, _table$initialState;
|
|
1965
1928
|
|
|
1966
|
-
return
|
|
1929
|
+
return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
|
|
1967
1930
|
},
|
|
1968
1931
|
getIsSomeColumnsPinned: position => {
|
|
1969
1932
|
var _pinningState$positio;
|
|
1970
1933
|
|
|
1971
|
-
const pinningState =
|
|
1934
|
+
const pinningState = table.getState().columnPinning;
|
|
1972
1935
|
|
|
1973
1936
|
if (!position) {
|
|
1974
1937
|
var _pinningState$left, _pinningState$right;
|
|
@@ -1978,35 +1941,35 @@
|
|
|
1978
1941
|
|
|
1979
1942
|
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
1980
1943
|
},
|
|
1981
|
-
getLeftLeafColumns: memo(() => [
|
|
1944
|
+
getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
1982
1945
|
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
1983
1946
|
}, {
|
|
1984
1947
|
key: 'getLeftLeafColumns',
|
|
1985
1948
|
debug: () => {
|
|
1986
|
-
var
|
|
1949
|
+
var _table$options$debugA4;
|
|
1987
1950
|
|
|
1988
|
-
return (
|
|
1951
|
+
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
|
|
1989
1952
|
}
|
|
1990
1953
|
}),
|
|
1991
|
-
getRightLeafColumns: memo(() => [
|
|
1954
|
+
getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
1992
1955
|
return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
1993
1956
|
}, {
|
|
1994
1957
|
key: 'getRightLeafColumns',
|
|
1995
1958
|
debug: () => {
|
|
1996
|
-
var
|
|
1959
|
+
var _table$options$debugA5;
|
|
1997
1960
|
|
|
1998
|
-
return (
|
|
1961
|
+
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
|
|
1999
1962
|
}
|
|
2000
1963
|
}),
|
|
2001
|
-
getCenterLeafColumns: memo(() => [
|
|
1964
|
+
getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
2002
1965
|
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
2003
1966
|
return allColumns.filter(d => !leftAndRight.includes(d.id));
|
|
2004
1967
|
}, {
|
|
2005
1968
|
key: 'getCenterLeafColumns',
|
|
2006
1969
|
debug: () => {
|
|
2007
|
-
var
|
|
1970
|
+
var _table$options$debugA6;
|
|
2008
1971
|
|
|
2009
|
-
return (
|
|
1972
|
+
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
|
|
2010
1973
|
}
|
|
2011
1974
|
})
|
|
2012
1975
|
};
|
|
@@ -2021,9 +1984,9 @@
|
|
|
2021
1984
|
...state
|
|
2022
1985
|
};
|
|
2023
1986
|
},
|
|
2024
|
-
getDefaultOptions:
|
|
1987
|
+
getDefaultOptions: table => {
|
|
2025
1988
|
return {
|
|
2026
|
-
onRowSelectionChange: makeStateUpdater('rowSelection',
|
|
1989
|
+
onRowSelectionChange: makeStateUpdater('rowSelection', table),
|
|
2027
1990
|
enableRowSelection: true,
|
|
2028
1991
|
enableMultiRowSelection: true,
|
|
2029
1992
|
enableSubRowSelection: true // enableGroupingRowSelection: false,
|
|
@@ -2032,20 +1995,20 @@
|
|
|
2032
1995
|
|
|
2033
1996
|
};
|
|
2034
1997
|
},
|
|
2035
|
-
|
|
1998
|
+
createTable: table => {
|
|
2036
1999
|
return {
|
|
2037
|
-
setRowSelection: updater =>
|
|
2000
|
+
setRowSelection: updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater),
|
|
2038
2001
|
resetRowSelection: defaultState => {
|
|
2039
|
-
var
|
|
2002
|
+
var _table$initialState$r;
|
|
2040
2003
|
|
|
2041
|
-
return
|
|
2004
|
+
return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
|
|
2042
2005
|
},
|
|
2043
2006
|
toggleAllRowsSelected: value => {
|
|
2044
|
-
|
|
2045
|
-
value = typeof value !== 'undefined' ? value : !
|
|
2007
|
+
table.setRowSelection(old => {
|
|
2008
|
+
value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
|
|
2046
2009
|
const rowSelection = { ...old
|
|
2047
2010
|
};
|
|
2048
|
-
const preGroupedFlatRows =
|
|
2011
|
+
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows; // We don't use `mutateRowIsSelected` here for performance reasons.
|
|
2049
2012
|
// All of the rows are flat already, so it wouldn't be worth it
|
|
2050
2013
|
|
|
2051
2014
|
if (value) {
|
|
@@ -2061,12 +2024,12 @@
|
|
|
2061
2024
|
return rowSelection;
|
|
2062
2025
|
});
|
|
2063
2026
|
},
|
|
2064
|
-
toggleAllPageRowsSelected: value =>
|
|
2065
|
-
const resolvedValue = typeof value !== 'undefined' ? value : !
|
|
2027
|
+
toggleAllPageRowsSelected: value => table.setRowSelection(old => {
|
|
2028
|
+
const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
|
|
2066
2029
|
const rowSelection = { ...old
|
|
2067
2030
|
};
|
|
2068
|
-
|
|
2069
|
-
mutateRowIsSelected(rowSelection, row.id, resolvedValue,
|
|
2031
|
+
table.getRowModel().rows.forEach(row => {
|
|
2032
|
+
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
|
|
2070
2033
|
});
|
|
2071
2034
|
return rowSelection;
|
|
2072
2035
|
}),
|
|
@@ -2075,7 +2038,7 @@
|
|
|
2075
2038
|
// rows,
|
|
2076
2039
|
// rowsById,
|
|
2077
2040
|
// options: { selectGroupingRows, selectSubRows },
|
|
2078
|
-
// } =
|
|
2041
|
+
// } = table
|
|
2079
2042
|
// const findSelectedRow = (rows: Row[]) => {
|
|
2080
2043
|
// let found
|
|
2081
2044
|
// rows.find(d => {
|
|
@@ -2103,7 +2066,7 @@
|
|
|
2103
2066
|
// selectSubRows: selectSubRows!,
|
|
2104
2067
|
// })
|
|
2105
2068
|
// }
|
|
2106
|
-
//
|
|
2069
|
+
// table.rows.forEach(row => {
|
|
2107
2070
|
// const isFirstRow = row.id === firstRow.id
|
|
2108
2071
|
// const isLastRow = row.id === lastRow.id
|
|
2109
2072
|
// if (isFirstRow || isLastRow) {
|
|
@@ -2118,10 +2081,10 @@
|
|
|
2118
2081
|
// addRow(row)
|
|
2119
2082
|
// }
|
|
2120
2083
|
// })
|
|
2121
|
-
//
|
|
2084
|
+
// table.setRowSelection(selectedRowIds)
|
|
2122
2085
|
// },
|
|
2123
|
-
getPreSelectedRowModel: () =>
|
|
2124
|
-
getSelectedRowModel: memo(() => [
|
|
2086
|
+
getPreSelectedRowModel: () => table.getCoreRowModel(),
|
|
2087
|
+
getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
2125
2088
|
if (!Object.keys(rowSelection).length) {
|
|
2126
2089
|
return {
|
|
2127
2090
|
rows: [],
|
|
@@ -2130,16 +2093,16 @@
|
|
|
2130
2093
|
};
|
|
2131
2094
|
}
|
|
2132
2095
|
|
|
2133
|
-
return selectRowsFn(
|
|
2096
|
+
return selectRowsFn(table, rowModel);
|
|
2134
2097
|
}, {
|
|
2135
2098
|
key: 'getSelectedRowModel',
|
|
2136
2099
|
debug: () => {
|
|
2137
|
-
var
|
|
2100
|
+
var _table$options$debugA;
|
|
2138
2101
|
|
|
2139
|
-
return (
|
|
2102
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
2140
2103
|
}
|
|
2141
2104
|
}),
|
|
2142
|
-
getFilteredSelectedRowModel: memo(() => [
|
|
2105
|
+
getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
2143
2106
|
if (!Object.keys(rowSelection).length) {
|
|
2144
2107
|
return {
|
|
2145
2108
|
rows: [],
|
|
@@ -2148,16 +2111,16 @@
|
|
|
2148
2111
|
};
|
|
2149
2112
|
}
|
|
2150
2113
|
|
|
2151
|
-
return selectRowsFn(
|
|
2114
|
+
return selectRowsFn(table, rowModel);
|
|
2152
2115
|
}, {
|
|
2153
2116
|
key: "development" === 'production' ,
|
|
2154
2117
|
debug: () => {
|
|
2155
|
-
var
|
|
2118
|
+
var _table$options$debugA2;
|
|
2156
2119
|
|
|
2157
|
-
return (
|
|
2120
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
|
|
2158
2121
|
}
|
|
2159
2122
|
}),
|
|
2160
|
-
getGroupedSelectedRowModel: memo(() => [
|
|
2123
|
+
getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
2161
2124
|
if (!Object.keys(rowSelection).length) {
|
|
2162
2125
|
return {
|
|
2163
2126
|
rows: [],
|
|
@@ -2166,31 +2129,31 @@
|
|
|
2166
2129
|
};
|
|
2167
2130
|
}
|
|
2168
2131
|
|
|
2169
|
-
return selectRowsFn(
|
|
2132
|
+
return selectRowsFn(table, rowModel);
|
|
2170
2133
|
}, {
|
|
2171
2134
|
key: "development" === 'production' ,
|
|
2172
2135
|
debug: () => {
|
|
2173
|
-
var
|
|
2136
|
+
var _table$options$debugA3;
|
|
2174
2137
|
|
|
2175
|
-
return (
|
|
2138
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
|
|
2176
2139
|
}
|
|
2177
2140
|
}),
|
|
2178
2141
|
///
|
|
2179
2142
|
// getGroupingRowCanSelect: rowId => {
|
|
2180
|
-
// const row =
|
|
2143
|
+
// const row = table.getRow(rowId)
|
|
2181
2144
|
// if (!row) {
|
|
2182
2145
|
// throw new Error()
|
|
2183
2146
|
// }
|
|
2184
|
-
// if (typeof
|
|
2185
|
-
// return
|
|
2147
|
+
// if (typeof table.options.enableGroupingRowSelection === 'function') {
|
|
2148
|
+
// return table.options.enableGroupingRowSelection(row)
|
|
2186
2149
|
// }
|
|
2187
|
-
// return
|
|
2150
|
+
// return table.options.enableGroupingRowSelection ?? false
|
|
2188
2151
|
// },
|
|
2189
2152
|
getIsAllRowsSelected: () => {
|
|
2190
|
-
const preFilteredFlatRows =
|
|
2153
|
+
const preFilteredFlatRows = table.getPreFilteredRowModel().flatRows;
|
|
2191
2154
|
const {
|
|
2192
2155
|
rowSelection
|
|
2193
|
-
} =
|
|
2156
|
+
} = table.getState();
|
|
2194
2157
|
let isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
|
|
2195
2158
|
|
|
2196
2159
|
if (isAllRowsSelected) {
|
|
@@ -2202,10 +2165,10 @@
|
|
|
2202
2165
|
return isAllRowsSelected;
|
|
2203
2166
|
},
|
|
2204
2167
|
getIsAllPageRowsSelected: () => {
|
|
2205
|
-
const paginationFlatRows =
|
|
2168
|
+
const paginationFlatRows = table.getPaginationRowModel().flatRows;
|
|
2206
2169
|
const {
|
|
2207
2170
|
rowSelection
|
|
2208
|
-
} =
|
|
2171
|
+
} = table.getState();
|
|
2209
2172
|
let isAllPageRowsSelected = !!paginationFlatRows.length;
|
|
2210
2173
|
|
|
2211
2174
|
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
|
|
@@ -2215,31 +2178,31 @@
|
|
|
2215
2178
|
return isAllPageRowsSelected;
|
|
2216
2179
|
},
|
|
2217
2180
|
getIsSomeRowsSelected: () => {
|
|
2218
|
-
var
|
|
2181
|
+
var _table$getState$rowSe;
|
|
2219
2182
|
|
|
2220
|
-
return !
|
|
2183
|
+
return !table.getIsAllRowsSelected() && !!Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
|
|
2221
2184
|
},
|
|
2222
2185
|
getIsSomePageRowsSelected: () => {
|
|
2223
|
-
const paginationFlatRows =
|
|
2224
|
-
return
|
|
2186
|
+
const paginationFlatRows = table.getPaginationRowModel().flatRows;
|
|
2187
|
+
return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
|
|
2225
2188
|
},
|
|
2226
2189
|
getToggleAllRowsSelectedHandler: () => {
|
|
2227
2190
|
return e => {
|
|
2228
|
-
|
|
2191
|
+
table.toggleAllRowsSelected(e.target.checked);
|
|
2229
2192
|
};
|
|
2230
2193
|
},
|
|
2231
2194
|
getToggleAllPageRowsSelectedHandler: () => {
|
|
2232
2195
|
return e => {
|
|
2233
|
-
|
|
2196
|
+
table.toggleAllPageRowsSelected(e.target.checked);
|
|
2234
2197
|
};
|
|
2235
2198
|
}
|
|
2236
2199
|
};
|
|
2237
2200
|
},
|
|
2238
|
-
createRow: (row,
|
|
2201
|
+
createRow: (row, table) => {
|
|
2239
2202
|
return {
|
|
2240
2203
|
toggleSelected: value => {
|
|
2241
2204
|
const isSelected = row.getIsSelected();
|
|
2242
|
-
|
|
2205
|
+
table.setRowSelection(old => {
|
|
2243
2206
|
value = typeof value !== 'undefined' ? value : !isSelected;
|
|
2244
2207
|
|
|
2245
2208
|
if (isSelected === value) {
|
|
@@ -2248,48 +2211,54 @@
|
|
|
2248
2211
|
|
|
2249
2212
|
const selectedRowIds = { ...old
|
|
2250
2213
|
};
|
|
2251
|
-
mutateRowIsSelected(selectedRowIds, row.id, value,
|
|
2214
|
+
mutateRowIsSelected(selectedRowIds, row.id, value, table);
|
|
2252
2215
|
return selectedRowIds;
|
|
2253
2216
|
});
|
|
2254
2217
|
},
|
|
2255
2218
|
getIsSelected: () => {
|
|
2256
2219
|
const {
|
|
2257
2220
|
rowSelection
|
|
2258
|
-
} =
|
|
2259
|
-
return isRowSelected(row, rowSelection)
|
|
2221
|
+
} = table.getState();
|
|
2222
|
+
return isRowSelected(row, rowSelection);
|
|
2260
2223
|
},
|
|
2261
2224
|
getIsSomeSelected: () => {
|
|
2262
2225
|
const {
|
|
2263
2226
|
rowSelection
|
|
2264
|
-
} =
|
|
2265
|
-
return
|
|
2227
|
+
} = table.getState();
|
|
2228
|
+
return isSubRowSelected(row, rowSelection) === 'some';
|
|
2229
|
+
},
|
|
2230
|
+
getIsAllSubRowsSelected: () => {
|
|
2231
|
+
const {
|
|
2232
|
+
rowSelection
|
|
2233
|
+
} = table.getState();
|
|
2234
|
+
return isSubRowSelected(row, rowSelection) === 'all';
|
|
2266
2235
|
},
|
|
2267
2236
|
getCanSelect: () => {
|
|
2268
|
-
var
|
|
2237
|
+
var _table$options$enable;
|
|
2269
2238
|
|
|
2270
|
-
if (typeof
|
|
2271
|
-
return
|
|
2239
|
+
if (typeof table.options.enableRowSelection === 'function') {
|
|
2240
|
+
return table.options.enableRowSelection(row);
|
|
2272
2241
|
}
|
|
2273
2242
|
|
|
2274
|
-
return (
|
|
2243
|
+
return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
|
|
2275
2244
|
},
|
|
2276
2245
|
getCanSelectSubRows: () => {
|
|
2277
|
-
var
|
|
2246
|
+
var _table$options$enable2;
|
|
2278
2247
|
|
|
2279
|
-
if (typeof
|
|
2280
|
-
return
|
|
2248
|
+
if (typeof table.options.enableSubRowSelection === 'function') {
|
|
2249
|
+
return table.options.enableSubRowSelection(row);
|
|
2281
2250
|
}
|
|
2282
2251
|
|
|
2283
|
-
return (
|
|
2252
|
+
return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
|
|
2284
2253
|
},
|
|
2285
2254
|
getCanMultiSelect: () => {
|
|
2286
|
-
var
|
|
2255
|
+
var _table$options$enable3;
|
|
2287
2256
|
|
|
2288
|
-
if (typeof
|
|
2289
|
-
return
|
|
2257
|
+
if (typeof table.options.enableMultiRowSelection === 'function') {
|
|
2258
|
+
return table.options.enableMultiRowSelection(row);
|
|
2290
2259
|
}
|
|
2291
2260
|
|
|
2292
|
-
return (
|
|
2261
|
+
return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
|
|
2293
2262
|
},
|
|
2294
2263
|
getToggleSelectedHandler: () => {
|
|
2295
2264
|
const canSelect = row.getCanSelect();
|
|
@@ -2304,16 +2273,20 @@
|
|
|
2304
2273
|
}
|
|
2305
2274
|
};
|
|
2306
2275
|
|
|
2307
|
-
const mutateRowIsSelected = (selectedRowIds, id, value,
|
|
2276
|
+
const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
|
|
2308
2277
|
var _row$subRows;
|
|
2309
2278
|
|
|
2310
|
-
const row =
|
|
2279
|
+
const row = table.getRow(id);
|
|
2311
2280
|
row.getIsGrouped(); // if ( // TODO: enforce grouping row selection rules
|
|
2312
2281
|
// !isGrouped ||
|
|
2313
|
-
// (isGrouped &&
|
|
2282
|
+
// (isGrouped && table.options.enableGroupingRowSelection)
|
|
2314
2283
|
// ) {
|
|
2315
2284
|
|
|
2316
2285
|
if (value) {
|
|
2286
|
+
if (!row.getCanMultiSelect()) {
|
|
2287
|
+
Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2317
2290
|
selectedRowIds[id] = true;
|
|
2318
2291
|
} else {
|
|
2319
2292
|
delete selectedRowIds[id];
|
|
@@ -2321,12 +2294,12 @@
|
|
|
2321
2294
|
|
|
2322
2295
|
|
|
2323
2296
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getCanSelectSubRows()) {
|
|
2324
|
-
row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value,
|
|
2297
|
+
row.subRows.forEach(row => mutateRowIsSelected(selectedRowIds, row.id, value, table));
|
|
2325
2298
|
}
|
|
2326
2299
|
};
|
|
2327
2300
|
|
|
2328
|
-
function selectRowsFn(
|
|
2329
|
-
const rowSelection =
|
|
2301
|
+
function selectRowsFn(table, rowModel) {
|
|
2302
|
+
const rowSelection = table.getState().rowSelection;
|
|
2330
2303
|
const newSelectedFlatRows = [];
|
|
2331
2304
|
const newSelectedRowsById = {}; // Filters top level and nested rows
|
|
2332
2305
|
|
|
@@ -2335,7 +2308,7 @@
|
|
|
2335
2308
|
return rows.map(row => {
|
|
2336
2309
|
var _row$subRows2;
|
|
2337
2310
|
|
|
2338
|
-
const isSelected = isRowSelected(row, rowSelection)
|
|
2311
|
+
const isSelected = isRowSelected(row, rowSelection);
|
|
2339
2312
|
|
|
2340
2313
|
if (isSelected) {
|
|
2341
2314
|
newSelectedFlatRows.push(row);
|
|
@@ -2360,11 +2333,12 @@
|
|
|
2360
2333
|
rowsById: newSelectedRowsById
|
|
2361
2334
|
};
|
|
2362
2335
|
}
|
|
2363
|
-
function isRowSelected(row, selection
|
|
2364
|
-
|
|
2365
|
-
return true;
|
|
2366
|
-
}
|
|
2336
|
+
function isRowSelected(row, selection) {
|
|
2337
|
+
var _selection$row$id;
|
|
2367
2338
|
|
|
2339
|
+
return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
|
|
2340
|
+
}
|
|
2341
|
+
function isSubRowSelected(row, selection, table) {
|
|
2368
2342
|
if (row.subRows && row.subRows.length) {
|
|
2369
2343
|
let allChildrenSelected = true;
|
|
2370
2344
|
let someSelected = false;
|
|
@@ -2380,7 +2354,7 @@
|
|
|
2380
2354
|
allChildrenSelected = false;
|
|
2381
2355
|
}
|
|
2382
2356
|
});
|
|
2383
|
-
return allChildrenSelected ?
|
|
2357
|
+
return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
|
|
2384
2358
|
}
|
|
2385
2359
|
|
|
2386
2360
|
return false;
|
|
@@ -2506,18 +2480,18 @@
|
|
|
2506
2480
|
sortingFn: 'auto'
|
|
2507
2481
|
};
|
|
2508
2482
|
},
|
|
2509
|
-
getDefaultOptions:
|
|
2483
|
+
getDefaultOptions: table => {
|
|
2510
2484
|
return {
|
|
2511
|
-
onSortingChange: makeStateUpdater('sorting',
|
|
2485
|
+
onSortingChange: makeStateUpdater('sorting', table),
|
|
2512
2486
|
isMultiSortEvent: e => {
|
|
2513
2487
|
return e.shiftKey;
|
|
2514
2488
|
}
|
|
2515
2489
|
};
|
|
2516
2490
|
},
|
|
2517
|
-
createColumn: (column,
|
|
2491
|
+
createColumn: (column, table) => {
|
|
2518
2492
|
return {
|
|
2519
2493
|
getAutoSortingFn: () => {
|
|
2520
|
-
const firstRows =
|
|
2494
|
+
const firstRows = table.getFilteredRowModel().flatRows.slice(10);
|
|
2521
2495
|
let isString = false;
|
|
2522
2496
|
|
|
2523
2497
|
for (const row of firstRows) {
|
|
@@ -2543,7 +2517,7 @@
|
|
|
2543
2517
|
return sortingFns.basic;
|
|
2544
2518
|
},
|
|
2545
2519
|
getAutoSortDir: () => {
|
|
2546
|
-
const firstRow =
|
|
2520
|
+
const firstRow = table.getFilteredRowModel().flatRows[0];
|
|
2547
2521
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
2548
2522
|
|
|
2549
2523
|
if (typeof value === 'string') {
|
|
@@ -2553,29 +2527,25 @@
|
|
|
2553
2527
|
return 'desc';
|
|
2554
2528
|
},
|
|
2555
2529
|
getSortingFn: () => {
|
|
2556
|
-
var _ref;
|
|
2557
|
-
|
|
2558
|
-
const userSortingFn = instance.options.sortingFns;
|
|
2559
|
-
|
|
2560
2530
|
if (!column) {
|
|
2561
2531
|
throw new Error();
|
|
2562
2532
|
}
|
|
2563
2533
|
|
|
2564
|
-
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() :
|
|
2534
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : sortingFns[column.columnDef.sortingFn];
|
|
2565
2535
|
},
|
|
2566
2536
|
toggleSorting: (desc, multi) => {
|
|
2567
2537
|
// if (column.columns.length) {
|
|
2568
2538
|
// column.columns.forEach((c, i) => {
|
|
2569
2539
|
// if (c.id) {
|
|
2570
|
-
//
|
|
2540
|
+
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
|
|
2571
2541
|
// }
|
|
2572
2542
|
// })
|
|
2573
2543
|
// return
|
|
2574
2544
|
// }
|
|
2575
|
-
// this needs to be outside of
|
|
2545
|
+
// this needs to be outside of table.setSorting to be in sync with rerender
|
|
2576
2546
|
const nextSortingOrder = column.getNextSortingOrder();
|
|
2577
|
-
|
|
2578
|
-
var
|
|
2547
|
+
table.setSorting(old => {
|
|
2548
|
+
var _table$options$enable, _table$options$enable2;
|
|
2579
2549
|
|
|
2580
2550
|
// Find any existing sorting for this column
|
|
2581
2551
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2604,9 +2574,9 @@
|
|
|
2604
2574
|
|
|
2605
2575
|
|
|
2606
2576
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2607
|
-
(
|
|
2577
|
+
(_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && // If enableSortRemove, enable in general
|
|
2608
2578
|
!hasDescDefined && ( // Must not be setting desc
|
|
2609
|
-
multi ? (
|
|
2579
|
+
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) && // If multi, don't allow if enableMultiRemove
|
|
2610
2580
|
!nextSortingOrder // Finally, detect if it should indeed be removed
|
|
2611
2581
|
) {
|
|
2612
2582
|
sortAction = 'remove';
|
|
@@ -2618,14 +2588,14 @@
|
|
|
2618
2588
|
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2619
2589
|
}];
|
|
2620
2590
|
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2621
|
-
var
|
|
2591
|
+
var _table$options$maxMul;
|
|
2622
2592
|
|
|
2623
2593
|
newSorting = [...old, {
|
|
2624
2594
|
id: column.id,
|
|
2625
2595
|
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2626
2596
|
}]; // Take latest n columns
|
|
2627
2597
|
|
|
2628
|
-
newSorting.splice(0, newSorting.length - ((
|
|
2598
|
+
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
|
|
2629
2599
|
} else if (sortAction === 'toggle' && old != null && old.length) {
|
|
2630
2600
|
// This flips (or sets) the
|
|
2631
2601
|
newSorting = old.map(d => {
|
|
@@ -2645,9 +2615,9 @@
|
|
|
2645
2615
|
});
|
|
2646
2616
|
},
|
|
2647
2617
|
getNextSortingOrder: () => {
|
|
2648
|
-
var
|
|
2618
|
+
var _ref, _column$columnDef$sor;
|
|
2649
2619
|
|
|
2650
|
-
const sortDescFirst = (
|
|
2620
|
+
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
|
|
2651
2621
|
const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
|
|
2652
2622
|
const isSorted = column.getIsSorted();
|
|
2653
2623
|
|
|
@@ -2662,59 +2632,59 @@
|
|
|
2662
2632
|
}
|
|
2663
2633
|
},
|
|
2664
2634
|
getCanSort: () => {
|
|
2665
|
-
var _column$columnDef$ena,
|
|
2635
|
+
var _column$columnDef$ena, _table$options$enable3;
|
|
2666
2636
|
|
|
2667
|
-
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((
|
|
2637
|
+
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_table$options$enable3 = table.options.enableSorting) != null ? _table$options$enable3 : true) && !!column.accessorFn;
|
|
2668
2638
|
},
|
|
2669
2639
|
getCanMultiSort: () => {
|
|
2670
|
-
var
|
|
2640
|
+
var _ref2, _column$columnDef$ena2;
|
|
2671
2641
|
|
|
2672
|
-
return (
|
|
2642
|
+
return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
|
|
2673
2643
|
},
|
|
2674
2644
|
getIsSorted: () => {
|
|
2675
|
-
var
|
|
2645
|
+
var _table$getState$sorti;
|
|
2676
2646
|
|
|
2677
|
-
const columnSort = (
|
|
2647
|
+
const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
|
|
2678
2648
|
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
|
|
2679
2649
|
},
|
|
2680
2650
|
getSortIndex: () => {
|
|
2681
|
-
var
|
|
2651
|
+
var _table$getState$sorti2, _table$getState$sorti3;
|
|
2682
2652
|
|
|
2683
|
-
return (
|
|
2653
|
+
return (_table$getState$sorti2 = (_table$getState$sorti3 = table.getState().sorting) == null ? void 0 : _table$getState$sorti3.findIndex(d => d.id === column.id)) != null ? _table$getState$sorti2 : -1;
|
|
2684
2654
|
},
|
|
2685
2655
|
clearSorting: () => {
|
|
2686
2656
|
//clear sorting for just 1 column
|
|
2687
|
-
|
|
2657
|
+
table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
|
|
2688
2658
|
},
|
|
2689
2659
|
getToggleSortingHandler: () => {
|
|
2690
2660
|
const canSort = column.getCanSort();
|
|
2691
2661
|
return e => {
|
|
2692
2662
|
if (!canSort) return;
|
|
2693
2663
|
e.persist == null ? void 0 : e.persist();
|
|
2694
|
-
column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ?
|
|
2664
|
+
column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
|
|
2695
2665
|
};
|
|
2696
2666
|
}
|
|
2697
2667
|
};
|
|
2698
2668
|
},
|
|
2699
|
-
|
|
2669
|
+
createTable: table => {
|
|
2700
2670
|
return {
|
|
2701
|
-
setSorting: updater =>
|
|
2671
|
+
setSorting: updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater),
|
|
2702
2672
|
resetSorting: defaultState => {
|
|
2703
|
-
var
|
|
2673
|
+
var _table$initialState$s, _table$initialState;
|
|
2704
2674
|
|
|
2705
|
-
|
|
2675
|
+
table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
|
|
2706
2676
|
},
|
|
2707
|
-
getPreSortedRowModel: () =>
|
|
2677
|
+
getPreSortedRowModel: () => table.getGroupedRowModel(),
|
|
2708
2678
|
getSortedRowModel: () => {
|
|
2709
|
-
if (!
|
|
2710
|
-
|
|
2679
|
+
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
|
|
2680
|
+
table._getSortedRowModel = table.options.getSortedRowModel(table);
|
|
2711
2681
|
}
|
|
2712
2682
|
|
|
2713
|
-
if (
|
|
2714
|
-
return
|
|
2683
|
+
if (table.options.manualSorting || !table._getSortedRowModel) {
|
|
2684
|
+
return table.getPreSortedRowModel();
|
|
2715
2685
|
}
|
|
2716
2686
|
|
|
2717
|
-
return
|
|
2687
|
+
return table._getSortedRowModel();
|
|
2718
2688
|
}
|
|
2719
2689
|
};
|
|
2720
2690
|
}
|
|
@@ -2728,29 +2698,29 @@
|
|
|
2728
2698
|
...state
|
|
2729
2699
|
};
|
|
2730
2700
|
},
|
|
2731
|
-
getDefaultOptions:
|
|
2701
|
+
getDefaultOptions: table => {
|
|
2732
2702
|
return {
|
|
2733
|
-
onColumnVisibilityChange: makeStateUpdater('columnVisibility',
|
|
2703
|
+
onColumnVisibilityChange: makeStateUpdater('columnVisibility', table)
|
|
2734
2704
|
};
|
|
2735
2705
|
},
|
|
2736
|
-
createColumn: (column,
|
|
2706
|
+
createColumn: (column, table) => {
|
|
2737
2707
|
return {
|
|
2738
2708
|
toggleVisibility: value => {
|
|
2739
2709
|
if (column.getCanHide()) {
|
|
2740
|
-
|
|
2710
|
+
table.setColumnVisibility(old => ({ ...old,
|
|
2741
2711
|
[column.id]: value != null ? value : !column.getIsVisible()
|
|
2742
2712
|
}));
|
|
2743
2713
|
}
|
|
2744
2714
|
},
|
|
2745
2715
|
getIsVisible: () => {
|
|
2746
|
-
var
|
|
2716
|
+
var _table$getState$colum, _table$getState$colum2;
|
|
2747
2717
|
|
|
2748
|
-
return (
|
|
2718
|
+
return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
|
|
2749
2719
|
},
|
|
2750
2720
|
getCanHide: () => {
|
|
2751
|
-
var _column$columnDef$ena,
|
|
2721
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
2752
2722
|
|
|
2753
|
-
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((
|
|
2723
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
|
|
2754
2724
|
},
|
|
2755
2725
|
getToggleVisibilityHandler: () => {
|
|
2756
2726
|
return e => {
|
|
@@ -2759,69 +2729,69 @@
|
|
|
2759
2729
|
}
|
|
2760
2730
|
};
|
|
2761
2731
|
},
|
|
2762
|
-
createRow: (row,
|
|
2732
|
+
createRow: (row, table) => {
|
|
2763
2733
|
return {
|
|
2764
|
-
_getAllVisibleCells: memo(() => [row.getAllCells(),
|
|
2734
|
+
_getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
|
|
2765
2735
|
return cells.filter(cell => cell.column.getIsVisible());
|
|
2766
2736
|
}, {
|
|
2767
2737
|
key: "development" === 'production' ,
|
|
2768
2738
|
debug: () => {
|
|
2769
|
-
var
|
|
2739
|
+
var _table$options$debugA;
|
|
2770
2740
|
|
|
2771
|
-
return (
|
|
2741
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
|
|
2772
2742
|
}
|
|
2773
2743
|
}),
|
|
2774
2744
|
getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
|
|
2775
2745
|
key: 'row.getVisibleCells',
|
|
2776
2746
|
debug: () => {
|
|
2777
|
-
var
|
|
2747
|
+
var _table$options$debugA2;
|
|
2778
2748
|
|
|
2779
|
-
return (
|
|
2749
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
|
|
2780
2750
|
}
|
|
2781
2751
|
})
|
|
2782
2752
|
};
|
|
2783
2753
|
},
|
|
2784
|
-
|
|
2754
|
+
createTable: table => {
|
|
2785
2755
|
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
2786
2756
|
return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
|
|
2787
2757
|
return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
2788
2758
|
}, {
|
|
2789
2759
|
key,
|
|
2790
2760
|
debug: () => {
|
|
2791
|
-
var
|
|
2761
|
+
var _table$options$debugA3;
|
|
2792
2762
|
|
|
2793
|
-
return (
|
|
2763
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
|
|
2794
2764
|
}
|
|
2795
2765
|
});
|
|
2796
2766
|
};
|
|
2797
2767
|
|
|
2798
2768
|
return {
|
|
2799
|
-
getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () =>
|
|
2800
|
-
getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () =>
|
|
2801
|
-
getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () =>
|
|
2802
|
-
getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () =>
|
|
2803
|
-
getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () =>
|
|
2804
|
-
setColumnVisibility: updater =>
|
|
2769
|
+
getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns()),
|
|
2770
|
+
getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns()),
|
|
2771
|
+
getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns()),
|
|
2772
|
+
getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns()),
|
|
2773
|
+
getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns()),
|
|
2774
|
+
setColumnVisibility: updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater),
|
|
2805
2775
|
resetColumnVisibility: defaultState => {
|
|
2806
|
-
var
|
|
2776
|
+
var _table$initialState$c;
|
|
2807
2777
|
|
|
2808
|
-
|
|
2778
|
+
table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
|
|
2809
2779
|
},
|
|
2810
2780
|
toggleAllColumnsVisible: value => {
|
|
2811
2781
|
var _value;
|
|
2812
2782
|
|
|
2813
|
-
value = (_value = value) != null ? _value : !
|
|
2814
|
-
|
|
2783
|
+
value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
|
|
2784
|
+
table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
|
|
2815
2785
|
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
2816
2786
|
}), {}));
|
|
2817
2787
|
},
|
|
2818
|
-
getIsAllColumnsVisible: () => !
|
|
2819
|
-
getIsSomeColumnsVisible: () =>
|
|
2788
|
+
getIsAllColumnsVisible: () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
|
|
2789
|
+
getIsSomeColumnsVisible: () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
|
|
2820
2790
|
getToggleAllColumnsVisibilityHandler: () => {
|
|
2821
2791
|
return e => {
|
|
2822
2792
|
var _target;
|
|
2823
2793
|
|
|
2824
|
-
|
|
2794
|
+
table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
2825
2795
|
};
|
|
2826
2796
|
}
|
|
2827
2797
|
};
|
|
@@ -2830,24 +2800,24 @@
|
|
|
2830
2800
|
|
|
2831
2801
|
const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
|
|
2832
2802
|
|
|
2833
|
-
function
|
|
2803
|
+
function createTable(options) {
|
|
2834
2804
|
var _options$initialState;
|
|
2835
2805
|
|
|
2836
2806
|
if (options.debugAll || options.debugTable) {
|
|
2837
2807
|
console.info('Creating Table Instance...');
|
|
2838
2808
|
}
|
|
2839
2809
|
|
|
2840
|
-
let
|
|
2810
|
+
let table = {
|
|
2841
2811
|
_features: features
|
|
2842
2812
|
};
|
|
2843
2813
|
|
|
2844
|
-
const defaultOptions =
|
|
2845
|
-
return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(
|
|
2814
|
+
const defaultOptions = table._features.reduce((obj, feature) => {
|
|
2815
|
+
return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(table));
|
|
2846
2816
|
}, {});
|
|
2847
2817
|
|
|
2848
2818
|
const mergeOptions = options => {
|
|
2849
|
-
if (
|
|
2850
|
-
return
|
|
2819
|
+
if (table.options.mergeOptions) {
|
|
2820
|
+
return table.options.mergeOptions(defaultOptions, options);
|
|
2851
2821
|
}
|
|
2852
2822
|
|
|
2853
2823
|
return { ...defaultOptions,
|
|
@@ -2860,7 +2830,7 @@
|
|
|
2860
2830
|
...((_options$initialState = options.initialState) != null ? _options$initialState : {})
|
|
2861
2831
|
};
|
|
2862
2832
|
|
|
2863
|
-
|
|
2833
|
+
table._features.forEach(feature => {
|
|
2864
2834
|
var _feature$getInitialSt;
|
|
2865
2835
|
|
|
2866
2836
|
initialState = (_feature$getInitialSt = feature.getInitialState == null ? void 0 : feature.getInitialState(initialState)) != null ? _feature$getInitialSt : initialState;
|
|
@@ -2893,48 +2863,37 @@
|
|
|
2893
2863
|
}
|
|
2894
2864
|
},
|
|
2895
2865
|
reset: () => {
|
|
2896
|
-
|
|
2866
|
+
table.setState(table.initialState);
|
|
2897
2867
|
},
|
|
2898
2868
|
setOptions: updater => {
|
|
2899
|
-
const newOptions = functionalUpdate(updater,
|
|
2900
|
-
|
|
2901
|
-
},
|
|
2902
|
-
_render: (template, props) => {
|
|
2903
|
-
if (typeof instance.options.render === 'function') {
|
|
2904
|
-
return instance.options.render(template, props);
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
if (typeof template === 'function') {
|
|
2908
|
-
return template(props);
|
|
2909
|
-
}
|
|
2910
|
-
|
|
2911
|
-
return template;
|
|
2869
|
+
const newOptions = functionalUpdate(updater, table.options);
|
|
2870
|
+
table.options = mergeOptions(newOptions);
|
|
2912
2871
|
},
|
|
2913
2872
|
getState: () => {
|
|
2914
|
-
return
|
|
2873
|
+
return table.options.state;
|
|
2915
2874
|
},
|
|
2916
2875
|
setState: updater => {
|
|
2917
|
-
|
|
2876
|
+
table.options.onStateChange == null ? void 0 : table.options.onStateChange(updater);
|
|
2918
2877
|
},
|
|
2919
2878
|
_getRowId: (row, index, parent) => {
|
|
2920
|
-
var
|
|
2879
|
+
var _table$options$getRow;
|
|
2921
2880
|
|
|
2922
|
-
return (
|
|
2881
|
+
return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : "" + (parent ? [parent.id, index].join('.') : index);
|
|
2923
2882
|
},
|
|
2924
2883
|
getCoreRowModel: () => {
|
|
2925
|
-
if (!
|
|
2926
|
-
|
|
2884
|
+
if (!table._getCoreRowModel) {
|
|
2885
|
+
table._getCoreRowModel = table.options.getCoreRowModel(table);
|
|
2927
2886
|
}
|
|
2928
2887
|
|
|
2929
|
-
return
|
|
2888
|
+
return table._getCoreRowModel();
|
|
2930
2889
|
},
|
|
2931
2890
|
// The final calls start at the bottom of the model,
|
|
2932
2891
|
// expanded rows, which then work their way up
|
|
2933
2892
|
getRowModel: () => {
|
|
2934
|
-
return
|
|
2893
|
+
return table.getPaginationRowModel();
|
|
2935
2894
|
},
|
|
2936
2895
|
getRow: id => {
|
|
2937
|
-
const row =
|
|
2896
|
+
const row = table.getRowModel().rowsById[id];
|
|
2938
2897
|
|
|
2939
2898
|
if (!row) {
|
|
2940
2899
|
{
|
|
@@ -2944,7 +2903,7 @@
|
|
|
2944
2903
|
|
|
2945
2904
|
return row;
|
|
2946
2905
|
},
|
|
2947
|
-
_getDefaultColumnDef: memo(() => [
|
|
2906
|
+
_getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
|
|
2948
2907
|
var _defaultColumn;
|
|
2949
2908
|
|
|
2950
2909
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
@@ -2952,32 +2911,32 @@
|
|
|
2952
2911
|
header: props => props.header.column.id,
|
|
2953
2912
|
footer: props => props.header.column.id,
|
|
2954
2913
|
cell: props => {
|
|
2955
|
-
var
|
|
2914
|
+
var _toString, _props$renderValue;
|
|
2956
2915
|
|
|
2957
|
-
return (
|
|
2916
|
+
return (_toString = (_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _toString : null;
|
|
2958
2917
|
},
|
|
2959
|
-
...
|
|
2918
|
+
...table._features.reduce((obj, feature) => {
|
|
2960
2919
|
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
2961
2920
|
}, {}),
|
|
2962
2921
|
...defaultColumn
|
|
2963
2922
|
};
|
|
2964
2923
|
}, {
|
|
2965
2924
|
debug: () => {
|
|
2966
|
-
var
|
|
2925
|
+
var _table$options$debugA;
|
|
2967
2926
|
|
|
2968
|
-
return (
|
|
2927
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
|
|
2969
2928
|
},
|
|
2970
2929
|
key: 'getDefaultColumnDef'
|
|
2971
2930
|
}),
|
|
2972
|
-
_getColumnDefs: () =>
|
|
2973
|
-
getAllColumns: memo(() => [
|
|
2931
|
+
_getColumnDefs: () => table.options.columns,
|
|
2932
|
+
getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {
|
|
2974
2933
|
const recurseColumns = function (columnDefs, parent, depth) {
|
|
2975
2934
|
if (depth === void 0) {
|
|
2976
2935
|
depth = 0;
|
|
2977
2936
|
}
|
|
2978
2937
|
|
|
2979
2938
|
return columnDefs.map(columnDef => {
|
|
2980
|
-
const column = createColumn(
|
|
2939
|
+
const column = createColumn(table, columnDef, depth, parent);
|
|
2981
2940
|
column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
|
|
2982
2941
|
return column;
|
|
2983
2942
|
});
|
|
@@ -2987,24 +2946,24 @@
|
|
|
2987
2946
|
}, {
|
|
2988
2947
|
key: 'getAllColumns',
|
|
2989
2948
|
debug: () => {
|
|
2990
|
-
var
|
|
2949
|
+
var _table$options$debugA2;
|
|
2991
2950
|
|
|
2992
|
-
return (
|
|
2951
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
|
|
2993
2952
|
}
|
|
2994
2953
|
}),
|
|
2995
|
-
getAllFlatColumns: memo(() => [
|
|
2954
|
+
getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
|
|
2996
2955
|
return allColumns.flatMap(column => {
|
|
2997
2956
|
return column.getFlatColumns();
|
|
2998
2957
|
});
|
|
2999
2958
|
}, {
|
|
3000
2959
|
key: 'getAllFlatColumns',
|
|
3001
2960
|
debug: () => {
|
|
3002
|
-
var
|
|
2961
|
+
var _table$options$debugA3;
|
|
3003
2962
|
|
|
3004
|
-
return (
|
|
2963
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
|
|
3005
2964
|
}
|
|
3006
2965
|
}),
|
|
3007
|
-
_getAllFlatColumnsById: memo(() => [
|
|
2966
|
+
_getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
|
|
3008
2967
|
return flatColumns.reduce((acc, column) => {
|
|
3009
2968
|
acc[column.id] = column;
|
|
3010
2969
|
return acc;
|
|
@@ -3012,24 +2971,24 @@
|
|
|
3012
2971
|
}, {
|
|
3013
2972
|
key: 'getAllFlatColumnsById',
|
|
3014
2973
|
debug: () => {
|
|
3015
|
-
var
|
|
2974
|
+
var _table$options$debugA4;
|
|
3016
2975
|
|
|
3017
|
-
return (
|
|
2976
|
+
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
|
|
3018
2977
|
}
|
|
3019
2978
|
}),
|
|
3020
|
-
getAllLeafColumns: memo(() => [
|
|
2979
|
+
getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
|
|
3021
2980
|
let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
|
|
3022
2981
|
return orderColumns(leafColumns);
|
|
3023
2982
|
}, {
|
|
3024
2983
|
key: 'getAllLeafColumns',
|
|
3025
2984
|
debug: () => {
|
|
3026
|
-
var
|
|
2985
|
+
var _table$options$debugA5;
|
|
3027
2986
|
|
|
3028
|
-
return (
|
|
2987
|
+
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
|
|
3029
2988
|
}
|
|
3030
2989
|
}),
|
|
3031
2990
|
getColumn: columnId => {
|
|
3032
|
-
const column =
|
|
2991
|
+
const column = table._getAllFlatColumnsById()[columnId];
|
|
3033
2992
|
|
|
3034
2993
|
if (!column) {
|
|
3035
2994
|
{
|
|
@@ -3042,76 +3001,20 @@
|
|
|
3042
3001
|
return column;
|
|
3043
3002
|
}
|
|
3044
3003
|
};
|
|
3045
|
-
Object.assign(
|
|
3004
|
+
Object.assign(table, coreInstance);
|
|
3046
3005
|
|
|
3047
|
-
|
|
3048
|
-
return Object.assign(
|
|
3006
|
+
table._features.forEach(feature => {
|
|
3007
|
+
return Object.assign(table, feature.createTable == null ? void 0 : feature.createTable(table));
|
|
3049
3008
|
});
|
|
3050
3009
|
|
|
3051
|
-
return instance;
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
//
|
|
3055
|
-
function createTableFactory(opts) {
|
|
3056
|
-
return () => createTable$1(undefined, undefined, opts);
|
|
3057
|
-
} // A lot of returns in here are `as any` for a reason. Unless you
|
|
3058
|
-
// can find a better way to do this, then don't worry about them
|
|
3059
|
-
|
|
3060
|
-
function createTable$1(_, __, options) {
|
|
3061
|
-
const table = {
|
|
3062
|
-
generics: undefined,
|
|
3063
|
-
options: options != null ? options : {
|
|
3064
|
-
render: (() => {
|
|
3065
|
-
throw new Error('');
|
|
3066
|
-
})()
|
|
3067
|
-
},
|
|
3068
|
-
// setGenerics: () => table as any,
|
|
3069
|
-
setRowType: () => table,
|
|
3070
|
-
setTableMetaType: () => table,
|
|
3071
|
-
setColumnMetaType: () => table,
|
|
3072
|
-
setFilterMetaType: () => table,
|
|
3073
|
-
setOptions: newOptions => createTable$1(_, __, { ...options,
|
|
3074
|
-
...newOptions
|
|
3075
|
-
}),
|
|
3076
|
-
createDisplayColumn: column => ({ ...column,
|
|
3077
|
-
columnDefType: 'display'
|
|
3078
|
-
}),
|
|
3079
|
-
createGroup: column => ({ ...column,
|
|
3080
|
-
columnDefType: 'group'
|
|
3081
|
-
}),
|
|
3082
|
-
createDataColumn: (accessor, column) => {
|
|
3083
|
-
column = { ...column,
|
|
3084
|
-
columnDefType: 'data',
|
|
3085
|
-
id: column.id
|
|
3086
|
-
};
|
|
3087
|
-
|
|
3088
|
-
if (typeof accessor === 'string') {
|
|
3089
|
-
var _column$id;
|
|
3090
|
-
|
|
3091
|
-
return { ...column,
|
|
3092
|
-
id: (_column$id = column.id) != null ? _column$id : accessor,
|
|
3093
|
-
accessorKey: accessor
|
|
3094
|
-
};
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
|
-
if (typeof accessor === 'function') {
|
|
3098
|
-
return { ...column,
|
|
3099
|
-
accessorFn: accessor
|
|
3100
|
-
};
|
|
3101
|
-
}
|
|
3102
|
-
|
|
3103
|
-
throw new Error('Invalid accessor');
|
|
3104
|
-
},
|
|
3105
|
-
createOptions: options => options
|
|
3106
|
-
};
|
|
3107
3010
|
return table;
|
|
3108
3011
|
}
|
|
3109
3012
|
|
|
3110
|
-
function createCell(
|
|
3013
|
+
function createCell(table, row, column, columnId) {
|
|
3111
3014
|
const getRenderValue = () => {
|
|
3112
3015
|
var _cell$getValue;
|
|
3113
3016
|
|
|
3114
|
-
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue :
|
|
3017
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : table.options.renderFallbackValue;
|
|
3115
3018
|
};
|
|
3116
3019
|
|
|
3117
3020
|
const cell = {
|
|
@@ -3119,25 +3022,25 @@
|
|
|
3119
3022
|
row,
|
|
3120
3023
|
column,
|
|
3121
3024
|
getValue: () => row.getValue(columnId),
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
}
|
|
3025
|
+
renderValue: getRenderValue,
|
|
3026
|
+
getContext: () => ({
|
|
3027
|
+
table,
|
|
3028
|
+
column,
|
|
3029
|
+
row,
|
|
3030
|
+
cell: cell,
|
|
3031
|
+
getValue: cell.getValue,
|
|
3032
|
+
renderValue: cell.renderValue
|
|
3033
|
+
})
|
|
3131
3034
|
};
|
|
3132
3035
|
|
|
3133
|
-
|
|
3134
|
-
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row,
|
|
3036
|
+
table._features.forEach(feature => {
|
|
3037
|
+
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, table));
|
|
3135
3038
|
}, {});
|
|
3136
3039
|
|
|
3137
3040
|
return cell;
|
|
3138
3041
|
}
|
|
3139
3042
|
|
|
3140
|
-
const createRow = (
|
|
3043
|
+
const createRow = (table, id, original, rowIndex, depth, subRows) => {
|
|
3141
3044
|
let row = {
|
|
3142
3045
|
id,
|
|
3143
3046
|
index: rowIndex,
|
|
@@ -3149,7 +3052,7 @@
|
|
|
3149
3052
|
return row._valuesCache[columnId];
|
|
3150
3053
|
}
|
|
3151
3054
|
|
|
3152
|
-
const column =
|
|
3055
|
+
const column = table.getColumn(columnId);
|
|
3153
3056
|
|
|
3154
3057
|
if (!column.accessorFn) {
|
|
3155
3058
|
return undefined;
|
|
@@ -3158,18 +3061,23 @@
|
|
|
3158
3061
|
row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
3159
3062
|
return row._valuesCache[columnId];
|
|
3160
3063
|
},
|
|
3064
|
+
renderValue: columnId => {
|
|
3065
|
+
var _row$getValue;
|
|
3066
|
+
|
|
3067
|
+
return (_row$getValue = row.getValue(columnId)) != null ? _row$getValue : table.options.renderFallbackValue;
|
|
3068
|
+
},
|
|
3161
3069
|
subRows: subRows != null ? subRows : [],
|
|
3162
3070
|
getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
|
|
3163
|
-
getAllCells: memo(() => [
|
|
3071
|
+
getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
|
|
3164
3072
|
return leafColumns.map(column => {
|
|
3165
|
-
return createCell(
|
|
3073
|
+
return createCell(table, row, column, column.id);
|
|
3166
3074
|
});
|
|
3167
3075
|
}, {
|
|
3168
3076
|
key: 'row.getAllCells',
|
|
3169
3077
|
debug: () => {
|
|
3170
|
-
var
|
|
3078
|
+
var _table$options$debugA;
|
|
3171
3079
|
|
|
3172
|
-
return (
|
|
3080
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
|
|
3173
3081
|
}
|
|
3174
3082
|
}),
|
|
3175
3083
|
_getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
|
|
@@ -3180,23 +3088,23 @@
|
|
|
3180
3088
|
}, {
|
|
3181
3089
|
key: "development" === 'production' ,
|
|
3182
3090
|
debug: () => {
|
|
3183
|
-
var
|
|
3091
|
+
var _table$options$debugA2;
|
|
3184
3092
|
|
|
3185
|
-
return (
|
|
3093
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
|
|
3186
3094
|
}
|
|
3187
3095
|
})
|
|
3188
3096
|
};
|
|
3189
3097
|
|
|
3190
|
-
for (let i = 0; i <
|
|
3191
|
-
const feature =
|
|
3192
|
-
Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row,
|
|
3098
|
+
for (let i = 0; i < table._features.length; i++) {
|
|
3099
|
+
const feature = table._features[i];
|
|
3100
|
+
Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, table));
|
|
3193
3101
|
}
|
|
3194
3102
|
|
|
3195
3103
|
return row;
|
|
3196
3104
|
};
|
|
3197
3105
|
|
|
3198
3106
|
function getCoreRowModel() {
|
|
3199
|
-
return
|
|
3107
|
+
return table => memo(() => [table.options.data], data => {
|
|
3200
3108
|
const rowModel = {
|
|
3201
3109
|
rows: [],
|
|
3202
3110
|
flatRows: [],
|
|
@@ -3218,18 +3126,18 @@
|
|
|
3218
3126
|
// }
|
|
3219
3127
|
// }
|
|
3220
3128
|
// Make the row
|
|
3221
|
-
const row = createRow(
|
|
3129
|
+
const row = createRow(table, table._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
|
|
3222
3130
|
|
|
3223
3131
|
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3224
3132
|
|
|
3225
|
-
rowModel.rowsById[row.id] = row; // Push
|
|
3133
|
+
rowModel.rowsById[row.id] = row; // Push table row into parent
|
|
3226
3134
|
|
|
3227
3135
|
rows.push(row); // Get the original subrows
|
|
3228
3136
|
|
|
3229
|
-
if (
|
|
3137
|
+
if (table.options.getSubRows) {
|
|
3230
3138
|
var _row$originalSubRows;
|
|
3231
3139
|
|
|
3232
|
-
row.originalSubRows =
|
|
3140
|
+
row.originalSubRows = table.options.getSubRows(originalRows[i], i); // Then recursively access them
|
|
3233
3141
|
|
|
3234
3142
|
if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
|
|
3235
3143
|
row.subRows = accessRows(row.originalSubRows, depth + 1, row);
|
|
@@ -3245,24 +3153,24 @@
|
|
|
3245
3153
|
}, {
|
|
3246
3154
|
key: 'getRowModel',
|
|
3247
3155
|
debug: () => {
|
|
3248
|
-
var
|
|
3156
|
+
var _table$options$debugA;
|
|
3249
3157
|
|
|
3250
|
-
return (
|
|
3158
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3251
3159
|
},
|
|
3252
3160
|
onChange: () => {
|
|
3253
|
-
|
|
3161
|
+
table._autoResetPageIndex();
|
|
3254
3162
|
}
|
|
3255
3163
|
});
|
|
3256
3164
|
}
|
|
3257
3165
|
|
|
3258
|
-
function filterRows(rows, filterRowImpl,
|
|
3259
|
-
if (
|
|
3260
|
-
return filterRowModelFromLeafs(rows, filterRowImpl,
|
|
3166
|
+
function filterRows(rows, filterRowImpl, table) {
|
|
3167
|
+
if (table.options.filterFromLeafRows) {
|
|
3168
|
+
return filterRowModelFromLeafs(rows, filterRowImpl, table);
|
|
3261
3169
|
}
|
|
3262
3170
|
|
|
3263
|
-
return filterRowModelFromRoot(rows, filterRowImpl,
|
|
3171
|
+
return filterRowModelFromRoot(rows, filterRowImpl, table);
|
|
3264
3172
|
}
|
|
3265
|
-
function filterRowModelFromLeafs(rowsToFilter, filterRow,
|
|
3173
|
+
function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
|
|
3266
3174
|
const newFilteredFlatRows = [];
|
|
3267
3175
|
const newFilteredRowsById = {};
|
|
3268
3176
|
|
|
@@ -3276,7 +3184,7 @@
|
|
|
3276
3184
|
let row = rowsToFilter[i];
|
|
3277
3185
|
|
|
3278
3186
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3279
|
-
const newRow = createRow(
|
|
3187
|
+
const newRow = createRow(table, row.id, row.original, row.index, row.depth);
|
|
3280
3188
|
newRow.columnFilters = row.columnFilters;
|
|
3281
3189
|
newRow.subRows = recurseFilterRows(row.subRows);
|
|
3282
3190
|
|
|
@@ -3303,7 +3211,7 @@
|
|
|
3303
3211
|
rowsById: newFilteredRowsById
|
|
3304
3212
|
};
|
|
3305
3213
|
}
|
|
3306
|
-
function filterRowModelFromRoot(rowsToFilter, filterRow,
|
|
3214
|
+
function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
3307
3215
|
const newFilteredFlatRows = [];
|
|
3308
3216
|
const newFilteredRowsById = {}; // Filters top level and nested rows
|
|
3309
3217
|
|
|
@@ -3320,7 +3228,7 @@
|
|
|
3320
3228
|
var _row$subRows2;
|
|
3321
3229
|
|
|
3322
3230
|
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
3323
|
-
const newRow = createRow(
|
|
3231
|
+
const newRow = createRow(table, row.id, row.original, row.index, row.depth);
|
|
3324
3232
|
newRow.subRows = recurseFilterRows(row.subRows);
|
|
3325
3233
|
row = newRow;
|
|
3326
3234
|
}
|
|
@@ -3342,7 +3250,7 @@
|
|
|
3342
3250
|
}
|
|
3343
3251
|
|
|
3344
3252
|
function getFilteredRowModel() {
|
|
3345
|
-
return
|
|
3253
|
+
return table => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
|
|
3346
3254
|
if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
3347
3255
|
for (let i = 0; i < rowModel.flatRows.length; i++) {
|
|
3348
3256
|
rowModel.flatRows[i].columnFilters = {};
|
|
@@ -3357,7 +3265,7 @@
|
|
|
3357
3265
|
(columnFilters != null ? columnFilters : []).forEach(d => {
|
|
3358
3266
|
var _filterFn$resolveFilt;
|
|
3359
3267
|
|
|
3360
|
-
const column =
|
|
3268
|
+
const column = table.getColumn(d.id);
|
|
3361
3269
|
|
|
3362
3270
|
if (!column) {
|
|
3363
3271
|
{
|
|
@@ -3382,8 +3290,8 @@
|
|
|
3382
3290
|
});
|
|
3383
3291
|
});
|
|
3384
3292
|
const filterableIds = columnFilters.map(d => d.id);
|
|
3385
|
-
const globalFilterFn =
|
|
3386
|
-
const globallyFilterableColumns =
|
|
3293
|
+
const globalFilterFn = table.getGlobalFilterFn();
|
|
3294
|
+
const globallyFilterableColumns = table.getAllLeafColumns().filter(column => column.getCanGlobalFilter());
|
|
3387
3295
|
|
|
3388
3296
|
if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {
|
|
3389
3297
|
filterableIds.push('__global__');
|
|
@@ -3447,22 +3355,22 @@
|
|
|
3447
3355
|
}; // Filter final rows using all of the active filters
|
|
3448
3356
|
|
|
3449
3357
|
|
|
3450
|
-
return filterRows(rowModel.rows, filterRowsImpl,
|
|
3358
|
+
return filterRows(rowModel.rows, filterRowsImpl, table);
|
|
3451
3359
|
}, {
|
|
3452
3360
|
key: 'getFilteredRowModel',
|
|
3453
3361
|
debug: () => {
|
|
3454
|
-
var
|
|
3362
|
+
var _table$options$debugA;
|
|
3455
3363
|
|
|
3456
|
-
return (
|
|
3364
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3457
3365
|
},
|
|
3458
3366
|
onChange: () => {
|
|
3459
|
-
|
|
3367
|
+
table._autoResetPageIndex();
|
|
3460
3368
|
}
|
|
3461
3369
|
});
|
|
3462
3370
|
}
|
|
3463
3371
|
|
|
3464
3372
|
function getFacetedRowModel() {
|
|
3465
|
-
return (
|
|
3373
|
+
return (table, columnId) => memo(() => [table.getPreFilteredRowModel(), table.getState().columnFilters, table.getState().globalFilter, table.getFilteredRowModel()], (preRowModel, columnFilters, globalFilter) => {
|
|
3466
3374
|
if (!preRowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
|
|
3467
3375
|
return preRowModel;
|
|
3468
3376
|
}
|
|
@@ -3480,20 +3388,20 @@
|
|
|
3480
3388
|
return true;
|
|
3481
3389
|
};
|
|
3482
3390
|
|
|
3483
|
-
return filterRows(preRowModel.rows, filterRowsImpl,
|
|
3391
|
+
return filterRows(preRowModel.rows, filterRowsImpl, table);
|
|
3484
3392
|
}, {
|
|
3485
3393
|
key: 'getFacetedRowModel_' + columnId,
|
|
3486
3394
|
debug: () => {
|
|
3487
|
-
var
|
|
3395
|
+
var _table$options$debugA;
|
|
3488
3396
|
|
|
3489
|
-
return (
|
|
3397
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3490
3398
|
},
|
|
3491
3399
|
onChange: () => {}
|
|
3492
3400
|
});
|
|
3493
3401
|
}
|
|
3494
3402
|
|
|
3495
3403
|
function getFacetedUniqueValues() {
|
|
3496
|
-
return (
|
|
3404
|
+
return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
|
|
3497
3405
|
let facetedUniqueValues = new Map();
|
|
3498
3406
|
|
|
3499
3407
|
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
@@ -3514,16 +3422,16 @@
|
|
|
3514
3422
|
}, {
|
|
3515
3423
|
key: 'getFacetedUniqueValues_' + columnId,
|
|
3516
3424
|
debug: () => {
|
|
3517
|
-
var
|
|
3425
|
+
var _table$options$debugA;
|
|
3518
3426
|
|
|
3519
|
-
return (
|
|
3427
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3520
3428
|
},
|
|
3521
3429
|
onChange: () => {}
|
|
3522
3430
|
});
|
|
3523
3431
|
}
|
|
3524
3432
|
|
|
3525
3433
|
function getFacetedMinMaxValues() {
|
|
3526
|
-
return (
|
|
3434
|
+
return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
|
|
3527
3435
|
var _facetedRowModel$flat;
|
|
3528
3436
|
|
|
3529
3437
|
const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
|
|
@@ -3550,27 +3458,27 @@
|
|
|
3550
3458
|
}, {
|
|
3551
3459
|
key: 'getFacetedMinMaxValues_' + columnId,
|
|
3552
3460
|
debug: () => {
|
|
3553
|
-
var
|
|
3461
|
+
var _table$options$debugA;
|
|
3554
3462
|
|
|
3555
|
-
return (
|
|
3463
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3556
3464
|
},
|
|
3557
3465
|
onChange: () => {}
|
|
3558
3466
|
});
|
|
3559
3467
|
}
|
|
3560
3468
|
|
|
3561
3469
|
function getSortedRowModel() {
|
|
3562
|
-
return
|
|
3470
|
+
return table => memo(() => [table.getState().sorting, table.getPreSortedRowModel()], (sorting, rowModel) => {
|
|
3563
3471
|
if (!rowModel.rows.length || !(sorting != null && sorting.length)) {
|
|
3564
3472
|
return rowModel;
|
|
3565
3473
|
}
|
|
3566
3474
|
|
|
3567
|
-
const sortingState =
|
|
3475
|
+
const sortingState = table.getState().sorting;
|
|
3568
3476
|
const sortedFlatRows = []; // Filter out sortings that correspond to non existing columns
|
|
3569
3477
|
|
|
3570
|
-
const availableSorting = sortingState.filter(sort =>
|
|
3478
|
+
const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
|
|
3571
3479
|
const columnInfoById = {};
|
|
3572
3480
|
availableSorting.forEach(sortEntry => {
|
|
3573
|
-
const column =
|
|
3481
|
+
const column = table.getColumn(sortEntry.id);
|
|
3574
3482
|
columnInfoById[sortEntry.id] = {
|
|
3575
3483
|
sortUndefined: column.columnDef.sortUndefined,
|
|
3576
3484
|
invertSorting: column.columnDef.invertSorting,
|
|
@@ -3640,24 +3548,24 @@
|
|
|
3640
3548
|
}, {
|
|
3641
3549
|
key: 'getSortedRowModel',
|
|
3642
3550
|
debug: () => {
|
|
3643
|
-
var
|
|
3551
|
+
var _table$options$debugA;
|
|
3644
3552
|
|
|
3645
|
-
return (
|
|
3553
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3646
3554
|
},
|
|
3647
3555
|
onChange: () => {
|
|
3648
|
-
|
|
3556
|
+
table._autoResetPageIndex();
|
|
3649
3557
|
}
|
|
3650
3558
|
});
|
|
3651
3559
|
}
|
|
3652
3560
|
|
|
3653
3561
|
function getGroupedRowModel() {
|
|
3654
|
-
return
|
|
3562
|
+
return table => memo(() => [table.getState().grouping, table.getPreGroupedRowModel()], (grouping, rowModel) => {
|
|
3655
3563
|
if (!rowModel.rows.length || !grouping.length) {
|
|
3656
3564
|
return rowModel;
|
|
3657
3565
|
} // Filter the grouping list down to columns that exist
|
|
3658
3566
|
|
|
3659
3567
|
|
|
3660
|
-
const existingGrouping = grouping.filter(columnId =>
|
|
3568
|
+
const existingGrouping = grouping.filter(columnId => table.getColumn(columnId));
|
|
3661
3569
|
const groupedFlatRows = [];
|
|
3662
3570
|
const groupedRowsById = {}; // const onlyGroupedFlatRows: Row[] = [];
|
|
3663
3571
|
// const onlyGroupedRowsById: Record<RowId, Row> = {};
|
|
@@ -3687,7 +3595,7 @@
|
|
|
3687
3595
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
|
|
3688
3596
|
|
|
3689
3597
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|
|
3690
|
-
const row = createRow(
|
|
3598
|
+
const row = createRow(table, id, undefined, index, depth);
|
|
3691
3599
|
Object.assign(row, {
|
|
3692
3600
|
groupingColumnId: columnId,
|
|
3693
3601
|
groupingValue,
|
|
@@ -3714,7 +3622,7 @@
|
|
|
3714
3622
|
} // Aggregate the values
|
|
3715
3623
|
|
|
3716
3624
|
|
|
3717
|
-
const column =
|
|
3625
|
+
const column = table.getColumn(columnId);
|
|
3718
3626
|
const aggregateFn = column.getAggregationFn();
|
|
3719
3627
|
|
|
3720
3628
|
if (aggregateFn) {
|
|
@@ -3757,15 +3665,15 @@
|
|
|
3757
3665
|
}, {
|
|
3758
3666
|
key: 'getGroupedRowModel',
|
|
3759
3667
|
debug: () => {
|
|
3760
|
-
var
|
|
3668
|
+
var _table$options$debugA;
|
|
3761
3669
|
|
|
3762
|
-
return (
|
|
3670
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3763
3671
|
},
|
|
3764
3672
|
onChange: () => {
|
|
3765
|
-
|
|
3766
|
-
|
|
3673
|
+
table._queue(() => {
|
|
3674
|
+
table._autoResetExpanded();
|
|
3767
3675
|
|
|
3768
|
-
|
|
3676
|
+
table._autoResetPageIndex();
|
|
3769
3677
|
});
|
|
3770
3678
|
}
|
|
3771
3679
|
});
|
|
@@ -3788,7 +3696,7 @@
|
|
|
3788
3696
|
}
|
|
3789
3697
|
|
|
3790
3698
|
function getExpandedRowModel() {
|
|
3791
|
-
return
|
|
3699
|
+
return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
|
|
3792
3700
|
if (!rowModel.rows.length || // Do not expand if rows are not included in pagination
|
|
3793
3701
|
!paginateExpandedRows || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
|
|
3794
3702
|
return rowModel;
|
|
@@ -3798,13 +3706,13 @@
|
|
|
3798
3706
|
}, {
|
|
3799
3707
|
key: 'getExpandedRowModel',
|
|
3800
3708
|
debug: () => {
|
|
3801
|
-
var
|
|
3709
|
+
var _table$options$debugA;
|
|
3802
3710
|
|
|
3803
|
-
return (
|
|
3711
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3804
3712
|
}
|
|
3805
3713
|
});
|
|
3806
3714
|
}
|
|
3807
|
-
function expandRows(rowModel,
|
|
3715
|
+
function expandRows(rowModel, table) {
|
|
3808
3716
|
const expandedRows = [];
|
|
3809
3717
|
|
|
3810
3718
|
const handleRow = row => {
|
|
@@ -3826,7 +3734,7 @@
|
|
|
3826
3734
|
}
|
|
3827
3735
|
|
|
3828
3736
|
function getPaginationRowModel(opts) {
|
|
3829
|
-
return
|
|
3737
|
+
return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel()], (pagination, rowModel) => {
|
|
3830
3738
|
if (!rowModel.rows.length) {
|
|
3831
3739
|
return rowModel;
|
|
3832
3740
|
}
|
|
@@ -3845,7 +3753,7 @@
|
|
|
3845
3753
|
rows = rows.slice(pageStart, pageEnd);
|
|
3846
3754
|
let paginatedRowModel;
|
|
3847
3755
|
|
|
3848
|
-
if (!
|
|
3756
|
+
if (!table.options.paginateExpandedRows) {
|
|
3849
3757
|
paginatedRowModel = expandRows({
|
|
3850
3758
|
rows,
|
|
3851
3759
|
flatRows,
|
|
@@ -3874,15 +3782,17 @@
|
|
|
3874
3782
|
}, {
|
|
3875
3783
|
key: 'getPaginationRowModel',
|
|
3876
3784
|
debug: () => {
|
|
3877
|
-
var
|
|
3785
|
+
var _table$options$debugA;
|
|
3878
3786
|
|
|
3879
|
-
return (
|
|
3787
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
3880
3788
|
}
|
|
3881
3789
|
});
|
|
3882
3790
|
}
|
|
3883
3791
|
|
|
3884
3792
|
//
|
|
3885
|
-
|
|
3793
|
+
function flexRender(Comp, props) {
|
|
3794
|
+
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__namespace.createElement(Comp, props) : Comp;
|
|
3795
|
+
}
|
|
3886
3796
|
|
|
3887
3797
|
function isReactComponent(component) {
|
|
3888
3798
|
return isClassComponent(component) || typeof component === 'function' || isExoticComponent(component);
|
|
@@ -3899,31 +3809,25 @@
|
|
|
3899
3809
|
return typeof component === 'object' && typeof component.$$typeof === 'symbol' && ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description);
|
|
3900
3810
|
}
|
|
3901
3811
|
|
|
3902
|
-
|
|
3903
|
-
render
|
|
3904
|
-
}); // const useIsomorphicLayoutEffect =
|
|
3905
|
-
// typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect
|
|
3906
|
-
|
|
3907
|
-
function useTableInstance(table, options) {
|
|
3812
|
+
function useReactTable(options) {
|
|
3908
3813
|
// Compose in the generic options to the user options
|
|
3909
|
-
const resolvedOptions = {
|
|
3814
|
+
const resolvedOptions = {
|
|
3910
3815
|
state: {},
|
|
3911
3816
|
// Dummy state
|
|
3912
3817
|
onStateChange: () => {},
|
|
3913
3818
|
// noop
|
|
3914
|
-
render,
|
|
3915
3819
|
renderFallbackValue: null,
|
|
3916
3820
|
...options
|
|
3917
|
-
}; // Create a new table
|
|
3821
|
+
}; // Create a new table and store it in state
|
|
3918
3822
|
|
|
3919
|
-
const [
|
|
3920
|
-
current:
|
|
3921
|
-
})); // By default, manage table state here using the
|
|
3823
|
+
const [tableRef] = React__namespace.useState(() => ({
|
|
3824
|
+
current: createTable(resolvedOptions)
|
|
3825
|
+
})); // By default, manage table state here using the table's initial state
|
|
3922
3826
|
|
|
3923
|
-
const [state, setState] = React__namespace.useState(() =>
|
|
3827
|
+
const [state, setState] = React__namespace.useState(() => tableRef.current.initialState); // Compose the default state above with any user state. This will allow the user
|
|
3924
3828
|
// to only control a subset of the state if desired.
|
|
3925
3829
|
|
|
3926
|
-
|
|
3830
|
+
tableRef.current.setOptions(prev => ({ ...prev,
|
|
3927
3831
|
...options,
|
|
3928
3832
|
state: { ...state,
|
|
3929
3833
|
...options.state
|
|
@@ -3935,7 +3839,7 @@
|
|
|
3935
3839
|
options.onStateChange == null ? void 0 : options.onStateChange(updater);
|
|
3936
3840
|
}
|
|
3937
3841
|
}));
|
|
3938
|
-
return
|
|
3842
|
+
return tableRef.current;
|
|
3939
3843
|
}
|
|
3940
3844
|
|
|
3941
3845
|
exports.ColumnSizing = ColumnSizing;
|
|
@@ -3954,12 +3858,11 @@
|
|
|
3954
3858
|
exports.createColumn = createColumn;
|
|
3955
3859
|
exports.createRow = createRow;
|
|
3956
3860
|
exports.createTable = createTable;
|
|
3957
|
-
exports.createTableFactory = createTableFactory;
|
|
3958
|
-
exports.createTableInstance = createTableInstance;
|
|
3959
3861
|
exports.defaultColumnSizing = defaultColumnSizing;
|
|
3960
3862
|
exports.expandRows = expandRows;
|
|
3961
3863
|
exports.filterFns = filterFns;
|
|
3962
3864
|
exports.flattenBy = flattenBy;
|
|
3865
|
+
exports.flexRender = flexRender;
|
|
3963
3866
|
exports.functionalUpdate = functionalUpdate;
|
|
3964
3867
|
exports.getCoreRowModel = getCoreRowModel;
|
|
3965
3868
|
exports.getExpandedRowModel = getExpandedRowModel;
|
|
@@ -3972,17 +3875,17 @@
|
|
|
3972
3875
|
exports.getSortedRowModel = getSortedRowModel;
|
|
3973
3876
|
exports.isFunction = isFunction;
|
|
3974
3877
|
exports.isRowSelected = isRowSelected;
|
|
3878
|
+
exports.isSubRowSelected = isSubRowSelected;
|
|
3975
3879
|
exports.makeStateUpdater = makeStateUpdater;
|
|
3976
3880
|
exports.memo = memo;
|
|
3977
3881
|
exports.noop = noop;
|
|
3978
3882
|
exports.orderColumns = orderColumns;
|
|
3979
3883
|
exports.passiveEventSupported = passiveEventSupported;
|
|
3980
3884
|
exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
|
|
3981
|
-
exports.render = render;
|
|
3982
3885
|
exports.selectRowsFn = selectRowsFn;
|
|
3983
3886
|
exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
|
|
3984
3887
|
exports.sortingFns = sortingFns;
|
|
3985
|
-
exports.
|
|
3888
|
+
exports.useReactTable = useReactTable;
|
|
3986
3889
|
|
|
3987
3890
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3988
3891
|
|