material-react-table 1.1.0-beta.0 → 1.1.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.
- package/dist/cjs/MaterialReactTable.d.ts +3 -3
- package/dist/cjs/_locales/ja.d.ts +2 -0
- package/dist/cjs/body/MRT_TableBodyCell.d.ts +1 -0
- package/dist/cjs/body/MRT_TableBodyRow.d.ts +1 -0
- package/dist/cjs/index.js +422 -427
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/table/MRT_TableRoot.d.ts +3 -3
- package/dist/esm/MaterialReactTable.d.ts +3 -3
- package/dist/esm/_locales/ja.d.ts +2 -0
- package/dist/esm/body/MRT_TableBodyCell.d.ts +1 -0
- package/dist/esm/body/MRT_TableBodyRow.d.ts +1 -0
- package/dist/esm/material-react-table.esm.js +422 -427
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/table/MRT_TableRoot.d.ts +3 -3
- package/dist/index.d.ts +35 -35
- package/locales/ja.d.ts +2 -0
- package/locales/ja.esm.d.ts +2 -0
- package/locales/ja.esm.js +92 -0
- package/locales/ja.esm.js.map +1 -0
- package/locales/ja.js +96 -0
- package/locales/ja.js.map +1 -0
- package/package.json +13 -13
- package/src/MaterialReactTable.tsx +6 -6
- package/src/_locales/ja.ts +92 -1
- package/src/body/MRT_TableBody.tsx +6 -2
- package/src/body/MRT_TableBodyCell.tsx +37 -36
- package/src/body/MRT_TableBodyRow.tsx +15 -9
- package/src/head/MRT_TableHeadCell.tsx +19 -16
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState, useCallback, useEffect, Fragment, memo, useLayoutEffect } from 'react';
|
|
2
2
|
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
3
|
-
import {
|
|
3
|
+
import { alpha, lighten, Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Radio, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade, useMediaQuery, Toolbar, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog, DialogTitle, DialogContent, Stack, DialogActions } from '@mui/material';
|
|
4
4
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
5
|
-
import {
|
|
5
|
+
import { ArrowRight, Cancel, CheckBox, ClearAll, Close, DensityLarge, DensityMedium, DensitySmall, DragHandle, DynamicFeed, Edit, ExpandLess, ExpandMore, FilterAlt, FilterAltOff, FilterList, FilterListOff, FullscreenExit, Fullscreen, KeyboardDoubleArrowDown, MoreHoriz, MoreVert, PushPin, RestartAlt, Save, Search, SearchOff, Sort, ViewColumn, VisibilityOff } from '@mui/icons-material';
|
|
6
6
|
import { useVirtual } from 'react-virtual';
|
|
7
7
|
|
|
8
8
|
/******************************************************************************
|
|
@@ -34,37 +34,161 @@ function __rest(s, e) {
|
|
|
34
34
|
|
|
35
35
|
const MRT_AggregationFns = Object.assign({}, aggregationFns);
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
|
|
38
|
+
const getAllLeafColumnDefs = (columns) => {
|
|
39
|
+
const allLeafColumnDefs = [];
|
|
40
|
+
const getLeafColumns = (cols) => {
|
|
41
|
+
cols.forEach((col) => {
|
|
42
|
+
if (col.columns) {
|
|
43
|
+
getLeafColumns(col.columns);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
allLeafColumnDefs.push(col);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
getLeafColumns(columns);
|
|
51
|
+
return allLeafColumnDefs;
|
|
52
|
+
};
|
|
53
|
+
const prepareColumns = ({ columnDefs, columnFilterFns, defaultDisplayColumn, filterFns, sortingFns, }) => columnDefs.map((columnDef) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
if (!columnDef.id)
|
|
56
|
+
columnDef.id = getColumnId(columnDef);
|
|
57
|
+
if (process.env.NODE_ENV !== 'production' && !columnDef.id) {
|
|
58
|
+
console.error('Column definitions must have a valid `accessorKey` or `id` property');
|
|
59
|
+
}
|
|
60
|
+
if (!columnDef.columnDefType)
|
|
61
|
+
columnDef.columnDefType = 'data';
|
|
62
|
+
if (!!((_a = columnDef.columns) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
63
|
+
columnDef.columnDefType = 'group';
|
|
64
|
+
columnDef.columns = prepareColumns({
|
|
65
|
+
columnDefs: columnDef.columns,
|
|
66
|
+
columnFilterFns,
|
|
67
|
+
defaultDisplayColumn,
|
|
68
|
+
filterFns,
|
|
69
|
+
sortingFns,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else if (columnDef.columnDefType === 'data') {
|
|
73
|
+
if (Object.keys(filterFns).includes(columnFilterFns[columnDef.id])) {
|
|
74
|
+
columnDef.filterFn =
|
|
75
|
+
(_b = filterFns[columnFilterFns[columnDef.id]]) !== null && _b !== void 0 ? _b : filterFns.fuzzy;
|
|
76
|
+
columnDef._filterFn =
|
|
77
|
+
columnFilterFns[columnDef.id];
|
|
78
|
+
}
|
|
79
|
+
if (Object.keys(sortingFns).includes(columnDef.sortingFn)) {
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
columnDef.sortingFn = sortingFns[columnDef.sortingFn];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (columnDef.columnDefType === 'display') {
|
|
85
|
+
columnDef = Object.assign(Object.assign({}, defaultDisplayColumn), columnDef);
|
|
86
|
+
}
|
|
87
|
+
return columnDef;
|
|
88
|
+
});
|
|
89
|
+
const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
|
|
90
|
+
if (draggedColumn.getCanPin()) {
|
|
91
|
+
draggedColumn.pin(targetColumn.getIsPinned());
|
|
92
|
+
}
|
|
93
|
+
columnOrder.splice(columnOrder.indexOf(targetColumn.id), 0, columnOrder.splice(columnOrder.indexOf(draggedColumn.id), 1)[0]);
|
|
94
|
+
return [...columnOrder];
|
|
95
|
+
};
|
|
96
|
+
const showExpandColumn = (props, grouping) => !!(props.enableExpanding ||
|
|
97
|
+
(props.enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
|
|
98
|
+
props.renderDetailPanel);
|
|
99
|
+
const getLeadingDisplayColumnIds = (props) => {
|
|
100
|
+
var _a;
|
|
101
|
+
return [
|
|
102
|
+
(props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
|
|
103
|
+
props.positionActionsColumn === 'first' &&
|
|
104
|
+
(props.enableRowActions ||
|
|
105
|
+
(props.enableEditing &&
|
|
106
|
+
['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
|
|
107
|
+
'mrt-row-actions',
|
|
108
|
+
props.positionExpandColumn === 'first' &&
|
|
109
|
+
showExpandColumn(props) &&
|
|
110
|
+
'mrt-row-expand',
|
|
111
|
+
props.enableRowSelection && 'mrt-row-select',
|
|
112
|
+
props.enableRowNumbers && 'mrt-row-numbers',
|
|
113
|
+
].filter(Boolean);
|
|
114
|
+
};
|
|
115
|
+
const getTrailingDisplayColumnIds = (props) => {
|
|
116
|
+
var _a;
|
|
117
|
+
return [
|
|
118
|
+
props.positionActionsColumn === 'last' &&
|
|
119
|
+
(props.enableRowActions ||
|
|
120
|
+
(props.enableEditing &&
|
|
121
|
+
['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
|
|
122
|
+
'mrt-row-actions',
|
|
123
|
+
props.positionExpandColumn === 'last' &&
|
|
124
|
+
showExpandColumn(props) &&
|
|
125
|
+
'mrt-row-expand',
|
|
126
|
+
];
|
|
127
|
+
};
|
|
128
|
+
const getDefaultColumnOrderIds = (props) => [
|
|
129
|
+
...getLeadingDisplayColumnIds(props),
|
|
130
|
+
...getAllLeafColumnDefs(props.columns).map((columnDef) => getColumnId(columnDef)),
|
|
131
|
+
...getTrailingDisplayColumnIds(props),
|
|
132
|
+
].filter(Boolean);
|
|
133
|
+
const getDefaultColumnFilterFn = (columnDef) => {
|
|
134
|
+
if (columnDef.filterVariant === 'multi-select')
|
|
135
|
+
return 'arrIncludesSome';
|
|
136
|
+
if (columnDef.filterVariant === 'range')
|
|
137
|
+
return 'betweenInclusive';
|
|
138
|
+
if (columnDef.filterVariant === 'select' ||
|
|
139
|
+
columnDef.filterVariant === 'checkbox')
|
|
140
|
+
return 'equals';
|
|
141
|
+
return 'fuzzy';
|
|
142
|
+
};
|
|
143
|
+
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
144
|
+
return (column.getIsPinned() === 'left' &&
|
|
145
|
+
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
146
|
+
};
|
|
147
|
+
const getIsFirstRightPinnedColumn = (column) => {
|
|
148
|
+
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
149
|
+
};
|
|
150
|
+
const getTotalRight = (table, column) => {
|
|
151
|
+
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
|
|
152
|
+
};
|
|
153
|
+
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
154
|
+
var _a, _b, _c, _d;
|
|
155
|
+
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
156
|
+
? alpha(lighten(theme.palette.background.default, 0.04), 0.97)
|
|
157
|
+
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
158
|
+
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
159
|
+
: getIsFirstRightPinnedColumn(column)
|
|
160
|
+
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
161
|
+
: undefined, left: column.getIsPinned() === 'left'
|
|
162
|
+
? `${column.getStart('left')}px`
|
|
163
|
+
: undefined, opacity: ((_a = table.getState().draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id ||
|
|
164
|
+
((_b = table.getState().hoveredColumn) === null || _b === void 0 ? void 0 : _b.id) === column.id
|
|
165
|
+
? 0.5
|
|
166
|
+
: 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
167
|
+
? 'sticky'
|
|
168
|
+
: undefined, right: column.getIsPinned() === 'right'
|
|
169
|
+
? `${getTotalRight(table, column)}px`
|
|
170
|
+
: undefined, transition: `all ${column.getIsResizing() ? 0 : '150ms'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
171
|
+
? tableCellProps.sx(theme)
|
|
172
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_c = column.columnDef.minSize) !== null && _c !== void 0 ? _c : 30}px)`, width: (_d = header === null || header === void 0 ? void 0 : header.getSize()) !== null && _d !== void 0 ? _d : column.getSize() }));
|
|
173
|
+
};
|
|
174
|
+
const MRT_DefaultColumn = {
|
|
175
|
+
minSize: 40,
|
|
176
|
+
maxSize: 1000,
|
|
177
|
+
size: 180,
|
|
178
|
+
};
|
|
179
|
+
const MRT_DefaultDisplayColumn = {
|
|
180
|
+
columnDefType: 'display',
|
|
181
|
+
enableClickToCopy: false,
|
|
182
|
+
enableColumnActions: false,
|
|
183
|
+
enableColumnDragging: false,
|
|
184
|
+
enableColumnFilter: false,
|
|
185
|
+
enableColumnOrdering: false,
|
|
186
|
+
enableEditing: false,
|
|
187
|
+
enableGlobalFilter: false,
|
|
188
|
+
enableGrouping: false,
|
|
189
|
+
enableHiding: false,
|
|
190
|
+
enableResizing: false,
|
|
191
|
+
enableSorting: false,
|
|
68
192
|
};
|
|
69
193
|
|
|
70
194
|
const fuzzy$1 = (row, columnId, filterValue, addMeta) => {
|
|
@@ -151,94 +275,37 @@ const MRT_FilterFns = Object.assign(Object.assign({}, filterFns), { between,
|
|
|
151
275
|
notEquals,
|
|
152
276
|
startsWith });
|
|
153
277
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
filterIncludesString: 'Contains',
|
|
186
|
-
filterIncludesStringSensitive: 'Contains',
|
|
187
|
-
filterLessThan: 'Less Than',
|
|
188
|
-
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
|
189
|
-
filterMode: 'Filter Mode: {filterType}',
|
|
190
|
-
filterNotEmpty: 'Not Empty',
|
|
191
|
-
filterNotEquals: 'Not Equals',
|
|
192
|
-
filterStartsWith: 'Starts With',
|
|
193
|
-
filterWeakEquals: 'Equals',
|
|
194
|
-
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
195
|
-
goToFirstPage: 'Go to first page',
|
|
196
|
-
goToLastPage: 'Go to last page',
|
|
197
|
-
goToNextPage: 'Go to next page',
|
|
198
|
-
goToPreviousPage: 'Go to previous page',
|
|
199
|
-
grab: 'Grab',
|
|
200
|
-
groupByColumn: 'Group by {column}',
|
|
201
|
-
groupedBy: 'Grouped by ',
|
|
202
|
-
hideAll: 'Hide all',
|
|
203
|
-
hideColumn: 'Hide {column} column',
|
|
204
|
-
max: 'Max',
|
|
205
|
-
min: 'Min',
|
|
206
|
-
move: 'Move',
|
|
207
|
-
noRecordsToDisplay: 'No records to display',
|
|
208
|
-
noResultsFound: 'No results found',
|
|
209
|
-
of: 'of',
|
|
210
|
-
or: 'or',
|
|
211
|
-
pinToLeft: 'Pin to left',
|
|
212
|
-
pinToRight: 'Pin to right',
|
|
213
|
-
resetColumnSize: 'Reset column size',
|
|
214
|
-
resetOrder: 'Reset order',
|
|
215
|
-
rowActions: 'Row Actions',
|
|
216
|
-
rowNumber: '#',
|
|
217
|
-
rowNumbers: 'Row Numbers',
|
|
218
|
-
rowsPerPage: 'Rows per page',
|
|
219
|
-
save: 'Save',
|
|
220
|
-
search: 'Search',
|
|
221
|
-
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
222
|
-
select: 'Select',
|
|
223
|
-
showAll: 'Show all',
|
|
224
|
-
showAllColumns: 'Show all columns',
|
|
225
|
-
showHideColumns: 'Show/Hide columns',
|
|
226
|
-
showHideFilters: 'Show/Hide filters',
|
|
227
|
-
showHideSearch: 'Show/Hide search',
|
|
228
|
-
sortByColumnAsc: 'Sort by {column} ascending',
|
|
229
|
-
sortByColumnDesc: 'Sort by {column} descending',
|
|
230
|
-
sortedByColumnAsc: 'Sorted by {column} ascending',
|
|
231
|
-
sortedByColumnDesc: 'Sorted by {column} descending',
|
|
232
|
-
thenBy: ', then by ',
|
|
233
|
-
toggleDensity: 'Toggle density',
|
|
234
|
-
toggleFullScreen: 'Toggle full screen',
|
|
235
|
-
toggleSelectAll: 'Toggle select all',
|
|
236
|
-
toggleSelectRow: 'Toggle select row',
|
|
237
|
-
toggleVisibility: 'Toggle visibility',
|
|
238
|
-
ungroupByColumn: 'Ungroup by {column}',
|
|
239
|
-
unpin: 'Unpin',
|
|
240
|
-
unpinAll: 'Unpin all',
|
|
241
|
-
unsorted: 'Unsorted',
|
|
278
|
+
const MRT_Default_Icons = {
|
|
279
|
+
ArrowRightIcon: ArrowRight,
|
|
280
|
+
CancelIcon: Cancel,
|
|
281
|
+
CheckBoxIcon: CheckBox,
|
|
282
|
+
ClearAllIcon: ClearAll,
|
|
283
|
+
CloseIcon: Close,
|
|
284
|
+
DensityLargeIcon: DensityLarge,
|
|
285
|
+
DensityMediumIcon: DensityMedium,
|
|
286
|
+
DensitySmallIcon: DensitySmall,
|
|
287
|
+
DragHandleIcon: DragHandle,
|
|
288
|
+
DynamicFeedIcon: DynamicFeed,
|
|
289
|
+
EditIcon: Edit,
|
|
290
|
+
ExpandLessIcon: ExpandLess,
|
|
291
|
+
ExpandMoreIcon: ExpandMore,
|
|
292
|
+
FilterAltIcon: FilterAlt,
|
|
293
|
+
FilterAltOffIcon: FilterAltOff,
|
|
294
|
+
FilterListIcon: FilterList,
|
|
295
|
+
FilterListOffIcon: FilterListOff,
|
|
296
|
+
FullscreenExitIcon: FullscreenExit,
|
|
297
|
+
FullscreenIcon: Fullscreen,
|
|
298
|
+
KeyboardDoubleArrowDownIcon: KeyboardDoubleArrowDown,
|
|
299
|
+
MoreHorizIcon: MoreHoriz,
|
|
300
|
+
MoreVertIcon: MoreVert,
|
|
301
|
+
PushPinIcon: PushPin,
|
|
302
|
+
RestartAltIcon: RestartAlt,
|
|
303
|
+
SaveIcon: Save,
|
|
304
|
+
SearchIcon: Search,
|
|
305
|
+
SearchOffIcon: SearchOff,
|
|
306
|
+
SortIcon: Sort,
|
|
307
|
+
ViewColumnIcon: ViewColumn,
|
|
308
|
+
VisibilityOffIcon: VisibilityOff,
|
|
242
309
|
};
|
|
243
310
|
|
|
244
311
|
const fuzzy = (rowA, rowB, columnId) => {
|
|
@@ -392,269 +459,112 @@ const mrtFilterOptions = (localization) => [
|
|
|
392
459
|
},
|
|
393
460
|
];
|
|
394
461
|
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
|
|
395
|
-
var _a, _b, _c, _d;
|
|
396
|
-
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
397
|
-
const { globalFilterFn, density } = getState();
|
|
398
|
-
const { column } = header !== null && header !== void 0 ? header : {};
|
|
399
|
-
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
|
400
|
-
const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
|
401
|
-
const internalFilterOptions = useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
|
|
402
|
-
? allowedColumnFilterOptions === undefined ||
|
|
403
|
-
(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
|
|
404
|
-
: (!globalFilterModeOptions ||
|
|
405
|
-
globalFilterModeOptions.includes(filterOption.option)) &&
|
|
406
|
-
['fuzzy', 'contains', 'startsWith'].includes(filterOption.option)), []);
|
|
407
|
-
const handleSelectFilterMode = (option) => {
|
|
408
|
-
if (header && column) {
|
|
409
|
-
setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
|
|
410
|
-
if (['empty', 'notEmpty'].includes(option)) {
|
|
411
|
-
column.setFilterValue(' ');
|
|
412
|
-
}
|
|
413
|
-
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
|
|
414
|
-
['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(option)) {
|
|
415
|
-
column.setFilterValue([]);
|
|
416
|
-
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
|
|
417
|
-
}
|
|
418
|
-
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
|
|
419
|
-
['between', 'betweenInclusive', 'inNumberRange'].includes(option)) {
|
|
420
|
-
column.setFilterValue(['', '']);
|
|
421
|
-
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
column.setFilterValue('');
|
|
425
|
-
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
setGlobalFilterFn(option);
|
|
430
|
-
}
|
|
431
|
-
setAnchorEl(null);
|
|
432
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
433
|
-
};
|
|
434
|
-
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
|
435
|
-
return (React.createElement(Menu, { anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
|
|
436
|
-
dense: density === 'compact',
|
|
437
|
-
} }, (_d = (header && column && columnDef
|
|
438
|
-
? (_c = (_b = columnDef.renderColumnFilterModeMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
|
439
|
-
column: column,
|
|
440
|
-
internalFilterOptions,
|
|
441
|
-
onSelectFilterMode: handleSelectFilterMode,
|
|
442
|
-
table,
|
|
443
|
-
})) !== null && _c !== void 0 ? _c : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
|
|
444
|
-
column: column,
|
|
445
|
-
internalFilterOptions,
|
|
446
|
-
onSelectFilterMode: handleSelectFilterMode,
|
|
447
|
-
table,
|
|
448
|
-
})
|
|
449
|
-
: renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
|
|
450
|
-
internalFilterOptions,
|
|
451
|
-
onSelectFilterMode: handleSelectFilterMode,
|
|
452
|
-
table,
|
|
453
|
-
}))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (React.createElement(MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
|
454
|
-
alignItems: 'center',
|
|
455
|
-
display: 'flex',
|
|
456
|
-
gap: '2ch',
|
|
457
|
-
my: 0,
|
|
458
|
-
py: '6px',
|
|
459
|
-
}, value: option },
|
|
460
|
-
React.createElement(Box, { sx: { fontSize: '1.25rem', width: '2ch' } }, symbol),
|
|
461
|
-
label)))));
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
|
465
|
-
const { options: { icons: { PushPinIcon }, localization, }, } = table;
|
|
466
|
-
const handlePinColumn = (pinDirection) => {
|
|
467
|
-
column.pin(pinDirection);
|
|
468
|
-
};
|
|
469
|
-
return (React.createElement(Box, { sx: { minWidth: '70px', textAlign: 'center' } }, column.getIsPinned() ? (React.createElement(Tooltip, { arrow: true, title: localization.unpin },
|
|
470
|
-
React.createElement(IconButton, { onClick: () => handlePinColumn(false), size: "small" },
|
|
471
|
-
React.createElement(PushPinIcon, null)))) : (React.createElement(React.Fragment, null,
|
|
472
|
-
React.createElement(Tooltip, { arrow: true, title: localization.pinToLeft },
|
|
473
|
-
React.createElement(IconButton, { onClick: () => handlePinColumn('left'), size: "small" },
|
|
474
|
-
React.createElement(PushPinIcon, { style: {
|
|
475
|
-
transform: 'rotate(90deg)',
|
|
476
|
-
} }))),
|
|
477
|
-
React.createElement(Tooltip, { arrow: true, title: localization.pinToRight },
|
|
478
|
-
React.createElement(IconButton, { onClick: () => handlePinColumn('right'), size: "small" },
|
|
479
|
-
React.createElement(PushPinIcon, { style: {
|
|
480
|
-
transform: 'rotate(-90deg)',
|
|
481
|
-
} })))))));
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
|
485
|
-
var _a;
|
|
486
|
-
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
487
|
-
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move },
|
|
488
|
-
React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
|
489
|
-
var _a;
|
|
490
|
-
e.stopPropagation();
|
|
491
|
-
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
|
492
|
-
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 150ms ease-in-out', '&:hover': {
|
|
493
|
-
backgroundColor: 'transparent',
|
|
494
|
-
opacity: 1,
|
|
495
|
-
}, '&:active': {
|
|
496
|
-
cursor: 'grabbing',
|
|
497
|
-
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
|
498
|
-
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
|
499
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
|
500
|
-
React.createElement(DragHandleIcon, null))));
|
|
501
|
-
};
|
|
502
|
-
|
|
503
|
-
const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
|
|
504
|
-
const getAllLeafColumnDefs = (columns) => {
|
|
505
|
-
const allLeafColumnDefs = [];
|
|
506
|
-
const getLeafColumns = (cols) => {
|
|
507
|
-
cols.forEach((col) => {
|
|
508
|
-
if (col.columns) {
|
|
509
|
-
getLeafColumns(col.columns);
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
allLeafColumnDefs.push(col);
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
getLeafColumns(columns);
|
|
517
|
-
return allLeafColumnDefs;
|
|
518
|
-
};
|
|
519
|
-
const prepareColumns = ({ columnDefs, columnFilterFns, defaultDisplayColumn, filterFns, sortingFns, }) => columnDefs.map((columnDef) => {
|
|
520
|
-
var _a, _b;
|
|
521
|
-
if (!columnDef.id)
|
|
522
|
-
columnDef.id = getColumnId(columnDef);
|
|
523
|
-
if (process.env.NODE_ENV !== 'production' && !columnDef.id) {
|
|
524
|
-
console.error('Column definitions must have a valid `accessorKey` or `id` property');
|
|
525
|
-
}
|
|
526
|
-
if (!columnDef.columnDefType)
|
|
527
|
-
columnDef.columnDefType = 'data';
|
|
528
|
-
if (!!((_a = columnDef.columns) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
529
|
-
columnDef.columnDefType = 'group';
|
|
530
|
-
columnDef.columns = prepareColumns({
|
|
531
|
-
columnDefs: columnDef.columns,
|
|
532
|
-
columnFilterFns,
|
|
533
|
-
defaultDisplayColumn,
|
|
534
|
-
filterFns,
|
|
535
|
-
sortingFns,
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
else if (columnDef.columnDefType === 'data') {
|
|
539
|
-
if (Object.keys(filterFns).includes(columnFilterFns[columnDef.id])) {
|
|
540
|
-
columnDef.filterFn =
|
|
541
|
-
(_b = filterFns[columnFilterFns[columnDef.id]]) !== null && _b !== void 0 ? _b : filterFns.fuzzy;
|
|
542
|
-
columnDef._filterFn =
|
|
543
|
-
columnFilterFns[columnDef.id];
|
|
544
|
-
}
|
|
545
|
-
if (Object.keys(sortingFns).includes(columnDef.sortingFn)) {
|
|
546
|
-
// @ts-ignore
|
|
547
|
-
columnDef.sortingFn = sortingFns[columnDef.sortingFn];
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
else if (columnDef.columnDefType === 'display') {
|
|
551
|
-
columnDef = Object.assign(Object.assign({}, defaultDisplayColumn), columnDef);
|
|
552
|
-
}
|
|
553
|
-
return columnDef;
|
|
554
|
-
});
|
|
555
|
-
const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
|
|
556
|
-
if (draggedColumn.getCanPin()) {
|
|
557
|
-
draggedColumn.pin(targetColumn.getIsPinned());
|
|
558
|
-
}
|
|
559
|
-
columnOrder.splice(columnOrder.indexOf(targetColumn.id), 0, columnOrder.splice(columnOrder.indexOf(draggedColumn.id), 1)[0]);
|
|
560
|
-
return [...columnOrder];
|
|
561
|
-
};
|
|
562
|
-
const showExpandColumn = (props, grouping) => !!(props.enableExpanding ||
|
|
563
|
-
(props.enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
|
|
564
|
-
props.renderDetailPanel);
|
|
565
|
-
const getLeadingDisplayColumnIds = (props) => {
|
|
566
|
-
var _a;
|
|
567
|
-
return [
|
|
568
|
-
(props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
|
|
569
|
-
props.positionActionsColumn === 'first' &&
|
|
570
|
-
(props.enableRowActions ||
|
|
571
|
-
(props.enableEditing &&
|
|
572
|
-
['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
|
|
573
|
-
'mrt-row-actions',
|
|
574
|
-
props.positionExpandColumn === 'first' &&
|
|
575
|
-
showExpandColumn(props) &&
|
|
576
|
-
'mrt-row-expand',
|
|
577
|
-
props.enableRowSelection && 'mrt-row-select',
|
|
578
|
-
props.enableRowNumbers && 'mrt-row-numbers',
|
|
579
|
-
].filter(Boolean);
|
|
580
|
-
};
|
|
581
|
-
const getTrailingDisplayColumnIds = (props) => {
|
|
582
|
-
var _a;
|
|
583
|
-
return [
|
|
584
|
-
props.positionActionsColumn === 'last' &&
|
|
585
|
-
(props.enableRowActions ||
|
|
586
|
-
(props.enableEditing &&
|
|
587
|
-
['row', 'modal'].includes((_a = props.editingMode) !== null && _a !== void 0 ? _a : ''))) &&
|
|
588
|
-
'mrt-row-actions',
|
|
589
|
-
props.positionExpandColumn === 'last' &&
|
|
590
|
-
showExpandColumn(props) &&
|
|
591
|
-
'mrt-row-expand',
|
|
592
|
-
];
|
|
593
|
-
};
|
|
594
|
-
const getDefaultColumnOrderIds = (props) => [
|
|
595
|
-
...getLeadingDisplayColumnIds(props),
|
|
596
|
-
...getAllLeafColumnDefs(props.columns).map((columnDef) => getColumnId(columnDef)),
|
|
597
|
-
...getTrailingDisplayColumnIds(props),
|
|
598
|
-
].filter(Boolean);
|
|
599
|
-
const getDefaultColumnFilterFn = (columnDef) => {
|
|
600
|
-
if (columnDef.filterVariant === 'multi-select')
|
|
601
|
-
return 'arrIncludesSome';
|
|
602
|
-
if (columnDef.filterVariant === 'range')
|
|
603
|
-
return 'betweenInclusive';
|
|
604
|
-
if (columnDef.filterVariant === 'select' ||
|
|
605
|
-
columnDef.filterVariant === 'checkbox')
|
|
606
|
-
return 'equals';
|
|
607
|
-
return 'fuzzy';
|
|
608
|
-
};
|
|
609
|
-
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
610
|
-
return (column.getIsPinned() === 'left' &&
|
|
611
|
-
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
612
|
-
};
|
|
613
|
-
const getIsFirstRightPinnedColumn = (column) => {
|
|
614
|
-
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
615
|
-
};
|
|
616
|
-
const getTotalRight = (table, column) => {
|
|
617
|
-
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
|
|
618
|
-
};
|
|
619
|
-
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
620
|
-
var _a, _b, _c, _d;
|
|
621
|
-
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
622
|
-
? alpha(lighten(theme.palette.background.default, 0.04), 0.97)
|
|
623
|
-
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
624
|
-
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
625
|
-
: getIsFirstRightPinnedColumn(column)
|
|
626
|
-
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
627
|
-
: undefined, left: column.getIsPinned() === 'left'
|
|
628
|
-
? `${column.getStart('left')}px`
|
|
629
|
-
: undefined, opacity: ((_a = table.getState().draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id ||
|
|
630
|
-
((_b = table.getState().hoveredColumn) === null || _b === void 0 ? void 0 : _b.id) === column.id
|
|
631
|
-
? 0.5
|
|
632
|
-
: 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
633
|
-
? 'sticky'
|
|
634
|
-
: undefined, right: column.getIsPinned() === 'right'
|
|
635
|
-
? `${getTotalRight(table, column)}px`
|
|
636
|
-
: undefined, transition: `all ${column.getIsResizing() ? 0 : '150ms'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
637
|
-
? tableCellProps.sx(theme)
|
|
638
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_c = column.columnDef.minSize) !== null && _c !== void 0 ? _c : 30}px)`, width: (_d = header === null || header === void 0 ? void 0 : header.getSize()) !== null && _d !== void 0 ? _d : column.getSize() }));
|
|
462
|
+
var _a, _b, _c, _d;
|
|
463
|
+
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
464
|
+
const { globalFilterFn, density } = getState();
|
|
465
|
+
const { column } = header !== null && header !== void 0 ? header : {};
|
|
466
|
+
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
|
467
|
+
const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
|
|
468
|
+
const internalFilterOptions = useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
|
|
469
|
+
? allowedColumnFilterOptions === undefined ||
|
|
470
|
+
(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
|
|
471
|
+
: (!globalFilterModeOptions ||
|
|
472
|
+
globalFilterModeOptions.includes(filterOption.option)) &&
|
|
473
|
+
['fuzzy', 'contains', 'startsWith'].includes(filterOption.option)), []);
|
|
474
|
+
const handleSelectFilterMode = (option) => {
|
|
475
|
+
if (header && column) {
|
|
476
|
+
setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
|
|
477
|
+
if (['empty', 'notEmpty'].includes(option)) {
|
|
478
|
+
column.setFilterValue(' ');
|
|
479
|
+
}
|
|
480
|
+
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
|
|
481
|
+
['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(option)) {
|
|
482
|
+
column.setFilterValue([]);
|
|
483
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
|
|
484
|
+
}
|
|
485
|
+
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
|
|
486
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(option)) {
|
|
487
|
+
column.setFilterValue(['', '']);
|
|
488
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
column.setFilterValue('');
|
|
492
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
setGlobalFilterFn(option);
|
|
497
|
+
}
|
|
498
|
+
setAnchorEl(null);
|
|
499
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
500
|
+
};
|
|
501
|
+
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
|
502
|
+
return (React.createElement(Menu, { anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
|
|
503
|
+
dense: density === 'compact',
|
|
504
|
+
} }, (_d = (header && column && columnDef
|
|
505
|
+
? (_c = (_b = columnDef.renderColumnFilterModeMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
|
506
|
+
column: column,
|
|
507
|
+
internalFilterOptions,
|
|
508
|
+
onSelectFilterMode: handleSelectFilterMode,
|
|
509
|
+
table,
|
|
510
|
+
})) !== null && _c !== void 0 ? _c : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
|
|
511
|
+
column: column,
|
|
512
|
+
internalFilterOptions,
|
|
513
|
+
onSelectFilterMode: handleSelectFilterMode,
|
|
514
|
+
table,
|
|
515
|
+
})
|
|
516
|
+
: renderGlobalFilterModeMenuItems === null || renderGlobalFilterModeMenuItems === void 0 ? void 0 : renderGlobalFilterModeMenuItems({
|
|
517
|
+
internalFilterOptions,
|
|
518
|
+
onSelectFilterMode: handleSelectFilterMode,
|
|
519
|
+
table,
|
|
520
|
+
}))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (React.createElement(MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
|
521
|
+
alignItems: 'center',
|
|
522
|
+
display: 'flex',
|
|
523
|
+
gap: '2ch',
|
|
524
|
+
my: 0,
|
|
525
|
+
py: '6px',
|
|
526
|
+
}, value: option },
|
|
527
|
+
React.createElement(Box, { sx: { fontSize: '1.25rem', width: '2ch' } }, symbol),
|
|
528
|
+
label)))));
|
|
639
529
|
};
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
530
|
+
|
|
531
|
+
const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
|
532
|
+
const { options: { icons: { PushPinIcon }, localization, }, } = table;
|
|
533
|
+
const handlePinColumn = (pinDirection) => {
|
|
534
|
+
column.pin(pinDirection);
|
|
535
|
+
};
|
|
536
|
+
return (React.createElement(Box, { sx: { minWidth: '70px', textAlign: 'center' } }, column.getIsPinned() ? (React.createElement(Tooltip, { arrow: true, title: localization.unpin },
|
|
537
|
+
React.createElement(IconButton, { onClick: () => handlePinColumn(false), size: "small" },
|
|
538
|
+
React.createElement(PushPinIcon, null)))) : (React.createElement(React.Fragment, null,
|
|
539
|
+
React.createElement(Tooltip, { arrow: true, title: localization.pinToLeft },
|
|
540
|
+
React.createElement(IconButton, { onClick: () => handlePinColumn('left'), size: "small" },
|
|
541
|
+
React.createElement(PushPinIcon, { style: {
|
|
542
|
+
transform: 'rotate(90deg)',
|
|
543
|
+
} }))),
|
|
544
|
+
React.createElement(Tooltip, { arrow: true, title: localization.pinToRight },
|
|
545
|
+
React.createElement(IconButton, { onClick: () => handlePinColumn('right'), size: "small" },
|
|
546
|
+
React.createElement(PushPinIcon, { style: {
|
|
547
|
+
transform: 'rotate(-90deg)',
|
|
548
|
+
} })))))));
|
|
644
549
|
};
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
550
|
+
|
|
551
|
+
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
|
552
|
+
var _a;
|
|
553
|
+
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
554
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move },
|
|
555
|
+
React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
|
556
|
+
var _a;
|
|
557
|
+
e.stopPropagation();
|
|
558
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
|
559
|
+
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 150ms ease-in-out', '&:hover': {
|
|
560
|
+
backgroundColor: 'transparent',
|
|
561
|
+
opacity: 1,
|
|
562
|
+
}, '&:active': {
|
|
563
|
+
cursor: 'grabbing',
|
|
564
|
+
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
|
565
|
+
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
|
566
|
+
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
|
567
|
+
React.createElement(DragHandleIcon, null))));
|
|
658
568
|
};
|
|
659
569
|
|
|
660
570
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
@@ -1842,19 +1752,11 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1842
1752
|
? columnDef.muiTableHeadCellProps({ column, table })
|
|
1843
1753
|
: columnDef.muiTableHeadCellProps;
|
|
1844
1754
|
const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
|
|
1845
|
-
const
|
|
1846
|
-
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1847
|
-
setHoveredColumn(null);
|
|
1848
|
-
}
|
|
1849
|
-
if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
|
|
1850
|
-
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
1851
|
-
}
|
|
1852
|
-
};
|
|
1853
|
-
const draggingBorder = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1755
|
+
const draggingBorder = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1854
1756
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
1855
1757
|
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
1856
1758
|
? `2px dashed ${theme.palette.primary.main}`
|
|
1857
|
-
: undefined;
|
|
1759
|
+
: undefined, [draggingColumn, hoveredColumn]);
|
|
1858
1760
|
const draggingBorders = draggingBorder
|
|
1859
1761
|
? {
|
|
1860
1762
|
borderLeft: draggingBorder,
|
|
@@ -1862,6 +1764,14 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1862
1764
|
borderTop: draggingBorder,
|
|
1863
1765
|
}
|
|
1864
1766
|
: undefined;
|
|
1767
|
+
const handleDragEnter = (_e) => {
|
|
1768
|
+
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1769
|
+
setHoveredColumn(null);
|
|
1770
|
+
}
|
|
1771
|
+
if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
|
|
1772
|
+
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1865
1775
|
const headerElement = ((_b = ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
|
|
1866
1776
|
? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
|
1867
1777
|
column,
|
|
@@ -2100,10 +2010,10 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
|
2100
2010
|
: (_b = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : cell.renderValue()));
|
|
2101
2011
|
};
|
|
2102
2012
|
|
|
2103
|
-
const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
2013
|
+
const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table, }) => {
|
|
2104
2014
|
var _a, _b;
|
|
2105
2015
|
const theme = useTheme();
|
|
2106
|
-
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping,
|
|
2016
|
+
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
|
2107
2017
|
const { draggingColumn, editingCell, editingRow, hoveredColumn, density, isLoading, showSkeletons, } = getState();
|
|
2108
2018
|
const { column, row } = cell;
|
|
2109
2019
|
const { columnDef } = column;
|
|
@@ -2118,6 +2028,25 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2118
2028
|
const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
|
|
2119
2029
|
? muiTableBodyCellSkeletonProps({ cell, column, row, table })
|
|
2120
2030
|
: muiTableBodyCellSkeletonProps;
|
|
2031
|
+
const [skeletonWidth, setSkeletonWidth] = useState(0);
|
|
2032
|
+
useEffect(() => setSkeletonWidth(isLoading || showSkeletons
|
|
2033
|
+
? columnDefType === 'display'
|
|
2034
|
+
? column.getSize() / 2
|
|
2035
|
+
: Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
|
|
2036
|
+
column.getSize() / 3)
|
|
2037
|
+
: 100), []);
|
|
2038
|
+
const draggingBorder = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
2039
|
+
? `1px dashed ${theme.palette.text.secondary}`
|
|
2040
|
+
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2041
|
+
? `2px dashed ${theme.palette.primary.main}`
|
|
2042
|
+
: undefined, [draggingColumn, hoveredColumn]);
|
|
2043
|
+
const draggingBorders = useMemo(() => draggingBorder
|
|
2044
|
+
? {
|
|
2045
|
+
borderLeft: draggingBorder,
|
|
2046
|
+
borderRight: draggingBorder,
|
|
2047
|
+
borderBottom: rowIndex === numRows - 1 ? draggingBorder : undefined,
|
|
2048
|
+
}
|
|
2049
|
+
: undefined, [draggingBorder, numRows]);
|
|
2121
2050
|
const isEditable = (enableEditing || columnDef.enableEditing) &&
|
|
2122
2051
|
columnDef.enableEditing !== false;
|
|
2123
2052
|
const isEditing = isEditable &&
|
|
@@ -2125,13 +2054,6 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2125
2054
|
(editingMode === 'table' ||
|
|
2126
2055
|
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id ||
|
|
2127
2056
|
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) === cell.id);
|
|
2128
|
-
const [skeletonWidth, setSkeletonWidth] = useState(0);
|
|
2129
|
-
useEffect(() => setSkeletonWidth(isLoading || showSkeletons
|
|
2130
|
-
? columnDefType === 'display'
|
|
2131
|
-
? column.getSize() / 2
|
|
2132
|
-
: Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
|
|
2133
|
-
column.getSize() / 3)
|
|
2134
|
-
: 100), [isLoading, showSkeletons]);
|
|
2135
2057
|
const handleDoubleClick = (event) => {
|
|
2136
2058
|
var _a;
|
|
2137
2059
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
|
@@ -2158,24 +2080,6 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2158
2080
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
2159
2081
|
}
|
|
2160
2082
|
};
|
|
2161
|
-
const draggingBorder = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
2162
|
-
? `1px dashed ${theme.palette.text.secondary}`
|
|
2163
|
-
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2164
|
-
? `2px dashed ${theme.palette.primary.main}`
|
|
2165
|
-
: undefined;
|
|
2166
|
-
const draggingBorders = draggingBorder
|
|
2167
|
-
? {
|
|
2168
|
-
borderLeft: draggingBorder,
|
|
2169
|
-
borderRight: draggingBorder,
|
|
2170
|
-
borderBottom: row.index ===
|
|
2171
|
-
(enablePagination
|
|
2172
|
-
? table.getRowModel()
|
|
2173
|
-
: table.getPrePaginationRowModel()).rows.length -
|
|
2174
|
-
1
|
|
2175
|
-
? draggingBorder
|
|
2176
|
-
: undefined,
|
|
2177
|
-
}
|
|
2178
|
-
: undefined;
|
|
2179
2083
|
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'inherit', overflow: 'hidden', p: density === 'compact'
|
|
2180
2084
|
? columnDefType === 'display'
|
|
2181
2085
|
? '0 0.5rem'
|
|
@@ -2232,8 +2136,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2232
2136
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
|
|
2233
2137
|
};
|
|
2234
2138
|
|
|
2235
|
-
const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
2236
|
-
var _a, _b;
|
|
2139
|
+
const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|
|
2237
2140
|
const theme = useTheme();
|
|
2238
2141
|
const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
|
|
2239
2142
|
const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
|
|
@@ -2246,11 +2149,11 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
|
2246
2149
|
}
|
|
2247
2150
|
};
|
|
2248
2151
|
const rowRef = useRef(null);
|
|
2249
|
-
const draggingBorder = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id
|
|
2152
|
+
const draggingBorder = useMemo(() => (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id
|
|
2250
2153
|
? `1px dashed ${theme.palette.text.secondary}`
|
|
2251
2154
|
: (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
|
2252
2155
|
? `2px dashed ${theme.palette.primary.main}`
|
|
2253
|
-
: undefined;
|
|
2156
|
+
: undefined, [draggingRow, hoveredRow]);
|
|
2254
2157
|
const draggingBorders = draggingBorder
|
|
2255
2158
|
? {
|
|
2256
2159
|
border: draggingBorder,
|
|
@@ -2270,16 +2173,17 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
|
2270
2173
|
: undefined,
|
|
2271
2174
|
} }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
|
2272
2175
|
? tableRowProps.sx(theme)
|
|
2273
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)), draggingBorders)) }),
|
|
2176
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)), draggingBorders)) }), row.getVisibleCells().map((cell) => {
|
|
2274
2177
|
const props = {
|
|
2275
2178
|
cell,
|
|
2276
2179
|
enableHover: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false,
|
|
2277
2180
|
key: cell.id,
|
|
2181
|
+
numRows,
|
|
2278
2182
|
rowIndex,
|
|
2279
2183
|
rowRef,
|
|
2280
2184
|
table,
|
|
2281
2185
|
};
|
|
2282
|
-
return memoMode === '
|
|
2186
|
+
return memoMode === 'cells' &&
|
|
2283
2187
|
cell.column.columnDef.columnDefType === 'data' &&
|
|
2284
2188
|
!draggingColumn &&
|
|
2285
2189
|
!draggingRow &&
|
|
@@ -2378,6 +2282,7 @@ const MRT_TableBody = ({ table }) => {
|
|
|
2378
2282
|
: rowOrVirtualRow;
|
|
2379
2283
|
const props = {
|
|
2380
2284
|
key: row.id,
|
|
2285
|
+
numRows: rows.length,
|
|
2381
2286
|
row,
|
|
2382
2287
|
rowIndex: enableRowVirtualization
|
|
2383
2288
|
? rowOrVirtualRow.index
|
|
@@ -2385,12 +2290,12 @@ const MRT_TableBody = ({ table }) => {
|
|
|
2385
2290
|
table,
|
|
2386
2291
|
virtualRow: enableRowVirtualization ? rowOrVirtualRow : null,
|
|
2387
2292
|
};
|
|
2388
|
-
return memoMode === '
|
|
2293
|
+
return memoMode === 'rows' ? (React.createElement(Memo_MRT_TableBodyRow, Object.assign({}, props))) : (React.createElement(MRT_TableBodyRow, Object.assign({}, props)));
|
|
2389
2294
|
}),
|
|
2390
2295
|
enableRowVirtualization && paddingBottom > 0 && (React.createElement("tr", null,
|
|
2391
2296
|
React.createElement("td", { style: { height: `${paddingBottom}px` } })))))));
|
|
2392
2297
|
};
|
|
2393
|
-
const Memo_MRT_TableBody = memo(MRT_TableBody, () =>
|
|
2298
|
+
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
|
2394
2299
|
|
|
2395
2300
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2396
2301
|
var _a, _b, _c;
|
|
@@ -2711,6 +2616,96 @@ const MRT_TableRoot = (props) => {
|
|
|
2711
2616
|
editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
|
2712
2617
|
};
|
|
2713
2618
|
|
|
2619
|
+
const MRT_Localization_EN = {
|
|
2620
|
+
actions: 'Actions',
|
|
2621
|
+
and: 'and',
|
|
2622
|
+
cancel: 'Cancel',
|
|
2623
|
+
changeFilterMode: 'Change filter mode',
|
|
2624
|
+
changeSearchMode: 'Change search mode',
|
|
2625
|
+
clearFilter: 'Clear filter',
|
|
2626
|
+
clearSearch: 'Clear search',
|
|
2627
|
+
clearSort: 'Clear sort',
|
|
2628
|
+
clickToCopy: 'Click to copy',
|
|
2629
|
+
columnActions: 'Column Actions',
|
|
2630
|
+
copiedToClipboard: 'Copied to clipboard',
|
|
2631
|
+
dropToGroupBy: 'Drop to group by {column}',
|
|
2632
|
+
edit: 'Edit',
|
|
2633
|
+
expand: 'Expand',
|
|
2634
|
+
expandAll: 'Expand all',
|
|
2635
|
+
filterArrIncludes: 'Includes',
|
|
2636
|
+
filterArrIncludesAll: 'Includes all',
|
|
2637
|
+
filterArrIncludesSome: 'Includes',
|
|
2638
|
+
filterBetween: 'Between',
|
|
2639
|
+
filterBetweenInclusive: 'Between Inclusive',
|
|
2640
|
+
filterByColumn: 'Filter by {column}',
|
|
2641
|
+
filterContains: 'Contains',
|
|
2642
|
+
filterEmpty: 'Empty',
|
|
2643
|
+
filterEndsWith: 'Ends With',
|
|
2644
|
+
filterEquals: 'Equals',
|
|
2645
|
+
filterEqualsString: 'Equals',
|
|
2646
|
+
filterFuzzy: 'Fuzzy',
|
|
2647
|
+
filterGreaterThan: 'Greater Than',
|
|
2648
|
+
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
|
2649
|
+
filterInNumberRange: 'Between',
|
|
2650
|
+
filterIncludesString: 'Contains',
|
|
2651
|
+
filterIncludesStringSensitive: 'Contains',
|
|
2652
|
+
filterLessThan: 'Less Than',
|
|
2653
|
+
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
|
2654
|
+
filterMode: 'Filter Mode: {filterType}',
|
|
2655
|
+
filterNotEmpty: 'Not Empty',
|
|
2656
|
+
filterNotEquals: 'Not Equals',
|
|
2657
|
+
filterStartsWith: 'Starts With',
|
|
2658
|
+
filterWeakEquals: 'Equals',
|
|
2659
|
+
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
2660
|
+
goToFirstPage: 'Go to first page',
|
|
2661
|
+
goToLastPage: 'Go to last page',
|
|
2662
|
+
goToNextPage: 'Go to next page',
|
|
2663
|
+
goToPreviousPage: 'Go to previous page',
|
|
2664
|
+
grab: 'Grab',
|
|
2665
|
+
groupByColumn: 'Group by {column}',
|
|
2666
|
+
groupedBy: 'Grouped by ',
|
|
2667
|
+
hideAll: 'Hide all',
|
|
2668
|
+
hideColumn: 'Hide {column} column',
|
|
2669
|
+
max: 'Max',
|
|
2670
|
+
min: 'Min',
|
|
2671
|
+
move: 'Move',
|
|
2672
|
+
noRecordsToDisplay: 'No records to display',
|
|
2673
|
+
noResultsFound: 'No results found',
|
|
2674
|
+
of: 'of',
|
|
2675
|
+
or: 'or',
|
|
2676
|
+
pinToLeft: 'Pin to left',
|
|
2677
|
+
pinToRight: 'Pin to right',
|
|
2678
|
+
resetColumnSize: 'Reset column size',
|
|
2679
|
+
resetOrder: 'Reset order',
|
|
2680
|
+
rowActions: 'Row Actions',
|
|
2681
|
+
rowNumber: '#',
|
|
2682
|
+
rowNumbers: 'Row Numbers',
|
|
2683
|
+
rowsPerPage: 'Rows per page',
|
|
2684
|
+
save: 'Save',
|
|
2685
|
+
search: 'Search',
|
|
2686
|
+
selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
|
|
2687
|
+
select: 'Select',
|
|
2688
|
+
showAll: 'Show all',
|
|
2689
|
+
showAllColumns: 'Show all columns',
|
|
2690
|
+
showHideColumns: 'Show/Hide columns',
|
|
2691
|
+
showHideFilters: 'Show/Hide filters',
|
|
2692
|
+
showHideSearch: 'Show/Hide search',
|
|
2693
|
+
sortByColumnAsc: 'Sort by {column} ascending',
|
|
2694
|
+
sortByColumnDesc: 'Sort by {column} descending',
|
|
2695
|
+
sortedByColumnAsc: 'Sorted by {column} ascending',
|
|
2696
|
+
sortedByColumnDesc: 'Sorted by {column} descending',
|
|
2697
|
+
thenBy: ', then by ',
|
|
2698
|
+
toggleDensity: 'Toggle density',
|
|
2699
|
+
toggleFullScreen: 'Toggle full screen',
|
|
2700
|
+
toggleSelectAll: 'Toggle select all',
|
|
2701
|
+
toggleSelectRow: 'Toggle select row',
|
|
2702
|
+
toggleVisibility: 'Toggle visibility',
|
|
2703
|
+
ungroupByColumn: 'Ungroup by {column}',
|
|
2704
|
+
unpin: 'Unpin',
|
|
2705
|
+
unpinAll: 'Unpin all',
|
|
2706
|
+
unsorted: 'Unsorted',
|
|
2707
|
+
};
|
|
2708
|
+
|
|
2714
2709
|
const MaterialReactTable = (_a) => {
|
|
2715
2710
|
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, localization, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "defaultDisplayColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "localization", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
|
2716
2711
|
const _icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), []);
|