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.
@@ -10,7 +10,7 @@ var iconsMaterial = require('@mui/icons-material');
10
10
  var reactTable = require('@tanstack/react-table');
11
11
  var material = require('@mui/material');
12
12
  var matchSorterUtils = require('@tanstack/match-sorter-utils');
13
- var reactVirtual = require('react-virtual');
13
+ var reactVirtual = require('@tanstack/react-virtual');
14
14
 
15
15
  function _extends() {
16
16
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -59,6 +59,9 @@ var MRT_DefaultLocalization_EN = {
59
59
  edit: 'Edit',
60
60
  expand: 'Expand',
61
61
  expandAll: 'Expand all',
62
+ filterArrIncludes: 'Includes',
63
+ filterArrIncludesAll: 'Includes all',
64
+ filterArrIncludesSome: 'Includes',
62
65
  filterBetween: 'Between',
63
66
  filterBetweenInclusive: 'Between Inclusive',
64
67
  filterByColumn: 'Filter by {column}',
@@ -66,15 +69,20 @@ var MRT_DefaultLocalization_EN = {
66
69
  filterEmpty: 'Empty',
67
70
  filterEndsWith: 'Ends With',
68
71
  filterEquals: 'Equals',
72
+ filterEqualsString: 'Equals',
69
73
  filterFuzzy: 'Fuzzy',
70
74
  filterGreaterThan: 'Greater Than',
71
75
  filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
76
+ filterInNumberRange: 'Between',
77
+ filterIncludesString: 'Contains',
78
+ filterIncludesStringSensitive: 'Contains',
72
79
  filterLessThan: 'Less Than',
73
80
  filterLessThanOrEqualTo: 'Less Than Or Equal To',
74
81
  filterMode: 'Filter Mode: {filterType}',
75
82
  filterNotEmpty: 'Not Empty',
76
83
  filterNotEquals: 'Not Equals',
77
84
  filterStartsWith: 'Starts With',
85
+ filterWeakEquals: 'Equals',
78
86
  filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
79
87
  grab: 'Grab',
80
88
  groupByColumn: 'Group by {column}',
@@ -84,6 +92,7 @@ var MRT_DefaultLocalization_EN = {
84
92
  max: 'Max',
85
93
  min: 'Min',
86
94
  move: 'Move',
95
+ or: 'or',
87
96
  pinToLeft: 'Pin to left',
88
97
  pinToRight: 'Pin to right',
89
98
  resetColumnSize: 'Reset column size',
@@ -182,7 +191,8 @@ var MRT_ExpandAllButton = function MRT_ExpandAllButton(_ref) {
182
191
  }, iconButtonProps, {
183
192
  sx: _extends({
184
193
  height: density === 'compact' ? '1.75rem' : '2.25rem',
185
- width: density === 'compact' ? '1.75rem' : '2.25rem'
194
+ width: density === 'compact' ? '1.75rem' : '2.25rem',
195
+ mt: density !== 'compact' ? '-0.25rem' : undefined
186
196
  }, iconButtonProps == null ? void 0 : iconButtonProps.sx)
187
197
  }), React__default.createElement(KeyboardDoubleArrowDownIcon, {
188
198
  style: {
@@ -238,8 +248,81 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
238
248
  }))));
239
249
  };
240
250
 
251
+ var internalFilterOptions = function internalFilterOptions(localization) {
252
+ return [{
253
+ option: 'fuzzy',
254
+ symbol: '≈',
255
+ label: localization.filterFuzzy,
256
+ divider: false
257
+ }, {
258
+ option: 'contains',
259
+ symbol: '*',
260
+ label: localization.filterContains,
261
+ divider: false
262
+ }, {
263
+ option: 'startsWith',
264
+ symbol: 'a',
265
+ label: localization.filterStartsWith,
266
+ divider: false
267
+ }, {
268
+ option: 'endsWith',
269
+ symbol: 'z',
270
+ label: localization.filterEndsWith,
271
+ divider: true
272
+ }, {
273
+ option: 'equals',
274
+ symbol: '=',
275
+ label: localization.filterEquals,
276
+ divider: false
277
+ }, {
278
+ option: 'notEquals',
279
+ symbol: '≠',
280
+ label: localization.filterNotEquals,
281
+ divider: true
282
+ }, {
283
+ option: 'between',
284
+ symbol: '⇿',
285
+ label: localization.filterBetween,
286
+ divider: false
287
+ }, {
288
+ option: 'betweenInclusive',
289
+ symbol: '⬌',
290
+ label: localization.filterBetweenInclusive,
291
+ divider: true
292
+ }, {
293
+ option: 'greaterThan',
294
+ symbol: '>',
295
+ label: localization.filterGreaterThan,
296
+ divider: false
297
+ }, {
298
+ option: 'greaterThanOrEqualTo',
299
+ symbol: '≥',
300
+ label: localization.filterGreaterThanOrEqualTo,
301
+ divider: false
302
+ }, {
303
+ option: 'lessThan',
304
+ symbol: '<',
305
+ label: localization.filterLessThan,
306
+ divider: false
307
+ }, {
308
+ option: 'lessThanOrEqualTo',
309
+ symbol: '≤',
310
+ label: localization.filterLessThanOrEqualTo,
311
+ divider: true
312
+ }, {
313
+ option: 'empty',
314
+ symbol: '∅',
315
+ label: localization.filterEmpty,
316
+ divider: false
317
+ }, {
318
+ option: 'notEmpty',
319
+ symbol: '!∅',
320
+ label: localization.filterNotEmpty,
321
+ divider: false
322
+ }];
323
+ };
241
324
  var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
