@equinor/eds-data-grid-react 0.7.4 → 0.7.6

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.
@@ -470,6 +470,7 @@ function TableRow({
470
470
  row,
471
471
  onCellClick,
472
472
  onClick,
473
+ onDoubleClick,
473
474
  onContextMenu
474
475
  }) {
475
476
  const {
@@ -482,6 +483,7 @@ function TableRow({
482
483
  },
483
484
  className: `${row.getIsSelected() ? 'selected' : ''} ${rowClass?.(row)}`,
484
485
  onClick: onClick,
486
+ onDoubleClick: onDoubleClick,
485
487
  onContextMenu: onContextMenu,
486
488
  children: row.getVisibleCells().map(cell => /*#__PURE__*/jsxRuntime.jsx(TableBodyCell, {
487
489
  cell: cell,
@@ -590,6 +592,7 @@ function EdsDataGridInner({
590
592
  defaultColumn,
591
593
  onRowContextMenu,
592
594
  onRowClick,
595
+ onRowDoubleClick,
593
596
  onCellClick,
594
597
  enableFooter,
595
598
  enableSortingRemoval,
@@ -842,6 +845,14 @@ function EdsDataGridInner({
842
845
  estimateSize
843
846
  });
844
847
  if (rowVirtualizerInstanceRef) rowVirtualizerInstanceRef.current = virtualizer;
848
+
849
+ // Add effect to recalculate virtualization when density changes
850
+ react.useEffect(() => {
851
+ if (enableVirtual && virtualizer) {
852
+ // Force the virtualizer to recalculate when density changes
853
+ virtualizer.measure();
854
+ }
855
+ }, [density, enableVirtual, virtualizer]);
845
856
  const virtualRows = virtualizer.getVirtualItems();
846
857
  const paddingTop = virtualRows.length ? virtualRows[0].start : 0;
847
858
  const paddingBottom = virtualRows.length ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
@@ -922,6 +933,7 @@ function EdsDataGridInner({
922
933
  row: row,
923
934
  onContextMenu: onRowContextMenu ? event => onRowContextMenu(row, event) : undefined,
924
935
  onClick: onRowClick ? event => onRowClick(row, event) : undefined,
936
+ onDoubleClick: onRowDoubleClick ? event => onRowDoubleClick(row, event) : undefined,
925
937
  onCellClick: onCellClick
926
938
  }, virtualItem.index);
927
939
  }), paddingBottom > 0 && /*#__PURE__*/jsxRuntime.jsx(edsCoreReact.Table.Row, {
@@ -66,6 +66,7 @@ function EdsDataGridInner({
66
66
  defaultColumn,
67
67
  onRowContextMenu,
68
68
  onRowClick,
69
+ onRowDoubleClick,
69
70
  onCellClick,
70
71
  enableFooter,
71
72
  enableSortingRemoval,
@@ -318,6 +319,14 @@ function EdsDataGridInner({
318
319
  estimateSize
319
320
  });
320
321
  if (rowVirtualizerInstanceRef) rowVirtualizerInstanceRef.current = virtualizer;
322
+
323
+ // Add effect to recalculate virtualization when density changes
324
+ useEffect(() => {
325
+ if (enableVirtual && virtualizer) {
326
+ // Force the virtualizer to recalculate when density changes
327
+ virtualizer.measure();
328
+ }
329
+ }, [density, enableVirtual, virtualizer]);
321
330
  const virtualRows = virtualizer.getVirtualItems();
322
331
  const paddingTop = virtualRows.length ? virtualRows[0].start : 0;
323
332
  const paddingBottom = virtualRows.length ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
@@ -398,6 +407,7 @@ function EdsDataGridInner({
398
407
  row: row,
399
408
  onContextMenu: onRowContextMenu ? event => onRowContextMenu(row, event) : undefined,
400
409
  onClick: onRowClick ? event => onRowClick(row, event) : undefined,
410
+ onDoubleClick: onRowDoubleClick ? event => onRowDoubleClick(row, event) : undefined,
401
411
  onCellClick: onCellClick
402
412
  }, virtualItem.index);
403
413
  }), paddingBottom > 0 && /*#__PURE__*/jsx(Table.Row, {
@@ -8,6 +8,7 @@ function TableRow({
8
8
  row,
9
9
  onCellClick,
10
10
  onClick,
11
+ onDoubleClick,
11
12
  onContextMenu
12
13
  }) {
13
14
  const {
@@ -20,6 +21,7 @@ function TableRow({
20
21
  },
21
22
  className: `${row.getIsSelected() ? 'selected' : ''} ${rowClass?.(row)}`,
22
23
  onClick: onClick,
24
+ onDoubleClick: onDoubleClick,
23
25
  onContextMenu: onContextMenu,
24
26
  children: row.getVisibleCells().map(cell => /*#__PURE__*/jsx(TableBodyCell, {
25
27
  cell: cell,
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes, ForwardedRef } from 'react';
2
2
  import { EdsDataGridProps } from './EdsDataGridProps';
3
- declare function EdsDataGridInner<T>({ rows, columns, columnResizeMode, pageSize, rowSelection, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, selectedRows, rowSelectionState, enableColumnFiltering, debug, enablePagination, enableSorting, stickyHeader, stickyFooter, onSelectRow, onRowSelectionChange, caption, enableVirtual, virtualHeight, columnVisibility, columnVisibilityChange, emptyMessage, columnOrder, cellClass, cellStyle, rowClass, rowStyle, headerClass, headerStyle, footerClass, footerStyle, externalPaginator, onSortingChange, manualSorting, sortingState, columnPinState, scrollbarHorizontal, width, minWidth, height, getRowId, rowVirtualizerInstanceRef, tableInstanceRef, columnSizing, onColumnResize, expansionState, setExpansionState, getSubRows, defaultColumn, onRowContextMenu, onRowClick, onCellClick, enableFooter, enableSortingRemoval, ...rest }: EdsDataGridProps<T> & HTMLAttributes<HTMLDivElement>, ref: ForwardedRef<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
3
+ declare function EdsDataGridInner<T>({ rows, columns, columnResizeMode, pageSize, rowSelection, enableRowSelection, enableMultiRowSelection, enableSubRowSelection, selectedRows, rowSelectionState, enableColumnFiltering, debug, enablePagination, enableSorting, stickyHeader, stickyFooter, onSelectRow, onRowSelectionChange, caption, enableVirtual, virtualHeight, columnVisibility, columnVisibilityChange, emptyMessage, columnOrder, cellClass, cellStyle, rowClass, rowStyle, headerClass, headerStyle, footerClass, footerStyle, externalPaginator, onSortingChange, manualSorting, sortingState, columnPinState, scrollbarHorizontal, width, minWidth, height, getRowId, rowVirtualizerInstanceRef, tableInstanceRef, columnSizing, onColumnResize, expansionState, setExpansionState, getSubRows, defaultColumn, onRowContextMenu, onRowClick, onRowDoubleClick, onCellClick, enableFooter, enableSortingRemoval, ...rest }: EdsDataGridProps<T> & HTMLAttributes<HTMLDivElement>, ref: ForwardedRef<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
4
4
  export declare const EdsDataGrid: <T>(props: EdsDataGridProps<T> & HTMLAttributes<HTMLDivElement> & {
5
5
  ref?: ForwardedRef<HTMLDivElement>;
6
6
  }) => ReturnType<typeof EdsDataGridInner>;
@@ -201,6 +201,14 @@ type HandlersProps<T> = {
201
201
  * @returns
202
202
  */
203
203
  onRowClick?: (row: Row<T>, event: MouseEvent<HTMLTableRowElement>) => unknown;
204
+ /**
205
+ * Row double-click handler.
206
+ *
207
+ * @param row The current row
208
+ * @param event The click event
209
+ * @returns
210
+ */
211
+ onRowDoubleClick?: (row: Row<T>, event: MouseEvent<HTMLTableRowElement>) => unknown;
204
212
  /**
205
213
  * Cell click handler.
206
214
  *
@@ -5,5 +5,5 @@ type Props<T> = {
5
5
  row: Row<T>;
6
6
  onCellClick?: EdsDataGridProps<T>['onCellClick'];
7
7
  } & HTMLAttributes<HTMLTableRowElement>;
8
- export declare function TableRow<T>({ row, onCellClick, onClick, onContextMenu, }: Props<T>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function TableRow<T>({ row, onCellClick, onClick, onDoubleClick, onContextMenu, }: Props<T>): import("react/jsx-runtime").JSX.Element;
9
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-data-grid-react",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "A feature-rich data-grid written in React, implementing the Equinor Design System",
5
5
  "license": "MIT",
6
6
  "types": "dist/types/index.d.ts",
@@ -20,32 +20,32 @@
20
20
  "styled-components": ">=5.1"
21
21
  },
22
22
  "dependencies": {
23
- "@tanstack/react-table": "^8.20.1",
24
- "@tanstack/react-virtual": "^3.10.8",
25
- "@equinor/eds-icons": "^0.21.0",
26
- "@equinor/eds-utils": "^0.8.5",
23
+ "@tanstack/react-table": "^8.20.6",
24
+ "@tanstack/react-virtual": "^3.13.2",
25
+ "@equinor/eds-icons": "^0.22.0",
26
+ "@equinor/eds-utils": "^0.8.7",
27
27
  "@equinor/eds-tokens": "0.9.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@rollup/plugin-babel": "^6.0.4",
31
- "@rollup/plugin-commonjs": "^27.0.0",
32
- "@rollup/plugin-node-resolve": "^15.3.0",
33
- "@storybook/addon-a11y": "^8.3.4",
34
- "@storybook/addon-actions": "^8.3.4",
35
- "@storybook/addon-docs": "^8.3.4",
36
- "@storybook/addon-essentials": "^8.3.4",
37
- "@storybook/addon-links": "^8.3.4",
38
- "@storybook/blocks": "^8.3.4",
39
- "@storybook/preview-api": "^8.3.4",
40
- "@storybook/react": "^8.3.4",
41
- "@storybook/react-vite": "^8.3.4",
31
+ "@rollup/plugin-commonjs": "^28.0.2",
32
+ "@rollup/plugin-node-resolve": "^16.0.0",
33
+ "@storybook/addon-a11y": "^8.4.7",
34
+ "@storybook/addon-actions": "^8.4.7",
35
+ "@storybook/addon-docs": "^8.4.7",
36
+ "@storybook/addon-essentials": "^8.4.7",
37
+ "@storybook/addon-links": "^8.4.7",
38
+ "@storybook/blocks": "^8.4.7",
39
+ "@storybook/preview-api": "^8.4.7",
40
+ "@storybook/react": "^8.4.7",
41
+ "@storybook/react-vite": "^8.4.7",
42
42
  "@testing-library/dom": "^10.4.0",
43
- "@testing-library/jest-dom": "^6.4.8",
44
- "@testing-library/react": "16.0.0",
43
+ "@testing-library/jest-dom": "^6.6.3",
44
+ "@testing-library/react": "16.3.0",
45
45
  "@testing-library/user-event": "^14.5.2",
46
- "@types/jest": "^29.5.12",
47
- "@types/node": "22.1.0",
48
- "@types/ramda": "^0.30.1",
46
+ "@types/jest": "^29.5.14",
47
+ "@types/node": "^22.13.14",
48
+ "@types/ramda": "^0.30.2",
49
49
  "@types/react": "^18.3.3",
50
50
  "@types/react-dom": "^18.3.0",
51
51
  "babel-plugin-styled-components": "^2.1.4",
@@ -53,20 +53,20 @@
53
53
  "jest-environment-jsdom": "29.7.0",
54
54
  "jest-styled-components": "^7.2.0",
55
55
  "js-file-download": "^0.4.12",
56
- "postcss": "^8.4.41",
56
+ "postcss": "^8.4.49",
57
57
  "ramda": "^0.30.1",
58
58
  "react": "^18.3.1",
59
59
  "react-dom": "^18.3.1",
60
- "react-hook-form": "^7.52.2",
61
- "rollup": "^4.22.5",
60
+ "react-hook-form": "^7.54.2",
61
+ "rollup": "^4.29.1",
62
62
  "rollup-plugin-delete": "^2.1.0",
63
63
  "rollup-plugin-postcss": "^4.0.2",
64
- "storybook": "^8.3.4",
65
- "styled-components": "6.1.12",
66
- "ts-jest": "29.2.4",
64
+ "storybook": "^8.4.7",
65
+ "styled-components": "6.1.17",
66
+ "ts-jest": "29.2.5",
67
67
  "ts-node": "10.9.2",
68
- "tsc-watch": "^6.2.0",
69
- "typescript": "~5.5.4"
68
+ "tsc-watch": "^6.2.1",
69
+ "typescript": "~5.8.2"
70
70
  },
71
71
  "homepage": "https://eds.equinor.com",
72
72
  "repository": {