@tanstack/table-core 8.0.0-alpha.55 → 8.0.0-alpha.59

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 (88) hide show
  1. package/build/cjs/core.js +18 -404
  2. package/build/cjs/core.js.map +1 -1
  3. package/build/cjs/createTable.js +3 -3
  4. package/build/cjs/createTable.js.map +1 -1
  5. package/build/cjs/features/Cells.js +107 -0
  6. package/build/cjs/features/Cells.js.map +1 -0
  7. package/build/cjs/features/ColumnSizing.js +96 -54
  8. package/build/cjs/features/ColumnSizing.js.map +1 -1
  9. package/build/cjs/features/Columns.js +216 -0
  10. package/build/cjs/features/Columns.js.map +1 -0
  11. package/build/cjs/features/Expanding.js +13 -21
  12. package/build/cjs/features/Expanding.js.map +1 -1
  13. package/build/cjs/features/Filters.js +3 -3
  14. package/build/cjs/features/Filters.js.map +1 -1
  15. package/build/cjs/features/Grouping.js +8 -11
  16. package/build/cjs/features/Grouping.js.map +1 -1
  17. package/build/cjs/features/Headers.js +79 -220
  18. package/build/cjs/features/Headers.js.map +1 -1
  19. package/build/cjs/features/Ordering.js +1 -1
  20. package/build/cjs/features/Ordering.js.map +1 -1
  21. package/build/cjs/features/Pagination.js +5 -5
  22. package/build/cjs/features/Pagination.js.map +1 -1
  23. package/build/cjs/features/Pinning.js +172 -2
  24. package/build/cjs/features/Pinning.js.map +1 -1
  25. package/build/cjs/features/RowSelection.js +16 -48
  26. package/build/cjs/features/RowSelection.js.map +1 -1
  27. package/build/cjs/features/Rows.js +84 -0
  28. package/build/cjs/features/Rows.js.map +1 -0
  29. package/build/cjs/features/Sorting.js +9 -12
  30. package/build/cjs/features/Sorting.js.map +1 -1
  31. package/build/cjs/features/Visibility.js +59 -38
  32. package/build/cjs/features/Visibility.js.map +1 -1
  33. package/build/cjs/filterFns.js +16 -0
  34. package/build/cjs/filterFns.js.map +1 -1
  35. package/build/cjs/index.js +0 -1
  36. package/build/cjs/index.js.map +1 -1
  37. package/build/cjs/utils.js +0 -16
  38. package/build/cjs/utils.js.map +1 -1
  39. package/build/esm/index.js +866 -856
  40. package/build/esm/index.js.map +1 -1
  41. package/build/stats-html.html +1 -1
  42. package/build/stats-react.json +424 -322
  43. package/build/types/core.d.ts +9 -88
  44. package/build/types/createTable.d.ts +10 -11
  45. package/build/types/features/Cells.d.ts +13 -0
  46. package/build/types/features/ColumnSizing.d.ts +24 -30
  47. package/build/types/features/Columns.d.ts +54 -0
  48. package/build/types/features/Expanding.d.ts +6 -9
  49. package/build/types/features/Filters.d.ts +3 -1
  50. package/build/types/features/Grouping.d.ts +6 -9
  51. package/build/types/features/Headers.d.ts +3 -15
  52. package/build/types/features/Ordering.d.ts +1 -1
  53. package/build/types/features/Pagination.d.ts +6 -6
  54. package/build/types/features/Pinning.d.ts +18 -4
  55. package/build/types/features/RowSelection.d.ts +6 -13
  56. package/build/types/features/Rows.d.ts +27 -0
  57. package/build/types/features/Sorting.d.ts +5 -8
  58. package/build/types/features/Visibility.d.ts +9 -7
  59. package/build/types/filterFns.d.ts +5 -0
  60. package/build/types/types.d.ts +27 -69
  61. package/build/types/utils.d.ts +1 -5
  62. package/build/umd/index.development.js +844 -835
  63. package/build/umd/index.development.js.map +1 -1
  64. package/build/umd/index.production.js +1 -1
  65. package/build/umd/index.production.js.map +1 -1
  66. package/package.json +1 -1
  67. package/src/core.ts +55 -601
  68. package/src/createTable.ts +13 -17
  69. package/src/features/Cells.ts +130 -0
  70. package/src/features/ColumnSizing.ts +111 -89
  71. package/src/features/Columns.ts +288 -0
  72. package/src/features/Expanding.ts +20 -42
  73. package/src/features/Filters.ts +11 -3
  74. package/src/features/Grouping.ts +13 -39
  75. package/src/features/Headers.ts +49 -233
  76. package/src/features/Ordering.ts +1 -1
  77. package/src/features/Pagination.ts +14 -4
  78. package/src/features/Pinning.ts +194 -3
  79. package/src/features/RowSelection.ts +26 -88
  80. package/src/features/Rows.ts +123 -0
  81. package/src/features/Sorting.ts +20 -43
  82. package/src/features/Visibility.ts +82 -63
  83. package/src/filterFns.ts +20 -0
  84. package/src/types.ts +59 -133
  85. package/src/utils/getColumnFilteredRowModelAsync.ts +1 -5
  86. package/src/utils/getGlobalFilteredRowModelAsync.ts +2 -6
  87. package/src/utils/getSortedRowModelAsync.ts +0 -1
  88. package/src/utils.ts +2 -31
@@ -98,13 +98,6 @@ function _toPropertyKey(arg) {
98
98
  return typeof key === "symbol" ? key : String(key);
99
99
  }
100
100
 
101
- // export type DefinedGenericKeys<T extends TableGenerics> = {
102
- // [K in keyof T]: 0 extends 1 & T[K] ? never : T[K] extends {} ? K : never
103
- // }[keyof T]
104
- // export type DefinedGenerics<T extends TableGenerics> = Pick<
105
- // T,
106
- // DefinedGenericKeys<T>
107
- // >
108
101
  function functionalUpdate(updater, input) {
109
102
  return typeof updater === 'function' ? updater(input) : updater;
110
103
  }
@@ -165,14 +158,6 @@ function flattenBy(arr, getChildren) {
165
158
  recurse(arr);
166
159
  return flat;
167
160
  }
168
- // @ts-ignore // Just rely on the type, not the implementation
169
- var propGetter = function propGetter(initial, getter) {
170
- if (isFunction(getter)) {
171
- return getter(initial);
172
- }
173
-
174
- return _extends({}, initial, getter != null ? getter : {});
175
- };
176
161
  function memo(getDeps, fn, opts) {
177
162
  var deps = [];
178
163
  var result;
@@ -361,11 +346,363 @@ function incrementalMemo(getDeps, getInitialValue, schedule, opts) {
361
346
  };
362
347
  } // opts?.onChange?.(result, oldResult)
363
348
 