242
- var _columnDef$enabledCol;
325
+ var _columnDef$columnFilt;
243
326
 
244
327
  var anchorEl = _ref.anchorEl,
245
328
  header = _ref.header,
@@ -249,7 +332,7 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
249
332
  var getState = table.getState,
250
333
  _table$options = table.options,
251
334
  enabledGlobalFilterOptions = _table$options.enabledGlobalFilterOptions,
252
- enabledColumnFilterOptions = _table$options.enabledColumnFilterOptions,
335
+ columnFilterModeOptions = _table$options.columnFilterModeOptions,
253
336
  localization = _table$options.localization,
254
337
  setCurrentFilterFns = table.setCurrentFilterFns,
255
338
  setCurrentGlobalFilterFn = table.setCurrentGlobalFilterFn;
@@ -265,80 +348,10 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
265
348
  var _ref3 = column != null ? column : {},
266
349
  columnDef = _ref3.columnDef;
267
350
 
268
- var allowedColumnFilterOptions = (_columnDef$enabledCol = columnDef == null ? void 0 : columnDef.enabledColumnFilterOptions) != null ? _columnDef$enabledCol : enabledColumnFilterOptions;
351
+ var allowedColumnFilterOptions = (_columnDef$columnFilt = columnDef == null ? void 0 : columnDef.columnFilterModeOptions) != null ? _columnDef$columnFilt : columnFilterModeOptions;
269
352
  var filterOptions = React.useMemo(function () {
270
- return [{
271
- option: 'fuzzy',
272
- symbol: '≈',
273
- label: localization.filterFuzzy,
274
- divider: false
275
- }, {
276
- option: 'contains',
277
- symbol: '*',
278
- label: localization.filterContains,
279
- divider: false
280
- }, {
281
- option: 'startsWith',
282
- symbol: 'a',
283
- label: localization.filterStartsWith,
284
- divider: false
285
- }, {
286
- option: 'endsWith',
287
- symbol: 'z',
288
- label: localization.filterEndsWith,
289
- divider: true
290
- }, {
291
- option: 'equals',
292
- symbol: '=',
293
- label: localization.filterEquals,
294
- divider: false
295
- }, {
296
- option: 'notEquals',
297
- symbol: '≠',
298
- label: localization.filterNotEquals,
299
- divider: true
300
- }, {
301
- option: 'between',
302
- symbol: '⇿',
303
- label: localization.filterBetween,
304
- divider: false
305
- }, {
306
- option: 'betweenInclusive',
307
- symbol: '⬌',
308
- label: localization.filterBetweenInclusive,
309
- divider: true
310
- }, {
311
- option: 'greaterThan',
312
- symbol: '>',
313
- label: localization.filterGreaterThan,
314
- divider: false
315
- }, {
316
- option: 'greaterThanOrEqualTo',
317
- symbol: '≥',
318
- label: localization.filterGreaterThanOrEqualTo,
319
- divider: false
320
- }, {
321
- option: 'lessThan',
322
- symbol: '<',
323
- label: localization.filterLessThan,
324
- divider: false
325
- }, {
326
- option: 'lessThanOrEqualTo',
327
- symbol: '≤',
328
- label: localization.filterLessThanOrEqualTo,
329
- divider: true
330
- }, {
331
- option: 'empty',
332
- symbol: '∅',
333
- label: localization.filterEmpty,
334
- divider: false
335
- }, {
336
- option: 'notEmpty',
337
- symbol: '!∅',
338
- label: localization.filterNotEmpty,
339
- divider: false
340
- }].filter(function (filterType) {
341
- return columnDef ? allowedColumnFilterOptions === undefined || (allowedColumnFilterOptions == null ? void 0 : allowedColumnFilterOptions.includes(filterType.option)) : (!enabledGlobalFilterOptions || enabledGlobalFilterOptions.includes(filterType.option)) && ['fuzzy', 'contains'].includes(filterType.option);
353
+ return internalFilterOptions(localization).filter(function (filterOption) {
354
+ return columnDef ? allowedColumnFilterOptions === undefined || (allowedColumnFilterOptions == null ? void 0 : allowedColumnFilterOptions.includes(filterOption.option)) : (!enabledGlobalFilterOptions || enabledGlobalFilterOptions.includes(filterOption.option)) && ['fuzzy', 'contains'].includes(filterOption.option);
342
355
  });
343
356
  }, []);
344
357
 
@@ -705,7 +718,9 @@ var prepareColumns = function prepareColumns(columnDefs, currentFilterFns) {
705
718
  if (Object.keys(MRT_FilterFns).includes(currentFilterFns[columnDef.id])) {
706
719
  var _MRT_FilterFns$curren;
707
720
 
708
- columnDef.filterFn = (_MRT_FilterFns$curren = MRT_FilterFns[currentFilterFns[columnDef.id]]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy;
721
+ columnDef.filterFn = (_MRT_FilterFns$curren = MRT_FilterFns[currentFilterFns[columnDef.id]]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy; //@ts-ignore
722
+
723
+ columnDef._filterFn = currentFilterFns[columnDef.id];
709
724
  }
710
725
 
711
726
  if (Object.keys(MRT_SortingFns).includes(columnDef.sortingFn)) {
@@ -736,6 +751,12 @@ var getDefaultColumnOrderIds = function getDefaultColumnOrderIds(props) {
736
751
  return getColumnId(columnDef);
737
752
  }), getTrailingDisplayColumnIds(props)).filter(Boolean);
738
753
  };
754
+ var getDefaultColumnFilterFn = function getDefaultColumnFilterFn(columnDef) {
755
+ if (columnDef.filterVariant === 'multiSelect') return 'arrIncludesSome';
756
+ if (columnDef.filterVariant === 'select') return 'equals';
757
+ if (columnDef.filterVariant === 'range') return 'betweenInclusive';
758
+ return 'fuzzy';
759
+ };
739
760
 
740
761
  var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
741
762
  var _column$columns2;
@@ -987,7 +1008,7 @@ var commonListItemStyles = {
987
1008
  alignItems: 'center'
988
1009
  };
989
1010
  var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
990
- var _columnDef$enabledCol, _localization$sortByC, _localization$sortByC2, _localization$filterB, _localization, _localization$hideCol, _localization$showAll;
1011
+ var _columnDef$columnFilt, _localization$sortByC, _localization$sortByC2, _localization$filterB, _localization, _localization$hideCol, _localization$showAll;
991
1012
 
992
1013
  var anchorEl = _ref.anchorEl,
993
1014
  header = _ref.header,
@@ -1004,7 +1025,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
1004
1025
  enableHiding = _table$options.enableHiding,
1005
1026
  enablePinning = _table$options.enablePinning,
1006
1027
  enableSorting = _table$options.enableSorting,
1007
- enabledColumnFilterOptions = _table$options.enabledColumnFilterOptions,
1028
+ columnFilterModeOptions = _table$options.columnFilterModeOptions,
1008
1029
  _table$options$icons = _table$options.icons,
1009
1030
  ArrowRightIcon = _table$options$icons.ArrowRightIcon,
1010
1031
  ClearAllIcon = _table$options$icons.ClearAllIcon,
@@ -1105,7 +1126,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
1105
1126
  };
1106
1127
 
1107
1128
  var isSelectFilter = !!columnDef.filterSelectOptions;
1108
- var allowedColumnFilterOptions = (_columnDef$enabledCol = columnDef == null ? void 0 : columnDef.enabledColumnFilterOptions) != null ? _columnDef$enabledCol : enabledColumnFilterOptions;
1129
+ var allowedColumnFilterOptions = (_columnDef$columnFilt = columnDef == null ? void 0 : columnDef.columnFilterModeOptions) != null ? _columnDef$columnFilt : columnFilterModeOptions;
1109
1130
  var showFilterModeSubMenu = enableColumnFilterChangeMode && columnDef.enableColumnFilterChangeMode !== false && !isSelectFilter && (allowedColumnFilterOptions === undefined || !!(allowedColumnFilterOptions != null && allowedColumnFilterOptions.length));
1110
1131
  return React__default.createElement(material.Menu, {
1111
1132
  anchorEl: anchorEl,
@@ -1452,9 +1473,9 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
1452
1473
  }, checkboxProps, {
1453
1474
  sx: function sx(theme) {
1454
1475
  return _extends({
1455
- height: density === 'compact' ? '1.5rem' : '2rem',
1456
- width: density === 'compact' ? '1.5rem' : '2rem',
1457
- m: '-1re.m'
1476
+ height: density === 'compact' ? '1.75rem' : '2.5rem',
1477
+ width: density === 'compact' ? '1.75rem' : '2.5rem',
1478
+ m: density !== 'compact' ? '-0.4rem' : undefined
1458
1479
  }, (checkboxProps == null ? void 0 : checkboxProps.sx) instanceof Function ? checkboxProps.sx(theme) : checkboxProps == null ? void 0 : checkboxProps.sx);
1459
1480
  }
1460
1481
  })));
