@trackunit/react-table 1.13.59 → 1.14.0

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.
package/index.cjs.js CHANGED
@@ -1119,11 +1119,12 @@ const Table = ({ rowHeight = 50, ...props }) => {
1119
1119
  //we need a reference to the scrolling element for logic down below
1120
1120
  const tableScrollElementRef = react.useRef(null);
1121
1121
  const [t] = useTranslation();
1122
- const virtualizer = reactComponents.useInfiniteScroll({
1122
+ const virtualizer = reactComponents.useBidirectionalScroll({
1123
1123
  pagination: props.pagination || reactComponents.noPagination,
1124
1124
  scrollElementRef: tableScrollElementRef,
1125
1125
  count: props.getRowModel().rows.length,
1126
1126
  estimateSize: () => rowHeight, // TODO: we should probably move from rowHeight -> estimateSize callback api to match Tanstack Virtual
1127
+ onTopItemChange: props.onTopItemChange,
1127
1128
  });
1128
1129
  const visibleColumns = react.useMemo(() => props.getAllColumns().filter(column => column.getIsVisible()), [props]);
1129
1130
  const visibleColumnsCount = visibleColumns.length;
package/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation, NamespaceTrans } from '@trackunit/i18n-library-translation';
3
- import { MenuItem, Icon, Button, Tooltip, useOverflowItems, MoreMenu, MenuList, Spacer, cvaInteractableItem, Text, Popover, PopoverTrigger, IconButton, PopoverContent, useInfiniteScroll, noPagination, Card, Spinner, EmptyState } from '@trackunit/react-components';
3
+ import { MenuItem, Icon, Button, Tooltip, useOverflowItems, MoreMenu, MenuList, Spacer, cvaInteractableItem, Text, Popover, PopoverTrigger, IconButton, PopoverContent, useBidirectionalScroll, noPagination, Card, Spinner, EmptyState } from '@trackunit/react-components';
4
4
  import { objectValues, nonNullable, objectKeys, objectEntries } from '@trackunit/shared-utils';
5
5
  import { useMemo, Children, cloneElement, useRef, useState, useEffect, useCallback, createElement } from 'react';
6
6
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
@@ -1118,11 +1118,12 @@ const Table = ({ rowHeight = 50, ...props }) => {
1118
1118
  //we need a reference to the scrolling element for logic down below
1119
1119
  const tableScrollElementRef = useRef(null);
1120
1120
  const [t] = useTranslation();
1121
- const virtualizer = useInfiniteScroll({
1121
+ const virtualizer = useBidirectionalScroll({
1122
1122
  pagination: props.pagination || noPagination,
1123
1123
  scrollElementRef: tableScrollElementRef,
1124
1124
  count: props.getRowModel().rows.length,
1125
1125
  estimateSize: () => rowHeight, // TODO: we should probably move from rowHeight -> estimateSize callback api to match Tanstack Virtual
1126
+ onTopItemChange: props.onTopItemChange,
1126
1127
  });
1127
1128
  const visibleColumns = useMemo(() => props.getAllColumns().filter(column => column.getIsVisible()), [props]);
1128
1129
  const visibleColumnsCount = visibleColumns.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "1.13.59",
3
+ "version": "1.14.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -14,14 +14,14 @@
14
14
  "react-dnd-html5-backend": "16.0.1",
15
15
  "@tanstack/react-router": "1.114.29",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/react-components": "1.17.48",
18
- "@trackunit/shared-utils": "1.13.60",
19
- "@trackunit/css-class-variance-utilities": "1.11.60",
20
- "@trackunit/ui-icons": "1.11.58",
21
- "@trackunit/react-table-base-components": "1.13.55",
22
- "@trackunit/react-form-components": "1.14.54",
23
- "@trackunit/i18n-library-translation": "1.12.51",
24
- "@trackunit/iris-app-runtime-core-api": "1.12.43",
17
+ "@trackunit/react-components": "1.18.0",
18
+ "@trackunit/shared-utils": "1.13.61",
19
+ "@trackunit/css-class-variance-utilities": "1.11.61",
20
+ "@trackunit/ui-icons": "1.11.59",
21
+ "@trackunit/react-table-base-components": "1.14.0",
22
+ "@trackunit/react-form-components": "1.15.0",
23
+ "@trackunit/i18n-library-translation": "1.12.52",
24
+ "@trackunit/iris-app-runtime-core-api": "1.12.44",
25
25
  "graphql": "^16.10.0"
26
26
  },
27
27
  "module": "./index.esm.js",
package/src/Table.d.ts CHANGED
@@ -79,6 +79,12 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
79
79
  * Used for custom column reorder logic or analytics.
80
80
  */
81
81
  onColumnDragStart?: (columnId: string) => void;
82
+ /**
83
+ * Callback fired when the topmost visible row changes during scroll.
84
+ * Receives the data index of the new top row. Useful for syncing scroll
85
+ * position to a URL cursor via `useCursorUrlSync`.
86
+ */
87
+ onTopItemChange?: (index: number) => void;
82
88
  }
83
89
  /**
84
90
  * Table displays large data sets with virtual scrolling, column sorting, filtering, resizing, drag-and-drop column reordering,