@equinor/eds-data-grid-react 0.2.0 → 0.3.0

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.
@@ -1,185 +1,187 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
1
+ import { Typography, useEds, Table, Pagination } from '@equinor/eds-core-react';
3
2
  import { getCoreRowModel, getSortedRowModel, getFacetedRowModel, getFacetedUniqueValues, getFacetedMinMaxValues, getFilteredRowModel, getPaginationRowModel, useReactTable } from '@tanstack/react-table';
4
- import { useEds, Table, Pagination } from '@equinor/eds-core-react';
3
+ import { useVirtualizer } from '@tanstack/react-virtual';
5
4
  import { useState, useEffect, useMemo, useRef, useCallback } from 'react';
6
5
  import { TableHeaderRow } from './components/TableHeaderRow.js';
7
6
  import { TableRow } from './components/TableRow.js';
8
7
  import { TableProvider } from './EdsDataGridContext.js';
9
- import { useVirtualizer } from '@tanstack/react-virtual';
10
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
+ import styled from 'styled-components';
9
+ import { addPxSuffixIfInputHasNoPrefix } from './utils.js';
10
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
11
 
12
- function EdsDataGrid(_ref) {
13
- var rows = _ref.rows,
14
- columns = _ref.columns,
15
- columnResizeMode = _ref.columnResizeMode,
16
- pageSize = _ref.pageSize,
17
- rowSelection = _ref.rowSelection,
18
- selectedRows = _ref.selectedRows,
19
- enableColumnFiltering = _ref.enableColumnFiltering,
20
- debug = _ref.debug,
21
- enablePagination = _ref.enablePagination,
22
- enableSorting = _ref.enableSorting,
23
- stickyHeader = _ref.stickyHeader,
24
- onSelectRow = _ref.onSelectRow,
25
- caption = _ref.caption,
26
- enableVirtual = _ref.enableVirtual,
27
- virtualHeight = _ref.virtualHeight,
28
- columnVisibility = _ref.columnVisibility,
29
- columnVisibilityChange = _ref.columnVisibilityChange,
30
- emptyMessage = _ref.emptyMessage,
31
- columnOrder = _ref.columnOrder,
32
- cellClass = _ref.cellClass,
33
- cellStyle = _ref.cellStyle,
34
- rowClass = _ref.rowClass,
35
- rowStyle = _ref.rowStyle,
36
- headerClass = _ref.headerClass,
37
- headerStyle = _ref.headerStyle,
38
- externalPaginator = _ref.externalPaginator,
39
- _onSortingChange = _ref.onSortingChange,
40
- manualSorting = _ref.manualSorting,
41
- sortingState = _ref.sortingState,
42
- columnPinState = _ref.columnPinState,
43
- scrollbarHorizontal = _ref.scrollbarHorizontal,
44
- width = _ref.width,
45
- height = _ref.height;
46
- var _useState = useState(sortingState !== null && sortingState !== void 0 ? sortingState : []),
47
- _useState2 = _slicedToArray(_useState, 2),
48
- sorting = _useState2[0],
49
- setSorting = _useState2[1];
50
- var _useState3 = useState(selectedRows !== null && selectedRows !== void 0 ? selectedRows : {}),
51
- _useState4 = _slicedToArray(_useState3, 2),
52
- selection = _useState4[0],
53
- setSelection = _useState4[1];
54
- var _useState5 = useState(columnPinState !== null && columnPinState !== void 0 ? columnPinState : {}),
55
- _useState6 = _slicedToArray(_useState5, 2),
56
- columnPin = _useState6[0],
57
- setColumnPin = _useState6[1];
58
- var _useState7 = useState([]),
59
- _useState8 = _slicedToArray(_useState7, 2),
60
- columnFilters = _useState8[0],
61
- setColumnFilters = _useState8[1];
62
- var _useState9 = useState(columnVisibility !== null && columnVisibility !== void 0 ? columnVisibility : {}),
63
- _useState10 = _slicedToArray(_useState9, 2),
64
- visible = _useState10[0],
65
- setVisible = _useState10[1];
66
- var _useState11 = useState(''),
67
- _useState12 = _slicedToArray(_useState11, 2),
68
- globalFilter = _useState12[0],
69
- setGlobalFilter = _useState12[1];
70
- var _useState13 = useState([]),
71
- _useState14 = _slicedToArray(_useState13, 2),
72
- columnOrderState = _useState14[0],
73
- setColumnOrderState = _useState14[1];
74
- var _useState15 = useState({
75
- pageIndex: 0,
76
- pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : 25
77
- }),
78
- _useState16 = _slicedToArray(_useState15, 2),
79
- page = _useState16[0],
80
- setPage = _useState16[1];
81
- useEffect(function () {
82
- setVisible(columnVisibility !== null && columnVisibility !== void 0 ? columnVisibility : {});
12
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
13
+ function EdsDataGrid({
14
+ rows,
15
+ columns,
16
+ columnResizeMode,
17
+ pageSize,
18
+ rowSelection,
19
+ selectedRows,
20
+ enableColumnFiltering,
21
+ debug,
22
+ enablePagination,
23
+ enableSorting,
24
+ stickyHeader,
25
+ onSelectRow,
26
+ caption,
27
+ enableVirtual,
28
+ virtualHeight,
29
+ columnVisibility,
30
+ columnVisibilityChange,
31
+ emptyMessage,
32
+ columnOrder,
33
+ cellClass,
34
+ cellStyle,
35
+ rowClass,
36
+ rowStyle,
37
+ headerClass,
38
+ headerStyle,
39
+ externalPaginator,
40
+ onSortingChange,
41
+ manualSorting,
42
+ sortingState,
43
+ columnPinState,
44
+ scrollbarHorizontal,
45
+ width,
46
+ minWidth,
47
+ height,
48
+ getRowId,
49
+ rowVirtualizerInstanceRef,
50
+ columnSizing,
51
+ onColumnResize
52
+ }) {
53
+ const [sorting, setSorting] = useState(sortingState ?? []);
54
+ const [selection, setSelection] = useState(selectedRows ?? {});
55
+ const [columnPin, setColumnPin] = useState(columnPinState ?? {});
56
+ const [columnFilters, setColumnFilters] = useState([]);
57
+ const [internalColumnSize, setInternalColumnSize] = useState(columnSizing ?? {});
58
+ const [visible, setVisible] = useState(columnVisibility ?? {});
59
+ const [globalFilter, setGlobalFilter] = useState('');
60
+ const [columnOrderState, setColumnOrderState] = useState([]);
61
+ const [page, setPage] = useState({
62
+ pageIndex: 0,
63
+ pageSize: pageSize ?? 25
64
+ });
65
+ useEffect(() => {
66
+ setVisible(columnVisibility ?? {});
83
67
  }, [columnVisibility, setVisible]);
84
- useEffect(function () {
85
- setColumnPin(function (s) {
86
- return columnPinState !== null && columnPinState !== void 0 ? columnPinState : s;
87
- });
68
+ useEffect(() => {
69
+ setColumnPin(s => columnPinState ?? s);
88
70
  }, [columnPinState]);
89
- useEffect(function () {
71
+ useEffect(() => {
90
72
  setSorting(sortingState);
91
73
  }, [sortingState]);
92
- useEffect(function () {
93
- setSelection(selectedRows !== null && selectedRows !== void 0 ? selectedRows : {});
74
+ useEffect(() => {
75
+ setSelection(selectedRows ?? {});
94
76
  }, [selectedRows]);
95
77
 
96
78
  /**
97
79
  * By default, the filter-function accepts single-value filters. This adds multi-filter functionality out of the box.
98
80
  */
99
- var _columns = useMemo(function () {
100
- return columns.map(function (column) {
81
+ const _columns = useMemo(() => {
82
+ return columns.map(column => {
101
83
  if (column.filterFn || column.enableColumnFilter === false) {
102
84
  return column;
103
85
  }
104
86
  /* istanbul ignore next */
105
- return _objectSpread(_objectSpread({}, column), {}, {
106
- filterFn: function filterFn(row, columnId, filterValue) {
107
- var _row$getValue;
87
+ return {
88
+ ...column,
89
+ filterFn: (row, columnId, filterValue) => {
108
90
  if (debug) {
109
91
  console.log('filterFn', row, columnId, filterValue);
110
92
  }
111
93
  if (!filterValue || (Array.isArray(filterValue) || typeof filterValue === 'string') && filterValue.length === 0) {
112
94
  return true;
113
95
  }
114
- var value = (_row$getValue = row.getValue(columnId)) !== null && _row$getValue !== void 0 ? _row$getValue : 'NULL_OR_UNDEFINED';
96
+ const value = row.getValue(columnId) ?? 'NULL_OR_UNDEFINED';
115
97
  if (Array.isArray(filterValue)) {
116
- var numeric = filterValue.some(function (v) {
117
- return typeof v === 'number';
118
- });
98
+ const numeric = filterValue.some(v => typeof v === 'number');
119
99
  if (numeric) {
120
- var _ref2 = filterValue,
121
- _ref3 = _slicedToArray(_ref2, 2),
122
- start = _ref3[0],
123
- end = _ref3[1];
100
+ const [start, end] = filterValue;
124
101
  return Number(value) >= (isNaN(start) ? 0 : start) && Number(value) <= (!end || isNaN(end) ? Infinity : end);
125
102
  } else {
126
- var validFilterValue = filterValue.filter(function (v) {
127
- return !!v;
128
- });
103
+ const validFilterValue = filterValue.filter(v => !!v);
129
104
  if (validFilterValue.length === 0) return true;
130
105
  return filterValue.includes(value);
131
106
  }
132
107
  }
133
108
  return value === filterValue;
134
109
  }
135
- });
110
+ };
136
111
  });
137
112
  }, [debug, columns]);
138
113
 
139
114
  /**
140
115
  * Set up default table options
141
116
  */
142
- var options = {
117
+ const options = {
143
118
  data: rows,
144
119
  columns: _columns,
120
+ defaultColumn: {
121
+ size: 150,
122
+ cell: context => {
123
+ return /*#__PURE__*/jsx(Typography, {
124
+ style: {
125
+ overflow: 'hidden',
126
+ whiteSpace: 'nowrap',
127
+ textOverflow: 'ellipsis'
128
+ },
129
+ group: "table",
130
+ variant: "cell_text",
131
+ children: String(context.getValue() ?? '')
132
+ });
133
+ }
134
+ },
145
135
  columnResizeMode: columnResizeMode,
136
+ onColumnSizingChange: change => {
137
+ if (typeof change === 'function') {
138
+ setInternalColumnSize(change(internalColumnSize));
139
+ } else {
140
+ setInternalColumnSize(change);
141
+ }
142
+ if (onColumnResize) {
143
+ onColumnResize(internalColumnSize);
144
+ }
145
+ },
146
146
  state: {
147
- sorting: sorting,
147
+ sorting,
148
148
  columnPinning: columnPin,
149
149
  rowSelection: selection,
150
- columnOrder: columnOrderState
150
+ columnOrder: columnOrderState,
151
+ columnSizing: columnSizing ?? internalColumnSize
151
152
  },
152
- onSortingChange: function onSortingChange(changes) {
153
- if (_onSortingChange) {
154
- _onSortingChange(changes);
153
+ onSortingChange: changes => {
154
+ if (onSortingChange) {
155
+ onSortingChange(changes);
155
156
  }
156
157
  setSorting(changes);
157
158
  },
158
159
  enableColumnFilters: !!enableColumnFiltering,
159
160
  enableFilters: !!enableColumnFiltering,
160
- enableSorting: enableSorting !== null && enableSorting !== void 0 ? enableSorting : false,
161
- manualSorting: manualSorting !== null && manualSorting !== void 0 ? manualSorting : false,
161
+ enableSorting: enableSorting ?? false,
162
+ manualSorting: manualSorting ?? false,
162
163
  enableColumnResizing: !!columnResizeMode,
163
164
  getCoreRowModel: getCoreRowModel(),
164
165
  getSortedRowModel: getSortedRowModel(),
165
166
  debugTable: debug,
166
167
  debugHeaders: debug,
167
168
  debugColumns: debug,
168
- enableRowSelection: rowSelection !== null && rowSelection !== void 0 ? rowSelection : false,
169
+ enableRowSelection: rowSelection ?? false,
169
170
  enableColumnPinning: true,
170
- enablePinning: true
171
+ enablePinning: true,
172
+ getRowId
171
173
  };
172
- useEffect(function () {
174
+ useEffect(() => {
173
175
  if (columnOrder && columnOrder.length > 0) {
174
- setColumnOrderState(columnOrder !== null && columnOrder !== void 0 ? columnOrder : []);
176
+ setColumnOrderState(columnOrder ?? []);
175
177
  }
176
178
  }, [columnOrder]);
177
179
 
178
180
  /**
179
181
  * Set up handlers for rowSelection
180
182
  */
181
- if (rowSelection !== null && rowSelection !== void 0 ? rowSelection : false) {
182
- options.onRowSelectionChange = function (updaterOrValue) {
183
+ if (rowSelection ?? false) {
184
+ options.onRowSelectionChange = updaterOrValue => {
183
185
  if (onSelectRow) {
184
186
  onSelectRow(updaterOrValue);
185
187
  }
@@ -204,7 +206,7 @@ function EdsDataGrid(_ref) {
204
206
  /**
205
207
  * Set up config for pagination
206
208
  */
207
- if (enablePagination !== null && enablePagination !== void 0 ? enablePagination : false) {
209
+ if (enablePagination ?? false) {
208
210
  options.state.pagination = page;
209
211
  options.getPaginationRowModel = getPaginationRowModel();
210
212
  }
@@ -214,8 +216,8 @@ function EdsDataGrid(_ref) {
214
216
  */
215
217
  if (columnVisibility) {
216
218
  options.state.columnVisibility = visible;
217
- options.onColumnVisibilityChange = function (vis) {
218
- var updated;
219
+ options.onColumnVisibilityChange = vis => {
220
+ let updated;
219
221
  if (typeof vis === 'function') {
220
222
  updated = vis(visible);
221
223
  } else {
@@ -225,51 +227,49 @@ function EdsDataGrid(_ref) {
225
227
  setVisible(updated);
226
228
  };
227
229
  }
228
- useEffect(function () {
229
- setPage(function (prev) {
230
- return _objectSpread(_objectSpread({}, prev), {}, {
231
- pageSize: pageSize !== null && pageSize !== void 0 ? pageSize : 25
232
- });
233
- });
230
+ useEffect(() => {
231
+ setPage(prev => ({
232
+ ...prev,
233
+ pageSize: pageSize ?? 25
234
+ }));
234
235
  }, [pageSize]);
235
- var table = useReactTable(options);
236
- var parentRefStyle = {};
236
+ const table = useReactTable(options);
237
+ let tableWrapperStyle = {};
237
238
 
238
239
  /**
239
240
  * Style the parent container to enable virtualization.
240
241
  * By not setting this, the virtual-scroll will always render every row, reducing computational overhead if turned off.
241
242
  */
242
243
  if (enableVirtual) {
243
- var _ref4;
244
- parentRefStyle = {
245
- height: (_ref4 = height !== null && height !== void 0 ? height : virtualHeight) !== null && _ref4 !== void 0 ? _ref4 : 500,
244
+ tableWrapperStyle = {
245
+ height: height ?? virtualHeight ?? 500,
246
246
  overflow: 'auto',
247
247
  position: 'relative'
248
248
  };
249
249
  }
250
- var parentRef = useRef(null);
250
+ const parentRef = useRef(null);
251
251
 
252
252
  /**
253
253
  * Virtualization setup
254
254
  */
255
- var _useEds = useEds(),
256
- density = _useEds.density;
257
- var estimateSize = useCallback(function () {
255
+ const {
256
+ density
257
+ } = useEds();
258
+ const estimateSize = useCallback(() => {
258
259
  return density === 'compact' ? 32 : 48;
259
260
  }, [density]);
260
- var virtualizer = useVirtualizer({
261
+ const virtualizer = useVirtualizer({
261
262
  count: table.getRowModel().rows.length,
262
- getScrollElement: function getScrollElement() {
263
- return parentRef.current;
264
- },
265
- estimateSize: estimateSize
263
+ getScrollElement: () => parentRef.current,
264
+ estimateSize
266
265
  });
267
- var virtualRows = virtualizer.getVirtualItems();
268
- var paddingTop = virtualRows.length ? virtualRows[0].start : 0;
269
- var paddingBottom = virtualRows.length ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
266
+ if (rowVirtualizerInstanceRef) rowVirtualizerInstanceRef.current = virtualizer;
267
+ const virtualRows = virtualizer.getVirtualItems();
268
+ const paddingTop = virtualRows.length ? virtualRows[0].start : 0;
269
+ const paddingBottom = virtualRows.length ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
270
270
 
271
271
  // These classes are primarily used to allow for feature-detection in the test-suite
272
- var classList = {
272
+ const classList = {
273
273
  'sticky-header': !!stickyHeader,
274
274
  virtual: !!enableVirtual,
275
275
  paging: !!enablePagination
@@ -285,90 +285,81 @@ function EdsDataGrid(_ref) {
285
285
  enableSorting: !!enableSorting,
286
286
  enableColumnFiltering: !!enableColumnFiltering,
287
287
  stickyHeader: !!stickyHeader,
288
- children: [/*#__PURE__*/jsxs("div", {
288
+ children: [/*#__PURE__*/jsxs(TableWrapper, {
289
289
  className: "table-wrapper",
290
- style: _objectSpread(_objectSpread({
291
- height: height !== null && height !== void 0 ? height : 'auto'
292
- }, parentRefStyle), {}, {
293
- width: scrollbarHorizontal ? width : 'auto',
294
- tableLayout: scrollbarHorizontal ? 'fixed' : 'auto',
295
- overflow: 'auto'
296
- }),
290
+ style: tableWrapperStyle,
297
291
  ref: parentRef,
292
+ $height: height,
293
+ $width: width,
294
+ $scrollbarHorizontal: scrollbarHorizontal,
298
295
  children: [/*#__PURE__*/jsxs(Table, {
299
- className: Object.entries(classList).filter(function (_ref5) {
300
- var _ref6 = _slicedToArray(_ref5, 2),
301
- k = _ref6[1];
302
- return k;
303
- }).map(function (_ref7) {
304
- var _ref8 = _slicedToArray(_ref7, 1),
305
- k = _ref8[0];
306
- return k;
307
- }).join(' '),
296
+ className: Object.entries(classList).filter(([, k]) => k).map(([k]) => k).join(' '),
308
297
  style: {
309
- width: table.getTotalSize()
298
+ tableLayout: scrollbarHorizontal ? 'fixed' : 'auto',
299
+ width: table.getTotalSize(),
300
+ minWidth: scrollbarHorizontal ? minWidth : 'auto'
310
301
  },
311
302
  children: [caption && /*#__PURE__*/jsx(Table.Caption, {
312
303
  children: caption
313
304
  }), /*#__PURE__*/jsx(Table.Head, {
314
305
  sticky: stickyHeader,
315
- children: table.getHeaderGroups().map(function (headerGroup) {
316
- return /*#__PURE__*/jsx(TableHeaderRow, {
317
- table: table,
318
- headerGroup: headerGroup,
319
- columnResizeMode: columnResizeMode,
320
- deltaOffset: table.getState().columnSizingInfo.deltaOffset
321
- }, headerGroup.id);
322
- })
306
+ children: table.getHeaderGroups().map(headerGroup => /*#__PURE__*/jsx(TableHeaderRow, {
307
+ table: table,
308
+ headerGroup: headerGroup,
309
+ columnResizeMode: columnResizeMode,
310
+ deltaOffset: table.getState().columnSizingInfo.deltaOffset
311
+ }, headerGroup.id))
323
312
  }), /*#__PURE__*/jsxs(Table.Body, {
313
+ style: {
314
+ backgroundColor: 'inherit'
315
+ },
324
316
  children: [table.getRowModel().rows.length === 0 && emptyMessage && /*#__PURE__*/jsx(Table.Row, {
325
317
  children: /*#__PURE__*/jsx(Table.Cell, {
326
- colSpan: table.getHeaderGroups().length,
318
+ colSpan: table.getFlatHeaders().length,
327
319
  children: emptyMessage
328
320
  })
329
321
  }), enableVirtual && /*#__PURE__*/jsxs(Fragment, {
330
- children: [/*#__PURE__*/jsx(Table.Row, {
322
+ children: [paddingTop > 0 && /*#__PURE__*/jsx(Table.Row, {
331
323
  "data-testid": "virtual-padding-top",
332
324
  className: 'virtual-padding-top',
325
+ style: {
326
+ pointerEvents: 'none'
327
+ },
333
328
  children: /*#__PURE__*/jsx(Table.Cell, {
334
329
  style: {
335
- height: "".concat(paddingTop, "px")
330
+ height: `${paddingTop}px`
336
331
  }
337
332
  })
338
- }), virtualRows.map(function (row) {
339
- return /*#__PURE__*/jsx(TableRow, {
340
- row: table.getRowModel().rows[row.index]
341
- }, row.index);
342
- }), /*#__PURE__*/jsx(Table.Row, {
333
+ }), virtualRows.map(row => /*#__PURE__*/jsx(TableRow, {
334
+ row: table.getRowModel().rows[row.index]
335
+ }, row.index)), paddingBottom > 0 && /*#__PURE__*/jsx(Table.Row, {
343
336
  "data-testid": "virtual-padding-bottom",
344
337
  className: 'virtual-padding-bottom',
338
+ style: {
339
+ pointerEvents: 'none'
340
+ },
345
341
  children: /*#__PURE__*/jsx(Table.Cell, {
346
342
  style: {
347
- height: "".concat(paddingBottom, "px")
343
+ height: `${paddingBottom}px`
348
344
  }
349
345
  })
350
346
  })]
351
- }), !enableVirtual && table.getRowModel().rows.map(function (row) {
352
- return /*#__PURE__*/jsx(TableRow, {
353
- row: row
354
- }, row.id);
355
- })]
347
+ }), !enableVirtual && table.getRowModel().rows.map(row => /*#__PURE__*/jsx(TableRow, {
348
+ row: row
349
+ }, row.id))]
356
350
  })]
357
351
  }), externalPaginator ? externalPaginator : enablePagination && /*#__PURE__*/jsx("div", {
358
352
  style: {
359
- maxWidth: "".concat(table.getTotalSize(), "px")
353
+ maxWidth: `${table.getTotalSize()}px`
360
354
  },
361
355
  children: /*#__PURE__*/jsx(Pagination, {
362
356
  totalItems: table.getFilteredRowModel().rows.length,
363
357
  withItemIndicator: true,
364
358
  itemsPerPage: page.pageSize,
365
- onChange: function onChange(e, p) {
366
- return setPage(function (s) {
367
- return _objectSpread(_objectSpread({}, s), {}, {
368
- pageIndex: p - 1
369
- });
370
- });
371
- },
359
+ onChange: (e, p) => setPage(s => ({
360
+ ...s,
361
+ pageIndex: p - 1
362
+ })),
372
363
  defaultPage: 1
373
364
  })
374
365
  })]
@@ -377,5 +368,17 @@ function EdsDataGrid(_ref) {
377
368
  })]
378
369
  });
379
370
  }
371
+ const TableWrapper = styled.div.withConfig({
372
+ displayName: "EdsDataGrid__TableWrapper",
373
+ componentId: "sc-82fj3f-0"
374
+ })(["height:", ";width:", ";overflow:auto;contain:", ";"], ({
375
+ $height
376
+ }) => addPxSuffixIfInputHasNoPrefix($height) ?? 'auto', ({
377
+ $scrollbarHorizontal,
378
+ $width
379
+ }) => $scrollbarHorizontal ? addPxSuffixIfInputHasNoPrefix($width) ?? '100%' : 'auto', ({
380
+ $height,
381
+ $width
382
+ }) => Boolean($height) && Boolean($width) ? 'strict' : 'unset');
380
383
 
381
384
  export { EdsDataGrid };
@@ -1,25 +1,22 @@
1
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
1
  import { createContext, useContext } from 'react';
3
2
  import { jsx } from 'react/jsx-runtime';
4
3
 
5
- var _excluded = ["children"];
6
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- var EdsDataGridContext = /*#__PURE__*/createContext({
5
+ const EdsDataGridContext = /*#__PURE__*/createContext({
8
6
  enableSorting: false,
9
7
  stickyHeader: false,
10
8
  enableColumnFiltering: false,
11
9
  table: null
12
10
  });
13
- function TableProvider(_ref) {
14
- var children = _ref.children,
15
- props = _objectWithoutProperties(_ref, _excluded);
11
+ function TableProvider({
12
+ children,
13
+ ...props
14
+ }) {
16
15
  return /*#__PURE__*/jsx(EdsDataGridContext.Provider, {
17
16
  value: props,
18
17
  children: children
19
18
  });
20
19
  }
21
- var useTableContext = function useTableContext() {
22
- return useContext(EdsDataGridContext);
23
- };
20
+ const useTableContext = () => useContext(EdsDataGridContext);
24
21
 
25
22
  export { EdsDataGridContext, TableProvider, useTableContext };