@@ -2120,15 +2141,15 @@ var MRT_TableHeadCellColumnActionsButton = function MRT_TableHeadCellColumnActio
2120
2141
  };
2121
2142
 
2122
2143
  var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2123
- var _currentFilterOption$, _localization$filterB, _columnDef$enabledCol, _currentFilterOption$2, _localization$clearFi, _columnDef$filterSele;
2144
+ var _currentFilterOption$, _localization$filterB, _columnDef$columnFilt, _currentFilterOption$2, _localization$clearFi, _columnDef$filterSele;
2124
2145
 
2125
2146
  var header = _ref.header,
2126
- inputIndex = _ref.inputIndex,
2147
+ rangeFilterIndex = _ref.rangeFilterIndex,
2127
2148
  table = _ref.table;
2128
2149
  var getState = table.getState,
2129
2150
  _table$options = table.options,
2130
2151
  enableColumnFilterChangeMode = _table$options.enableColumnFilterChangeMode,
2131
- enabledColumnFilterOptions = _table$options.enabledColumnFilterOptions,
2152
+ columnFilterModeOptions = _table$options.columnFilterModeOptions,
2132
2153
  _table$options$icons = _table$options.icons,
2133
2154
  FilterListIcon = _table$options$icons.FilterListIcon,
2134
2155
  CloseIcon = _table$options$icons.CloseIcon,
