@tanstack/react-table 0.0.1-alpha.8 → 8.0.0-alpha.2

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 (107) hide show
  1. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +112 -0
  2. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  3. package/build/cjs/aggregationTypes.js +130 -0
  4. package/build/cjs/aggregationTypes.js.map +1 -0
  5. package/build/cjs/core.js +519 -0
  6. package/build/cjs/core.js.map +1 -0
  7. package/build/cjs/createTable.js +103 -0
  8. package/build/cjs/createTable.js.map +1 -0
  9. package/build/cjs/features/ColumnSizing.js +331 -0
  10. package/build/cjs/features/ColumnSizing.js.map +1 -0
  11. package/build/cjs/features/Expanding.js +234 -0
  12. package/build/cjs/features/Expanding.js.map +1 -0
  13. package/build/cjs/features/Filters.js +396 -0
  14. package/build/cjs/features/Filters.js.map +1 -0
  15. package/build/cjs/features/Grouping.js +228 -0
  16. package/build/cjs/features/Grouping.js.map +1 -0
  17. package/build/cjs/features/Headers.js +486 -0
  18. package/build/cjs/features/Headers.js.map +1 -0
  19. package/build/cjs/features/Ordering.js +83 -0
  20. package/build/cjs/features/Ordering.js.map +1 -0
  21. package/build/cjs/features/Pinning.js +163 -0
  22. package/build/cjs/features/Pinning.js.map +1 -0
  23. package/build/cjs/features/Sorting.js +269 -0
  24. package/build/cjs/features/Sorting.js.map +1 -0
  25. package/build/cjs/features/Visibility.js +160 -0
  26. package/build/cjs/features/Visibility.js.map +1 -0
  27. package/build/cjs/filterTypes.js +172 -0
  28. package/build/cjs/filterTypes.js.map +1 -0
  29. package/build/cjs/index.js +30 -0
  30. package/build/cjs/index.js.map +1 -0
  31. package/build/cjs/sortTypes.js +121 -0
  32. package/build/cjs/sortTypes.js.map +1 -0
  33. package/build/cjs/utils/columnFilterRowsFn.js +130 -0
  34. package/build/cjs/utils/columnFilterRowsFn.js.map +1 -0
  35. package/build/cjs/utils/expandRowsFn.js +38 -0
  36. package/build/cjs/utils/expandRowsFn.js.map +1 -0
  37. package/build/cjs/utils/globalFilterRowsFn.js +100 -0
  38. package/build/cjs/utils/globalFilterRowsFn.js.map +1 -0
  39. package/build/cjs/utils/groupRowsFn.js +154 -0
  40. package/build/cjs/utils/groupRowsFn.js.map +1 -0
  41. package/build/cjs/utils/sortRowsFn.js +93 -0
  42. package/build/cjs/utils/sortRowsFn.js.map +1 -0
  43. package/build/cjs/utils.js +143 -0
  44. package/build/cjs/utils.js.map +1 -0
  45. package/build/esm/index.js +3722 -0
  46. package/build/esm/index.js.map +1 -0
  47. package/build/stats-html.html +2689 -0
  48. package/build/stats-react.json +747 -0
  49. package/build/types/aggregationTypes.d.ts +22 -0
  50. package/build/types/core.d.ts +126 -0
  51. package/build/types/createTable.d.ts +35 -0
  52. package/build/types/features/ColumnSizing.d.ts +73 -0
  53. package/build/types/features/Expanding.d.ts +52 -0
  54. package/build/types/features/Filters.d.ts +93 -0
  55. package/build/types/features/Grouping.d.ts +82 -0
  56. package/build/types/features/Headers.d.ts +41 -0
  57. package/build/types/features/Ordering.d.ts +19 -0
  58. package/build/types/features/Pinning.d.ts +39 -0
  59. package/build/types/features/Sorting.d.ts +75 -0
  60. package/build/types/features/Visibility.d.ts +47 -0
  61. package/build/types/filterTypes.d.ts +50 -0
  62. package/build/types/index.d.ts +7 -0
  63. package/build/types/sortTypes.d.ts +17 -0
  64. package/build/types/types.d.ts +124 -0
  65. package/build/types/utils/columnFilterRowsFn.d.ts +2 -0
  66. package/build/types/utils/expandRowsFn.d.ts +2 -0
  67. package/build/types/utils/globalFilterRowsFn.d.ts +2 -0
  68. package/build/types/utils/groupRowsFn.d.ts +2 -0
  69. package/build/types/utils/sortRowsFn.d.ts +2 -0
  70. package/build/types/utils.d.ts +24 -0
  71. package/{dist/react-table.development.js → build/umd/index.development.js} +372 -29
  72. package/build/umd/index.development.js.map +1 -0
  73. package/build/umd/index.production.js +12 -0
  74. package/build/umd/index.production.js.map +1 -0
  75. package/package.json +9 -94
  76. package/src/core.tsx +43 -5
  77. package/src/createTable.tsx +1 -1
  78. package/src/features/ColumnSizing.ts +482 -0
  79. package/src/features/Filters.ts +1 -1
  80. package/src/features/Headers.ts +43 -6
  81. package/src/features/{withPagination.ts → withPagination.oldts} +0 -0
  82. package/src/features/{withRowSelection.ts → withRowSelection.oldts} +0 -0
  83. package/src/types.ts +35 -6
  84. package/src/utils.tsx +8 -2
  85. package/dist/react-table.development.js.map +0 -1
  86. package/dist/react-table.production.min.js +0 -2
  87. package/dist/react-table.production.min.js.map +0 -1
  88. package/lib/index.js +0 -65
  89. package/src/features/notest/useAbsoluteLayout.test.js +0 -152
  90. package/src/features/notest/useBlockLayout.test.js +0 -158
  91. package/src/features/notest/useColumnOrder.test.js +0 -186
  92. package/src/features/notest/useExpanded.test.js +0 -125
  93. package/src/features/notest/useFilters.test.js +0 -393
  94. package/src/features/notest/useFiltersAndRowSelect.test.js +0 -256
  95. package/src/features/notest/useFlexLayout.test.js +0 -152
  96. package/src/features/notest/useGroupBy.test.js +0 -259
  97. package/src/features/notest/usePagination.test.js +0 -231
  98. package/src/features/notest/useResizeColumns.test.js +0 -229
  99. package/src/features/notest/useRowSelect.test.js +0 -250
  100. package/src/features/notest/useRowState.test.js +0 -178
  101. package/src/features/tests/Visibility.test.tsx +0 -225
  102. package/src/features/tests/__snapshots__/Visibility.test.tsx.snap +0 -390
  103. package/src/features/tests/withSorting.notest.tsx +0 -341
  104. package/src/features/withColumnResizing.ts +0 -281
  105. package/src/test-utils/makeTestData.ts +0 -41
  106. package/src/tests/__snapshots__/core.test.tsx.snap +0 -148
  107. package/src/tests/core.test.tsx +0 -241
