@equinor/eds-data-grid-react 0.7.3 → 0.7.5

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.
@@ -8,6 +8,7 @@ var styled = require('styled-components');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var edsIcons = require('@equinor/eds-icons');
10
10
  var edsTokens = require('@equinor/eds-tokens');
11
+ var edsUtils = require('@equinor/eds-utils');
11
12
 
12
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
14
 
@@ -469,6 +470,7 @@ function TableRow({
469
470
  row,
470
471
  onCellClick,
471
472
  onClick,
473
+ onDoubleClick,
472
474
  onContextMenu
473
475
  }) {
474
476
  const {
@@ -481,6 +483,7 @@ function TableRow({
481
483
  },
482
484
  className: `${row.getIsSelected() ? 'selected' : ''} ${rowClass?.(row)}`,
483
485
  onClick: onClick,
486
+ onDoubleClick: onDoubleClick,
484
487
  onContextMenu: onContextMenu,
485
488
  children: row.getVisibleCells().map(cell => /*#__PURE__*/jsxRuntime.jsx(TableBodyCell, {
486
489
  cell: cell,
@@ -535,7 +538,7 @@ function logDevelopmentWarningOfPropUse(deprecatedProps) {
535
538
  }
536
539
 
537
540
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
538
- function EdsDataGrid({
541
+ function EdsDataGridInner({
539
542
  rows,
540
543
  columns,
541
544
  columnResizeMode,
@@ -589,11 +592,12 @@ function EdsDataGrid({
589
592
  defaultColumn,
590
593
  onRowContextMenu,
591
594
  onRowClick,
595
+ onRowDoubleClick,
592
596
  onCellClick,
593
597
  enableFooter,
594
598
  enableSortingRemoval,
595
599
  ...rest
596
- }) {
600
+ }, ref) {
597
601
  logDevelopmentWarningOfPropUse({
598
602
  virtualHeight: {
599
603
  value: virtualHeight,
@@ -824,6 +828,7 @@ function EdsDataGrid({
824
828
  };
825
829
  }
826
830
  const parentRef = react.useRef(null);
831
+ const combinedRef = react.useMemo(() => edsUtils.mergeRefs(parentRef, ref), [parentRef, ref]);
827
832
 
828
833
  /**
829
834
  * Virtualization setup
@@ -872,7 +877,7 @@ function EdsDataGrid({
872
877
  ...rest.style,
873
878
  ...tableWrapperStyle
874
879
  },
875
- ref: parentRef,
880
+ ref: combinedRef,
876
881
  $height: height,
877
882
  $width: width,
878
883
  $scrollbarHorizontal: scrollbarHorizontal,
@@ -920,6 +925,7 @@ function EdsDataGrid({
920
925
  row: row,
921
926
  onContextMenu: onRowContextMenu ? event => onRowContextMenu(row, event) : undefined,
922
927
  onClick: onRowClick ? event => onRowClick(row, event) : undefined,
928
+ onDoubleClick: onRowDoubleClick ? event => onRowDoubleClick(row, event) : undefined,
923
929
  onCellClick: onCellClick
924
930
  }, virtualItem.index);
925
931
  }), paddingBottom > 0 && /*#__PURE__*/jsxRuntime.jsx(edsCoreReact.Table.Row, {
@@ -982,6 +988,7 @@ const TableWrapper = styled__default.default.div.withConfig({
982
988
  $height,
983
989
  $width
984
990
  }) => Boolean($height) && Boolean($width) ? 'strict' : 'unset');
991
+ const EdsDataGrid = /*#__PURE__*/react.forwardRef(EdsDataGridInner);
985
992
 
986
993
  Object.defineProperty(exports, "createColumnHelper", {
987
994
  enumerable: true,
@@ -1,17 +1,18 @@
1
1
  import { Typography, useEds, Table, Pagination } from '@equinor/eds-core-react';
2
2
  import { getExpandedRowModel, getCoreRowModel, getSortedRowModel, getFacetedRowModel, getFacetedUniqueValues, getFacetedMinMaxValues, getFilteredRowModel, getPaginationRowModel, useReactTable } from '@tanstack/react-table';
3
3
  import { useVirtualizer } from '@tanstack/react-virtual';
4
- import { useState, useEffect, useMemo, useRef, useCallback } from 'react';
4
+ import { forwardRef, useState, useEffect, useMemo, useRef, useCallback } from 'react';
5
5
  import styled from 'styled-components';
6
6
  import { TableProvider } from './EdsDataGridContext.js';
7
7
  import { TableHeaderRow } from './components/TableHeaderRow.js';
8
8
  import { TableFooterRow } from './components/TableFooterRow.js';
9
9
  import { TableRow } from './components/TableRow.js';
10
10
  import { addPxSuffixIfInputHasNoPrefix, logDevelopmentWarningOfPropUse } from './utils.js';
11
+ import { mergeRefs } from '@equinor/eds-utils';
11
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
13
 
13
14
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
14
- function EdsDataGrid({
15
+ function EdsDataGridInner({
15
16
  rows,
16
17
  columns,
17
18
  columnResizeMode,
@@ -65,11 +66,12 @@ function EdsDataGrid({
65
66
  defaultColumn,
66
67
  onRowContextMenu,
67
68
  onRowClick,
69
+ onRowDoubleClick,
68
70
  onCellClick,
69
71
  enableFooter,
70
72
  enableSortingRemoval,
71
73
  ...rest
72
- }) {
74
+ }, ref) {
73
75
  logDevelopmentWarningOfPropUse({
74
76
  virtualHeight: {
75
77
  value: virtualHeight,
@@ -300,6 +302,7 @@ function EdsDataGrid({
300
302
  };
301
303
  }
302
304
  const parentRef = useRef(null);
305
+ const combinedRef = useMemo(() => mergeRefs(parentRef, ref), [parentRef, ref]);
303
306
 
304
307
  /**
305
308
  * Virtualization setup
@@ -348,7 +351,7 @@ function EdsDataGrid({
348
351
  ...rest.style,
349
352
  ...tableWrapperStyle
350
353
  },
351
- ref: parentRef,
354
+ ref: combinedRef,
352
355
  $height: height,
353
356
  $width: width,
354
357
  $scrollbarHorizontal: scrollbarHorizontal,
@@ -396,6 +399,7 @@ function EdsDataGrid({
396
399
  row: row,
397
400
  onContextMenu: onRowContextMenu ? event => onRowContextMenu(row, event) : undefined,
398
401
  onClick: onRowClick ? event => onRowClick(row, event) : undefined,
402
+ onDoubleClick: onRowDoubleClick ? event => onRowDoubleClick(row, event) : undefined,
399
403
  onCellClick: onCellClick
400
404
  }, virtualItem.index);
401
405
  }), paddingBottom > 0 && /*#__PURE__*/jsx(Table.Row, {
@@ -458,5 +462,6 @@ const TableWrapper = styled.div.withConfig({
458
462
  $height,
459
463
  $width
460
464
  }) => Boolean($height) && Boolean($width) ? 'strict' : 'unset');
465
+ const EdsDataGrid = /*#__PURE__*/forwardRef(EdsDataGridInner);
461
466
 
462
467
  export { EdsDataGrid };
@@ -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,3 +1,7 @@
1
- import { HTMLAttributes } from 'react';
1
+ import { HTMLAttributes, ForwardedRef } from 'react';
2
2
  import { EdsDataGridProps } from './EdsDataGridProps';
3
- export declare function EdsDataGrid<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>): 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
+ export declare const EdsDataGrid: <T>(props: EdsDataGridProps<T> & HTMLAttributes<HTMLDivElement> & {
5
+ ref?: ForwardedRef<HTMLDivElement>;
6
+ }) => ReturnType<typeof EdsDataGridInner>;
7
+ export {};
@@ -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.3",
3
+ "version": "0.7.5",
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.11.2",
25
+ "@equinor/eds-utils": "^0.8.6",
26
+ "@equinor/eds-icons": "^0.22.0",
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.1.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.10.5",
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.13",
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.7.2"
70
70
  },
71
71
  "homepage": "https://eds.equinor.com",
72
72
  "repository": {