@@ -2142,25 +2163,39 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2142
2163
  var _getState = getState(),
2143
2164
  currentFilterFns = _getState.currentFilterFns;
2144
2165
 
2145
- var _useState = React.useState(null),
2146
- anchorEl = _useState[0],
2147
- setAnchorEl = _useState[1];
2148
-
2149
2166
  var mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function ? muiTableHeadCellFilterTextFieldProps({
2150
2167
  column: column,
2151
- table: table
2168
+ table: table,
2169
+ rangeFilterIndex: rangeFilterIndex
2152
2170
  }) : muiTableHeadCellFilterTextFieldProps;
2153
2171
  var mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function ? columnDef.muiTableHeadCellFilterTextFieldProps({
2154
2172
  column: column,
2155
- table: table
2173
+ table: table,
2174
+ rangeFilterIndex: rangeFilterIndex
2156
2175
  }) : columnDef.muiTableHeadCellFilterTextFieldProps;
2157
2176
 
2158
2177
  var textFieldProps = _extends({}, mTableHeadCellFilterTextFieldProps, mcTableHeadCellFilterTextFieldProps);
2159
2178
 
2179
+ var isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
2180
+ var isSelectFilter = columnDef.filterVariant === 'select';
2181
+ var isMultiSelectFilter = columnDef.filterVariant === 'multiSelect';
2182
+ var isTextboxFilter = !isSelectFilter && !isMultiSelectFilter;
2183
+ var currentFilterOption = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
2184
+ var filterId = "mrt-" + tableId + "-" + header.id + "-filter-text-field" + (rangeFilterIndex != null ? rangeFilterIndex : '');
2185
+ var filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption) ? //@ts-ignore
2186
+ 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)))] : '';
2187
+ 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 : '';
2188
+ var allowedColumnFilterOptions = (_columnDef$columnFilt = columnDef == null ? void 0 : columnDef.columnFilterModeOptions) != null ? _columnDef$columnFilt : columnFilterModeOptions;
2189
+ var showChangeModeButton = enableColumnFilterChangeMode && columnDef.enableColumnFilterChangeMode !== false && !rangeFilterIndex && (allowedColumnFilterOptions === undefined || !!(allowedColumnFilterOptions != null && allowedColumnFilterOptions.length));
2190
+
2191
+ var _useState = React.useState(null),
2192
+ anchorEl = _useState[0],
2193
+ setAnchorEl = _useState[1];
2194
+
2160
2195
  var _useState2 = React.useState(function () {
2161
- var _column$getFilterValu, _column$getFilterValu2, _column$getFilterValu3;
2196
+ var _column$getFilterValu, _column$getFilterValu2;
2162
2197
 
2163
- return inputIndex !== undefined ? (_column$getFilterValu = (_column$getFilterValu2 = column.getFilterValue()) == null ? void 0 : _column$getFilterValu2[inputIndex]) != null ? _column$getFilterValu : '' : (_column$getFilterValu3 = column.getFilterValue()) != null ? _column$getFilterValu3 : '';
2198
+ return isMultiSelectFilter ? column.getFilterValue() || [] : isRangeFilter ? ((_column$getFilterValu = column.getFilterValue()) == null ? void 0 : _column$getFilterValu[rangeFilterIndex]) || [] : (_column$getFilterValu2 = column.getFilterValue()) != null ? _column$getFilterValu2 : '';
2164
2199
  }),
2165
2200
  filterValue = _useState2[0],
2166
2201
  setFilterValue = _useState2[1];