@@ -1,3 +1,13 @@
1
+ /**
2
+ * react-table
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
1
11
  (function (global, factory) {
2
12
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
3
13
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -665,12 +675,12 @@
665
675
  };
666
676
 
667
677
  //
668
- function getInitialState$6() {
678
+ function getInitialState$7() {
669
679
  return {
670
680
  columnVisibility: {}
671
681
  };
672
682
  }
673
- function getDefaultOptions$6(instance) {
683
+ function getDefaultOptions$7(instance) {
674
684
  return {
675
685
  onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
676
686
  };
@@ -680,7 +690,7 @@
680
690
  defaultIsVisible: true
681
691
  };
682
692
  }
683
- function createColumn$4(column, instance) {
693
+ function createColumn$5(column, instance) {
684
694
  return {
685
695
  getCanHide: function getCanHide() {
686
696
  return instance.getColumnCanHide(column.id);
@@ -704,7 +714,7 @@
704
714
  }
705
715
  };
706
716
  }
707
- function getInstance$7(instance) {
717
+ function getInstance$8(instance) {
708
718
  return {
709
719
  getVisibleFlatColumns: memo(function () {
710
720
  return [instance.getAllFlatColumns(), instance.getAllFlatColumns().filter(function (d) {
@@ -919,19 +929,19 @@
919
929
  aggregationType: 'auto'
920
930
  };
921
931
  }
922
- function getInitialState$5() {
932
+ function getInitialState$6() {
923
933
  return {
924
934
  grouping: []
925
935
  };
926
936
  }
927
- function getDefaultOptions$5(instance) {
937
+ function getDefaultOptions$6(instance) {
928
938
  return {
929
939
  onGroupingChange: makeStateUpdater('grouping', instance),
930
940
  autoResetGrouping: true,
931
941
  groupedColumnMode: 'reorder'
932
942
  };
933
943
  }
934
- function createColumn$3(column, instance) {
944
+ function createColumn$4(column, instance) {
935
945
  return {
936
946
  aggregationType: column.aggregationType,
937
947
  getCanGroup: function getCanGroup() {
@@ -951,7 +961,7 @@
951
961
  }
952
962
  };
953
963
  }
954
- function getInstance$6(instance) {
964
+ function getInstance$7(instance) {
955
965
  return {
956
966
  getColumnAutoAggregationFn: function getColumnAutoAggregationFn(columnId) {
957
967
  var firstRow = instance.getCoreFlatRows()[0];
@@ -1116,17 +1126,17 @@
1116
1126
  }
1117
1127
 
1118
1128
  //
1119
- function getInitialState$4() {
1129
+ function getInitialState$5() {
1120
1130
  return {
1121
1131
  columnOrder: []
1122
1132
  };
1123
1133
  }
1124
- function getDefaultOptions$4(instance) {
1134
+ function getDefaultOptions$5(instance) {
1125
1135
  return {
1126
1136
  onColumnOrderChange: makeStateUpdater('columnOrder', instance)
1127
1137
  };
1128
1138
  }
1129
- function getInstance$5(instance) {
1139
+ function getInstance$6(instance) {
1130
1140
  return {
1131
1141
  setColumnOrder: function setColumnOrder(updater) {
1132
1142
  return instance.options.onColumnOrderChange == null ? void 0 : instance.options.onColumnOrderChange(updater, functionalUpdate(updater, instance.getState().columnOrder));
@@ -1178,7 +1188,7 @@
1178
1188
  }
1179
1189
 
1180
1190
  //
1181
- function getInitialState$3() {
1191
+ function getInitialState$4() {
1182
1192
  return {
1183
1193
  columnPinning: {
1184
1194
  left: [],
@@ -1186,12 +1196,12 @@
1186
1196
  }
1187
1197
  };
1188
1198
  }
1189
- function getDefaultOptions$3(instance) {
1199
+ function getDefaultOptions$4(instance) {
1190
1200
  return {
1191
1201
  onColumnPinningChange: makeStateUpdater('columnPinning', instance)
1192
1202
  };
1193
1203
  }
1194
- function createColumn$2(column, instance) {
1204
+ function createColumn$3(column, instance) {
1195
1205
  return {
1196
1206
  getCanPin: function getCanPin() {
1197
1207
  return instance.getColumnCanPin(column.id);
@@ -1207,7 +1217,7 @@
1207
1217
  }
1208
1218
  };
1209
1219
  }
1210
- function getInstance$4(instance) {
1220
+ function getInstance$5(instance) {
1211
1221
  return {
1212
1222
  setColumnPinning: function setColumnPinning(updater) {
1213
1223
  return instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater, functionalUpdate(updater, instance.getState().columnPinning));
@@ -1319,6 +1329,312 @@
1319
1329
  };
1320
1330
  }
1321
1331
 
1332
+ //
1333
+ var defaultColumnSizing = {
1334
+ width: 150,
1335
+ minWidth: 20,
1336
+ maxWidth: Number.MAX_SAFE_INTEGER
1337
+ };
1338
+ function getInitialState$3() {
1339
+ return {
1340
+ columnSizing: {},
1341
+ columnSizingInfo: {
1342
+ startOffset: null,
1343
+ startSize: null,
1344
+ deltaOffset: null,
1345
+ deltaPercentage: null,
1346
+ isResizingColumn: false,
1347
+ columnSizingStart: []
1348
+ }
1349
+ };
1350
+ }
1351
+ function getDefaultOptions$3(instance) {
1352
+ return {
1353
+ columnResizeMode: 'onEnd',
1354
+ onColumnSizingChange: makeStateUpdater('columnSizing', instance),
1355
+ onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', instance)
1356
+ };
1357
+ }
1358
+ function getInstance$4(instance) {
1359
+ return {
1360
+ setColumnSizing: function setColumnSizing(updater) {
1361
+ return instance.options.onColumnSizingChange == null ? void 0 : instance.options.onColumnSizingChange(updater, functionalUpdate(updater, instance.getState().columnSizing));
1362
+ },
1363
+ setColumnSizingInfo: function setColumnSizingInfo(updater) {
1364
+ return instance.options.onColumnSizingInfoChange == null ? void 0 : instance.options.onColumnSizingInfoChange(updater, functionalUpdate(updater, instance.getState().columnSizingInfo));
1365
+ },
1366
+ resetColumnSizing: function resetColumnSizing() {
1367
+ var _instance$initialStat;
1368
+
1369
+ instance.setColumnSizing((_instance$initialStat = instance.initialState.columnSizing) != null ? _instance$initialStat : {});
1370
+ },
1371
+ resetHeaderSizeInfo: function resetHeaderSizeInfo() {
1372
+ var _instance$initialStat2;
1373
+
1374
+ instance.setColumnSizingInfo((_instance$initialStat2 = instance.initialState.columnSizingInfo) != null ? _instance$initialStat2 : {});
1375
+ },
1376
+ resetColumnSize: function resetColumnSize(columnId) {
1377
+ instance.setColumnSizing(function (_ref) {
1378
+ _ref[columnId];
1379
+ var rest = _objectWithoutPropertiesLoose(_ref, [columnId].map(_toPropertyKey));
1380
+
1381
+ return rest;
1382
+ });
1383
+ },
1384
+ resetHeaderSize: function resetHeaderSize(headerId) {
1385
+ var header = instance.getHeader(headerId);
1386
+
1387
+ if (!header) {
1388
+ return;
1389
+ }
1390
+
1391
+ return instance.resetColumnSize(header.column.id);
1392
+ },
1393
+ getHeaderCanResize: function getHeaderCanResize(headerId) {
1394
+ var header = instance.getHeader(headerId);
1395
+
1396
+ if (!header) {
1397
+ throw new Error();
1398
+ }
1399
+
1400
+ return instance.getColumnCanResize(header.column.id);
1401
+ },
1402
+ getColumnCanResize: function getColumnCanResize(columnId) {
1403
+ var _ref2, _ref3, _column$enableResizin;
1404
+
1405
+ var column = instance.getColumn(columnId);
1406
+
1407
+ if (!column) {
1408
+ throw new Error();
1409
+ }
1410
+
1411
+ return (_ref2 = (_ref3 = (_column$enableResizin = column.enableResizing) != null ? _column$enableResizin : instance.options.enableColumnResizing) != null ? _ref3 : column.defaultCanResize) != null ? _ref2 : true;
1412
+ },
1413
+ getColumnIsResizing: function getColumnIsResizing(columnId) {
1414
+ var column = instance.getColumn(columnId);
1415
+
1416
+ if (!column) {
1417
+ throw new Error();
1418
+ }
1419
+
1420
+ return instance.getState().columnSizingInfo.isResizingColumn === columnId;
1421
+ },
1422
+ getHeaderIsResizing: function getHeaderIsResizing(headerId) {
1423
+ var header = instance.getHeader(headerId);
1424
+
1425
+ if (!header) {
1426
+ throw new Error();
1427
+ }
1428
+
1429
+ return instance.getColumnIsResizing(header.column.id);
1430
+ },
1431
+ getHeaderResizerProps: function getHeaderResizerProps(headerId, userProps) {
1432
+ var header = instance.getHeader(headerId);
1433
+
1434
+ if (!header) {
1435
+ return;
1436
+ }
1437
+
1438
+ var column = instance.getColumn(header.column.id);
1439
+
1440
+ if (!column) {
1441
+ return;
1442
+ }
1443
+
1444
+ var canResize = column.getCanResize();
1445
+
1446
+ var onResizeStart = function onResizeStart(e) {
1447
+ if (isTouchStartEvent(e)) {
1448
+ // lets not respond to multiple touches (e.g. 2 or 3 fingers)
1449
+ if (e.touches && e.touches.length > 1) {
1450
+ return;
1451
+ }
1452
+ }
1453
+
1454
+ var columnSizingStart = header.getLeafHeaders().map(function (d) {
1455
+ return [d.column.id, d.getWidth()];
1456
+ });
1457
+ var clientX = isTouchStartEvent(e) ? Math.round(e.touches[0].clientX) : e.clientX;
1458
+
1459
+ var updateOffset = function updateOffset(eventType, clientXPos) {
1460
+ if (typeof clientXPos !== 'number') {
1461
+ return;
1462
+ }
1463
+
1464
+ var newColumnSizing = {};
1465
+ instance.setColumnSizingInfo(function (old) {
1466
+ var _old$startOffset, _old$startSize;
1467
+
1468
+ var deltaOffset = clientXPos - ((_old$startOffset = old == null ? void 0 : old.startOffset) != null ? _old$startOffset : 0);
1469
+ var deltaPercentage = Math.max(deltaOffset / ((_old$startSize = old == null ? void 0 : old.startSize) != null ? _old$startSize : 0), -0.999999);
1470
+ old.columnSizingStart.forEach(function (_ref4) {
1471
+ var columnId = _ref4[0],
1472
+ headerWidth = _ref4[1];
1473
+ newColumnSizing[columnId] = Math.max(headerWidth + headerWidth * deltaPercentage, 0);
1474
+ });
1475
+ return _extends({}, old, {
1476
+ deltaOffset: deltaOffset,
1477
+ deltaPercentage: deltaPercentage
1478
+ });
1479
+ });
1480
+
1481
+ if (instance.options.columnResizeMode === 'onChange' || eventType === 'end') {
1482
+ instance.setColumnSizing(function (old) {
1483
+ return _extends({}, old, newColumnSizing);
1484
+ });
1485
+ }
1486
+ };
1487
+
1488
+ var onMove = function onMove(clientXPos) {
1489
+ return updateOffset('move', clientXPos);
1490
+ };
1491
+
1492
+ var onEnd = function onEnd(clientXPos) {
1493
+ updateOffset('end', clientXPos);
1494
+ instance.setColumnSizingInfo(function (old) {
1495
+ return _extends({}, old, {
1496
+ isResizingColumn: false,
1497
+ startOffset: null,
1498
+ startSize: null,
1499
+ deltaOffset: null,
1500
+ deltaPercentage: null,
1501
+ columnSizingStart: []
1502
+ });
1503
+ });
1504
+ };
1505
+
1506
+ var mouseEvents = {
1507
+ moveHandler: function moveHandler(e) {
1508
+ return onMove(e.clientX);
1509
+ },
1510
+ upHandler: function upHandler(e) {
1511
+ document.removeEventListener('mousemove', mouseEvents.moveHandler);
1512
+ document.removeEventListener('mouseup', mouseEvents.upHandler);
1513
+ onEnd(e.clientX);
1514
+ }
1515
+ };
1516
+ var touchEvents = {
1517
+ moveHandler: function moveHandler(e) {
1518
+ if (e.cancelable) {
1519
+ e.preventDefault();
1520
+ e.stopPropagation();
1521
+ }
1522
+
1523
+ onMove(e.touches[0].clientX);
1524
+ return false;
1525
+ },
1526
+ upHandler: function upHandler(e) {
1527
+ document.removeEventListener('touchmove', touchEvents.moveHandler);
1528
+ document.removeEventListener('touchend', touchEvents.upHandler);
1529
+
1530
+ if (e.cancelable) {
1531
+ e.preventDefault();
1532
+ e.stopPropagation();
1533
+ }
1534
+
1535
+ onEnd(e.touches[0].clientX);
1536
+ }
1537
+ };
1538
+ var passiveIfSupported = passiveEventSupported() ? {
1539
+ passive: false
1540
+ } : false;
1541
+
1542
+ if (isTouchStartEvent(e)) {
1543
+ document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
1544
+ document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
1545
+ } else {
1546
+ document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
1547
+ document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
1548
+ }
1549
+
1550
+ instance.setColumnSizingInfo(function (old) {
1551
+ return _extends({}, old, {
1552
+ startOffset: clientX,
1553
+ startSize: header.getWidth(),
1554
+ deltaOffset: 0,
1555
+ deltaPercentage: 0,
1556
+ columnSizingStart: columnSizingStart,
1557
+ isResizingColumn: header.column.id
1558
+ });
1559
+ });
1560
+ };
1561
+
1562
+ var initialProps = canResize ? {
1563
+ title: 'Toggle Grouping',
1564
+ draggable: false,
1565
+ role: 'separator',
1566
+ onMouseDown: function onMouseDown(e) {
1567
+ e.persist();
1568
+ onResizeStart(e);
1569
+ },
1570
+ onTouchStart: function onTouchStart(e) {
1571
+ e.persist();
1572
+ onResizeStart(e);
1573
+ }
1574
+ } : {};
1575
+ return propGetter(initialProps, userProps);
1576
+ }
1577
+ };
1578
+ }
1579
+ function createColumn$2(column, instance) {
1580
+ return {
1581
+ getIsResizing: function getIsResizing() {
1582
+ return instance.getColumnIsResizing(column.id);
1583
+ },
1584
+ getCanResize: function getCanResize() {
1585
+ return instance.getColumnCanResize(column.id);
1586
+ },
1587
+ resetSize: function resetSize() {
1588
+ return instance.resetColumnSize(column.id);
1589
+ }
1590
+ };
1591
+ }
1592
+ function createHeader(header, instance) {
1593
+ return {
1594
+ getIsResizing: function getIsResizing() {
1595
+ return instance.getHeaderIsResizing(header.id);
1596
+ },
1597
+ getCanResize: function getCanResize() {
1598
+ return instance.getHeaderCanResize(header.id);
1599
+ },
1600
+ getResizerProps: function getResizerProps(userProps) {
1601
+ return instance.getHeaderResizerProps(header.id, userProps);
1602
+ },
1603
+ resetSize: function resetSize() {
1604
+ return instance.resetHeaderSize(header.id);
1605
+ }
1606
+ };
1607
+ }
1608
+ var passiveSupported = null;
1609
+ function passiveEventSupported() {
1610
+ if (typeof passiveSupported === 'boolean') return passiveSupported;
1611
+ var supported = false;
1612
+
1613
+ try {
1614
+ var options = {
1615
+ get passive() {
1616
+ supported = true;
1617
+ return false;
1618
+ }
1619
+
1620
+ };
1621
+
1622
+ var noop = function noop() {};
1623
+
1624
+ window.addEventListener('test', noop, options);
1625
+ window.removeEventListener('test', noop);
1626
+ } catch (err) {
1627
+ supported = false;
1628
+ }
1629
+
1630
+ passiveSupported = supported;
1631
+ return passiveSupported;
1632
+ }
1633
+
1634
+ function isTouchStartEvent(e) {
1635
+ return e.type === 'touchstart';
1636
+ }
1637
+
1322
1638
  //
1323
1639
  function createRow$1(row, instance) {
1324
1640
  return {
@@ -1370,7 +1686,7 @@
1370
1686
  }
1371
1687
  function getInstance$3(instance) {
1372
1688
  return {
1373
- createHeader: function createHeader(column, options) {
1689
+ createHeader: function createHeader$1(column, options) {
1374
1690
  var _options$id;
1375
1691
 
1376
1692
  var id = (_options$id = options.id) != null ? _options$id : column.id;
@@ -1432,6 +1748,8 @@
1432
1748
  });
1433
1749
  }
1434
1750
  };
1751
+ header = Object.assign(header, createHeader(header, instance)); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
1752
+
1435
1753
  return header;
1436
1754
  },
1437
1755
  // Header Groups
@@ -2881,7 +3199,7 @@
2881
3199
 
2882
3200
  var instance = {};
2883
3201
 
2884
- var defaultOptions = _extends({}, getDefaultOptions$6(instance), getDefaultOptions$4(instance), getDefaultOptions$3(instance), getDefaultOptions$2(instance), getDefaultOptions$1(instance), getDefaultOptions$5(instance), getDefaultOptions(instance));
3202
+ var defaultOptions = _extends({}, getDefaultOptions$7(instance), getDefaultOptions$5(instance), getDefaultOptions$4(instance), getDefaultOptions$2(instance), getDefaultOptions$1(instance), getDefaultOptions$6(instance), getDefaultOptions(instance), getDefaultOptions$3(instance));
2885
3203
 
2886
3204
  var defaultState = {};
2887
3205
 
@@ -2893,9 +3211,9 @@
2893
3211
 
2894
3212
  instance.options = buildOptions(options);
2895
3213
 
2896
- var initialState = _extends({}, getInitialState$6(), getInitialState$4(), getInitialState$3(), getInitialState$2(), getInitialState$1(), getInitialState$5(), getInitialState(), (_options$initialState = options.initialState) != null ? _options$initialState : {});
3214
+ var initialState = _extends({}, getInitialState$7(), getInitialState$5(), getInitialState$4(), getInitialState$2(), getInitialState$1(), getInitialState$6(), getInitialState(), getInitialState$3(), (_options$initialState = options.initialState) != null ? _options$initialState : {});
2897
3215
 
2898
- var finalInstance = _extends({}, instance, getInstance$7(instance), getInstance$5(instance), getInstance$4(instance), getInstance$3(instance), getInstance$2(instance), getInstance$1(instance), getInstance$6(instance), getInstance(instance), {
3216
+ var finalInstance = _extends({}, instance, getInstance$8(instance), getInstance$6(instance), getInstance$5(instance), getInstance$3(instance), getInstance$2(instance), getInstance$1(instance), getInstance$7(instance), getInstance(instance), getInstance$4(instance), {
2899
3217
  rerender: rerender,
2900
3218
  initialState: initialState,
2901
3219
  internalState: initialState,
@@ -2952,7 +3270,7 @@
2952
3270
  getColumnDefs: function getColumnDefs() {
2953
3271
  return instance.options.columns;
2954
3272
  },
2955
- createColumn: function createColumn$5(columnDef, depth, parent) {
3273
+ createColumn: function createColumn$6(columnDef, depth, parent) {
2956
3274
  var _ref2, _columnDef$id;
2957
3275
 
2958
3276
  var defaultColumn = instance.getDefaultColumn();
@@ -2973,11 +3291,7 @@
2973
3291
  }
2974
3292
  }
2975
3293
 
2976
- var column = _extends({
2977
- width: 150,
2978
- minWidth: 20,
2979
- maxWidth: Number.MAX_SAFE_INTEGER
2980
- }, defaultColumn, columnDef, {
3294
+ var column = _extends({}, defaultColumnSizing, defaultColumn, columnDef, {
2981
3295
  id: "" + id,
2982
3296
  accessorFn: accessorFn,
2983
3297
  parent: parent,
@@ -3012,7 +3326,7 @@
3012
3326
  }, 'column.getLeafColumns', instance.options.debug)
3013
3327
  });
3014
3328
 
3015
- column = Object.assign(column, createColumn$4(column, instance), createColumn$2(column, instance), createColumn$1(column, instance), createColumn(column, instance), createColumn$3(column, instance)); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
3329
+ column = Object.assign(column, createColumn$5(column, instance), createColumn$3(column, instance), createColumn$1(column, instance), createColumn(column, instance), createColumn$4(column, instance), createColumn$2(column, instance)); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
3016
3330
 
3017
3331
  return column;
3018
3332
  },
@@ -3072,7 +3386,7 @@
3072
3386
  return column;
3073
3387
  },
3074
3388
  getColumnWidth: function getColumnWidth(columnId) {
3075
- var _column$minWidth, _column$width, _column$maxWidth;
3389
+ var _column$minWidth, _ref3, _column$maxWidth;
3076
3390
 
3077
3391
  var column = instance.getColumn(columnId);
3078
3392
 
@@ -3080,7 +3394,8 @@
3080
3394
  throw new Error();
3081
3395
  }
3082
3396
 
3083
- return Math.min(Math.max((_column$minWidth = column.minWidth) != null ? _column$minWidth : 0, (_column$width = column.width) != null ? _column$width : 0), (_column$maxWidth = column.maxWidth) != null ? _column$maxWidth : 0);
3397
+ var columnSize = instance.getState().columnSizing[column.id];
3398
+ return Math.min(Math.max((_column$minWidth = column.minWidth) != null ? _column$minWidth : defaultColumnSizing.minWidth, (_ref3 = columnSize != null ? columnSize : column.width) != null ? _ref3 : defaultColumnSizing.width), (_column$maxWidth = column.maxWidth) != null ? _column$maxWidth : defaultColumnSizing.maxWidth);
3084
3399
  },
3085
3400
  createCell: function createCell$1(row, column, value) {
3086
3401
  var cell = {
@@ -3324,6 +3639,34 @@
3324
3639
  key: cell.id,
3325
3640
  role: 'gridcell'
3326
3641
  }, userProps);
3642
+ },
3643
+ getTableWidth: function getTableWidth() {
3644
+ var _instance$getHeaderGr, _instance$getHeaderGr2;
3645
+
3646
+ return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce(function (sum, header) {
3647
+ return sum + header.getWidth();
3648
+ }, 0)) != null ? _instance$getHeaderGr : 0;
3649
+ },
3650
+ getLeftTableWidth: function getLeftTableWidth() {
3651
+ var _instance$getLeftHead, _instance$getLeftHead2;
3652
+
3653
+ return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce(function (sum, header) {
3654
+ return sum + header.getWidth();
3655
+ }, 0)) != null ? _instance$getLeftHead : 0;
3656
+ },
3657
+ getCenterTableWidth: function getCenterTableWidth() {
3658
+ var _instance$getCenterHe, _instance$getCenterHe2;
3659
+
3660
+ return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce(function (sum, header) {
3661
+ return sum + header.getWidth();
3662
+ }, 0)) != null ? _instance$getCenterHe : 0;
3663
+ },
3664
+ getRightTableWidth: function getRightTableWidth() {
3665
+ var _instance$getRightHea, _instance$getRightHea2;
3666
+
3667
+ return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce(function (sum, header) {
3668
+ return sum + header.getWidth();
3669
+ }, 0)) != null ? _instance$getRightHea : 0;
3327
3670
  }
3328
3671
  });
3329
3672
 
@@ -3403,4 +3746,4 @@
3403
3746
  Object.defineProperty(exports, '__esModule', { value: true });
3404
3747
 
3405
3748
  }));
3406
- //# sourceMappingURL=react-table.development.js.map
3749
+ //# sourceMappingURL=index.development.js.map