@tanstack/table-core 8.0.0-alpha.54 → 8.0.0-alpha.58

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.
Files changed (74) hide show
  1. package/build/cjs/core.js +9 -384
  2. package/build/cjs/core.js.map +1 -1
  3. package/build/cjs/features/Cells.js +122 -0
  4. package/build/cjs/features/Cells.js.map +1 -0
  5. package/build/cjs/features/ColumnSizing.js +90 -37
  6. package/build/cjs/features/ColumnSizing.js.map +1 -1
  7. package/build/cjs/features/Columns.js +216 -0
  8. package/build/cjs/features/Columns.js.map +1 -0
  9. package/build/cjs/features/Expanding.js +2 -2
  10. package/build/cjs/features/Expanding.js.map +1 -1
  11. package/build/cjs/features/Filters.js +3 -3
  12. package/build/cjs/features/Filters.js.map +1 -1
  13. package/build/cjs/features/Grouping.js +2 -2
  14. package/build/cjs/features/Grouping.js.map +1 -1
  15. package/build/cjs/features/Headers.js +78 -153
  16. package/build/cjs/features/Headers.js.map +1 -1
  17. package/build/cjs/features/Ordering.js +1 -1
  18. package/build/cjs/features/Ordering.js.map +1 -1
  19. package/build/cjs/features/Pagination.js +2 -2
  20. package/build/cjs/features/Pagination.js.map +1 -1
  21. package/build/cjs/features/Pinning.js +172 -2
  22. package/build/cjs/features/Pinning.js.map +1 -1
  23. package/build/cjs/features/RowSelection.js +1 -1
  24. package/build/cjs/features/RowSelection.js.map +1 -1
  25. package/build/cjs/features/Rows.js +99 -0
  26. package/build/cjs/features/Rows.js.map +1 -0
  27. package/build/cjs/features/Sorting.js +2 -2
  28. package/build/cjs/features/Sorting.js.map +1 -1
  29. package/build/cjs/features/Visibility.js +51 -17
  30. package/build/cjs/features/Visibility.js.map +1 -1
  31. package/build/cjs/utils.js.map +1 -1
  32. package/build/esm/index.js +881 -695
  33. package/build/esm/index.js.map +1 -1
  34. package/build/stats-html.html +1 -1
  35. package/build/stats-react.json +418 -316
  36. package/build/types/core.d.ts +2 -79
  37. package/build/types/features/Cells.d.ts +14 -0
  38. package/build/types/features/ColumnSizing.d.ts +26 -18
  39. package/build/types/features/Columns.d.ts +54 -0
  40. package/build/types/features/Expanding.d.ts +2 -1
  41. package/build/types/features/Filters.d.ts +3 -1
  42. package/build/types/features/Grouping.d.ts +2 -1
  43. package/build/types/features/Headers.d.ts +3 -11
  44. package/build/types/features/Ordering.d.ts +1 -1
  45. package/build/types/features/Pagination.d.ts +2 -1
  46. package/build/types/features/Pinning.d.ts +18 -4
  47. package/build/types/features/RowSelection.d.ts +1 -1
  48. package/build/types/features/Rows.d.ts +29 -0
  49. package/build/types/features/Sorting.d.ts +2 -1
  50. package/build/types/features/Visibility.d.ts +7 -2
  51. package/build/types/types.d.ts +18 -10
  52. package/build/types/utils.d.ts +0 -1
  53. package/build/umd/index.development.js +882 -696
  54. package/build/umd/index.development.js.map +1 -1
  55. package/build/umd/index.production.js +1 -1
  56. package/build/umd/index.production.js.map +1 -1
  57. package/package.json +1 -1
  58. package/src/core.ts +28 -550
  59. package/src/features/Cells.ts +156 -0
  60. package/src/features/ColumnSizing.ts +103 -51
  61. package/src/features/Columns.ts +290 -0
  62. package/src/features/Expanding.ts +7 -3
  63. package/src/features/Filters.ts +11 -3
  64. package/src/features/Grouping.ts +3 -2
  65. package/src/features/Headers.ts +48 -138
  66. package/src/features/Ordering.ts +1 -1
  67. package/src/features/Pagination.ts +6 -2
  68. package/src/features/Pinning.ts +194 -3
  69. package/src/features/RowSelection.ts +1 -1
  70. package/src/features/Rows.ts +151 -0
  71. package/src/features/Sorting.ts +3 -2
  72. package/src/features/Visibility.ts +67 -20
  73. package/src/types.ts +25 -37
  74. package/src/utils.ts +1 -3
@@ -367,11 +367,385 @@
367
367
  };
368
368
  } // opts?.onChange?.(result, oldResult)
369
369
 