349
+ //
350
+ var Columns = {
351
+ createInstance: function createInstance(instance) {
352
+ return {
353
+ getDefaultColumn: memo(function () {
354
+ return [instance.options.defaultColumn];
355
+ }, function (defaultColumn) {
356
+ var _defaultColumn;
357
+
358
+ defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
359
+ return _extends({
360
+ header: function header(props) {
361
+ return props.header.column.id;
362
+ },
363
+ footer: function footer(props) {
364
+ return props.header.column.id;
365
+ },
366
+ cell: function cell(_ref) {
367
+ var _ref$value = _ref.value,
368
+ value = _ref$value === void 0 ? '' : _ref$value;
369
+ return typeof value === 'boolean' ? value.toString() : value;
370
+ }
371
+ }, instance._features.reduce(function (obj, feature) {
372
+ return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
373
+ }, {}), defaultColumn);
374
+ }, {
375
+ debug: function debug() {
376
+ var _instance$options$deb;
377
+
378
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
379
+ },
380
+ key: 'getDefaultColumn'
381
+ }),
382
+ getColumnDefs: function getColumnDefs() {
383
+ return instance.options.columns;
384
+ },
385
+ createColumn: function createColumn(columnDef, depth, parent) {
386
+ var _ref2, _columnDef$id;
387
+
388
+ var defaultColumn = instance.getDefaultColumn();
389
+ var id = (_ref2 = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref2 : typeof columnDef.header === 'string' ? columnDef.header : undefined;
390
+ var accessorFn;
391
+
392
+ if (columnDef.accessorFn) {
393
+ accessorFn = columnDef.accessorFn;
394
+ } else if (columnDef.accessorKey) {
395
+ accessorFn = function accessorFn(originalRow) {
396
+ return originalRow[columnDef.accessorKey];
397
+ };
398
+ }
399
+
400
+ if (!id) {
401
+ if (process.env.NODE_ENV !== 'production') {
402
+ throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
403
+ }
404
+
405
+ throw new Error();
406
+ }
407
+
408
+ var column = _extends({}, defaultColumn, columnDef, {
409
+ id: "" + id,
410
+ accessorFn: accessorFn,
411
+ parent: parent,
412
+ depth: depth,
413
+ columnDef: columnDef,
414
+ columnDefType: columnDef.columnDefType,
415
+ columns: [],
416
+ getFlatColumns: memo(function () {
417
+ return [true];
418
+ }, function () {
419
+ var _column$columns;
420
+
421
+ return [column].concat((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(function (d) {
422
+ return d.getFlatColumns();
423
+ }));
424
+ }, {
425
+ key: 'column.getFlatColumns',
426
+ debug: function debug() {
427
+ var _instance$options$deb2;
428
+
429
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
430
+ }
431
+ }),
432
+ getLeafColumns: memo(function () {
433
+ return [instance._getOrderColumnsFn()];
434
+ }, function (orderColumns) {
435
+ var _column$columns2;
436
+
437
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
438
+ var leafColumns = column.columns.flatMap(function (column) {
439
+ return column.getLeafColumns();
440
+ });
441
+ return orderColumns(leafColumns);
442
+ }
443
+
444
+ return [column];
445
+ }, {
446
+ key: 'column.getLeafColumns',
447
+ debug: function debug() {
448
+ var _instance$options$deb3;
449
+
450
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
451
+ }
452
+ })
453
+ });
454
+
455
+ column = instance._features.reduce(function (obj, feature) {
456
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
457
+ }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
458
+
459
+ return column;
460
+ },
461
+ getAllColumns: memo(function () {
462
+ return [instance.getColumnDefs()];
463
+ }, function (columnDefs) {
464
+ var recurseColumns = function recurseColumns(columnDefs, parent, depth) {
465
+ if (depth === void 0) {
466
+ depth = 0;
467
+ }
468
+
469
+ return columnDefs.map(function (columnDef) {
470
+ var column = instance.createColumn(columnDef, depth, parent);
471
+ column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
472
+ return column;
473
+ });
474
+ };
475
+
476
+ return recurseColumns(columnDefs);
477
+ }, {
478
+ key: 'getAllColumns',
479
+ debug: function debug() {
480
+ var _instance$options$deb4;
481
+
482
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
483
+ }
484
+ }),
485
+ getAllFlatColumns: memo(function () {
486
+ return [instance.getAllColumns()];
487
+ }, function (allColumns) {
488
+ return allColumns.flatMap(function (column) {
489
+ return column.getFlatColumns();
490
+ });
491
+ }, {
492
+ key: 'getAllFlatColumns',
493
+ debug: function debug() {
494
+ var _instance$options$deb5;
495
+
496
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
497
+ }
498
+ }),
499
+ getAllFlatColumnsById: memo(function () {
500
+ return [instance.getAllFlatColumns()];
501
+ }, function (flatColumns) {
502
+ return flatColumns.reduce(function (acc, column) {
503
+ acc[column.id] = column;
504
+ return acc;
505
+ }, {});
506
+ }, {
507
+ key: 'getAllFlatColumnsById',
508
+ debug: function debug() {
509
+ var _instance$options$deb6;
510
+
511
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
512
+ }
513
+ }),
514
+ getAllLeafColumns: memo(function () {
515
+ return [instance.getAllColumns(), instance._getOrderColumnsFn()];
516
+ }, function (allColumns, orderColumns) {
517
+ var leafColumns = allColumns.flatMap(function (column) {
518
+ return column.getLeafColumns();
519
+ });
520
+ return orderColumns(leafColumns);
521
+ }, {
522
+ key: 'getAllLeafColumns',
523
+ debug: function debug() {
524
+ var _instance$options$deb7;
525
+
526
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
527
+ }
528
+ }),
529
+ getColumn: function getColumn(columnId) {
530
+ var column = instance.getAllFlatColumnsById()[columnId];
531
+
532
+ if (!column) {
533
+ if (process.env.NODE_ENV !== 'production') {
534
+ console.warn("[Table] Column with id " + columnId + " does not exist.");
535
+ }
536
+
537
+ throw new Error();
538
+ }
539
+
540
+ return column;
541
+ }
542
+ };
543
+ }
544
+ };
545
+
546
+ //
547
+ var Rows = {
548
+ // createRow: <TGenerics extends TableGenerics>(
549
+ // row: Row<TGenerics>,
550
+ // instance: TableInstance<TGenerics>
551
+ // ): CellsRow<TGenerics> => {
552
+ // return {}
553
+ // },
554
+ createInstance: function createInstance(instance) {
555
+ return {
556
+ getRowId: function getRowId(row, index, parent) {
557
+ var _instance$options$get;
558
+
559
+ 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);
560
+ },
561
+ createRow: function createRow(id, original, rowIndex, depth, values) {
562
+ var row = {
563
+ id: id,
564
+ index: rowIndex,
565
+ original: original,
566
+ depth: depth,
567
+ values: values,
568
+ subRows: [],
569
+ getLeafRows: function getLeafRows() {
570
+ return flattenBy(row.subRows, function (d) {
571
+ return d.subRows;
572
+ });
573
+ }
574
+ };
575
+
576
+ for (var i = 0; i < instance._features.length; i++) {
577
+ var feature = instance._features[i];
578
+ Object.assign(row, feature.createRow == null ? void 0 : feature.createRow(row, instance));
579
+ }
580
+
581
+ return row;
582
+ },
583
+ getCoreRowModel: function getCoreRowModel() {
584
+ if (!instance._getCoreRowModel) {
585
+ instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
586
+ }
587
+
588
+ return instance._getCoreRowModel();
589
+ },
590
+ // The final calls start at the bottom of the model,
591
+ // expanded rows, which then work their way up
592
+ getRowModel: function getRowModel() {
593
+ return instance.getPaginationRowModel();
594
+ },
595
+ getRow: function getRow(id) {
596
+ var row = instance.getRowModel().rowsById[id];
597
+
598
+ if (!row) {
599
+ if (process.env.NODE_ENV !== 'production') {
600
+ throw new Error("getRow expected an ID, but got " + id);
601
+ }
602
+
603
+ throw new Error();
604
+ }
605
+
606
+ return row;
607
+ }
608
+ };
609
+ }
610
+ };
611
+
612
+ //
613
+ var Cells = {
614
+ createRow: function createRow(row, instance) {
615
+ return {
616
+ getAllCells: memo(function () {
617
+ return [instance.getAllLeafColumns()];
618
+ }, function (leafColumns) {
619
+ return leafColumns.map(function (column) {
620
+ return instance.createCell(row, column, row.values[column.id]);
621
+ });
622
+ }, {
623
+ key: process.env.NODE_ENV !== 'production' ? 'row.getAllCells' : '',
624
+ debug: function debug() {
625
+ var _instance$options$deb;
626
+
627
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
628
+ }
629
+ }),
630
+ getAllCellsByColumnId: memo(function () {
631
+ return [row.getAllCells()];
632
+ }, function (allCells) {
633
+ return allCells.reduce(function (acc, cell) {
634
+ acc[cell.columnId] = cell;
635
+ return acc;
636
+ }, {});
637
+ }, {
638
+ key: 'row.getAllCellsByColumnId',
639
+ debug: function debug() {
640
+ var _instance$options$deb2;
641
+
642
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
643
+ }
644
+ })
645
+ };
646
+ },
647
+ createInstance: function createInstance(instance) {
648
+ return {
649
+ createCell: function createCell(row, column, value) {
650
+ var cell = {
651
+ id: row.id + "_" + column.id,
652
+ rowId: row.id,
653
+ columnId: column.id,
654
+ row: row,
655
+ column: column,
656
+ value: value,
657
+ renderCell: function renderCell() {
658
+ return column.cell ? instance.render(column.cell, {
659
+ instance: instance,
660
+ column: column,
661
+ row: row,
662
+ cell: cell,
663
+ value: value
664
+ }) : null;
665
+ }
666
+ };
667
+
668
+ instance._features.forEach(function (feature) {
669
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
670
+ }, {});
671
+
672
+ return cell;
673
+ },
674
+ getCell: function getCell(rowId, columnId) {
675
+ var row = instance.getRow(rowId);
676
+
677
+ if (!row) {
678
+ if (process.env.NODE_ENV !== 'production') {
679
+ throw new Error("[Table] could not find row with id " + rowId);
680
+ }
681
+
682
+ throw new Error();
683
+ }
684
+
685
+ var cell = row.getAllCellsByColumnId()[columnId];
686
+
687
+ if (!cell) {
688
+ if (process.env.NODE_ENV !== 'production') {
689
+ throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
690
+ }
691
+
692
+ throw new Error();
693
+ }
694
+
695
+ return cell;
696
+ }
697
+ };
698
+ }
699
+ };
700
+
364
701
  //
365
702
  var defaultColumnSizing = {
366
- width: 150,
367
- minWidth: 20,
368
- maxWidth: Number.MAX_SAFE_INTEGER
703
+ size: 150,
704
+ minSize: 20,
705
+ maxSize: Number.MAX_SAFE_INTEGER
369
706
  };
370
707
  var ColumnSizing = {
371
708
  getDefaultColumn: function getDefaultColumn() {
@@ -391,10 +728,45 @@ var ColumnSizing = {
391
728
  onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
392
729
  };
393
730
  },
394
- getInstance: function getInstance(instance) {
731
+ createColumn: function createColumn(column, instance) {
732
+ return {
733
+ getSize: function getSize() {
734
+ return instance.getColumnSize(column.id);
735
+ },
736
+ getStart: function getStart(position) {
737
+ return instance.getColumnStart(column.id, position);
738
+ },
739
+ getIsResizing: function getIsResizing() {
740
+ return instance.getColumnIsResizing(column.id);
741
+ },
742
+ getCanResize: function getCanResize() {
743
+ return instance.getColumnCanResize(column.id);
744
+ },
745
+ resetSize: function resetSize() {
746
+ return instance.resetColumnSize(column.id);
747
+ }
748
+ };
749
+ },
750
+ createHeader: function createHeader(header, instance) {
751
+ return {
752
+ getIsResizing: function getIsResizing() {
753
+ return instance.getColumnIsResizing(header.column.id);
754
+ },
755
+ getCanResize: function getCanResize() {
756
+ return instance.getColumnCanResize(header.column.id);
757
+ },
758
+ resetSize: function resetSize() {
759
+ return instance.resetColumnSize(header.column.id);
760
+ },
761
+ getResizeHandler: function getResizeHandler() {
762
+ return instance.getResizeHandler(header.id);
763
+ }
764
+ };
765
+ },
766
+ createInstance: function createInstance(instance) {
395
767
  return {
396
- getColumnWidth: function getColumnWidth(columnId) {
397
- var _column$minWidth, _ref, _column$maxWidth;
768
+ getColumnSize: function getColumnSize(columnId) {
769
+ var _column$minSize, _ref, _column$maxSize;
398
770
 
399
771
  var column = instance.getColumn(columnId);
400
772
 
@@ -403,7 +775,26 @@ var ColumnSizing = {
403
775
  }
404
776
 
405
777
  var columnSize = instance.getState().columnSizing[column.id];
406
- 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);
778
+ 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);
779
+ },
780
+ getColumnStart: function getColumnStart(columnId, position) {
781
+ var column = instance.getColumn(columnId);
782
+
783
+ if (!column) {
784
+ throw new Error();
785
+ }
786
+
787
+ var columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
788
+ var index = columns.findIndex(function (d) {
789
+ return d.id === columnId;
790
+ });
791
+
792
+ if (index > 0) {
793
+ var prevSiblingColumn = columns[index - 1];
794
+ return instance.getColumnStart(prevSiblingColumn.id, position) + prevSiblingColumn.getSize();
795
+ }
796
+
797
+ return 0;
407
798
  },
408
799
  setColumnSizing: function setColumnSizing(updater) {
409
800
  return instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater);
@@ -471,12 +862,16 @@ var ColumnSizing = {
471
862
 
472
863
  return instance.getColumnIsResizing(header.column.id);
473
864
  },
474
- getHeaderResizerProps: function getHeaderResizerProps(headerId, userProps) {
865
+ getResizeHandler: function getResizeHandler(headerId) {
475
866
  var header = instance.getHeader(headerId);
476
867
  var column = instance.getColumn(header.column.id);
477
868
  var canResize = column.getCanResize();
869
+ return function (e) {
870
+ if (!canResize) {
871
+ return;
872
+ }
873
+ e.persist == null ? void 0 : e.persist();
478
874
 
479
- var onResizeStart = function onResizeStart(e) {
480
875
  if (isTouchStartEvent(e)) {
481
876
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
482
877
  if (e.touches && e.touches.length > 1) {
@@ -485,10 +880,10 @@ var ColumnSizing = {
485
880
  }
486
881
 
487
882
  var header = headerId ? instance.getHeader(headerId) : undefined;
488
- var startSize = header ? header.getWidth() : column.getWidth();
883
+ var startSize = header ? header.getSize() : column.getSize();
489
884
  var columnSizingStart = header ? header.getLeafHeaders().map(function (d) {
490
- return [d.column.id, d.getWidth()];
491
- }) : [[column.id, column.getWidth()]];
885
+ return [d.column.id, d.getSize()];
886
+ }) : [[column.id, column.getSize()]];
492
887
  var clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
493
888
 
494
889
  var updateOffset = function updateOffset(eventType, clientXPos) {
@@ -504,8 +899,8 @@ var ColumnSizing = {
504
899
  var deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
505
900
  old.columnSizingStart.forEach(function (_ref5) {
506
901
  var columnId = _ref5[0],
507
- headerWidth = _ref5[1];
508
- newColumnSizing[columnId] = Math.round(Math.max(headerWidth + headerWidth * deltaPercentage, 0) * 100) / 100;
902
+ headerSize = _ref5[1];
903
+ newColumnSizing[columnId] = Math.round(Math.max(headerSize + headerSize * deltaPercentage, 0) * 100) / 100;
509
904
  });
510
905
  return _extends({}, old, {
511
906
  deltaOffset: deltaOffset,
@@ -593,50 +988,34 @@ var ColumnSizing = {
593
988
  });
594
989
  });
595
990
  };
596
-
597
- var initialProps = canResize ? {
598
- title: 'Toggle Grouping',
599
- draggable: false,
600
- role: 'separator',
601
- onMouseDown: function onMouseDown(e) {
602
- e.persist == null ? void 0 : e.persist();
603
- onResizeStart(e);
604
- },
605
- onTouchStart: function onTouchStart(e) {
606
- e.persist == null ? void 0 : e.persist();
607
- onResizeStart(e);
608
- }
609
- } : {};
610
- return propGetter(initialProps, userProps);
611
- }
612
- };
613
- },
614
- createColumn: function createColumn(column, instance) {
615
- return {
616
- getIsResizing: function getIsResizing() {
617
- return instance.getColumnIsResizing(column.id);
618
- },
619
- getCanResize: function getCanResize() {
620
- return instance.getColumnCanResize(column.id);
621
991
  },
622
- resetSize: function resetSize() {
623
- return instance.resetColumnSize(column.id);
624
- }
625
- };
626
- },
627
- createHeader: function createHeader(header, instance) {
628
- return {
629
- getIsResizing: function getIsResizing() {
630
- return instance.getColumnIsResizing(header.column.id);
992
+ getTotalSize: function getTotalSize() {
993
+ var _instance$getHeaderGr, _instance$getHeaderGr2;
994
+
995
+ return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce(function (sum, header) {
996
+ return sum + header.getSize();
997
+ }, 0)) != null ? _instance$getHeaderGr : 0;
631
998
  },
632
- getCanResize: function getCanResize() {
633
- return instance.getColumnCanResize(header.column.id);
999
+ getLeftTotalSize: function getLeftTotalSize() {
1000
+ var _instance$getLeftHead, _instance$getLeftHead2;
1001
+
1002
+ return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce(function (sum, header) {
1003
+ return sum + header.getSize();
1004
+ }, 0)) != null ? _instance$getLeftHead : 0;
634
1005
  },
635
- resetSize: function resetSize() {
636
- return instance.resetColumnSize(header.column.id);
1006
+ getCenterTotalSize: function getCenterTotalSize() {
1007
+ var _instance$getCenterHe, _instance$getCenterHe2;
1008
+
1009
+ return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce(function (sum, header) {
1010
+ return sum + header.getSize();
1011
+ }, 0)) != null ? _instance$getCenterHe : 0;
637
1012
  },
638
- getResizerProps: function getResizerProps(userProps) {
639
- return instance.getHeaderResizerProps(header.id, userProps);
1013
+ getRightTotalSize: function getRightTotalSize() {
1014
+ var _instance$getRightHea, _instance$getRightHea2;
1015
+
1016
+ return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce(function (sum, header) {
1017
+ return sum + header.getSize();
1018
+ }, 0)) != null ? _instance$getRightHea : 0;
640
1019
  }
641
1020
  };
642
1021
  }
@@ -686,7 +1065,7 @@ var Expanding = {
686
1065
  paginateExpandedRows: true
687
1066
  };
688
1067
  },
689
- getInstance: function getInstance(instance) {
1068
+ createInstance: function createInstance(instance) {
690
1069
  var registered = false;
691
1070
  return {
692
1071
  queueResetExpanded: function queueResetExpanded() {
@@ -791,7 +1170,7 @@ var Expanding = {
791
1170
  return instance.getRowCanExpand(id);
792
1171
  });
793
1172
  },
794
- getToggleExpandedProps: function getToggleExpandedProps(rowId, userProps) {
1173
+ getToggleExpandedHandler: function getToggleExpandedHandler(rowId) {
795
1174
  var row = instance.getRow(rowId);
796
1175
 
797
1176
  if (!row) {
@@ -799,24 +1178,16 @@ var Expanding = {
799
1178
  }
800
1179
 
801
1180
  var canExpand = instance.getRowCanExpand(rowId);
802
- var initialProps = {
803
- title: canExpand ? 'Toggle Expanded' : undefined,
804
- onClick: canExpand ? function (e) {
805
- e.persist == null ? void 0 : e.persist();
806
- instance.toggleRowExpanded(rowId);
807
- } : undefined
1181
+ return function () {
1182
+ if (!canExpand) return;
1183
+ instance.toggleRowExpanded(rowId);
808
1184
  };
809
- return propGetter(initialProps, userProps);
810
- },
811
- getToggleAllRowsExpandedProps: function getToggleAllRowsExpandedProps(userProps) {
812
- var initialProps = {
813
- title: 'Toggle All Expanded',
814
- onClick: function onClick(e) {
815
- e.persist == null ? void 0 : e.persist();
816
- instance.toggleAllRowsExpanded();
817
- }
1185
+ },
1186
+ getToggleAllRowsExpandedHandler: function getToggleAllRowsExpandedHandler() {
1187
+ return function (e) {
1188
+ e.persist == null ? void 0 : e.persist();
1189
+ instance.toggleAllRowsExpanded();
818
1190
  };
819
- return propGetter(initialProps, userProps);
820
1191
  },
821
1192
  getIsSomeRowsExpanded: function getIsSomeRowsExpanded() {
822
1193
  var expanded = instance.getState().expanded;
@@ -856,7 +1227,7 @@ var Expanding = {
856
1227
  instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
857
1228
  }
858
1229
 
859
- if (!instance._getExpandedRowModel) {
1230
+ if (instance.options.manualExpanding || !instance._getExpandedRowModel) {
860
1231
  return instance.getPreExpandedRowModel();
861
1232
  }
862
1233
 
@@ -875,8 +1246,8 @@ var Expanding = {
875
1246
  getCanExpand: function getCanExpand() {
876
1247
  return row.subRows && !!row.subRows.length;
877
1248
  },
878
- getToggleExpandedProps: function getToggleExpandedProps(userProps) {
879
- return instance.getToggleExpandedProps(row.id, userProps);
1249
+ getToggleExpandedHandler: function getToggleExpandedHandler() {
1250
+ return instance.getToggleExpandedHandler(row.id);
880
1251
  }
881
1252
  };
882
1253
  }
@@ -889,6 +1260,7 @@ var filterFns = {
889
1260
  equalsStringSensitive: equalsStringSensitive,
890
1261
  arrIncludes: arrIncludes,
891
1262
  arrIncludesAll: arrIncludesAll,
1263
+ arrIncludesSome: arrIncludesSome,
892
1264
  equals: equals,
893
1265
  weakEquals: weakEquals,
894
1266
  betweenNumberRange: betweenNumberRange
@@ -978,7 +1350,22 @@ arrIncludesAll.autoRemove = function (val) {
978
1350
  return testFalsey(val) || !(val != null && val.length);
979
1351
  };
980
1352
 
981
- function equals(rows, columnIds, filterValue) {
1353
+ function arrIncludesSome(rows, columnIds, filterValue) {
1354
+ return rows.filter(function (row) {
1355
+ return columnIds.some(function (id) {
1356
+ var rowValue = row.values[id];
1357
+ return rowValue && rowValue.length && filterValue.some(function (val) {
1358
+ return rowValue.includes(val);
1359
+ });
1360
+ });
1361
+ });
1362
+ }
1363
+
1364
+ arrIncludesSome.autoRemove = function (val) {
1365
+ return testFalsey(val) || !(val != null && val.length);
1366
+ };
1367
+
1368
+ function equals(rows, columnIds, filterValue) {
982
1369
  return rows.filter(function (row) {
983
1370
  return columnIds.some(function (id) {
984
1371
  var rowValue = row.values[id];
@@ -1145,7 +1532,7 @@ var Filters = {
1145
1532
  }
1146
1533
  };
1147
1534
  },
1148
- getInstance: function getInstance(instance) {
1535
+ createInstance: function createInstance(instance) {
1149
1536
  var registered = false;
1150
1537
  return {
1151
1538
  queueResetFilters: function queueResetFilters() {
@@ -1347,7 +1734,7 @@ var Filters = {
1347
1734
  instance._getColumnFilteredRowModel = instance.options.getColumnFilteredRowModel(instance);
1348
1735
  }
1349
1736
 
1350
- if (!instance._getColumnFilteredRowModel) {
1737
+ if (instance.options.manualColumnFiltering || !instance._getColumnFilteredRowModel) {
1351
1738
  return instance.getPreColumnFilteredRowModel();
1352
1739
  }
1353
1740
 
@@ -1361,7 +1748,7 @@ var Filters = {
1361
1748
  instance._getGlobalFilteredRowModel = instance.options.getGlobalFilteredRowModel(instance);
1362
1749
  }
1363
1750
 
1364
- if (!instance._getGlobalFilteredRowModel) {
1751
+ if (instance.options.manualGlobalFiltering || !instance._getGlobalFilteredRowModel) {
1365
1752
  return instance.getPreGlobalFilteredRowModel();
1366
1753
  }
1367
1754
 
@@ -1522,12 +1909,12 @@ var Grouping = {
1522
1909
  toggleGrouping: function toggleGrouping() {
1523
1910
  return instance.toggleColumnGrouping(column.id);
1524
1911
  },
1525
- getToggleGroupingProps: function getToggleGroupingProps(userProps) {
1526
- return instance.getToggleGroupingProps(column.id, userProps);
1912
+ getToggleGroupingHandler: function getToggleGroupingHandler() {
1913
+ return instance.getToggleGroupingHandler(column.id);
1527
1914
  }
1528
1915
  };
1529
1916
  },
1530
- getInstance: function getInstance(instance) {
1917
+ createInstance: function createInstance(instance) {
1531
1918
  var registered = false;
1532
1919
  return {
1533
1920
  queueResetGrouping: function queueResetGrouping() {
@@ -1613,16 +2000,13 @@ var Grouping = {
1613
2000
 
1614
2001
  instance.setGrouping((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
1615
2002
  },
1616
- getToggleGroupingProps: function getToggleGroupingProps(columnId, userProps) {
2003
+ getToggleGroupingHandler: function getToggleGroupingHandler(columnId) {
1617
2004
  var column = instance.getColumn(columnId);
1618
2005
  var canGroup = column.getCanGroup();
1619
- var initialProps = {
1620
- title: canGroup ? 'Toggle Grouping' : undefined,
1621
- onClick: canGroup ? function (e) {
1622
- column.toggleGrouping == null ? void 0 : column.toggleGrouping();
1623
- } : undefined
2006
+ return function () {
2007
+ if (!canGroup) return;
2008
+ column.toggleGrouping == null ? void 0 : column.toggleGrouping();
1624
2009
  };
1625
- return propGetter(initialProps, userProps);
1626
2010
  },
1627
2011
  getRowIsGrouped: function getRowIsGrouped(rowId) {
1628
2012
  var _instance$getRow;
@@ -1637,7 +2021,7 @@ var Grouping = {
1637
2021
  instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
1638
2022
  }
1639
2023
 
1640
- if (!instance._getGroupedRowModel) {
2024
+ if (instance.options.manualGrouping || !instance._getGroupedRowModel) {
1641
2025
  return instance.getPreGroupedRowModel();
1642
2026
  }
1643
2027
 
@@ -1713,7 +2097,7 @@ var Ordering = {
1713
2097
  onColumnOrderChange: makeStateUpdater('columnOrder', instance)
1714
2098
  };
1715
2099
  },
1716
- getInstance: function getInstance(instance) {
2100
+ createInstance: function createInstance(instance) {
1717
2101
  return {
1718
2102
  setColumnOrder: function setColumnOrder(updater) {
1719
2103
  return instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater);
@@ -1770,13 +2154,13 @@ var Ordering = {
1770
2154
 
1771
2155
  //
1772
2156
  var Pagination = {
1773
- getInitialState: function getInitialState() {
2157
+ getInitialState: function getInitialState(initialState) {
1774
2158
  return {
1775
- pagination: {
2159
+ pagination: _extends({
1776
2160
  pageCount: -1,
1777
2161
  pageIndex: 0,
1778
2162
  pageSize: 10
1779
- }
2163
+ }, initialState == null ? void 0 : initialState.pagination)
1780
2164
  };
1781
2165
  },
1782
2166
  getDefaultOptions: function getDefaultOptions(instance) {
@@ -1785,7 +2169,7 @@ var Pagination = {
1785
2169
  autoResetPageIndex: true
1786
2170
  };
1787
2171
  },
1788
- getInstance: function getInstance(instance) {
2172
+ createInstance: function createInstance(instance) {
1789
2173
  var registered = false;
1790
2174
  return {
1791
2175
  queueResetPageIndex: function queueResetPageIndex() {
@@ -1916,7 +2300,7 @@ var Pagination = {
1916
2300
  instance._getPaginationRowModel = instance.options.getPaginationRowModel(instance);
1917
2301
  }
1918
2302
 
1919
- if (!instance._getPaginationRowModel) {
2303
+ if (instance.options.manualPagination || !instance._getPaginationRowModel) {
1920
2304
  return instance.getPrePaginationRowModel();
1921
2305
  }
1922
2306
 
@@ -1966,7 +2350,129 @@ var Pinning = {
1966
2350
  }
1967
2351
  };
1968
2352
  },
1969
- getInstance: function getInstance(instance) {
2353
+ createRow: function createRow(row, instance) {
2354
+ return {
2355
+ getCenterVisibleCells: memo(function () {
2356
+ return [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
2357
+ }, function (allCells, left, right) {
2358
+ var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
2359
+ return allCells.filter(function (d) {
2360
+ return !leftAndRight.includes(d.columnId);
2361
+ });
2362
+ }, {
2363
+ key: 'row.getCenterVisibleCells',
2364
+ debug: function debug() {
2365
+ var _instance$options$deb;
2366
+
2367
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2368
+ }
2369
+ }),
2370
+ getLeftVisibleCells: memo(function () {
2371
+ return [row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
2372
+ }, function (allCells, left) {
2373
+ var cells = (left != null ? left : []).map(function (columnId) {
2374
+ return allCells.find(function (cell) {
2375
+ return cell.columnId === columnId;
2376
+ });
2377
+ }).filter(Boolean).map(function (d) {
2378
+ return _extends({}, d, {
2379
+ position: 'left'
2380
+ });
2381
+ });
2382
+ return cells;
2383
+ }, {
2384
+ key: 'row.getLeftVisibleCells',
2385
+ debug: function debug() {
2386
+ var _instance$options$deb2;
2387
+
2388
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2389
+ }
2390
+ }),
2391
+ getRightVisibleCells: memo(function () {
2392
+ return [row._getAllVisibleCells(), instance.getState().columnPinning.right];
2393
+ }, function (allCells, right) {
2394
+ var cells = (right != null ? right : []).map(function (columnId) {
2395
+ return allCells.find(function (cell) {
2396
+ return cell.columnId === columnId;
2397
+ });
2398
+ }).filter(Boolean).map(function (d) {
2399
+ return _extends({}, d, {
2400
+ position: 'left'
2401
+ });
2402
+ });
2403
+ return cells;
2404
+ }, {
2405
+ key: 'row.getRightVisibleCells',
2406
+ debug: function debug() {
2407
+ var _instance$options$deb3;
2408
+
2409
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
2410
+ }
2411
+ })
2412
+ };
2413
+ },
2414
+ createCell: function createCell(cell, instance) {
2415
+ return {
2416
+ getCenterVisibleCells: memo(function () {
2417
+ return [cell.row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
2418
+ }, function (allCells, left, right) {
2419
+ var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
2420
+ return allCells.filter(function (d) {
2421
+ return !leftAndRight.includes(d.columnId);
2422
+ });
2423
+ }, {
2424
+ key: 'row.getCenterVisibleCells',
2425
+ debug: function debug() {
2426
+ var _instance$options$deb4;
2427
+
2428
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugRows;
2429
+ }
2430
+ }),
2431
+ getLeftVisibleCells: memo(function () {
2432
+ return [cell.row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
2433
+ }, function (allCells, left) {
2434
+ var cells = (left != null ? left : []).map(function (columnId) {
2435
+ return allCells.find(function (cell) {
2436
+ return cell.columnId === columnId;
2437
+ });
2438
+ }).filter(Boolean).map(function (d) {
2439
+ return _extends({}, d, {
2440
+ position: 'left'
2441
+ });
2442
+ });
2443
+ return cells;
2444
+ }, {
2445
+ key: 'row.getLeftVisibleCells',
2446
+ debug: function debug() {
2447
+ var _instance$options$deb5;
2448
+
2449
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugRows;
2450
+ }
2451
+ }),
2452
+ getRightVisibleCells: memo(function () {
2453
+ return [cell.row._getAllVisibleCells(), instance.getState().columnPinning.right];
2454
+ }, function (allCells, right) {
2455
+ var cells = (right != null ? right : []).map(function (columnId) {
2456
+ return allCells.find(function (cell) {
2457
+ return cell.columnId === columnId;
2458
+ });
2459
+ }).filter(Boolean).map(function (d) {
2460
+ return _extends({}, d, {
2461
+ position: 'left'
2462
+ });
2463
+ });
2464
+ return cells;
2465
+ }, {
2466
+ key: 'row.getRightVisibleCells',
2467
+ debug: function debug() {
2468
+ var _instance$options$deb6;
2469
+
2470
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugRows;
2471
+ }
2472
+ })
2473
+ };
2474
+ },
2475
+ createInstance: function createInstance(instance) {
1970
2476
  return {
1971
2477
  setColumnPinning: function setColumnPinning(updater) {
1972
2478
  return instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater);
@@ -2066,7 +2572,54 @@ var Pinning = {
2066
2572
  left = _instance$getState$co5.left,
2067
2573
  right = _instance$getState$co5.right;
2068
2574
  return Boolean((left == null ? void 0 : left.length) || (right == null ? void 0 : right.length));
2069
- }
2575
+ },
2576
+ getLeftLeafColumns: memo(function () {
2577
+ return [instance.getAllLeafColumns(), instance.getState().columnPinning.left];
2578
+ }, function (allColumns, left) {
2579
+ return (left != null ? left : []).map(function (columnId) {
2580
+ return allColumns.find(function (column) {
2581
+ return column.id === columnId;
2582
+ });
2583
+ }).filter(Boolean);
2584
+ }, {
2585
+ key: 'getLeftLeafColumns',
2586
+ debug: function debug() {
2587
+ var _instance$options$deb7;
2588
+
2589
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
2590
+ }
2591
+ }),
2592
+ getRightLeafColumns: memo(function () {
2593
+ return [instance.getAllLeafColumns(), instance.getState().columnPinning.right];
2594
+ }, function (allColumns, right) {
2595
+ return (right != null ? right : []).map(function (columnId) {
2596
+ return allColumns.find(function (column) {
2597
+ return column.id === columnId;
2598
+ });
2599
+ }).filter(Boolean);
2600
+ }, {
2601
+ key: 'getRightLeafColumns',
2602
+ debug: function debug() {
2603
+ var _instance$options$deb8;
2604
+
2605
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugColumns;
2606
+ }
2607
+ }),
2608
+ getCenterLeafColumns: memo(function () {
2609
+ return [instance.getAllLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
2610
+ }, function (allColumns, left, right) {
2611
+ var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
2612
+ return allColumns.filter(function (d) {
2613
+ return !leftAndRight.includes(d.id);
2614
+ });
2615
+ }, {
2616
+ key: 'getCenterLeafColumns',
2617
+ debug: function debug() {
2618
+ var _instance$options$deb9;
2619
+
2620
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugColumns;
2621
+ }
2622
+ })
2070
2623
  };
2071
2624
  }
2072
2625
  };
@@ -2090,7 +2643,7 @@ var RowSelection = {
2090
2643
 
2091
2644
  };
2092
2645
  },
2093
- getInstance: function getInstance(instance) {
2646
+ createInstance: function createInstance(instance) {
2094
2647
  var registered = false; // const pageRows = instance.getPageRows()
2095
2648
 
2096
2649
  return {
@@ -2417,59 +2970,27 @@ var RowSelection = {
2417
2970
  var paginationFlatRows = instance.getPaginationRowModel().flatRows;
2418
2971
  return instance.getIsAllPageRowsSelected() ? false : !!(paginationFlatRows != null && paginationFlatRows.length);
2419
2972
  },
2420
- getToggleRowSelectedProps: function getToggleRowSelectedProps(rowId, userProps) {
2973
+ getToggleRowSelectedHandler: function getToggleRowSelectedHandler(rowId) {
2421
2974
  var row = instance.getRow(rowId);
2422
- var isSelected = row.getIsSelected();
2423
- var isSomeSelected = row.getIsSomeSelected();
2975
+ row.getIsSelected();
2976
+ row.getIsSomeSelected();
2424
2977
  var canSelect = row.getCanSelect();
2425
- var initialProps = {
2426
- onChange: canSelect ? function (e) {
2427
- row.toggleSelected(e.target.checked);
2428
- } : undefined,
2429
- checked: isSelected,
2430
- title: 'Toggle Row Selected',
2431
- indeterminate: isSomeSelected // onChange: forInput
2432
- // ? (e: Event) => e.stopPropagation()
2433
- // : (e: Event) => {
2434
- // if (instance.options.isAdditiveSelectEvent(e)) {
2435
- // row.toggleSelected()
2436
- // } else if (instance.options.isInclusiveSelectEvent(e)) {
2437
- // instance.addRowSelectionRange(row.id)
2438
- // } else {
2439
- // instance.setRowSelection({})
2440
- // row.toggleSelected()
2441
- // }
2442
- // if (props.onClick) props.onClick(e)
2443
- // },
2978
+ return function (e) {
2979
+ var _target;
2444
2980
 
2981
+ if (!canSelect) return;
2982
+ row.toggleSelected((_target = e.target) == null ? void 0 : _target.checked);
2445
2983
  };
2446
- return propGetter(initialProps, userProps);
2447
- },
2448
- getToggleAllRowsSelectedProps: function getToggleAllRowsSelectedProps(userProps) {
2449
- var isSomeRowsSelected = instance.getIsSomeRowsSelected();
2450
- var isAllRowsSelected = instance.getIsAllRowsSelected();
2451
- var initialProps = {
2452
- onChange: function onChange(e) {
2453
- instance.toggleAllRowsSelected(e.target.checked);
2454
- },
2455
- checked: isAllRowsSelected,
2456
- title: 'Toggle All Rows Selected',
2457
- indeterminate: isSomeRowsSelected
2984
+ },
2985
+ getToggleAllRowsSelectedHandler: function getToggleAllRowsSelectedHandler() {
2986
+ return function (e) {
2987
+ instance.toggleAllRowsSelected(e.target.checked);
2458
2988
  };
2459
- return propGetter(initialProps, userProps);
2460
- },
2461
- getToggleAllPageRowsSelectedProps: function getToggleAllPageRowsSelectedProps(userProps) {
2462
- var isSomePageRowsSelected = instance.getIsSomePageRowsSelected();
2463
- var isAllPageRowsSelected = instance.getIsAllPageRowsSelected();
2464
- var initialProps = {
2465
- onChange: function onChange(e) {
2466
- instance.toggleAllPageRowsSelected(e.target.checked);
2467
- },
2468
- checked: isAllPageRowsSelected,
2469
- title: 'Toggle All Current Page Rows Selected',
2470
- indeterminate: isSomePageRowsSelected
2989
+ },
2990
+ getToggleAllPageRowsSelectedHandler: function getToggleAllPageRowsSelectedHandler() {
2991
+ return function (e) {
2992
+ instance.toggleAllPageRowsSelected(e.target.checked);
2471
2993
  };
2472
- return propGetter(initialProps, userProps);
2473
2994
  }
2474
2995
  };
2475
2996
  },
@@ -2484,8 +3005,8 @@ var RowSelection = {
2484
3005
  toggleSelected: function toggleSelected(value) {
2485
3006
  return instance.toggleRowSelected(row.id, value);
2486
3007
  },
2487
- getToggleSelectedProps: function getToggleSelectedProps(userProps) {
2488
- return instance.getToggleRowSelectedProps(row.id, userProps);
3008
+ getToggleSelectedHandler: function getToggleSelectedHandler() {
3009
+ return instance.getToggleRowSelectedHandler(row.id);
2489
3010
  },
2490
3011
  getCanMultiSelect: function getCanMultiSelect() {
2491
3012
  return instance.getRowCanMultiSelect(row.id);
@@ -2728,12 +3249,12 @@ var Sorting = {
2728
3249
  toggleSorting: function toggleSorting(desc, isMulti) {
2729
3250
  return instance.toggleColumnSorting(column.id, desc, isMulti);
2730
3251
  },
2731
- getToggleSortingProps: function getToggleSortingProps(userProps) {
2732
- return instance.getToggleSortingProps(column.id, userProps);
3252
+ getToggleSortingHandler: function getToggleSortingHandler() {
3253
+ return instance.getToggleSortingHandler(column.id);
2733
3254
  }
2734
3255
  };
2735
3256
  },
2736
- getInstance: function getInstance(instance) {
3257
+ createInstance: function createInstance(instance) {
2737
3258
  var registered = false;
2738
3259
  return {
2739
3260
  queueResetSorting: function queueResetSorting() {
@@ -2949,7 +3470,7 @@ var Sorting = {
2949
3470
  instance.setSorting((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2950
3471
  }
2951
3472
  },
2952
- getToggleSortingProps: function getToggleSortingProps(columnId, userProps) {
3473
+ getToggleSortingHandler: function getToggleSortingHandler(columnId) {
2953
3474
  var column = instance.getColumn(columnId);
2954
3475
 
2955
3476
  if (!column) {
@@ -2957,14 +3478,11 @@ var Sorting = {
2957
3478
  }
2958
3479
 
2959
3480
  var canSort = column.getCanSort();
2960
- var initialProps = {
2961
- title: canSort ? 'Toggle Sorting' : undefined,
2962
- onClick: canSort ? function (e) {
2963
- e.persist == null ? void 0 : e.persist();
2964
- column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? instance.options.isMultiSortEvent == null ? void 0 : instance.options.isMultiSortEvent(e) : false);
2965
- } : undefined
3481
+ return function (e) {
3482
+ if (!canSort) return;
3483
+ e.persist == null ? void 0 : e.persist();
3484
+ column.toggleSorting == null ? void 0 : column.toggleSorting(undefined, column.getCanMultiSort() ? instance.options.isMultiSortEvent == null ? void 0 : instance.options.isMultiSortEvent(e) : false);
2966
3485
  };
2967
- return propGetter(initialProps, userProps);
2968
3486
  },
2969
3487
  getPreSortedRowModel: function getPreSortedRowModel() {
2970
3488
  return instance.getGlobalFilteredRowModel();
@@ -2974,7 +3492,7 @@ var Sorting = {
2974
3492
  instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
2975
3493
  }
2976
3494
 
2977
- if (!instance._getSortedRowModel) {
3495
+ if (instance.options.manualSorting || !instance._getSortedRowModel) {
2978
3496
  return instance.getPreSortedRowModel();
2979
3497
  }
2980
3498
 
@@ -3012,56 +3530,84 @@ var Visibility = {
3012
3530
  toggleVisibility: function toggleVisibility(value) {
3013
3531
  return instance.toggleColumnVisibility(column.id, value);
3014
3532
  },
3015
- getToggleVisibilityProps: function getToggleVisibilityProps(userProps) {
3016
- var props = {
3017
- type: 'checkbox',
3018
- checked: column.getIsVisible == null ? void 0 : column.getIsVisible(),
3019
- title: 'Toggle Column Visibility',
3020
- onChange: function onChange(e) {
3021
- column.toggleVisibility == null ? void 0 : column.toggleVisibility(e.target.checked);
3022
- }
3533
+ getToggleVisibilityHandler: function getToggleVisibilityHandler() {
3534
+ return function (e) {
3535
+ column.toggleVisibility == null ? void 0 : column.toggleVisibility(e.target.checked);
3023
3536
  };
3024
- return propGetter(props, userProps);
3025
3537
  }
3026
3538
  };
3027
3539
  },
3028
- getInstance: function getInstance(instance) {
3540
+ createRow: function createRow(row, instance) {
3029
3541
  return {
3030
- getVisibleFlatColumns: memo(function () {
3031
- return [instance.getAllFlatColumns(), instance.getAllFlatColumns().filter(function (d) {
3032
- return d.getIsVisible == null ? void 0 : d.getIsVisible();
3542
+ _getAllVisibleCells: memo(function () {
3543
+ return [row.getAllCells().filter(function (cell) {
3544
+ return cell.column.getIsVisible();
3033
3545
  }).map(function (d) {
3034
3546
  return d.id;
3035
3547
  }).join('_')];
3036
- }, function (allFlatColumns) {
3037
- return allFlatColumns.filter(function (d) {
3038
- return d.getIsVisible == null ? void 0 : d.getIsVisible();
3548
+ }, function (_) {
3549
+ return row.getAllCells().filter(function (cell) {
3550
+ return cell.column.getIsVisible();
3039
3551
  });
3040
3552
  }, {
3041
- key: 'getVisibleFlatColumns',
3553
+ key: 'row._getAllVisibleCells',
3042
3554
  debug: function debug() {
3043
3555
  var _instance$options$deb;
3044
3556
 
3045
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
3557
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3046
3558
  }
3047
3559
  }),
3048
- getVisibleLeafColumns: memo(function () {
3049
- return [instance.getAllLeafColumns(), instance.getAllLeafColumns().filter(function (d) {
3050
- return d.getIsVisible == null ? void 0 : d.getIsVisible();
3560
+ getVisibleCells: memo(function () {
3561
+ return [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()];
3562
+ }, function (left, center, right) {
3563
+ return [].concat(left, center, right);
3564
+ }, {
3565
+ key: 'row.getVisibleCells',
3566
+ debug: function debug() {
3567
+ var _instance$options$deb2;
3568
+
3569
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3570
+ }
3571
+ })
3572
+ };
3573
+ },
3574
+ createInstance: function createInstance(instance) {
3575
+ var makeVisibleColumnsMethod = function makeVisibleColumnsMethod(key, getColumns) {
3576
+ return memo(function () {
3577
+ return [getColumns(), getColumns().filter(function (d) {
3578
+ return d.getIsVisible();
3051
3579
  }).map(function (d) {
3052
3580
  return d.id;
3053
3581
  }).join('_')];
3054
- }, function (allFlatColumns) {
3055
- return allFlatColumns.filter(function (d) {
3582
+ }, function (columns) {
3583
+ return columns.filter(function (d) {
3056
3584
  return d.getIsVisible == null ? void 0 : d.getIsVisible();
3057
3585
  });
3058
3586
  }, {
3059
- key: 'getVisibleLeafColumns',
3587
+ key: key,
3060
3588
  debug: function debug() {
3061
- var _instance$options$deb2;
3589
+ var _instance$options$deb3;
3062
3590
 
3063
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
3591
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
3064
3592
  }
3593
+ });
3594
+ };
3595
+
3596
+ return {
3597
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', function () {
3598
+ return instance.getAllFlatColumns();
3599
+ }),
3600
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', function () {
3601
+ return instance.getAllLeafColumns();
3602
+ }),
3603
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', function () {
3604
+ return instance.getLeftLeafColumns();
3605
+ }),
3606
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', function () {
3607
+ return instance.getRightLeafColumns();
3608
+ }),
3609
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', function () {
3610
+ return instance.getCenterLeafColumns();
3065
3611
  }),
3066
3612
  setColumnVisibility: function setColumnVisibility(updater) {
3067
3613
  return instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater);
@@ -3119,19 +3665,12 @@ var Visibility = {
3119
3665
  return column.getIsVisible == null ? void 0 : column.getIsVisible();
3120
3666
  });
3121
3667
  },
3122
- getToggleAllColumnsVisibilityProps: function getToggleAllColumnsVisibilityProps(userProps) {
3123
- var props = {
3124
- onChange: function onChange(e) {
3125
- var _e$target;
3668
+ getToggleAllColumnsVisibilityHandler: function getToggleAllColumnsVisibilityHandler() {
3669
+ return function (e) {
3670
+ var _target;
3126
3671
 
3127
- instance.toggleAllColumnsVisible((_e$target = e.target) == null ? void 0 : _e$target.checked);
3128
- },
3129
- type: 'checkbox',
3130
- title: 'Toggle visibility for all columns',
3131
- checked: instance.getIsAllColumnsVisible(),
3132
- indeterminate: !instance.getIsAllColumnsVisible() && instance.getIsSomeColumnsVisible() ? 'indeterminate' : undefined
3672
+ instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
3133
3673
  };
3134
- return propGetter(props, userProps);
3135
3674
  }
3136
3675
  };
3137
3676
  }
@@ -3139,120 +3678,47 @@ var Visibility = {
3139
3678
 
3140
3679
  //
3141
3680
  var Headers = {
3142
- createRow: function createRow(row, instance) {
3681
+ createInstance: function createInstance(instance) {
3143
3682
  return {
3144
- _getAllVisibleCells: memo(function () {
3145
- return [row.getAllCells().filter(function (cell) {
3146
- return cell.column.getIsVisible();
3147
- }).map(function (d) {
3148
- return d.id;
3149
- }).join('_')];
3150
- }, function (_) {
3151
- return row.getAllCells().filter(function (cell) {
3152
- return cell.column.getIsVisible();
3153
- });
3154
- }, {
3155
- key: 'row._getAllVisibleCells',
3156
- debug: function debug() {
3157
- var _instance$options$deb;
3683
+ createHeader: function createHeader(column, options) {
3684
+ var _options$id;
3158
3685
 
3159
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3160
- }
3161
- }),
3162
- getVisibleCells: memo(function () {
3163
- return [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()];
3164
- }, function (left, center, right) {
3165
- return [].concat(left, center, right);
3166
- }, {
3167
- key: 'row.getVisibleCells',
3168
- debug: function debug() {
3169
- var _instance$options$deb2;
3686
+ var id = (_options$id = options.id) != null ? _options$id : column.id;
3687
+ var header = {
3688
+ id: id,
3689
+ column: column,
3690
+ index: options.index,
3691
+ isPlaceholder: options.isPlaceholder,
3692
+ placeholderId: options.placeholderId,
3693
+ depth: options.depth,
3694
+ subHeaders: [],
3695
+ colSpan: 0,
3696
+ rowSpan: 0,
3697
+ headerGroup: null,
3698
+ getSize: function getSize() {
3699
+ var sum = 0;
3170
3700
 
3171
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3172
- }
3173
- }),
3174
- getCenterVisibleCells: memo(function () {
3175
- return [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
3176
- }, function (allCells, left, right) {
3177
- var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
3178
- return allCells.filter(function (d) {
3179
- return !leftAndRight.includes(d.columnId);
3180
- });
3181
- }, {
3182
- key: 'row.getCenterVisibleCells',
3183
- debug: function debug() {
3184
- var _instance$options$deb3;
3701
+ var recurse = function recurse(header) {
3702
+ if (header.subHeaders.length) {
3703
+ header.subHeaders.forEach(recurse);
3704
+ } else {
3705
+ var _header$column$getSiz;
3185
3706
 
3186
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
3187
- }
3188
- }),
3189
- getLeftVisibleCells: memo(function () {
3190
- return [row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
3191
- }, function (allCells, left) {
3192
- var cells = (left != null ? left : []).map(function (columnId) {
3193
- return allCells.find(function (cell) {
3194
- return cell.columnId === columnId;
3195
- });
3196
- }).filter(Boolean);
3197
- return cells;
3198
- }, {
3199
- key: 'row.getLeftVisibleCells',
3200
- debug: function debug() {
3201
- var _instance$options$deb4;
3202
-
3203
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugRows;
3204
- }
3205
- }),
3206
- getRightVisibleCells: memo(function () {
3207
- return [row._getAllVisibleCells(), instance.getState().columnPinning.right];
3208
- }, function (allCells, right) {
3209
- var cells = (right != null ? right : []).map(function (columnId) {
3210
- return allCells.find(function (cell) {
3211
- return cell.columnId === columnId;
3212
- });
3213
- }).filter(Boolean);
3214
- return cells;
3215
- }, {
3216
- key: 'row.getRightVisibleCells',
3217
- debug: function debug() {
3218
- var _instance$options$deb5;
3219
-
3220
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugRows;
3221
- }
3222
- })
3223
- };
3224
- },
3225
- getInstance: function getInstance(instance) {
3226
- return {
3227
- createHeader: function createHeader(column, options) {
3228
- var _options$id;
3229
-
3230
- var id = (_options$id = options.id) != null ? _options$id : column.id;
3231
- var header = {
3232
- id: id,
3233
- column: column,
3234
- isPlaceholder: options.isPlaceholder,
3235
- placeholderId: options.placeholderId,
3236
- depth: options.depth,
3237
- subHeaders: [],
3238
- colSpan: 0,
3239
- rowSpan: 0,
3240
- getWidth: function getWidth() {
3241
- var sum = 0;
3242
-
3243
- var recurse = function recurse(header) {
3244
- if (header.subHeaders.length) {
3245
- header.subHeaders.forEach(recurse);
3246
- } else {
3247
- var _header$column$getWid;
3248
-
3249
- sum += (_header$column$getWid = header.column.getWidth()) != null ? _header$column$getWid : 0;
3707
+ sum += (_header$column$getSiz = header.column.getSize()) != null ? _header$column$getSiz : 0;
3250
3708
  }
3251
3709
  };
3252
3710
 
3253
3711
  recurse(header);
3254
3712
  return sum;
3255
3713
  },
3714
+ getStart: function getStart() {
3715
+ if (header.index > 0) {
3716
+ var prevSiblingHeader = header.headerGroup.headers[header.index - 1];
3717
+ return prevSiblingHeader.getStart() + prevSiblingHeader.getSize();
3718
+ }
3719
+
3720
+ return 0;
3721
+ },
3256
3722
  getLeafHeaders: function getLeafHeaders() {
3257
3723
  var leafHeaders = [];
3258
3724
 
@@ -3267,12 +3733,6 @@ var Headers = {
3267
3733
  recurseHeader(header);
3268
3734
  return leafHeaders;
3269
3735
  },
3270
- getHeaderProps: function getHeaderProps(userProps) {
3271
- return instance.getHeaderProps(header.id, userProps);
3272
- },
3273
- getFooterProps: function getFooterProps(userProps) {
3274
- return instance.getFooterProps(header.id, userProps);
3275
- },
3276
3736
  renderHeader: function renderHeader() {
3277
3737
  return column.header ? instance.render(column.header, {
3278
3738
  instance: instance,
@@ -3287,9 +3747,13 @@ var Headers = {
3287
3747
  column: column
3288
3748
  }) : null;
3289
3749
  }
3290
- }; // Yes, we have to convert instance to unknown, because we know more than the compiler here.
3750
+ };
3291
3751
 
3292
- return Object.assign(header, ColumnSizing.createHeader(header, instance));
3752
+ instance._features.forEach(function (feature) {
3753
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
3754
+ });
3755
+
3756
+ return header;
3293
3757
  },
3294
3758
  // Header Groups
3295
3759
  getHeaderGroups: memo(function () {
@@ -3309,9 +3773,9 @@ var Headers = {
3309
3773
  }, {
3310
3774
  key: 'getHeaderGroups',
3311
3775
  debug: function debug() {
3312
- var _instance$options$deb6;
3776
+ var _instance$options$deb;
3313
3777
 
3314
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
3778
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
3315
3779
  }
3316
3780
  }),
3317
3781
  getCenterHeaderGroups: memo(function () {
@@ -3324,9 +3788,9 @@ var Headers = {
3324
3788
  }, {
3325
3789
  key: 'getCenterHeaderGroups',
3326
3790
  debug: function debug() {
3327
- var _instance$options$deb7;
3791
+ var _instance$options$deb2;
3328
3792
 
3329
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
3793
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
3330
3794
  }
3331
3795
  }),
3332
3796
  getLeftHeaderGroups: memo(function () {
@@ -3339,9 +3803,9 @@ var Headers = {
3339
3803
  }, {
3340
3804
  key: 'getLeftHeaderGroups',
3341
3805
  debug: function debug() {
3342
- var _instance$options$deb8;
3806
+ var _instance$options$deb3;
3343
3807
 
3344
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
3808
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
3345
3809
  }
3346
3810
  }),
3347
3811
  getRightHeaderGroups: memo(function () {
@@ -3354,9 +3818,9 @@ var Headers = {
3354
3818
  }, {
3355
3819
  key: 'getRightHeaderGroups',
3356
3820
  debug: function debug() {
3357
- var _instance$options$deb9;
3821
+ var _instance$options$deb4;
3358
3822
 
3359
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
3823
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
3360
3824
  }
3361
3825
  }),
3362
3826
  // Footer Groups
@@ -3367,9 +3831,9 @@ var Headers = {
3367
3831
  }, {
3368
3832
  key: 'getFooterGroups',
3369
3833
  debug: function debug() {
3370
- var _instance$options$deb10;
3834
+ var _instance$options$deb5;
3371
3835
 
3372
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
3836
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
3373
3837
  }
3374
3838
  }),
3375
3839
  getLeftFooterGroups: memo(function () {
@@ -3379,9 +3843,9 @@ var Headers = {
3379
3843
  }, {
3380
3844
  key: 'getLeftFooterGroups',
3381
3845
  debug: function debug() {
3382
- var _instance$options$deb11;
3846
+ var _instance$options$deb6;
3383
3847
 
3384
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
3848
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
3385
3849
  }
3386
3850
  }),
3387
3851
  getCenterFooterGroups: memo(function () {
@@ -3391,9 +3855,9 @@ var Headers = {
3391
3855
  }, {
3392
3856
  key: 'getCenterFooterGroups',
3393
3857
  debug: function debug() {
3394
- var _instance$options$deb12;
3858
+ var _instance$options$deb7;
3395
3859
 
3396
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
3860
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
3397
3861
  }
3398
3862
  }),
3399
3863
  getRightFooterGroups: memo(function () {
@@ -3403,9 +3867,9 @@ var Headers = {
3403
3867
  }, {
3404
3868
  key: 'getRightFooterGroups',
3405
3869
  debug: function debug() {
3406
- var _instance$options$deb13;
3870
+ var _instance$options$deb8;
3407
3871
 
3408
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
3872
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
3409
3873
  }
3410
3874
  }),
3411
3875
  // Flat Headers
@@ -3418,9 +3882,9 @@ var Headers = {
3418
3882
  }, {
3419
3883
  key: 'getFlatHeaders',
3420
3884
  debug: function debug() {
3421
- var _instance$options$deb14;
3885
+ var _instance$options$deb9;
3422
3886
 
3423
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
3887
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
3424
3888
  }
3425
3889
  }),
3426
3890
  getLeftFlatHeaders: memo(function () {
@@ -3432,9 +3896,9 @@ var Headers = {
3432
3896
  }, {
3433
3897
  key: 'getLeftFlatHeaders',
3434
3898
  debug: function debug() {
3435
- var _instance$options$deb15;
3899
+ var _instance$options$deb10;
3436
3900
 
3437
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
3901
+ return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
3438
3902
  }
3439
3903
  }),
3440
3904
  getCenterFlatHeaders: memo(function () {
@@ -3446,9 +3910,9 @@ var Headers = {
3446
3910
  }, {
3447
3911
  key: 'getCenterFlatHeaders',
3448
3912
  debug: function debug() {
3449
- var _instance$options$deb16;
3913
+ var _instance$options$deb11;
3450
3914
 
3451
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
3915
+ return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
3452
3916
  }
3453
3917
  }),
3454
3918
  getRightFlatHeaders: memo(function () {
@@ -3460,9 +3924,9 @@ var Headers = {
3460
3924
  }, {
3461
3925
  key: 'getRightFlatHeaders',
3462
3926
  debug: function debug() {
3463
- var _instance$options$deb17;
3927
+ var _instance$options$deb12;
3464
3928
 
3465
- return (_instance$options$deb17 = instance.options.debugAll) != null ? _instance$options$deb17 : instance.options.debugHeaders;
3929
+ return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
3466
3930
  }
3467
3931
  }),
3468
3932
  // Leaf Headers
@@ -3477,9 +3941,9 @@ var Headers = {
3477
3941
  }, {
3478
3942
  key: 'getCenterLeafHeaders',
3479
3943
  debug: function debug() {
3480
- var _instance$options$deb18;
3944
+ var _instance$options$deb13;
3481
3945
 
3482
- return (_instance$options$deb18 = instance.options.debugAll) != null ? _instance$options$deb18 : instance.options.debugHeaders;
3946
+ return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
3483
3947
  }
3484
3948
  }),
3485
3949
  getLeftLeafHeaders: memo(function () {
@@ -3493,9 +3957,9 @@ var Headers = {
3493
3957
  }, {
3494
3958
  key: 'getLeftLeafHeaders',
3495
3959
  debug: function debug() {
3496
- var _instance$options$deb19;
3960
+ var _instance$options$deb14;
3497
3961
 
3498
- return (_instance$options$deb19 = instance.options.debugAll) != null ? _instance$options$deb19 : instance.options.debugHeaders;
3962
+ return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
3499
3963
  }
3500
3964
  }),
3501
3965
  getRightLeafHeaders: memo(function () {
@@ -3509,9 +3973,9 @@ var Headers = {
3509
3973
  }, {
3510
3974
  key: 'getRightLeafHeaders',
3511
3975
  debug: function debug() {
3512
- var _instance$options$deb20;
3976
+ var _instance$options$deb15;
3513
3977
 
3514
- return (_instance$options$deb20 = instance.options.debugAll) != null ? _instance$options$deb20 : instance.options.debugHeaders;
3978
+ return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
3515
3979
  }
3516
3980
  }),
3517
3981
  getLeafHeaders: memo(function () {
@@ -3525,9 +3989,9 @@ var Headers = {
3525
3989
  }, {
3526
3990
  key: 'getLeafHeaders',
3527
3991
  debug: function debug() {
3528
- var _instance$options$deb21;
3992
+ var _instance$options$deb16;
3529
3993
 
3530
- return (_instance$options$deb21 = instance.options.debugAll) != null ? _instance$options$deb21 : instance.options.debugHeaders;
3994
+ return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
3531
3995
  }
3532
3996
  }),
3533
3997
  getHeader: function getHeader(id) {
@@ -3544,69 +4008,6 @@ var Headers = {
3544
4008
  }
3545
4009
 
3546
4010
  return header;
3547
- },
3548
- getHeaderGroupProps: function getHeaderGroupProps(id, userProps) {
3549
- var headerGroup = instance.getHeaderGroups().find(function (d) {
3550
- return d.id === id;
3551
- });
3552
-
3553
- if (!headerGroup) {
3554
- return;
3555
- }
3556
-
3557
- return propGetter({
3558
- key: headerGroup.id,
3559
- role: 'row'
3560
- }, userProps);
3561
- },
3562
- getFooterGroupProps: function getFooterGroupProps(id, userProps) {
3563
- var headerGroup = instance.getFooterGroups().find(function (d) {
3564
- return d.id === id;
3565
- });
3566
-
3567
- if (!headerGroup) {
3568
- return;
3569
- }
3570
-
3571
- var initialProps = {
3572
- key: headerGroup.id,
3573
- role: 'row'
3574
- };
3575
- return propGetter(initialProps, userProps);
3576
- },
3577
- getHeaderProps: function getHeaderProps(id, userProps) {
3578
- var header = instance.getHeader(id);
3579
-
3580
- if (!header) {
3581
- throw new Error();
3582
- }
3583
-
3584
- var initialProps = {
3585
- key: header.id,
3586
- role: 'columnheader',
3587
- colSpan: header.colSpan,
3588
- rowSpan: header.rowSpan
3589
- };
3590
- return propGetter(initialProps, userProps);
3591
- },
3592
- getFooterProps: function getFooterProps(id, userProps) {
3593
- var header = instance.getHeader(id);
3594
- var initialProps = {
3595
- key: header.id,
3596
- role: 'columnfooter',
3597
- colSpan: header.colSpan,
3598
- rowSpan: header.rowSpan
3599
- };
3600
- return propGetter(initialProps, userProps);
3601
- },
3602
- getTotalWidth: function getTotalWidth() {
3603
- var width = 0;
3604
- instance.getVisibleLeafColumns().forEach(function (column) {
3605
- var _column$getWidth;
3606
-
3607
- width += (_column$getWidth = column.getWidth()) != null ? _column$getWidth : 0;
3608
- });
3609
- return width;
3610
4011
  }
3611
4012
  };
3612
4013
  }
@@ -3646,20 +4047,14 @@ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
3646
4047
  var headerGroup = {
3647
4048
  depth: depth,
3648
4049
  id: [headerFamily, "" + depth].filter(Boolean).join('_'),
3649
- headers: [],
3650
- getHeaderGroupProps: function getHeaderGroupProps(getterValue) {
3651
- return instance.getHeaderGroupProps("" + depth, getterValue);
3652
- },
3653
- getFooterGroupProps: function getFooterGroupProps(getterValue) {
3654
- return instance.getFooterGroupProps("" + depth, getterValue);
3655
- }
4050
+ headers: []
3656
4051
  }; // The parent columns we're going to scan next
3657
4052
 
3658
- var parentHeaders = []; // Scan each column for parents
4053
+ var pendingParentHeaders = []; // Scan each column for parents
3659
4054
 
3660
4055
  headersToGroup.forEach(function (headerToGroup) {
3661
4056
  // What is the latest (last) parent column?
3662
- var latestParentHeader = [].concat(parentHeaders).reverse()[0];
4057
+ var latestPendingParentHeader = [].concat(pendingParentHeaders).reverse()[0];
3663
4058
  var isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
3664
4059
  var column;
3665
4060
  var isPlaceholder = false;
@@ -3673,37 +4068,41 @@ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
3673
4068
  isPlaceholder = true;
3674
4069
  }
3675
4070
 
3676
- var header = instance.createHeader(column, {
3677
- id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
3678
- isPlaceholder: isPlaceholder,
3679
- placeholderId: isPlaceholder ? "" + parentHeaders.filter(function (d) {
3680
- return d.column === column;
3681
- }).length : undefined,
3682
- depth: depth
3683
- });
3684
-
3685
- if (!latestParentHeader || latestParentHeader.column !== header.column) {
3686
- header.subHeaders.push(headerToGroup);
3687
- parentHeaders.push(header);
4071
+ if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
4072
+ // This column is repeated. Add it as a sub header to the next batch
4073
+ latestPendingParentHeader.subHeaders.push(headerToGroup);
3688
4074
  } else {
3689
- latestParentHeader.subHeaders.push(headerToGroup);
3690
- } // if (!headerToGroup.isPlaceholder) {
3691
- // headerToGroup.column.header = headerToGroup;
3692
- // }
3693
-
4075
+ // This is a new header. Let's create it
4076
+ var header = instance.createHeader(column, {
4077
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
4078
+ isPlaceholder: isPlaceholder,
4079
+ placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(function (d) {
4080
+ return d.column === column;
4081
+ }).length : undefined,
4082
+ depth: depth,
4083
+ index: pendingParentHeaders.length
4084
+ }); // Add the headerToGroup as a subHeader of the new header
4085
+
4086
+ header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
4087
+ // in the next batch
4088
+
4089
+ pendingParentHeaders.push(header);
4090
+ }
3694
4091
 
3695
4092
  headerGroup.headers.push(headerToGroup);
4093
+ headerToGroup.headerGroup = headerGroup;
3696
4094
  });
3697
4095
  headerGroups.push(headerGroup);
3698
4096
 
3699
4097
  if (depth > 0) {
3700
- createHeaderGroup(parentHeaders, depth - 1);
4098
+ createHeaderGroup(pendingParentHeaders, depth - 1);
3701
4099
  }
3702
4100
  };
3703
4101
 
3704
- var bottomHeaders = columnsToGroup.map(function (column) {
4102
+ var bottomHeaders = columnsToGroup.map(function (column, index) {
3705
4103
  return instance.createHeader(column, {
3706
- depth: maxDepth
4104
+ depth: maxDepth,
4105
+ index: index
3707
4106
  });
3708
4107
  });
3709
4108
  createHeaderGroup(bottomHeaders, maxDepth - 1);
@@ -3747,7 +4146,6 @@ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
3747
4146
  return headerGroups;
3748
4147
  }
3749
4148
 
3750
- var features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
3751
4149
  function createTableInstance(options) {
3752
4150
  var _options$initialState;
3753
4151
 
@@ -3756,28 +4154,34 @@ function createTableInstance(options) {
3756
4154
  }
3757
4155
 
3758
4156
  var instance = {};
3759
- var defaultOptions = features.reduce(function (obj, feature) {
4157
+ instance._features = [Columns, Rows, Cells, Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing];
4158
+
4159
+ var defaultOptions = instance._features.reduce(function (obj, feature) {
3760
4160
  return Object.assign(obj, feature.getDefaultOptions == null ? void 0 : feature.getDefaultOptions(instance));
3761
4161
  }, {});
3762
4162
 
3763
- var buildOptions = function buildOptions(options) {
4163
+ var mergeOptions = function mergeOptions(options) {
4164
+ if (instance.options.mergeOptions) {
4165
+ return instance.options.mergeOptions(defaultOptions, options);
4166
+ }
4167
+
3764
4168
  return _extends({}, defaultOptions, options);
3765
4169
  };
3766
4170
 
3767
- instance.options = buildOptions(options);
4171
+ instance.options = _extends({}, defaultOptions, options);
3768
4172
  var coreInitialState = {
3769
4173
  coreProgress: 1
3770
4174
  };
3771
4175
 
3772
- var initialState = _extends({}, coreInitialState, features.reduce(function (obj, feature) {
3773
- return Object.assign(obj, feature.getInitialState == null ? void 0 : feature.getInitialState());
3774
- }, {}), (_options$initialState = options.initialState) != null ? _options$initialState : {});
4176
+ var initialState = _extends({}, coreInitialState, (_options$initialState = options.initialState) != null ? _options$initialState : {}, instance._features.reduce(function (obj, feature) {
4177
+ return Object.assign(obj, feature.getInitialState == null ? void 0 : feature.getInitialState(options.initialState));
4178
+ }, {}));
3775
4179
 
3776
4180
  var queued = [];
3777
4181
  var queuedTimeout;
3778
4182
 
3779
- var finalInstance = _extends({}, instance, features.reduce(function (obj, feature) {
3780
- return Object.assign(obj, feature.getInstance == null ? void 0 : feature.getInstance(instance));
4183
+ var finalInstance = _extends({}, instance, instance._features.reduce(function (obj, feature) {
4184
+ return Object.assign(obj, feature.createInstance == null ? void 0 : feature.createInstance(instance));
3781
4185
  }, {}), {
3782
4186
  queue: function queue(cb) {
3783
4187
  queued.push(cb);
@@ -3803,12 +4207,7 @@ function createTableInstance(options) {
3803
4207
  },
3804
4208
  setOptions: function setOptions(updater) {
3805
4209
  var newOptions = functionalUpdate(updater, instance.options);
3806
-
3807
- if (instance.options.mergeOptions) {
3808
- instance.options = instance.options.mergeOptions(defaultOptions, newOptions);
3809
- } else {
3810
- instance.options = buildOptions(newOptions);
3811
- }
4210
+ instance.options = mergeOptions(newOptions);
3812
4211
  },
3813
4212
  render: function render(template, props) {
3814
4213
  if (typeof instance.options.render === 'function') {
@@ -3821,401 +4220,12 @@ function createTableInstance(options) {
3821
4220
 
3822
4221
  return template;
3823
4222
  },
3824
- getRowId: function getRowId(row, index, parent) {
3825
- var _instance$options$get;
3826
-
3827
- 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);
3828
- },
3829
4223
  getState: function getState() {
3830
4224
  return instance.options.state;
3831
4225
  },
3832
4226
  setState: function setState(updater) {
3833
4227
  instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
3834
4228
  },
3835
- getDefaultColumn: memo(function () {
3836
- return [instance.options.defaultColumn];
3837
- }, function (defaultColumn) {
3838
- var _defaultColumn;
3839
-
3840
- defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
3841
- return _extends({
3842
- header: function header(props) {
3843
- return props.header.column.id;
3844
- },
3845
- footer: function footer(props) {
3846
- return props.header.column.id;
3847
- },
3848
- cell: function cell(_ref) {
3849
- var _ref$value = _ref.value,
3850
- value = _ref$value === void 0 ? '' : _ref$value;
3851
- return typeof value === 'boolean' ? value.toString() : value;
3852
- }
3853
- }, features.reduce(function (obj, feature) {
3854
- return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
3855
- }, {}), defaultColumn);
3856
- }, {
3857
- debug: function debug() {
3858
- var _instance$options$deb;
3859
-
3860
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
3861
- },
3862
- key: 'getDefaultColumn'
3863
- }),
3864
- getColumnDefs: function getColumnDefs() {
3865
- return instance.options.columns;
3866
- },
3867
- createColumn: function createColumn(columnDef, depth, parent) {
3868
- var _ref2, _columnDef$id;
3869
-
3870
- var defaultColumn = instance.getDefaultColumn();
3871
- var id = (_ref2 = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref2 : typeof columnDef.header === 'string' ? columnDef.header : undefined;
3872
- var accessorFn;
3873
-
3874
- if (columnDef.accessorFn) {
3875
- accessorFn = columnDef.accessorFn;
3876
- } else if (columnDef.accessorKey) {
3877
- accessorFn = function accessorFn(originalRow) {
3878
- return originalRow[columnDef.accessorKey];
3879
- };
3880
- }
3881
-
3882
- if (!id) {
3883
- if (process.env.NODE_ENV !== 'production') {
3884
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
3885
- }
3886
-
3887
- throw new Error();
3888
- }
3889
-
3890
- var column = _extends({}, defaultColumn, columnDef, {
3891
- id: "" + id,
3892
- accessorFn: accessorFn,
3893
- parent: parent,
3894
- depth: depth,
3895
- columnDef: columnDef,
3896
- columnDefType: columnDef.columnDefType,
3897
- columns: [],
3898
- getWidth: function getWidth() {
3899
- return instance.getColumnWidth(column.id);
3900
- },
3901
- getFlatColumns: memo(function () {
3902
- return [true];
3903
- }, function () {
3904
- var _column$columns;
3905
-
3906
- return [column].concat((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(function (d) {
3907
- return d.getFlatColumns();
3908
- }));
3909
- }, {
3910
- key: 'column.getFlatColumns',
3911
- debug: function debug() {
3912
- var _instance$options$deb2;
3913
-
3914
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
3915
- }
3916
- }),
3917
- getLeafColumns: memo(function () {
3918
- return [instance._getOrderColumnsFn()];
3919
- }, function (orderColumns) {
3920
- var _column$columns2;
3921
-
3922
- if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
3923
- var leafColumns = column.columns.flatMap(function (column) {
3924
- return column.getLeafColumns();
3925
- });
3926
- return orderColumns(leafColumns);
3927
- }
3928
-
3929
- return [column];
3930
- }, {
3931
- key: 'column.getLeafColumns',
3932
- debug: function debug() {
3933
- var _instance$options$deb3;
3934
-
3935
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
3936
- }
3937
- })
3938
- });
3939
-
3940
- column = features.reduce(function (obj, feature) {
3941
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
3942
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
3943
-
3944
- return column;
3945
- },
3946
- getAllColumns: memo(function () {
3947
- return [instance.getColumnDefs()];
3948
- }, function (columnDefs) {
3949
- var recurseColumns = function recurseColumns(columnDefs, parent, depth) {
3950
- if (depth === void 0) {
3951
- depth = 0;
3952
- }
3953
-
3954
- return columnDefs.map(function (columnDef) {
3955
- var column = instance.createColumn(columnDef, depth, parent);
3956
- column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
3957
- return column;
3958
- });
3959
- };
3960
-
3961
- return recurseColumns(columnDefs);
3962
- }, {
3963
- key: 'getAllColumns',
3964
- debug: function debug() {
3965
- var _instance$options$deb4;
3966
-
3967
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
3968
- }
3969
- }),
3970
- getAllFlatColumns: memo(function () {
3971
- return [instance.getAllColumns()];
3972
- }, function (allColumns) {
3973
- return allColumns.flatMap(function (column) {
3974
- return column.getFlatColumns();
3975
- });
3976
- }, {
3977
- key: 'getAllFlatColumns',
3978
- debug: function debug() {
3979
- var _instance$options$deb5;
3980
-
3981
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
3982
- }
3983
- }),
3984
- getAllFlatColumnsById: memo(function () {
3985
- return [instance.getAllFlatColumns()];
3986
- }, function (flatColumns) {
3987
- return flatColumns.reduce(function (acc, column) {
3988
- acc[column.id] = column;
3989
- return acc;
3990
- }, {});
3991
- }, {
3992
- key: 'getAllFlatColumnsById',
3993
- debug: function debug() {
3994
- var _instance$options$deb6;
3995
-
3996
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
3997
- }
3998
- }),
3999
- getAllLeafColumns: memo(function () {
4000
- return [instance.getAllColumns(), instance._getOrderColumnsFn()];
4001
- }, function (allColumns, orderColumns) {
4002
- var leafColumns = allColumns.flatMap(function (column) {
4003
- return column.getLeafColumns();
4004
- });
4005
- return orderColumns(leafColumns);
4006
- }, {
4007
- key: 'getAllLeafColumns',
4008
- debug: function debug() {
4009
- var _instance$options$deb7;
4010
-
4011
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
4012
- }
4013
- }),
4014
- getColumn: function getColumn(columnId) {
4015
- var column = instance.getAllFlatColumnsById()[columnId];
4016
-
4017
- if (!column) {
4018
- if (process.env.NODE_ENV !== 'production') {
4019
- console.warn("[Table] Column with id " + columnId + " does not exist.");
4020
- }
4021
-
4022
- throw new Error();
4023
- }
4024
-
4025
- return column;
4026
- },
4027
- createCell: function createCell(row, column, value) {
4028
- var cell = {
4029
- id: row.id + "_" + column.id,
4030
- rowId: row.id,
4031
- columnId: column.id,
4032
- row: row,
4033
- column: column,
4034
- value: value,
4035
- getCellProps: function getCellProps(userProps) {
4036
- return instance.getCellProps(row.id, column.id, userProps);
4037
- },
4038
- renderCell: function renderCell() {
4039
- return column.cell ? instance.render(column.cell, {
4040
- instance: instance,
4041
- column: column,
4042
- row: row,
4043
- cell: cell,
4044
- value: value
4045
- }) : null;
4046
- }
4047
- };
4048
- features.forEach(function (feature) {
4049
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
4050
- }, {});
4051
- return cell;
4052
- },
4053
- createRow: function createRow(id, original, rowIndex, depth, values) {
4054
- var row = {
4055
- id: id,
4056
- index: rowIndex,
4057
- original: original,
4058
- depth: depth,
4059
- values: values,
4060
- subRows: [],
4061
- getLeafRows: function getLeafRows() {
4062
- return flattenBy(row.subRows, function (d) {
4063
- return d.subRows;
4064
- });
4065
- },
4066
- getRowProps: function getRowProps(userProps) {
4067
- return instance.getRowProps(row.id, userProps);
4068
- },
4069
- getAllCells: undefined,
4070
- getAllCellsByColumnId: undefined
4071
- };
4072
- row.getAllCells = memo(function () {
4073
- return [instance.getAllLeafColumns()];
4074
- }, function (leafColumns) {
4075
- return leafColumns.map(function (column) {
4076
- return instance.createCell(row, column, row.values[column.id]);
4077
- });
4078
- }, {
4079
- key: process.env.NODE_ENV !== 'production' ? 'row.getAllCells' : '',
4080
- debug: function debug() {
4081
- var _instance$options$deb8;
4082
-
4083
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugRows;
4084
- }
4085
- });
4086
- row.getAllCellsByColumnId = memo(function () {
4087
- return [row.getAllCells()];
4088
- }, function (allCells) {
4089
- return allCells.reduce(function (acc, cell) {
4090
- acc[cell.columnId] = cell;
4091
- return acc;
4092
- }, {});
4093
- }, {
4094
- key: 'row.getAllCellsByColumnId',
4095
- debug: function debug() {
4096
- var _instance$options$deb9;
4097
-
4098
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugRows;
4099
- }
4100
- });
4101
-
4102
- for (var i = 0; i < features.length; i++) {
4103
- var feature = features[i];
4104
- Object.assign(row, feature.createRow == null ? void 0 : feature.createRow(row, instance));
4105
- }
4106
-
4107
- return row;
4108
- },
4109
- getCoreRowModel: function getCoreRowModel() {
4110
- if (!instance._getCoreRowModel) {
4111
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
4112
- }
4113
-
4114
- return instance._getCoreRowModel();
4115
- },
4116
- // The final calls start at the bottom of the model,
4117
- // expanded rows, which then work their way up
4118
- getRowModel: function getRowModel() {
4119
- return instance.getPaginationRowModel();
4120
- },
4121
- getRow: function getRow(id) {
4122
- var row = instance.getRowModel().rowsById[id];
4123
-
4124
- if (!row) {
4125
- if (process.env.NODE_ENV !== 'production') {
4126
- throw new Error("getRow expected an ID, but got " + id);
4127
- }
4128
-
4129
- throw new Error();
4130
- }
4131
-
4132
- return row;
4133
- },
4134
- getCell: function getCell(rowId, columnId) {
4135
- var row = instance.getRow(rowId);
4136
-
4137
- if (!row) {
4138
- if (process.env.NODE_ENV !== 'production') {
4139
- throw new Error("[Table] could not find row with id " + rowId);
4140
- }
4141
-
4142
- throw new Error();
4143
- }
4144
-
4145
- var cell = row.getAllCellsByColumnId()[columnId];
4146
-
4147
- if (!cell) {
4148
- if (process.env.NODE_ENV !== 'production') {
4149
- throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
4150
- }
4151
-
4152
- throw new Error();
4153
- }
4154
-
4155
- return cell;
4156
- },
4157
- getTableProps: function getTableProps(userProps) {
4158
- return propGetter({
4159
- role: 'table'
4160
- }, userProps);
4161
- },
4162
- getTableBodyProps: function getTableBodyProps(userProps) {
4163
- return propGetter({
4164
- role: 'rowgroup'
4165
- }, userProps);
4166
- },
4167
- getRowProps: function getRowProps(rowId, userProps) {
4168
- var row = instance.getRow(rowId);
4169
-
4170
- if (!row) {
4171
- return;
4172
- }
4173
-
4174
- return propGetter({
4175
- key: row.id,
4176
- role: 'row'
4177
- }, userProps);
4178
- },
4179
- getCellProps: function getCellProps(rowId, columnId, userProps) {
4180
- var cell = instance.getCell(rowId, columnId);
4181
-
4182
- if (!cell) {
4183
- return;
4184
- }
4185
-
4186
- return propGetter({
4187
- key: cell.id,
4188
- role: 'gridcell'
4189
- }, userProps);
4190
- },
4191
- getTableWidth: function getTableWidth() {
4192
- var _instance$getHeaderGr, _instance$getHeaderGr2;
4193
-
4194
- return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce(function (sum, header) {
4195
- return sum + header.getWidth();
4196
- }, 0)) != null ? _instance$getHeaderGr : 0;
4197
- },
4198
- getLeftTableWidth: function getLeftTableWidth() {
4199
- var _instance$getLeftHead, _instance$getLeftHead2;
4200
-
4201
- return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce(function (sum, header) {
4202
- return sum + header.getWidth();
4203
- }, 0)) != null ? _instance$getLeftHead : 0;
4204
- },
4205
- getCenterTableWidth: function getCenterTableWidth() {
4206
- var _instance$getCenterHe, _instance$getCenterHe2;
4207
-
4208
- return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce(function (sum, header) {
4209
- return sum + header.getWidth();
4210
- }, 0)) != null ? _instance$getCenterHe : 0;
4211
- },
4212
- getRightTableWidth: function getRightTableWidth() {
4213
- var _instance$getRightHea, _instance$getRightHea2;
4214
-
4215
- return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce(function (sum, header) {
4216
- return sum + header.getWidth();
4217
- }, 0)) != null ? _instance$getRightHea : 0;
4218
- },
4219
4229
  getOverallProgress: function getOverallProgress() {
4220
4230
  var _instance$getState = instance.getState(),
4221
4231
  coreProgress = _instance$getState.coreProgress,
@@ -4250,6 +4260,9 @@ function createTable(_, __, options) {
4250
4260
  throw new Error('');
4251
4261
  }()
4252
4262
  },
4263
+ setGenerics: function setGenerics() {
4264
+ return table;
4265
+ },
4253
4266
  setRowType: function setRowType() {
4254
4267
  return table;
4255
4268
  },
@@ -4262,9 +4275,6 @@ function createTable(_, __, options) {
4262
4275
  setOptions: function setOptions(newOptions) {
4263
4276
  return createTable(_, __, _extends({}, options, newOptions));
4264
4277
  },
4265
- createColumns: function createColumns(columns) {
4266
- return columns;
4267
- },
4268
4278
  createDisplayColumn: function createDisplayColumn(column) {
4269
4279
  return _extends({}, column, {
4270
4280
  columnDefType: 'display'
@@ -5087,5 +5097,5 @@ function getPaginationRowModel(opts) {
5087
5097
  };
5088
5098
  }
5089
5099
 
5090
- export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, buildHeaderGroups, createTableFactory, createTableInstance, defaultColumnSizing, expandRows, flattenBy, functionalUpdate, getBatchGroups, getColumnFilteredRowModelSync, getCoreRowModelAsync, getCoreRowModelSync, getExpandedRowModel, getGlobalFilteredRowModelSync, getGroupedRowModelSync, getPaginationRowModel, getSortedRowModelSync, incrementalMemo, isFunction, isRowSelected, makeStateUpdater, memo, noop, passiveEventSupported, propGetter, selectRowsFn, shouldAutoRemoveFilter };
5100
+ export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, buildHeaderGroups, createTableFactory, createTableInstance, defaultColumnSizing, expandRows, flattenBy, functionalUpdate, getBatchGroups, getColumnFilteredRowModelSync, getCoreRowModelAsync, getCoreRowModelSync, getExpandedRowModel, getGlobalFilteredRowModelSync, getGroupedRowModelSync, getPaginationRowModel, getSortedRowModelSync, incrementalMemo, isFunction, isRowSelected, makeStateUpdater, memo, noop, passiveEventSupported, selectRowsFn, shouldAutoRemoveFilter };
5091
5101
  //# sourceMappingURL=index.js.map