material-react-table 0.26.6 → 0.29.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/README.md +7 -8
- package/dist/MaterialReactTable.d.ts +11 -7
- package/dist/column.utils.d.ts +1 -0
- package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
- package/dist/localization.d.ts +9 -0
- package/dist/material-react-table.cjs.development.js +214 -146
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +215 -147
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_FilterOptionMenu.d.ts +7 -0
- package/package.json +5 -5
- package/src/MaterialReactTable.tsx +15 -7
- package/src/body/MRT_TableBody.tsx +12 -12
- package/src/body/MRT_TableBodyCell.tsx +7 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +1 -0
- package/src/column.utils.ts +13 -0
- package/src/head/MRT_TableHeadCell.tsx +2 -4
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +3 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +8 -3
- package/src/inputs/MRT_FilterRangeFields.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +124 -84
- package/src/inputs/MRT_SelectCheckbox.tsx +3 -3
- package/src/localization.ts +18 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +2 -2
- package/src/menus/MRT_FilterOptionMenu.tsx +103 -101
- package/src/table/MRT_TableRoot.tsx +2 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useMemo, useState, useCallback, Fragment, useRef, useLayoutEffect, useEffect } from 'react';
|
|
2
2
|
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';
|
|
3
3
|
import { filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
4
|
-
import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, useMediaQuery, Toolbar, lighten, alpha, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog } from '@mui/material';
|
|
4
|
+
import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, useMediaQuery, Toolbar, lighten, alpha, ListItemText, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog } from '@mui/material';
|
|
5
5
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
6
|
-
import {
|
|
6
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
7
7
|
|
|
8
8
|
function _extends() {
|
|
9
9
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -52,6 +52,9 @@ var MRT_DefaultLocalization_EN = {
|
|
|
52
52
|
edit: 'Edit',
|
|
53
53
|
expand: 'Expand',
|
|
54
54
|
expandAll: 'Expand all',
|
|
55
|
+
filterArrIncludes: 'Includes',
|
|
56
|
+
filterArrIncludesAll: 'Includes all',
|
|
57
|
+
filterArrIncludesSome: 'Includes',
|
|
55
58
|
filterBetween: 'Between',
|
|
56
59
|
filterBetweenInclusive: 'Between Inclusive',
|
|
57
60
|
filterByColumn: 'Filter by {column}',
|
|
@@ -59,15 +62,20 @@ var MRT_DefaultLocalization_EN = {
|
|
|
59
62
|
filterEmpty: 'Empty',
|
|
60
63
|
filterEndsWith: 'Ends With',
|
|
61
64
|
filterEquals: 'Equals',
|
|
65
|
+
filterEqualsString: 'Equals',
|
|
62
66
|
filterFuzzy: 'Fuzzy',
|
|
63
67
|
filterGreaterThan: 'Greater Than',
|
|
64
68
|
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
|
69
|
+
filterInNumberRange: 'Between',
|
|
70
|
+
filterIncludesString: 'Contains',
|
|
71
|
+
filterIncludesStringSensitive: 'Contains',
|
|
65
72
|
filterLessThan: 'Less Than',
|
|
66
73
|
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
|
67
74
|
filterMode: 'Filter Mode: {filterType}',
|
|
68
75
|
filterNotEmpty: 'Not Empty',
|
|
69
76
|
filterNotEquals: 'Not Equals',
|
|
70
77
|
filterStartsWith: 'Starts With',
|
|
78
|
+
filterWeakEquals: 'Equals',
|
|
71
79
|
filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
|
|
72
80
|
grab: 'Grab',
|
|
73
81
|
groupByColumn: 'Group by {column}',
|
|
@@ -77,6 +85,7 @@ var MRT_DefaultLocalization_EN = {
|
|
|
77
85
|
max: 'Max',
|
|
78
86
|
min: 'Min',
|
|
79
87
|
move: 'Move',
|
|
88
|
+
or: 'or',
|
|
80
89
|
pinToLeft: 'Pin to left',
|
|
81
90
|
pinToRight: 'Pin to right',
|
|
82
91
|
resetColumnSize: 'Reset column size',
|
|
@@ -175,7 +184,8 @@ var MRT_ExpandAllButton = function MRT_ExpandAllButton(_ref) {
|
|
|
175
184
|
}, iconButtonProps, {
|
|
176
185
|
sx: _extends({
|
|
177
186
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
178
|
-
width: density === 'compact' ? '1.75rem' : '2.25rem'
|
|
187
|
+
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
188
|
+
mt: density !== 'compact' ? '-0.25rem' : undefined
|
|
179
189
|
}, iconButtonProps == null ? void 0 : iconButtonProps.sx)
|
|
180
190
|
}), React.createElement(KeyboardDoubleArrowDownIcon, {
|
|
181
191
|
style: {
|
|
@@ -231,8 +241,81 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
|
231
241
|
}))));
|
|
232
242
|
};
|
|
233
243
|
|
|
244
|
+
var internalFilterOptions = function internalFilterOptions(localization) {
|
|
245
|
+
return [{
|
|
246
|
+
option: 'fuzzy',
|
|
247
|
+
symbol: '≈',
|
|
248
|
+
label: localization.filterFuzzy,
|
|
249
|
+
divider: false
|
|
250
|
+
}, {
|
|
251
|
+
option: 'contains',
|
|
252
|
+
symbol: '*',
|
|
253
|
+
label: localization.filterContains,
|
|
254
|
+
divider: false
|
|
255
|
+
}, {
|
|
256
|
+
option: 'startsWith',
|
|
257
|
+
symbol: 'a',
|
|
258
|
+
label: localization.filterStartsWith,
|
|
259
|
+
divider: false
|
|
260
|
+
}, {
|
|
261
|
+
option: 'endsWith',
|
|
262
|
+
symbol: 'z',
|
|
263
|
+
label: localization.filterEndsWith,
|
|
264
|
+
divider: true
|
|
265
|
+
}, {
|
|
266
|
+
option: 'equals',
|
|
267
|
+
symbol: '=',
|
|
268
|
+
label: localization.filterEquals,
|
|
269
|
+
divider: false
|
|
270
|
+
}, {
|
|
271
|
+
option: 'notEquals',
|
|
272
|
+
symbol: '≠',
|
|
273
|
+
label: localization.filterNotEquals,
|
|
274
|
+
divider: true
|
|
275
|
+
}, {
|
|
276
|
+
option: 'between',
|
|
277
|
+
symbol: '⇿',
|
|
278
|
+
label: localization.filterBetween,
|
|
279
|
+
divider: false
|
|
280
|
+
}, {
|
|
281
|
+
option: 'betweenInclusive',
|
|
282
|
+
symbol: '⬌',
|
|
283
|
+
label: localization.filterBetweenInclusive,
|
|
284
|
+
divider: true
|
|
285
|
+
}, {
|
|
286
|
+
option: 'greaterThan',
|
|
287
|
+
symbol: '>',
|
|
288
|
+
label: localization.filterGreaterThan,
|
|
289
|
+
divider: false
|
|
290
|
+
}, {
|
|
291
|
+
option: 'greaterThanOrEqualTo',
|
|
292
|
+
symbol: '≥',
|
|
293
|
+
label: localization.filterGreaterThanOrEqualTo,
|
|
294
|
+
divider: false
|
|
295
|
+
}, {
|
|
296
|
+
option: 'lessThan',
|
|
297
|
+
symbol: '<',
|
|
298
|
+
label: localization.filterLessThan,
|
|
299
|
+
divider: false
|
|
300
|
+
}, {
|
|
301
|
+
option: 'lessThanOrEqualTo',
|
|
302
|
+
symbol: '≤',
|
|
303
|
+
label: localization.filterLessThanOrEqualTo,
|
|
304
|
+
divider: true
|
|
305
|
+
}, {
|
|
306
|
+
option: 'empty',
|
|
307
|
+
symbol: '∅',
|
|
308
|
+
label: localization.filterEmpty,
|
|
309
|
+
divider: false
|
|
310
|
+
}, {
|
|
311
|
+
option: 'notEmpty',
|
|
312
|
+
symbol: '!∅',
|
|
313
|
+
label: localization.filterNotEmpty,
|
|
314
|
+
divider: false
|
|
315
|
+
}];
|
|
316
|
+
};
|
|
234
317
|
var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
235
|
-
var _columnDef$
|
|
318
|
+
var _columnDef$columnFilt;
|
|
236
319
|
|
|
237
320
|
var anchorEl = _ref.anchorEl,
|
|
238
321
|
header = _ref.header,
|
|
@@ -242,7 +325,7 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
|
242
325
|
var getState = table.getState,
|
|
243
326
|
_table$options = table.options,
|
|
244
327
|
enabledGlobalFilterOptions = _table$options.enabledGlobalFilterOptions,
|
|
245
|
-
|
|
328
|
+
columnFilterModeOptions = _table$options.columnFilterModeOptions,
|
|
246
329
|
localization = _table$options.localization,
|
|
247
330
|
setCurrentFilterFns = table.setCurrentFilterFns,
|
|
248
331
|
setCurrentGlobalFilterFn = table.setCurrentGlobalFilterFn;
|
|
@@ -258,80 +341,10 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
|
258
341
|
var _ref3 = column != null ? column : {},
|
|
259
342
|
columnDef = _ref3.columnDef;
|
|
260
343
|
|
|
261
|
-
var allowedColumnFilterOptions = (_columnDef$
|
|
344
|
+
var allowedColumnFilterOptions = (_columnDef$columnFilt = columnDef == null ? void 0 : columnDef.columnFilterModeOptions) != null ? _columnDef$columnFilt : columnFilterModeOptions;
|
|
262
345
|
var filterOptions = useMemo(function () {
|
|
263
|
-
return
|
|
264
|
-
option: 'fuzzy',
|
|
265
|
-
symbol: '≈',
|
|
266
|
-
label: localization.filterFuzzy,
|
|
267
|
-
divider: false
|
|
268
|
-
}, {
|
|
269
|
-
option: 'contains',
|
|
270
|
-
symbol: '*',
|
|
271
|
-
label: localization.filterContains,
|
|
272
|
-
divider: false
|
|
273
|
-
}, {
|
|
274
|
-
option: 'startsWith',
|
|
275
|
-
symbol: 'a',
|
|
276
|
-
label: localization.filterStartsWith,
|
|
277
|
-
divider: false
|
|
278
|
-
}, {
|
|
279
|
-
option: 'endsWith',
|
|
280
|
-
symbol: 'z',
|
|
281
|
-
label: localization.filterEndsWith,
|
|
282
|
-
divider: true
|
|
283
|
-
}, {
|
|
284
|
-
option: 'equals',
|
|
285
|
-
symbol: '=',
|
|
286
|
-
label: localization.filterEquals,
|
|
287
|
-
divider: false
|
|
288
|
-
}, {
|
|
289
|
-
option: 'notEquals',
|
|
290
|
-
symbol: '≠',
|
|
291
|
-
label: localization.filterNotEquals,
|
|
292
|
-
divider: true
|
|
293
|
-
}, {
|
|
294
|
-
option: 'between',
|
|
295
|
-
symbol: '⇿',
|
|
296
|
-
label: localization.filterBetween,
|
|
297
|
-
divider: false
|
|
298
|
-
}, {
|
|
299
|
-
option: 'betweenInclusive',
|
|
300
|
-
symbol: '⬌',
|
|
301
|
-
label: localization.filterBetweenInclusive,
|
|
302
|
-
divider: true
|
|
303
|
-
}, {
|
|
304
|
-
option: 'greaterThan',
|
|
305
|
-
symbol: '>',
|
|
306
|
-
label: localization.filterGreaterThan,
|
|
307
|
-
divider: false
|
|
308
|
-
}, {
|
|
309
|
-
option: 'greaterThanOrEqualTo',
|
|
310
|
-
symbol: '≥',
|
|
311
|
-
label: localization.filterGreaterThanOrEqualTo,
|
|
312
|
-
divider: false
|
|
313
|
-
}, {
|
|
314
|
-
option: 'lessThan',
|
|
315
|
-
symbol: '<',
|
|
316
|
-
label: localization.filterLessThan,
|
|
317
|
-
divider: false
|
|
318
|
-
}, {
|
|
319
|
-
option: 'lessThanOrEqualTo',
|
|
320
|
-
symbol: '≤',
|
|
321
|
-
label: localization.filterLessThanOrEqualTo,
|
|
322
|
-
divider: true
|
|
323
|
-
}, {
|
|
324
|
-
option: 'empty',
|
|
325
|
-
symbol: '∅',
|
|
326
|
-
label: localization.filterEmpty,
|
|
327
|
-
divider: false
|
|
328
|
-
}, {
|
|
329
|
-
option: 'notEmpty',
|
|
330
|
-
symbol: '!∅',
|
|
331
|
-
label: localization.filterNotEmpty,
|
|
332
|
-
divider: false
|
|
333
|
-
}].filter(function (filterType) {
|
|
334
|
-
return columnDef ? allowedColumnFilterOptions === undefined || (allowedColumnFilterOptions == null ? void 0 : allowedColumnFilterOptions.includes(filterType.option)) : (!enabledGlobalFilterOptions || enabledGlobalFilterOptions.includes(filterType.option)) && ['fuzzy', 'contains'].includes(filterType.option);
|
|
346
|
+
return internalFilterOptions(localization).filter(function (filterOption) {
|
|
347
|
+
return columnDef ? allowedColumnFilterOptions === undefined || (allowedColumnFilterOptions == null ? void 0 : allowedColumnFilterOptions.includes(filterOption.option)) : (!enabledGlobalFilterOptions || enabledGlobalFilterOptions.includes(filterOption.option)) && ['fuzzy', 'contains'].includes(filterOption.option);
|
|
335
348
|
});
|
|
336
349
|
}, []);
|
|
337
350
|
|
|
@@ -698,7 +711,9 @@ var prepareColumns = function prepareColumns(columnDefs, currentFilterFns) {
|
|
|
698
711
|
if (Object.keys(MRT_FilterFns).includes(currentFilterFns[columnDef.id])) {
|
|
699
712
|
var _MRT_FilterFns$curren;
|
|
700
713
|
|
|
701
|
-
columnDef.filterFn = (_MRT_FilterFns$curren = MRT_FilterFns[currentFilterFns[columnDef.id]]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy;
|
|
714
|
+
columnDef.filterFn = (_MRT_FilterFns$curren = MRT_FilterFns[currentFilterFns[columnDef.id]]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy; //@ts-ignore
|
|
715
|
+
|
|
716
|
+
columnDef._filterFn = currentFilterFns[columnDef.id];
|
|
702
717
|
}
|
|
703
718
|
|
|
704
719
|
if (Object.keys(MRT_SortingFns).includes(columnDef.sortingFn)) {
|
|
@@ -729,6 +744,12 @@ var getDefaultColumnOrderIds = function getDefaultColumnOrderIds(props) {
|
|
|
729
744
|
return getColumnId(columnDef);
|
|
730
745
|
}), getTrailingDisplayColumnIds(props)).filter(Boolean);
|
|
731
746
|
};
|
|
747
|
+
var getDefaultColumnFilterFn = function getDefaultColumnFilterFn(columnDef) {
|
|
748
|
+
if (columnDef.filterVariant === 'multiSelect') return 'arrIncludesSome';
|
|
749
|
+
if (columnDef.filterVariant === 'select') return 'equals';
|
|
750
|
+
if (columnDef.filterVariant === 'range') return 'betweenInclusive';
|
|
751
|
+
return 'fuzzy';
|
|
752
|
+
};
|
|
732
753
|
|
|
733
754
|
var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
|
|
734
755
|
var _column$columns2;
|
|
@@ -980,7 +1001,7 @@ var commonListItemStyles = {
|
|
|
980
1001
|
alignItems: 'center'
|
|
981
1002
|
};
|
|
982
1003
|
var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
983
|
-
var _columnDef$
|
|
1004
|
+
var _columnDef$columnFilt, _localization$sortByC, _localization$sortByC2, _localization$filterB, _localization, _localization$hideCol, _localization$showAll;
|
|
984
1005
|
|
|
985
1006
|
var anchorEl = _ref.anchorEl,
|
|
986
1007
|
header = _ref.header,
|
|
@@ -997,7 +1018,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
997
1018
|
enableHiding = _table$options.enableHiding,
|
|
998
1019
|
enablePinning = _table$options.enablePinning,
|
|
999
1020
|
enableSorting = _table$options.enableSorting,
|
|
1000
|
-
|
|
1021
|
+
columnFilterModeOptions = _table$options.columnFilterModeOptions,
|
|
1001
1022
|
_table$options$icons = _table$options.icons,
|
|
1002
1023
|
ArrowRightIcon = _table$options$icons.ArrowRightIcon,
|
|
1003
1024
|
ClearAllIcon = _table$options$icons.ClearAllIcon,
|
|
@@ -1098,7 +1119,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
1098
1119
|
};
|
|
1099
1120
|
|
|
1100
1121
|
var isSelectFilter = !!columnDef.filterSelectOptions;
|
|
1101
|
-
var allowedColumnFilterOptions = (_columnDef$
|
|
1122
|
+
var allowedColumnFilterOptions = (_columnDef$columnFilt = columnDef == null ? void 0 : columnDef.columnFilterModeOptions) != null ? _columnDef$columnFilt : columnFilterModeOptions;
|
|
1102
1123
|
var showFilterModeSubMenu = enableColumnFilterChangeMode && columnDef.enableColumnFilterChangeMode !== false && !isSelectFilter && (allowedColumnFilterOptions === undefined || !!(allowedColumnFilterOptions != null && allowedColumnFilterOptions.length));
|
|
1103
1124
|
return React.createElement(Menu, {
|
|
1104
1125
|
anchorEl: anchorEl,
|
|
@@ -1445,9 +1466,9 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
1445
1466
|
}, checkboxProps, {
|
|
1446
1467
|
sx: function sx(theme) {
|
|
1447
1468
|
return _extends({
|
|
1448
|
-
height: density === 'compact' ? '1.
|
|
1449
|
-
width: density === 'compact' ? '1.
|
|
1450
|
-
m: '-
|
|
1469
|
+
height: density === 'compact' ? '1.75rem' : '2.5rem',
|
|
1470
|
+
width: density === 'compact' ? '1.75rem' : '2.5rem',
|
|
1471
|
+
m: density !== 'compact' ? '-0.4rem' : undefined
|
|
1451
1472
|
}, (checkboxProps == null ? void 0 : checkboxProps.sx) instanceof Function ? checkboxProps.sx(theme) : checkboxProps == null ? void 0 : checkboxProps.sx);
|
|
1452
1473
|
}
|
|
1453
1474
|
})));
|
|
@@ -2113,15 +2134,15 @@ var MRT_TableHeadCellColumnActionsButton = function MRT_TableHeadCellColumnActio
|
|
|
2113
2134
|
};
|
|
2114
2135
|
|
|
2115
2136
|
var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
2116
|
-
var _currentFilterOption$, _localization$filterB, _columnDef$
|
|
2137
|
+
var _currentFilterOption$, _localization$filterB, _columnDef$columnFilt, _currentFilterOption$2, _localization$clearFi, _columnDef$filterSele;
|
|
2117
2138
|
|
|
2118
2139
|
var header = _ref.header,
|
|
2119
|
-
|
|
2140
|
+
rangeFilterIndex = _ref.rangeFilterIndex,
|
|
2120
2141
|
table = _ref.table;
|
|
2121
2142
|
var getState = table.getState,
|
|
2122
2143
|
_table$options = table.options,
|
|
2123
2144
|
enableColumnFilterChangeMode = _table$options.enableColumnFilterChangeMode,
|
|
2124
|
-
|
|
2145
|
+
columnFilterModeOptions = _table$options.columnFilterModeOptions,
|
|
2125
2146
|
_table$options$icons = _table$options.icons,
|
|
2126
2147
|
FilterListIcon = _table$options$icons.FilterListIcon,
|
|
2127
2148
|
CloseIcon = _table$options$icons.CloseIcon,
|
|
@@ -2135,25 +2156,39 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2135
2156
|
var _getState = getState(),
|
|
2136
2157
|
currentFilterFns = _getState.currentFilterFns;
|
|
2137
2158
|
|
|
2138
|
-
var _useState = useState(null),
|
|
2139
|
-
anchorEl = _useState[0],
|
|
2140
|
-
setAnchorEl = _useState[1];
|
|
2141
|
-
|
|
2142
2159
|
var mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function ? muiTableHeadCellFilterTextFieldProps({
|
|
2143
2160
|
column: column,
|
|
2144
|
-
table: table
|
|
2161
|
+
table: table,
|
|
2162
|
+
rangeFilterIndex: rangeFilterIndex
|
|
2145
2163
|
}) : muiTableHeadCellFilterTextFieldProps;
|
|
2146
2164
|
var mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function ? columnDef.muiTableHeadCellFilterTextFieldProps({
|
|
2147
2165
|
column: column,
|
|
2148
|
-
table: table
|
|
2166
|
+
table: table,
|
|
2167
|
+
rangeFilterIndex: rangeFilterIndex
|
|
2149
2168
|
}) : columnDef.muiTableHeadCellFilterTextFieldProps;
|
|
2150
2169
|
|
|
2151
2170
|
var textFieldProps = _extends({}, mTableHeadCellFilterTextFieldProps, mcTableHeadCellFilterTextFieldProps);
|
|
2152
2171
|
|
|
2172
|
+
var isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
|
|
2173
|
+
var isSelectFilter = columnDef.filterVariant === 'select';
|
|
2174
|
+
var isMultiSelectFilter = columnDef.filterVariant === 'multiSelect';
|
|
2175
|
+
var isTextboxFilter = !isSelectFilter && !isMultiSelectFilter;
|
|
2176
|
+
var currentFilterOption = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
|
|
2177
|
+
var filterId = "mrt-" + tableId + "-" + header.id + "-filter-text-field" + (rangeFilterIndex != null ? rangeFilterIndex : '');
|
|
2178
|
+
var filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption) ? //@ts-ignore
|
|
2179
|
+
localization["filter" + ((currentFilterOption == null ? void 0 : currentFilterOption.charAt == null ? void 0 : (_currentFilterOption$ = currentFilterOption.charAt(0)) == null ? void 0 : _currentFilterOption$.toUpperCase()) + (currentFilterOption == null ? void 0 : currentFilterOption.slice(1)))] : '';
|
|
2180
|
+
var filterPlaceholder = !isRangeFilter ? (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(columnDef.header)) : rangeFilterIndex === 0 ? localization.min : rangeFilterIndex === 1 ? localization.max : '';
|
|
2181
|
+
var allowedColumnFilterOptions = (_columnDef$columnFilt = columnDef == null ? void 0 : columnDef.columnFilterModeOptions) != null ? _columnDef$columnFilt : columnFilterModeOptions;
|
|
2182
|
+
var showChangeModeButton = enableColumnFilterChangeMode && columnDef.enableColumnFilterChangeMode !== false && !rangeFilterIndex && (allowedColumnFilterOptions === undefined || !!(allowedColumnFilterOptions != null && allowedColumnFilterOptions.length));
|
|
2183
|
+
|
|
2184
|
+
var _useState = useState(null),
|
|
2185
|
+
anchorEl = _useState[0],
|
|
2186
|
+
setAnchorEl = _useState[1];
|
|
2187
|
+
|
|
2153
2188
|
var _useState2 = useState(function () {
|
|
2154
|
-
var _column$getFilterValu, _column$getFilterValu2
|
|
2189
|
+
var _column$getFilterValu, _column$getFilterValu2;
|
|
2155
2190
|
|
|
2156
|
-
return
|
|
2191
|
+
return isMultiSelectFilter ? column.getFilterValue() || [] : isRangeFilter ? ((_column$getFilterValu = column.getFilterValue()) == null ? void 0 : _column$getFilterValu[rangeFilterIndex]) || [] : (_column$getFilterValu2 = column.getFilterValue()) != null ? _column$getFilterValu2 : '';
|
|
2157
2192
|
}),
|
|
2158
2193
|
filterValue = _useState2[0],
|
|
2159
2194
|
setFilterValue = _useState2[1];
|
|
@@ -2161,41 +2196,40 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2161
2196
|
var handleChangeDebounced = useCallback(debounce(function (event) {
|
|
2162
2197
|
var value = textFieldProps.type === 'date' ? new Date(event.target.value) : event.target.value;
|
|
2163
2198
|
|
|
2164
|
-
if (
|
|
2199
|
+
if (isRangeFilter) {
|
|
2165
2200
|
column.setFilterValue(function (old) {
|
|
2166
2201
|
var newFilterValues = old != null ? old : ['', ''];
|
|
2167
|
-
newFilterValues[
|
|
2202
|
+
newFilterValues[rangeFilterIndex] = value;
|
|
2168
2203
|
return newFilterValues;
|
|
2169
2204
|
});
|
|
2170
2205
|
} else {
|
|
2171
2206
|
column.setFilterValue(value != null ? value : undefined);
|
|
2172
2207
|
}
|
|
2173
|
-
}, 200), []);
|
|
2208
|
+
}, isTextboxFilter ? 200 : 1), []);
|
|
2174
2209
|
|
|
2175
2210
|
var handleChange = function handleChange(event) {
|
|
2176
2211
|
setFilterValue(event.target.value);
|
|
2177
2212
|
handleChangeDebounced(event);
|
|
2178
2213
|
};
|
|
2179
2214
|
|
|
2180
|
-
var handleFilterMenuOpen = function handleFilterMenuOpen(event) {
|
|
2181
|
-
setAnchorEl(event.currentTarget);
|
|
2182
|
-
};
|
|
2183
|
-
|
|
2184
2215
|
var handleClear = function handleClear() {
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2216
|
+
if (isMultiSelectFilter) {
|
|
2217
|
+
setFilterValue([]);
|
|
2218
|
+
column.setFilterValue([]);
|
|
2219
|
+
} else if (isRangeFilter) {
|
|
2220
|
+
setFilterValue('');
|
|
2188
2221
|
column.setFilterValue(function (old) {
|
|
2189
2222
|
var newFilterValues = old != null ? old : ['', ''];
|
|
2190
|
-
newFilterValues[
|
|
2223
|
+
newFilterValues[rangeFilterIndex] = undefined;
|
|
2191
2224
|
return newFilterValues;
|
|
2192
2225
|
});
|
|
2193
2226
|
} else {
|
|
2227
|
+
setFilterValue('');
|
|
2194
2228
|
column.setFilterValue(undefined);
|
|
2195
2229
|
}
|
|
2196
2230
|
};
|
|
2197
2231
|
|
|
2198
|
-
var
|
|
2232
|
+
var handleClearEmptyFilterChip = function handleClearEmptyFilterChip() {
|
|
2199
2233
|
setFilterValue('');
|
|
2200
2234
|
column.setFilterValue(undefined);
|
|
2201
2235
|
setCurrentFilterFns(function (prev) {
|
|
@@ -2205,6 +2239,10 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2205
2239
|
});
|
|
2206
2240
|
};
|
|
2207
2241
|
|
|
2242
|
+
var handleFilterMenuOpen = function handleFilterMenuOpen(event) {
|
|
2243
|
+
setAnchorEl(event.currentTarget);
|
|
2244
|
+
};
|
|
2245
|
+
|
|
2208
2246
|
if (columnDef.Filter) {
|
|
2209
2247
|
return React.createElement(React.Fragment, null, columnDef.Filter == null ? void 0 : columnDef.Filter({
|
|
2210
2248
|
header: header,
|
|
@@ -2212,14 +2250,6 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2212
2250
|
}));
|
|
2213
2251
|
}
|
|
2214
2252
|
|
|
2215
|
-
var filterId = "mrt-" + tableId + "-" + header.id + "-filter-text-field" + (inputIndex != null ? inputIndex : '');
|
|
2216
|
-
var currentFilterOption = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
|
|
2217
|
-
var isSelectFilter = !!columnDef.filterSelectOptions;
|
|
2218
|
-
var filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption) ? //@ts-ignore
|
|
2219
|
-
localization["filter" + ((currentFilterOption == null ? void 0 : (_currentFilterOption$ = currentFilterOption.charAt(0)) == null ? void 0 : _currentFilterOption$.toUpperCase()) + (currentFilterOption == null ? void 0 : currentFilterOption.slice(1)))] : '';
|
|
2220
|
-
var filterPlaceholder = inputIndex === undefined ? (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(columnDef.header)) : inputIndex === 0 ? localization.min : inputIndex === 1 ? localization.max : '';
|
|
2221
|
-
var allowedColumnFilterOptions = (_columnDef$enabledCol = columnDef == null ? void 0 : columnDef.enabledColumnFilterOptions) != null ? _columnDef$enabledCol : enabledColumnFilterOptions;
|
|
2222
|
-
var showChangeModeButton = enableColumnFilterChangeMode && columnDef.enableColumnFilterChangeMode !== false && !isSelectFilter && !inputIndex && (allowedColumnFilterOptions === undefined || !!(allowedColumnFilterOptions != null && allowedColumnFilterOptions.length));
|
|
2223
2253
|
return React.createElement(React.Fragment, null, React.createElement(TextField, Object.assign({
|
|
2224
2254
|
fullWidth: true,
|
|
2225
2255
|
id: filterId,
|
|
@@ -2243,13 +2273,13 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2243
2273
|
}
|
|
2244
2274
|
},
|
|
2245
2275
|
margin: "none",
|
|
2246
|
-
placeholder: filterChipLabel || isSelectFilter ? undefined : filterPlaceholder,
|
|
2276
|
+
placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter ? undefined : filterPlaceholder,
|
|
2247
2277
|
onChange: handleChange,
|
|
2248
2278
|
onClick: function onClick(e) {
|
|
2249
2279
|
return e.stopPropagation();
|
|
2250
2280
|
},
|
|
2251
|
-
select: isSelectFilter,
|
|
2252
|
-
value: filterValue
|
|
2281
|
+
select: isSelectFilter || isMultiSelectFilter,
|
|
2282
|
+
value: filterValue,
|
|
2253
2283
|
variant: "standard",
|
|
2254
2284
|
InputProps: {
|
|
2255
2285
|
startAdornment: showChangeModeButton ? React.createElement(InputAdornment, {
|
|
@@ -2266,14 +2296,13 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2266
2296
|
width: '1.75rem'
|
|
2267
2297
|
}
|
|
2268
2298
|
}, React.createElement(FilterListIcon, null)))), filterChipLabel && React.createElement(Chip, {
|
|
2269
|
-
onDelete:
|
|
2299
|
+
onDelete: handleClearEmptyFilterChip,
|
|
2270
2300
|
label: filterChipLabel
|
|
2271
2301
|
})) : React.createElement(FilterListIcon, null),
|
|
2272
2302
|
endAdornment: !filterChipLabel && React.createElement(InputAdornment, {
|
|
2273
2303
|
position: "end"
|
|
2274
2304
|
}, React.createElement(Tooltip, {
|
|
2275
2305
|
arrow: true,
|
|
2276
|
-
disableHoverListener: isSelectFilter,
|
|
2277
2306
|
placement: "right",
|
|
2278
2307
|
title: (_localization$clearFi = localization.clearFilter) != null ? _localization$clearFi : ''
|
|
2279
2308
|
}, React.createElement("span", null, React.createElement(IconButton, {
|
|
@@ -2286,31 +2315,59 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2286
2315
|
width: '1.75rem'
|
|
2287
2316
|
}
|
|
2288
2317
|
}, React.createElement(CloseIcon, null)))))
|
|
2318
|
+
},
|
|
2319
|
+
SelectProps: {
|
|
2320
|
+
displayEmpty: true,
|
|
2321
|
+
multiple: isMultiSelectFilter,
|
|
2322
|
+
renderValue: isMultiSelectFilter ? function (selected) {
|
|
2323
|
+
return !(selected != null && selected.length) ? React.createElement(Box, {
|
|
2324
|
+
sx: {
|
|
2325
|
+
opacity: 0.5
|
|
2326
|
+
}
|
|
2327
|
+
}, filterPlaceholder) : React.createElement(Box, {
|
|
2328
|
+
sx: {
|
|
2329
|
+
display: 'flex',
|
|
2330
|
+
flexWrap: 'wrap',
|
|
2331
|
+
gap: '2px'
|
|
2332
|
+
}
|
|
2333
|
+
}, selected == null ? void 0 : selected.map(function (value) {
|
|
2334
|
+
return React.createElement(Chip, {
|
|
2335
|
+
key: value,
|
|
2336
|
+
label: value
|
|
2337
|
+
});
|
|
2338
|
+
}));
|
|
2339
|
+
} : undefined
|
|
2289
2340
|
}
|
|
2290
2341
|
}, textFieldProps, {
|
|
2291
2342
|
sx: function sx(theme) {
|
|
2292
2343
|
return _extends({
|
|
2293
|
-
m: '-0.25rem',
|
|
2294
2344
|
p: 0,
|
|
2295
|
-
minWidth: !filterChipLabel ? '
|
|
2345
|
+
minWidth: !filterChipLabel ? '6rem' : 'auto',
|
|
2296
2346
|
width: 'calc(100% + 0.5rem)',
|
|
2297
2347
|
'& .MuiSelect-icon': {
|
|
2298
2348
|
mr: '1.5rem'
|
|
2299
2349
|
}
|
|
2300
2350
|
}, (textFieldProps == null ? void 0 : textFieldProps.sx) instanceof Function ? textFieldProps.sx(theme) : textFieldProps == null ? void 0 : textFieldProps.sx);
|
|
2301
2351
|
}
|
|
2302
|
-
}), isSelectFilter && React.createElement(MenuItem, {
|
|
2352
|
+
}), (isSelectFilter || isMultiSelectFilter) && React.createElement(MenuItem, {
|
|
2303
2353
|
divider: true,
|
|
2304
|
-
disabled:
|
|
2354
|
+
disabled: true,
|
|
2355
|
+
hidden: true,
|
|
2305
2356
|
value: ""
|
|
2306
|
-
},
|
|
2357
|
+
}, React.createElement(Box, {
|
|
2358
|
+
sx: {
|
|
2359
|
+
opacity: 0.5
|
|
2360
|
+
}
|
|
2361
|
+
}, filterPlaceholder)), columnDef == null ? void 0 : (_columnDef$filterSele = columnDef.filterSelectOptions) == null ? void 0 : _columnDef$filterSele.map(function (option) {
|
|
2362
|
+
var _column$getFilterValu3;
|
|
2363
|
+
|
|
2307
2364
|
var value;
|
|
2308
2365
|
var text;
|
|
2309
2366
|
|
|
2310
|
-
if (typeof option
|
|
2367
|
+
if (typeof option !== 'object') {
|
|
2311
2368
|
value = option;
|
|
2312
2369
|
text = option;
|
|
2313
|
-
} else
|
|
2370
|
+
} else {
|
|
2314
2371
|
value = option.value;
|
|
2315
2372
|
text = option.text;
|
|
2316
2373
|
}
|
|
@@ -2318,7 +2375,12 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2318
2375
|
return React.createElement(MenuItem, {
|
|
2319
2376
|
key: value,
|
|
2320
2377
|
value: value
|
|
2321
|
-
},
|
|
2378
|
+
}, isMultiSelectFilter && React.createElement(Checkbox, {
|
|
2379
|
+
checked: ((_column$getFilterValu3 = column.getFilterValue()) != null ? _column$getFilterValu3 : []).includes(value),
|
|
2380
|
+
sx: {
|
|
2381
|
+
mr: '0.5rem'
|
|
2382
|
+
}
|
|
2383
|
+
}), React.createElement(ListItemText, null, text));
|
|
2322
2384
|
})), React.createElement(MRT_FilterOptionMenu, {
|
|
2323
2385
|
anchorEl: anchorEl,
|
|
2324
2386
|
header: header,
|
|
@@ -2338,11 +2400,11 @@ var MRT_FilterRangeFields = function MRT_FilterRangeFields(_ref) {
|
|
|
2338
2400
|
}
|
|
2339
2401
|
}, React.createElement(MRT_FilterTextField, {
|
|
2340
2402
|
header: header,
|
|
2341
|
-
|
|
2403
|
+
rangeFilterIndex: 0,
|
|
2342
2404
|
table: table
|
|
2343
2405
|
}), React.createElement(MRT_FilterTextField, {
|
|
2344
2406
|
header: header,
|
|
2345
|
-
|
|
2407
|
+
rangeFilterIndex: 1,
|
|
2346
2408
|
table: table
|
|
2347
2409
|
}));
|
|
2348
2410
|
};
|
|
@@ -2361,7 +2423,7 @@ var MRT_TableHeadCellFilterContainer = function MRT_TableHeadCellFilterContainer
|
|
|
2361
2423
|
"in": showColumnFilters,
|
|
2362
2424
|
mountOnEnter: true,
|
|
2363
2425
|
unmountOnExit: true
|
|
2364
|
-
}, currentFilterFns[column.id]
|
|
2426
|
+
}, ['between', 'betweenInclusive', 'inNumberRange'].includes(currentFilterFns[column.id]) ? React.createElement(MRT_FilterRangeFields, {
|
|
2365
2427
|
header: header,
|
|
2366
2428
|
table: table
|
|
2367
2429
|
}) : React.createElement(MRT_FilterTextField, {
|
|
@@ -2385,12 +2447,13 @@ var MRT_TableHeadCellFilterLabel = function MRT_TableHeadCellFilterLabel(_ref) {
|
|
|
2385
2447
|
|
|
2386
2448
|
var column = header.column;
|
|
2387
2449
|
var columnDef = column.columnDef;
|
|
2450
|
+
var isRangeFilter = ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
|
|
2388
2451
|
var currentFilterOption = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
|
|
2389
2452
|
var filterTooltip = localization.filteringByColumn.replace('{column}', String(columnDef.header)).replace('{filterType}', // @ts-ignore
|
|
2390
|
-
localization["filter" + ((currentFilterOption == null ? void 0 : (_currentFilterOption$ = currentFilterOption.charAt(0)) == null ? void 0 : _currentFilterOption$.toUpperCase()) + (currentFilterOption == null ? void 0 : currentFilterOption.slice(1)))]).replace('{filterValue}', "\"" + (Array.isArray(column.getFilterValue()) ? column.getFilterValue().join("\" " + localization.and + " \"") : column.getFilterValue()) + "\"").replace('" "', '');
|
|
2453
|
+
localization["filter" + ((currentFilterOption == null ? void 0 : (_currentFilterOption$ = currentFilterOption.charAt(0)) == null ? void 0 : _currentFilterOption$.toUpperCase()) + (currentFilterOption == null ? void 0 : currentFilterOption.slice(1)))]).replace('{filterValue}', "\"" + (Array.isArray(column.getFilterValue()) ? column.getFilterValue().join("\" " + (isRangeFilter ? localization.and : localization.or) + " \"") : column.getFilterValue()) + "\"").replace('" "', '');
|
|
2391
2454
|
return React.createElement(Grow, {
|
|
2392
2455
|
unmountOnExit: true,
|
|
2393
|
-
"in": !!column.getFilterValue() &&
|
|
2456
|
+
"in": !!column.getFilterValue() && isRangeFilter || !isRangeFilter && ( // @ts-ignore
|
|
2394
2457
|
!!((_column$getFilterValu = column.getFilterValue()) != null && _column$getFilterValu[0]) || !!((_column$getFilterValu2 = column.getFilterValue()) != null && _column$getFilterValu2[1]))
|
|
2395
2458
|
}, React.createElement("span", null, React.createElement(Tooltip, {
|
|
2396
2459
|
arrow: true,
|
|
@@ -2623,7 +2686,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
2623
2686
|
left: column.getIsPinned() === 'left' ? column.getStart('left') + "px" : undefined,
|
|
2624
2687
|
overflow: 'visible',
|
|
2625
2688
|
opacity: (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id || (currentHoveredColumn == null ? void 0 : currentHoveredColumn.id) === column.id ? 0.5 : 1,
|
|
2626
|
-
p: density === 'compact' ?
|
|
2689
|
+
p: density === 'compact' ? '0.5rem' : density === 'comfortable' ? columnDefType === 'display' ? '0.75rem' : '1rem' : columnDefType === 'display' ? '1rem 1.25rem' : '1.5rem',
|
|
2627
2690
|
pb: columnDefType === 'display' ? 0 : undefined,
|
|
2628
2691
|
position: column.getIsPinned() && columnDefType !== 'group' ? 'sticky' : undefined,
|
|
2629
2692
|
pt: columnDefType === 'group' ? 0 : density === 'compact' ? '0.25' : density === 'comfortable' ? '.75rem' : '1.25rem',
|
|
@@ -2924,6 +2987,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2924
2987
|
enableClickToCopy = _table$options.enableClickToCopy,
|
|
2925
2988
|
enableColumnOrdering = _table$options.enableColumnOrdering,
|
|
2926
2989
|
enableEditing = _table$options.enableEditing,
|
|
2990
|
+
enablePagination = _table$options.enablePagination,
|
|
2927
2991
|
enableRowNumbers = _table$options.enableRowNumbers,
|
|
2928
2992
|
muiTableBodyCellProps = _table$options.muiTableBodyCellProps,
|
|
2929
2993
|
muiTableBodyCellSkeletonProps = _table$options.muiTableBodyCellSkeletonProps,
|
|
@@ -2998,7 +3062,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2998
3062
|
var draggingBorders = draggingBorder ? {
|
|
2999
3063
|
borderLeft: draggingBorder,
|
|
3000
3064
|
borderRight: draggingBorder,
|
|
3001
|
-
borderBottom: row.index === table.getRowModel().rows.length - 1 ? draggingBorder : undefined
|
|
3065
|
+
borderBottom: row.index === (enablePagination ? table.getRowModel() : table.getPrePaginationRowModel()).rows.length - 1 ? draggingBorder : undefined
|
|
3002
3066
|
} : undefined;
|
|
3003
3067
|
return React.createElement(TableCell, Object.assign({
|
|
3004
3068
|
onDoubleClick: handleDoubleClick,
|
|
@@ -3201,19 +3265,23 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
|
|
|
3201
3265
|
|
|
3202
3266
|
return enablePagination ? getRowModel().rows : getPrePaginationRowModel().rows;
|
|
3203
3267
|
}, [enableGlobalFilterRankedResults, enableGlobalFilterRankedResults && globalFilter || !enablePagination ? getPrePaginationRowModel().rows : getRowModel().rows, globalFilter]);
|
|
3204
|
-
var rowVirtualizer = enableRowVirtualization ?
|
|
3205
|
-
|
|
3268
|
+
var rowVirtualizer = enableRowVirtualization ? useVirtualizer(_extends({
|
|
3269
|
+
estimateSize: function estimateSize() {
|
|
3270
|
+
return density === 'compact' ? 25 : 50;
|
|
3271
|
+
},
|
|
3206
3272
|
overscan: density === 'compact' ? 30 : 10,
|
|
3207
|
-
|
|
3208
|
-
|
|
3273
|
+
getScrollElement: function getScrollElement() {
|
|
3274
|
+
return tableContainerRef.current;
|
|
3275
|
+
},
|
|
3276
|
+
count: rows.length
|
|
3209
3277
|
}, virtualizerProps)) : {};
|
|
3210
|
-
var virtualRows = enableRowVirtualization ? rowVirtualizer.
|
|
3278
|
+
var virtualRows = enableRowVirtualization ? rowVirtualizer.getVirtualItems() : [];
|
|
3211
3279
|
var paddingTop = 0;
|
|
3212
3280
|
var paddingBottom = 0;
|
|
3213
3281
|
|
|
3214
3282
|
if (enableRowVirtualization) {
|
|
3215
|
-
paddingTop = virtualRows.length
|
|
3216
|
-
paddingBottom = virtualRows.length
|
|
3283
|
+
paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
3284
|
+
paddingBottom = !!virtualRows.length ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
|
|
3217
3285
|
}
|
|
3218
3286
|
|
|
3219
3287
|
return React.createElement(TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React.createElement("tr", null, React.createElement("td", {
|
|
@@ -3539,9 +3607,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
3539
3607
|
|
|
3540
3608
|
var _useState14 = useState(function () {
|
|
3541
3609
|
return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (col) {
|
|
3542
|
-
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$current7, _ref3, _col$id$toString2, _col$id2, _col$accessorKey2,
|
|
3610
|
+
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$current7, _ref3, _col$id$toString2, _col$id2, _col$accessorKey2, _ref4;
|
|
3543
3611
|
|
|
3544
|
-
return _ref4 = {}, _ref4[(_ref = (_col$id$toString = (_col$id = col.id) == null ? void 0 : _col$id.toString()) != null ? _col$id$toString : (_col$accessorKey = col.accessorKey) == null ? void 0 : _col$accessorKey.toString()) != null ? _ref : ''] = col.filterFn instanceof Function ? (_col$filterFn$name = col.filterFn.name) != null ? _col$filterFn$name : 'custom' : (_ref2 = (_col$filterFn = col.filterFn) != null ? _col$filterFn : initialState == null ? void 0 : (_initialState$current7 = initialState.currentFilterFns) == null ? void 0 : _initialState$current7[(_ref3 = (_col$id$toString2 = (_col$id2 = col.id) == null ? void 0 : _col$id2.toString()) != null ? _col$id$toString2 : (_col$accessorKey2 = col.accessorKey) == null ? void 0 : _col$accessorKey2.toString()) != null ? _ref3 : '']) != null ? _ref2 :
|
|
3612
|
+
return _ref4 = {}, _ref4[(_ref = (_col$id$toString = (_col$id = col.id) == null ? void 0 : _col$id.toString()) != null ? _col$id$toString : (_col$accessorKey = col.accessorKey) == null ? void 0 : _col$accessorKey.toString()) != null ? _ref : ''] = col.filterFn instanceof Function ? (_col$filterFn$name = col.filterFn.name) != null ? _col$filterFn$name : 'custom' : (_ref2 = (_col$filterFn = col.filterFn) != null ? _col$filterFn : initialState == null ? void 0 : (_initialState$current7 = initialState.currentFilterFns) == null ? void 0 : _initialState$current7[(_ref3 = (_col$id$toString2 = (_col$id2 = col.id) == null ? void 0 : _col$id2.toString()) != null ? _col$id$toString2 : (_col$accessorKey2 = col.accessorKey) == null ? void 0 : _col$accessorKey2.toString()) != null ? _ref3 : '']) != null ? _ref2 : getDefaultColumnFilterFn(col), _ref4;
|
|
3545
3613
|
})));
|
|
3546
3614
|
}),
|
|
3547
3615
|
currentFilterFns = _useState14[0],
|
|
@@ -3726,7 +3794,7 @@ var MaterialReactTable = (function (_ref) {
|
|
|
3726
3794
|
_ref$enableColumnActi = _ref.enableColumnActions,
|
|
3727
3795
|
enableColumnActions = _ref$enableColumnActi === void 0 ? true : _ref$enableColumnActi,
|
|
3728
3796
|
_ref$enableColumnFilt = _ref.enableColumnFilterChangeMode,
|
|
3729
|
-
enableColumnFilterChangeMode = _ref$enableColumnFilt === void 0 ?
|
|
3797
|
+
enableColumnFilterChangeMode = _ref$enableColumnFilt === void 0 ? false : _ref$enableColumnFilt,
|
|
3730
3798
|
_ref$enableColumnFilt2 = _ref.enableColumnFilters,
|
|
3731
3799
|
enableColumnFilters = _ref$enableColumnFilt2 === void 0 ? true : _ref$enableColumnFilt2,
|
|
3732
3800
|
_ref$enableColumnOrde = _ref.enableColumnOrdering,
|
|
@@ -3744,7 +3812,7 @@ var MaterialReactTable = (function (_ref) {
|
|
|
3744
3812
|
_ref$enableGlobalFilt = _ref.enableGlobalFilter,
|
|
3745
3813
|
enableGlobalFilter = _ref$enableGlobalFilt === void 0 ? true : _ref$enableGlobalFilt,
|
|
3746
3814
|
_ref$enableGlobalFilt2 = _ref.enableGlobalFilterChangeMode,
|
|
3747
|
-
enableGlobalFilterChangeMode = _ref$enableGlobalFilt2 === void 0 ?
|
|
3815
|
+
enableGlobalFilterChangeMode = _ref$enableGlobalFilt2 === void 0 ? false : _ref$enableGlobalFilt2,
|
|
3748
3816
|
_ref$enableGlobalFilt3 = _ref.enableGlobalFilterRankedResults,
|
|
3749
3817
|
enableGlobalFilterRankedResults = _ref$enableGlobalFilt3 === void 0 ? true : _ref$enableGlobalFilt3,
|
|
3750
3818
|
_ref$enableGrouping = _ref.enableGrouping,
|