@tanstack/table-core 8.11.2 → 8.11.4

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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/build/lib/aggregationFns.js +9 -11
  3. package/build/lib/aggregationFns.js.map +1 -1
  4. package/build/lib/columnHelper.js +9 -11
  5. package/build/lib/columnHelper.js.map +1 -1
  6. package/build/lib/core/cell.js +9 -11
  7. package/build/lib/core/cell.js.map +1 -1
  8. package/build/lib/core/column.js +9 -11
  9. package/build/lib/core/column.js.map +1 -1
  10. package/build/lib/core/headers.js +9 -11
  11. package/build/lib/core/headers.js.map +1 -1
  12. package/build/lib/core/row.js +9 -11
  13. package/build/lib/core/row.js.map +1 -1
  14. package/build/lib/core/table.js +17 -15
  15. package/build/lib/core/table.js.map +1 -1
  16. package/build/lib/features/ColumnSizing.d.ts +2 -2
  17. package/build/lib/features/ColumnSizing.js +21 -20
  18. package/build/lib/features/ColumnSizing.js.map +1 -1
  19. package/build/lib/features/Expanding.js +9 -11
  20. package/build/lib/features/Expanding.js.map +1 -1
  21. package/build/lib/features/Filters.js +9 -11
  22. package/build/lib/features/Filters.js.map +1 -1
  23. package/build/lib/features/Grouping.js +9 -11
  24. package/build/lib/features/Grouping.js.map +1 -1
  25. package/build/lib/features/Ordering.js +9 -11
  26. package/build/lib/features/Ordering.js.map +1 -1
  27. package/build/lib/features/Pagination.js +9 -11
  28. package/build/lib/features/Pagination.js.map +1 -1
  29. package/build/lib/features/Pinning.js +9 -11
  30. package/build/lib/features/Pinning.js.map +1 -1
  31. package/build/lib/features/RowSelection.js +9 -11
  32. package/build/lib/features/RowSelection.js.map +1 -1
  33. package/build/lib/features/Sorting.js +9 -11
  34. package/build/lib/features/Sorting.js.map +1 -1
  35. package/build/lib/features/Visibility.js +9 -11
  36. package/build/lib/features/Visibility.js.map +1 -1
  37. package/build/lib/filterFns.js +9 -11
  38. package/build/lib/filterFns.js.map +1 -1
  39. package/build/lib/index.esm.js +29 -22
  40. package/build/lib/index.esm.js.map +1 -1
  41. package/build/lib/index.js +9 -11
  42. package/build/lib/index.js.map +1 -1
  43. package/build/lib/index.mjs +29 -22
  44. package/build/lib/index.mjs.map +1 -1
  45. package/build/lib/sortingFns.js +9 -11
  46. package/build/lib/sortingFns.js.map +1 -1
  47. package/build/lib/utils/filterRowsUtils.js +9 -11
  48. package/build/lib/utils/filterRowsUtils.js.map +1 -1
  49. package/build/lib/utils/getCoreRowModel.js +9 -11
  50. package/build/lib/utils/getCoreRowModel.js.map +1 -1
  51. package/build/lib/utils/getExpandedRowModel.js +9 -11
  52. package/build/lib/utils/getExpandedRowModel.js.map +1 -1
  53. package/build/lib/utils/getFacetedMinMaxValues.js +9 -11
  54. package/build/lib/utils/getFacetedMinMaxValues.js.map +1 -1
  55. package/build/lib/utils/getFacetedRowModel.js +9 -11
  56. package/build/lib/utils/getFacetedRowModel.js.map +1 -1
  57. package/build/lib/utils/getFacetedUniqueValues.js +9 -11
  58. package/build/lib/utils/getFacetedUniqueValues.js.map +1 -1
  59. package/build/lib/utils/getFilteredRowModel.js +9 -11
  60. package/build/lib/utils/getFilteredRowModel.js.map +1 -1
  61. package/build/lib/utils/getGroupedRowModel.js +9 -11
  62. package/build/lib/utils/getGroupedRowModel.js.map +1 -1
  63. package/build/lib/utils/getPaginationRowModel.js +9 -11
  64. package/build/lib/utils/getPaginationRowModel.js.map +1 -1
  65. package/build/lib/utils/getSortedRowModel.js +9 -11
  66. package/build/lib/utils/getSortedRowModel.js.map +1 -1
  67. package/build/lib/utils.js +9 -11
  68. package/build/lib/utils.js.map +1 -1
  69. package/build/umd/index.development.js +28 -23
  70. package/build/umd/index.development.js.map +1 -1
  71. package/build/umd/index.production.js +10 -10
  72. package/build/umd/index.production.js.map +1 -1
  73. package/package.json +13 -3
  74. package/src/aggregationFns.ts +0 -0
  75. package/src/columnHelper.ts +2 -2
  76. package/src/core/row.ts +2 -1
  77. package/src/core/table.ts +10 -5
  78. package/src/features/ColumnSizing.ts +33 -16
  79. package/src/features/Filters.ts +9 -9
  80. package/src/features/Grouping.ts +7 -5
  81. package/src/features/Sorting.ts +3 -3
  82. package/src/index.ts +0 -0
  83. package/src/types.ts +4 -2
  84. package/src/utils/getSortedRowModel.ts +5 -5
  85. package/src/utils.ts +14 -14
