@equinor/eds-data-grid-react 0.7.3 → 0.7.4
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
|
|
|
@@ -535,7 +536,7 @@ function logDevelopmentWarningOfPropUse(deprecatedProps) {
|
|
|
535
536
|
}
|
|
536
537
|
|
|
537
538
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
538
|
-
function
|
|
539
|
+
function EdsDataGridInner({
|
|
539
540
|
rows,
|
|
540
541
|
columns,
|
|
541
542
|
columnResizeMode,
|
|
@@ -593,7 +594,7 @@ function EdsDataGrid({
|
|
|
593
594
|
enableFooter,
|
|
594
595
|
enableSortingRemoval,
|
|
595
596
|
...rest
|
|
596
|
-
}) {
|
|
597
|
+
}, ref) {
|
|
597
598
|
logDevelopmentWarningOfPropUse({
|
|
598
599
|
virtualHeight: {
|
|
599
600
|
value: virtualHeight,
|
|
@@ -824,6 +825,7 @@ function EdsDataGrid({
|
|
|
824
825
|
};
|
|
825
826
|
}
|
|
826
827
|
const parentRef = react.useRef(null);
|
|
828
|
+
const combinedRef = react.useMemo(() => edsUtils.mergeRefs(parentRef, ref), [parentRef, ref]);
|
|
827
829
|
|
|
828
830
|
/**
|
|
829
831
|
* Virtualization setup
|
|
@@ -872,7 +874,7 @@ function EdsDataGrid({
|
|
|
872
874
|
...rest.style,
|
|
873
875
|
...tableWrapperStyle
|
|
874
876
|
},
|
|
875
|
-
ref:
|
|
877
|
+
ref: combinedRef,
|
|
876
878
|
$height: height,
|
|
877
879
|
$width: width,
|
|
878
880
|
$scrollbarHorizontal: scrollbarHorizontal,
|
|
@@ -982,6 +984,7 @@ const TableWrapper = styled__default.default.div.withConfig({
|
|
|
982
984
|
$height,
|
|
983
985
|
$width
|
|
984
986
|
}) => Boolean($height) && Boolean($width) ? 'strict' : 'unset');
|
|
987
|
+
const EdsDataGrid = /*#__PURE__*/react.forwardRef(EdsDataGridInner);
|
|
985
988
|
|
|
986
989
|
Object.defineProperty(exports, "createColumnHelper", {
|
|
987
990
|
enumerable: true,
|
package/dist/esm/EdsDataGrid.js
CHANGED
|
@@ -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
|
|
15
|
+
function EdsDataGridInner({
|
|
15
16
|
rows,
|
|
16
17
|
columns,
|
|
17
18
|
columnResizeMode,
|
|
@@ -69,7 +70,7 @@ function EdsDataGrid({
|
|
|
69
70
|
enableFooter,
|
|
70
71
|
enableSortingRemoval,
|
|
71
72
|
...rest
|
|
72
|
-
}) {
|
|
73
|
+
}, ref) {
|
|
73
74
|
logDevelopmentWarningOfPropUse({
|
|
74
75
|
virtualHeight: {
|
|
75
76
|
value: virtualHeight,
|
|
@@ -300,6 +301,7 @@ function EdsDataGrid({
|
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
303
|
const parentRef = useRef(null);
|
|
304
|
+
const combinedRef = useMemo(() => mergeRefs(parentRef, ref), [parentRef, ref]);
|
|
303
305
|
|
|
304
306
|
/**
|
|
305
307
|
* Virtualization setup
|
|
@@ -348,7 +350,7 @@ function EdsDataGrid({
|
|
|
348
350
|
...rest.style,
|
|
349
351
|
...tableWrapperStyle
|
|
350
352
|
},
|
|
351
|
-
ref:
|
|
353
|
+
ref: combinedRef,
|
|
352
354
|
$height: height,
|
|
353
355
|
$width: width,
|
|
354
356
|
$scrollbarHorizontal: scrollbarHorizontal,
|
|
@@ -458,5 +460,6 @@ const TableWrapper = styled.div.withConfig({
|
|
|
458
460
|
$height,
|
|
459
461
|
$width
|
|
460
462
|
}) => Boolean($height) && Boolean($width) ? 'strict' : 'unset');
|
|
463
|
+
const EdsDataGrid = /*#__PURE__*/forwardRef(EdsDataGridInner);
|
|
461
464
|
|
|
462
465
|
export { EdsDataGrid };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
1
|
+
import { HTMLAttributes, ForwardedRef } from 'react';
|
|
2
2
|
import { EdsDataGridProps } from './EdsDataGridProps';
|
|
3
|
-
|
|
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;
|
|
4
|
+
export declare const EdsDataGrid: <T>(props: EdsDataGridProps<T> & HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
ref?: ForwardedRef<HTMLDivElement>;
|
|
6
|
+
}) => ReturnType<typeof EdsDataGridInner>;
|
|
7
|
+
export {};
|
package/package.json
CHANGED