@trackunit/react-table 1.7.9 → 1.7.11

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
@@ -870,11 +870,11 @@ const Table = ({ rowHeight = 50, ...props }) => {
870
870
  //we need a reference to the scrolling element for logic down below
871
871
  const tableContainerRef = react.useRef(null);
872
872
  const [t] = useTranslation();
873
- const { fetchMoreOnBottomReached, getVirtualItems, getTotalSize } = reactTablePagination.useInfiniteScroll({
873
+ const { getVirtualItems, getTotalSize } = reactTablePagination.useInfiniteScroll({
874
874
  pagination: props.pagination || reactTablePagination.noPagination,
875
875
  containerRef: tableContainerRef,
876
- rowSize: props.getRowModel().rows.length || 0,
877
- rowHeight,
876
+ count: props.getRowModel().rows.length,
877
+ estimateSize: () => rowHeight, // TODO: we should probably move from rowHeight -> estimateSize callback api to match Tanstack Virtual
878
878
  });
879
879
  const visibleColumns = react.useMemo(() => props.getAllColumns().filter(column => column.getIsVisible()), [props]);
880
880
  const visibleColumnsCount = visibleColumns.length;
@@ -941,7 +941,7 @@ const Table = ({ rowHeight = 50, ...props }) => {
941
941
  header.column.getToggleSortingHandler()?.(event);
942
942
  }
943
943
  }, [props]);
944
- return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsxRuntime.jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
944
+ return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsxRuntime.jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", ref: tableContainerRef, children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
945
945
  height: hasResults ? "auto" : "100%",
946
946
  width: "100%",
947
947
  position: "relative",
package/index.esm.js CHANGED
@@ -869,11 +869,11 @@ const Table = ({ rowHeight = 50, ...props }) => {
869
869
  //we need a reference to the scrolling element for logic down below
870
870
  const tableContainerRef = useRef(null);
871
871
  const [t] = useTranslation();
872
- const { fetchMoreOnBottomReached, getVirtualItems, getTotalSize } = useInfiniteScroll({
872
+ const { getVirtualItems, getTotalSize } = useInfiniteScroll({
873
873
  pagination: props.pagination || noPagination,
874
874
  containerRef: tableContainerRef,
875
- rowSize: props.getRowModel().rows.length || 0,
876
- rowHeight,
875
+ count: props.getRowModel().rows.length,
876
+ estimateSize: () => rowHeight, // TODO: we should probably move from rowHeight -> estimateSize callback api to match Tanstack Virtual
877
877
  });
878
878
  const visibleColumns = useMemo(() => props.getAllColumns().filter(column => column.getIsVisible()), [props]);
879
879
  const visibleColumnsCount = visibleColumns.length;
@@ -940,7 +940,7 @@ const Table = ({ rowHeight = 50, ...props }) => {
940
940
  header.column.getToggleSortingHandler()?.(event);
941
941
  }
942
942
  }, [props]);
943
- return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxs(TableRoot, { style: {
943
+ return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), dataTestId: props.dataTestId, children: [props.headerLeftActions || props.headerRightActions ? (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-neutral-200", ref: tableContainerRef, children: jsxs(TableRoot, { style: {
944
944
  height: hasResults ? "auto" : "100%",
945
945
  width: "100%",
946
946
  position: "relative",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "1.7.9",
3
+ "version": "1.7.11",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -15,16 +15,16 @@
15
15
  "jest-fetch-mock": "^3.0.3",
16
16
  "@tanstack/react-router": "1.114.29",
17
17
  "tailwind-merge": "^2.0.0",
18
- "@trackunit/react-components": "1.9.8",
19
- "@trackunit/shared-utils": "1.9.5",
20
- "@trackunit/css-class-variance-utilities": "1.7.5",
21
- "@trackunit/ui-icons": "1.7.7",
22
- "@trackunit/react-table-base-components": "1.7.8",
23
- "@trackunit/react-table-pagination": "1.7.5",
24
- "@trackunit/react-form-components": "1.8.8",
25
- "@trackunit/i18n-library-translation": "1.7.7",
26
- "@trackunit/react-core-contexts-api": "1.8.6",
27
- "@trackunit/react-test-setup": "1.4.5"
18
+ "@trackunit/react-components": "1.9.10",
19
+ "@trackunit/shared-utils": "1.9.7",
20
+ "@trackunit/css-class-variance-utilities": "1.7.7",
21
+ "@trackunit/ui-icons": "1.7.9",
22
+ "@trackunit/react-table-base-components": "1.7.10",
23
+ "@trackunit/react-table-pagination": "1.7.7",
24
+ "@trackunit/react-form-components": "1.8.10",
25
+ "@trackunit/i18n-library-translation": "1.7.9",
26
+ "@trackunit/react-core-contexts-api": "1.8.8",
27
+ "@trackunit/react-test-setup": "1.4.7"
28
28
  },
29
29
  "module": "./index.esm.js",
30
30
  "main": "./index.cjs.js",
package/src/Table.d.ts CHANGED
@@ -27,4 +27,4 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
27
27
  /**
28
28
  *
29
29
  */
30
- export declare const Table: <TData extends object>({ rowHeight, ...props }: TableProps<TData>) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const Table: <TData extends object>({ rowHeight, ...props }: TableProps<TData>) => ReactElement;