370
+ //
371
+ var Columns = {
372
+ createInstance: function createInstance(instance) {
373
+ return {
374
+ getDefaultColumn: memo(function () {
375
+ return [instance.options.defaultColumn];
376
+ }, function (defaultColumn) {
377
+ var _defaultColumn;
378
+
379
+ defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
380
+ return _extends({
381
+ header: function header(props) {
382
+ return props.header.column.id;
383
+ },
384
+ footer: function footer(props) {
385
+ return props.header.column.id;
386
+ },
387
+ cell: function cell(_ref) {
388
+ var _ref$value = _ref.value,
389
+ value = _ref$value === void 0 ? '' : _ref$value;
390
+ return typeof value === 'boolean' ? value.toString() : value;
391
+ }
392
+ }, instance._features.reduce(function (obj, feature) {
393
+ return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
394
+ }, {}), defaultColumn);
395
+ }, {
396
+ debug: function debug() {
397
+ var _instance$options$deb;
398
+
399
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
400
+ },
401
+ key: 'getDefaultColumn'
402
+ }),
403
+ getColumnDefs: function getColumnDefs() {
404
+ return instance.options.columns;
405
+ },
406
+ createColumn: function createColumn(columnDef, depth, parent) {
407
+ var _ref2, _columnDef$id;
408
+
409
+ var defaultColumn = instance.getDefaultColumn();
410
+ var id = (_ref2 = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref2 : typeof columnDef.header === 'string' ? columnDef.header : undefined;
411
+ var accessorFn;
412
+
413
+ if (columnDef.accessorFn) {
414
+ accessorFn = columnDef.accessorFn;
415
+ } else if (columnDef.accessorKey) {
416
+ accessorFn = function accessorFn(originalRow) {
417
+ return originalRow[columnDef.accessorKey];
418
+ };
419
+ }
420
+
421
+ if (!id) {
422
+ {
423
+ throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
424
+ }
425
+ }
426
+
427
+ var column = _extends({}, defaultColumn, columnDef, {
428
+ id: "" + id,
429
+ accessorFn: accessorFn,
430
+ parent: parent,
431
+ depth: depth,
432
+ columnDef: columnDef,
433
+ columnDefType: columnDef.columnDefType,
434
+ columns: [],
435
+ getFlatColumns: memo(function () {
436
+ return [true];
437
+ }, function () {
438
+ var _column$columns;
439
+
440
+ return [column].concat((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(function (d) {
441
+ return d.getFlatColumns();
442
+ }));
443
+ }, {
444
+ key: 'column.getFlatColumns',
445
+ debug: function debug() {
446
+ var _instance$options$deb2;
447
+
448
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
449
+ }
450
+ }),
451
+ getLeafColumns: memo(function () {
452
+ return [instance._getOrderColumnsFn()];
453
+ }, function (orderColumns) {
454
+ var _column$columns2;
455
+
456
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
457
+ var leafColumns = column.columns.flatMap(function (column) {
458
+ return column.getLeafColumns();
459
+ });
460
+ return orderColumns(leafColumns);
461
+ }
462
+
463
+ return [column];
464
+ }, {
465
+ key: 'column.getLeafColumns',
466
+ debug: function debug() {
467
+ var _instance$options$deb3;
468
+
469
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
470
+ }
471
+ })
472
+ });
473
+
474
+ column = instance._features.reduce(function (obj, feature) {
475
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
476
+ }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
477
+
478
+ return column;
479
+ },
480
+ getAllColumns: memo(function () {
481
+ return [instance.getColumnDefs()];
482
+ }, function (columnDefs) {
483
+ var recurseColumns = function recurseColumns(columnDefs, parent, depth) {
484
+ if (depth === void 0) {
485
+ depth = 0;
486
+ }
487
+
488
+ return columnDefs.map(function (columnDef) {
489
+ var column = instance.createColumn(columnDef, depth, parent);
490
+ column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
491
+ return column;
492
+ });
493
+ };
494
+
495
+ return recurseColumns(columnDefs);
496
+ }, {
497
+ key: 'getAllColumns',
498
+ debug: function debug() {
499
+ var _instance$options$deb4;
500
+
501
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
502
+ }
503
+ }),
504
+ getAllFlatColumns: memo(function () {
505
+ return [instance.getAllColumns()];
506
+ }, function (allColumns) {
507
+ return allColumns.flatMap(function (column) {
508
+ return column.getFlatColumns();
509
+ });
510
+ }, {
511
+ key: 'getAllFlatColumns',
512
+ debug: function debug() {
513
+ var _instance$options$deb5;
514
+
515
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
516
+ }
517
+ }),
518
+ getAllFlatColumnsById: memo(function () {
519
+ return [instance.getAllFlatColumns()];
520
+ }, function (flatColumns) {
521
+ return flatColumns.reduce(function (acc, column) {
522
+ acc[column.id] = column;
523
+ return acc;
524
+ }, {});
525
+ }, {
526
+ key: 'getAllFlatColumnsById',
527
+ debug: function debug() {
528
+ var _instance$options$deb6;
529
+
530
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
531
+ }
532
+ }),
533
+ getAllLeafColumns: memo(function () {
534
+ return [instance.getAllColumns(), instance._getOrderColumnsFn()];
535
+ }, function (allColumns, orderColumns) {
536
+ var leafColumns = allColumns.flatMap(function (column) {
537
+ return column.getLeafColumns();
538
+ });
539
+ return orderColumns(leafColumns);
540
+ }, {
541
+ key: 'getAllLeafColumns',
542
+ debug: function debug() {
543
+ var _instance$options$deb7;
544
+
545
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
546
+ }
547
+ }),
548
+ getColumn: function getColumn(columnId) {
549
+ var column = instance.getAllFlatColumnsById()[columnId];
550
+
551
+ if (!column) {
552
+ {
553
+ console.warn("[Table] Column with id " + columnId + " does not exist.");
554
+ }
555
+
556
+ throw new Error();
557
+ }
558
+
559
+ return column;
560
+ }
561
+ };
562
+ }
563
+ };
564
+
565
+ //
566
+ var Rows = {
567
+ // createRow: <TGenerics extends TableGenerics>(
568
+ // row: Row<TGenerics>,
569
+ // instance: TableInstance<TGenerics>
570
+ // ): CellsRow<TGenerics> => {
571
+ // return {}
572
+ // },
573
+ createInstance: function createInstance(instance) {
574
+ return {
575
+ getRowId: function getRowId(row, index, parent) {
576
+ var _instance$options$get;
577
+
578
+ return (_instance$options$get = instance.options.getRowId == null ? void 0 : instance.options.getRowId(row, index, parent)) != null ? _instance$options$get : "" + (parent ? [parent.id, index].join('.') : index);
579
+ },
580
+ createRow: function createRow(id, original, rowIndex, depth, values) {
581
+ var row = {
582
+ id: id,
583
+ index: rowIndex,
584
+ original: original,
585
+ depth: depth,
586
+ values: values,
587
+ subRows: [],
588
+ getLeafRows: function getLeafRows() {
589
+ return flattenBy(row.subRows, function (d) {
590
+ return d.subRows;
591
+ });
592
+ },
593
+ getRowProps: function getRowProps(userProps) {
594
+ return instance.getRowProps(row.id, userProps);
595
+ }
596
+ };
597
+
598
+ for (var i = 0; i < instance._features.length; i++) {
599
+ var feature = instance._features[i];
600
+ Object.assign(row, feature.createRow == null ? void 0 : feature.createRow(row, instance));
601
+ }
602
+
603
+ return row;
604
+ },
605
+ getCoreRowModel: function getCoreRowModel() {
606
+ if (!instance._getCoreRowModel) {
607
+ instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
608
+ }
609
+
610
+ return instance._getCoreRowModel();
611
+ },
612
+ // The final calls start at the bottom of the model,
613
+ // expanded rows, which then work their way up
614
+ getRowModel: function getRowModel() {
615
+ return instance.getPaginationRowModel();
616
+ },
617
+ getRow: function getRow(id) {
618
+ var row = instance.getRowModel().rowsById[id];
619
+
620
+ if (!row) {
621
+ {
622
+ throw new Error("getRow expected an ID, but got " + id);
623
+ }
624
+ }
625
+
626
+ return row;
627
+ },
628
+ getRowProps: function getRowProps(rowId, userProps) {
629
+ var row = instance.getRow(rowId);
630
+
631
+ if (!row) {
632
+ return;
633
+ }
634
+
635
+ return propGetter({
636
+ key: row.id,
637
+ role: 'row'
638
+ }, userProps);
639
+ }
640
+ };
641
+ }
642
+ };
643
+
644
+ //
645
+ var Cells = {
646
+ createRow: function createRow(row, instance) {
647
+ return {
648
+ getAllCells: memo(function () {
649
+ return [instance.getAllLeafColumns()];
650
+ }, function (leafColumns) {
651
+ return leafColumns.map(function (column) {
652
+ return instance.createCell(row, column, row.values[column.id]);
653
+ });
654
+ }, {
655
+ key: 'row.getAllCells' ,
656
+ debug: function debug() {
657
+ var _instance$options$deb;
658
+
659
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
660
+ }
661
+ }),
662
+ getAllCellsByColumnId: memo(function () {
663
+ return [row.getAllCells()];
664
+ }, function (allCells) {
665
+ return allCells.reduce(function (acc, cell) {
666
+ acc[cell.columnId] = cell;
667
+ return acc;
668
+ }, {});
669
+ }, {
670
+ key: 'row.getAllCellsByColumnId',
671
+ debug: function debug() {
672
+ var _instance$options$deb2;
673
+
674
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
675
+ }
676
+ })
677
+ };
678
+ },
679
+ createInstance: function createInstance(instance) {
680
+ return {
681
+ createCell: function createCell(row, column, value) {
682
+ var cell = {
683
+ id: row.id + "_" + column.id,
684
+ rowId: row.id,
685
+ columnId: column.id,
686
+ row: row,
687
+ column: column,
688
+ value: value,
689
+ getCellProps: function getCellProps(userProps) {
690
+ return instance.getCellProps(row.id, column.id, userProps);
691
+ },
692
+ renderCell: function renderCell() {
693
+ return column.cell ? instance.render(column.cell, {
694
+ instance: instance,
695
+ column: column,
696
+ row: row,
697
+ cell: cell,
698
+ value: value
699
+ }) : null;
700
+ }
701
+ };
702
+
703
+ instance._features.forEach(function (feature) {
704
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
705
+ }, {});
706
+
707
+ return cell;
708
+ },
709
+ getCell: function getCell(rowId, columnId) {
710
+ var row = instance.getRow(rowId);
711
+
712
+ if (!row) {
713
+ {
714
+ throw new Error("[Table] could not find row with id " + rowId);
715
+ }
716
+ }
717
+
718
+ var cell = row.getAllCellsByColumnId()[columnId];
719
+
720
+ if (!cell) {
721
+ {
722
+ throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
723
+ }
724
+ }
725
+
726
+ return cell;
727
+ },
728
+ getCellProps: function getCellProps(rowId, columnId, userProps) {
729
+ var cell = instance.getCell(rowId, columnId);
730
+
731
+ if (!cell) {
732
+ return;
733
+ }
734
+
735
+ return propGetter({
736
+ key: cell.id,
737
+ role: 'gridcell'
738
+ }, userProps);
739
+ }
740
+ };
741
+ }
742
+ };
743
+
370
744
  //
371
745
  var defaultColumnSizing = {
372
- width: 150,
373
- minWidth: 20,
374
- maxWidth: Number.MAX_SAFE_INTEGER
746
+ size: 150,
747
+ minSize: 20,
748
+ maxSize: Number.MAX_SAFE_INTEGER
375
749
  };
376
750
  var ColumnSizing = {
377
751
  getDefaultColumn: function getDefaultColumn() {
@@ -397,10 +771,45 @@
397
771
  onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
398
772
  };
399
773
  },
400
- getInstance: function getInstance(instance) {
774
+ createColumn: function createColumn(column, instance) {
775
+ return {
776
+ getSize: function getSize() {
777
+ return instance.getColumnSize(column.id);
778
+ },
779
+ getStart: function getStart(position) {
780
+ return instance.getColumnStart(column.id, position);
781
+ },
782
+ getIsResizing: function getIsResizing() {
783
+ return instance.getColumnIsResizing(column.id);
784
+ },
785
+ getCanResize: function getCanResize() {
786
+ return instance.getColumnCanResize(column.id);
787
+ },
788
+ resetSize: function resetSize() {
789
+ return instance.resetColumnSize(column.id);
790
+ }
791
+ };
792
+ },
793
+ createHeader: function createHeader(header, instance) {
401
794
  return {
402
- getColumnWidth: function getColumnWidth(columnId) {
403
- var _column$minWidth, _ref, _column$maxWidth;
795
+ getIsResizing: function getIsResizing() {
796
+ return instance.getColumnIsResizing(header.column.id);
797
+ },
798
+ getCanResize: function getCanResize() {
799
+ return instance.getColumnCanResize(header.column.id);
800
+ },
801
+ resetSize: function resetSize() {
802
+ return instance.resetColumnSize(header.column.id);
803
+ },
804
+ getResizerProps: function getResizerProps(userProps) {
805
+ return instance.getHeaderResizerProps(header.id, userProps);
806
+ }
807
+ };
808
+ },
809
+ createInstance: function createInstance(instance) {
810
+ return {
811
+ getColumnSize: function getColumnSize(columnId) {
812
+ var _column$minSize, _ref, _column$maxSize;
404
813
 
405
814
  var column = instance.getColumn(columnId);
406
815
 
@@ -409,7 +818,26 @@
409
818
  }
410
819
 
411
820
  var columnSize = instance.getState().columnSizing[column.id];
412
- return Math.min(Math.max((_column$minWidth = column.minWidth) != null ? _column$minWidth : defaultColumnSizing.minWidth, (_ref = columnSize != null ? columnSize : column.width) != null ? _ref : defaultColumnSizing.width), (_column$maxWidth = column.maxWidth) != null ? _column$maxWidth : defaultColumnSizing.maxWidth);
821
+ return Math.min(Math.max((_column$minSize = column.minSize) != null ? _column$minSize : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.size) != null ? _ref : defaultColumnSizing.size), (_column$maxSize = column.maxSize) != null ? _column$maxSize : defaultColumnSizing.maxSize);
822
+ },
823
+ getColumnStart: function getColumnStart(columnId, position) {
824
+ var column = instance.getColumn(columnId);
825
+
826
+ if (!column) {
827
+ throw new Error();
828
+ }
829
+
830
+ var columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
831
+ var index = columns.findIndex(function (d) {
832
+ return d.id === columnId;
833
+ });
834
+
835
+ if (index > 0) {
836
+ var prevSiblingColumn = columns[index - 1];
837
+ return instance.getColumnStart(prevSiblingColumn.id, position) + prevSiblingColumn.getSize();
838
+ }
839
+
840
+ return 0;
413
841
  },
414
842
  setColumnSizing: function setColumnSizing(updater) {
415
843
  return instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater);
@@ -491,10 +919,10 @@
491
919
  }
492
920
 
493
921
  var header = headerId ? instance.getHeader(headerId) : undefined;
494
- var startSize = header ? header.getWidth() : column.getWidth();
922
+ var startSize = header ? header.getSize() : column.getSize();
495
923
  var columnSizingStart = header ? header.getLeafHeaders().map(function (d) {
496
- return [d.column.id, d.getWidth()];
497
- }) : [[column.id, column.getWidth()]];
924
+ return [d.column.id, d.getSize()];
925
+ }) : [[column.id, column.getSize()]];
498
926
  var clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
499
927
 
500
928
  var updateOffset = function updateOffset(eventType, clientXPos) {
@@ -510,8 +938,8 @@
510
938
  var deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
511
939
  old.columnSizingStart.forEach(function (_ref5) {
512
940
  var columnId = _ref5[0],
513
- headerWidth = _ref5[1];
514
- newColumnSizing[columnId] = Math.round(Math.max(headerWidth + headerWidth * deltaPercentage, 0) * 100) / 100;
941
+ headerSize = _ref5[1];
942
+ newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
515
943
  });
516
944
  return _extends({}, old, {
517
945
  deltaOffset: deltaOffset,
@@ -614,35 +1042,34 @@
614
1042
  }
615
1043
  } : {};
616
1044
  return propGetter(initialProps, userProps);
617
- }
618
- };
619
- },
620
- createColumn: function createColumn(column, instance) {
621
- return {
622
- getIsResizing: function getIsResizing() {
623
- return instance.getColumnIsResizing(column.id);
624
1045
  },
625
- getCanResize: function getCanResize() {
626
- return instance.getColumnCanResize(column.id);
627
- },
628
- resetSize: function resetSize() {
629
- return instance.resetColumnSize(column.id);
630
- }
631
- };
632
- },
633
- createHeader: function createHeader(header, instance) {
634
- return {
635
- getIsResizing: function getIsResizing() {
636
- return instance.getColumnIsResizing(header.column.id);
1046
+ getTotalSize: function getTotalSize() {
1047
+ var _instance$getHeaderGr, _instance$getHeaderGr2;
1048
+
1049
+ return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce(function (sum, header) {
1050
+ return sum + header.getSize();
1051
+ }, 0)) != null ? _instance$getHeaderGr : 0;
637
1052
  },
638
- getCanResize: function getCanResize() {
639
- return instance.getColumnCanResize(header.column.id);
1053
+ getLeftTotalSize: function getLeftTotalSize() {
1054
+ var _instance$getLeftHead, _instance$getLeftHead2;
1055
+
1056
+ return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce(function (sum, header) {
1057
+ return sum + header.getSize();
1058
+ }, 0)) != null ? _instance$getLeftHead : 0;
640
1059
  },
641
- resetSize: function resetSize() {
642
- return instance.resetColumnSize(header.column.id);
1060
+ getCenterTotalSize: function getCenterTotalSize() {
1061
+ var _instance$getCenterHe, _instance$getCenterHe2;
1062
+
1063
+ return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce(function (sum, header) {
1064
+ return sum + header.getSize();
1065
+ }, 0)) != null ? _instance$getCenterHe : 0;
643
1066
  },
644
- getResizerProps: function getResizerProps(userProps) {
645
- return instance.getHeaderResizerProps(header.id, userProps);
1067
+ getRightTotalSize: function getRightTotalSize() {
1068
+ var _instance$getRightHea, _instance$getRightHea2;
1069
+
1070
+ return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce(function (sum, header) {
1071
+ return sum + header.getSize();
1072
+ }, 0)) != null ? _instance$getRightHea : 0;
646
1073
  }
647
1074
  };
648
1075
  }