@@ -1,17 +1,15 @@
1
1
  /**
2
- * table-core
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
- */
2
+ * table-core
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
+ */
11
11
  'use strict';
12
12
 
13
- Object.defineProperty(exports, '__esModule', { value: true });
14
-
15
13
  var table = require('./core/table.js');
16
14
  var column = require('./core/column.js');
17
15
  var headers = require('./core/headers.js');
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,13 +1,13 @@
1
1
  /**
2
- * table-core
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
- */
2
+ * table-core
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
+ */
11
11
  // Is this type a tuple?
12
12
 
13
13
  // If this type is a tuple, what indices are allowed?
@@ -601,7 +601,10 @@ const ColumnSizing = {
601
601
  }
602
602
  return 0;
603
603
  };
604
- header.getResizeHandler = () => {
604
+ header.getResizeHandler = function (contextDocument) {
605
+ if (contextDocument === void 0) {
606
+ contextDocument = document;
607
+ }
605
608
  const column = table.getColumn(header.column.id);
606
609
  const canResize = column == null ? void 0 : column.getCanResize();
607
610
  return e => {
@@ -661,8 +664,8 @@ const ColumnSizing = {
661
664
  const mouseEvents = {
662
665
  moveHandler: e => onMove(e.clientX),
663
666
  upHandler: e => {
664
- document.removeEventListener('mousemove', mouseEvents.moveHandler);
665
- document.removeEventListener('mouseup', mouseEvents.upHandler);
667
+ contextDocument.removeEventListener('mousemove', mouseEvents.moveHandler);
668
+ contextDocument.removeEventListener('mouseup', mouseEvents.upHandler);
666
669
  onEnd(e.clientX);
667
670
  }
668
671
  };
@@ -677,8 +680,8 @@ const ColumnSizing = {
677
680
  },
678
681
  upHandler: e => {
679
682
  var _e$touches$;
680
- document.removeEventListener('touchmove', touchEvents.moveHandler);
681
- document.removeEventListener('touchend', touchEvents.upHandler);
683
+ contextDocument.removeEventListener('touchmove', touchEvents.moveHandler);
684
+ contextDocument.removeEventListener('touchend', touchEvents.upHandler);
682
685
  if (e.cancelable) {
683
686
  e.preventDefault();
684
687
  e.stopPropagation();
@@ -690,11 +693,11 @@ const ColumnSizing = {
690
693
  passive: false
691
694
  } : false;
692
695
  if (isTouchStartEvent(e)) {
693
- document.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
694
- document.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
696
+ contextDocument.addEventListener('touchmove', touchEvents.moveHandler, passiveIfSupported);
697
+ contextDocument.addEventListener('touchend', touchEvents.upHandler, passiveIfSupported);
695
698
  } else {
696
- document.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
697
- document.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
699
+ contextDocument.addEventListener('mousemove', mouseEvents.moveHandler, passiveIfSupported);
700
+ contextDocument.addEventListener('mouseup', mouseEvents.upHandler, passiveIfSupported);
698
701
  }
699
702
  table.setColumnSizingInfo(old => ({
700
703
  ...old,
@@ -2797,13 +2800,17 @@ function createTable(options) {
2797
2800
  getRowModel: () => {
2798
2801
  return table.getPaginationRowModel();
2799
2802
  },
2803
+ //in next version, we should just pass in the row model as the optional 2nd arg
2800
2804
  getRow: (id, searchAll) => {
2801
- const row = (searchAll ? table.getCoreRowModel() : table.getRowModel()).rowsById[id];
2805
+ let row = (searchAll ? table.getPrePaginationRowModel() : table.getRowModel()).rowsById[id];
2802
2806
  if (!row) {
2803
- if (process.env.NODE_ENV !== 'production') {
2804
- throw new Error(`getRow expected an ID, but got ${id}`);
2807
+ row = table.getCoreRowModel().rowsById[id];
2808
+ if (!row) {
2809
+ if (process.env.NODE_ENV !== 'production') {
2810
+ throw new Error(`getRow could not find row with ID: ${id}`);
2811
+ }
2812
+ throw new Error();
2805
2813
  }
2806
- throw new Error();
2807
2814
  }
2808
2815
  return row;
2809
2816
  },