material-react-table 2.9.0 → 2.9.1
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.
- package/dist/index.esm.js +14 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useMRT_TableInstance.ts +1 -42
- package/src/hooks/useMRT_TableOptions.ts +33 -0
- package/src/utils/row.utils.ts +4 -1
- package/src/utils.ts +0 -0
package/package.json
CHANGED
@@ -1,16 +1,5 @@
|
|
1
1
|
import { useMemo, useRef, useState } from 'react';
|
2
|
-
import {
|
3
|
-
getCoreRowModel,
|
4
|
-
getExpandedRowModel,
|
5
|
-
getFacetedMinMaxValues,
|
6
|
-
getFacetedRowModel,
|
7
|
-
getFacetedUniqueValues,
|
8
|
-
getFilteredRowModel,
|
9
|
-
getGroupedRowModel,
|
10
|
-
getPaginationRowModel,
|
11
|
-
getSortedRowModel,
|
12
|
-
useReactTable,
|
13
|
-
} from '@tanstack/react-table';
|
2
|
+
import { useReactTable } from '@tanstack/react-table';
|
14
3
|
import {
|
15
4
|
type MRT_Cell,
|
16
5
|
type MRT_Column,
|
@@ -207,36 +196,6 @@ export const useMRT_TableInstance = <TData extends MRT_RowData>(
|
|
207
196
|
|
208
197
|
//@ts-ignore
|
209
198
|
const table = useReactTable({
|
210
|
-
getCoreRowModel: getCoreRowModel(),
|
211
|
-
getExpandedRowModel:
|
212
|
-
tableOptions.enableExpanding || tableOptions.enableGrouping
|
213
|
-
? getExpandedRowModel()
|
214
|
-
: undefined,
|
215
|
-
getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
216
|
-
? getFacetedMinMaxValues()
|
217
|
-
: undefined,
|
218
|
-
getFacetedRowModel: tableOptions.enableFacetedValues
|
219
|
-
? getFacetedRowModel()
|
220
|
-
: undefined,
|
221
|
-
getFacetedUniqueValues: tableOptions.enableFacetedValues
|
222
|
-
? getFacetedUniqueValues()
|
223
|
-
: undefined,
|
224
|
-
getFilteredRowModel:
|
225
|
-
tableOptions.enableColumnFilters ||
|
226
|
-
tableOptions.enableGlobalFilter ||
|
227
|
-
tableOptions.enableFilters
|
228
|
-
? getFilteredRowModel()
|
229
|
-
: undefined,
|
230
|
-
getGroupedRowModel: tableOptions.enableGrouping
|
231
|
-
? getGroupedRowModel()
|
232
|
-
: undefined,
|
233
|
-
getPaginationRowModel: tableOptions.enablePagination
|
234
|
-
? getPaginationRowModel()
|
235
|
-
: undefined,
|
236
|
-
getSortedRowModel: tableOptions.enableSorting
|
237
|
-
? getSortedRowModel()
|
238
|
-
: undefined,
|
239
|
-
getSubRows: (row) => row?.subRows,
|
240
199
|
onColumnOrderChange,
|
241
200
|
onColumnSizingInfoChange,
|
242
201
|
onGroupingChange,
|
@@ -1,4 +1,15 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
|
+
import {
|
3
|
+
getCoreRowModel,
|
4
|
+
getExpandedRowModel,
|
5
|
+
getFacetedMinMaxValues,
|
6
|
+
getFacetedRowModel,
|
7
|
+
getFacetedUniqueValues,
|
8
|
+
getFilteredRowModel,
|
9
|
+
getGroupedRowModel,
|
10
|
+
getPaginationRowModel,
|
11
|
+
getSortedRowModel,
|
12
|
+
} from '@tanstack/react-table';
|
2
13
|
import { useTheme } from '@mui/material/styles';
|
3
14
|
import { MRT_AggregationFns } from '../fns/aggregationFns';
|
4
15
|
import { MRT_FilterFns } from '../fns/filterFns';
|
@@ -55,6 +66,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
55
66
|
enableDensityToggle = true,
|
56
67
|
enableExpandAll = true,
|
57
68
|
enableExpanding,
|
69
|
+
enableFacetedValues = false,
|
58
70
|
enableFilterMatchHighlighting = true,
|
59
71
|
enableFilters = true,
|
60
72
|
enableFullScreenToggle = true,
|
@@ -178,6 +190,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
178
190
|
enableDensityToggle,
|
179
191
|
enableExpandAll,
|
180
192
|
enableExpanding,
|
193
|
+
enableFacetedValues,
|
181
194
|
enableFilterMatchHighlighting,
|
182
195
|
enableFilters,
|
183
196
|
enableFullScreenToggle,
|
@@ -199,6 +212,26 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
199
212
|
enableToolbarInternalActions,
|
200
213
|
enableTopToolbar,
|
201
214
|
filterFns,
|
215
|
+
getCoreRowModel: getCoreRowModel(),
|
216
|
+
getExpandedRowModel:
|
217
|
+
enableExpanding || enableGrouping ? getExpandedRowModel() : undefined,
|
218
|
+
getFacetedMinMaxValues: enableFacetedValues
|
219
|
+
? getFacetedMinMaxValues()
|
220
|
+
: undefined,
|
221
|
+
getFacetedRowModel: enableFacetedValues ? getFacetedRowModel() : undefined,
|
222
|
+
getFacetedUniqueValues: enableFacetedValues
|
223
|
+
? getFacetedUniqueValues()
|
224
|
+
: undefined,
|
225
|
+
getFilteredRowModel:
|
226
|
+
enableColumnFilters || enableGlobalFilter || enableFilters
|
227
|
+
? getFilteredRowModel()
|
228
|
+
: undefined,
|
229
|
+
getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined,
|
230
|
+
getPaginationRowModel: enablePagination
|
231
|
+
? getPaginationRowModel()
|
232
|
+
: undefined,
|
233
|
+
getSortedRowModel: enableSorting ? getSortedRowModel() : undefined,
|
234
|
+
getSubRows: (row) => row?.subRows,
|
202
235
|
icons,
|
203
236
|
layoutMode,
|
204
237
|
localization,
|
package/src/utils/row.utils.ts
CHANGED
@@ -12,7 +12,10 @@ export const getIsRowSelected = <TData extends MRT_RowData>({
|
|
12
12
|
row: MRT_Row<TData>;
|
13
13
|
table: MRT_TableInstance<TData>;
|
14
14
|
}) => {
|
15
|
-
const {
|
15
|
+
const {
|
16
|
+
options: { enableRowSelection },
|
17
|
+
} = table;
|
18
|
+
|
16
19
|
return (
|
17
20
|
row.getIsSelected() ||
|
18
21
|
(parseFromValuesOrFunc(enableRowSelection, row) &&
|
package/src/utils.ts
DELETED
File without changes
|