@@ -2168,41 +2203,40 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2168
2203
  var handleChangeDebounced = React.useCallback(material.debounce(function (event) {
2169
2204
  var value = textFieldProps.type === 'date' ? new Date(event.target.value) : event.target.value;
2170
2205
 
2171
- if (inputIndex !== undefined) {
2206
+ if (isRangeFilter) {
2172
2207
  column.setFilterValue(function (old) {
2173
2208
  var newFilterValues = old != null ? old : ['', ''];
2174
- newFilterValues[inputIndex] = value;
2209
+ newFilterValues[rangeFilterIndex] = value;
2175
2210
  return newFilterValues;
2176
2211
  });
2177
2212
  } else {
2178
2213
  column.setFilterValue(value != null ? value : undefined);
2179
2214
  }
2180
- }, 200), []);
2215
+ }, isTextboxFilter ? 200 : 1), []);
2181
2216
 
2182
2217
  var handleChange = function handleChange(event) {
2183
2218
  setFilterValue(event.target.value);
2184
2219
  handleChangeDebounced(event);
2185
2220
  };
2186
2221
 
2187
- var handleFilterMenuOpen = function handleFilterMenuOpen(event) {
2188
- setAnchorEl(event.currentTarget);
2189
- };
2190
-
2191
2222
  var handleClear = function handleClear() {
2192
- setFilterValue('');
2193
-
2194
- if (inputIndex !== undefined) {
2223
+ if (isMultiSelectFilter) {
2224
+ setFilterValue([]);
2225
+ column.setFilterValue([]);
2226
+ } else if (isRangeFilter) {
2227
+ setFilterValue('');
2195
2228
  column.setFilterValue(function (old) {
2196
2229
  var newFilterValues = old != null ? old : ['', ''];
2197
- newFilterValues[inputIndex] = undefined;
2230
+ newFilterValues[rangeFilterIndex] = undefined;
2198
2231
  return newFilterValues;
2199
2232
  });
2200
2233
  } else {
2234
+ setFilterValue('');
2201
2235
  column.setFilterValue(undefined);
2202
2236
  }
2203
2237
  };
2204
2238
 
2205
- var handleClearFilterChip = function handleClearFilterChip() {
2239
+ var handleClearEmptyFilterChip = function handleClearEmptyFilterChip() {
2206
2240
  setFilterValue('');
2207
2241
  column.setFilterValue(undefined);
2208
2242
  setCurrentFilterFns(function (prev) {
@@ -2212,6 +2246,10 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2212
2246
  });
2213
2247
  };
2214
2248
 
2249
+ var handleFilterMenuOpen = function handleFilterMenuOpen(event) {
2250
+ setAnchorEl(event.currentTarget);
2251
+ };
2252
+
2215
2253
  if (columnDef.Filter) {
2216
2254
  return React__default.createElement(React__default.Fragment, null, columnDef.Filter == null ? void 0 : columnDef.Filter({
2217
2255
  header: header,
@@ -2219,14 +2257,6 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2219
2257
  }));
2220
2258
  }
2221
2259
 
2222
- var filterId = "mrt-" + tableId + "-" + header.id + "-filter-text-field" + (inputIndex != null ? inputIndex : '');
2223
- var currentFilterOption = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
2224
- var isSelectFilter = !!columnDef.filterSelectOptions;
2225
- var filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption) ? //@ts-ignore
2226
- localization["filter" + ((currentFilterOption == null ? void 0 : (_currentFilterOption$ = currentFilterOption.charAt(0)) == null ? void 0 : _currentFilterOption$.toUpperCase()) + (currentFilterOption == null ? void 0 : currentFilterOption.slice(1)))] : '';
2227
- 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 : '';
2228
- var allowedColumnFilterOptions = (_columnDef$enabledCol = columnDef == null ? void 0 : columnDef.enabledColumnFilterOptions) != null ? _columnDef$enabledCol : enabledColumnFilterOptions;
2229
- var showChangeModeButton = enableColumnFilterChangeMode && columnDef.enableColumnFilterChangeMode !== false && !isSelectFilter && !inputIndex && (allowedColumnFilterOptions === undefined || !!(allowedColumnFilterOptions != null && allowedColumnFilterOptions.length));
2230
2260
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.TextField, Object.assign({
2231
2261
  fullWidth: true,
2232
2262
  id: filterId,
@@ -2250,13 +2280,13 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2250
2280
  }
2251
2281
  },
2252
2282
  margin: "none",
2253
- placeholder: filterChipLabel || isSelectFilter ? undefined : filterPlaceholder,
2283
+ placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter ? undefined : filterPlaceholder,
2254
2284
  onChange: handleChange,
2255
2285
  onClick: function onClick(e) {
2256
2286
  return e.stopPropagation();
2257
2287
  },
2258
- select: isSelectFilter,
2259
- value: filterValue != null ? filterValue : '',
2288
+ select: isSelectFilter || isMultiSelectFilter,
2289
+ value: filterValue,
2260
2290
  variant: "standard",
2261
2291
  InputProps: {
2262
2292
  startAdornment: showChangeModeButton ? React__default.createElement(material.InputAdornment, {
@@ -2273,14 +2303,13 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2273
2303
  width: '1.75rem'
2274
2304
  }
2275
2305
  }, React__default.createElement(FilterListIcon, null)))), filterChipLabel && React__default.createElement(material.Chip, {
2276
- onDelete: handleClearFilterChip,
2306
+ onDelete: handleClearEmptyFilterChip,
2277
2307
  label: filterChipLabel
2278
2308
  })) : React__default.createElement(FilterListIcon, null),