@@ -692,7 +1119,7 @@
692
1119
  paginateExpandedRows: true
693
1120
  };
694
1121
  },
695
- getInstance: function getInstance(instance) {
1122
+ createInstance: function createInstance(instance) {
696
1123
  var registered = false;
697
1124
  return {
698
1125
  queueResetExpanded: function queueResetExpanded() {
@@ -862,7 +1289,7 @@
862
1289
  instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
863
1290
  }
864
1291
 
865
- if (!instance._getExpandedRowModel) {
1292
+ if (instance.options.manualExpanding || !instance._getExpandedRowModel) {
866
1293
  return instance.getPreExpandedRowModel();
867
1294
  }
868
1295
 
@@ -1151,7 +1578,7 @@
1151
1578
  }
1152
1579
  };
1153
1580
  },
1154
- getInstance: function getInstance(instance) {
1581
+ createInstance: function createInstance(instance) {
1155
1582
  var registered = false;
1156
1583
  return {
1157
1584
  queueResetFilters: function queueResetFilters() {
@@ -1353,7 +1780,7 @@
1353
1780
  instance._getColumnFilteredRowModel = instance.options.getColumnFilteredRowModel(instance);
1354
1781
  }
1355
1782
 
1356
- if (!instance._getColumnFilteredRowModel) {
1783
+ if (instance.options.manualColumnFiltering || !instance._getColumnFilteredRowModel) {
1357
1784
  return instance.getPreColumnFilteredRowModel();
1358
1785
  }
1359
1786
 
@@ -1367,7 +1794,7 @@
1367
1794
  instance._getGlobalFilteredRowModel = instance.options.getGlobalFilteredRowModel(instance);
1368
1795
  }
1369
1796
 
1370
- if (!instance._getGlobalFilteredRowModel) {
1797
+ if (instance.options.manualGlobalFiltering || !instance._getGlobalFilteredRowModel) {
1371
1798
  return instance.getPreGlobalFilteredRowModel();
1372
1799
  }
1373
1800
 
@@ -1533,7 +1960,7 @@
1533
1960
  }
1534
1961
  };
1535
1962
  },
1536
- getInstance: function getInstance(instance) {
1963
+ createInstance: function createInstance(instance) {
1537
1964
  var registered = false;
1538
1965
  return {
1539
1966
  queueResetGrouping: function queueResetGrouping() {
@@ -1643,7 +2070,7 @@
1643
2070
  instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
1644
2071
  }
1645
2072
 
1646
- if (!instance._getGroupedRowModel) {
2073
+ if (instance.options.manualGrouping || !instance._getGroupedRowModel) {
1647
2074
  return instance.getPreGroupedRowModel();
1648
2075
  }
1649
2076
 
@@ -1719,7 +2146,7 @@
1719
2146
  onColumnOrderChange: makeStateUpdater('columnOrder', instance)
1720
2147
  };
1721
2148
  },
1722
- getInstance: function getInstance(instance) {
2149
+ createInstance: function createInstance(instance) {
1723
2150
  return {
1724
2151
  setColumnOrder: function setColumnOrder(updater) {
1725
2152
  return instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater);
@@ -1791,7 +2218,7 @@
1791
2218
  autoResetPageIndex: true
1792
2219
  };
1793
2220
  },
1794
- getInstance: function getInstance(instance) {
2221
+ createInstance: function createInstance(instance) {
1795
2222
  var registered = false;
1796
2223
  return {
1797
2224
  queueResetPageIndex: function queueResetPageIndex() {
@@ -1898,81 +2325,203 @@
1898
2325
  return true;
1899
2326
  }
1900
2327
 
1901
- if (pageCount === 0) {
1902
- return false;
2328
+ if (pageCount === 0) {
2329
+ return false;
2330
+ }
2331
+
2332
+ return pageIndex < pageCount - 1;
2333
+ },
2334
+ previousPage: function previousPage() {
2335
+ return instance.setPageIndex(function (old) {
2336
+ return old - 1;
2337
+ });
2338
+ },
2339
+ nextPage: function nextPage() {
2340
+ return instance.setPageIndex(function (old) {
2341
+ return old + 1;
2342
+ });
2343
+ },
2344
+ getPrePaginationRowModel: function getPrePaginationRowModel() {
2345
+ return instance.getExpandedRowModel();
2346
+ },
2347
+ getPaginationRowModel: function getPaginationRowModel() {
2348
+ if (!instance._getPaginationRowModel && instance.options.getPaginationRowModel) {
2349
+ instance._getPaginationRowModel = instance.options.getPaginationRowModel(instance);
2350
+ }
2351
+
2352
+ if (instance.options.manualPagination || !instance._getPaginationRowModel) {
2353
+ return instance.getPrePaginationRowModel();
2354
+ }
2355
+
2356
+ return instance._getPaginationRowModel();
2357
+ },
2358
+ getPageCount: function getPageCount() {
2359
+ var pageCount = instance.getState().pagination.pageCount;
2360
+
2361
+ if (pageCount > 0) {
2362
+ return pageCount;
2363
+ }
2364
+
2365
+ return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
2366
+ }
2367
+ };
2368
+ }
2369
+ };
2370
+
2371
+ //
2372
+ var Pinning = {
2373
+ getInitialState: function getInitialState() {
2374
+ return {
2375
+ columnPinning: {
2376
+ left: [],
2377
+ right: []
2378
+ }
2379
+ };
2380
+ },
2381
+ getDefaultOptions: function getDefaultOptions(instance) {
2382
+ return {
2383
+ onColumnPinningChange: makeStateUpdater('columnPinning', instance)
2384
+ };
2385
+ },
2386
+ createColumn: function createColumn(column, instance) {
2387
+ return {
2388
+ getCanPin: function getCanPin() {
2389
+ return instance.getColumnCanPin(column.id);
2390
+ },
2391
+ getPinnedIndex: function getPinnedIndex() {
2392
+ return instance.getColumnPinnedIndex(column.id);
2393
+ },
2394
+ getIsPinned: function getIsPinned() {
2395
+ return instance.getColumnIsPinned(column.id);
2396
+ },
2397
+ pin: function pin(position) {
2398
+ return instance.pinColumn(column.id, position);
2399
+ }
2400
+ };
2401
+ },
2402
+ createRow: function createRow(row, instance) {
2403
+ return {
2404
+ getCenterVisibleCells: memo(function () {
2405
+ return [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
2406
+ }, function (allCells, left, right) {
2407
+ var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
2408
+ return allCells.filter(function (d) {
2409
+ return !leftAndRight.includes(d.columnId);
2410
+ });
2411
+ }, {
2412
+ key: 'row.getCenterVisibleCells',
2413
+ debug: function debug() {
2414
+ var _instance$options$deb;
2415
+
2416
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2417
+ }
2418
+ }),
2419
+ getLeftVisibleCells: memo(function () {
2420
+ return [row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
2421
+ }, function (allCells, left) {
2422
+ var cells = (left != null ? left : []).map(function (columnId) {
2423
+ return allCells.find(function (cell) {
2424
+ return cell.columnId === columnId;
2425
+ });
2426
+ }).filter(Boolean).map(function (d) {
2427
+ return _extends({}, d, {
2428
+ position: 'left'
2429
+ });
2430
+ });
2431
+ return cells;
2432
+ }, {
2433
+ key: 'row.getLeftVisibleCells',
2434
+ debug: function debug() {
2435
+ var _instance$options$deb2;
2436
+
2437
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2438
+ }
2439
+ }),
2440
+ getRightVisibleCells: memo(function () {
2441
+ return [row._getAllVisibleCells(), instance.getState().columnPinning.right];
2442
+ }, function (allCells, right) {
2443
+ var cells = (right != null ? right : []).map(function (columnId) {
2444
+ return allCells.find(function (cell) {
2445
+ return cell.columnId === columnId;
2446
+ });
2447
+ }).filter(Boolean).map(function (d) {
2448
+ return _extends({}, d, {
2449
+ position: 'left'
2450
+ });
2451
+ });
2452
+ return cells;
2453
+ }, {
2454
+ key: 'row.getRightVisibleCells',
2455
+ debug: function debug() {
2456
+ var _instance$options$deb3;
2457
+
2458
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
2459
+ }
2460
+ })
2461
+ };
2462
+ },
2463
+ createCell: function createCell(cell, instance) {
2464
+ return {
2465
+ getCenterVisibleCells: memo(function () {
2466
+ return [cell.row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
2467
+ }, function (allCells, left, right) {
2468
+ var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
2469
+ return allCells.filter(function (d) {
2470
+ return !leftAndRight.includes(d.columnId);
2471
+ });
2472
+ }, {
2473
+ key: 'row.getCenterVisibleCells',
2474
+ debug: function debug() {
2475
+ var _instance$options$deb4;
2476
+
2477
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugRows;
1903
2478
  }
1904
-
1905
- return pageIndex < pageCount - 1;
1906
- },
1907
- previousPage: function previousPage() {
1908
- return instance.setPageIndex(function (old) {
1909
- return old - 1;
1910
- });
1911
- },
1912
- nextPage: function nextPage() {
1913
- return instance.setPageIndex(function (old) {
1914
- return old + 1;
2479
+ }),
2480
+ getLeftVisibleCells: memo(function () {
2481
+ return [cell.row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
2482
+ }, function (allCells, left) {
2483
+ var cells = (left != null ? left : []).map(function (columnId) {
2484
+ return allCells.find(function (cell) {
2485
+ return cell.columnId === columnId;
2486
+ });
2487
+ }).filter(Boolean).map(function (d) {
2488
+ return _extends({}, d, {
2489
+ position: 'left'
2490
+ });
1915
2491
  });
1916
- },
1917
- getPrePaginationRowModel: function getPrePaginationRowModel() {
1918
- return instance.getExpandedRowModel();
1919
- },
1920
- getPaginationRowModel: function getPaginationRowModel() {
1921
- if (!instance._getPaginationRowModel && instance.options.getPaginationRowModel) {
1922
- instance._getPaginationRowModel = instance.options.getPaginationRowModel(instance);
1923
- }
2492
+ return cells;
2493
+ }, {
2494
+ key: 'row.getLeftVisibleCells',
2495
+ debug: function debug() {
2496
+ var _instance$options$deb5;
1924
2497
 
1925
- if (!instance._getPaginationRowModel) {
1926
- return instance.getPrePaginationRowModel();
2498
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugRows;
1927
2499
  }
2500
+ }),
2501
+ getRightVisibleCells: memo(function () {
2502
+ return [cell.row._getAllVisibleCells(), instance.getState().columnPinning.right];
2503
+ }, function (allCells, right) {
2504
+ var cells = (right != null ? right : []).map(function (columnId) {
2505
+ return allCells.find(function (cell) {
2506
+ return cell.columnId === columnId;
2507
+ });
2508
+ }).filter(Boolean).map(function (d) {
2509
+ return _extends({}, d, {
2510
+ position: 'left'
2511
+ });
2512
+ });
2513
+ return cells;
2514
+ }, {
2515
+ key: 'row.getRightVisibleCells',
2516
+ debug: function debug() {
2517
+ var _instance$options$deb6;
1928
2518
 
1929
- return instance._getPaginationRowModel();
1930
- },
1931
- getPageCount: function getPageCount() {
1932
- var pageCount = instance.getState().pagination.pageCount;
1933
-
1934
- if (pageCount > 0) {
1935
- return pageCount;
2519
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugRows;
1936
2520
  }
1937
-
1938
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1939
- }
1940
- };
1941
- }
1942
- };
1943
-
1944
- //
1945
- var Pinning = {
1946
- getInitialState: function getInitialState() {
1947
- return {
1948
- columnPinning: {
1949
- left: [],
1950
- right: []
1951
- }
1952
- };
1953
- },
1954
- getDefaultOptions: function getDefaultOptions(instance) {
1955
- return {
1956
- onColumnPinningChange: makeStateUpdater('columnPinning', instance)
1957
- };
1958
- },
1959
- createColumn: function createColumn(column, instance) {
1960
- return {
1961
- getCanPin: function getCanPin() {
1962
- return instance.getColumnCanPin(column.id);
1963
- },
1964
- getPinnedIndex: function getPinnedIndex() {
1965
- return instance.getColumnPinnedIndex(column.id);
1966
- },
1967
- getIsPinned: function getIsPinned() {
1968
- return instance.getColumnIsPinned(column.id);
1969
- },
1970
- pin: function pin(position) {
1971
- return instance.pinColumn(column.id, position);
1972
- }
2521
+ })
1973
2522
  };
1974
2523
  },
1975
- getInstance: function getInstance(instance) {
2524
+ createInstance: function createInstance(instance) {
1976
2525
  return {
1977
2526
  setColumnPinning: function setColumnPinning(updater) {
1978
2527
  return instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater);
@@ -2072,7 +2621,54 @@
2072
2621
  left = _instance$getState$co5.left,
2073
2622
  right = _instance$getState$co5.right;
2074
2623
  return Boolean((left == null ? void 0 : left.length) || (right == null ? void 0 : right.length));
2075
- }
2624
+ },
2625
+ getLeftLeafColumns: memo(function () {
2626
+ return [instance.getAllLeafColumns(), instance.getState().columnPinning.left];
2627
+ }, function (allColumns, left) {
2628
+ return (left != null ? left : []).map(function (columnId) {
2629
+ return allColumns.find(function (column) {
2630
+ return column.id === columnId;
2631
+ });
2632
+ }).filter(Boolean);
2633
+ }, {
2634
+ key: 'getLeftLeafColumns',
2635
+ debug: function debug() {
2636
+ var _instance$options$deb7;
2637
+
2638
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
2639
+ }
2640
+ }),
2641
+ getRightLeafColumns: memo(function () {
2642
+ return [instance.getAllLeafColumns(), instance.getState().columnPinning.right];
2643
+ }, function (allColumns, right) {
2644
+ return (right != null ? right : []).map(function (columnId) {
2645
+ return allColumns.find(function (column) {
2646
+ return column.id === columnId;
2647
+ });
2648
+ }).filter(Boolean);
2649
+ }, {
2650
+ key: 'getRightLeafColumns',
2651
+ debug: function debug() {
2652
+ var _instance$options$deb8;
2653
+
2654
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugColumns;
2655
+ }
2656
+ }),
2657
+ getCenterLeafColumns: memo(function () {
2658
+ return [instance.getAllLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
2659
+ }, function (allColumns, left, right) {
2660
+ var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
2661
+ return allColumns.filter(function (d) {
2662
+ return !leftAndRight.includes(d.id);
2663
+ });
2664
+ }, {
2665
+ key: 'getCenterLeafColumns',
2666
+ debug: function debug() {
2667
+ var _instance$options$deb9;
2668
+
2669
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugColumns;
2670
+ }
2671
+ })
2076
2672
  };
2077
2673
  }
2078
2674
  };
@@ -2096,7 +2692,7 @@
2096
2692
 
2097
2693
  };
2098
2694
  },
2099
- getInstance: function getInstance(instance) {
2695
+ createInstance: function createInstance(instance) {
2100
2696
  var registered = false; // const pageRows = instance.getPageRows()
2101
2697
 
2102
2698
  return {
@@ -2739,7 +3335,7 @@
2739
3335
  }
2740
3336
  };
2741
3337
  },
2742
- getInstance: function getInstance(instance) {
3338
+ createInstance: function createInstance(instance) {
2743
3339
  var registered = false;
2744
3340
  return {
2745
3341
  queueResetSorting: function queueResetSorting() {
@@ -2980,7 +3576,7 @@
2980
3576
  instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
2981
3577
  }
2982
3578
 
2983
- if (!instance._getSortedRowModel) {
3579
+ if (instance.options.manualSorting || !instance._getSortedRowModel) {
2984
3580
  return instance.getPreSortedRowModel();
2985
3581
  }
2986
3582
 
@@ -3031,43 +3627,77 @@
3031
3627
  }
3032
3628
  };
3033
3629
  },
3034
- getInstance: function getInstance(instance) {
3630
+ createRow: function createRow(row, instance) {
3035
3631
  return {
3036
- getVisibleFlatColumns: memo(function () {
3037
- return [instance.getAllFlatColumns(), instance.getAllFlatColumns().filter(function (d) {
3038
- return d.getIsVisible == null ? void 0 : d.getIsVisible();
3632
+ _getAllVisibleCells: memo(function () {
3633
+ return [row.getAllCells().filter(function (cell) {
3634
+ return cell.column.getIsVisible();
3039
3635
  }).map(function (d) {
3040
3636
  return d.id;
3041
3637
  }).join('_')];
3042
- }, function (allFlatColumns) {
3043
- return allFlatColumns.filter(function (d) {
3044
- return d.getIsVisible == null ? void 0 : d.getIsVisible();
3638
+ }, function (_) {
3639
+ return row.getAllCells().filter(function (cell) {
3640
+ return cell.column.getIsVisible();
3045
3641
  });
3046
3642
  }, {
3047
- key: 'getVisibleFlatColumns',
3643
+ key: 'row._getAllVisibleCells',
3048
3644
  debug: function debug() {
3049
3645
  var _instance$options$deb;
3050
3646
 
3051
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
3647
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3052
3648
  }
3053
3649
  }),
3054
- getVisibleLeafColumns: memo(function () {
3055
- return [instance.getAllLeafColumns(), instance.getAllLeafColumns().filter(function (d) {
3056
- return d.getIsVisible == null ? void 0 : d.getIsVisible();
3650
+ getVisibleCells: memo(function () {
3651
+ return [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()];
3652
+ }, function (left, center, right) {
3653
+ return [].concat(left, center, right);
3654
+ }, {
3655
+ key: 'row.getVisibleCells',
3656
+ debug: function debug() {
3657
+ var _instance$options$deb2;
3658
+
3659
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3660
+ }
3661
+ })
3662
+ };
3663
+ },
3664
+ createInstance: function createInstance(instance) {
3665
+ var makeVisibleColumnsMethod = function makeVisibleColumnsMethod(key, getColumns) {
3666
+ return memo(function () {
3667
+ return [getColumns(), getColumns().filter(function (d) {
3668
+ return d.getIsVisible();
3057
3669
  }).map(function (d) {
3058
3670
  return d.id;
3059
3671
  }).join('_')];
3060
- }, function (allFlatColumns) {
3061
- return allFlatColumns.filter(function (d) {
3672
+ }, function (columns) {
3673
+ return columns.filter(function (d) {
3062
3674
  return d.getIsVisible == null ? void 0 : d.getIsVisible();
3063
3675
  });
3064
3676
  }, {
3065
- key: 'getVisibleLeafColumns',
3677
+ key: key,
3066
3678
  debug: function debug() {
3067
- var _instance$options$deb2;
3679
+ var _instance$options$deb3;
3068
3680
 
3069
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
3681
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
3070
3682
  }
3683
+ });
3684
+ };
3685
+
3686
+ return {
3687
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', function () {
3688
+ return instance.getAllFlatColumns();
3689
+ }),
3690
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', function () {
3691
+ return instance.getAllLeafColumns();
3692
+ }),
3693
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', function () {
3694
+ return instance.getLeftLeafColumns();
3695
+ }),
3696
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', function () {
3697
+ return instance.getRightLeafColumns();
3698
+ }),
3699
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', function () {
3700
+ return instance.getCenterLeafColumns();
3071
3701
  }),
3072
3702
  setColumnVisibility: function setColumnVisibility(updater) {
3073
3703
  return instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater);
@@ -3107,128 +3737,45 @@
3107
3737
  getColumnCanHide: function getColumnCanHide(columnId) {
3108
3738
  var _ref2, _ref3, _instance$options$ena;
3109
3739
 
3110
- var column = instance.getColumn(columnId);
3111
-
3112
- if (!column) {
3113
- throw new Error();
3114
- }
3115
-
3116
- return (_ref2 = (_ref3 = (_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : column.enableHiding) != null ? _ref3 : column.defaultCanHide) != null ? _ref2 : true;
3117
- },
3118
- getIsAllColumnsVisible: function getIsAllColumnsVisible() {
3119
- return !instance.getAllLeafColumns().some(function (column) {
3120
- return !(column.getIsVisible != null && column.getIsVisible());
3121
- });
3122
- },
3123
- getIsSomeColumnsVisible: function getIsSomeColumnsVisible() {
3124
- return instance.getAllLeafColumns().some(function (column) {
3125
- return column.getIsVisible == null ? void 0 : column.getIsVisible();
3126
- });
3127
- },
3128
- getToggleAllColumnsVisibilityProps: function getToggleAllColumnsVisibilityProps(userProps) {
3129
- var props = {
3130
- onChange: function onChange(e) {
3131
- var _e$target;
3132
-
3133
- instance.toggleAllColumnsVisible((_e$target = e.target) == null ? void 0 : _e$target.checked);
3134
- },
3135
- type: 'checkbox',
3136
- title: 'Toggle visibility for all columns',
3137
- checked: instance.getIsAllColumnsVisible(),
3138
- indeterminate: !instance.getIsAllColumnsVisible() && instance.getIsSomeColumnsVisible() ? 'indeterminate' : undefined
3139
- };
3140
- return propGetter(props, userProps);
3141
- }
3142
- };
3143
- }
3144
- };
3145
-
3146
- //
3147
- var Headers = {
3148
- createRow: function createRow(row, instance) {
3149
- return {
3150
- _getAllVisibleCells: memo(function () {
3151
- return [row.getAllCells().filter(function (cell) {
3152
- return cell.column.getIsVisible();
3153
- }).map(function (d) {
3154
- return d.id;
3155
- }).join('_')];
3156
- }, function (_) {
3157
- return row.getAllCells().filter(function (cell) {
3158
- return cell.column.getIsVisible();
3159
- });
3160
- }, {
3161
- key: 'row._getAllVisibleCells',
3162
- debug: function debug() {
3163
- var _instance$options$deb;
3164
-
3165
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3166
- }
3167
- }),
3168
- getVisibleCells: memo(function () {
3169
- return [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()];
3170
- }, function (left, center, right) {
3171
- return [].concat(left, center, right);
3172
- }, {
3173
- key: 'row.getVisibleCells',
3174
- debug: function debug() {
3175
- var _instance$options$deb2;
3176
-
3177
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3178
- }
3179
- }),
3180
- getCenterVisibleCells: memo(function () {
3181
- return [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
3182
- }, function (allCells, left, right) {
3183
- var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
3184
- return allCells.filter(function (d) {
3185
- return !leftAndRight.includes(d.columnId);
3186
- });
3187
- }, {
3188
- key: 'row.getCenterVisibleCells',
3189
- debug: function debug() {
3190
- var _instance$options$deb3;
3191
-
3192
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
3193
- }
3194
- }),
3195
- getLeftVisibleCells: memo(function () {
3196
- return [row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
3197
- }, function (allCells, left) {
3198
- var cells = (left != null ? left : []).map(function (columnId) {
3199
- return allCells.find(function (cell) {
3200
- return cell.columnId === columnId;
3201
- });
3202
- }).filter(Boolean);
3203
- return cells;
3204
- }, {
3205
- key: 'row.getLeftVisibleCells',
3206
- debug: function debug() {
3207
- var _instance$options$deb4;
3740
+ var column = instance.getColumn(columnId);
3208
3741
 
3209
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugRows;
3742
+ if (!column) {
3743
+ throw new Error();
3210
3744
  }
3211
- }),
3212
- getRightVisibleCells: memo(function () {
3213
- return [row._getAllVisibleCells(), instance.getState().columnPinning.right];
3214
- }, function (allCells, right) {
3215
- var cells = (right != null ? right : []).map(function (columnId) {
3216
- return allCells.find(function (cell) {
3217
- return cell.columnId === columnId;
3218
- });
3219
- }).filter(Boolean);
3220
- return cells;
3221
- }, {
3222
- key: 'row.getRightVisibleCells',
3223
- debug: function debug() {
3224
- var _instance$options$deb5;
3225
3745
 
3226
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugRows;
3227
- }
3228
- })
3746
+ return (_ref2 = (_ref3 = (_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : column.enableHiding) != null ? _ref3 : column.defaultCanHide) != null ? _ref2 : true;
3747
+ },
3748
+ getIsAllColumnsVisible: function getIsAllColumnsVisible() {
3749
+ return !instance.getAllLeafColumns().some(function (column) {
3750
+ return !(column.getIsVisible != null && column.getIsVisible());
3751
+ });
3752
+ },
3753
+ getIsSomeColumnsVisible: function getIsSomeColumnsVisible() {
3754
+ return instance.getAllLeafColumns().some(function (column) {
3755
+ return column.getIsVisible == null ? void 0 : column.getIsVisible();
3756
+ });
3757
+ },
3758
+ getToggleAllColumnsVisibilityProps: function getToggleAllColumnsVisibilityProps(userProps) {
3759
+ var props = {
3760
+ onChange: function onChange(e) {
3761
+ var _e$target;
3762
+
3763
+ instance.toggleAllColumnsVisible((_e$target = e.target) == null ? void 0 : _e$target.checked);
3764
+ },
3765
+ type: 'checkbox',
3766
+ title: 'Toggle visibility for all columns',
3767
+ checked: instance.getIsAllColumnsVisible(),
3768
+ indeterminate: !instance.getIsAllColumnsVisible() && instance.getIsSomeColumnsVisible() ? 'indeterminate' : undefined
3769
+ };
3770
+ return propGetter(props, userProps);
3771
+ }
3229
3772
  };
3230
- },
3231
- getInstance: function getInstance(instance) {
3773
+ }
3774
+ };
3775
+
3776
+ //
3777
+ var Headers = {
3778
+ createInstance: function createInstance(instance) {
3232
3779
  return {
3233
3780
  createHeader: function createHeader(column, options) {
3234
3781
  var _options$id;
@@ -3237,28 +3784,38 @@
3237
3784
  var header = {
3238
3785
  id: id,
3239
3786
  column: column,
3787
+ index: options.index,
3240
3788
  isPlaceholder: options.isPlaceholder,
3241
3789
  placeholderId: options.placeholderId,
3242
3790
  depth: options.depth,
3243
3791
  subHeaders: [],
3244
3792
  colSpan: 0,
3245
3793
  rowSpan: 0,
3246
- getWidth: function getWidth() {
3794
+ headerGroup: null,
3795
+ getSize: function getSize() {
3247
3796
  var sum = 0;
3248
3797
 
3249
3798
  var recurse = function recurse(header) {
3250
3799
  if (header.subHeaders.length) {
3251
3800
  header.subHeaders.forEach(recurse);
3252
3801
  } else {
3253
- var _header$column$getWid;
3802
+ var _header$column$getSiz;
3254
3803
 
3255
- sum += (_header$column$getWid = header.column.getWidth()) != null ? _header$column$getWid : 0;
3804
+ sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
3256
3805
  }
3257
3806
  };
3258
3807
 
3259
3808
  recurse(header);
3260
3809
  return sum;
3261
3810
  },
3811
+ getStart: function getStart() {
3812
+ if (header.index > 0) {
3813
+ var prevSiblingHeader = header.headerGroup.headers[header.index - 1];
3814
+ return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
3815
+ }
3816
+
3817
+ return 0;
3818
+ },
3262
3819
  getLeafHeaders: function getLeafHeaders() {
3263
3820
  var leafHeaders = [];
3264
3821
 
@@ -3293,9 +3850,13 @@
3293
3850
  column: column
3294
3851
  }) : null;
3295
3852
  }
3296
- }; // Yes, we have to convert instance to unknown, because we know more than the compiler here.
3853
+ };
3854
+
3855
+ instance._features.forEach(function (feature) {
3856
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
3857
+ });
3297
3858
 
3298
- return Object.assign(header, ColumnSizing.createHeader(header, instance));
3859
+ return header;
3299
3860
  },
3300
3861
  // Header Groups
3301
3862
  getHeaderGroups: memo(function () {
@@ -3315,9 +3876,9 @@
3315
3876
  }, {
3316
3877
  key: 'getHeaderGroups',
3317
3878
  debug: function debug() {
3318
- var _instance$options$deb6;
3879
+ var _instance$options$deb;
3319
3880
 
3320
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
3881
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
3321
3882
  }
3322
3883
  }),
3323
3884
  getCenterHeaderGroups: memo(function () {
@@ -3330,9 +3891,9 @@
3330
3891
  }, {
3331
3892
  key: 'getCenterHeaderGroups',
3332
3893
  debug: function debug() {
3333
- var _instance$options$deb7;
3894
+ var _instance$options$deb2;
3334
3895
 
3335
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
3896
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
3336
3897
  }
3337
3898
  }),
3338
3899
  getLeftHeaderGroups: memo(function () {
@@ -3345,9 +3906,9 @@
3345
3906
  }, {
3346
3907
  key: 'getLeftHeaderGroups',
3347
3908
  debug: function debug() {
3348
- var _instance$options$deb8;
3909
+ var _instance$options$deb3;
3349
3910
 
3350
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
3911
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
3351
3912
  }
3352
3913
  }),
3353
3914
  getRightHeaderGroups: memo(function () {
@@ -3360,9 +3921,9 @@
3360
3921
  }, {
3361
3922
  key: 'getRightHeaderGroups',
3362
3923
  debug: function debug() {
3363
- var _instance$options$deb9;
3924
+ var _instance$options$deb4;
3364
3925
 
3365
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
3926
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
3366
3927
  }
3367
3928
  }),
3368
3929
  // Footer Groups
@@ -3373,9 +3934,9 @@
3373
3934
  }, {
3374
3935
  key: 'getFooterGroups',
3375
3936
  debug: function debug() {
3376
- var _instance$options$deb10;
3937
+ var _instance$options$deb5;
3377
3938
 
3378
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
3939
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
3379
3940
  }
3380
3941
  }),
3381
3942
  getLeftFooterGroups: memo(function () {
@@ -3385,9 +3946,9 @@
3385
3946
  }, {
3386
3947
  key: 'getLeftFooterGroups',
3387
3948
  debug: function debug() {
3388
- var _instance$options$deb11;
3949
+ var _instance$options$deb6;
3389
3950
 
3390
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
3951
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
3391
3952
  }
3392
3953
  }),
3393
3954
  getCenterFooterGroups: memo(function () {
@@ -3397,9 +3958,9 @@
3397
3958
  }, {
3398
3959
  key: 'getCenterFooterGroups',
3399
3960
  debug: function debug() {
3400
- var _instance$options$deb12;
3961
+ var _instance$options$deb7;
3401
3962
 
3402
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
3963
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
3403
3964
  }
3404
3965
  }),
3405
3966
  getRightFooterGroups: memo(function () {
@@ -3409,9 +3970,9 @@
3409
3970
  }, {
3410
3971
  key: 'getRightFooterGroups',
3411
3972
  debug: function debug() {
3412
- var _instance$options$deb13;
3973
+ var _instance$options$deb8;
3413
3974
 
3414
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
3975
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
3415
3976
  }
3416
3977
  }),
3417
3978
  // Flat Headers
@@ -3424,9 +3985,9 @@
3424
3985
  }, {
3425
3986
  key: 'getFlatHeaders',
3426
3987
  debug: function debug() {
3427
- var _instance$options$deb14;
3988
+ var _instance$options$deb9;
3428
3989
 
3429
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
3990
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
3430
3991
  }
3431
3992
  }),
3432
3993
  getLeftFlatHeaders: memo(function () {
@@ -3438,9 +3999,9 @@
3438
3999
  }, {
3439
4000
  key: 'getLeftFlatHeaders',
3440
4001
  debug: function debug() {
3441
- var _instance$options$deb15;
4002
+ var _instance$options$deb10;
3442
4003
 
3443
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
4004
+ return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
3444
4005
  }
3445
4006
  }),
3446
4007
  getCenterFlatHeaders: memo(function () {
@@ -3452,9 +4013,9 @@
3452
4013
  }, {
3453
4014
  key: 'getCenterFlatHeaders',
3454
4015
  debug: function debug() {
3455
- var _instance$options$deb16;
4016
+ var _instance$options$deb11;
3456
4017
 
3457
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
4018
+ return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
3458
4019
  }
3459
4020
  }),
3460
4021
  getRightFlatHeaders: memo(function () {
@@ -3466,9 +4027,9 @@
3466
4027
  }, {
3467
4028
  key: 'getRightFlatHeaders',
3468
4029
  debug: function debug() {
3469
- var _instance$options$deb17;
4030
+ var _instance$options$deb12;
3470
4031
 
3471
- return (_instance$options$deb17 = instance.options.debugAll) != null ? _instance$options$deb17 : instance.options.debugHeaders;
4032
+ return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
3472
4033
  }
3473
4034
  }),
3474
4035
  // Leaf Headers
@@ -3483,9 +4044,9 @@
3483
4044
  }, {
3484
4045
  key: 'getCenterLeafHeaders',
3485
4046
  debug: function debug() {
3486
- var _instance$options$deb18;
4047
+ var _instance$options$deb13;
3487
4048
 
3488
- return (_instance$options$deb18 = instance.options.debugAll) != null ? _instance$options$deb18 : instance.options.debugHeaders;
4049
+ return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
3489
4050
  }
3490
4051
  }),
3491
4052
  getLeftLeafHeaders: memo(function () {
@@ -3499,9 +4060,9 @@
3499
4060
  }, {
3500
4061
  key: 'getLeftLeafHeaders',
3501
4062
  debug: function debug() {
3502
- var _instance$options$deb19;
4063
+ var _instance$options$deb14;
3503
4064
 
3504
- return (_instance$options$deb19 = instance.options.debugAll) != null ? _instance$options$deb19 : instance.options.debugHeaders;
4065
+ return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
3505
4066
  }
3506
4067
  }),
3507
4068
  getRightLeafHeaders: memo(function () {
@@ -3515,9 +4076,9 @@
3515
4076
  }, {
3516
4077
  key: 'getRightLeafHeaders',
3517
4078
  debug: function debug() {
3518
- var _instance$options$deb20;
4079
+ var _instance$options$deb15;
3519
4080
 
3520
- return (_instance$options$deb20 = instance.options.debugAll) != null ? _instance$options$deb20 : instance.options.debugHeaders;
4081
+ return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
3521
4082
  }
3522
4083
  }),
3523
4084
  getLeafHeaders: memo(function () {
@@ -3531,9 +4092,9 @@
3531
4092
  }, {
3532
4093
  key: 'getLeafHeaders',
3533
4094
  debug: function debug() {
3534
- var _instance$options$deb21;
4095
+ var _instance$options$deb16;
3535
4096
 
3536
- return (_instance$options$deb21 = instance.options.debugAll) != null ? _instance$options$deb21 : instance.options.debugHeaders;
4097
+ return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
3537
4098
  }
3538
4099
  }),
3539
4100
  getHeader: function getHeader(id) {
@@ -3604,15 +4165,6 @@
3604
4165
  rowSpan: header.rowSpan
3605
4166
  };
3606
4167
  return propGetter(initialProps, userProps);
3607
- },
3608
- getTotalWidth: function getTotalWidth() {
3609
- var width = 0;
3610
- instance.getVisibleLeafColumns().forEach(function (column) {
3611
- var _column$getWidth;
3612
-
3613
- width += (_column$getWidth = column.getWidth()) != null ? _column$getWidth : 0;
3614
- });
3615
- return width;
3616
4168
  }
3617
4169
  };
3618
4170
  }
@@ -3661,11 +4213,11 @@
3661
4213
  }
3662
4214
  }; // The parent columns we're going to scan next
3663
4215
 
3664
- var parentHeaders = []; // Scan each column for parents
4216
+ var pendingParentHeaders = []; // Scan each column for parents
3665
4217
 
3666
4218
  headersToGroup.forEach(function (headerToGroup) {
3667
4219
  // What is the latest (last) parent column?
3668
- var latestParentHeader = [].concat(parentHeaders).reverse()[0];
4220
+ var latestPendingParentHeader = [].concat(pendingParentHeaders).reverse()[0];
3669
4221
  var isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
3670
4222
  var column;
3671
4223
  var isPlaceholder = false;
@@ -3679,37 +4231,41 @@
3679
4231
  isPlaceholder = true;
3680
4232
  }
3681
4233
 
3682
- var header = instance.createHeader(column, {
3683
- id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
3684
- isPlaceholder: isPlaceholder,
3685
- placeholderId: isPlaceholder ? "" + parentHeaders.filter(function (d) {
3686
- return d.column === column;
3687
- }).length : undefined,
3688
- depth: depth
3689
- });
3690
-
3691
- if (!latestParentHeader || latestParentHeader.column !== header.column) {
3692
- header.subHeaders.push(headerToGroup);
3693
- parentHeaders.push(header);
4234
+ if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
4235
+ // This column is repeated. Add it as a sub header to the next batch
4236
+ latestPendingParentHeader.subHeaders.push(headerToGroup);
3694
4237
  } else {
3695
- latestParentHeader.subHeaders.push(headerToGroup);
3696
- } // if (!headerToGroup.isPlaceholder) {
3697
- // headerToGroup.column.header = headerToGroup;
3698
- // }
3699
-
4238
+ // This is a new header. Let's create it
4239
+ var header = instance.createHeader(column, {
4240
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
4241
+ isPlaceholder: isPlaceholder,
4242
+ placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(function (d) {
4243
+ return d.column === column;
4244
+ }).length : undefined,
4245
+ depth: depth,
4246
+ index: pendingParentHeaders.length
4247
+ }); // Add the headerToGroup as a subHeader of the new header
4248
+
4249
+ header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
4250
+ // in the next batch
4251
+
4252
+ pendingParentHeaders.push(header);
4253
+ }
3700
4254
 
3701
4255
  headerGroup.headers.push(headerToGroup);
4256
+ headerToGroup.headerGroup = headerGroup;
3702
4257
  });
3703
4258
  headerGroups.push(headerGroup);
3704
4259
 
3705
4260
  if (depth > 0) {
3706
- createHeaderGroup(parentHeaders, depth - 1);
4261
+ createHeaderGroup(pendingParentHeaders, depth - 1);
3707
4262
  }
3708
4263
  };
3709
4264
 
3710
- var bottomHeaders = columnsToGroup.map(function (column) {
4265
+ var bottomHeaders = columnsToGroup.map(function (column, index) {
3711
4266
  return instance.createHeader(column, {
3712
- depth: maxDepth
4267
+ depth: maxDepth,
4268
+ index: index
3713
4269
  });
3714
4270
  });
3715
4271
  createHeaderGroup(bottomHeaders, maxDepth - 1);
@@ -3753,7 +4309,6 @@
3753
4309
  return headerGroups;
3754
4310
  }
3755
4311
 
3756
- var features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
3757
4312
  function createTableInstance(options) {
3758
4313
  var _options$initialState;
3759
4314
 
@@ -3762,7 +4317,9 @@
3762
4317
  }
3763
4318
 
3764
4319
  var instance = {};
3765
- var defaultOptions = features.reduce(function (obj, feature) {
4320
+ instance._features = [Columns, Rows, Cells, Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
4321
+
4322
+ var defaultOptions = instance._features.reduce(function (obj, feature) {
3766
4323
  return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(instance));
3767
4324
  }, {});
3768
4325
 
@@ -3775,15 +4332,15 @@
3775
4332
  coreProgress: 1
3776
4333
  };
3777
4334
 
3778
- var initialState = _extends({}, coreInitialState, features.reduce(function (obj, feature) {
4335
+ var initialState = _extends({}, coreInitialState, instance._features.reduce(function (obj, feature) {
3779
4336
  return Object.assign(obj, feature.getInitialState == null ? void 0 : feature.getInitialState());
3780
4337
  }, {}), (_options$initialState = options.initialState) != null ? _options$initialState : {});
3781
4338
 
3782
4339
  var queued = [];
3783
4340
  var queuedTimeout;
3784
4341
 
3785
- var finalInstance = _extends({}, instance, features.reduce(function (obj, feature) {
3786
- return Object.assign(obj, feature.getInstance == null ? void 0 : feature.getInstance(instance));
4342
+ var finalInstance = _extends({}, instance, instance._features.reduce(function (obj, feature) {
4343
+ return Object.assign(obj, feature.createInstance == null ? void 0 : feature.createInstance(instance));
3787
4344
  }, {}), {
3788
4345
  queue: function queue(cb) {
3789
4346
  queued.push(cb);
@@ -3827,331 +4384,12 @@
3827
4384
 
3828
4385
  return template;
3829
4386
  },
3830
- getRowId: function getRowId(row, index, parent) {
3831
- var _instance$options$get;
3832
-
3833
- return (_instance$options$get = instance.options.getRowId == null ? void 0 : instance.options.getRowId(row, index, parent)) != null ? _instance$options$get : "" + (parent ? [parent.id, index].join('.') : index);
3834
- },
3835
4387
  getState: function getState() {
3836
4388
  return instance.options.state;
3837
4389
  },
3838
4390
  setState: function setState(updater) {
3839
4391
  instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
3840
4392
  },
3841
- getDefaultColumn: memo(function () {
3842
- return [instance.options.defaultColumn];
3843
- }, function (defaultColumn) {
3844
- var _defaultColumn;
3845
-
3846
- defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
3847
- return _extends({
3848
- header: function header(props) {
3849
- return props.header.column.id;
3850
- },
3851
- footer: function footer(props) {
3852
- return props.header.column.id;
3853
- },
3854
- cell: function cell(_ref) {
3855
- var _ref$value = _ref.value,
3856
- value = _ref$value === void 0 ? '' : _ref$value;
3857
- return typeof value === 'boolean' ? value.toString() : value;
3858
- }
3859
- }, features.reduce(function (obj, feature) {
3860
- return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
3861
- }, {}), defaultColumn);
3862
- }, {
3863
- debug: function debug() {
3864
- var _instance$options$deb;
3865
-
3866
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
3867
- },
3868
- key: 'getDefaultColumn'
3869
- }),
3870
- getColumnDefs: function getColumnDefs() {
3871
- return instance.options.columns;
3872
- },
3873
- createColumn: function createColumn(columnDef, depth, parent) {
3874
- var _ref2, _columnDef$id;
3875
-
3876
- var defaultColumn = instance.getDefaultColumn();
3877
- var id = (_ref2 = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref2 : typeof columnDef.header === 'string' ? columnDef.header : undefined;
3878
- var accessorFn;
3879
-
3880
- if (columnDef.accessorFn) {
3881
- accessorFn = columnDef.accessorFn;
3882
- } else if (columnDef.accessorKey) {
3883
- accessorFn = function accessorFn(originalRow) {
3884
- return originalRow[columnDef.accessorKey];
3885
- };
3886
- }
3887
-
3888
- if (!id) {
3889
- {
3890
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
3891
- }
3892
- }
3893
-
3894
- var column = _extends({}, defaultColumn, columnDef, {
3895
- id: "" + id,
3896
- accessorFn: accessorFn,
3897
- parent: parent,
3898
- depth: depth,
3899
- columnDef: columnDef,
3900
- columnDefType: columnDef.columnDefType,
3901
- columns: [],
3902
- getWidth: function getWidth() {
3903
- return instance.getColumnWidth(column.id);
3904
- },
3905
- getFlatColumns: memo(function () {
3906
- return [true];
3907
- }, function () {
3908
- var _column$columns;
3909
-
3910
- return [column].concat((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(function (d) {
3911
- return d.getFlatColumns();
3912
- }));
3913
- }, {
3914
- key: 'column.getFlatColumns',
3915
- debug: function debug() {
3916
- var _instance$options$deb2;
3917
-
3918
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
3919
- }
3920
- }),
3921
- getLeafColumns: memo(function () {
3922
- return [instance._getOrderColumnsFn()];
3923
- }, function (orderColumns) {
3924
- var _column$columns2;
3925
-
3926
- if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
3927
- var leafColumns = column.columns.flatMap(function (column) {
3928
- return column.getLeafColumns();
3929
- });
3930
- return orderColumns(leafColumns);
3931
- }
3932
-
3933
- return [column];
3934
- }, {
3935
- key: 'column.getLeafColumns',
3936
- debug: function debug() {
3937
- var _instance$options$deb3;
3938
-
3939
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
3940
- }
3941
- })
3942
- });
3943
-
3944
- column = features.reduce(function (obj, feature) {
3945
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
3946
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
3947
-
3948
- return column;
3949
- },
3950
- getAllColumns: memo(function () {
3951
- return [instance.getColumnDefs()];
3952
- }, function (columnDefs) {
3953
- var recurseColumns = function recurseColumns(columnDefs, parent, depth) {
3954
- if (depth === void 0) {
3955
- depth = 0;
3956
- }
3957
-
3958
- return columnDefs.map(function (columnDef) {
3959
- var column = instance.createColumn(columnDef, depth, parent);
3960
- column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
3961
- return column;
3962
- });
3963
- };
3964
-
3965
- return recurseColumns(columnDefs);
3966
- }, {
3967
- key: 'getAllColumns',
3968
- debug: function debug() {
3969
- var _instance$options$deb4;
3970
-
3971
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
3972
- }
3973
- }),
3974
- getAllFlatColumns: memo(function () {
3975
- return [instance.getAllColumns()];
3976
- }, function (allColumns) {
3977
- return allColumns.flatMap(function (column) {
3978
- return column.getFlatColumns();
3979
- });
3980
- }, {
3981
- key: 'getAllFlatColumns',
3982
- debug: function debug() {
3983
- var _instance$options$deb5;
3984
-
3985
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
3986
- }
3987
- }),
3988
- getAllFlatColumnsById: memo(function () {
3989
- return [instance.getAllFlatColumns()];
3990
- }, function (flatColumns) {
3991
- return flatColumns.reduce(function (acc, column) {
3992
- acc[column.id] = column;
3993
- return acc;
3994
- }, {});
3995
- }, {
3996
- key: 'getAllFlatColumnsById',
3997
- debug: function debug() {
3998
- var _instance$options$deb6;
3999
-
4000
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
4001
- }
4002
- }),
4003
- getAllLeafColumns: memo(function () {
4004
- return [instance.getAllColumns(), instance._getOrderColumnsFn()];
4005
- }, function (allColumns, orderColumns) {
4006
- var leafColumns = allColumns.flatMap(function (column) {
4007
- return column.getLeafColumns();
4008
- });
4009
- return orderColumns(leafColumns);
4010
- }, {
4011
- key: 'getAllLeafColumns',
4012
- debug: function debug() {
4013
- var _instance$options$deb7;
4014
-
4015
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
4016
- }
4017
- }),
4018
- getColumn: function getColumn(columnId) {
4019
- var column = instance.getAllFlatColumnsById()[columnId];
4020
-
4021
- if (!column) {
4022
- {
4023
- console.warn("[Table] Column with id " + columnId + " does not exist.");
4024
- }
4025
-
4026
- throw new Error();
4027
- }
4028
-
4029
- return column;
4030
- },
4031
- createCell: function createCell(row, column, value) {
4032
- var cell = {
4033
- id: row.id + "_" + column.id,
4034
- rowId: row.id,
4035
- columnId: column.id,
4036
- row: row,
4037
- column: column,
4038
- value: value,
4039
- getCellProps: function getCellProps(userProps) {
4040
- return instance.getCellProps(row.id, column.id, userProps);
4041
- },
4042
- renderCell: function renderCell() {
4043
- return column.cell ? instance.render(column.cell, {
4044
- instance: instance,
4045
- column: column,
4046
- row: row,
4047
- cell: cell,
4048
- value: value
4049
- }) : null;
4050
- }
4051
- };
4052
- features.forEach(function (feature) {
4053
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
4054
- }, {});
4055
- return cell;
4056
- },
4057
- createRow: function createRow(id, original, rowIndex, depth, values) {
4058
- var row = {
4059
- id: id,
4060
- index: rowIndex,
4061
- original: original,
4062
- depth: depth,
4063
- values: values,
4064
- subRows: [],
4065
- getLeafRows: function getLeafRows() {
4066
- return flattenBy(row.subRows, function (d) {
4067
- return d.subRows;
4068
- });
4069
- },
4070
- getRowProps: function getRowProps(userProps) {
4071
- return instance.getRowProps(row.id, userProps);
4072
- },
4073
- getAllCells: undefined,
4074
- getAllCellsByColumnId: undefined
4075
- };
4076
- row.getAllCells = memo(function () {
4077
- return [instance.getAllLeafColumns()];
4078
- }, function (leafColumns) {
4079
- return leafColumns.map(function (column) {
4080
- return instance.createCell(row, column, row.values[column.id]);
4081
- });
4082
- }, {
4083
- key: 'row.getAllCells' ,
4084
- debug: function debug() {
4085
- var _instance$options$deb8;
4086
-
4087
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugRows;
4088
- }
4089
- });
4090
- row.getAllCellsByColumnId = memo(function () {
4091
- return [row.getAllCells()];
4092
- }, function (allCells) {
4093
- return allCells.reduce(function (acc, cell) {
4094
- acc[cell.columnId] = cell;
4095
- return acc;
4096
- }, {});
4097
- }, {
4098
- key: 'row.getAllCellsByColumnId',
4099
- debug: function debug() {
4100
- var _instance$options$deb9;
4101
-
4102
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugRows;
4103
- }
4104
- });
4105
-
4106
- for (var i = 0; i < features.length; i++) {
4107
- var feature = features[i];
4108
- Object.assign(row, feature.createRow == null ? void 0 : feature.createRow(row, instance));
4109
- }
4110
-
4111
- return row;
4112
- },
4113
- getCoreRowModel: function getCoreRowModel() {
4114
- if (!instance._getCoreRowModel) {
4115
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
4116
- }
4117
-
4118
- return instance._getCoreRowModel();
4119
- },
4120
- // The final calls start at the bottom of the model,
4121
- // expanded rows, which then work their way up
4122
- getRowModel: function getRowModel() {
4123
- return instance.getPaginationRowModel();
4124
- },
4125
- getRow: function getRow(id) {
4126
- var row = instance.getRowModel().rowsById[id];
4127
-
4128
- if (!row) {
4129
- {
4130
- throw new Error("getRow expected an ID, but got " + id);
4131
- }
4132
- }
4133
-
4134
- return row;
4135
- },
4136
- getCell: function getCell(rowId, columnId) {
4137
- var row = instance.getRow(rowId);
4138
-
4139
- if (!row) {
4140
- {
4141
- throw new Error("[Table] could not find row with id " + rowId);
4142
- }
4143
- }
4144
-
4145
- var cell = row.getAllCellsByColumnId()[columnId];
4146
-
4147
- if (!cell) {
4148
- {
4149
- throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
4150
- }
4151
- }
4152
-
4153
- return cell;
4154
- },
4155
4393
  getTableProps: function getTableProps(userProps) {
4156
4394
  return propGetter({
4157
4395
  role: 'table'
@@ -4162,58 +4400,6 @@
4162
4400
  role: 'rowgroup'
4163
4401
  }, userProps);
4164
4402
  },
4165
- getRowProps: function getRowProps(rowId, userProps) {
4166
- var row = instance.getRow(rowId);
4167
-
4168
- if (!row) {
4169
- return;
4170
- }
4171
-
4172
- return propGetter({
4173
- key: row.id,
4174
- role: 'row'
4175
- }, userProps);
4176
- },
4177
- getCellProps: function getCellProps(rowId, columnId, userProps) {
4178
- var cell = instance.getCell(rowId, columnId);
4179
-
4180
- if (!cell) {
4181
- return;
4182
- }
4183
-
4184
- return propGetter({
4185
- key: cell.id,
4186
- role: 'gridcell'
4187
- }, userProps);
4188
- },
4189
- getTableWidth: function getTableWidth() {
4190
- var _instance$getHeaderGr, _instance$getHeaderGr2;
4191
-
4192
- return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce(function (sum, header) {
4193
- return sum + header.getWidth();
4194
- }, 0)) != null ? _instance$getHeaderGr : 0;
4195
- },
4196
- getLeftTableWidth: function getLeftTableWidth() {
4197
- var _instance$getLeftHead, _instance$getLeftHead2;
4198
-
4199
- return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce(function (sum, header) {
4200
- return sum + header.getWidth();
4201
- }, 0)) != null ? _instance$getLeftHead : 0;
4202
- },
4203
- getCenterTableWidth: function getCenterTableWidth() {
4204
- var _instance$getCenterHe, _instance$getCenterHe2;
4205
-
4206
- return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce(function (sum, header) {
4207
- return sum + header.getWidth();
4208
- }, 0)) != null ? _instance$getCenterHe : 0;
4209
- },
4210
- getRightTableWidth: function getRightTableWidth() {
4211
- var _instance$getRightHea, _instance$getRightHea2;
4212
-
4213
- return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce(function (sum, header) {
4214
- return sum + header.getWidth();
4215
- }, 0)) != null ? _instance$getRightHea : 0;
4216
- },
4217
4403
  getOverallProgress: function getOverallProgress() {
4218
4404
  var _instance$getState = instance.getState(),
4219
4405
  coreProgress = _instance$getState.coreProgress,