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

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.
@@ -580,6 +580,7 @@ function EdsDataGrid({
580
580
  height,
581
581
  getRowId,
582
582
  rowVirtualizerInstanceRef,
583
+ tableInstanceRef,
583
584
  columnSizing,
584
585
  onColumnResize,
585
586
  expansionState,
@@ -806,6 +807,9 @@ function EdsDataGrid({
806
807
  }));
807
808
  }, [pageSize]);
808
809
  const table = reactTable.useReactTable(options);
810
+ if (tableInstanceRef) {
811
+ tableInstanceRef.current = table;
812
+ }
809
813
  let tableWrapperStyle = {};
810
814
 
811
815
  /**
@@ -56,6 +56,7 @@ function EdsDataGrid({
56
56
  height,
57
57
  getRowId,
58
58
  rowVirtualizerInstanceRef,
59
+ tableInstanceRef,
59
60
  columnSizing,
60
61
  onColumnResize,
61
62
  expansionState,
@@ -282,6 +283,9 @@ function EdsDataGrid({
282
283
  }));
283
284
  }, [pageSize]);
284
285
  const table = useReactTable(options);
286
+ if (tableInstanceRef) {
287
+ tableInstanceRef.current = table;
288
+ }
285
289
  let tableWrapperStyle = {};
286
290
 
287
291
  /**
@@ -1,3 +1,3 @@
1
1
  import { HTMLAttributes } 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, columnSizing, onColumnResize, expansionState, setExpansionState, getSubRows, defaultColumn, onRowContextMenu, onRowClick, onCellClick, enableFooter, enableSortingRemoval, ...rest }: EdsDataGridProps<T> & HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
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;
@@ -1,4 +1,4 @@
1
- import { Cell, Column, ColumnDef, ColumnPinningState, ColumnResizeMode, ColumnSizingState, ExpandedState, OnChangeFn, Row, RowSelectionState, SortingState, TableOptions } from '@tanstack/react-table';
1
+ import { Cell, Column, ColumnDef, ColumnPinningState, ColumnResizeMode, ColumnSizingState, ExpandedState, OnChangeFn, Row, RowSelectionState, SortingState, Table, TableOptions } from '@tanstack/react-table';
2
2
  import { Virtualizer } from '@tanstack/react-virtual';
3
3
  import { CSSProperties, MouseEvent, MutableRefObject, ReactElement } from 'react';
4
4
  type BaseProps<T> = {
@@ -272,15 +272,16 @@ type ColumnProps = {
272
272
  columnSizing?: ColumnSizingState;
273
273
  onColumnResize?: (e: ColumnSizingState) => void;
274
274
  };
275
- type RefProps = {
275
+ type RefProps<T> = {
276
276
  rowVirtualizerInstanceRef?: MutableRefObject<Virtualizer<HTMLDivElement, Element> | null>;
277
+ tableInstanceRef?: MutableRefObject<Table<T> | null>;
277
278
  };
278
279
  type ExpansionProps<T> = {
279
280
  expansionState?: ExpandedState;
280
281
  setExpansionState?: React.Dispatch<React.SetStateAction<ExpandedState>>;
281
282
  getSubRows?: (row: T, rowIndex: number) => Array<T>;
282
283
  };
283
- export type EdsDataGridProps<T> = BaseProps<T> & RowSelectionProps<T> & StyleProps<T> & HandlersProps<T> & SortProps & FilterProps & PagingProps & ColumnProps & VirtualProps & RefProps & ExpansionProps<T> & {
284
+ export type EdsDataGridProps<T> = BaseProps<T> & RowSelectionProps<T> & StyleProps<T> & HandlersProps<T> & SortProps & FilterProps & PagingProps & ColumnProps & VirtualProps & RefProps<T> & ExpansionProps<T> & {
284
285
  /**
285
286
  * Which columns are visible. If not set, all columns are visible. undefined means that the column is visible.
286
287
  * @default undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/eds-data-grid-react",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
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",
@@ -23,8 +23,8 @@
23
23
  "@tanstack/react-table": "^8.20.1",
24
24
  "@tanstack/react-virtual": "^3.10.8",
25
25
  "@equinor/eds-icons": "^0.21.0",
26
- "@equinor/eds-tokens": "0.9.2",
27
- "@equinor/eds-utils": "^0.8.5"
26
+ "@equinor/eds-utils": "^0.8.5",
27
+ "@equinor/eds-tokens": "0.9.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@rollup/plugin-babel": "^6.0.4",