2279
2309
  endAdornment: !filterChipLabel && React__default.createElement(material.InputAdornment, {
2280
2310
  position: "end"
2281
2311
  }, React__default.createElement(material.Tooltip, {
2282
2312
  arrow: true,
2283
- disableHoverListener: isSelectFilter,
2284
2313
  placement: "right",
2285
2314
  title: (_localization$clearFi = localization.clearFilter) != null ? _localization$clearFi : ''
2286
2315
  }, React__default.createElement("span", null, React__default.createElement(material.IconButton, {
@@ -2293,31 +2322,59 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2293
2322
  width: '1.75rem'
2294
2323
  }
2295
2324
  }, React__default.createElement(CloseIcon, null)))))
2325
+ },
2326
+ SelectProps: {
2327
+ displayEmpty: true,
2328
+ multiple: isMultiSelectFilter,
2329
+ renderValue: isMultiSelectFilter ? function (selected) {
2330
+ return !(selected != null && selected.length) ? React__default.createElement(material.Box, {
2331
+ sx: {
2332
+ opacity: 0.5
2333
+ }
2334
+ }, filterPlaceholder) : React__default.createElement(material.Box, {
2335
+ sx: {
2336
+ display: 'flex',
2337
+ flexWrap: 'wrap',
2338
+ gap: '2px'
2339
+ }
2340
+ }, selected == null ? void 0 : selected.map(function (value) {
2341
+ return React__default.createElement(material.Chip, {
2342
+ key: value,
2343
+ label: value
2344
+ });
2345
+ }));
2346
+ } : undefined
2296
2347
  }
2297
2348
  }, textFieldProps, {
2298
2349
  sx: function sx(theme) {
2299
2350
  return _extends({
2300
- m: '-0.25rem',
2301
2351
  p: 0,
2302
- minWidth: !filterChipLabel ? '8rem' : 'auto',
2352
+ minWidth: !filterChipLabel ? '6rem' : 'auto',
2303
2353
  width: 'calc(100% + 0.5rem)',
2304
2354
  '& .MuiSelect-icon': {
2305
2355
  mr: '1.5rem'
2306
2356
  }
2307
2357
  }, (textFieldProps == null ? void 0 : textFieldProps.sx) instanceof Function ? textFieldProps.sx(theme) : textFieldProps == null ? void 0 : textFieldProps.sx);
2308
2358
  }
2309
- }), isSelectFilter && React__default.createElement(material.MenuItem, {
2359
+ }), (isSelectFilter || isMultiSelectFilter) && React__default.createElement(material.MenuItem, {
2310
2360
  divider: true,
2311
- disabled: !filterValue,
2361
+ disabled: true,
2362
+ hidden: true,
2312
2363
  value: ""
2313
- }, localization.clearFilter), columnDef == null ? void 0 : (_columnDef$filterSele = columnDef.filterSelectOptions) == null ? void 0 : _columnDef$filterSele.map(function (option) {
2364
+ }, React__default.createElement(material.Box, {
2365
+ sx: {
2366
+ opacity: 0.5
2367
+ }
2368
+ }, filterPlaceholder)), columnDef == null ? void 0 : (_columnDef$filterSele = columnDef.filterSelectOptions) == null ? void 0 : _columnDef$filterSele.map(function (option) {
2369
+ var _column$getFilterValu3;
2370
+
2314
2371
  var value;
2315
2372
  var text;
2316
2373
 
2317
- if (typeof option === 'string') {
2374
+ if (typeof option !== 'object') {
2318
2375
  value = option;
2319
2376
  text = option;
2320
- } else if (typeof option === 'object') {
2377
+ } else {
2321
2378
  value = option.value;
2322
2379
  text = option.text;
2323
2380
  }
@@ -2325,7 +2382,12 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2325
2382
  return React__default.createElement(material.MenuItem, {
2326
2383
  key: value,
2327
2384
  value: value
2328
- }, text);
2385
+ }, isMultiSelectFilter && React__default.createElement(material.Checkbox, {
2386
+ checked: ((_column$getFilterValu3 = column.getFilterValue()) != null ? _column$getFilterValu3 : []).includes(value),
2387
+ sx: {
2388
+ mr: '0.5rem'
2389
+ }
2390
+ }), React__default.createElement(material.ListItemText, null, text));
2329
2391
  })), React__default.createElement(MRT_FilterOptionMenu, {
2330
2392
  anchorEl: anchorEl,
2331
2393
  header: header,
@@ -2345,11 +2407,11 @@ var MRT_FilterRangeFields = function MRT_FilterRangeFields(_ref) {
2345
2407
  }
2346
2408
  }, React__default.createElement(MRT_FilterTextField, {
2347
2409
  header: header,
2348
- inputIndex: 0,
2410
+ rangeFilterIndex: 0,
2349
2411
  table: table
2350
2412
  }), React__default.createElement(MRT_FilterTextField, {
2351
2413
  header: header,
2352
- inputIndex: 1,
2414
+ rangeFilterIndex: 1,
2353
2415
  table: table
2354
2416
  }));
