@equinor/apollo-components 1.1.1 → 1.1.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.
package/dist/index.js CHANGED
@@ -356,14 +356,14 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
356
356
  function VirtualTable({ table, containerRef, ...props }) {
357
357
  var _a, _b;
358
358
  const { rows } = table.getRowModel();
359
- const rowVirtualizer = (0, import_react_virtual.useVirtual)({
360
- overscan: 10,
361
- size: rows.length,
362
- parentRef: containerRef
359
+ const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
360
+ count: rows.length,
361
+ estimateSize: () => 35,
362
+ getScrollElement: () => containerRef.current
363
363
  });
364
- const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
364
+ const virtualRows = rowVirtualizer.getVirtualItems();
365
365
  const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
366
- const paddingBottom = virtualRows.length > 0 ? totalSize - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
366
+ const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
367
367
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_eds_core_react9.Table, {
368
368
  children: [
369
369
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TableHeader, {
package/dist/index.mjs CHANGED
@@ -306,7 +306,7 @@ var DataTableHeader = (props) => {
306
306
  // src/DataTable/components/VirtualTable.tsx
307
307
  import { Table as Table5 } from "@equinor/eds-core-react";
308
308
  import { flexRender as flexRender3 } from "@tanstack/react-table";
309
- import { useVirtual } from "@tanstack/react-virtual";
309
+ import { useVirtualizer } from "@tanstack/react-virtual";
310
310
 
311
311
  // src/DataTable/components/PaddingRow.tsx
312
312
  import { Table as Table4 } from "@equinor/eds-core-react";
@@ -326,14 +326,14 @@ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
326
326
  function VirtualTable({ table, containerRef, ...props }) {
327
327
  var _a, _b;
328
328
  const { rows } = table.getRowModel();
329
- const rowVirtualizer = useVirtual({
330
- overscan: 10,
331
- size: rows.length,
332
- parentRef: containerRef
329
+ const rowVirtualizer = useVirtualizer({
330
+ count: rows.length,
331
+ estimateSize: () => 35,
332
+ getScrollElement: () => containerRef.current
333
333
  });
334
- const { virtualItems: virtualRows, totalSize } = rowVirtualizer;
334
+ const virtualRows = rowVirtualizer.getVirtualItems();
335
335
  const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
336
- const paddingBottom = virtualRows.length > 0 ? totalSize - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
336
+ const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
337
337
  return /* @__PURE__ */ jsxs6(Table5, {
338
338
  children: [
339
339
  /* @__PURE__ */ jsx10(TableHeader, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",