@tanstack/react-table 8.9.7 → 8.9.9
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.
|
@@ -191,9 +191,9 @@
|
|
|
191
191
|
}
|
|
192
192
|
})
|
|
193
193
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
194
|
+
for (const feature of table._features) {
|
|
195
|
+
feature.createColumn == null || feature.createColumn(column, table);
|
|
196
|
+
}
|
|
197
197
|
|
|
198
198
|
// Yes, we have to convert table to uknown, because we know more than the compiler here.
|
|
199
199
|
return column;
|
|
@@ -233,196 +233,197 @@
|
|
|
233
233
|
})
|
|
234
234
|
};
|
|
235
235
|
table._features.forEach(feature => {
|
|
236
|
-
|
|
236
|
+
feature.createHeader == null || feature.createHeader(header, table);
|
|
237
237
|
});
|
|
238
238
|
return header;
|
|
239
239
|
}
|
|
240
240
|
const Headers = {
|
|
241
241
|
createTable: table => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}),
|
|
291
|
-
// Footer Groups
|
|
242
|
+
// Header Groups
|
|
243
|
+
|
|
244
|
+
table.getHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
245
|
+
var _left$map$filter, _right$map$filter;
|
|
246
|
+
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
247
|
+
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
248
|
+
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
249
|
+
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], table);
|
|
250
|
+
return headerGroups;
|
|
251
|
+
}, {
|
|
252
|
+
key: 'getHeaderGroups',
|
|
253
|
+
debug: () => {
|
|
254
|
+
var _table$options$debugA;
|
|
255
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
table.getCenterHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
259
|
+
leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
260
|
+
return buildHeaderGroups(allColumns, leafColumns, table, 'center');
|
|
261
|
+
}, {
|
|
262
|
+
key: 'getCenterHeaderGroups',
|
|
263
|
+
debug: () => {
|
|
264
|
+
var _table$options$debugA2;
|
|
265
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
table.getLeftHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
269
|
+
var _left$map$filter2;
|
|
270
|
+
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
271
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
|
|
272
|
+
}, {
|
|
273
|
+
key: 'getLeftHeaderGroups',
|
|
274
|
+
debug: () => {
|
|
275
|
+
var _table$options$debugA3;
|
|
276
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
table.getRightHeaderGroups = memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
280
|
+
var _right$map$filter2;
|
|
281
|
+
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
282
|
+
return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
|
|
283
|
+
}, {
|
|
284
|
+
key: 'getRightHeaderGroups',
|
|
285
|
+
debug: () => {
|
|
286
|
+
var _table$options$debugA4;
|
|
287
|
+
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugHeaders;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
292
290
|
|
|
293
|
-
|
|
294
|
-
return [...headerGroups].reverse();
|
|
295
|
-
}, {
|
|
296
|
-
key: 'getFooterGroups',
|
|
297
|
-
debug: () => {
|
|
298
|
-
var _table$options$debugA5;
|
|
299
|
-
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
|
|
300
|
-
}
|
|
301
|
-
}),
|
|
302
|
-
getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
|
|
303
|
-
return [...headerGroups].reverse();
|
|
304
|
-
}, {
|
|
305
|
-
key: 'getLeftFooterGroups',
|
|
306
|
-
debug: () => {
|
|
307
|
-
var _table$options$debugA6;
|
|
308
|
-
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
|
|
309
|
-
}
|
|
310
|
-
}),
|
|
311
|
-
getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
|
|
312
|
-
return [...headerGroups].reverse();
|
|
313
|
-
}, {
|
|
314
|
-
key: 'getCenterFooterGroups',
|
|
315
|
-
debug: () => {
|
|
316
|
-
var _table$options$debugA7;
|
|
317
|
-
return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
|
|
318
|
-
}
|
|
319
|
-
}),
|
|
320
|
-
getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
|
|
321
|
-
return [...headerGroups].reverse();
|
|
322
|
-
}, {
|
|
323
|
-
key: 'getRightFooterGroups',
|
|
324
|
-
debug: () => {
|
|
325
|
-
var _table$options$debugA8;
|
|
326
|
-
return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
|
|
327
|
-
}
|
|
328
|
-
}),
|
|
329
|
-
// Flat Headers
|
|
291
|
+
// Footer Groups
|
|
330
292
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}).flat();
|
|
368
|
-
}, {
|
|
369
|
-
key: 'getRightFlatHeaders',
|
|
370
|
-
debug: () => {
|
|
371
|
-
var _table$options$debugA12;
|
|
372
|
-
return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
|
|
373
|
-
}
|
|
374
|
-
}),
|
|
375
|
-
// Leaf Headers
|
|
293
|
+
table.getFooterGroups = memo(() => [table.getHeaderGroups()], headerGroups => {
|
|
294
|
+
return [...headerGroups].reverse();
|
|
295
|
+
}, {
|
|
296
|
+
key: 'getFooterGroups',
|
|
297
|
+
debug: () => {
|
|
298
|
+
var _table$options$debugA5;
|
|
299
|
+
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
table.getLeftFooterGroups = memo(() => [table.getLeftHeaderGroups()], headerGroups => {
|
|
303
|
+
return [...headerGroups].reverse();
|
|
304
|
+
}, {
|
|
305
|
+
key: 'getLeftFooterGroups',
|
|
306
|
+
debug: () => {
|
|
307
|
+
var _table$options$debugA6;
|
|
308
|
+
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
table.getCenterFooterGroups = memo(() => [table.getCenterHeaderGroups()], headerGroups => {
|
|
312
|
+
return [...headerGroups].reverse();
|
|
313
|
+
}, {
|
|
314
|
+
key: 'getCenterFooterGroups',
|
|
315
|
+
debug: () => {
|
|
316
|
+
var _table$options$debugA7;
|
|
317
|
+
return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
table.getRightFooterGroups = memo(() => [table.getRightHeaderGroups()], headerGroups => {
|
|
321
|
+
return [...headerGroups].reverse();
|
|
322
|
+
}, {
|
|
323
|
+
key: 'getRightFooterGroups',
|
|
324
|
+
debug: () => {
|
|
325
|
+
var _table$options$debugA8;
|
|
326
|
+
return (_table$options$debugA8 = table.options.debugAll) != null ? _table$options$debugA8 : table.options.debugHeaders;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
376
329
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
330
|
+
// Flat Headers
|
|
331
|
+
|
|
332
|
+
table.getFlatHeaders = memo(() => [table.getHeaderGroups()], headerGroups => {
|
|
333
|
+
return headerGroups.map(headerGroup => {
|
|
334
|
+
return headerGroup.headers;
|
|
335
|
+
}).flat();
|
|
336
|
+
}, {
|
|
337
|
+
key: 'getFlatHeaders',
|
|
338
|
+
debug: () => {
|
|
339
|
+
var _table$options$debugA9;
|
|
340
|
+
return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
table.getLeftFlatHeaders = memo(() => [table.getLeftHeaderGroups()], left => {
|
|
344
|
+
return left.map(headerGroup => {
|
|
345
|
+
return headerGroup.headers;
|
|
346
|
+
}).flat();
|
|
347
|
+
}, {
|
|
348
|
+
key: 'getLeftFlatHeaders',
|
|
349
|
+
debug: () => {
|
|
350
|
+
var _table$options$debugA10;
|
|
351
|
+
return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
table.getCenterFlatHeaders = memo(() => [table.getCenterHeaderGroups()], left => {
|
|
355
|
+
return left.map(headerGroup => {
|
|
356
|
+
return headerGroup.headers;
|
|
357
|
+
}).flat();
|
|
358
|
+
}, {
|
|
359
|
+
key: 'getCenterFlatHeaders',
|
|
360
|
+
debug: () => {
|
|
361
|
+
var _table$options$debugA11;
|
|
362
|
+
return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
table.getRightFlatHeaders = memo(() => [table.getRightHeaderGroups()], left => {
|
|
366
|
+
return left.map(headerGroup => {
|
|
367
|
+
return headerGroup.headers;
|
|
368
|
+
}).flat();
|
|
369
|
+
}, {
|
|
370
|
+
key: 'getRightFlatHeaders',
|
|
371
|
+
debug: () => {
|
|
372
|
+
var _table$options$debugA12;
|
|
373
|
+
return (_table$options$debugA12 = table.options.debugAll) != null ? _table$options$debugA12 : table.options.debugHeaders;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Leaf Headers
|
|
378
|
+
|
|
379
|
+
table.getCenterLeafHeaders = memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
|
|
380
|
+
return flatHeaders.filter(header => {
|
|
381
|
+
var _header$subHeaders;
|
|
382
|
+
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
383
|
+
});
|
|
384
|
+
}, {
|
|
385
|
+
key: 'getCenterLeafHeaders',
|
|
386
|
+
debug: () => {
|
|
387
|
+
var _table$options$debugA13;
|
|
388
|
+
return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
table.getLeftLeafHeaders = memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
|
|
392
|
+
return flatHeaders.filter(header => {
|
|
393
|
+
var _header$subHeaders2;
|
|
394
|
+
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
395
|
+
});
|
|
396
|
+
}, {
|
|
397
|
+
key: 'getLeftLeafHeaders',
|
|
398
|
+
debug: () => {
|
|
399
|
+
var _table$options$debugA14;
|
|
400
|
+
return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
table.getRightLeafHeaders = memo(() => [table.getRightFlatHeaders()], flatHeaders => {
|
|
404
|
+
return flatHeaders.filter(header => {
|
|
405
|
+
var _header$subHeaders3;
|
|
406
|
+
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
407
|
+
});
|
|
408
|
+
}, {
|
|
409
|
+
key: 'getRightLeafHeaders',
|
|
410
|
+
debug: () => {
|
|
411
|
+
var _table$options$debugA15;
|
|
412
|
+
return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
table.getLeafHeaders = memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
|
|
416
|
+
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
417
|
+
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 => {
|
|
418
|
+
return header.getLeafHeaders();
|
|
419
|
+
}).flat();
|
|
420
|
+
}, {
|
|
421
|
+
key: 'getLeafHeaders',
|
|
422
|
+
debug: () => {
|
|
423
|
+
var _table$options$debugA16;
|
|
424
|
+
return (_table$options$debugA16 = table.options.debugAll) != null ? _table$options$debugA16 : table.options.debugHeaders;
|
|
425
|
+
}
|
|
426
|
+
});
|
|
426
427
|
}
|
|
427
428
|
};
|
|
428
429
|
function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
@@ -582,204 +583,198 @@
|
|
|
582
583
|
};
|
|
583
584
|
},
|
|
584
585
|
createColumn: (column, table) => {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return table.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
615
|
-
}
|
|
586
|
+
column.getSize = () => {
|
|
587
|
+
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
588
|
+
const columnSize = table.getState().columnSizing[column.id];
|
|
589
|
+
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);
|
|
590
|
+
};
|
|
591
|
+
column.getStart = position => {
|
|
592
|
+
const columns = !position ? table.getVisibleLeafColumns() : position === 'left' ? table.getLeftVisibleLeafColumns() : table.getRightVisibleLeafColumns();
|
|
593
|
+
const index = columns.findIndex(d => d.id === column.id);
|
|
594
|
+
if (index > 0) {
|
|
595
|
+
const prevSiblingColumn = columns[index - 1];
|
|
596
|
+
return prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize();
|
|
597
|
+
}
|
|
598
|
+
return 0;
|
|
599
|
+
};
|
|
600
|
+
column.resetSize = () => {
|
|
601
|
+
table.setColumnSizing(_ref2 => {
|
|
602
|
+
let {
|
|
603
|
+
[column.id]: _,
|
|
604
|
+
...rest
|
|
605
|
+
} = _ref2;
|
|
606
|
+
return rest;
|
|
607
|
+
});
|
|
608
|
+
};
|
|
609
|
+
column.getCanResize = () => {
|
|
610
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
611
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableColumnResizing) != null ? _table$options$enable : true);
|
|
612
|
+
};
|
|
613
|
+
column.getIsResizing = () => {
|
|
614
|
+
return table.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
616
615
|
};
|
|
617
616
|
},
|
|
618
617
|
createHeader: (header, table) => {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
recurse(header);
|
|
631
|
-
return sum;
|
|
632
|
-
},
|
|
633
|
-
getStart: () => {
|
|
634
|
-
if (header.index > 0) {
|
|
635
|
-
const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
|
|
636
|
-
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
|
|
618
|
+
header.getSize = () => {
|
|
619
|
+
let sum = 0;
|
|
620
|
+
const recurse = header => {
|
|
621
|
+
if (header.subHeaders.length) {
|
|
622
|
+
header.subHeaders.forEach(recurse);
|
|
623
|
+
} else {
|
|
624
|
+
var _header$column$getSiz;
|
|
625
|
+
sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
|
|
637
626
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
627
|
+
};
|
|
628
|
+
recurse(header);
|
|
629
|
+
return sum;
|
|
630
|
+
};
|
|
631
|
+
header.getStart = () => {
|
|
632
|
+
if (header.index > 0) {
|
|
633
|
+
const prevSiblingHeader = header.headerGroup.headers[header.index - 1];
|
|
634
|
+
return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
|
|
635
|
+
}
|
|
636
|
+
return 0;
|
|
637
|
+
};
|
|
638
|
+
header.getResizeHandler = () => {
|
|
639
|
+
const column = table.getColumn(header.column.id);
|
|
640
|
+
const canResize = column == null ? void 0 : column.getCanResize();
|
|
641
|
+
return e => {
|
|
642
|
+
if (!column || !canResize) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
e.persist == null || e.persist();
|
|
646
|
+
if (isTouchStartEvent(e)) {
|
|
647
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
648
|
+
if (e.touches && e.touches.length > 1) {
|
|
645
649
|
return;
|
|
646
650
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
651
|
+
}
|
|
652
|
+
const startSize = header.getSize();
|
|
653
|
+
const columnSizingStart = header ? header.getLeafHeaders().map(d => [d.column.id, d.column.getSize()]) : [[column.id, column.getSize()]];
|
|
654
|
+
const clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
|
|
655
|
+
const newColumnSizing = {};
|
|
656
|
+
const updateOffset = (eventType, clientXPos) => {
|
|
657
|
+
if (typeof clientXPos !== 'number') {
|
|
658
|
+
return;
|
|
653
659
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
table.setColumnSizingInfo(old => {
|
|
663
|
-
var _old$startOffset, _old$startSize;
|
|
664
|
-
const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
|
|
665
|
-
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
|
|
666
|
-
old.columnSizingStart.forEach(_ref3 => {
|
|
667
|
-
let [columnId, headerSize] = _ref3;
|
|
668
|
-
newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
|
|
669
|
-
});
|
|
670
|
-
return {
|
|
671
|
-
...old,
|
|
672
|
-
deltaOffset,
|
|
673
|
-
deltaPercentage
|
|
674
|
-
};
|
|
660
|
+
table.setColumnSizingInfo(old => {
|
|
661
|
+
var _old$startOffset, _old$startSize;
|
|
662
|
+
const deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
|
|
663
|
+
const deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
|
|
664
|
+
old.columnSizingStart.forEach(_ref3 => {
|
|
665
|
+
let [columnId, headerSize] = _ref3;
|
|
666
|
+
newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
|
|
675
667
|
});
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const onEnd = clientXPos => {
|
|
685
|
-
updateOffset('end', clientXPos);
|
|
686
|
-
table.setColumnSizingInfo(old => ({
|
|
668
|
+
return {
|
|
669
|
+
...old,
|
|
670
|
+
deltaOffset,
|
|
671
|
+
deltaPercentage
|
|
672
|
+
};
|
|
673
|
+
});
|
|
674
|
+
if (table.options.columnResizeMode === 'onChange' || eventType === 'end') {
|
|
675
|
+
table.setColumnSizing(old => ({
|
|
687
676
|
...old,
|
|
688
|
-
|
|
689
|
-
startOffset: null,
|
|
690
|
-
startSize: null,
|
|
691
|
-
deltaOffset: null,
|
|
692
|
-
deltaPercentage: null,
|
|
693
|
-
columnSizingStart: []
|
|
677
|
+
...newColumnSizing
|
|
694
678
|
}));
|
|
695
|
-
};
|
|
696
|
-
const mouseEvents = {
|
|
697
|
-
moveHandler: e => onMove(e.clientX),
|
|
698
|
-
upHandler: e => {
|
|
699
|
-
document.removeEventListener('mousemove', mouseEvents.moveHandler);
|
|
700
|
-
document.removeEventListener('mouseup', mouseEvents.upHandler);
|
|
701
|
-
onEnd(e.clientX);
|
|
702
|
-
}
|
|
703
|
-
};
|
|
704
|
-
const touchEvents = {
|
|
705
|
-
moveHandler: e => {
|
|
706
|
-
if (e.cancelable) {
|
|
707
|
-
e.preventDefault();
|
|
708
|
-
e.stopPropagation();
|
|
709
|
-
}
|
|
710
|
-
onMove(e.touches[0].clientX);
|
|
711
|
-
return false;
|
|
712
|
-
},
|
|
713
|
-
upHandler: e => {
|
|
714
|
-
var _e$touches$;
|
|
715
|
-
document.removeEventListener('touchmove', touchEvents.moveHandler);
|
|
716
|
-
document.removeEventListener('touchend', touchEvents.upHandler);
|
|
717
|
-
if (e.cancelable) {
|
|
718
|
-
e.preventDefault();
|
|
719
|
-
e.stopPropagation();
|
|
720
|
-
}
|
|
721
|
-
onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
const passiveIfSupported = passiveEventSupported() ? {
|
|
725
|
-
passive: false
|
|
726
|
-
} : false;
|
|
727
|
-
if (isTouchStartEvent(e)) {
|
|
728
|
-
document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
|
|
729
|
-
document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
|
|
730
|
-
} else {
|
|
731
|
-
document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
|
|
732
|
-
document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
|
|
733
679
|
}
|
|
680
|
+
};
|
|
681
|
+
const onMove = clientXPos => updateOffset('move', clientXPos);
|
|
682
|
+
const onEnd = clientXPos => {
|
|
683
|
+
updateOffset('end', clientXPos);
|
|
734
684
|
table.setColumnSizingInfo(old => ({
|
|
735
685
|
...old,
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
686
|
+
isResizingColumn: false,
|
|
687
|
+
startOffset: null,
|
|
688
|
+
startSize: null,
|
|
689
|
+
deltaOffset: null,
|
|
690
|
+
deltaPercentage: null,
|
|
691
|
+
columnSizingStart: []
|
|
742
692
|
}));
|
|
743
693
|
};
|
|
744
|
-
|
|
694
|
+
const mouseEvents = {
|
|
695
|
+
moveHandler: e => onMove(e.clientX),
|
|
696
|
+
upHandler: e => {
|
|
697
|
+
document.removeEventListener('mousemove', mouseEvents.moveHandler);
|
|
698
|
+
document.removeEventListener('mouseup', mouseEvents.upHandler);
|
|
699
|
+
onEnd(e.clientX);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
const touchEvents = {
|
|
703
|
+
moveHandler: e => {
|
|
704
|
+
if (e.cancelable) {
|
|
705
|
+
e.preventDefault();
|
|
706
|
+
e.stopPropagation();
|
|
707
|
+
}
|
|
708
|
+
onMove(e.touches[0].clientX);
|
|
709
|
+
return false;
|
|
710
|
+
},
|
|
711
|
+
upHandler: e => {
|
|
712
|
+
var _e$touches$;
|
|
713
|
+
document.removeEventListener('touchmove', touchEvents.moveHandler);
|
|
714
|
+
document.removeEventListener('touchend', touchEvents.upHandler);
|
|
715
|
+
if (e.cancelable) {
|
|
716
|
+
e.preventDefault();
|
|
717
|
+
e.stopPropagation();
|
|
718
|
+
}
|
|
719
|
+
onEnd((_e$touches$ = e.touches[0]) == null ? void 0 : _e$touches$.clientX);
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
const passiveIfSupported = passiveEventSupported() ? {
|
|
723
|
+
passive: false
|
|
724
|
+
} : false;
|
|
725
|
+
if (isTouchStartEvent(e)) {
|
|
726
|
+
document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
|
|
727
|
+
document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
|
|
728
|
+
} else {
|
|
729
|
+
document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
|
|
730
|
+
document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
|
|
731
|
+
}
|
|
732
|
+
table.setColumnSizingInfo(old => ({
|
|
733
|
+
...old,
|
|
734
|
+
startOffset: clientX,
|
|
735
|
+
startSize,
|
|
736
|
+
deltaOffset: 0,
|
|
737
|
+
deltaPercentage: 0,
|
|
738
|
+
columnSizingStart,
|
|
739
|
+
isResizingColumn: column.id
|
|
740
|
+
}));
|
|
741
|
+
};
|
|
745
742
|
};
|
|
746
743
|
},
|
|
747
744
|
createTable: table => {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
return
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
return
|
|
780
|
-
|
|
781
|
-
}, 0)) != null ? _table$getRightHeader : 0;
|
|
782
|
-
}
|
|
745
|
+
table.setColumnSizing = updater => table.options.onColumnSizingChange == null ? void 0 : table.options.onColumnSizingChange(updater);
|
|
746
|
+
table.setColumnSizingInfo = updater => table.options.onColumnSizingInfoChange == null ? void 0 : table.options.onColumnSizingInfoChange(updater);
|
|
747
|
+
table.resetColumnSizing = defaultState => {
|
|
748
|
+
var _table$initialState$c;
|
|
749
|
+
table.setColumnSizing(defaultState ? {} : (_table$initialState$c = table.initialState.columnSizing) != null ? _table$initialState$c : {});
|
|
750
|
+
};
|
|
751
|
+
table.resetHeaderSizeInfo = defaultState => {
|
|
752
|
+
var _table$initialState$c2;
|
|
753
|
+
table.setColumnSizingInfo(defaultState ? getDefaultColumnSizingInfoState() : (_table$initialState$c2 = table.initialState.columnSizingInfo) != null ? _table$initialState$c2 : getDefaultColumnSizingInfoState());
|
|
754
|
+
};
|
|
755
|
+
table.getTotalSize = () => {
|
|
756
|
+
var _table$getHeaderGroup, _table$getHeaderGroup2;
|
|
757
|
+
return (_table$getHeaderGroup = (_table$getHeaderGroup2 = table.getHeaderGroups()[0]) == null ? void 0 : _table$getHeaderGroup2.headers.reduce((sum, header) => {
|
|
758
|
+
return sum + header.getSize();
|
|
759
|
+
}, 0)) != null ? _table$getHeaderGroup : 0;
|
|
760
|
+
};
|
|
761
|
+
table.getLeftTotalSize = () => {
|
|
762
|
+
var _table$getLeftHeaderG, _table$getLeftHeaderG2;
|
|
763
|
+
return (_table$getLeftHeaderG = (_table$getLeftHeaderG2 = table.getLeftHeaderGroups()[0]) == null ? void 0 : _table$getLeftHeaderG2.headers.reduce((sum, header) => {
|
|
764
|
+
return sum + header.getSize();
|
|
765
|
+
}, 0)) != null ? _table$getLeftHeaderG : 0;
|
|
766
|
+
};
|
|
767
|
+
table.getCenterTotalSize = () => {
|
|
768
|
+
var _table$getCenterHeade, _table$getCenterHeade2;
|
|
769
|
+
return (_table$getCenterHeade = (_table$getCenterHeade2 = table.getCenterHeaderGroups()[0]) == null ? void 0 : _table$getCenterHeade2.headers.reduce((sum, header) => {
|
|
770
|
+
return sum + header.getSize();
|
|
771
|
+
}, 0)) != null ? _table$getCenterHeade : 0;
|
|
772
|
+
};
|
|
773
|
+
table.getRightTotalSize = () => {
|
|
774
|
+
var _table$getRightHeader, _table$getRightHeader2;
|
|
775
|
+
return (_table$getRightHeader = (_table$getRightHeader2 = table.getRightHeaderGroups()[0]) == null ? void 0 : _table$getRightHeader2.headers.reduce((sum, header) => {
|
|
776
|
+
return sum + header.getSize();
|
|
777
|
+
}, 0)) != null ? _table$getRightHeader : 0;
|
|
783
778
|
};
|
|
784
779
|
}
|
|
785
780
|
};
|
|
@@ -825,141 +820,137 @@
|
|
|
825
820
|
createTable: table => {
|
|
826
821
|
let registered = false;
|
|
827
822
|
let queued = false;
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
registered = true;
|
|
834
|
-
});
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
|
|
838
|
-
if (queued) return;
|
|
839
|
-
queued = true;
|
|
840
|
-
table._queue(() => {
|
|
841
|
-
table.resetExpanded();
|
|
842
|
-
queued = false;
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
},
|
|
846
|
-
setExpanded: updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater),
|
|
847
|
-
toggleAllRowsExpanded: expanded => {
|
|
848
|
-
if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
|
|
849
|
-
table.setExpanded(true);
|
|
850
|
-
} else {
|
|
851
|
-
table.setExpanded({});
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
resetExpanded: defaultState => {
|
|
855
|
-
var _table$initialState$e, _table$initialState;
|
|
856
|
-
table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
|
|
857
|
-
},
|
|
858
|
-
getCanSomeRowsExpand: () => {
|
|
859
|
-
return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
|
|
860
|
-
},
|
|
861
|
-
getToggleAllRowsExpandedHandler: () => {
|
|
862
|
-
return e => {
|
|
863
|
-
e.persist == null || e.persist();
|
|
864
|
-
table.toggleAllRowsExpanded();
|
|
865
|
-
};
|
|
866
|
-
},
|
|
867
|
-
getIsSomeRowsExpanded: () => {
|
|
868
|
-
const expanded = table.getState().expanded;
|
|
869
|
-
return expanded === true || Object.values(expanded).some(Boolean);
|
|
870
|
-
},
|
|
871
|
-
getIsAllRowsExpanded: () => {
|
|
872
|
-
const expanded = table.getState().expanded;
|
|
873
|
-
|
|
874
|
-
// If expanded is true, save some cycles and return true
|
|
875
|
-
if (typeof expanded === 'boolean') {
|
|
876
|
-
return expanded === true;
|
|
877
|
-
}
|
|
878
|
-
if (!Object.keys(expanded).length) {
|
|
879
|
-
return false;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
// If any row is not expanded, return false
|
|
883
|
-
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
|
|
884
|
-
return false;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
// They must all be expanded :shrug:
|
|
888
|
-
return true;
|
|
889
|
-
},
|
|
890
|
-
getExpandedDepth: () => {
|
|
891
|
-
let maxDepth = 0;
|
|
892
|
-
const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
|
|
893
|
-
rowIds.forEach(id => {
|
|
894
|
-
const splitId = id.split('.');
|
|
895
|
-
maxDepth = Math.max(maxDepth, splitId.length);
|
|
823
|
+
table._autoResetExpanded = () => {
|
|
824
|
+
var _ref, _table$options$autoRe;
|
|
825
|
+
if (!registered) {
|
|
826
|
+
table._queue(() => {
|
|
827
|
+
registered = true;
|
|
896
828
|
});
|
|
897
|
-
return
|
|
898
|
-
},
|
|
899
|
-
getPreExpandedRowModel: () => table.getSortedRowModel(),
|
|
900
|
-
getExpandedRowModel: () => {
|
|
901
|
-
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
|
|
902
|
-
table._getExpandedRowModel = table.options.getExpandedRowModel(table);
|
|
903
|
-
}
|
|
904
|
-
if (table.options.manualExpanding || !table._getExpandedRowModel) {
|
|
905
|
-
return table.getPreExpandedRowModel();
|
|
906
|
-
}
|
|
907
|
-
return table._getExpandedRowModel();
|
|
829
|
+
return;
|
|
908
830
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
var _expanded;
|
|
916
|
-
const exists = old === true ? true : !!(old != null && old[row.id]);
|
|
917
|
-
let oldExpanded = {};
|
|
918
|
-
if (old === true) {
|
|
919
|
-
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
|
|
920
|
-
oldExpanded[rowId] = true;
|
|
921
|
-
});
|
|
922
|
-
} else {
|
|
923
|
-
oldExpanded = old;
|
|
924
|
-
}
|
|
925
|
-
expanded = (_expanded = expanded) != null ? _expanded : !exists;
|
|
926
|
-
if (!exists && expanded) {
|
|
927
|
-
return {
|
|
928
|
-
...oldExpanded,
|
|
929
|
-
[row.id]: true
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
if (exists && !expanded) {
|
|
933
|
-
const {
|
|
934
|
-
[row.id]: _,
|
|
935
|
-
...rest
|
|
936
|
-
} = oldExpanded;
|
|
937
|
-
return rest;
|
|
938
|
-
}
|
|
939
|
-
return old;
|
|
831
|
+
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetExpanded) != null ? _ref : !table.options.manualExpanding) {
|
|
832
|
+
if (queued) return;
|
|
833
|
+
queued = true;
|
|
834
|
+
table._queue(() => {
|
|
835
|
+
table.resetExpanded();
|
|
836
|
+
queued = false;
|
|
940
837
|
});
|
|
941
|
-
},
|
|
942
|
-
getIsExpanded: () => {
|
|
943
|
-
var _table$options$getIsR;
|
|
944
|
-
const expanded = table.getState().expanded;
|
|
945
|
-
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]));
|
|
946
|
-
},
|
|
947
|
-
getCanExpand: () => {
|
|
948
|
-
var _table$options$getRow, _table$options$enable, _row$subRows;
|
|
949
|
-
return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
950
|
-
},
|
|
951
|
-
getToggleExpandedHandler: () => {
|
|
952
|
-
const canExpand = row.getCanExpand();
|
|
953
|
-
return () => {
|
|
954
|
-
if (!canExpand) return;
|
|
955
|
-
row.toggleExpanded();
|
|
956
|
-
};
|
|
957
838
|
}
|
|
958
839
|
};
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
840
|
+
table.setExpanded = updater => table.options.onExpandedChange == null ? void 0 : table.options.onExpandedChange(updater);
|
|
841
|
+
table.toggleAllRowsExpanded = expanded => {
|
|
842
|
+
if (expanded != null ? expanded : !table.getIsAllRowsExpanded()) {
|
|
843
|
+
table.setExpanded(true);
|
|
844
|
+
} else {
|
|
845
|
+
table.setExpanded({});
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
table.resetExpanded = defaultState => {
|
|
849
|
+
var _table$initialState$e, _table$initialState;
|
|
850
|
+
table.setExpanded(defaultState ? {} : (_table$initialState$e = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.expanded) != null ? _table$initialState$e : {});
|
|
851
|
+
};
|
|
852
|
+
table.getCanSomeRowsExpand = () => {
|
|
853
|
+
return table.getPrePaginationRowModel().flatRows.some(row => row.getCanExpand());
|
|
854
|
+
};
|
|
855
|
+
table.getToggleAllRowsExpandedHandler = () => {
|
|
856
|
+
return e => {
|
|
857
|
+
e.persist == null || e.persist();
|
|
858
|
+
table.toggleAllRowsExpanded();
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
table.getIsSomeRowsExpanded = () => {
|
|
862
|
+
const expanded = table.getState().expanded;
|
|
863
|
+
return expanded === true || Object.values(expanded).some(Boolean);
|
|
864
|
+
};
|
|
865
|
+
table.getIsAllRowsExpanded = () => {
|
|
866
|
+
const expanded = table.getState().expanded;
|
|
867
|
+
|
|
868
|
+
// If expanded is true, save some cycles and return true
|
|
869
|
+
if (typeof expanded === 'boolean') {
|
|
870
|
+
return expanded === true;
|
|
871
|
+
}
|
|
872
|
+
if (!Object.keys(expanded).length) {
|
|
873
|
+
return false;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// If any row is not expanded, return false
|
|
877
|
+
if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {
|
|
878
|
+
return false;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// They must all be expanded :shrug:
|
|
882
|
+
return true;
|
|
883
|
+
};
|
|
884
|
+
table.getExpandedDepth = () => {
|
|
885
|
+
let maxDepth = 0;
|
|
886
|
+
const rowIds = table.getState().expanded === true ? Object.keys(table.getRowModel().rowsById) : Object.keys(table.getState().expanded);
|
|
887
|
+
rowIds.forEach(id => {
|
|
888
|
+
const splitId = id.split('.');
|
|
889
|
+
maxDepth = Math.max(maxDepth, splitId.length);
|
|
890
|
+
});
|
|
891
|
+
return maxDepth;
|
|
892
|
+
};
|
|
893
|
+
table.getPreExpandedRowModel = () => table.getSortedRowModel();
|
|
894
|
+
table.getExpandedRowModel = () => {
|
|
895
|
+
if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {
|
|
896
|
+
table._getExpandedRowModel = table.options.getExpandedRowModel(table);
|
|
897
|
+
}
|
|
898
|
+
if (table.options.manualExpanding || !table._getExpandedRowModel) {
|
|
899
|
+
return table.getPreExpandedRowModel();
|
|
900
|
+
}
|
|
901
|
+
return table._getExpandedRowModel();
|
|
902
|
+
};
|
|
903
|
+
},
|
|
904
|
+
createRow: (row, table) => {
|
|
905
|
+
row.toggleExpanded = expanded => {
|
|
906
|
+
table.setExpanded(old => {
|
|
907
|
+
var _expanded;
|
|
908
|
+
const exists = old === true ? true : !!(old != null && old[row.id]);
|
|
909
|
+
let oldExpanded = {};
|
|
910
|
+
if (old === true) {
|
|
911
|
+
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
|
|
912
|
+
oldExpanded[rowId] = true;
|
|
913
|
+
});
|
|
914
|
+
} else {
|
|
915
|
+
oldExpanded = old;
|
|
916
|
+
}
|
|
917
|
+
expanded = (_expanded = expanded) != null ? _expanded : !exists;
|
|
918
|
+
if (!exists && expanded) {
|
|
919
|
+
return {
|
|
920
|
+
...oldExpanded,
|
|
921
|
+
[row.id]: true
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
if (exists && !expanded) {
|
|
925
|
+
const {
|
|
926
|
+
[row.id]: _,
|
|
927
|
+
...rest
|
|
928
|
+
} = oldExpanded;
|
|
929
|
+
return rest;
|
|
930
|
+
}
|
|
931
|
+
return old;
|
|
932
|
+
});
|
|
933
|
+
};
|
|
934
|
+
row.getIsExpanded = () => {
|
|
935
|
+
var _table$options$getIsR;
|
|
936
|
+
const expanded = table.getState().expanded;
|
|
937
|
+
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]));
|
|
938
|
+
};
|
|
939
|
+
row.getCanExpand = () => {
|
|
940
|
+
var _table$options$getRow, _table$options$enable, _row$subRows;
|
|
941
|
+
return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
942
|
+
};
|
|
943
|
+
row.getToggleExpandedHandler = () => {
|
|
944
|
+
const canExpand = row.getCanExpand();
|
|
945
|
+
return () => {
|
|
946
|
+
if (!canExpand) return;
|
|
947
|
+
row.toggleExpanded();
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
const includesString = (row, columnId, filterValue) => {
|
|
963
954
|
var _row$getValue;
|
|
964
955
|
const search = filterValue.toLowerCase();
|
|
965
956
|
return Boolean((_row$getValue = row.getValue(columnId)) == null || (_row$getValue = _row$getValue.toString()) == null || (_row$getValue = _row$getValue.toLowerCase()) == null ? void 0 : _row$getValue.includes(search));
|
|
@@ -1073,184 +1064,176 @@
|
|
|
1073
1064
|
};
|
|
1074
1065
|
},
|
|
1075
1066
|
createColumn: (column, table) => {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
return d;
|
|
1142
|
-
})) != null ? _old$map : [];
|
|
1143
|
-
}
|
|
1144
|
-
if (old != null && old.length) {
|
|
1145
|
-
return [...old, newFilterObj];
|
|
1146
|
-
}
|
|
1147
|
-
return [newFilterObj];
|
|
1148
|
-
});
|
|
1149
|
-
},
|
|
1150
|
-
_getFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id),
|
|
1151
|
-
getFacetedRowModel: () => {
|
|
1152
|
-
if (!column._getFacetedRowModel) {
|
|
1153
|
-
return table.getPreFilteredRowModel();
|
|
1067
|
+
column.getAutoFilterFn = () => {
|
|
1068
|
+
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
1069
|
+
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1070
|
+
if (typeof value === 'string') {
|
|
1071
|
+
return filterFns.includesString;
|
|
1072
|
+
}
|
|
1073
|
+
if (typeof value === 'number') {
|
|
1074
|
+
return filterFns.inNumberRange;
|
|
1075
|
+
}
|
|
1076
|
+
if (typeof value === 'boolean') {
|
|
1077
|
+
return filterFns.equals;
|
|
1078
|
+
}
|
|
1079
|
+
if (value !== null && typeof value === 'object') {
|
|
1080
|
+
return filterFns.equals;
|
|
1081
|
+
}
|
|
1082
|
+
if (Array.isArray(value)) {
|
|
1083
|
+
return filterFns.arrIncludes;
|
|
1084
|
+
}
|
|
1085
|
+
return filterFns.weakEquals;
|
|
1086
|
+
};
|
|
1087
|
+
column.getFilterFn = () => {
|
|
1088
|
+
var _table$options$filter, _table$options$filter2;
|
|
1089
|
+
return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : // @ts-ignore
|
|
1090
|
+
(_table$options$filter = (_table$options$filter2 = table.options.filterFns) == null ? void 0 : _table$options$filter2[column.columnDef.filterFn]) != null ? _table$options$filter : filterFns[column.columnDef.filterFn];
|
|
1091
|
+
};
|
|
1092
|
+
column.getCanFilter = () => {
|
|
1093
|
+
var _column$columnDef$ena, _table$options$enable, _table$options$enable2;
|
|
1094
|
+
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;
|
|
1095
|
+
};
|
|
1096
|
+
column.getCanGlobalFilter = () => {
|
|
1097
|
+
var _column$columnDef$ena2, _table$options$enable3, _table$options$enable4, _table$options$getCol;
|
|
1098
|
+
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;
|
|
1099
|
+
};
|
|
1100
|
+
column.getIsFiltered = () => column.getFilterIndex() > -1;
|
|
1101
|
+
column.getFilterValue = () => {
|
|
1102
|
+
var _table$getState$colum;
|
|
1103
|
+
return (_table$getState$colum = table.getState().columnFilters) == null || (_table$getState$colum = _table$getState$colum.find(d => d.id === column.id)) == null ? void 0 : _table$getState$colum.value;
|
|
1104
|
+
};
|
|
1105
|
+
column.getFilterIndex = () => {
|
|
1106
|
+
var _table$getState$colum2, _table$getState$colum3;
|
|
1107
|
+
return (_table$getState$colum2 = (_table$getState$colum3 = table.getState().columnFilters) == null ? void 0 : _table$getState$colum3.findIndex(d => d.id === column.id)) != null ? _table$getState$colum2 : -1;
|
|
1108
|
+
};
|
|
1109
|
+
column.setFilterValue = value => {
|
|
1110
|
+
table.setColumnFilters(old => {
|
|
1111
|
+
const filterFn = column.getFilterFn();
|
|
1112
|
+
const previousfilter = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
1113
|
+
const newFilter = functionalUpdate(value, previousfilter ? previousfilter.value : undefined);
|
|
1114
|
+
|
|
1115
|
+
//
|
|
1116
|
+
if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {
|
|
1117
|
+
var _old$filter;
|
|
1118
|
+
return (_old$filter = old == null ? void 0 : old.filter(d => d.id !== column.id)) != null ? _old$filter : [];
|
|
1119
|
+
}
|
|
1120
|
+
const newFilterObj = {
|
|
1121
|
+
id: column.id,
|
|
1122
|
+
value: newFilter
|
|
1123
|
+
};
|
|
1124
|
+
if (previousfilter) {
|
|
1125
|
+
var _old$map;
|
|
1126
|
+
return (_old$map = old == null ? void 0 : old.map(d => {
|
|
1127
|
+
if (d.id === column.id) {
|
|
1128
|
+
return newFilterObj;
|
|
1129
|
+
}
|
|
1130
|
+
return d;
|
|
1131
|
+
})) != null ? _old$map : [];
|
|
1154
1132
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
_getFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id),
|
|
1158
|
-
getFacetedUniqueValues: () => {
|
|
1159
|
-
if (!column._getFacetedUniqueValues) {
|
|
1160
|
-
return new Map();
|
|
1133
|
+
if (old != null && old.length) {
|
|
1134
|
+
return [...old, newFilterObj];
|
|
1161
1135
|
}
|
|
1162
|
-
return
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
return column._getFacetedMinMaxValues();
|
|
1136
|
+
return [newFilterObj];
|
|
1137
|
+
});
|
|
1138
|
+
};
|
|
1139
|
+
column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
|
|
1140
|
+
column.getFacetedRowModel = () => {
|
|
1141
|
+
if (!column._getFacetedRowModel) {
|
|
1142
|
+
return table.getPreFilteredRowModel();
|
|
1170
1143
|
}
|
|
1171
|
-
|
|
1172
|
-
// facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
|
|
1144
|
+
return column._getFacetedRowModel();
|
|
1173
1145
|
};
|
|
1146
|
+
column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
|
|
1147
|
+
column.getFacetedUniqueValues = () => {
|
|
1148
|
+
if (!column._getFacetedUniqueValues) {
|
|
1149
|
+
return new Map();
|
|
1150
|
+
}
|
|
1151
|
+
return column._getFacetedUniqueValues();
|
|
1152
|
+
};
|
|
1153
|
+
column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
|
|
1154
|
+
column.getFacetedMinMaxValues = () => {
|
|
1155
|
+
if (!column._getFacetedMinMaxValues) {
|
|
1156
|
+
return undefined;
|
|
1157
|
+
}
|
|
1158
|
+
return column._getFacetedMinMaxValues();
|
|
1159
|
+
};
|
|
1160
|
+
// () => [column.getFacetedRowModel()],
|
|
1161
|
+
// facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),
|
|
1174
1162
|
},
|
|
1175
1163
|
|
|
1176
1164
|
createRow: (row, table) => {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
columnFiltersMeta: {}
|
|
1180
|
-
};
|
|
1165
|
+
row.columnFilters = {};
|
|
1166
|
+
row.columnFiltersMeta = {};
|
|
1181
1167
|
},
|
|
1182
1168
|
createTable: table => {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
const
|
|
1202
|
-
if (column) {
|
|
1203
|
-
|
|
1204
|
-
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
|
|
1205
|
-
return false;
|
|
1206
|
-
}
|
|
1169
|
+
table.getGlobalAutoFilterFn = () => {
|
|
1170
|
+
return filterFns.includesString;
|
|
1171
|
+
};
|
|
1172
|
+
table.getGlobalFilterFn = () => {
|
|
1173
|
+
var _table$options$filter3, _table$options$filter4;
|
|
1174
|
+
const {
|
|
1175
|
+
globalFilterFn: globalFilterFn
|
|
1176
|
+
} = table.options;
|
|
1177
|
+
return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? table.getGlobalAutoFilterFn() : // @ts-ignore
|
|
1178
|
+
(_table$options$filter3 = (_table$options$filter4 = table.options.filterFns) == null ? void 0 : _table$options$filter4[globalFilterFn]) != null ? _table$options$filter3 : filterFns[globalFilterFn];
|
|
1179
|
+
};
|
|
1180
|
+
table.setColumnFilters = updater => {
|
|
1181
|
+
const leafColumns = table.getAllLeafColumns();
|
|
1182
|
+
const updateFn = old => {
|
|
1183
|
+
var _functionalUpdate;
|
|
1184
|
+
return (_functionalUpdate = functionalUpdate(updater, old)) == null ? void 0 : _functionalUpdate.filter(filter => {
|
|
1185
|
+
const column = leafColumns.find(d => d.id === filter.id);
|
|
1186
|
+
if (column) {
|
|
1187
|
+
const filterFn = column.getFilterFn();
|
|
1188
|
+
if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {
|
|
1189
|
+
return false;
|
|
1207
1190
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
if (table.options.manualFiltering || !table._getFilteredRowModel) {
|
|
1229
|
-
return table.getPreFilteredRowModel();
|
|
1230
|
-
}
|
|
1231
|
-
return table._getFilteredRowModel();
|
|
1232
|
-
},
|
|
1233
|
-
_getGlobalFacetedRowModel: table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__'),
|
|
1234
|
-
getGlobalFacetedRowModel: () => {
|
|
1235
|
-
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
|
|
1236
|
-
return table.getPreFilteredRowModel();
|
|
1237
|
-
}
|
|
1238
|
-
return table._getGlobalFacetedRowModel();
|
|
1239
|
-
},
|
|
1240
|
-
_getGlobalFacetedUniqueValues: table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__'),
|
|
1241
|
-
getGlobalFacetedUniqueValues: () => {
|
|
1242
|
-
if (!table._getGlobalFacetedUniqueValues) {
|
|
1243
|
-
return new Map();
|
|
1244
|
-
}
|
|
1245
|
-
return table._getGlobalFacetedUniqueValues();
|
|
1246
|
-
},
|
|
1247
|
-
_getGlobalFacetedMinMaxValues: table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__'),
|
|
1248
|
-
getGlobalFacetedMinMaxValues: () => {
|
|
1249
|
-
if (!table._getGlobalFacetedMinMaxValues) {
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
return table._getGlobalFacetedMinMaxValues();
|
|
1191
|
+
}
|
|
1192
|
+
return true;
|
|
1193
|
+
});
|
|
1194
|
+
};
|
|
1195
|
+
table.options.onColumnFiltersChange == null || table.options.onColumnFiltersChange(updateFn);
|
|
1196
|
+
};
|
|
1197
|
+
table.setGlobalFilter = updater => {
|
|
1198
|
+
table.options.onGlobalFilterChange == null || table.options.onGlobalFilterChange(updater);
|
|
1199
|
+
};
|
|
1200
|
+
table.resetGlobalFilter = defaultState => {
|
|
1201
|
+
table.setGlobalFilter(defaultState ? undefined : table.initialState.globalFilter);
|
|
1202
|
+
};
|
|
1203
|
+
table.resetColumnFilters = defaultState => {
|
|
1204
|
+
var _table$initialState$c, _table$initialState;
|
|
1205
|
+
table.setColumnFilters(defaultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
|
|
1206
|
+
};
|
|
1207
|
+
table.getPreFilteredRowModel = () => table.getCoreRowModel();
|
|
1208
|
+
table.getFilteredRowModel = () => {
|
|
1209
|
+
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
|
|
1210
|
+
table._getFilteredRowModel = table.options.getFilteredRowModel(table);
|
|
1253
1211
|
}
|
|
1212
|
+
if (table.options.manualFiltering || !table._getFilteredRowModel) {
|
|
1213
|
+
return table.getPreFilteredRowModel();
|
|
1214
|
+
}
|
|
1215
|
+
return table._getFilteredRowModel();
|
|
1216
|
+
};
|
|
1217
|
+
table._getGlobalFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, '__global__');
|
|
1218
|
+
table.getGlobalFacetedRowModel = () => {
|
|
1219
|
+
if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {
|
|
1220
|
+
return table.getPreFilteredRowModel();
|
|
1221
|
+
}
|
|
1222
|
+
return table._getGlobalFacetedRowModel();
|
|
1223
|
+
};
|
|
1224
|
+
table._getGlobalFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, '__global__');
|
|
1225
|
+
table.getGlobalFacetedUniqueValues = () => {
|
|
1226
|
+
if (!table._getGlobalFacetedUniqueValues) {
|
|
1227
|
+
return new Map();
|
|
1228
|
+
}
|
|
1229
|
+
return table._getGlobalFacetedUniqueValues();
|
|
1230
|
+
};
|
|
1231
|
+
table._getGlobalFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, '__global__');
|
|
1232
|
+
table.getGlobalFacetedMinMaxValues = () => {
|
|
1233
|
+
if (!table._getGlobalFacetedMinMaxValues) {
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
return table._getGlobalFacetedMinMaxValues();
|
|
1254
1237
|
};
|
|
1255
1238
|
}
|
|
1256
1239
|
};
|
|
@@ -1375,98 +1358,90 @@
|
|
|
1375
1358
|
};
|
|
1376
1359
|
},
|
|
1377
1360
|
createColumn: (column, table) => {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
return old.filter(d => d !== column.id);
|
|
1384
|
-
}
|
|
1385
|
-
return [...(old != null ? old : []), column.id];
|
|
1386
|
-
});
|
|
1387
|
-
},
|
|
1388
|
-
getCanGroup: () => {
|
|
1389
|
-
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1390
|
-
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;
|
|
1391
|
-
},
|
|
1392
|
-
getIsGrouped: () => {
|
|
1393
|
-
var _table$getState$group;
|
|
1394
|
-
return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
|
|
1395
|
-
},
|
|
1396
|
-
getGroupedIndex: () => {
|
|
1397
|
-
var _table$getState$group2;
|
|
1398
|
-
return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
|
|
1399
|
-
},
|
|
1400
|
-
getToggleGroupingHandler: () => {
|
|
1401
|
-
const canGroup = column.getCanGroup();
|
|
1402
|
-
return () => {
|
|
1403
|
-
if (!canGroup) return;
|
|
1404
|
-
column.toggleGrouping();
|
|
1405
|
-
};
|
|
1406
|
-
},
|
|
1407
|
-
getAutoAggregationFn: () => {
|
|
1408
|
-
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
1409
|
-
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1410
|
-
if (typeof value === 'number') {
|
|
1411
|
-
return aggregationFns.sum;
|
|
1412
|
-
}
|
|
1413
|
-
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
1414
|
-
return aggregationFns.extent;
|
|
1415
|
-
}
|
|
1416
|
-
},
|
|
1417
|
-
getAggregationFn: () => {
|
|
1418
|
-
var _table$options$aggreg, _table$options$aggreg2;
|
|
1419
|
-
if (!column) {
|
|
1420
|
-
throw new Error();
|
|
1361
|
+
column.toggleGrouping = () => {
|
|
1362
|
+
table.setGrouping(old => {
|
|
1363
|
+
// Find any existing grouping for this column
|
|
1364
|
+
if (old != null && old.includes(column.id)) {
|
|
1365
|
+
return old.filter(d => d !== column.id);
|
|
1421
1366
|
}
|
|
1422
|
-
return
|
|
1367
|
+
return [...(old != null ? old : []), column.id];
|
|
1368
|
+
});
|
|
1369
|
+
};
|
|
1370
|
+
column.getCanGroup = () => {
|
|
1371
|
+
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1372
|
+
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;
|
|
1373
|
+
};
|
|
1374
|
+
column.getIsGrouped = () => {
|
|
1375
|
+
var _table$getState$group;
|
|
1376
|
+
return (_table$getState$group = table.getState().grouping) == null ? void 0 : _table$getState$group.includes(column.id);
|
|
1377
|
+
};
|
|
1378
|
+
column.getGroupedIndex = () => {
|
|
1379
|
+
var _table$getState$group2;
|
|
1380
|
+
return (_table$getState$group2 = table.getState().grouping) == null ? void 0 : _table$getState$group2.indexOf(column.id);
|
|
1381
|
+
};
|
|
1382
|
+
column.getToggleGroupingHandler = () => {
|
|
1383
|
+
const canGroup = column.getCanGroup();
|
|
1384
|
+
return () => {
|
|
1385
|
+
if (!canGroup) return;
|
|
1386
|
+
column.toggleGrouping();
|
|
1387
|
+
};
|
|
1388
|
+
};
|
|
1389
|
+
column.getAutoAggregationFn = () => {
|
|
1390
|
+
const firstRow = table.getCoreRowModel().flatRows[0];
|
|
1391
|
+
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1392
|
+
if (typeof value === 'number') {
|
|
1393
|
+
return aggregationFns.sum;
|
|
1394
|
+
}
|
|
1395
|
+
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
1396
|
+
return aggregationFns.extent;
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
column.getAggregationFn = () => {
|
|
1400
|
+
var _table$options$aggreg, _table$options$aggreg2;
|
|
1401
|
+
if (!column) {
|
|
1402
|
+
throw new Error();
|
|
1423
1403
|
}
|
|
1404
|
+
return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_table$options$aggreg = (_table$options$aggreg2 = table.options.aggregationFns) == null ? void 0 : _table$options$aggreg2[column.columnDef.aggregationFn]) != null ? _table$options$aggreg : aggregationFns[column.columnDef.aggregationFn];
|
|
1424
1405
|
};
|
|
1425
1406
|
},
|
|
1426
1407
|
createTable: table => {
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
return table.getPreGroupedRowModel();
|
|
1440
|
-
}
|
|
1441
|
-
return table._getGroupedRowModel();
|
|
1408
|
+
table.setGrouping = updater => table.options.onGroupingChange == null ? void 0 : table.options.onGroupingChange(updater);
|
|
1409
|
+
table.resetGrouping = defaultState => {
|
|
1410
|
+
var _table$initialState$g, _table$initialState;
|
|
1411
|
+
table.setGrouping(defaultState ? [] : (_table$initialState$g = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.grouping) != null ? _table$initialState$g : []);
|
|
1412
|
+
};
|
|
1413
|
+
table.getPreGroupedRowModel = () => table.getFilteredRowModel();
|
|
1414
|
+
table.getGroupedRowModel = () => {
|
|
1415
|
+
if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {
|
|
1416
|
+
table._getGroupedRowModel = table.options.getGroupedRowModel(table);
|
|
1417
|
+
}
|
|
1418
|
+
if (table.options.manualGrouping || !table._getGroupedRowModel) {
|
|
1419
|
+
return table.getPreGroupedRowModel();
|
|
1442
1420
|
}
|
|
1421
|
+
return table._getGroupedRowModel();
|
|
1443
1422
|
};
|
|
1444
1423
|
},
|
|
1445
1424
|
createRow: (row, table) => {
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
1450
|
-
return row._groupingValuesCache[columnId];
|
|
1451
|
-
}
|
|
1452
|
-
const column = table.getColumn(columnId);
|
|
1453
|
-
if (!(column != null && column.columnDef.getGroupingValue)) {
|
|
1454
|
-
return row.getValue(columnId);
|
|
1455
|
-
}
|
|
1456
|
-
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
|
|
1425
|
+
row.getIsGrouped = () => !!row.groupingColumnId;
|
|
1426
|
+
row.getGroupingValue = columnId => {
|
|
1427
|
+
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
1457
1428
|
return row._groupingValuesCache[columnId];
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1429
|
+
}
|
|
1430
|
+
const column = table.getColumn(columnId);
|
|
1431
|
+
if (!(column != null && column.columnDef.getGroupingValue)) {
|
|
1432
|
+
return row.getValue(columnId);
|
|
1433
|
+
}
|
|
1434
|
+
row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(row.original);
|
|
1435
|
+
return row._groupingValuesCache[columnId];
|
|
1460
1436
|
};
|
|
1437
|
+
row._groupingValuesCache = {};
|
|
1461
1438
|
},
|
|
1462
1439
|
createCell: (cell, column, row, table) => {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
1469
|
-
}
|
|
1440
|
+
cell.getIsGrouped = () => column.getIsGrouped() && column.id === row.groupingColumnId;
|
|
1441
|
+
cell.getIsPlaceholder = () => !cell.getIsGrouped() && column.getIsGrouped();
|
|
1442
|
+
cell.getIsAggregated = () => {
|
|
1443
|
+
var _row$subRows;
|
|
1444
|
+
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
1470
1445
|
};
|
|
1471
1446
|
}
|
|
1472
1447
|
};
|
|
@@ -1497,46 +1472,44 @@
|
|
|
1497
1472
|
};
|
|
1498
1473
|
},
|
|
1499
1474
|
createTable: table => {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
const columnOrderCopy = [...columnOrder];
|
|
1475
|
+
table.setColumnOrder = updater => table.options.onColumnOrderChange == null ? void 0 : table.options.onColumnOrderChange(updater);
|
|
1476
|
+
table.resetColumnOrder = defaultState => {
|
|
1477
|
+
var _table$initialState$c;
|
|
1478
|
+
table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
|
|
1479
|
+
};
|
|
1480
|
+
table._getOrderColumnsFn = memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
|
|
1481
|
+
// Sort grouped columns to the start of the column list
|
|
1482
|
+
// before the headers are built
|
|
1483
|
+
let orderedColumns = [];
|
|
1484
|
+
|
|
1485
|
+
// If there is no order, return the normal columns
|
|
1486
|
+
if (!(columnOrder != null && columnOrder.length)) {
|
|
1487
|
+
orderedColumns = columns;
|
|
1488
|
+
} else {
|
|
1489
|
+
const columnOrderCopy = [...columnOrder];
|
|
1516
1490
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1491
|
+
// If there is an order, make a copy of the columns
|
|
1492
|
+
const columnsCopy = [...columns];
|
|
1519
1493
|
|
|
1520
|
-
|
|
1494
|
+
// And make a new ordered array of the columns
|
|
1521
1495
|
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1496
|
+
// Loop over the columns and place them in order into the new array
|
|
1497
|
+
while (columnsCopy.length && columnOrderCopy.length) {
|
|
1498
|
+
const targetColumnId = columnOrderCopy.shift();
|
|
1499
|
+
const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId);
|
|
1500
|
+
if (foundIndex > -1) {
|
|
1501
|
+
orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]);
|
|
1529
1502
|
}
|
|
1530
|
-
|
|
1531
|
-
// If there are any columns left, add them to the end
|
|
1532
|
-
orderedColumns = [...orderedColumns, ...columnsCopy];
|
|
1533
1503
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1504
|
+
|
|
1505
|
+
// If there are any columns left, add them to the end
|
|
1506
|
+
orderedColumns = [...orderedColumns, ...columnsCopy];
|
|
1507
|
+
}
|
|
1508
|
+
return orderColumns(orderedColumns, grouping, groupedColumnMode);
|
|
1509
|
+
}, {
|
|
1510
|
+
key: 'getOrderColumnsFn'
|
|
1511
|
+
// debug: () => table.options.debugAll ?? table.options.debugTable,
|
|
1512
|
+
});
|
|
1540
1513
|
}
|
|
1541
1514
|
};
|
|
1542
1515
|
|
|
@@ -1566,126 +1539,124 @@
|
|
|
1566
1539
|
createTable: table => {
|
|
1567
1540
|
let registered = false;
|
|
1568
1541
|
let queued = false;
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
registered = true;
|
|
1575
|
-
});
|
|
1576
|
-
return;
|
|
1577
|
-
}
|
|
1578
|
-
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
|
|
1579
|
-
if (queued) return;
|
|
1580
|
-
queued = true;
|
|
1581
|
-
table._queue(() => {
|
|
1582
|
-
table.resetPageIndex();
|
|
1583
|
-
queued = false;
|
|
1584
|
-
});
|
|
1585
|
-
}
|
|
1586
|
-
},
|
|
1587
|
-
setPagination: updater => {
|
|
1588
|
-
const safeUpdater = old => {
|
|
1589
|
-
let newState = functionalUpdate(updater, old);
|
|
1590
|
-
return newState;
|
|
1591
|
-
};
|
|
1592
|
-
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
|
|
1593
|
-
},
|
|
1594
|
-
resetPagination: defaultState => {
|
|
1595
|
-
var _table$initialState$p;
|
|
1596
|
-
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
|
|
1597
|
-
},
|
|
1598
|
-
setPageIndex: updater => {
|
|
1599
|
-
table.setPagination(old => {
|
|
1600
|
-
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
1601
|
-
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
|
|
1602
|
-
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
|
|
1603
|
-
return {
|
|
1604
|
-
...old,
|
|
1605
|
-
pageIndex
|
|
1606
|
-
};
|
|
1542
|
+
table._autoResetPageIndex = () => {
|
|
1543
|
+
var _ref, _table$options$autoRe;
|
|
1544
|
+
if (!registered) {
|
|
1545
|
+
table._queue(() => {
|
|
1546
|
+
registered = true;
|
|
1607
1547
|
});
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
},
|
|
1617
|
-
setPageSize: updater => {
|
|
1618
|
-
table.setPagination(old => {
|
|
1619
|
-
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
|
|
1620
|
-
const topRowIndex = old.pageSize * old.pageIndex;
|
|
1621
|
-
const pageIndex = Math.floor(topRowIndex / pageSize);
|
|
1622
|
-
return {
|
|
1623
|
-
...old,
|
|
1624
|
-
pageIndex,
|
|
1625
|
-
pageSize
|
|
1626
|
-
};
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
if ((_ref = (_table$options$autoRe = table.options.autoResetAll) != null ? _table$options$autoRe : table.options.autoResetPageIndex) != null ? _ref : !table.options.manualPagination) {
|
|
1551
|
+
if (queued) return;
|
|
1552
|
+
queued = true;
|
|
1553
|
+
table._queue(() => {
|
|
1554
|
+
table.resetPageIndex();
|
|
1555
|
+
queued = false;
|
|
1627
1556
|
});
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1559
|
+
table.setPagination = updater => {
|
|
1560
|
+
const safeUpdater = old => {
|
|
1561
|
+
let newState = functionalUpdate(updater, old);
|
|
1562
|
+
return newState;
|
|
1563
|
+
};
|
|
1564
|
+
return table.options.onPaginationChange == null ? void 0 : table.options.onPaginationChange(safeUpdater);
|
|
1565
|
+
};
|
|
1566
|
+
table.resetPagination = defaultState => {
|
|
1567
|
+
var _table$initialState$p;
|
|
1568
|
+
table.setPagination(defaultState ? getDefaultPaginationState() : (_table$initialState$p = table.initialState.pagination) != null ? _table$initialState$p : getDefaultPaginationState());
|
|
1569
|
+
};
|
|
1570
|
+
table.setPageIndex = updater => {
|
|
1571
|
+
table.setPagination(old => {
|
|
1572
|
+
let pageIndex = functionalUpdate(updater, old.pageIndex);
|
|
1573
|
+
const maxPageIndex = typeof table.options.pageCount === 'undefined' || table.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : table.options.pageCount - 1;
|
|
1574
|
+
pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex));
|
|
1635
1575
|
return {
|
|
1636
1576
|
...old,
|
|
1637
|
-
pageCount: newPageCount
|
|
1638
|
-
};
|
|
1639
|
-
}),
|
|
1640
|
-
getPageOptions: memo(() => [table.getPageCount()], pageCount => {
|
|
1641
|
-
let pageOptions = [];
|
|
1642
|
-
if (pageCount && pageCount > 0) {
|
|
1643
|
-
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
1644
|
-
}
|
|
1645
|
-
return pageOptions;
|
|
1646
|
-
}, {
|
|
1647
|
-
key: 'getPageOptions',
|
|
1648
|
-
debug: () => {
|
|
1649
|
-
var _table$options$debugA;
|
|
1650
|
-
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
1651
|
-
}
|
|
1652
|
-
}),
|
|
1653
|
-
getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,
|
|
1654
|
-
getCanNextPage: () => {
|
|
1655
|
-
const {
|
|
1656
1577
|
pageIndex
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1578
|
+
};
|
|
1579
|
+
});
|
|
1580
|
+
};
|
|
1581
|
+
table.resetPageIndex = defaultState => {
|
|
1582
|
+
var _table$initialState$p2, _table$initialState;
|
|
1583
|
+
table.setPageIndex(defaultState ? defaultPageIndex : (_table$initialState$p2 = (_table$initialState = table.initialState) == null || (_table$initialState = _table$initialState.pagination) == null ? void 0 : _table$initialState.pageIndex) != null ? _table$initialState$p2 : defaultPageIndex);
|
|
1584
|
+
};
|
|
1585
|
+
table.resetPageSize = defaultState => {
|
|
1586
|
+
var _table$initialState$p3, _table$initialState2;
|
|
1587
|
+
table.setPageSize(defaultState ? defaultPageSize : (_table$initialState$p3 = (_table$initialState2 = table.initialState) == null || (_table$initialState2 = _table$initialState2.pagination) == null ? void 0 : _table$initialState2.pageSize) != null ? _table$initialState$p3 : defaultPageSize);
|
|
1588
|
+
};
|
|
1589
|
+
table.setPageSize = updater => {
|
|
1590
|
+
table.setPagination(old => {
|
|
1591
|
+
const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize));
|
|
1592
|
+
const topRowIndex = old.pageSize * old.pageIndex;
|
|
1593
|
+
const pageIndex = Math.floor(topRowIndex / pageSize);
|
|
1594
|
+
return {
|
|
1595
|
+
...old,
|
|
1596
|
+
pageIndex,
|
|
1597
|
+
pageSize
|
|
1598
|
+
};
|
|
1599
|
+
});
|
|
1600
|
+
};
|
|
1601
|
+
table.setPageCount = updater => table.setPagination(old => {
|
|
1602
|
+
var _table$options$pageCo;
|
|
1603
|
+
let newPageCount = functionalUpdate(updater, (_table$options$pageCo = table.options.pageCount) != null ? _table$options$pageCo : -1);
|
|
1604
|
+
if (typeof newPageCount === 'number') {
|
|
1605
|
+
newPageCount = Math.max(-1, newPageCount);
|
|
1606
|
+
}
|
|
1607
|
+
return {
|
|
1608
|
+
...old,
|
|
1609
|
+
pageCount: newPageCount
|
|
1610
|
+
};
|
|
1611
|
+
});
|
|
1612
|
+
table.getPageOptions = memo(() => [table.getPageCount()], pageCount => {
|
|
1613
|
+
let pageOptions = [];
|
|
1614
|
+
if (pageCount && pageCount > 0) {
|
|
1615
|
+
pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
|
|
1688
1616
|
}
|
|
1617
|
+
return pageOptions;
|
|
1618
|
+
}, {
|
|
1619
|
+
key: 'getPageOptions',
|
|
1620
|
+
debug: () => {
|
|
1621
|
+
var _table$options$debugA;
|
|
1622
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
1623
|
+
}
|
|
1624
|
+
});
|
|
1625
|
+
table.getCanPreviousPage = () => table.getState().pagination.pageIndex > 0;
|
|
1626
|
+
table.getCanNextPage = () => {
|
|
1627
|
+
const {
|
|
1628
|
+
pageIndex
|
|
1629
|
+
} = table.getState().pagination;
|
|
1630
|
+
const pageCount = table.getPageCount();
|
|
1631
|
+
if (pageCount === -1) {
|
|
1632
|
+
return true;
|
|
1633
|
+
}
|
|
1634
|
+
if (pageCount === 0) {
|
|
1635
|
+
return false;
|
|
1636
|
+
}
|
|
1637
|
+
return pageIndex < pageCount - 1;
|
|
1638
|
+
};
|
|
1639
|
+
table.previousPage = () => {
|
|
1640
|
+
return table.setPageIndex(old => old - 1);
|
|
1641
|
+
};
|
|
1642
|
+
table.nextPage = () => {
|
|
1643
|
+
return table.setPageIndex(old => {
|
|
1644
|
+
return old + 1;
|
|
1645
|
+
});
|
|
1646
|
+
};
|
|
1647
|
+
table.getPrePaginationRowModel = () => table.getExpandedRowModel();
|
|
1648
|
+
table.getPaginationRowModel = () => {
|
|
1649
|
+
if (!table._getPaginationRowModel && table.options.getPaginationRowModel) {
|
|
1650
|
+
table._getPaginationRowModel = table.options.getPaginationRowModel(table);
|
|
1651
|
+
}
|
|
1652
|
+
if (table.options.manualPagination || !table._getPaginationRowModel) {
|
|
1653
|
+
return table.getPrePaginationRowModel();
|
|
1654
|
+
}
|
|
1655
|
+
return table._getPaginationRowModel();
|
|
1656
|
+
};
|
|
1657
|
+
table.getPageCount = () => {
|
|
1658
|
+
var _table$options$pageCo2;
|
|
1659
|
+
return (_table$options$pageCo2 = table.options.pageCount) != null ? _table$options$pageCo2 : Math.ceil(table.getPrePaginationRowModel().rows.length / table.getState().pagination.pageSize);
|
|
1689
1660
|
};
|
|
1690
1661
|
}
|
|
1691
1662
|
};
|
|
@@ -1709,140 +1680,134 @@
|
|
|
1709
1680
|
};
|
|
1710
1681
|
},
|
|
1711
1682
|
createColumn: (column, table) => {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
var _old$left, _old$right;
|
|
1719
|
-
return {
|
|
1720
|
-
left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
|
|
1721
|
-
right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
|
|
1722
|
-
};
|
|
1723
|
-
}
|
|
1724
|
-
if (position === 'left') {
|
|
1725
|
-
var _old$left2, _old$right2;
|
|
1726
|
-
return {
|
|
1727
|
-
left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
|
|
1728
|
-
right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
|
|
1729
|
-
};
|
|
1730
|
-
}
|
|
1683
|
+
column.pin = position => {
|
|
1684
|
+
const columnIds = column.getLeafColumns().map(d => d.id).filter(Boolean);
|
|
1685
|
+
table.setColumnPinning(old => {
|
|
1686
|
+
var _old$left3, _old$right3;
|
|
1687
|
+
if (position === 'right') {
|
|
1688
|
+
var _old$left, _old$right;
|
|
1731
1689
|
return {
|
|
1732
|
-
left: ((_old$
|
|
1733
|
-
right: ((_old$
|
|
1690
|
+
left: ((_old$left = old == null ? void 0 : old.left) != null ? _old$left : []).filter(d => !(columnIds != null && columnIds.includes(d))),
|
|
1691
|
+
right: [...((_old$right = old == null ? void 0 : old.right) != null ? _old$right : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds]
|
|
1734
1692
|
};
|
|
1735
|
-
});
|
|
1736
|
-
},
|
|
1737
|
-
getCanPin: () => {
|
|
1738
|
-
const leafColumns = column.getLeafColumns();
|
|
1739
|
-
return leafColumns.some(d => {
|
|
1740
|
-
var _d$columnDef$enablePi, _table$options$enable;
|
|
1741
|
-
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
|
|
1742
|
-
});
|
|
1743
|
-
},
|
|
1744
|
-
getIsPinned: () => {
|
|
1745
|
-
const leafColumnIds = column.getLeafColumns().map(d => d.id);
|
|
1746
|
-
const {
|
|
1747
|
-
left,
|
|
1748
|
-
right
|
|
1749
|
-
} = table.getState().columnPinning;
|
|
1750
|
-
const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
|
|
1751
|
-
const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
|
|
1752
|
-
return isLeft ? 'left' : isRight ? 'right' : false;
|
|
1753
|
-
},
|
|
1754
|
-
getPinnedIndex: () => {
|
|
1755
|
-
var _table$getState$colum, _table$getState$colum2;
|
|
1756
|
-
const position = column.getIsPinned();
|
|
1757
|
-
return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
|
|
1758
|
-
}
|
|
1759
|
-
};
|
|
1760
|
-
},
|
|
1761
|
-
createRow: (row, table) => {
|
|
1762
|
-
return {
|
|
1763
|
-
getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
1764
|
-
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
1765
|
-
return allCells.filter(d => !leftAndRight.includes(d.column.id));
|
|
1766
|
-
}, {
|
|
1767
|
-
key: "development" === 'production' ,
|
|
1768
|
-
debug: () => {
|
|
1769
|
-
var _table$options$debugA;
|
|
1770
|
-
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
|
|
1771
|
-
}
|
|
1772
|
-
}),
|
|
1773
|
-
getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
|
|
1774
|
-
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
|
|
1775
|
-
...d,
|
|
1776
|
-
position: 'left'
|
|
1777
|
-
}));
|
|
1778
|
-
return cells;
|
|
1779
|
-
}, {
|
|
1780
|
-
key: "development" === 'production' ,
|
|
1781
|
-
debug: () => {
|
|
1782
|
-
var _table$options$debugA2;
|
|
1783
|
-
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
|
|
1784
1693
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
return cells;
|
|
1792
|
-
}, {
|
|
1793
|
-
key: "development" === 'production' ,
|
|
1794
|
-
debug: () => {
|
|
1795
|
-
var _table$options$debugA3;
|
|
1796
|
-
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
|
|
1694
|
+
if (position === 'left') {
|
|
1695
|
+
var _old$left2, _old$right2;
|
|
1696
|
+
return {
|
|
1697
|
+
left: [...((_old$left2 = old == null ? void 0 : old.left) != null ? _old$left2 : []).filter(d => !(columnIds != null && columnIds.includes(d))), ...columnIds],
|
|
1698
|
+
right: ((_old$right2 = old == null ? void 0 : old.right) != null ? _old$right2 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
|
|
1699
|
+
};
|
|
1797
1700
|
}
|
|
1798
|
-
|
|
1701
|
+
return {
|
|
1702
|
+
left: ((_old$left3 = old == null ? void 0 : old.left) != null ? _old$left3 : []).filter(d => !(columnIds != null && columnIds.includes(d))),
|
|
1703
|
+
right: ((_old$right3 = old == null ? void 0 : old.right) != null ? _old$right3 : []).filter(d => !(columnIds != null && columnIds.includes(d)))
|
|
1704
|
+
};
|
|
1705
|
+
});
|
|
1706
|
+
};
|
|
1707
|
+
column.getCanPin = () => {
|
|
1708
|
+
const leafColumns = column.getLeafColumns();
|
|
1709
|
+
return leafColumns.some(d => {
|
|
1710
|
+
var _d$columnDef$enablePi, _table$options$enable;
|
|
1711
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_table$options$enable = table.options.enablePinning) != null ? _table$options$enable : true);
|
|
1712
|
+
});
|
|
1713
|
+
};
|
|
1714
|
+
column.getIsPinned = () => {
|
|
1715
|
+
const leafColumnIds = column.getLeafColumns().map(d => d.id);
|
|
1716
|
+
const {
|
|
1717
|
+
left,
|
|
1718
|
+
right
|
|
1719
|
+
} = table.getState().columnPinning;
|
|
1720
|
+
const isLeft = leafColumnIds.some(d => left == null ? void 0 : left.includes(d));
|
|
1721
|
+
const isRight = leafColumnIds.some(d => right == null ? void 0 : right.includes(d));
|
|
1722
|
+
return isLeft ? 'left' : isRight ? 'right' : false;
|
|
1723
|
+
};
|
|
1724
|
+
column.getPinnedIndex = () => {
|
|
1725
|
+
var _table$getState$colum, _table$getState$colum2;
|
|
1726
|
+
const position = column.getIsPinned();
|
|
1727
|
+
return position ? (_table$getState$colum = (_table$getState$colum2 = table.getState().columnPinning) == null || (_table$getState$colum2 = _table$getState$colum2[position]) == null ? void 0 : _table$getState$colum2.indexOf(column.id)) != null ? _table$getState$colum : -1 : 0;
|
|
1799
1728
|
};
|
|
1800
1729
|
},
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1730
|
+
createRow: (row, table) => {
|
|
1731
|
+
row.getCenterVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
|
|
1732
|
+
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
1733
|
+
return allCells.filter(d => !leftAndRight.includes(d.column.id));
|
|
1734
|
+
}, {
|
|
1735
|
+
key: "development" === 'production' ,
|
|
1736
|
+
debug: () => {
|
|
1737
|
+
var _table$options$debugA;
|
|
1738
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
row.getLeftVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
|
|
1742
|
+
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
|
|
1743
|
+
...d,
|
|
1744
|
+
position: 'left'
|
|
1745
|
+
}));
|
|
1746
|
+
return cells;
|
|
1747
|
+
}, {
|
|
1748
|
+
key: "development" === 'production' ,
|
|
1749
|
+
debug: () => {
|
|
1750
|
+
var _table$options$debugA2;
|
|
1751
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1754
|
+
row.getRightVisibleCells = memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
|
|
1755
|
+
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
|
|
1756
|
+
...d,
|
|
1757
|
+
position: 'right'
|
|
1758
|
+
}));
|
|
1759
|
+
return cells;
|
|
1760
|
+
}, {
|
|
1761
|
+
key: "development" === 'production' ,
|
|
1762
|
+
debug: () => {
|
|
1763
|
+
var _table$options$debugA3;
|
|
1764
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugRows;
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
},
|
|
1768
|
+
createTable: table => {
|
|
1769
|
+
table.setColumnPinning = updater => table.options.onColumnPinningChange == null ? void 0 : table.options.onColumnPinningChange(updater);
|
|
1770
|
+
table.resetColumnPinning = defaultState => {
|
|
1771
|
+
var _table$initialState$c, _table$initialState;
|
|
1772
|
+
return table.setColumnPinning(defaultState ? getDefaultPinningState() : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnPinning) != null ? _table$initialState$c : getDefaultPinningState());
|
|
1773
|
+
};
|
|
1774
|
+
table.getIsSomeColumnsPinned = position => {
|
|
1775
|
+
var _pinningState$positio;
|
|
1776
|
+
const pinningState = table.getState().columnPinning;
|
|
1777
|
+
if (!position) {
|
|
1778
|
+
var _pinningState$left, _pinningState$right;
|
|
1779
|
+
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
|
|
1780
|
+
}
|
|
1781
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
1845
1782
|
};
|
|
1783
|
+
table.getLeftLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
|
|
1784
|
+
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
1785
|
+
}, {
|
|
1786
|
+
key: 'getLeftLeafColumns',
|
|
1787
|
+
debug: () => {
|
|
1788
|
+
var _table$options$debugA4;
|
|
1789
|
+
return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
table.getRightLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
|
|
1793
|
+
return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
1794
|
+
}, {
|
|
1795
|
+
key: 'getRightLeafColumns',
|
|
1796
|
+
debug: () => {
|
|
1797
|
+
var _table$options$debugA5;
|
|
1798
|
+
return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
|
|
1799
|
+
}
|
|
1800
|
+
});
|
|
1801
|
+
table.getCenterLeafColumns = memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
|
|
1802
|
+
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
1803
|
+
return allColumns.filter(d => !leftAndRight.includes(d.id));
|
|
1804
|
+
}, {
|
|
1805
|
+
key: 'getCenterLeafColumns',
|
|
1806
|
+
debug: () => {
|
|
1807
|
+
var _table$options$debugA6;
|
|
1808
|
+
return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugColumns;
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1846
1811
|
}
|
|
1847
1812
|
};
|
|
1848
1813
|
|
|
@@ -1868,278 +1833,276 @@
|
|
|
1868
1833
|
},
|
|
1869
1834
|
|
|
1870
1835
|
createTable: table => {
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
table.
|
|
1879
|
-
value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
|
|
1880
|
-
const rowSelection = {
|
|
1881
|
-
...old
|
|
1882
|
-
};
|
|
1883
|
-
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
|
|
1884
|
-
|
|
1885
|
-
// We don't use `mutateRowIsSelected` here for performance reasons.
|
|
1886
|
-
// All of the rows are flat already, so it wouldn't be worth it
|
|
1887
|
-
if (value) {
|
|
1888
|
-
preGroupedFlatRows.forEach(row => {
|
|
1889
|
-
if (!row.getCanSelect()) {
|
|
1890
|
-
return;
|
|
1891
|
-
}
|
|
1892
|
-
rowSelection[row.id] = true;
|
|
1893
|
-
});
|
|
1894
|
-
} else {
|
|
1895
|
-
preGroupedFlatRows.forEach(row => {
|
|
1896
|
-
delete rowSelection[row.id];
|
|
1897
|
-
});
|
|
1898
|
-
}
|
|
1899
|
-
return rowSelection;
|
|
1900
|
-
});
|
|
1901
|
-
},
|
|
1902
|
-
toggleAllPageRowsSelected: value => table.setRowSelection(old => {
|
|
1903
|
-
const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
|
|
1836
|
+
table.setRowSelection = updater => table.options.onRowSelectionChange == null ? void 0 : table.options.onRowSelectionChange(updater);
|
|
1837
|
+
table.resetRowSelection = defaultState => {
|
|
1838
|
+
var _table$initialState$r;
|
|
1839
|
+
return table.setRowSelection(defaultState ? {} : (_table$initialState$r = table.initialState.rowSelection) != null ? _table$initialState$r : {});
|
|
1840
|
+
};
|
|
1841
|
+
table.toggleAllRowsSelected = value => {
|
|
1842
|
+
table.setRowSelection(old => {
|
|
1843
|
+
value = typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected();
|
|
1904
1844
|
const rowSelection = {
|
|
1905
1845
|
...old
|
|
1906
1846
|
};
|
|
1907
|
-
table.
|
|
1908
|
-
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
|
|
1909
|
-
});
|
|
1910
|
-
return rowSelection;
|
|
1911
|
-
}),
|
|
1912
|
-
// addRowSelectionRange: rowId => {
|
|
1913
|
-
// const {
|
|
1914
|
-
// rows,
|
|
1915
|
-
// rowsById,
|
|
1916
|
-
// options: { selectGroupingRows, selectSubRows },
|
|
1917
|
-
// } = table
|
|
1918
|
-
|
|
1919
|
-
// const findSelectedRow = (rows: Row[]) => {
|
|
1920
|
-
// let found
|
|
1921
|
-
// rows.find(d => {
|
|
1922
|
-
// if (d.getIsSelected()) {
|
|
1923
|
-
// found = d
|
|
1924
|
-
// return true
|
|
1925
|
-
// }
|
|
1926
|
-
// const subFound = findSelectedRow(d.subRows || [])
|
|
1927
|
-
// if (subFound) {
|
|
1928
|
-
// found = subFound
|
|
1929
|
-
// return true
|
|
1930
|
-
// }
|
|
1931
|
-
// return false
|
|
1932
|
-
// })
|
|
1933
|
-
// return found
|
|
1934
|
-
// }
|
|
1935
|
-
|
|
1936
|
-
// const firstRow = findSelectedRow(rows) || rows[0]
|
|
1937
|
-
// const lastRow = rowsById[rowId]
|
|
1938
|
-
|
|
1939
|
-
// let include = false
|
|
1940
|
-
// const selectedRowIds = {}
|
|
1941
|
-
|
|
1942
|
-
// const addRow = (row: Row) => {
|
|
1943
|
-
// mutateRowIsSelected(selectedRowIds, row.id, true, {
|
|
1944
|
-
// rowsById,
|
|
1945
|
-
// selectGroupingRows: selectGroupingRows!,
|
|
1946
|
-
// selectSubRows: selectSubRows!,
|
|
1947
|
-
// })
|
|
1948
|
-
// }
|
|
1949
|
-
|
|
1950
|
-
// table.rows.forEach(row => {
|
|
1951
|
-
// const isFirstRow = row.id === firstRow.id
|
|
1952
|
-
// const isLastRow = row.id === lastRow.id
|
|
1953
|
-
|
|
1954
|
-
// if (isFirstRow || isLastRow) {
|
|
1955
|
-
// if (!include) {
|
|
1956
|
-
// include = true
|
|
1957
|
-
// } else if (include) {
|
|
1958
|
-
// addRow(row)
|
|
1959
|
-
// include = false
|
|
1960
|
-
// }
|
|
1961
|
-
// }
|
|
1962
|
-
|
|
1963
|
-
// if (include) {
|
|
1964
|
-
// addRow(row)
|
|
1965
|
-
// }
|
|
1966
|
-
// })
|
|
1847
|
+
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
|
|
1967
1848
|
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
key: 'getSelectedRowModel',
|
|
1982
|
-
debug: () => {
|
|
1983
|
-
var _table$options$debugA;
|
|
1984
|
-
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
1985
|
-
}
|
|
1986
|
-
}),
|
|
1987
|
-
getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
1988
|
-
if (!Object.keys(rowSelection).length) {
|
|
1989
|
-
return {
|
|
1990
|
-
rows: [],
|
|
1991
|
-
flatRows: [],
|
|
1992
|
-
rowsById: {}
|
|
1993
|
-
};
|
|
1994
|
-
}
|
|
1995
|
-
return selectRowsFn(table, rowModel);
|
|
1996
|
-
}, {
|
|
1997
|
-
key: "development" === 'production' ,
|
|
1998
|
-
debug: () => {
|
|
1999
|
-
var _table$options$debugA2;
|
|
2000
|
-
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
|
|
2001
|
-
}
|
|
2002
|
-
}),
|
|
2003
|
-
getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
2004
|
-
if (!Object.keys(rowSelection).length) {
|
|
2005
|
-
return {
|
|
2006
|
-
rows: [],
|
|
2007
|
-
flatRows: [],
|
|
2008
|
-
rowsById: {}
|
|
2009
|
-
};
|
|
2010
|
-
}
|
|
2011
|
-
return selectRowsFn(table, rowModel);
|
|
2012
|
-
}, {
|
|
2013
|
-
key: "development" === 'production' ,
|
|
2014
|
-
debug: () => {
|
|
2015
|
-
var _table$options$debugA3;
|
|
2016
|
-
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
|
|
2017
|
-
}
|
|
2018
|
-
}),
|
|
2019
|
-
///
|
|
2020
|
-
|
|
2021
|
-
// getGroupingRowCanSelect: rowId => {
|
|
2022
|
-
// const row = table.getRow(rowId)
|
|
2023
|
-
|
|
2024
|
-
// if (!row) {
|
|
2025
|
-
// throw new Error()
|
|
2026
|
-
// }
|
|
2027
|
-
|
|
2028
|
-
// if (typeof table.options.enableGroupingRowSelection === 'function') {
|
|
2029
|
-
// return table.options.enableGroupingRowSelection(row)
|
|
2030
|
-
// }
|
|
2031
|
-
|
|
2032
|
-
// return table.options.enableGroupingRowSelection ?? false
|
|
2033
|
-
// },
|
|
2034
|
-
|
|
2035
|
-
getIsAllRowsSelected: () => {
|
|
2036
|
-
const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
|
|
2037
|
-
const {
|
|
2038
|
-
rowSelection
|
|
2039
|
-
} = table.getState();
|
|
2040
|
-
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
|
|
2041
|
-
if (isAllRowsSelected) {
|
|
2042
|
-
if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
|
|
2043
|
-
isAllRowsSelected = false;
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
return isAllRowsSelected;
|
|
2047
|
-
},
|
|
2048
|
-
getIsAllPageRowsSelected: () => {
|
|
2049
|
-
const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());
|
|
2050
|
-
const {
|
|
2051
|
-
rowSelection
|
|
2052
|
-
} = table.getState();
|
|
2053
|
-
let isAllPageRowsSelected = !!paginationFlatRows.length;
|
|
2054
|
-
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
|
|
2055
|
-
isAllPageRowsSelected = false;
|
|
1849
|
+
// We don't use `mutateRowIsSelected` here for performance reasons.
|
|
1850
|
+
// All of the rows are flat already, so it wouldn't be worth it
|
|
1851
|
+
if (value) {
|
|
1852
|
+
preGroupedFlatRows.forEach(row => {
|
|
1853
|
+
if (!row.getCanSelect()) {
|
|
1854
|
+
return;
|
|
1855
|
+
}
|
|
1856
|
+
rowSelection[row.id] = true;
|
|
1857
|
+
});
|
|
1858
|
+
} else {
|
|
1859
|
+
preGroupedFlatRows.forEach(row => {
|
|
1860
|
+
delete rowSelection[row.id];
|
|
1861
|
+
});
|
|
2056
1862
|
}
|
|
2057
|
-
return
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
1863
|
+
return rowSelection;
|
|
1864
|
+
});
|
|
1865
|
+
};
|
|
1866
|
+
table.toggleAllPageRowsSelected = value => table.setRowSelection(old => {
|
|
1867
|
+
const resolvedValue = typeof value !== 'undefined' ? value : !table.getIsAllPageRowsSelected();
|
|
1868
|
+
const rowSelection = {
|
|
1869
|
+
...old
|
|
1870
|
+
};
|
|
1871
|
+
table.getRowModel().rows.forEach(row => {
|
|
1872
|
+
mutateRowIsSelected(rowSelection, row.id, resolvedValue, table);
|
|
1873
|
+
});
|
|
1874
|
+
return rowSelection;
|
|
1875
|
+
});
|
|
1876
|
+
|
|
1877
|
+
// addRowSelectionRange: rowId => {
|
|
1878
|
+
// const {
|
|
1879
|
+
// rows,
|
|
1880
|
+
// rowsById,
|
|
1881
|
+
// options: { selectGroupingRows, selectSubRows },
|
|
1882
|
+
// } = table
|
|
1883
|
+
|
|
1884
|
+
// const findSelectedRow = (rows: Row[]) => {
|
|
1885
|
+
// let found
|
|
1886
|
+
// rows.find(d => {
|
|
1887
|
+
// if (d.getIsSelected()) {
|
|
1888
|
+
// found = d
|
|
1889
|
+
// return true
|
|
1890
|
+
// }
|
|
1891
|
+
// const subFound = findSelectedRow(d.subRows || [])
|
|
1892
|
+
// if (subFound) {
|
|
1893
|
+
// found = subFound
|
|
1894
|
+
// return true
|
|
1895
|
+
// }
|
|
1896
|
+
// return false
|
|
1897
|
+
// })
|
|
1898
|
+
// return found
|
|
1899
|
+
// }
|
|
1900
|
+
|
|
1901
|
+
// const firstRow = findSelectedRow(rows) || rows[0]
|
|
1902
|
+
// const lastRow = rowsById[rowId]
|
|
1903
|
+
|
|
1904
|
+
// let include = false
|
|
1905
|
+
// const selectedRowIds = {}
|
|
1906
|
+
|
|
1907
|
+
// const addRow = (row: Row) => {
|
|
1908
|
+
// mutateRowIsSelected(selectedRowIds, row.id, true, {
|
|
1909
|
+
// rowsById,
|
|
1910
|
+
// selectGroupingRows: selectGroupingRows!,
|
|
1911
|
+
// selectSubRows: selectSubRows!,
|
|
1912
|
+
// })
|
|
1913
|
+
// }
|
|
1914
|
+
|
|
1915
|
+
// table.rows.forEach(row => {
|
|
1916
|
+
// const isFirstRow = row.id === firstRow.id
|
|
1917
|
+
// const isLastRow = row.id === lastRow.id
|
|
1918
|
+
|
|
1919
|
+
// if (isFirstRow || isLastRow) {
|
|
1920
|
+
// if (!include) {
|
|
1921
|
+
// include = true
|
|
1922
|
+
// } else if (include) {
|
|
1923
|
+
// addRow(row)
|
|
1924
|
+
// include = false
|
|
1925
|
+
// }
|
|
1926
|
+
// }
|
|
1927
|
+
|
|
1928
|
+
// if (include) {
|
|
1929
|
+
// addRow(row)
|
|
1930
|
+
// }
|
|
1931
|
+
// })
|
|
1932
|
+
|
|
1933
|
+
// table.setRowSelection(selectedRowIds)
|
|
1934
|
+
// },
|
|
1935
|
+
table.getPreSelectedRowModel = () => table.getCoreRowModel();
|
|
1936
|
+
table.getSelectedRowModel = memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
|
|
1937
|
+
if (!Object.keys(rowSelection).length) {
|
|
1938
|
+
return {
|
|
1939
|
+
rows: [],
|
|
1940
|
+
flatRows: [],
|
|
1941
|
+
rowsById: {}
|
|
2071
1942
|
};
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
1943
|
+
}
|
|
1944
|
+
return selectRowsFn(table, rowModel);
|
|
1945
|
+
}, {
|
|
1946
|
+
key: 'getSelectedRowModel',
|
|
1947
|
+
debug: () => {
|
|
1948
|
+
var _table$options$debugA;
|
|
1949
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
table.getFilteredSelectedRowModel = memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
|
|
1953
|
+
if (!Object.keys(rowSelection).length) {
|
|
1954
|
+
return {
|
|
1955
|
+
rows: [],
|
|
1956
|
+
flatRows: [],
|
|
1957
|
+
rowsById: {}
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
return selectRowsFn(table, rowModel);
|
|
1961
|
+
}, {
|
|
1962
|
+
key: "development" === 'production' ,
|
|
1963
|
+
debug: () => {
|
|
1964
|
+
var _table$options$debugA2;
|
|
1965
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1968
|
+
table.getGroupedSelectedRowModel = memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
1969
|
+
if (!Object.keys(rowSelection).length) {
|
|
1970
|
+
return {
|
|
1971
|
+
rows: [],
|
|
1972
|
+
flatRows: [],
|
|
1973
|
+
rowsById: {}
|
|
2076
1974
|
};
|
|
2077
1975
|
}
|
|
1976
|
+
return selectRowsFn(table, rowModel);
|
|
1977
|
+
}, {
|
|
1978
|
+
key: "development" === 'production' ,
|
|
1979
|
+
debug: () => {
|
|
1980
|
+
var _table$options$debugA3;
|
|
1981
|
+
return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugTable;
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
|
|
1985
|
+
///
|
|
1986
|
+
|
|
1987
|
+
// getGroupingRowCanSelect: rowId => {
|
|
1988
|
+
// const row = table.getRow(rowId)
|
|
1989
|
+
|
|
1990
|
+
// if (!row) {
|
|
1991
|
+
// throw new Error()
|
|
1992
|
+
// }
|
|
1993
|
+
|
|
1994
|
+
// if (typeof table.options.enableGroupingRowSelection === 'function') {
|
|
1995
|
+
// return table.options.enableGroupingRowSelection(row)
|
|
1996
|
+
// }
|
|
1997
|
+
|
|
1998
|
+
// return table.options.enableGroupingRowSelection ?? false
|
|
1999
|
+
// },
|
|
2000
|
+
|
|
2001
|
+
table.getIsAllRowsSelected = () => {
|
|
2002
|
+
const preGroupedFlatRows = table.getFilteredRowModel().flatRows;
|
|
2003
|
+
const {
|
|
2004
|
+
rowSelection
|
|
2005
|
+
} = table.getState();
|
|
2006
|
+
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
|
|
2007
|
+
if (isAllRowsSelected) {
|
|
2008
|
+
if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
|
|
2009
|
+
isAllRowsSelected = false;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
return isAllRowsSelected;
|
|
2013
|
+
};
|
|
2014
|
+
table.getIsAllPageRowsSelected = () => {
|
|
2015
|
+
const paginationFlatRows = table.getPaginationRowModel().flatRows.filter(row => row.getCanSelect());
|
|
2016
|
+
const {
|
|
2017
|
+
rowSelection
|
|
2018
|
+
} = table.getState();
|
|
2019
|
+
let isAllPageRowsSelected = !!paginationFlatRows.length;
|
|
2020
|
+
if (isAllPageRowsSelected && paginationFlatRows.some(row => !rowSelection[row.id])) {
|
|
2021
|
+
isAllPageRowsSelected = false;
|
|
2022
|
+
}
|
|
2023
|
+
return isAllPageRowsSelected;
|
|
2024
|
+
};
|
|
2025
|
+
table.getIsSomeRowsSelected = () => {
|
|
2026
|
+
var _table$getState$rowSe;
|
|
2027
|
+
const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
|
|
2028
|
+
return totalSelected > 0 && totalSelected < table.getFilteredRowModel().flatRows.length;
|
|
2029
|
+
};
|
|
2030
|
+
table.getIsSomePageRowsSelected = () => {
|
|
2031
|
+
const paginationFlatRows = table.getPaginationRowModel().flatRows;
|
|
2032
|
+
return table.getIsAllPageRowsSelected() ? false : paginationFlatRows.filter(row => row.getCanSelect()).some(d => d.getIsSelected() || d.getIsSomeSelected());
|
|
2033
|
+
};
|
|
2034
|
+
table.getToggleAllRowsSelectedHandler = () => {
|
|
2035
|
+
return e => {
|
|
2036
|
+
table.toggleAllRowsSelected(e.target.checked);
|
|
2037
|
+
};
|
|
2038
|
+
};
|
|
2039
|
+
table.getToggleAllPageRowsSelectedHandler = () => {
|
|
2040
|
+
return e => {
|
|
2041
|
+
table.toggleAllPageRowsSelected(e.target.checked);
|
|
2042
|
+
};
|
|
2078
2043
|
};
|
|
2079
2044
|
},
|
|
2080
2045
|
createRow: (row, table) => {
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
return old;
|
|
2088
|
-
}
|
|
2089
|
-
const selectedRowIds = {
|
|
2090
|
-
...old
|
|
2091
|
-
};
|
|
2092
|
-
mutateRowIsSelected(selectedRowIds, row.id, value, table);
|
|
2093
|
-
return selectedRowIds;
|
|
2094
|
-
});
|
|
2095
|
-
},
|
|
2096
|
-
getIsSelected: () => {
|
|
2097
|
-
const {
|
|
2098
|
-
rowSelection
|
|
2099
|
-
} = table.getState();
|
|
2100
|
-
return isRowSelected(row, rowSelection);
|
|
2101
|
-
},
|
|
2102
|
-
getIsSomeSelected: () => {
|
|
2103
|
-
const {
|
|
2104
|
-
rowSelection
|
|
2105
|
-
} = table.getState();
|
|
2106
|
-
return isSubRowSelected(row, rowSelection) === 'some';
|
|
2107
|
-
},
|
|
2108
|
-
getIsAllSubRowsSelected: () => {
|
|
2109
|
-
const {
|
|
2110
|
-
rowSelection
|
|
2111
|
-
} = table.getState();
|
|
2112
|
-
return isSubRowSelected(row, rowSelection) === 'all';
|
|
2113
|
-
},
|
|
2114
|
-
getCanSelect: () => {
|
|
2115
|
-
var _table$options$enable;
|
|
2116
|
-
if (typeof table.options.enableRowSelection === 'function') {
|
|
2117
|
-
return table.options.enableRowSelection(row);
|
|
2118
|
-
}
|
|
2119
|
-
return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
|
|
2120
|
-
},
|
|
2121
|
-
getCanSelectSubRows: () => {
|
|
2122
|
-
var _table$options$enable2;
|
|
2123
|
-
if (typeof table.options.enableSubRowSelection === 'function') {
|
|
2124
|
-
return table.options.enableSubRowSelection(row);
|
|
2125
|
-
}
|
|
2126
|
-
return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
|
|
2127
|
-
},
|
|
2128
|
-
getCanMultiSelect: () => {
|
|
2129
|
-
var _table$options$enable3;
|
|
2130
|
-
if (typeof table.options.enableMultiRowSelection === 'function') {
|
|
2131
|
-
return table.options.enableMultiRowSelection(row);
|
|
2046
|
+
row.toggleSelected = value => {
|
|
2047
|
+
const isSelected = row.getIsSelected();
|
|
2048
|
+
table.setRowSelection(old => {
|
|
2049
|
+
value = typeof value !== 'undefined' ? value : !isSelected;
|
|
2050
|
+
if (isSelected === value) {
|
|
2051
|
+
return old;
|
|
2132
2052
|
}
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
getToggleSelectedHandler: () => {
|
|
2136
|
-
const canSelect = row.getCanSelect();
|
|
2137
|
-
return e => {
|
|
2138
|
-
var _target;
|
|
2139
|
-
if (!canSelect) return;
|
|
2140
|
-
row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
|
|
2053
|
+
const selectedRowIds = {
|
|
2054
|
+
...old
|
|
2141
2055
|
};
|
|
2056
|
+
mutateRowIsSelected(selectedRowIds, row.id, value, table);
|
|
2057
|
+
return selectedRowIds;
|
|
2058
|
+
});
|
|
2059
|
+
};
|
|
2060
|
+
row.getIsSelected = () => {
|
|
2061
|
+
const {
|
|
2062
|
+
rowSelection
|
|
2063
|
+
} = table.getState();
|
|
2064
|
+
return isRowSelected(row, rowSelection);
|
|
2065
|
+
};
|
|
2066
|
+
row.getIsSomeSelected = () => {
|
|
2067
|
+
const {
|
|
2068
|
+
rowSelection
|
|
2069
|
+
} = table.getState();
|
|
2070
|
+
return isSubRowSelected(row, rowSelection) === 'some';
|
|
2071
|
+
};
|
|
2072
|
+
row.getIsAllSubRowsSelected = () => {
|
|
2073
|
+
const {
|
|
2074
|
+
rowSelection
|
|
2075
|
+
} = table.getState();
|
|
2076
|
+
return isSubRowSelected(row, rowSelection) === 'all';
|
|
2077
|
+
};
|
|
2078
|
+
row.getCanSelect = () => {
|
|
2079
|
+
var _table$options$enable;
|
|
2080
|
+
if (typeof table.options.enableRowSelection === 'function') {
|
|
2081
|
+
return table.options.enableRowSelection(row);
|
|
2082
|
+
}
|
|
2083
|
+
return (_table$options$enable = table.options.enableRowSelection) != null ? _table$options$enable : true;
|
|
2084
|
+
};
|
|
2085
|
+
row.getCanSelectSubRows = () => {
|
|
2086
|
+
var _table$options$enable2;
|
|
2087
|
+
if (typeof table.options.enableSubRowSelection === 'function') {
|
|
2088
|
+
return table.options.enableSubRowSelection(row);
|
|
2089
|
+
}
|
|
2090
|
+
return (_table$options$enable2 = table.options.enableSubRowSelection) != null ? _table$options$enable2 : true;
|
|
2091
|
+
};
|
|
2092
|
+
row.getCanMultiSelect = () => {
|
|
2093
|
+
var _table$options$enable3;
|
|
2094
|
+
if (typeof table.options.enableMultiRowSelection === 'function') {
|
|
2095
|
+
return table.options.enableMultiRowSelection(row);
|
|
2142
2096
|
}
|
|
2097
|
+
return (_table$options$enable3 = table.options.enableMultiRowSelection) != null ? _table$options$enable3 : true;
|
|
2098
|
+
};
|
|
2099
|
+
row.getToggleSelectedHandler = () => {
|
|
2100
|
+
const canSelect = row.getCanSelect();
|
|
2101
|
+
return e => {
|
|
2102
|
+
var _target;
|
|
2103
|
+
if (!canSelect) return;
|
|
2104
|
+
row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
|
|
2105
|
+
};
|
|
2143
2106
|
};
|
|
2144
2107
|
}
|
|
2145
2108
|
};
|
|
@@ -2353,191 +2316,187 @@
|
|
|
2353
2316
|
};
|
|
2354
2317
|
},
|
|
2355
2318
|
createColumn: (column, table) => {
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
return sortingFns.datetime;
|
|
2364
|
-
}
|
|
2365
|
-
if (typeof value === 'string') {
|
|
2366
|
-
isString = true;
|
|
2367
|
-
if (value.split(reSplitAlphaNumeric).length > 1) {
|
|
2368
|
-
return sortingFns.alphanumeric;
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
if (isString) {
|
|
2373
|
-
return sortingFns.text;
|
|
2319
|
+
column.getAutoSortingFn = () => {
|
|
2320
|
+
const firstRows = table.getFilteredRowModel().flatRows.slice(10);
|
|
2321
|
+
let isString = false;
|
|
2322
|
+
for (const row of firstRows) {
|
|
2323
|
+
const value = row == null ? void 0 : row.getValue(column.id);
|
|
2324
|
+
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
2325
|
+
return sortingFns.datetime;
|
|
2374
2326
|
}
|
|
2375
|
-
return sortingFns.basic;
|
|
2376
|
-
},
|
|
2377
|
-
getAutoSortDir: () => {
|
|
2378
|
-
const firstRow = table.getFilteredRowModel().flatRows[0];
|
|
2379
|
-
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
2380
2327
|
if (typeof value === 'string') {
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
getSortingFn: () => {
|
|
2386
|
-
var _table$options$sortin, _table$options$sortin2;
|
|
2387
|
-
if (!column) {
|
|
2388
|
-
throw new Error();
|
|
2328
|
+
isString = true;
|
|
2329
|
+
if (value.split(reSplitAlphaNumeric).length > 1) {
|
|
2330
|
+
return sortingFns.alphanumeric;
|
|
2331
|
+
}
|
|
2389
2332
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2333
|
+
}
|
|
2334
|
+
if (isString) {
|
|
2335
|
+
return sortingFns.text;
|
|
2336
|
+
}
|
|
2337
|
+
return sortingFns.basic;
|
|
2338
|
+
};
|
|
2339
|
+
column.getAutoSortDir = () => {
|
|
2340
|
+
const firstRow = table.getFilteredRowModel().flatRows[0];
|
|
2341
|
+
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
2342
|
+
if (typeof value === 'string') {
|
|
2343
|
+
return 'asc';
|
|
2344
|
+
}
|
|
2345
|
+
return 'desc';
|
|
2346
|
+
};
|
|
2347
|
+
column.getSortingFn = () => {
|
|
2348
|
+
var _table$options$sortin, _table$options$sortin2;
|
|
2349
|
+
if (!column) {
|
|
2350
|
+
throw new Error();
|
|
2351
|
+
}
|
|
2352
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_table$options$sortin = (_table$options$sortin2 = table.options.sortingFns) == null ? void 0 : _table$options$sortin2[column.columnDef.sortingFn]) != null ? _table$options$sortin : sortingFns[column.columnDef.sortingFn];
|
|
2353
|
+
};
|
|
2354
|
+
column.toggleSorting = (desc, multi) => {
|
|
2355
|
+
// if (column.columns.length) {
|
|
2356
|
+
// column.columns.forEach((c, i) => {
|
|
2357
|
+
// if (c.id) {
|
|
2358
|
+
// table.toggleColumnSorting(c.id, undefined, multi || !!i)
|
|
2359
|
+
// }
|
|
2360
|
+
// })
|
|
2361
|
+
// return
|
|
2362
|
+
// }
|
|
2401
2363
|
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
} else {
|
|
2420
|
-
sortAction = 'add';
|
|
2421
|
-
}
|
|
2364
|
+
// this needs to be outside of table.setSorting to be in sync with rerender
|
|
2365
|
+
const nextSortingOrder = column.getNextSortingOrder();
|
|
2366
|
+
const hasManualValue = typeof desc !== 'undefined' && desc !== null;
|
|
2367
|
+
table.setSorting(old => {
|
|
2368
|
+
// Find any existing sorting for this column
|
|
2369
|
+
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
2370
|
+
const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
|
|
2371
|
+
let newSorting = [];
|
|
2372
|
+
|
|
2373
|
+
// What should we do with this sort action?
|
|
2374
|
+
let sortAction;
|
|
2375
|
+
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc';
|
|
2376
|
+
|
|
2377
|
+
// Multi-mode
|
|
2378
|
+
if (old != null && old.length && column.getCanMultiSort() && multi) {
|
|
2379
|
+
if (existingSorting) {
|
|
2380
|
+
sortAction = 'toggle';
|
|
2422
2381
|
} else {
|
|
2423
|
-
|
|
2424
|
-
if (old != null && old.length && existingIndex !== old.length - 1) {
|
|
2425
|
-
sortAction = 'replace';
|
|
2426
|
-
} else if (existingSorting) {
|
|
2427
|
-
sortAction = 'toggle';
|
|
2428
|
-
} else {
|
|
2429
|
-
sortAction = 'replace';
|
|
2430
|
-
}
|
|
2382
|
+
sortAction = 'add';
|
|
2431
2383
|
}
|
|
2384
|
+
} else {
|
|
2385
|
+
// Normal mode
|
|
2386
|
+
if (old != null && old.length && existingIndex !== old.length - 1) {
|
|
2387
|
+
sortAction = 'replace';
|
|
2388
|
+
} else if (existingSorting) {
|
|
2389
|
+
sortAction = 'toggle';
|
|
2390
|
+
} else {
|
|
2391
|
+
sortAction = 'replace';
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2432
2394
|
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
}
|
|
2395
|
+
// Handle toggle states that will remove the sorting
|
|
2396
|
+
if (sortAction === 'toggle') {
|
|
2397
|
+
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
|
|
2398
|
+
if (!hasManualValue) {
|
|
2399
|
+
// Is our intention to remove?
|
|
2400
|
+
if (!nextSortingOrder) {
|
|
2401
|
+
sortAction = 'remove';
|
|
2441
2402
|
}
|
|
2442
2403
|
}
|
|
2443
|
-
if (sortAction === 'add') {
|
|
2444
|
-
var _table$options$maxMul;
|
|
2445
|
-
newSorting = [...old, {
|
|
2446
|
-
id: column.id,
|
|
2447
|
-
desc: nextDesc
|
|
2448
|
-
}];
|
|
2449
|
-
// Take latest n columns
|
|
2450
|
-
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
|
|
2451
|
-
} else if (sortAction === 'toggle') {
|
|
2452
|
-
// This flips (or sets) the
|
|
2453
|
-
newSorting = old.map(d => {
|
|
2454
|
-
if (d.id === column.id) {
|
|
2455
|
-
return {
|
|
2456
|
-
...d,
|
|
2457
|
-
desc: nextDesc
|
|
2458
|
-
};
|
|
2459
|
-
}
|
|
2460
|
-
return d;
|
|
2461
|
-
});
|
|
2462
|
-
} else if (sortAction === 'remove') {
|
|
2463
|
-
newSorting = old.filter(d => d.id !== column.id);
|
|
2464
|
-
} else {
|
|
2465
|
-
newSorting = [{
|
|
2466
|
-
id: column.id,
|
|
2467
|
-
desc: nextDesc
|
|
2468
|
-
}];
|
|
2469
|
-
}
|
|
2470
|
-
return newSorting;
|
|
2471
|
-
});
|
|
2472
|
-
},
|
|
2473
|
-
getFirstSortDir: () => {
|
|
2474
|
-
var _ref, _column$columnDef$sor;
|
|
2475
|
-
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
|
|
2476
|
-
return sortDescFirst ? 'desc' : 'asc';
|
|
2477
|
-
},
|
|
2478
|
-
getNextSortingOrder: multi => {
|
|
2479
|
-
var _table$options$enable, _table$options$enable2;
|
|
2480
|
-
const firstSortDirection = column.getFirstSortDir();
|
|
2481
|
-
const isSorted = column.getIsSorted();
|
|
2482
|
-
if (!isSorted) {
|
|
2483
|
-
return firstSortDirection;
|
|
2484
2404
|
}
|
|
2485
|
-
if (
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2405
|
+
if (sortAction === 'add') {
|
|
2406
|
+
var _table$options$maxMul;
|
|
2407
|
+
newSorting = [...old, {
|
|
2408
|
+
id: column.id,
|
|
2409
|
+
desc: nextDesc
|
|
2410
|
+
}];
|
|
2411
|
+
// Take latest n columns
|
|
2412
|
+
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
|
|
2413
|
+
} else if (sortAction === 'toggle') {
|
|
2414
|
+
// This flips (or sets) the
|
|
2415
|
+
newSorting = old.map(d => {
|
|
2416
|
+
if (d.id === column.id) {
|
|
2417
|
+
return {
|
|
2418
|
+
...d,
|
|
2419
|
+
desc: nextDesc
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
return d;
|
|
2423
|
+
});
|
|
2424
|
+
} else if (sortAction === 'remove') {
|
|
2425
|
+
newSorting = old.filter(d => d.id !== column.id);
|
|
2426
|
+
} else {
|
|
2427
|
+
newSorting = [{
|
|
2428
|
+
id: column.id,
|
|
2429
|
+
desc: nextDesc
|
|
2430
|
+
}];
|
|
2490
2431
|
}
|
|
2491
|
-
return
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
return
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
//clear sorting for just 1 column
|
|
2512
|
-
table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
|
|
2513
|
-
},
|
|
2514
|
-
getToggleSortingHandler: () => {
|
|
2515
|
-
const canSort = column.getCanSort();
|
|
2516
|
-
return e => {
|
|
2517
|
-
if (!canSort) return;
|
|
2518
|
-
e.persist == null || e.persist();
|
|
2519
|
-
column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
|
|
2520
|
-
};
|
|
2432
|
+
return newSorting;
|
|
2433
|
+
});
|
|
2434
|
+
};
|
|
2435
|
+
column.getFirstSortDir = () => {
|
|
2436
|
+
var _ref, _column$columnDef$sor;
|
|
2437
|
+
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
|
|
2438
|
+
return sortDescFirst ? 'desc' : 'asc';
|
|
2439
|
+
};
|
|
2440
|
+
column.getNextSortingOrder = multi => {
|
|
2441
|
+
var _table$options$enable, _table$options$enable2;
|
|
2442
|
+
const firstSortDirection = column.getFirstSortDir();
|
|
2443
|
+
const isSorted = column.getIsSorted();
|
|
2444
|
+
if (!isSorted) {
|
|
2445
|
+
return firstSortDirection;
|
|
2446
|
+
}
|
|
2447
|
+
if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && (
|
|
2448
|
+
// If enableSortRemove, enable in general
|
|
2449
|
+
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
|
|
2450
|
+
) {
|
|
2451
|
+
return false;
|
|
2521
2452
|
}
|
|
2453
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
2454
|
+
};
|
|
2455
|
+
column.getCanSort = () => {
|
|
2456
|
+
var _column$columnDef$ena, _table$options$enable3;
|
|
2457
|
+
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;
|
|
2458
|
+
};
|
|
2459
|
+
column.getCanMultiSort = () => {
|
|
2460
|
+
var _ref2, _column$columnDef$ena2;
|
|
2461
|
+
return (_ref2 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : table.options.enableMultiSort) != null ? _ref2 : !!column.accessorFn;
|
|
2462
|
+
};
|
|
2463
|
+
column.getIsSorted = () => {
|
|
2464
|
+
var _table$getState$sorti;
|
|
2465
|
+
const columnSort = (_table$getState$sorti = table.getState().sorting) == null ? void 0 : _table$getState$sorti.find(d => d.id === column.id);
|
|
2466
|
+
return !columnSort ? false : columnSort.desc ? 'desc' : 'asc';
|
|
2467
|
+
};
|
|
2468
|
+
column.getSortIndex = () => {
|
|
2469
|
+
var _table$getState$sorti2, _table$getState$sorti3;
|
|
2470
|
+
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;
|
|
2471
|
+
};
|
|
2472
|
+
column.clearSorting = () => {
|
|
2473
|
+
//clear sorting for just 1 column
|
|
2474
|
+
table.setSorting(old => old != null && old.length ? old.filter(d => d.id !== column.id) : []);
|
|
2475
|
+
};
|
|
2476
|
+
column.getToggleSortingHandler = () => {
|
|
2477
|
+
const canSort = column.getCanSort();
|
|
2478
|
+
return e => {
|
|
2479
|
+
if (!canSort) return;
|
|
2480
|
+
e.persist == null || e.persist();
|
|
2481
|
+
column.toggleSorting == null || column.toggleSorting(undefined, column.getCanMultiSort() ? table.options.isMultiSortEvent == null ? void 0 : table.options.isMultiSortEvent(e) : false);
|
|
2482
|
+
};
|
|
2522
2483
|
};
|
|
2523
2484
|
},
|
|
2524
2485
|
createTable: table => {
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
return table.getPreSortedRowModel();
|
|
2538
|
-
}
|
|
2539
|
-
return table._getSortedRowModel();
|
|
2486
|
+
table.setSorting = updater => table.options.onSortingChange == null ? void 0 : table.options.onSortingChange(updater);
|
|
2487
|
+
table.resetSorting = defaultState => {
|
|
2488
|
+
var _table$initialState$s, _table$initialState;
|
|
2489
|
+
table.setSorting(defaultState ? [] : (_table$initialState$s = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.sorting) != null ? _table$initialState$s : []);
|
|
2490
|
+
};
|
|
2491
|
+
table.getPreSortedRowModel = () => table.getGroupedRowModel();
|
|
2492
|
+
table.getSortedRowModel = () => {
|
|
2493
|
+
if (!table._getSortedRowModel && table.options.getSortedRowModel) {
|
|
2494
|
+
table._getSortedRowModel = table.options.getSortedRowModel(table);
|
|
2495
|
+
}
|
|
2496
|
+
if (table.options.manualSorting || !table._getSortedRowModel) {
|
|
2497
|
+
return table.getPreSortedRowModel();
|
|
2540
2498
|
}
|
|
2499
|
+
return table._getSortedRowModel();
|
|
2541
2500
|
};
|
|
2542
2501
|
}
|
|
2543
2502
|
};
|
|
@@ -2557,49 +2516,45 @@
|
|
|
2557
2516
|
};
|
|
2558
2517
|
},
|
|
2559
2518
|
createColumn: (column, table) => {
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
}));
|
|
2567
|
-
}
|
|
2568
|
-
},
|
|
2569
|
-
getIsVisible: () => {
|
|
2570
|
-
var _table$getState$colum, _table$getState$colum2;
|
|
2571
|
-
return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
|
|
2572
|
-
},
|
|
2573
|
-
getCanHide: () => {
|
|
2574
|
-
var _column$columnDef$ena, _table$options$enable;
|
|
2575
|
-
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
|
|
2576
|
-
},
|
|
2577
|
-
getToggleVisibilityHandler: () => {
|
|
2578
|
-
return e => {
|
|
2579
|
-
column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
|
|
2580
|
-
};
|
|
2519
|
+
column.toggleVisibility = value => {
|
|
2520
|
+
if (column.getCanHide()) {
|
|
2521
|
+
table.setColumnVisibility(old => ({
|
|
2522
|
+
...old,
|
|
2523
|
+
[column.id]: value != null ? value : !column.getIsVisible()
|
|
2524
|
+
}));
|
|
2581
2525
|
}
|
|
2582
2526
|
};
|
|
2527
|
+
column.getIsVisible = () => {
|
|
2528
|
+
var _table$getState$colum, _table$getState$colum2;
|
|
2529
|
+
return (_table$getState$colum = (_table$getState$colum2 = table.getState().columnVisibility) == null ? void 0 : _table$getState$colum2[column.id]) != null ? _table$getState$colum : true;
|
|
2530
|
+
};
|
|
2531
|
+
column.getCanHide = () => {
|
|
2532
|
+
var _column$columnDef$ena, _table$options$enable;
|
|
2533
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_table$options$enable = table.options.enableHiding) != null ? _table$options$enable : true);
|
|
2534
|
+
};
|
|
2535
|
+
column.getToggleVisibilityHandler = () => {
|
|
2536
|
+
return e => {
|
|
2537
|
+
column.toggleVisibility == null || column.toggleVisibility(e.target.checked);
|
|
2538
|
+
};
|
|
2539
|
+
};
|
|
2583
2540
|
},
|
|
2584
2541
|
createRow: (row, table) => {
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
})
|
|
2602
|
-
};
|
|
2542
|
+
row._getAllVisibleCells = memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
|
|
2543
|
+
return cells.filter(cell => cell.column.getIsVisible());
|
|
2544
|
+
}, {
|
|
2545
|
+
key: "development" === 'production' ,
|
|
2546
|
+
debug: () => {
|
|
2547
|
+
var _table$options$debugA;
|
|
2548
|
+
return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
row.getVisibleCells = memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
|
|
2552
|
+
key: 'row.getVisibleCells',
|
|
2553
|
+
debug: () => {
|
|
2554
|
+
var _table$options$debugA2;
|
|
2555
|
+
return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
|
|
2556
|
+
}
|
|
2557
|
+
});
|
|
2603
2558
|
},
|
|
2604
2559
|
createTable: table => {
|
|
2605
2560
|
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
@@ -2613,33 +2568,31 @@
|
|
|
2613
2568
|
}
|
|
2614
2569
|
});
|
|
2615
2570
|
};
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
};
|
|
2642
|
-
}
|
|
2571
|
+
table.getVisibleFlatColumns = makeVisibleColumnsMethod('getVisibleFlatColumns', () => table.getAllFlatColumns());
|
|
2572
|
+
table.getVisibleLeafColumns = makeVisibleColumnsMethod('getVisibleLeafColumns', () => table.getAllLeafColumns());
|
|
2573
|
+
table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => table.getLeftLeafColumns());
|
|
2574
|
+
table.getRightVisibleLeafColumns = makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => table.getRightLeafColumns());
|
|
2575
|
+
table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => table.getCenterLeafColumns());
|
|
2576
|
+
table.setColumnVisibility = updater => table.options.onColumnVisibilityChange == null ? void 0 : table.options.onColumnVisibilityChange(updater);
|
|
2577
|
+
table.resetColumnVisibility = defaultState => {
|
|
2578
|
+
var _table$initialState$c;
|
|
2579
|
+
table.setColumnVisibility(defaultState ? {} : (_table$initialState$c = table.initialState.columnVisibility) != null ? _table$initialState$c : {});
|
|
2580
|
+
};
|
|
2581
|
+
table.toggleAllColumnsVisible = value => {
|
|
2582
|
+
var _value;
|
|
2583
|
+
value = (_value = value) != null ? _value : !table.getIsAllColumnsVisible();
|
|
2584
|
+
table.setColumnVisibility(table.getAllLeafColumns().reduce((obj, column) => ({
|
|
2585
|
+
...obj,
|
|
2586
|
+
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
2587
|
+
}), {}));
|
|
2588
|
+
};
|
|
2589
|
+
table.getIsAllColumnsVisible = () => !table.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible()));
|
|
2590
|
+
table.getIsSomeColumnsVisible = () => table.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible());
|
|
2591
|
+
table.getToggleAllColumnsVisibilityHandler = () => {
|
|
2592
|
+
return e => {
|
|
2593
|
+
var _target;
|
|
2594
|
+
table.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
2595
|
+
};
|
|
2643
2596
|
};
|
|
2644
2597
|
}
|
|
2645
2598
|
};
|
|
@@ -2835,9 +2788,10 @@
|
|
|
2835
2788
|
}
|
|
2836
2789
|
};
|
|
2837
2790
|
Object.assign(table, coreInstance);
|
|
2838
|
-
table._features.
|
|
2839
|
-
|
|
2840
|
-
|
|
2791
|
+
for (let index = 0; index < table._features.length; index++) {
|
|
2792
|
+
const feature = table._features[index];
|
|
2793
|
+
feature == null || feature.createTable == null || feature.createTable(table);
|
|
2794
|
+
}
|
|
2841
2795
|
return table;
|
|
2842
2796
|
}
|
|
2843
2797
|
|
|
@@ -2865,7 +2819,7 @@
|
|
|
2865
2819
|
})
|
|
2866
2820
|
};
|
|
2867
2821
|
table._features.forEach(feature => {
|
|
2868
|
-
|
|
2822
|
+
feature.createCell == null || feature.createCell(cell, column, row, table);
|
|
2869
2823
|
}, {});
|
|
2870
2824
|
return cell;
|
|
2871
2825
|
}
|
|
@@ -2949,7 +2903,7 @@
|
|
|
2949
2903
|
};
|
|
2950
2904
|
for (let i = 0; i < table._features.length; i++) {
|
|
2951
2905
|
const feature = table._features[i];
|
|
2952
|
-
|
|
2906
|
+
feature == null || feature.createRow == null || feature.createRow(row, table);
|
|
2953
2907
|
}
|
|
2954
2908
|
return row;
|
|
2955
2909
|
};
|