2355
2417
  };
@@ -2368,7 +2430,7 @@ var MRT_TableHeadCellFilterContainer = function MRT_TableHeadCellFilterContainer
2368
2430
  "in": showColumnFilters,
2369
2431
  mountOnEnter: true,
2370
2432
  unmountOnExit: true
2371
- }, currentFilterFns[column.id] === 'between' ? React__default.createElement(MRT_FilterRangeFields, {
2433
+ }, ['between', 'betweenInclusive', 'inNumberRange'].includes(currentFilterFns[column.id]) ? React__default.createElement(MRT_FilterRangeFields, {
2372
2434
  header: header,
2373
2435
  table: table
2374
2436
  }) : React__default.createElement(MRT_FilterTextField, {
@@ -2392,12 +2454,13 @@ var MRT_TableHeadCellFilterLabel = function MRT_TableHeadCellFilterLabel(_ref) {
2392
2454
 
2393
2455
  var column = header.column;
2394
2456
  var columnDef = column.columnDef;
2457
+ var isRangeFilter = ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
2395
2458
  var currentFilterOption = currentFilterFns == null ? void 0 : currentFilterFns[header.id];
2396
2459
  var filterTooltip = localization.filteringByColumn.replace('{column}', String(columnDef.header)).replace('{filterType}', // @ts-ignore
2397
- 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('" "', '');
2460
+ 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('" "', '');
2398
2461
  return React__default.createElement(material.Grow, {
2399
2462
  unmountOnExit: true,
2400
- "in": !!column.getFilterValue() && currentFilterOption !== 'between' || currentFilterOption === 'between' && ( // @ts-ignore
2463
+ "in": !!column.getFilterValue() && isRangeFilter || !isRangeFilter && ( // @ts-ignore
2401
2464
  !!((_column$getFilterValu = column.getFilterValue()) != null && _column$getFilterValu[0]) || !!((_column$getFilterValu2 = column.getFilterValue()) != null && _column$getFilterValu2[1]))
2402
2465
  }, React__default.createElement("span", null, React__default.createElement(material.Tooltip, {
2403
2466
  arrow: true,
@@ -2630,7 +2693,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
2630
2693
  left: column.getIsPinned() === 'left' ? column.getStart('left') + "px" : undefined,
2631
2694
  overflow: 'visible',
2632
2695
  opacity: (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id || (currentHoveredColumn == null ? void 0 : currentHoveredColumn.id) === column.id ? 0.5 : 1,
2633
- p: density === 'compact' ? columnDefType === 'display' ? '0 0.5rem' : '0.5rem' : density === 'comfortable' ? columnDefType === 'display' ? '0.5rem 0.75rem' : '1rem' : columnDefType === 'display' ? '1rem 1.25rem' : '1.5rem',
2696
+ p: density === 'compact' ? '0.5rem' : density === 'comfortable' ? columnDefType === 'display' ? '0.75rem' : '1rem' : columnDefType === 'display' ? '1rem 1.25rem' : '1.5rem',
2634
2697
  pb: columnDefType === 'display' ? 0 : undefined,
2635
2698
  position: column.getIsPinned() && columnDefType !== 'group' ? 'sticky' : undefined,
2636
2699
  pt: columnDefType === 'group' ? 0 : density === 'compact' ? '0.25' : density === 'comfortable' ? '.75rem' : '1.25rem',
@@ -2931,6 +2994,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
2931
2994
  enableClickToCopy = _table$options.enableClickToCopy,
2932
2995
  enableColumnOrdering = _table$options.enableColumnOrdering,
2933
2996
  enableEditing = _table$options.enableEditing,
2997
+ enablePagination = _table$options.enablePagination,
2934
2998
  enableRowNumbers = _table$options.enableRowNumbers,
2935
2999
  muiTableBodyCellProps = _table$options.muiTableBodyCellProps,
2936
3000
  muiTableBodyCellSkeletonProps = _table$options.muiTableBodyCellSkeletonProps,
@@ -3005,7 +3069,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
3005
3069
  var draggingBorders = draggingBorder ? {
3006
3070
  borderLeft: draggingBorder,
3007
3071
  borderRight: draggingBorder,
3008
- borderBottom: row.index === table.getRowModel().rows.length - 1 ? draggingBorder : undefined
3072
+ borderBottom: row.index === (enablePagination ? table.getRowModel() : table.getPrePaginationRowModel()).rows.length - 1 ? draggingBorder : undefined
3009
3073
  } : undefined;
3010
3074
  return React__default.createElement(material.TableCell, Object.assign({
3011
3075
  onDoubleClick: handleDoubleClick,
@@ -3208,19 +3272,23 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
3208
3272
 
3209
3273
  return enablePagination ? getRowModel().rows : getPrePaginationRowModel().rows;
3210
3274
  }, [enableGlobalFilterRankedResults, enableGlobalFilterRankedResults && globalFilter || !enablePagination ? getPrePaginationRowModel().rows : getRowModel().rows, globalFilter]);
3211
- var rowVirtualizer = enableRowVirtualization ? reactVirtual.useVirtual(_extends({
3212
- // estimateSize: () => (density === 'compact' ? 25 : 50),
3275
+ var rowVirtualizer = enableRowVirtualization ? reactVirtual.useVirtualizer(_extends({
3276
+ estimateSize: function estimateSize() {
3277
+ return density === 'compact' ? 25 : 50;
3278
+ },
3213
3279
  overscan: density === 'compact' ? 30 : 10,
3214
- parentRef: tableContainerRef,
3215
- size: rows.length
3280
+ getScrollElement: function getScrollElement() {
3281
+ return tableContainerRef.current;
3282
+ },
3283
+ count: rows.length
3216
3284
  }, virtualizerProps)) : {};
3217
- var virtualRows = enableRowVirtualization ? rowVirtualizer.virtualItems : [];
3285
+ var virtualRows = enableRowVirtualization ? rowVirtualizer.getVirtualItems() : [];
3218
3286
  var paddingTop = 0;
3219
3287
  var paddingBottom = 0;
3220
3288
 
3221
3289
  if (enableRowVirtualization) {
3222
- paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
3223
- paddingBottom = virtualRows.length > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
3290
+ paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
3291
+ paddingBottom = !!virtualRows.length ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
3224
3292
  }
3225
3293
 
3226
3294
  return React__default.createElement(material.TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React__default.createElement("tr", null, React__default.createElement("td", {
@@ -3546,9 +3614,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3546
3614
 
3547
3615
  var _useState14 = React.useState(function () {
3548
3616
  return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (col) {
3549
- 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, _col$filterSelectOpti, _ref4;
3617
+ 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;
3550
3618
 
3551
- 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 : !!((_col$filterSelectOpti = col.filterSelectOptions) != null && _col$filterSelectOpti.length) ? 'equals' : 'fuzzy', _ref4;
3619
+ 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;
3552
3620
  })));
3553
3621
  }),
3554
3622
  currentFilterFns = _useState14[0],
@@ -3733,7 +3801,7 @@ var MaterialReactTable = (function (_ref) {
3733
3801
  _ref$enableColumnActi = _ref.enableColumnActions,
3734
3802
  enableColumnActions = _ref$enableColumnActi === void 0 ? true : _ref$enableColumnActi,
3735
3803
  _ref$enableColumnFilt = _ref.enableColumnFilterChangeMode,
3736
- enableColumnFilterChangeMode = _ref$enableColumnFilt === void 0 ? true : _ref$enableColumnFilt,
3804
+ enableColumnFilterChangeMode = _ref$enableColumnFilt === void 0 ? false : _ref$enableColumnFilt,
3737
3805
  _ref$enableColumnFilt2 = _ref.enableColumnFilters,
3738
3806
  enableColumnFilters = _ref$enableColumnFilt2 === void 0 ? true : _ref$enableColumnFilt2,
3739
3807
  _ref$enableColumnOrde = _ref.enableColumnOrdering,
@@ -3751,7 +3819,7 @@ var MaterialReactTable = (function (_ref) {
3751
3819
  _ref$enableGlobalFilt = _ref.enableGlobalFilter,
3752
3820
  enableGlobalFilter = _ref$enableGlobalFilt === void 0 ? true : _ref$enableGlobalFilt,
3753
3821
  _ref$enableGlobalFilt2 = _ref.enableGlobalFilterChangeMode,
3754
- enableGlobalFilterChangeMode = _ref$enableGlobalFilt2 === void 0 ? true : _ref$enableGlobalFilt2,
3822
+ enableGlobalFilterChangeMode = _ref$enableGlobalFilt2 === void 0 ? false : _ref$enableGlobalFilt2,
3755
3823
  _ref$enableGlobalFilt3 = _ref.enableGlobalFilterRankedResults,
3756
3824
  enableGlobalFilterRankedResults = _ref$enableGlobalFilt3 === void 0 ? true : _ref$enableGlobalFilt3,
3757
3825
  _ref$enableGrouping = _ref.enableGrouping,