material-react-table 0.33.4 → 0.34.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.
Files changed (60) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/MaterialReactTable.d.ts +6 -21
  3. package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +4 -5
  4. package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +3 -4
  5. package/dist/cjs/buttons/MRT_GrabHandleButton.d.ts +4 -4
  6. package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +3 -4
  7. package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +3 -4
  8. package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +3 -4
  9. package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +3 -4
  10. package/dist/cjs/index.d.ts +8 -2
  11. package/dist/cjs/index.js +2820 -0
  12. package/dist/cjs/index.js.map +1 -0
  13. package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +3 -4
  14. package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +3 -4
  15. package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +3 -4
  16. package/dist/cjs/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -8
  17. package/dist/cjs/table/MRT_TableRoot.d.ts +0 -1
  18. package/dist/cjs/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
  19. package/dist/esm/MaterialReactTable.d.ts +6 -21
  20. package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +4 -5
  21. package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +3 -4
  22. package/dist/esm/buttons/MRT_GrabHandleButton.d.ts +4 -4
  23. package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +3 -4
  24. package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +3 -4
  25. package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +3 -4
  26. package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +3 -4
  27. package/dist/esm/index.d.ts +8 -2
  28. package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +3 -4
  29. package/dist/esm/material-react-table.esm.js +2806 -0
  30. package/dist/esm/material-react-table.esm.js.map +1 -0
  31. package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +3 -4
  32. package/dist/esm/menus/MRT_ShowHideColumnsMenu.d.ts +3 -4
  33. package/dist/esm/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -8
  34. package/dist/esm/table/MRT_TableRoot.d.ts +0 -1
  35. package/dist/esm/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
  36. package/dist/index.d.ts +37 -22
  37. package/package.json +9 -10
  38. package/src/MaterialReactTable.tsx +11 -24
  39. package/src/body/MRT_TableBody.tsx +30 -11
  40. package/src/body/MRT_TableBodyCell.tsx +1 -1
  41. package/src/body/MRT_TableBodyRow.tsx +1 -1
  42. package/src/buttons/MRT_ColumnPinningButtons.tsx +10 -5
  43. package/src/buttons/MRT_FullScreenToggleButton.tsx +10 -4
  44. package/src/buttons/MRT_GrabHandleButton.tsx +5 -5
  45. package/src/buttons/MRT_ShowHideColumnsButton.tsx +10 -4
  46. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +10 -4
  47. package/src/buttons/MRT_ToggleFiltersButton.tsx +10 -4
  48. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +10 -4
  49. package/src/head/MRT_TableHeadCell.tsx +1 -1
  50. package/src/index.tsx +17 -3
  51. package/src/inputs/MRT_GlobalFilterTextField.tsx +7 -4
  52. package/src/menus/MRT_FilterOptionMenu.tsx +5 -5
  53. package/src/menus/MRT_ShowHideColumnsMenu.tsx +9 -7
  54. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +15 -13
  55. package/src/table/MRT_TableContainer.tsx +15 -4
  56. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +2 -7
  57. package/dist/cjs/index.min.js +0 -7398
  58. package/dist/cjs/index.min.js.map +0 -1
  59. package/dist/esm/material-react-table.esm.min.js +0 -7374
  60. package/dist/esm/material-react-table.esm.min.js.map +0 -1
@@ -0,0 +1,2820 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var reactTable = require('@tanstack/react-table');
7
+ var iconsMaterial = require('@mui/icons-material');
8
+ var matchSorterUtils = require('@tanstack/match-sorter-utils');
9
+ var material = require('@mui/material');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
+
15
+ /******************************************************************************
16
+ Copyright (c) Microsoft Corporation.
17
+
18
+ Permission to use, copy, modify, and/or distribute this software for any
19
+ purpose with or without fee is hereby granted.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
22
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
24
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
25
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
+ PERFORMANCE OF THIS SOFTWARE.
28
+ ***************************************************************************** */
29
+
30
+ function __rest(s, e) {
31
+ var t = {};
32
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
33
+ t[p] = s[p];
34
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
35
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
36
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
37
+ t[p[i]] = s[p[i]];
38
+ }
39
+ return t;
40
+ }
41
+
42
+ const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
43
+
44
+ const MRT_Default_Icons = {
45
+ ArrowRightIcon: iconsMaterial.ArrowRight,
46
+ CancelIcon: iconsMaterial.Cancel,
47
+ CheckBoxIcon: iconsMaterial.CheckBox,
48
+ ClearAllIcon: iconsMaterial.ClearAll,
49
+ CloseIcon: iconsMaterial.Close,
50
+ DensityLargeIcon: iconsMaterial.DensityLarge,
51
+ DensityMediumIcon: iconsMaterial.DensityMedium,
52
+ DensitySmallIcon: iconsMaterial.DensitySmall,
53
+ DragHandleIcon: iconsMaterial.DragHandle,
54
+ DynamicFeedIcon: iconsMaterial.DynamicFeed,
55
+ EditIcon: iconsMaterial.Edit,
56
+ ExpandLessIcon: iconsMaterial.ExpandLess,
57
+ ExpandMoreIcon: iconsMaterial.ExpandMore,
58
+ FilterAltIcon: iconsMaterial.FilterAlt,
59
+ FilterAltOffIcon: iconsMaterial.FilterAltOff,
60
+ FilterListIcon: iconsMaterial.FilterList,
61
+ FilterListOffIcon: iconsMaterial.FilterListOff,
62
+ FullscreenExitIcon: iconsMaterial.FullscreenExit,
63
+ FullscreenIcon: iconsMaterial.Fullscreen,
64
+ KeyboardDoubleArrowDownIcon: iconsMaterial.KeyboardDoubleArrowDown,
65
+ MoreHorizIcon: iconsMaterial.MoreHoriz,
66
+ MoreVertIcon: iconsMaterial.MoreVert,
67
+ PushPinIcon: iconsMaterial.PushPin,
68
+ RestartAltIcon: iconsMaterial.RestartAlt,
69
+ SaveIcon: iconsMaterial.Save,
70
+ SearchIcon: iconsMaterial.Search,
71
+ SearchOffIcon: iconsMaterial.SearchOff,
72
+ SortIcon: iconsMaterial.Sort,
73
+ ViewColumnIcon: iconsMaterial.ViewColumn,
74
+ VisibilityOffIcon: iconsMaterial.VisibilityOff,
75
+ };
76
+
77
+ const fuzzy$1 = (row, columnId, filterValue, addMeta) => {
78
+ const itemRank = matchSorterUtils.rankItem(row.getValue(columnId), filterValue, {
79
+ threshold: matchSorterUtils.rankings.MATCHES,
80
+ });
81
+ addMeta(itemRank);
82
+ return itemRank.passed;
83
+ };
84
+ fuzzy$1.autoRemove = (val) => !val;
85
+ const contains = (row, id, filterValue) => row
86
+ .getValue(id)
87
+ .toString()
88
+ .toLowerCase()
89
+ .trim()
90
+ .includes(filterValue.toString().toLowerCase().trim());
91
+ contains.autoRemove = (val) => !val;
92
+ const startsWith = (row, id, filterValue) => row
93
+ .getValue(id)
94
+ .toString()
95
+ .toLowerCase()
96
+ .trim()
97
+ .startsWith(filterValue.toString().toLowerCase().trim());
98
+ startsWith.autoRemove = (val) => !val;
99
+ const endsWith = (row, id, filterValue) => row
100
+ .getValue(id)
101
+ .toString()
102
+ .toLowerCase()
103
+ .trim()
104
+ .endsWith(filterValue.toString().toLowerCase().trim());
105
+ endsWith.autoRemove = (val) => !val;
106
+ const equals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() ===
107
+ filterValue.toString().toLowerCase().trim();
108
+ equals.autoRemove = (val) => !val;
109
+ const notEquals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() !==
110
+ filterValue.toString().toLowerCase().trim();
111
+ notEquals.autoRemove = (val) => !val;
112
+ const greaterThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
113
+ ? +row.getValue(id) > +filterValue
114
+ : row.getValue(id).toString().toLowerCase().trim() >
115
+ filterValue.toString().toLowerCase().trim();
116
+ greaterThan.autoRemove = (val) => !val;
117
+ const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
118
+ greaterThanOrEqualTo.autoRemove = (val) => !val;
119
+ const lessThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
120
+ ? +row.getValue(id) < +filterValue
121
+ : row.getValue(id).toString().toLowerCase().trim() <
122
+ filterValue.toString().toLowerCase().trim();
123
+ lessThan.autoRemove = (val) => !val;
124
+ const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
125
+ lessThanOrEqualTo.autoRemove = (val) => !val;
126
+ const between = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
127
+ greaterThan(row, id, filterValues[0])) &&
128
+ ((!isNaN(+filterValues[0]) &&
129
+ !isNaN(+filterValues[1]) &&
130
+ +filterValues[0] > +filterValues[1]) ||
131
+ ['', undefined].includes(filterValues[1]) ||
132
+ lessThan(row, id, filterValues[1]));
133
+ between.autoRemove = (val) => !val;
134
+ const betweenInclusive = (row, id, filterValues) => (['', undefined].includes(filterValues[0]) ||
135
+ greaterThanOrEqualTo(row, id, filterValues[0])) &&
136
+ ((!isNaN(+filterValues[0]) &&
137
+ !isNaN(+filterValues[1]) &&
138
+ +filterValues[0] > +filterValues[1]) ||
139
+ ['', undefined].includes(filterValues[1]) ||
140
+ lessThanOrEqualTo(row, id, filterValues[1]));
141
+ betweenInclusive.autoRemove = (val) => !val;
142
+ const empty = (row, id, _filterValue) => !row.getValue(id).toString().trim();
143
+ empty.autoRemove = (val) => !val;
144
+ const notEmpty = (row, id, _filterValue) => !!row.getValue(id).toString().trim();
145
+ notEmpty.autoRemove = (val) => !val;
146
+ const MRT_FilterFns = Object.assign(Object.assign({}, reactTable.filterFns), { between,
147
+ betweenInclusive,
148
+ contains,
149
+ empty,
150
+ endsWith,
151
+ equals,
152
+ fuzzy: fuzzy$1,
153
+ greaterThan,
154
+ greaterThanOrEqualTo,
155
+ lessThan,
156
+ lessThanOrEqualTo,
157
+ notEmpty,
158
+ notEquals,
159
+ startsWith });
160
+
161
+ const MRT_DefaultLocalization_EN = {
162
+ actions: 'Actions',
163
+ and: 'and',
164
+ cancel: 'Cancel',
165
+ changeFilterMode: 'Change filter mode',
166
+ changeSearchMode: 'Change search mode',
167
+ clearFilter: 'Clear filter',
168
+ clearSearch: 'Clear search',
169
+ clearSort: 'Clear sort',
170
+ clickToCopy: 'Click to copy',
171
+ columnActions: 'Column Actions',
172
+ copiedToClipboard: 'Copied to clipboard',
173
+ dropToGroupBy: 'Drop to group by {column}',
174
+ edit: 'Edit',
175
+ expand: 'Expand',
176
+ expandAll: 'Expand all',
177
+ filterArrIncludes: 'Includes',
178
+ filterArrIncludesAll: 'Includes all',
179
+ filterArrIncludesSome: 'Includes',
180
+ filterBetween: 'Between',
181
+ filterBetweenInclusive: 'Between Inclusive',
182
+ filterByColumn: 'Filter by {column}',
183
+ filterContains: 'Contains',
184
+ filterEmpty: 'Empty',
185
+ filterEndsWith: 'Ends With',
186
+ filterEquals: 'Equals',
187
+ filterEqualsString: 'Equals',
188
+ filterFuzzy: 'Fuzzy',
189
+ filterGreaterThan: 'Greater Than',
190
+ filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
191
+ filterInNumberRange: 'Between',
192
+ filterIncludesString: 'Contains',
193
+ filterIncludesStringSensitive: 'Contains',
194
+ filterLessThan: 'Less Than',
195
+ filterLessThanOrEqualTo: 'Less Than Or Equal To',
196
+ filterMode: 'Filter Mode: {filterType}',
197
+ filterNotEmpty: 'Not Empty',
198
+ filterNotEquals: 'Not Equals',
199
+ filterStartsWith: 'Starts With',
200
+ filterWeakEquals: 'Equals',
201
+ filteringByColumn: 'Filtering by {column} - {filterType} {filterValue}',
202
+ grab: 'Grab',
203
+ groupByColumn: 'Group by {column}',
204
+ groupedBy: 'Grouped by ',
205
+ hideAll: 'Hide all',
206
+ hideColumn: 'Hide {column} column',
207
+ max: 'Max',
208
+ min: 'Min',
209
+ move: 'Move',
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
+ save: 'Save',
219
+ search: 'Search',
220
+ selectedCountOfRowCountRowsSelected: '{selectedCount} of {rowCount} row(s) selected',
221
+ select: 'Select',
222
+ showAll: 'Show all',
223
+ showAllColumns: 'Show all columns',
224
+ showHideColumns: 'Show/Hide columns',
225
+ showHideFilters: 'Show/Hide filters',
226
+ showHideSearch: 'Show/Hide search',
227
+ sortByColumnAsc: 'Sort by {column} ascending',
228
+ sortByColumnDesc: 'Sort by {column} descending',
229
+ sortedByColumnAsc: 'Sorted by {column} ascending',
230
+ sortedByColumnDesc: 'Sorted by {column} descending',
231
+ thenBy: ', then by ',
232
+ toggleDensity: 'Toggle density',
233
+ toggleFullScreen: 'Toggle full screen',
234
+ toggleSelectAll: 'Toggle select all',
235
+ toggleSelectRow: 'Toggle select row',
236
+ toggleVisibility: 'Toggle visibility',
237
+ ungroupByColumn: 'Ungroup by {column}',
238
+ unpin: 'Unpin',
239
+ unpinAll: 'Unpin all',
240
+ unsorted: 'Unsorted',
241
+ };
242
+
243
+ const fuzzy = (rowA, rowB, columnId) => {
244
+ let dir = 0;
245
+ if (rowA.columnFiltersMeta[columnId]) {
246
+ dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
247
+ }
248
+ // Provide a fallback for when the item ranks are equal
249
+ return dir === 0
250
+ ? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
251
+ : dir;
252
+ };
253
+ const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy });
254
+ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
255
+ Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
256
+
257
+ const MRT_ExpandAllButton = ({ table }) => {
258
+ const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
259
+ const { density } = getState();
260
+ const iconButtonProps = muiExpandAllButtonProps instanceof Function
261
+ ? muiExpandAllButtonProps({ table })
262
+ : muiExpandAllButtonProps;
263
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.expandAll },
264
+ React__default["default"].createElement("span", null,
265
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: !getCanSomeRowsExpand() && !renderDetailPanel, onClick: () => toggleAllRowsExpanded(!getIsAllRowsExpanded()) }, iconButtonProps, { sx: Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) }),
266
+ React__default["default"].createElement(KeyboardDoubleArrowDownIcon, { style: {
267
+ transform: `rotate(${getIsAllRowsExpanded()
268
+ ? -180
269
+ : getIsSomeRowsExpanded()
270
+ ? -90
271
+ : 0}deg)`,
272
+ transition: 'transform 0.2s',
273
+ } })))));
274
+ };
275
+
276
+ const MRT_ExpandButton = ({ row, table }) => {
277
+ const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
278
+ const { density } = getState();
279
+ const iconButtonProps = muiExpandButtonProps instanceof Function
280
+ ? muiExpandButtonProps({ table, row })
281
+ : muiExpandButtonProps;
282
+ const handleToggleExpand = () => {
283
+ row.toggleExpanded();
284
+ };
285
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.expand },
286
+ React__default["default"].createElement("span", null,
287
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.expand, disabled: !row.getCanExpand() && !renderDetailPanel, onClick: handleToggleExpand }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
288
+ ? iconButtonProps.sx(theme)
289
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
290
+ React__default["default"].createElement(ExpandMoreIcon, { style: {
291
+ transform: `rotate(${!row.getCanExpand() && !renderDetailPanel
292
+ ? -90
293
+ : row.getIsExpanded()
294
+ ? -180
295
+ : 0}deg)`,
296
+ transition: 'transform 0.2s',
297
+ } })))));
298
+ };
299
+
300
+ const internalFilterOptions = (localization) => [
301
+ {
302
+ option: 'fuzzy',
303
+ symbol: '≈',
304
+ label: localization.filterFuzzy,
305
+ divider: false,
306
+ },
307
+ {
308
+ option: 'contains',
309
+ symbol: '*',
310
+ label: localization.filterContains,
311
+ divider: false,
312
+ },
313
+ {
314
+ option: 'startsWith',
315
+ symbol: 'a',
316
+ label: localization.filterStartsWith,
317
+ divider: false,
318
+ },
319
+ {
320
+ option: 'endsWith',
321
+ symbol: 'z',
322
+ label: localization.filterEndsWith,
323
+ divider: true,
324
+ },
325
+ {
326
+ option: 'equals',
327
+ symbol: '=',
328
+ label: localization.filterEquals,
329
+ divider: false,
330
+ },
331
+ {
332
+ option: 'notEquals',
333
+ symbol: '≠',
334
+ label: localization.filterNotEquals,
335
+ divider: true,
336
+ },
337
+ {
338
+ option: 'between',
339
+ symbol: '⇿',
340
+ label: localization.filterBetween,
341
+ divider: false,
342
+ },
343
+ {
344
+ option: 'betweenInclusive',
345
+ symbol: '⬌',
346
+ label: localization.filterBetweenInclusive,
347
+ divider: true,
348
+ },
349
+ {
350
+ option: 'greaterThan',
351
+ symbol: '>',
352
+ label: localization.filterGreaterThan,
353
+ divider: false,
354
+ },
355
+ {
356
+ option: 'greaterThanOrEqualTo',
357
+ symbol: '≥',
358
+ label: localization.filterGreaterThanOrEqualTo,
359
+ divider: false,
360
+ },
361
+ {
362
+ option: 'lessThan',
363
+ symbol: '<',
364
+ label: localization.filterLessThan,
365
+ divider: false,
366
+ },
367
+ {
368
+ option: 'lessThanOrEqualTo',
369
+ symbol: '≤',
370
+ label: localization.filterLessThanOrEqualTo,
371
+ divider: true,
372
+ },
373
+ {
374
+ option: 'empty',
375
+ symbol: '∅',
376
+ label: localization.filterEmpty,
377
+ divider: false,
378
+ },
379
+ {
380
+ option: 'notEmpty',
381
+ symbol: '!∅',
382
+ label: localization.filterNotEmpty,
383
+ divider: false,
384
+ },
385
+ ];
386
+ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
387
+ var _a;
388
+ const { getState, options: { enabledGlobalFilterOptions, columnFilterModeOptions, localization, }, setColumnFilterFns, setGlobalFilterFn, } = table;
389
+ const { columnFilterFns, globalFilterFn, density } = getState();
390
+ const { column } = header !== null && header !== void 0 ? header : {};
391
+ const { columnDef } = column !== null && column !== void 0 ? column : {};
392
+ const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
393
+ const filterOptions = React.useMemo(() => internalFilterOptions(localization).filter((filterOption) => columnDef
394
+ ? allowedColumnFilterOptions === undefined ||
395
+ (allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
396
+ : (!enabledGlobalFilterOptions ||
397
+ enabledGlobalFilterOptions.includes(filterOption.option)) &&
398
+ ['fuzzy', 'contains'].includes(filterOption.option)), []);
399
+ const handleSelectFilterType = (option) => {
400
+ if (header && column) {
401
+ setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
402
+ if (['empty', 'notEmpty'].includes(option)) {
403
+ column.setFilterValue(' ');
404
+ }
405
+ else if (option === 'between') {
406
+ column.setFilterValue(['', '']);
407
+ }
408
+ else {
409
+ column.setFilterValue('');
410
+ }
411
+ }
412
+ else {
413
+ setGlobalFilterFn(option);
414
+ }
415
+ setAnchorEl(null);
416
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect();
417
+ };
418
+ const filterOption = !!header ? columnFilterFns[header.id] : globalFilterFn;
419
+ return (React__default["default"].createElement(material.Menu, { anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
420
+ dense: density === 'compact',
421
+ } }, filterOptions.map(({ option, label, divider, symbol }, index) => (React__default["default"].createElement(material.MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterType(option), selected: option === filterOption, sx: {
422
+ py: '6px',
423
+ my: 0,
424
+ alignItems: 'center',
425
+ display: 'flex',
426
+ gap: '2ch',
427
+ }, value: option },
428
+ React__default["default"].createElement(material.Box, { sx: { fontSize: '1.25rem', width: '2ch' } }, symbol),
429
+ label)))));
430
+ };
431
+
432
+ const MRT_ColumnPinningButtons = ({ column, table, }) => {
433
+ const { options: { icons: { PushPinIcon }, localization, }, } = table;
434
+ const handlePinColumn = (pinDirection) => {
435
+ column.pin(pinDirection);
436
+ };
437
+ return (React__default["default"].createElement(material.Box, { sx: { minWidth: '70px', textAlign: 'center' } }, column.getIsPinned() ? (React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.unpin },
438
+ React__default["default"].createElement(material.IconButton, { onClick: () => handlePinColumn(false), size: "small" },
439
+ React__default["default"].createElement(PushPinIcon, null)))) : (React__default["default"].createElement(React__default["default"].Fragment, null,
440
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.pinToLeft },
441
+ React__default["default"].createElement(material.IconButton, { onClick: () => handlePinColumn('left'), size: "small" },
442
+ React__default["default"].createElement(PushPinIcon, { style: {
443
+ transform: 'rotate(90deg)',
444
+ } }))),
445
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.pinToRight },
446
+ React__default["default"].createElement(material.IconButton, { onClick: () => handlePinColumn('right'), size: "small" },
447
+ React__default["default"].createElement(PushPinIcon, { style: {
448
+ transform: 'rotate(-90deg)',
449
+ } })))))));
450
+ };
451
+
452
+ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
453
+ const { options: { icons: { DragHandleIcon }, localization, }, } = table;
454
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: localization.move },
455
+ React__default["default"].createElement(material.IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { sx: Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
456
+ backgroundColor: 'transparent',
457
+ opacity: 1,
458
+ }, '&:active': {
459
+ cursor: 'grabbing',
460
+ } }, iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) }),
461
+ React__default["default"].createElement(DragHandleIcon, null))));
462
+ };
463
+
464
+ const defaultDisplayColumnDefOptions = {
465
+ columnDefType: 'display',
466
+ enableClickToCopy: false,
467
+ enableColumnActions: false,
468
+ enableColumnDragging: false,
469
+ enableColumnFilter: false,
470
+ enableColumnOrdering: false,
471
+ enableEditing: false,
472
+ enableGlobalFilter: false,
473
+ enableGrouping: false,
474
+ enableHiding: false,
475
+ enableResizing: false,
476
+ enableSorting: false,
477
+ };
478
+ 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; };
479
+ const getAllLeafColumnDefs = (columns) => {
480
+ let lowestLevelColumns = columns;
481
+ let currentCols = columns;
482
+ while (!!(currentCols === null || currentCols === void 0 ? void 0 : currentCols.length) && currentCols.some((col) => col.columns)) {
483
+ const nextCols = currentCols
484
+ .filter((col) => !!col.columns)
485
+ .map((col) => col.columns)
486
+ .flat();
487
+ if (nextCols.every((col) => !(col === null || col === void 0 ? void 0 : col.columns))) {
488
+ lowestLevelColumns = [...lowestLevelColumns, ...nextCols];
489
+ }
490
+ currentCols = nextCols;
491
+ }
492
+ return lowestLevelColumns.filter((col) => !col.columns);
493
+ };
494
+ const prepareColumns = (columnDefs, columnFilterFns, filterFns, sortingFns) => columnDefs.map((columnDef) => {
495
+ var _a, _b;
496
+ if (!columnDef.id)
497
+ columnDef.id = getColumnId(columnDef);
498
+ if (process.env.NODE_ENV !== 'production' && !columnDef.id) {
499
+ console.error('Column definitions must have a valid `accessorKey` or `id` property');
500
+ }
501
+ if (!columnDef.columnDefType)
502
+ columnDef.columnDefType = 'data';
503
+ if (!!((_a = columnDef.columns) === null || _a === void 0 ? void 0 : _a.length)) {
504
+ columnDef.columnDefType = 'group';
505
+ columnDef.columns = prepareColumns(columnDef.columns, columnFilterFns, filterFns, sortingFns);
506
+ }
507
+ else if (columnDef.columnDefType === 'data') {
508
+ if (Object.keys(filterFns).includes(columnFilterFns[columnDef.id])) {
509
+ columnDef.filterFn =
510
+ // @ts-ignore
511
+ (_b = filterFns[columnFilterFns[columnDef.id]]) !== null && _b !== void 0 ? _b : filterFns.fuzzy;
512
+ //@ts-ignore
513
+ columnDef._filterFn = columnFilterFns[columnDef.id];
514
+ }
515
+ if (Object.keys(sortingFns).includes(columnDef.sortingFn)) {
516
+ // @ts-ignore
517
+ columnDef.sortingFn = sortingFns[columnDef.sortingFn];
518
+ }
519
+ }
520
+ else if (columnDef.columnDefType === 'display') {
521
+ columnDef = Object.assign(Object.assign({}, defaultDisplayColumnDefOptions), columnDef);
522
+ }
523
+ return columnDef;
524
+ });
525
+ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
526
+ if (draggedColumn.getCanPin()) {
527
+ draggedColumn.pin(targetColumn.getIsPinned());
528
+ }
529
+ columnOrder.splice(columnOrder.indexOf(targetColumn.id), 0, columnOrder.splice(columnOrder.indexOf(draggedColumn.id), 1)[0]);
530
+ return [...columnOrder];
531
+ };
532
+ const getLeadingDisplayColumnIds = (props) => [
533
+ (props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
534
+ ((props.positionActionsColumn === 'first' && props.enableRowActions) ||
535
+ (props.enableEditing && props.editingMode === 'row')) &&
536
+ 'mrt-row-actions',
537
+ props.positionExpandColumn === 'first' &&
538
+ (props.enableExpanding ||
539
+ props.enableGrouping ||
540
+ props.renderDetailPanel) &&
541
+ 'mrt-row-expand',
542
+ props.enableRowSelection && 'mrt-row-select',
543
+ props.enableRowNumbers && 'mrt-row-numbers',
544
+ ].filter(Boolean);
545
+ const getTrailingDisplayColumnIds = (props) => [
546
+ ((props.positionActionsColumn === 'last' && props.enableRowActions) ||
547
+ (props.enableEditing && props.editingMode === 'row')) &&
548
+ 'mrt-row-actions',
549
+ props.positionExpandColumn === 'last' &&
550
+ (props.enableExpanding ||
551
+ props.enableGrouping ||
552
+ props.renderDetailPanel) &&
553
+ 'mrt-row-expand',
554
+ ];
555
+ const getDefaultColumnOrderIds = (props) => [
556
+ ...getLeadingDisplayColumnIds(props),
557
+ ...getAllLeafColumnDefs(props.columns).map((columnDef) => getColumnId(columnDef)),
558
+ ...getTrailingDisplayColumnIds(props),
559
+ ].filter(Boolean);
560
+ const getDefaultColumnFilterFn = (columnDef) => {
561
+ if (columnDef.filterVariant === 'multi-select')
562
+ return 'arrIncludesSome';
563
+ if (columnDef.filterVariant === 'select')
564
+ return 'equals';
565
+ if (columnDef.filterVariant === 'range')
566
+ return 'betweenInclusive';
567
+ return 'fuzzy';
568
+ };
569
+
570
+ const MRT_ShowHideColumnsMenuItems = ({ allColumns, currentHoveredColumn, setCurrentHoveredColumn, column, isSubMenu, table, }) => {
571
+ var _a;
572
+ const { getState, options: { enableColumnOrdering, enableHiding, enablePinning, localization, }, setColumnOrder, } = table;
573
+ const { columnOrder } = getState();
574
+ const { columnDef } = column;
575
+ const { columnDefType } = columnDef;
576
+ const switchChecked = (columnDefType !== 'group' && column.getIsVisible()) ||
577
+ (columnDefType === 'group' &&
578
+ column.getLeafColumns().some((col) => col.getIsVisible()));
579
+ const handleToggleColumnHidden = (column) => {
580
+ var _a, _b;
581
+ if (columnDefType === 'group') {
582
+ (_b = (_a = column === null || column === void 0 ? void 0 : column.columns) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (childColumn) => {
583
+ childColumn.toggleVisibility(!switchChecked);
584
+ });
585
+ }
586
+ else {
587
+ column.toggleVisibility();
588
+ }
589
+ };
590
+ const menuItemRef = React.useRef(null);
591
+ const [isDragging, setIsDragging] = React.useState(false);
592
+ const handleDragStart = (e) => {
593
+ setIsDragging(true);
594
+ e.dataTransfer.setDragImage(menuItemRef.current, 0, 0);
595
+ };
596
+ const handleDragEnd = (_e) => {
597
+ setIsDragging(false);
598
+ setCurrentHoveredColumn(null);
599
+ if (currentHoveredColumn) {
600
+ setColumnOrder(reorderColumn(column, currentHoveredColumn, columnOrder));
601
+ }
602
+ };
603
+ const handleDragEnter = (_e) => {
604
+ if (!isDragging) {
605
+ setCurrentHoveredColumn(column);
606
+ }
607
+ };
608
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
609
+ React__default["default"].createElement(material.MenuItem, { disableRipple: true, ref: menuItemRef, onDragEnter: handleDragEnter, sx: (theme) => ({
610
+ alignItems: 'center',
611
+ justifyContent: 'flex-start',
612
+ my: 0,
613
+ opacity: isDragging ? 0.5 : 1,
614
+ outline: isDragging
615
+ ? `1px dashed ${theme.palette.divider}`
616
+ : (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
617
+ ? `2px dashed ${theme.palette.primary.main}`
618
+ : 'none',
619
+ pl: `${(column.depth + 0.5) * 2}rem`,
620
+ py: '6px',
621
+ }) },
622
+ React__default["default"].createElement(material.Box, { sx: {
623
+ display: 'flex',
624
+ flexWrap: 'nowrap',
625
+ gap: '8px',
626
+ } },
627
+ !isSubMenu &&
628
+ columnDefType !== 'group' &&
629
+ enableColumnOrdering &&
630
+ !allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
631
+ (columnDef.enableColumnOrdering !== false ? (React__default["default"].createElement(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (React__default["default"].createElement(material.Box, { sx: { width: '28px' } }))),
632
+ !isSubMenu &&
633
+ enablePinning &&
634
+ (column.getCanPin() ? (React__default["default"].createElement(MRT_ColumnPinningButtons, { column: column, table: table })) : (React__default["default"].createElement(material.Box, { sx: { width: '70px' } }))),
635
+ enableHiding ? (React__default["default"].createElement(material.FormControlLabel, { componentsProps: {
636
+ typography: {
637
+ sx: {
638
+ mb: 0,
639
+ opacity: columnDefType !== 'display' ? 1 : 0.5,
640
+ },
641
+ },
642
+ }, checked: switchChecked, control: React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility },
643
+ React__default["default"].createElement(material.Switch, null)), disabled: (isSubMenu && switchChecked) ||
644
+ !column.getCanHide() ||
645
+ column.getIsGrouped(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (React__default["default"].createElement(material.Typography, { sx: { alignSelf: 'center' } }, columnDef.header)))), (_a = column.columns) === null || _a === void 0 ? void 0 :
646
+ _a.map((c, i) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, currentHoveredColumn: currentHoveredColumn, isSubMenu: isSubMenu, key: `${i}-${c.id}`, setCurrentHoveredColumn: setCurrentHoveredColumn, table: table })))));
647
+ };
648
+
649
+ const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) => {
650
+ const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, toggleAllColumnsVisible, options: { localization, enablePinning, enableColumnOrdering }, } = table;
651
+ const { density, columnOrder, columnPinning } = getState();
652
+ const hideAllColumns = () => {
653
+ getAllLeafColumns()
654
+ .filter((col) => col.columnDef.enableHiding !== false)
655
+ .forEach((col) => col.toggleVisibility(false));
656
+ };
657
+ const allColumns = React.useMemo(() => {
658
+ const columns = getAllColumns();
659
+ if (columnOrder.length > 0 &&
660
+ !columns.some((col) => col.columnDef.columnDefType === 'group')) {
661
+ return [
662
+ ...getLeftLeafColumns(),
663
+ ...Array.from(new Set(columnOrder)).map((colId) => getCenterLeafColumns().find((col) => (col === null || col === void 0 ? void 0 : col.id) === colId)),
664
+ ...getRightLeafColumns(),
665
+ ].filter(Boolean);
666
+ }
667
+ return columns;
668
+ }, [
669
+ columnOrder,
670
+ columnPinning,
671
+ getAllColumns(),
672
+ getCenterLeafColumns(),
673
+ getLeftLeafColumns(),
674
+ getRightLeafColumns(),
675
+ ]);
676
+ const [currentHoveredColumn, setCurrentHoveredColumn] = React.useState(null);
677
+ return (React__default["default"].createElement(material.Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
678
+ dense: density === 'compact',
679
+ } },
680
+ React__default["default"].createElement(material.Box, { sx: {
681
+ display: 'flex',
682
+ justifyContent: isSubMenu ? 'center' : 'space-between',
683
+ p: '0.5rem',
684
+ pt: 0,
685
+ } },
686
+ !isSubMenu && (React__default["default"].createElement(material.Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns }, localization.hideAll)),
687
+ !isSubMenu && enableColumnOrdering && (React__default["default"].createElement(material.Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)) }, localization.resetOrder)),
688
+ !isSubMenu && enablePinning && (React__default["default"].createElement(material.Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, localization.unpinAll)),
689
+ React__default["default"].createElement(material.Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, localization.showAll)),
690
+ React__default["default"].createElement(material.Divider, null),
691
+ allColumns.map((column, index) => (React__default["default"].createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, currentHoveredColumn: currentHoveredColumn, isSubMenu: isSubMenu, key: `${index}-${column.id}`, setCurrentHoveredColumn: setCurrentHoveredColumn, table: table })))));
692
+ };
693
+
694
+ const commonMenuItemStyles = {
695
+ py: '6px',
696
+ my: 0,
697
+ justifyContent: 'space-between',
698
+ alignItems: 'center',
699
+ };
700
+ const commonListItemStyles = {
701
+ display: 'flex',
702
+ alignItems: 'center',
703
+ };
704
+ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
705
+ var _a, _b, _c, _d, _e, _f, _g;
706
+ const { getState, toggleAllColumnsVisible, setColumnOrder, options: { enableColumnFilterChangeMode, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, columnFilterModeOptions, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, tableId, localization, }, setShowFilters, } = table;
707
+ const { column } = header;
708
+ const { columnDef } = column;
709
+ const { columnSizing, columnVisibility, density } = getState();
710
+ const [filterMenuAnchorEl, setFilterMenuAnchorEl] = React.useState(null);
711
+ const [showHideColumnsMenuAnchorEl, setShowHideColumnsMenuAnchorEl] = React.useState(null);
712
+ const handleClearSort = () => {
713
+ column.clearSorting();
714
+ setAnchorEl(null);
715
+ };
716
+ const handleSortAsc = () => {
717
+ column.toggleSorting(false);
718
+ setAnchorEl(null);
719
+ };
720
+ const handleSortDesc = () => {
721
+ column.toggleSorting(true);
722
+ setAnchorEl(null);
723
+ };
724
+ const handleResetColumnSize = () => {
725
+ column.resetSize();
726
+ setAnchorEl(null);
727
+ };
728
+ const handleHideColumn = () => {
729
+ column.toggleVisibility(false);
730
+ setAnchorEl(null);
731
+ };
732
+ const handlePinColumn = (pinDirection) => {
733
+ column.pin(pinDirection);
734
+ setAnchorEl(null);
735
+ };
736
+ const handleGroupByColumn = () => {
737
+ column.toggleGrouping();
738
+ setColumnOrder((old) => ['mrt-row-expand', ...old]);
739
+ setAnchorEl(null);
740
+ };
741
+ const handleClearFilter = () => {
742
+ column.setFilterValue('');
743
+ setAnchorEl(null);
744
+ };
745
+ const handleFilterByColumn = () => {
746
+ setShowFilters(true);
747
+ setTimeout(() => {
748
+ var _a, _b, _c;
749
+ return (_c = document
750
+ .getElementById(
751
+ // @ts-ignore
752
+ (_b = (_a = header.muiTableHeadCellFilterTextFieldProps) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : `mrt-${tableId}-${header.id}-filter-text-field`)) === null || _c === void 0 ? void 0 : _c.focus();
753
+ }, 200);
754
+ setAnchorEl(null);
755
+ };
756
+ const handleShowAllColumns = () => {
757
+ toggleAllColumnsVisible(true);
758
+ setAnchorEl(null);
759
+ };
760
+ const handleOpenFilterModeMenu = (event) => {
761
+ event.stopPropagation();
762
+ setFilterMenuAnchorEl(event.currentTarget);
763
+ };
764
+ const handleOpenShowHideColumnsMenu = (event) => {
765
+ event.stopPropagation();
766
+ setShowHideColumnsMenuAnchorEl(event.currentTarget);
767
+ };
768
+ const isSelectFilter = !!columnDef.filterSelectOptions;
769
+ const allowedColumnFilterOptions = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _a !== void 0 ? _a : columnFilterModeOptions;
770
+ const showFilterModeSubMenu = enableColumnFilterChangeMode &&
771
+ columnDef.enableColumnFilterChangeMode !== false &&
772
+ !isSelectFilter &&
773
+ (allowedColumnFilterOptions === undefined ||
774
+ !!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
775
+ return (React__default["default"].createElement(material.Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
776
+ dense: density === 'compact',
777
+ } },
778
+ enableSorting &&
779
+ column.getCanSort() && [
780
+ React__default["default"].createElement(material.MenuItem, { disabled: !column.getIsSorted(), key: 0, onClick: handleClearSort, sx: commonMenuItemStyles },
781
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
782
+ React__default["default"].createElement(material.ListItemIcon, null,
783
+ React__default["default"].createElement(ClearAllIcon, null)),
784
+ localization.clearSort)),
785
+ React__default["default"].createElement(material.MenuItem, { disabled: column.getIsSorted() === 'asc', key: 1, onClick: handleSortAsc, sx: commonMenuItemStyles },
786
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
787
+ React__default["default"].createElement(material.ListItemIcon, null,
788
+ React__default["default"].createElement(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } })), (_b = localization.sortByColumnAsc) === null || _b === void 0 ? void 0 :
789
+ _b.replace('{column}', String(columnDef.header)))),
790
+ React__default["default"].createElement(material.MenuItem, { divider: enableColumnFilters || enableGrouping || enableHiding, key: 2, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles },
791
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
792
+ React__default["default"].createElement(material.ListItemIcon, null,
793
+ React__default["default"].createElement(SortIcon, null)), (_c = localization.sortByColumnDesc) === null || _c === void 0 ? void 0 :
794
+ _c.replace('{column}', String(columnDef.header)))),
795
+ ],
796
+ enableColumnFilters &&
797
+ column.getCanFilter() &&
798
+ [
799
+ React__default["default"].createElement(material.MenuItem, { disabled: !column.getFilterValue(), key: 0, onClick: handleClearFilter, sx: commonMenuItemStyles },
800
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
801
+ React__default["default"].createElement(material.ListItemIcon, null,
802
+ React__default["default"].createElement(FilterListOffIcon, null)),
803
+ localization.clearFilter)),
804
+ React__default["default"].createElement(material.MenuItem, { divider: enableGrouping || enableHiding, key: 1, onClick: handleFilterByColumn, sx: commonMenuItemStyles },
805
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
806
+ React__default["default"].createElement(material.ListItemIcon, null,
807
+ React__default["default"].createElement(FilterListIcon, null)), (_d = localization.filterByColumn) === null || _d === void 0 ? void 0 :
808
+ _d.replace('{column}', String(columnDef.header))),
809
+ showFilterModeSubMenu && (React__default["default"].createElement(material.IconButton, { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 } },
810
+ React__default["default"].createElement(ArrowRightIcon, null)))),
811
+ showFilterModeSubMenu && (React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, key: 2, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table })),
812
+ ].filter(Boolean),
813
+ enableGrouping &&
814
+ column.getCanGroup() && [
815
+ React__default["default"].createElement(material.MenuItem, { divider: enablePinning, key: 0, onClick: handleGroupByColumn, sx: commonMenuItemStyles },
816
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
817
+ React__default["default"].createElement(material.ListItemIcon, null,
818
+ React__default["default"].createElement(DynamicFeedIcon, null)), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 :
819
+ _e.replace('{column}', String(columnDef.header)))),
820
+ ],
821
+ enablePinning &&
822
+ column.getCanPin() && [
823
+ React__default["default"].createElement(material.MenuItem, { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), key: 0, onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles },
824
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
825
+ React__default["default"].createElement(material.ListItemIcon, null,
826
+ React__default["default"].createElement(PushPinIcon, { style: { transform: 'rotate(90deg)' } })),
827
+ localization.pinToLeft)),
828
+ React__default["default"].createElement(material.MenuItem, { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), key: 1, onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles },
829
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
830
+ React__default["default"].createElement(material.ListItemIcon, null,
831
+ React__default["default"].createElement(PushPinIcon, { style: { transform: 'rotate(-90deg)' } })),
832
+ localization.pinToRight)),
833
+ React__default["default"].createElement(material.MenuItem, { disabled: !column.getIsPinned(), divider: enableHiding, key: 2, onClick: () => handlePinColumn(false), sx: commonMenuItemStyles },
834
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
835
+ React__default["default"].createElement(material.ListItemIcon, null,
836
+ React__default["default"].createElement(PushPinIcon, null)),
837
+ localization.unpin)),
838
+ ],
839
+ enableColumnResizing &&
840
+ column.getCanResize() && [
841
+ React__default["default"].createElement(material.MenuItem, { disabled: !columnSizing[column.id], key: 0, onClick: handleResetColumnSize, sx: commonMenuItemStyles },
842
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
843
+ React__default["default"].createElement(material.ListItemIcon, null,
844
+ React__default["default"].createElement(RestartAltIcon, null)),
845
+ localization.resetColumnSize)),
846
+ ],
847
+ enableHiding && [
848
+ React__default["default"].createElement(material.MenuItem, { disabled: columnDef.enableHiding === false, key: 0, onClick: handleHideColumn, sx: commonMenuItemStyles },
849
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
850
+ React__default["default"].createElement(material.ListItemIcon, null,
851
+ React__default["default"].createElement(VisibilityOffIcon, null)), (_f = localization.hideColumn) === null || _f === void 0 ? void 0 :
852
+ _f.replace('{column}', String(columnDef.header)))),
853
+ React__default["default"].createElement(material.MenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
854
+ .length, key: 1, onClick: handleShowAllColumns, sx: commonMenuItemStyles },
855
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
856
+ React__default["default"].createElement(material.ListItemIcon, null,
857
+ React__default["default"].createElement(ViewColumnIcon, null)), (_g = localization.showAllColumns) === null || _g === void 0 ? void 0 :
858
+ _g.replace('{column}', String(columnDef.header))),
859
+ React__default["default"].createElement(material.IconButton, { onClick: handleOpenShowHideColumnsMenu, onMouseEnter: handleOpenShowHideColumnsMenu, size: "small", sx: { p: 0 } },
860
+ React__default["default"].createElement(ArrowRightIcon, null))),
861
+ React__default["default"].createElement(MRT_ShowHideColumnsMenu, { anchorEl: showHideColumnsMenuAnchorEl, isSubMenu: true, key: 2, setAnchorEl: setShowHideColumnsMenuAnchorEl, table: table }),
862
+ ]));
863
+ };
864
+
865
+ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) => {
866
+ const { getState, options: { icons: { EditIcon }, enableEditing, localization, renderRowActionMenuItems, }, } = table;
867
+ const { density } = getState();
868
+ return (React__default["default"].createElement(material.Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
869
+ dense: density === 'compact',
870
+ } },
871
+ enableEditing && (React__default["default"].createElement(material.MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles },
872
+ React__default["default"].createElement(material.Box, { sx: commonListItemStyles },
873
+ React__default["default"].createElement(material.ListItemIcon, null,
874
+ React__default["default"].createElement(EditIcon, null)),
875
+ localization.edit))), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 :
876
+ renderRowActionMenuItems({
877
+ row,
878
+ table,
879
+ closeMenu: () => setAnchorEl(null),
880
+ })));
881
+ };
882
+
883
+ const MRT_EditActionButtons = ({ row, table }) => {
884
+ const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditRowSubmit, }, setCurrentEditingRow, } = table;
885
+ const { currentEditingRow } = getState();
886
+ const handleCancel = () => {
887
+ var _a;
888
+ row._valuesCache = (_a = row.original) !== null && _a !== void 0 ? _a : {};
889
+ setCurrentEditingRow(null);
890
+ };
891
+ const handleSave = () => {
892
+ onEditRowSubmit === null || onEditRowSubmit === void 0 ? void 0 : onEditRowSubmit({ row: currentEditingRow !== null && currentEditingRow !== void 0 ? currentEditingRow : row, table });
893
+ setCurrentEditingRow(null);
894
+ };
895
+ return (React__default["default"].createElement(material.Box, { sx: { display: 'flex', gap: '0.75rem' } },
896
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.cancel },
897
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.cancel, onClick: handleCancel },
898
+ React__default["default"].createElement(CancelIcon, null))),
899
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.save },
900
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.save, color: "info", onClick: handleSave },
901
+ React__default["default"].createElement(SaveIcon, null)))));
902
+ };
903
+
904
+ const commonIconButtonStyles = {
905
+ height: '2rem',
906
+ ml: '10px',
907
+ opacity: 0.5,
908
+ transition: 'opacity 0.2s',
909
+ width: '2rem',
910
+ '&:hover': {
911
+ opacity: 1,
912
+ },
913
+ };
914
+ const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
915
+ const { getState, options: { enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setCurrentEditingRow, } = table;
916
+ const { currentEditingRow } = getState();
917
+ const [anchorEl, setAnchorEl] = React.useState(null);
918
+ const handleOpenRowActionMenu = (event) => {
919
+ event.stopPropagation();
920
+ event.preventDefault();
921
+ setAnchorEl(event.currentTarget);
922
+ };
923
+ const handleStartEditMode = () => {
924
+ setCurrentEditingRow(Object.assign({}, row));
925
+ setAnchorEl(null);
926
+ };
927
+ return (React__default["default"].createElement(React__default["default"].Fragment, null, renderRowActions ? (React__default["default"].createElement(React__default["default"].Fragment, null, renderRowActions({ row, table }))) : row.id === (currentEditingRow === null || currentEditingRow === void 0 ? void 0 : currentEditingRow.id) ? (React__default["default"].createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React__default["default"].createElement(material.Tooltip, { placement: "right", arrow: true, title: localization.edit },
928
+ React__default["default"].createElement(material.IconButton, { sx: commonIconButtonStyles, onClick: handleStartEditMode },
929
+ React__default["default"].createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React__default["default"].createElement(React__default["default"].Fragment, null,
930
+ React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
931
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles },
932
+ React__default["default"].createElement(MoreHorizIcon, null))),
933
+ React__default["default"].createElement(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table }))) : null));
934
+ };
935
+
936
+ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
937
+ const { getState, options: { localization, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
938
+ const { density } = getState();
939
+ const checkboxProps = !row
940
+ ? muiSelectAllCheckboxProps instanceof Function
941
+ ? muiSelectAllCheckboxProps({ table })
942
+ : muiSelectAllCheckboxProps
943
+ : muiSelectCheckboxProps instanceof Function
944
+ ? muiSelectCheckboxProps({ row, table })
945
+ : muiSelectCheckboxProps;
946
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: selectAll ? localization.toggleSelectAll : localization.toggleSelectRow },
947
+ React__default["default"].createElement(material.Checkbox, Object.assign({ checked: selectAll ? table.getIsAllRowsSelected() : row === null || row === void 0 ? void 0 : row.getIsSelected(), indeterminate: selectAll ? table.getIsSomeRowsSelected() : row === null || row === void 0 ? void 0 : row.getIsSomeSelected(), inputProps: {
948
+ 'aria-label': selectAll
949
+ ? localization.toggleSelectAll
950
+ : localization.toggleSelectRow,
951
+ }, onChange: !row
952
+ ? selectAllMode === 'all'
953
+ ? table.getToggleAllRowsSelectedHandler()
954
+ : table.getToggleAllPageRowsSelectedHandler()
955
+ : row.getToggleSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
956
+ ? checkboxProps.sx(theme)
957
+ : checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) }))));
958
+ };
959
+
960
+ const MRT_GlobalFilterTextField = ({ table, }) => {
961
+ var _a;
962
+ const { getState, setGlobalFilter, options: { enableGlobalFilterChangeMode, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, tableId, }, } = table;
963
+ const { globalFilter, showGlobalFilter } = getState();
964
+ const [anchorEl, setAnchorEl] = React.useState(null);
965
+ const [searchValue, setSearchValue] = React.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
966
+ const handleChangeDebounced = React.useCallback(material.debounce((event) => {
967
+ var _a;
968
+ setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
969
+ }, 250), []);
970
+ const handleChange = (event) => {
971
+ setSearchValue(event.target.value);
972
+ handleChangeDebounced(event);
973
+ };
974
+ const handleGlobalFilterMenuOpen = (event) => {
975
+ setAnchorEl(event.currentTarget);
976
+ };
977
+ const handleClear = () => {
978
+ setSearchValue('');
979
+ setGlobalFilter(undefined);
980
+ };
981
+ const textFieldProps = muiSearchTextFieldProps instanceof Function
982
+ ? muiSearchTextFieldProps({ table })
983
+ : muiSearchTextFieldProps;
984
+ return (React__default["default"].createElement(material.Collapse, { in: showGlobalFilter, orientation: "horizontal" },
985
+ React__default["default"].createElement(material.TextField, Object.assign({ id: `mrt-${tableId}-search-text-field`, placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
986
+ startAdornment: enableGlobalFilterChangeMode ? (React__default["default"].createElement(material.InputAdornment, { position: "start" },
987
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.changeSearchMode },
988
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
989
+ React__default["default"].createElement(SearchIcon, null))))) : (React__default["default"].createElement(SearchIcon, { style: { marginRight: '4px' } })),
990
+ endAdornment: (React__default["default"].createElement(material.InputAdornment, { position: "end" },
991
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '' },
992
+ React__default["default"].createElement("span", null,
993
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small" },
994
+ React__default["default"].createElement(CloseIcon, null)))))),
995
+ } }, textFieldProps)),
996
+ React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
997
+ };
998
+
999
+ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
1000
+ const { options: { muiLinearProgressProps }, getState, } = table;
1001
+ const { isLoading, showProgressBars } = getState();
1002
+ const linearProgressProps = muiLinearProgressProps instanceof Function
1003
+ ? muiLinearProgressProps({ isTopToolbar, table })
1004
+ : muiLinearProgressProps;
1005
+ return (React__default["default"].createElement(material.Collapse, { in: isLoading || showProgressBars, mountOnEnter: true, unmountOnExit: true, sx: {
1006
+ bottom: isTopToolbar ? 0 : undefined,
1007
+ position: 'absolute',
1008
+ top: !isTopToolbar ? 0 : undefined,
1009
+ width: '100%',
1010
+ } },
1011
+ React__default["default"].createElement(material.LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
1012
+ };
1013
+
1014
+ const MRT_TablePagination = ({ table, position }) => {
1015
+ const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
1016
+ const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
1017
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
1018
+ const showFirstLastPageButtons = totalRowCount / pageSize > 2;
1019
+ const tablePaginationProps = muiTablePaginationProps instanceof Function
1020
+ ? muiTablePaginationProps({ table })
1021
+ : muiTablePaginationProps;
1022
+ const handleChangeRowsPerPage = (event) => {
1023
+ setPageSize(+event.target.value);
1024
+ };
1025
+ return (React__default["default"].createElement(material.TablePagination, Object.assign({ SelectProps: {
1026
+ sx: { m: '0 1rem 0 1ch' },
1027
+ MenuProps: { MenuListProps: { disablePadding: true } },
1028
+ }, component: "div", count: totalRowCount, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { sx: (theme) => (Object.assign({ m: '0 0.5rem', mt: position === 'top' &&
1029
+ enableToolbarInternalActions &&
1030
+ !showGlobalFilter
1031
+ ? '3.5rem'
1032
+ : undefined, position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1033
+ ? tablePaginationProps.sx(theme)
1034
+ : tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
1035
+ };
1036
+
1037
+ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1038
+ var _a, _b;
1039
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiTableToolbarAlertBannerProps }, } = table;
1040
+ const { grouping, showAlertBanner } = getState();
1041
+ const alertProps = muiTableToolbarAlertBannerProps instanceof Function
1042
+ ? muiTableToolbarAlertBannerProps({ table })
1043
+ : muiTableToolbarAlertBannerProps;
1044
+ const selectMessage = getSelectedRowModel().rows.length > 0
1045
+ ? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', getPrePaginationRowModel().rows.length.toString())
1046
+ : null;
1047
+ const groupedByMessage = grouping.length > 0 ? (React__default["default"].createElement("span", null,
1048
+ localization.groupedBy,
1049
+ ' ',
1050
+ grouping.map((columnId, index) => (React__default["default"].createElement(React.Fragment, { key: `${index}-${columnId}` },
1051
+ index > 0 ? localization.thenBy : '',
1052
+ React__default["default"].createElement(material.Chip, { color: "secondary", label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() })))))) : null;
1053
+ return (React__default["default"].createElement(material.Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
1054
+ React__default["default"].createElement(material.Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
1055
+ ? alertProps.sx(theme)
1056
+ : alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
1057
+ (alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React__default["default"].createElement(material.AlertTitle, null, alertProps.title),
1058
+ React__default["default"].createElement(material.Box, { sx: { p: '0.5rem 1rem' } }, alertProps === null || alertProps === void 0 ? void 0 :
1059
+ alertProps.children,
1060
+ (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (React__default["default"].createElement("br", null)),
1061
+ selectMessage,
1062
+ selectMessage && groupedByMessage && React__default["default"].createElement("br", null),
1063
+ groupedByMessage))));
1064
+ };
1065
+
1066
+ const MRT_FullScreenToggleButton = (_a) => {
1067
+ var { table } = _a, rest = __rest(_a, ["table"]);
1068
+ const { getState, options: { icons: { FullscreenExitIcon, FullscreenIcon }, localization, }, setIsFullScreen, } = table;
1069
+ const { isFullScreen } = getState();
1070
+ const handleToggleFullScreen = () => {
1071
+ setIsFullScreen(!isFullScreen);
1072
+ };
1073
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.toggleFullScreen },
1074
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest), isFullScreen ? React__default["default"].createElement(FullscreenExitIcon, null) : React__default["default"].createElement(FullscreenIcon, null))));
1075
+ };
1076
+
1077
+ const MRT_ShowHideColumnsButton = (_a) => {
1078
+ var { table } = _a, rest = __rest(_a, ["table"]);
1079
+ const { options: { icons: { ViewColumnIcon }, localization, }, } = table;
1080
+ const [anchorEl, setAnchorEl] = React.useState(null);
1081
+ const handleClick = (event) => {
1082
+ setAnchorEl(event.currentTarget);
1083
+ };
1084
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
1085
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.showHideColumns },
1086
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.showHideColumns, onClick: handleClick }, rest),
1087
+ React__default["default"].createElement(ViewColumnIcon, null))),
1088
+ React__default["default"].createElement(MRT_ShowHideColumnsMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
1089
+ };
1090
+
1091
+ const MRT_ToggleDensePaddingButton = (_a) => {
1092
+ var { table } = _a, rest = __rest(_a, ["table"]);
1093
+ const { getState, options: { icons: { DensityLargeIcon, DensityMediumIcon, DensitySmallIcon }, localization, }, setDensity, } = table;
1094
+ const { density } = getState();
1095
+ const handleToggleDensePadding = () => {
1096
+ const nextDensity = density === 'comfortable'
1097
+ ? 'compact'
1098
+ : density === 'compact'
1099
+ ? 'spacious'
1100
+ : 'comfortable';
1101
+ setDensity(nextDensity);
1102
+ };
1103
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.toggleDensity },
1104
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding }, rest), density === 'compact' ? (React__default["default"].createElement(DensitySmallIcon, null)) : density === 'comfortable' ? (React__default["default"].createElement(DensityMediumIcon, null)) : (React__default["default"].createElement(DensityLargeIcon, null)))));
1105
+ };
1106
+
1107
+ const MRT_ToggleFiltersButton = (_a) => {
1108
+ var { table } = _a, rest = __rest(_a, ["table"]);
1109
+ const { getState, options: { icons: { FilterListIcon, FilterListOffIcon }, localization, }, setShowFilters, } = table;
1110
+ const { showColumnFilters } = getState();
1111
+ const handleToggleShowFilters = () => {
1112
+ setShowFilters(!showColumnFilters);
1113
+ };
1114
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.showHideFilters },
1115
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleShowFilters }, rest), showColumnFilters ? React__default["default"].createElement(FilterListOffIcon, null) : React__default["default"].createElement(FilterListIcon, null))));
1116
+ };
1117
+
1118
+ const MRT_ToggleGlobalFilterButton = (_a) => {
1119
+ var { table } = _a, rest = __rest(_a, ["table"]);
1120
+ const { getState, options: { icons: { SearchIcon, SearchOffIcon }, tableId, localization, muiSearchTextFieldProps, }, setShowGlobalFilter, } = table;
1121
+ const { showGlobalFilter } = getState();
1122
+ const textFieldProps = muiSearchTextFieldProps instanceof Function
1123
+ ? muiSearchTextFieldProps({ table })
1124
+ : muiSearchTextFieldProps;
1125
+ const handleToggleSearch = () => {
1126
+ setShowGlobalFilter(!showGlobalFilter);
1127
+ setTimeout(() => {
1128
+ var _a, _b;
1129
+ return (_b = document
1130
+ .getElementById((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.id) !== null && _a !== void 0 ? _a : `mrt-${tableId}-search-text-field`)) === null || _b === void 0 ? void 0 : _b.focus();
1131
+ }, 200);
1132
+ };
1133
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.showHideSearch },
1134
+ React__default["default"].createElement(material.IconButton, Object.assign({ onClick: handleToggleSearch }, rest), showGlobalFilter ? React__default["default"].createElement(SearchOffIcon, null) : React__default["default"].createElement(SearchIcon, null))));
1135
+ };
1136
+
1137
+ const MRT_ToolbarInternalButtons = ({ table }) => {
1138
+ var _a;
1139
+ const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, positionGlobalFilter, renderToolbarInternalActions, }, } = table;
1140
+ return (React__default["default"].createElement(material.Box, { sx: {
1141
+ alignItems: 'center',
1142
+ display: 'flex',
1143
+ zIndex: 3,
1144
+ } }, (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
1145
+ table,
1146
+ })) !== null && _a !== void 0 ? _a : (React__default["default"].createElement(React__default["default"].Fragment, null,
1147
+ enableGlobalFilter && positionGlobalFilter === 'right' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })),
1148
+ enableFilters && enableGlobalFilter && (React__default["default"].createElement(MRT_ToggleGlobalFilterButton, { table: table })),
1149
+ enableFilters && enableColumnFilters && (React__default["default"].createElement(MRT_ToggleFiltersButton, { table: table })),
1150
+ (enableHiding || enableColumnOrdering || enablePinning) && (React__default["default"].createElement(MRT_ShowHideColumnsButton, { table: table })),
1151
+ enableDensityToggle && (React__default["default"].createElement(MRT_ToggleDensePaddingButton, { table: table })),
1152
+ enableFullScreenToggle && (React__default["default"].createElement(MRT_FullScreenToggleButton, { table: table }))))));
1153
+ };
1154
+
1155
+ const MRT_ToolbarDropZone = ({ table }) => {
1156
+ var _a, _b;
1157
+ const { getState, options: { enableGrouping, localization }, setCurrentHoveredColumn, } = table;
1158
+ const { currentDraggingColumn, currentHoveredColumn } = getState();
1159
+ const handleDragEnter = (_event) => {
1160
+ setCurrentHoveredColumn({ id: 'drop-zone' });
1161
+ };
1162
+ return (React__default["default"].createElement(material.Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping && !!currentDraggingColumn },
1163
+ React__default["default"].createElement(material.Box, { sx: (theme) => ({
1164
+ alignItems: 'center',
1165
+ backgroundColor: material.alpha(theme.palette.info.main, (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1),
1166
+ border: `dashed ${theme.palette.info.main} 2px`,
1167
+ display: 'flex',
1168
+ justifyContent: 'center',
1169
+ height: 'calc(100% - 4px)',
1170
+ position: 'absolute',
1171
+ width: 'calc(100% - 4px)',
1172
+ zIndex: 2,
1173
+ }), onDragEnter: handleDragEnter },
1174
+ React__default["default"].createElement(material.Typography, null, localization.dropToGroupBy.replace('{column}', (_b = (_a = currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '')))));
1175
+ };
1176
+
1177
+ const commonToolbarStyles = ({ theme }) => ({
1178
+ alignItems: 'flex-start',
1179
+ backgroundColor: material.lighten(theme.palette.background.default, 0.04),
1180
+ backgroundImage: 'none',
1181
+ display: 'grid',
1182
+ minHeight: '3.5rem',
1183
+ overflow: 'hidden',
1184
+ p: '0 !important',
1185
+ transition: 'all 0.2s ease-in-out',
1186
+ zIndex: 1,
1187
+ });
1188
+ const MRT_TopToolbar = ({ table }) => {
1189
+ var _a;
1190
+ const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTableTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, tableId, }, } = table;
1191
+ const { isFullScreen, showGlobalFilter } = getState();
1192
+ const isMobile = material.useMediaQuery('(max-width:720px)');
1193
+ const toolbarProps = muiTableTopToolbarProps instanceof Function
1194
+ ? muiTableTopToolbarProps({ table })
1195
+ : muiTableTopToolbarProps;
1196
+ const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
1197
+ return (React__default["default"].createElement(material.Toolbar, Object.assign({ id: `mrt-${tableId}-toolbar-top`, variant: "dense" }, toolbarProps, { sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
1198
+ ? toolbarProps.sx(theme)
1199
+ : toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
1200
+ positionToolbarAlertBanner === 'top' && (React__default["default"].createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
1201
+ ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React__default["default"].createElement(MRT_ToolbarDropZone, { table: table })),
1202
+ React__default["default"].createElement(material.Box, { sx: {
1203
+ alignItems: 'flex-start',
1204
+ boxSizing: 'border-box',
1205
+ display: 'flex',
1206
+ justifyContent: 'space-between',
1207
+ p: '0.5rem',
1208
+ position: stackAlertBanner ? 'relative' : 'absolute',
1209
+ right: 0,
1210
+ top: 0,
1211
+ width: '100%',
1212
+ } },
1213
+ enableGlobalFilter && positionGlobalFilter === 'left' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React__default["default"].createElement("span", null),
1214
+ enableToolbarInternalActions ? (React__default["default"].createElement(MRT_ToolbarInternalButtons, { table: table })) : (enableGlobalFilter &&
1215
+ positionGlobalFilter === 'right' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })))),
1216
+ enablePagination &&
1217
+ ['top', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (React__default["default"].createElement(MRT_TablePagination, { table: table, position: "top" })),
1218
+ React__default["default"].createElement(MRT_LinearProgressBar, { isTopToolbar: true, table: table })));
1219
+ };
1220
+
1221
+ const MRT_BottomToolbar = ({ table }) => {
1222
+ const { getState, options: { enablePagination, muiTableBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, tableId, }, } = table;
1223
+ const { isFullScreen } = getState();
1224
+ const isMobile = material.useMediaQuery('(max-width:720px)');
1225
+ const toolbarProps = muiTableBottomToolbarProps instanceof Function
1226
+ ? muiTableBottomToolbarProps({ table })
1227
+ : muiTableBottomToolbarProps;
1228
+ const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
1229
+ return (React__default["default"].createElement(material.Toolbar, Object.assign({ id: `mrt-${tableId}-toolbar-bottom`, variant: "dense" }, toolbarProps, { sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `-3px 0 6px ${material.alpha(theme.palette.common.black, 0.1)}`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
1230
+ ? toolbarProps.sx(theme)
1231
+ : toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
1232
+ React__default["default"].createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
1233
+ positionToolbarAlertBanner === 'bottom' && (React__default["default"].createElement(MRT_ToolbarAlertBanner, { table: table })),
1234
+ ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React__default["default"].createElement(MRT_ToolbarDropZone, { table: table })),
1235
+ React__default["default"].createElement(material.Box, { sx: {
1236
+ display: 'flex',
1237
+ justifyContent: 'space-between',
1238
+ width: '100%',
1239
+ } },
1240
+ renderBottomToolbarCustomActions ? (React__default["default"].createElement(material.Box, { sx: { p: '0.5rem' } }, renderBottomToolbarCustomActions({ table }))) : (React__default["default"].createElement("span", null)),
1241
+ React__default["default"].createElement(material.Box, { sx: {
1242
+ display: 'flex',
1243
+ justifyContent: 'flex-end',
1244
+ position: stackAlertBanner ? 'relative' : 'absolute',
1245
+ right: 0,
1246
+ top: 0,
1247
+ } }, enablePagination &&
1248
+ ['bottom', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (React__default["default"].createElement(MRT_TablePagination, { table: table, position: "bottom" }))))));
1249
+ };
1250
+
1251
+ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
1252
+ const { options: { icons: { MoreVertIcon }, localization, muiTableHeadCellColumnActionsButtonProps, }, } = table;
1253
+ const { column } = header;
1254
+ const { columnDef } = column;
1255
+ const [anchorEl, setAnchorEl] = React.useState(null);
1256
+ const handleClick = (event) => {
1257
+ event.stopPropagation();
1258
+ event.preventDefault();
1259
+ setAnchorEl(event.currentTarget);
1260
+ };
1261
+ const mTableHeadCellColumnActionsButtonProps = muiTableHeadCellColumnActionsButtonProps instanceof Function
1262
+ ? muiTableHeadCellColumnActionsButtonProps({ column, table })
1263
+ : muiTableHeadCellColumnActionsButtonProps;
1264
+ const mcTableHeadCellColumnActionsButtonProps = columnDef.muiTableHeadCellColumnActionsButtonProps instanceof Function
1265
+ ? columnDef.muiTableHeadCellColumnActionsButtonProps({
1266
+ column,
1267
+ table,
1268
+ })
1269
+ : columnDef.muiTableHeadCellColumnActionsButtonProps;
1270
+ const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
1271
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
1272
+ React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: localization.columnActions },
1273
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', mt: '-0.2rem', opacity: 0.5, transition: 'opacity 0.2s', width: '2rem', '&:hover': {
1274
+ opacity: 1,
1275
+ } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
1276
+ ? iconButtonProps.sx(theme)
1277
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
1278
+ React__default["default"].createElement(MoreVertIcon, null))),
1279
+ React__default["default"].createElement(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table })));
1280
+ };
1281
+
1282
+ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1283
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1284
+ const { getState, options: { enableColumnFilterChangeMode, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, muiTableHeadCellFilterTextFieldProps, tableId, }, setColumnFilterFns, } = table;
1285
+ const { column } = header;
1286
+ const { columnDef } = column;
1287
+ const { columnFilterFns } = getState();
1288
+ const mTableHeadCellFilterTextFieldProps = muiTableHeadCellFilterTextFieldProps instanceof Function
1289
+ ? muiTableHeadCellFilterTextFieldProps({
1290
+ column,
1291
+ table,
1292
+ rangeFilterIndex,
1293
+ })
1294
+ : muiTableHeadCellFilterTextFieldProps;
1295
+ const mcTableHeadCellFilterTextFieldProps = columnDef.muiTableHeadCellFilterTextFieldProps instanceof Function
1296
+ ? columnDef.muiTableHeadCellFilterTextFieldProps({
1297
+ column,
1298
+ table,
1299
+ rangeFilterIndex,
1300
+ })
1301
+ : columnDef.muiTableHeadCellFilterTextFieldProps;
1302
+ const textFieldProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
1303
+ const isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
1304
+ const isSelectFilter = columnDef.filterVariant === 'select';
1305
+ const isMultiSelectFilter = columnDef.filterVariant === 'multi-select';
1306
+ const isTextboxFilter = columnDef.filterVariant === 'text' ||
1307
+ (!isSelectFilter && !isMultiSelectFilter);
1308
+ const currentFilterOption = columnFilterFns === null || columnFilterFns === void 0 ? void 0 : columnFilterFns[header.id];
1309
+ const filterId = `mrt-${tableId}-${header.id}-filter-text-field${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : ''}`;
1310
+ const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
1311
+ ? //@ts-ignore
1312
+ localization[`filter${((_b = (_a = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _a === void 0 ? void 0 : _a.call(currentFilterOption, 0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
1313
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
1314
+ : '';
1315
+ const filterPlaceholder = !isRangeFilter
1316
+ ? (_c = localization.filterByColumn) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header))
1317
+ : rangeFilterIndex === 0
1318
+ ? localization.min
1319
+ : rangeFilterIndex === 1
1320
+ ? localization.max
1321
+ : '';
1322
+ const allowedColumnFilterOptions = (_d = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _d !== void 0 ? _d : columnFilterModeOptions;
1323
+ const showChangeModeButton = enableColumnFilterChangeMode &&
1324
+ columnDef.enableColumnFilterChangeMode !== false &&
1325
+ !rangeFilterIndex &&
1326
+ (allowedColumnFilterOptions === undefined ||
1327
+ !!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
1328
+ const [anchorEl, setAnchorEl] = React.useState(null);
1329
+ const [filterValue, setFilterValue] = React.useState(() => {
1330
+ var _a, _b;
1331
+ return isMultiSelectFilter
1332
+ ? column.getFilterValue() || []
1333
+ : isRangeFilter
1334
+ ? ((_a = column.getFilterValue()) === null || _a === void 0 ? void 0 : _a[rangeFilterIndex]) || []
1335
+ : (_b = column.getFilterValue()) !== null && _b !== void 0 ? _b : '';
1336
+ });
1337
+ const handleChangeDebounced = React.useCallback(material.debounce((event) => {
1338
+ let value = textFieldProps.type === 'date'
1339
+ ? new Date(event.target.value)
1340
+ : event.target.value;
1341
+ if (isRangeFilter) {
1342
+ column.setFilterValue((old) => {
1343
+ const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
1344
+ newFilterValues[rangeFilterIndex] = value;
1345
+ return newFilterValues;
1346
+ });
1347
+ }
1348
+ else {
1349
+ column.setFilterValue(value !== null && value !== void 0 ? value : undefined);
1350
+ }
1351
+ }, isTextboxFilter ? 200 : 1), []);
1352
+ const handleChange = (event) => {
1353
+ setFilterValue(event.target.value);
1354
+ handleChangeDebounced(event);
1355
+ };
1356
+ const handleClear = () => {
1357
+ if (isMultiSelectFilter) {
1358
+ setFilterValue([]);
1359
+ column.setFilterValue([]);
1360
+ }
1361
+ else if (isRangeFilter) {
1362
+ setFilterValue('');
1363
+ column.setFilterValue((old) => {
1364
+ const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
1365
+ newFilterValues[rangeFilterIndex] = undefined;
1366
+ return newFilterValues;
1367
+ });
1368
+ }
1369
+ else {
1370
+ setFilterValue('');
1371
+ column.setFilterValue(undefined);
1372
+ }
1373
+ };
1374
+ const handleClearEmptyFilterChip = () => {
1375
+ setFilterValue('');
1376
+ column.setFilterValue(undefined);
1377
+ setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: 'fuzzy' })));
1378
+ };
1379
+ const handleFilterMenuOpen = (event) => {
1380
+ setAnchorEl(event.currentTarget);
1381
+ };
1382
+ if (columnDef.Filter) {
1383
+ return React__default["default"].createElement(React__default["default"].Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
1384
+ }
1385
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
1386
+ React__default["default"].createElement(material.TextField, Object.assign({ fullWidth: true, id: filterId, inputProps: {
1387
+ disabled: !!filterChipLabel,
1388
+ sx: {
1389
+ textOverflow: 'ellipsis',
1390
+ width: filterChipLabel ? 0 : undefined,
1391
+ },
1392
+ title: filterPlaceholder,
1393
+ }, helperText: showChangeModeButton ? (React__default["default"].createElement("label", { htmlFor: filterId }, localization.filterMode.replace('{filterType}',
1394
+ // @ts-ignore
1395
+ localization[`filter${((_f = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _f === void 0 ? void 0 : _f.toUpperCase()) +
1396
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
1397
+ sx: {
1398
+ fontSize: '0.6rem',
1399
+ lineHeight: '0.8rem',
1400
+ whiteSpace: 'nowrap',
1401
+ },
1402
+ }, margin: "none", placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter
1403
+ ? undefined
1404
+ : filterPlaceholder, onChange: handleChange, onClick: (e) => e.stopPropagation(), select: isSelectFilter || isMultiSelectFilter, value: filterValue, variant: "standard", InputProps: {
1405
+ startAdornment: showChangeModeButton ? (React__default["default"].createElement(material.InputAdornment, { position: "start" },
1406
+ React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.changeFilterMode },
1407
+ React__default["default"].createElement("span", null,
1408
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
1409
+ React__default["default"].createElement(FilterListIcon, null)))),
1410
+ filterChipLabel && (React__default["default"].createElement(material.Chip, { onDelete: handleClearEmptyFilterChip, label: filterChipLabel })))) : (React__default["default"].createElement(FilterListIcon, { style: { marginRight: '4px' } })),
1411
+ endAdornment: !filterChipLabel && (React__default["default"].createElement(material.InputAdornment, { position: "end" },
1412
+ React__default["default"].createElement(material.Tooltip, { arrow: true, placement: "right", title: (_g = localization.clearFilter) !== null && _g !== void 0 ? _g : '' },
1413
+ React__default["default"].createElement("span", null,
1414
+ React__default["default"].createElement(material.IconButton, { "aria-label": localization.clearFilter, disabled: !(filterValue === null || filterValue === void 0 ? void 0 : filterValue.length), onClick: handleClear, size: "small", sx: {
1415
+ height: '1.75rem',
1416
+ width: '1.75rem',
1417
+ } },
1418
+ React__default["default"].createElement(CloseIcon, null)))))),
1419
+ }, SelectProps: {
1420
+ displayEmpty: true,
1421
+ multiple: isMultiSelectFilter,
1422
+ renderValue: isMultiSelectFilter
1423
+ ? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (React__default["default"].createElement(material.Box, { sx: { opacity: 0.5 } }, filterPlaceholder)) : (React__default["default"].createElement(material.Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' } }, selected === null || selected === void 0 ? void 0 : selected.map((value) => (React__default["default"].createElement(material.Chip, { key: value, label: value })))))
1424
+ : undefined,
1425
+ } }, textFieldProps, { sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '6rem' : 'auto', width: '100%', '& .MuiSelect-icon': {
1426
+ mr: '1.5rem',
1427
+ } }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
1428
+ ? textFieldProps.sx(theme)
1429
+ : textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))) }),
1430
+ (isSelectFilter || isMultiSelectFilter) && (React__default["default"].createElement(material.MenuItem, { divider: true, disabled: true, hidden: true, value: "" },
1431
+ React__default["default"].createElement(material.Box, { sx: { opacity: 0.5 } }, filterPlaceholder))), (_h = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterSelectOptions) === null || _h === void 0 ? void 0 :
1432
+ _h.map((option) => {
1433
+ var _a;
1434
+ let value;
1435
+ let text;
1436
+ if (typeof option !== 'object') {
1437
+ value = option;
1438
+ text = option;
1439
+ }
1440
+ else {
1441
+ value = option.value;
1442
+ text = option.text;
1443
+ }
1444
+ return (React__default["default"].createElement(material.MenuItem, { key: value, value: value },
1445
+ isMultiSelectFilter && (React__default["default"].createElement(material.Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
1446
+ React__default["default"].createElement(material.ListItemText, null, text)));
1447
+ })),
1448
+ React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table })));
1449
+ };
1450
+
1451
+ const MRT_FilterRangeFields = ({ header, table }) => {
1452
+ return (React__default["default"].createElement(material.Box, { sx: { display: 'grid', gridTemplateColumns: '6fr 6fr', gap: '1rem' } },
1453
+ React__default["default"].createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }),
1454
+ React__default["default"].createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })));
1455
+ };
1456
+
1457
+ const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
1458
+ const { getState } = table;
1459
+ const { columnFilterFns, showColumnFilters } = getState();
1460
+ const { column } = header;
1461
+ return (React__default["default"].createElement(material.Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, ['between', 'betweenInclusive', 'inNumberRange'].includes(columnFilterFns[column.id]) ? (React__default["default"].createElement(MRT_FilterRangeFields, { header: header, table: table })) : (React__default["default"].createElement(MRT_FilterTextField, { header: header, table: table }))));
1462
+ };
1463
+
1464
+ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1465
+ var _a, _b, _c;
1466
+ const { getState, options: { icons: { FilterAltIcon }, localization, }, } = table;
1467
+ const { columnFilterFns } = getState();
1468
+ const { column } = header;
1469
+ const { columnDef } = column;
1470
+ const isRangeFilter = [
1471
+ 'between',
1472
+ 'betweenInclusive',
1473
+ 'inNumberRange',
1474
+ ].includes(columnDef._filterFn);
1475
+ const currentFilterOption = columnFilterFns === null || columnFilterFns === void 0 ? void 0 : columnFilterFns[header.id];
1476
+ const filterTooltip = localization.filteringByColumn
1477
+ .replace('{column}', String(columnDef.header))
1478
+ .replace('{filterType}',
1479
+ // @ts-ignore
1480
+ localization[`filter${((_a = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _a === void 0 ? void 0 : _a.toUpperCase()) +
1481
+ (currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`])
1482
+ .replace('{filterValue}', `"${Array.isArray(column.getFilterValue())
1483
+ ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1484
+ : column.getFilterValue()}"`)
1485
+ .replace('" "', '');
1486
+ return (React__default["default"].createElement(material.Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && isRangeFilter) ||
1487
+ (!isRangeFilter && // @ts-ignore
1488
+ (!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
1489
+ React__default["default"].createElement("span", null,
1490
+ React__default["default"].createElement(material.Tooltip, { arrow: true, placement: "top", title: filterTooltip },
1491
+ React__default["default"].createElement(material.IconButton, { disableRipple: true, onClick: (event) => {
1492
+ event.stopPropagation();
1493
+ }, size: "small", sx: {
1494
+ m: 0,
1495
+ opacity: 0.8,
1496
+ p: '2px',
1497
+ transform: 'scale(0.66)',
1498
+ width: '1.5ch',
1499
+ } },
1500
+ React__default["default"].createElement(FilterAltIcon, null))))));
1501
+ };
1502
+
1503
+ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1504
+ const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder, setCurrentDraggingColumn, setCurrentHoveredColumn, } = table;
1505
+ const { columnDef } = column;
1506
+ const { currentHoveredColumn, currentDraggingColumn, columnOrder } = getState();
1507
+ const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
1508
+ ? muiTableHeadCellDragHandleProps({ column, table })
1509
+ : muiTableHeadCellDragHandleProps;
1510
+ const mcIconButtonProps = columnDef.muiTableHeadCellDragHandleProps instanceof Function
1511
+ ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1512
+ : columnDef.muiTableHeadCellDragHandleProps;
1513
+ const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1514
+ const handleDragStart = (e) => {
1515
+ setCurrentDraggingColumn(column);
1516
+ e.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1517
+ };
1518
+ const handleDragEnd = (event) => {
1519
+ onColumnDrop === null || onColumnDrop === void 0 ? void 0 : onColumnDrop({
1520
+ event,
1521
+ draggedColumn: column,
1522
+ targetColumn: currentHoveredColumn,
1523
+ });
1524
+ if ((currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === 'drop-zone') {
1525
+ column.toggleGrouping();
1526
+ }
1527
+ else if (enableColumnOrdering &&
1528
+ currentHoveredColumn &&
1529
+ (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) !== (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id)) {
1530
+ setColumnOrder(reorderColumn(column, currentHoveredColumn, columnOrder));
1531
+ }
1532
+ setCurrentDraggingColumn(null);
1533
+ setCurrentHoveredColumn(null);
1534
+ };
1535
+ return (React__default["default"].createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1536
+ };
1537
+
1538
+ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
1539
+ var _a;
1540
+ const { getState, options: { columnResizeMode }, } = table;
1541
+ const { density, showColumnFilters } = getState();
1542
+ const { column } = header;
1543
+ const { columnDef } = column;
1544
+ const { columnDefType } = columnDef;
1545
+ return (React__default["default"].createElement(material.Divider, { flexItem: true, orientation: "vertical", onDoubleClick: () => column.resetSize(), sx: (theme) => ({
1546
+ borderRadius: '2px',
1547
+ borderRightWidth: '2px',
1548
+ cursor: 'col-resize',
1549
+ height: showColumnFilters && columnDefType === 'data' ? '4rem' : '2rem',
1550
+ mr: density === 'compact' ? '-0.5rem' : '-1rem',
1551
+ opacity: 0.8,
1552
+ position: 'absolute',
1553
+ right: '1px',
1554
+ touchAction: 'none',
1555
+ transition: column.getIsResizing() ? undefined : 'all 0.2s ease-in-out',
1556
+ userSelect: 'none',
1557
+ zIndex: 4,
1558
+ '&:active': {
1559
+ backgroundColor: theme.palette.info.main,
1560
+ opacity: 1,
1561
+ },
1562
+ }), onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), style: {
1563
+ transform: column.getIsResizing()
1564
+ ? `translateX(${((_a = getState().columnSizingInfo.deltaOffset) !== null && _a !== void 0 ? _a : 0) /
1565
+ (columnResizeMode === 'onChange' ? 16 : 1)}px)`
1566
+ : 'none',
1567
+ } }));
1568
+ };
1569
+
1570
+ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
1571
+ const { options: { localization }, } = table;
1572
+ const { column } = header;
1573
+ const { columnDef } = column;
1574
+ const sortTooltip = !!column.getIsSorted()
1575
+ ? column.getIsSorted() === 'desc'
1576
+ ? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
1577
+ : localization.sortedByColumnAsc.replace('{column}', columnDef.header)
1578
+ : localization.unsorted;
1579
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, placement: "top", title: sortTooltip },
1580
+ React__default["default"].createElement(material.TableSortLabel, { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
1581
+ ? column.getIsSorted()
1582
+ : undefined, sx: {
1583
+ width: '2ch',
1584
+ transform: 'translateX(-0.5ch)',
1585
+ } })));
1586
+ };
1587
+
1588
+ const MRT_TableHeadCell = ({ header, table }) => {
1589
+ var _a, _b, _c, _d;
1590
+ const theme = material.useTheme();
1591
+ const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setCurrentHoveredColumn, } = table;
1592
+ const { density, currentDraggingColumn, currentHoveredColumn, showColumnFilters, } = getState();
1593
+ const { column } = header;
1594
+ const { columnDef } = column;
1595
+ const { columnDefType } = columnDef;
1596
+ const mTableHeadCellProps = muiTableHeadCellProps instanceof Function
1597
+ ? muiTableHeadCellProps({ column, table })
1598
+ : muiTableHeadCellProps;
1599
+ const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
1600
+ ? columnDef.muiTableHeadCellProps({ column, table })
1601
+ : columnDef.muiTableHeadCellProps;
1602
+ const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
1603
+ const getIsLastLeftPinnedColumn = () => {
1604
+ return (column.getIsPinned() === 'left' &&
1605
+ table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
1606
+ };
1607
+ const getIsFirstRightPinnedColumn = () => {
1608
+ return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
1609
+ };
1610
+ const getTotalRight = () => {
1611
+ return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
1612
+ };
1613
+ const handleDragEnter = (_e) => {
1614
+ if (enableGrouping && (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === 'drop-zone') {
1615
+ setCurrentHoveredColumn(null);
1616
+ }
1617
+ if (enableColumnOrdering && currentDraggingColumn) {
1618
+ setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
1619
+ }
1620
+ };
1621
+ const draggingBorder = (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id) === column.id
1622
+ ? `1px dashed ${theme.palette.text.secondary}`
1623
+ : (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
1624
+ ? `2px dashed ${theme.palette.primary.main}`
1625
+ : undefined;
1626
+ const draggingBorders = draggingBorder
1627
+ ? {
1628
+ borderLeft: draggingBorder,
1629
+ borderRight: draggingBorder,
1630
+ borderTop: draggingBorder,
1631
+ }
1632
+ : undefined;
1633
+ const headerElement = ((_b = ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) instanceof Function
1634
+ ? (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
1635
+ column,
1636
+ header,
1637
+ table,
1638
+ })
1639
+ : columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header)) !== null && _b !== void 0 ? _b : columnDef.header);
1640
+ const tableHeadCellRef = React__default["default"].useRef(null);
1641
+ return (React__default["default"].createElement(material.TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => {
1642
+ var _a;
1643
+ return (Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && columnDefType !== 'group'
1644
+ ? material.alpha(material.lighten(theme.palette.background.default, 0.04), 0.95)
1645
+ : 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn()
1646
+ ? `4px 0 4px -2px ${material.alpha(theme.palette.common.black, 0.1)}`
1647
+ : getIsFirstRightPinnedColumn()
1648
+ ? `-4px 0 4px -2px ${material.alpha(theme.palette.common.black, 0.1)}`
1649
+ : undefined, fontWeight: 'bold', left: column.getIsPinned() === 'left'
1650
+ ? `${column.getStart('left')}px`
1651
+ : undefined, overflow: 'visible', opacity: (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id) === column.id ||
1652
+ (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
1653
+ ? 0.5
1654
+ : 1, p: density === 'compact'
1655
+ ? '0.5rem'
1656
+ : density === 'comfortable'
1657
+ ? columnDefType === 'display'
1658
+ ? '0.75rem'
1659
+ : '1rem'
1660
+ : columnDefType === 'display'
1661
+ ? '1rem 1.25rem'
1662
+ : '1.5rem', pb: columnDefType === 'display'
1663
+ ? 0
1664
+ : showColumnFilters || density === 'compact'
1665
+ ? '0.4rem'
1666
+ : '0.6rem', position: column.getIsPinned() && columnDefType !== 'group'
1667
+ ? 'sticky'
1668
+ : undefined, pt: columnDefType === 'group'
1669
+ ? 0
1670
+ : density === 'compact'
1671
+ ? '0.25'
1672
+ : density === 'comfortable'
1673
+ ? '.75rem'
1674
+ : '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id) === column.id
1675
+ ? 3
1676
+ : column.getIsPinned() && columnDefType !== 'group'
1677
+ ? 2
1678
+ : 1 }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
1679
+ ? tableCellProps.sx(theme)
1680
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: header.getSize() }));
1681
+ } }),
1682
+ header.isPlaceholder ? null : (React__default["default"].createElement(material.Box, { sx: {
1683
+ alignItems: 'flex-start',
1684
+ display: 'flex',
1685
+ justifyContent: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right'
1686
+ ? 'flex-end'
1687
+ : columnDefType === 'group' ||
1688
+ (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
1689
+ ? 'center'
1690
+ : 'space-between',
1691
+ position: 'relative',
1692
+ width: '100%',
1693
+ } },
1694
+ React__default["default"].createElement(material.Box, { onClick: column.getToggleSortingHandler(), sx: {
1695
+ alignItems: 'center',
1696
+ cursor: column.getCanSort() && columnDefType !== 'group'
1697
+ ? 'pointer'
1698
+ : undefined,
1699
+ display: 'flex',
1700
+ flexWrap: 'nowrap',
1701
+ m: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' ? 'auto' : undefined,
1702
+ pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center' && column.getCanSort()
1703
+ ? '1rem'
1704
+ : undefined,
1705
+ whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 24 ? 'nowrap' : 'normal',
1706
+ } },
1707
+ headerElement,
1708
+ column.getCanSort() && (React__default["default"].createElement(MRT_TableHeadCellSortLabel, { header: header, table: table })),
1709
+ column.getCanFilter() && (React__default["default"].createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
1710
+ columnDefType !== 'group' && (React__default["default"].createElement(material.Box, { sx: { whiteSpace: 'nowrap' } },
1711
+ ((enableColumnDragging &&
1712
+ columnDef.enableColumnDragging !== false) ||
1713
+ (enableColumnOrdering &&
1714
+ columnDef.enableColumnOrdering !== false) ||
1715
+ (enableGrouping && columnDef.enableGrouping !== false)) && (React__default["default"].createElement(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: tableHeadCellRef })),
1716
+ (enableColumnActions || columnDef.enableColumnActions) &&
1717
+ columnDef.enableColumnActions !== false && (React__default["default"].createElement(MRT_TableHeadCellColumnActionsButton, { header: header, table: table })))),
1718
+ column.getCanResize() && (React__default["default"].createElement(MRT_TableHeadCellResizeHandle, { header: header, table: table })))),
1719
+ column.getCanFilter() && (React__default["default"].createElement(MRT_TableHeadCellFilterContainer, { header: header, table: table }))));
1720
+ };
1721
+
1722
+ const MRT_TableHeadRow = ({ headerGroup, table }) => {
1723
+ const { options: { muiTableHeadRowProps }, } = table;
1724
+ const tableRowProps = muiTableHeadRowProps instanceof Function
1725
+ ? muiTableHeadRowProps({ headerGroup, table })
1726
+ : muiTableHeadRowProps;
1727
+ return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ boxShadow: `4px 0 8px ${material.alpha(theme.palette.common.black, 0.1)}`, backgroundColor: material.lighten(theme.palette.background.default, 0.04) }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)) }), headerGroup.headers.map((header, index) => (React__default["default"].createElement(MRT_TableHeadCell, { header: header, key: header.id || index, table: table })))));
1728
+ };
1729
+
1730
+ const MRT_TableHead = ({ table }) => {
1731
+ const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
1732
+ const tableHeadProps = muiTableHeadProps instanceof Function
1733
+ ? muiTableHeadProps({ table })
1734
+ : muiTableHeadProps;
1735
+ return (React__default["default"].createElement(material.TableHead, Object.assign({}, tableHeadProps), getHeaderGroups().map((headerGroup) => (React__default["default"].createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
1736
+ };
1737
+
1738
+ function _extends() {
1739
+ _extends = Object.assign || function (target) {
1740
+ for (var i = 1; i < arguments.length; i++) {
1741
+ var source = arguments[i];
1742
+
1743
+ for (var key in source) {
1744
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1745
+ target[key] = source[key];
1746
+ }
1747
+ }
1748
+ }
1749
+
1750
+ return target;
1751
+ };
1752
+
1753
+ return _extends.apply(this, arguments);
1754
+ }
1755
+
1756
+ function _objectWithoutPropertiesLoose(source, excluded) {
1757
+ if (source == null) return {};
1758
+ var target = {};
1759
+ var sourceKeys = Object.keys(source);
1760
+ var key, i;
1761
+
1762
+ for (i = 0; i < sourceKeys.length; i++) {
1763
+ key = sourceKeys[i];
1764
+ if (excluded.indexOf(key) >= 0) continue;
1765
+ target[key] = source[key];
1766
+ }
1767
+
1768
+ return target;
1769
+ }
1770
+
1771
+ var props = ['bottom', 'height', 'left', 'right', 'top', 'width'];
1772
+
1773
+ var rectChanged = function rectChanged(a, b) {
1774
+ if (a === void 0) {
1775
+ a = {};
1776
+ }
1777
+
1778
+ if (b === void 0) {
1779
+ b = {};
1780
+ }
1781
+
1782
+ return props.some(function (prop) {
1783
+ return a[prop] !== b[prop];
1784
+ });
1785
+ };
1786
+
1787
+ var observedNodes = /*#__PURE__*/new Map();
1788
+ var rafId;
1789
+
1790
+ var run = function run() {
1791
+ var changedStates = [];
1792
+ observedNodes.forEach(function (state, node) {
1793
+ var newRect = node.getBoundingClientRect();
1794
+
1795
+ if (rectChanged(newRect, state.rect)) {
1796
+ state.rect = newRect;
1797
+ changedStates.push(state);
1798
+ }
1799
+ });
1800
+ changedStates.forEach(function (state) {
1801
+ state.callbacks.forEach(function (cb) {
1802
+ return cb(state.rect);
1803
+ });
1804
+ });
1805
+ rafId = window.requestAnimationFrame(run);
1806
+ };
1807
+
1808
+ function observeRect(node, cb) {
1809
+ return {
1810
+ observe: function observe() {
1811
+ var wasEmpty = observedNodes.size === 0;
1812
+
1813
+ if (observedNodes.has(node)) {
1814
+ observedNodes.get(node).callbacks.push(cb);
1815
+ } else {
1816
+ observedNodes.set(node, {
1817
+ rect: undefined,
1818
+ hasRectChanged: false,
1819
+ callbacks: [cb]
1820
+ });
1821
+ }
1822
+
1823
+ if (wasEmpty) run();
1824
+ },
1825
+ unobserve: function unobserve() {
1826
+ var state = observedNodes.get(node);
1827
+
1828
+ if (state) {
1829
+ // Remove the callback
1830
+ var index = state.callbacks.indexOf(cb);
1831
+ if (index >= 0) state.callbacks.splice(index, 1); // Remove the node reference
1832
+
1833
+ if (!state.callbacks.length) observedNodes["delete"](node); // Stop the loop
1834
+
1835
+ if (!observedNodes.size) cancelAnimationFrame(rafId);
1836
+ }
1837
+ }
1838
+ };
1839
+ }
1840
+
1841
+ var useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React__default["default"].useLayoutEffect : React__default["default"].useEffect;
1842
+
1843
+ function useRect(nodeRef, initialRect) {
1844
+ if (initialRect === void 0) {
1845
+ initialRect = {
1846
+ width: 0,
1847
+ height: 0
1848
+ };
1849
+ }
1850
+
1851
+ var _React$useState = React__default["default"].useState(nodeRef.current),
1852
+ element = _React$useState[0],
1853
+ setElement = _React$useState[1];
1854
+
1855
+ var _React$useReducer = React__default["default"].useReducer(rectReducer, initialRect),
1856
+ rect = _React$useReducer[0],
1857
+ dispatch = _React$useReducer[1];
1858
+
1859
+ var initialRectSet = React__default["default"].useRef(false);
1860
+ useIsomorphicLayoutEffect$1(function () {
1861
+ if (nodeRef.current !== element) {
1862
+ setElement(nodeRef.current);
1863
+ }
1864
+ });
1865
+ useIsomorphicLayoutEffect$1(function () {
1866
+ if (element && !initialRectSet.current) {
1867
+ initialRectSet.current = true;
1868
+
1869
+ var _rect = element.getBoundingClientRect();
1870
+
1871
+ dispatch({
1872
+ rect: _rect
1873
+ });
1874
+ }
1875
+ }, [element]);
1876
+ React__default["default"].useEffect(function () {
1877
+ if (!element) {
1878
+ return;
1879
+ }
1880
+
1881
+ var observer = observeRect(element, function (rect) {
1882
+ dispatch({
1883
+ rect: rect
1884
+ });
1885
+ });
1886
+ observer.observe();
1887
+ return function () {
1888
+ observer.unobserve();
1889
+ };
1890
+ }, [element]);
1891
+ return rect;
1892
+ }
1893
+
1894
+ function rectReducer(state, action) {
1895
+ var rect = action.rect;
1896
+
1897
+ if (state.height !== rect.height || state.width !== rect.width) {
1898
+ return rect;
1899
+ }
1900
+
1901
+ return state;
1902
+ }
1903
+
1904
+ var defaultEstimateSize = function defaultEstimateSize() {
1905
+ return 50;
1906
+ };
1907
+
1908
+ var defaultKeyExtractor = function defaultKeyExtractor(index) {
1909
+ return index;
1910
+ };
1911
+
1912
+ var defaultMeasureSize = function defaultMeasureSize(el, horizontal) {
1913
+ var key = horizontal ? 'offsetWidth' : 'offsetHeight';
1914
+ return el[key];
1915
+ };
1916
+
1917
+ var defaultRangeExtractor = function defaultRangeExtractor(range) {
1918
+ var start = Math.max(range.start - range.overscan, 0);
1919
+ var end = Math.min(range.end + range.overscan, range.size - 1);
1920
+ var arr = [];
1921
+
1922
+ for (var i = start; i <= end; i++) {
1923
+ arr.push(i);
1924
+ }
1925
+
1926
+ return arr;
1927
+ };
1928
+ function useVirtual(_ref) {
1929
+ var _measurements;
1930
+
1931
+ var _ref$size = _ref.size,
1932
+ size = _ref$size === void 0 ? 0 : _ref$size,
1933
+ _ref$estimateSize = _ref.estimateSize,
1934
+ estimateSize = _ref$estimateSize === void 0 ? defaultEstimateSize : _ref$estimateSize,
1935
+ _ref$overscan = _ref.overscan,
1936
+ overscan = _ref$overscan === void 0 ? 1 : _ref$overscan,
1937
+ _ref$paddingStart = _ref.paddingStart,
1938
+ paddingStart = _ref$paddingStart === void 0 ? 0 : _ref$paddingStart,
1939
+ _ref$paddingEnd = _ref.paddingEnd,
1940
+ paddingEnd = _ref$paddingEnd === void 0 ? 0 : _ref$paddingEnd,
1941
+ parentRef = _ref.parentRef,
1942
+ horizontal = _ref.horizontal,
1943
+ scrollToFn = _ref.scrollToFn,
1944
+ useObserver = _ref.useObserver,
1945
+ initialRect = _ref.initialRect,
1946
+ onScrollElement = _ref.onScrollElement,
1947
+ scrollOffsetFn = _ref.scrollOffsetFn,
1948
+ _ref$keyExtractor = _ref.keyExtractor,
1949
+ keyExtractor = _ref$keyExtractor === void 0 ? defaultKeyExtractor : _ref$keyExtractor,
1950
+ _ref$measureSize = _ref.measureSize,
1951
+ measureSize = _ref$measureSize === void 0 ? defaultMeasureSize : _ref$measureSize,
1952
+ _ref$rangeExtractor = _ref.rangeExtractor,
1953
+ rangeExtractor = _ref$rangeExtractor === void 0 ? defaultRangeExtractor : _ref$rangeExtractor;
1954
+ var sizeKey = horizontal ? 'width' : 'height';
1955
+ var scrollKey = horizontal ? 'scrollLeft' : 'scrollTop';
1956
+ var latestRef = React__default["default"].useRef({
1957
+ scrollOffset: 0,
1958
+ measurements: []
1959
+ });
1960
+
1961
+ var _React$useState = React__default["default"].useState(0),
1962
+ scrollOffset = _React$useState[0],
1963
+ setScrollOffset = _React$useState[1];
1964
+
1965
+ latestRef.current.scrollOffset = scrollOffset;
1966
+ var useMeasureParent = useObserver || useRect;
1967
+
1968
+ var _useMeasureParent = useMeasureParent(parentRef, initialRect),
1969
+ outerSize = _useMeasureParent[sizeKey];
1970
+
1971
+ latestRef.current.outerSize = outerSize;
1972
+ var defaultScrollToFn = React__default["default"].useCallback(function (offset) {
1973
+ if (parentRef.current) {
1974
+ parentRef.current[scrollKey] = offset;
1975
+ }
1976
+ }, [parentRef, scrollKey]);
1977
+ var resolvedScrollToFn = scrollToFn || defaultScrollToFn;
1978
+ scrollToFn = React__default["default"].useCallback(function (offset) {
1979
+ resolvedScrollToFn(offset, defaultScrollToFn);
1980
+ }, [defaultScrollToFn, resolvedScrollToFn]);
1981
+
1982
+ var _React$useState2 = React__default["default"].useState({}),
1983
+ measuredCache = _React$useState2[0],
1984
+ setMeasuredCache = _React$useState2[1];
1985
+
1986
+ var measure = React__default["default"].useCallback(function () {
1987
+ return setMeasuredCache({});
1988
+ }, []);
1989
+ var pendingMeasuredCacheIndexesRef = React__default["default"].useRef([]);
1990
+ var measurements = React__default["default"].useMemo(function () {
1991
+ var min = pendingMeasuredCacheIndexesRef.current.length > 0 ? Math.min.apply(Math, pendingMeasuredCacheIndexesRef.current) : 0;
1992
+ pendingMeasuredCacheIndexesRef.current = [];
1993
+ var measurements = latestRef.current.measurements.slice(0, min);
1994
+
1995
+ for (var i = min; i < size; i++) {
1996
+ var key = keyExtractor(i);
1997
+ var measuredSize = measuredCache[key];
1998
+
1999
+ var _start = measurements[i - 1] ? measurements[i - 1].end : paddingStart;
2000
+
2001
+ var _size = typeof measuredSize === 'number' ? measuredSize : estimateSize(i);
2002
+
2003
+ var _end = _start + _size;
2004
+
2005
+ measurements[i] = {
2006
+ index: i,
2007
+ start: _start,
2008
+ size: _size,
2009
+ end: _end,
2010
+ key: key
2011
+ };
2012
+ }
2013
+
2014
+ return measurements;
2015
+ }, [estimateSize, measuredCache, paddingStart, size, keyExtractor]);
2016
+ var totalSize = (((_measurements = measurements[size - 1]) == null ? void 0 : _measurements.end) || paddingStart) + paddingEnd;
2017
+ latestRef.current.measurements = measurements;
2018
+ latestRef.current.totalSize = totalSize;
2019
+ var element = onScrollElement ? onScrollElement.current : parentRef.current;
2020
+ var scrollOffsetFnRef = React__default["default"].useRef(scrollOffsetFn);
2021
+ scrollOffsetFnRef.current = scrollOffsetFn;
2022
+ useIsomorphicLayoutEffect$1(function () {
2023
+ if (!element) {
2024
+ setScrollOffset(0);
2025
+ return;
2026
+ }
2027
+
2028
+ var onScroll = function onScroll(event) {
2029
+ var offset = scrollOffsetFnRef.current ? scrollOffsetFnRef.current(event) : element[scrollKey];
2030
+ setScrollOffset(offset);
2031
+ };
2032
+
2033
+ onScroll();
2034
+ element.addEventListener('scroll', onScroll, {
2035
+ capture: false,
2036
+ passive: true
2037
+ });
2038
+ return function () {
2039
+ element.removeEventListener('scroll', onScroll);
2040
+ };
2041
+ }, [element, scrollKey]);
2042
+
2043
+ var _calculateRange = calculateRange(latestRef.current),
2044
+ start = _calculateRange.start,
2045
+ end = _calculateRange.end;
2046
+
2047
+ var indexes = React__default["default"].useMemo(function () {
2048
+ return rangeExtractor({
2049
+ start: start,
2050
+ end: end,
2051
+ overscan: overscan,
2052
+ size: measurements.length
2053
+ });
2054
+ }, [start, end, overscan, measurements.length, rangeExtractor]);
2055
+ var measureSizeRef = React__default["default"].useRef(measureSize);
2056
+ measureSizeRef.current = measureSize;
2057
+ var virtualItems = React__default["default"].useMemo(function () {
2058
+ var virtualItems = [];
2059
+
2060
+ var _loop = function _loop(k, len) {
2061
+ var i = indexes[k];
2062
+ var measurement = measurements[i];
2063
+
2064
+ var item = _extends(_extends({}, measurement), {}, {
2065
+ measureRef: function measureRef(el) {
2066
+ if (el) {
2067
+ var measuredSize = measureSizeRef.current(el, horizontal);
2068
+
2069
+ if (measuredSize !== item.size) {
2070
+ var _scrollOffset = latestRef.current.scrollOffset;
2071
+
2072
+ if (item.start < _scrollOffset) {
2073
+ defaultScrollToFn(_scrollOffset + (measuredSize - item.size));
2074
+ }
2075
+
2076
+ pendingMeasuredCacheIndexesRef.current.push(i);
2077
+ setMeasuredCache(function (old) {
2078
+ var _extends2;
2079
+
2080
+ return _extends(_extends({}, old), {}, (_extends2 = {}, _extends2[item.key] = measuredSize, _extends2));
2081
+ });
2082
+ }
2083
+ }
2084
+ }
2085
+ });
2086
+
2087
+ virtualItems.push(item);
2088
+ };
2089
+
2090
+ for (var k = 0, len = indexes.length; k < len; k++) {
2091
+ _loop(k);
2092
+ }
2093
+
2094
+ return virtualItems;
2095
+ }, [indexes, defaultScrollToFn, horizontal, measurements]);
2096
+ var mountedRef = React__default["default"].useRef(false);
2097
+ useIsomorphicLayoutEffect$1(function () {
2098
+ if (mountedRef.current) {
2099
+ setMeasuredCache({});
2100
+ }
2101
+
2102
+ mountedRef.current = true;
2103
+ }, [estimateSize]);
2104
+ var scrollToOffset = React__default["default"].useCallback(function (toOffset, _temp) {
2105
+ var _ref2 = _temp === void 0 ? {} : _temp,
2106
+ _ref2$align = _ref2.align,
2107
+ align = _ref2$align === void 0 ? 'start' : _ref2$align;
2108
+
2109
+ var _latestRef$current = latestRef.current,
2110
+ scrollOffset = _latestRef$current.scrollOffset,
2111
+ outerSize = _latestRef$current.outerSize;
2112
+
2113
+ if (align === 'auto') {
2114
+ if (toOffset <= scrollOffset) {
2115
+ align = 'start';
2116
+ } else if (toOffset >= scrollOffset + outerSize) {
2117
+ align = 'end';
2118
+ } else {
2119
+ align = 'start';
2120
+ }
2121
+ }
2122
+
2123
+ if (align === 'start') {
2124
+ scrollToFn(toOffset);
2125
+ } else if (align === 'end') {
2126
+ scrollToFn(toOffset - outerSize);
2127
+ } else if (align === 'center') {
2128
+ scrollToFn(toOffset - outerSize / 2);
2129
+ }
2130
+ }, [scrollToFn]);
2131
+ var tryScrollToIndex = React__default["default"].useCallback(function (index, _temp2) {
2132
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
2133
+ _ref3$align = _ref3.align,
2134
+ align = _ref3$align === void 0 ? 'auto' : _ref3$align,
2135
+ rest = _objectWithoutPropertiesLoose(_ref3, ["align"]);
2136
+
2137
+ var _latestRef$current2 = latestRef.current,
2138
+ measurements = _latestRef$current2.measurements,
2139
+ scrollOffset = _latestRef$current2.scrollOffset,
2140
+ outerSize = _latestRef$current2.outerSize;
2141
+ var measurement = measurements[Math.max(0, Math.min(index, size - 1))];
2142
+
2143
+ if (!measurement) {
2144
+ return;
2145
+ }
2146
+
2147
+ if (align === 'auto') {
2148
+ if (measurement.end >= scrollOffset + outerSize) {
2149
+ align = 'end';
2150
+ } else if (measurement.start <= scrollOffset) {
2151
+ align = 'start';
2152
+ } else {
2153
+ return;
2154
+ }
2155
+ }
2156
+
2157
+ var toOffset = align === 'center' ? measurement.start + measurement.size / 2 : align === 'end' ? measurement.end : measurement.start;
2158
+ scrollToOffset(toOffset, _extends({
2159
+ align: align
2160
+ }, rest));
2161
+ }, [scrollToOffset, size]);
2162
+ var scrollToIndex = React__default["default"].useCallback(function () {
2163
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2164
+ args[_key] = arguments[_key];
2165
+ }
2166
+
2167
+ // We do a double request here because of
2168
+ // dynamic sizes which can cause offset shift
2169
+ // and end up in the wrong spot. Unfortunately,
2170
+ // we can't know about those dynamic sizes until
2171
+ // we try and render them. So double down!
2172
+ tryScrollToIndex.apply(void 0, args);
2173
+ requestAnimationFrame(function () {
2174
+ tryScrollToIndex.apply(void 0, args);
2175
+ });
2176
+ }, [tryScrollToIndex]);
2177
+ return {
2178
+ virtualItems: virtualItems,
2179
+ totalSize: totalSize,
2180
+ scrollToOffset: scrollToOffset,
2181
+ scrollToIndex: scrollToIndex,
2182
+ measure: measure
2183
+ };
2184
+ }
2185
+
2186
+ var findNearestBinarySearch = function findNearestBinarySearch(low, high, getCurrentValue, value) {
2187
+ while (low <= high) {
2188
+ var middle = (low + high) / 2 | 0;
2189
+ var currentValue = getCurrentValue(middle);
2190
+
2191
+ if (currentValue < value) {
2192
+ low = middle + 1;
2193
+ } else if (currentValue > value) {
2194
+ high = middle - 1;
2195
+ } else {
2196
+ return middle;
2197
+ }
2198
+ }
2199
+
2200
+ if (low > 0) {
2201
+ return low - 1;
2202
+ } else {
2203
+ return 0;
2204
+ }
2205
+ };
2206
+
2207
+ function calculateRange(_ref4) {
2208
+ var measurements = _ref4.measurements,
2209
+ outerSize = _ref4.outerSize,
2210
+ scrollOffset = _ref4.scrollOffset;
2211
+ var size = measurements.length - 1;
2212
+
2213
+ var getOffset = function getOffset(index) {
2214
+ return measurements[index].start;
2215
+ };
2216
+
2217
+ var start = findNearestBinarySearch(0, size, getOffset, scrollOffset);
2218
+ var end = start;
2219
+
2220
+ while (end < size && measurements[end].end < scrollOffset + outerSize) {
2221
+ end++;
2222
+ }
2223
+
2224
+ return {
2225
+ start: start,
2226
+ end: end
2227
+ };
2228
+ }
2229
+
2230
+ const MRT_EditCellTextField = ({ cell, table }) => {
2231
+ var _a;
2232
+ const { getState, options: { tableId, enableEditing, muiTableBodyCellEditTextFieldProps, onCellEditBlur, onCellEditChange, }, setCurrentEditingCell, setCurrentEditingRow, } = table;
2233
+ const { column, row } = cell;
2234
+ const { columnDef } = column;
2235
+ const [value, setValue] = React.useState(cell.getValue());
2236
+ const handleChange = (event) => {
2237
+ var _a;
2238
+ setValue(event.target.value);
2239
+ (_a = columnDef.onCellEditChange) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table });
2240
+ onCellEditChange === null || onCellEditChange === void 0 ? void 0 : onCellEditChange({ event, cell, table });
2241
+ };
2242
+ const handleBlur = (event) => {
2243
+ var _a;
2244
+ if (getState().currentEditingRow) {
2245
+ if (!row._valuesCache)
2246
+ row._valuesCache = {};
2247
+ row._valuesCache[column.id] = value;
2248
+ setCurrentEditingRow(Object.assign({}, getState().currentEditingRow));
2249
+ }
2250
+ setCurrentEditingCell(null);
2251
+ (_a = columnDef.onCellEditBlur) === null || _a === void 0 ? void 0 : _a.call(columnDef, { event, cell, table });
2252
+ onCellEditBlur === null || onCellEditBlur === void 0 ? void 0 : onCellEditBlur({ event, cell, table });
2253
+ };
2254
+ const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
2255
+ ? muiTableBodyCellEditTextFieldProps({ cell, table })
2256
+ : muiTableBodyCellEditTextFieldProps;
2257
+ const mcTableBodyCellEditTextFieldProps = columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
2258
+ ? columnDef.muiTableBodyCellEditTextFieldProps({
2259
+ cell,
2260
+ table,
2261
+ })
2262
+ : columnDef.muiTableBodyCellEditTextFieldProps;
2263
+ const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
2264
+ if (enableEditing && columnDef.enableEditing !== false && columnDef.Edit) {
2265
+ return React__default["default"].createElement(React__default["default"].Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, table }));
2266
+ }
2267
+ return (React__default["default"].createElement(material.TextField, Object.assign({ id: `mrt-${tableId}-edit-cell-text-field-${cell.id}`, margin: "dense", onBlur: handleBlur, onChange: handleChange, onClick: (e) => e.stopPropagation(), placeholder: columnDef.header, value: value, variant: "standard" }, textFieldProps)));
2268
+ };
2269
+
2270
+ const MRT_CopyButton = ({ cell, children, table }) => {
2271
+ const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
2272
+ const { column } = cell;
2273
+ const { columnDef } = column;
2274
+ const [copied, setCopied] = React.useState(false);
2275
+ const handleCopy = (text) => {
2276
+ navigator.clipboard.writeText(text);
2277
+ setCopied(true);
2278
+ setTimeout(() => setCopied(false), 4000);
2279
+ };
2280
+ const mTableBodyCellCopyButtonProps = muiTableBodyCellCopyButtonProps instanceof Function
2281
+ ? muiTableBodyCellCopyButtonProps({ cell, table })
2282
+ : muiTableBodyCellCopyButtonProps;
2283
+ const mcTableBodyCellCopyButtonProps = columnDef.muiTableBodyCellCopyButtonProps instanceof Function
2284
+ ? columnDef.muiTableBodyCellCopyButtonProps({
2285
+ cell,
2286
+ table,
2287
+ })
2288
+ : columnDef.muiTableBodyCellCopyButtonProps;
2289
+ const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
2290
+ return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: copied ? localization.copiedToClipboard : localization.clickToCopy },
2291
+ React__default["default"].createElement(material.Button, Object.assign({ onClick: () => handleCopy(cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
2292
+ ? buttonProps.sx(theme)
2293
+ : buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))) }), children)));
2294
+ };
2295
+
2296
+ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
2297
+ const { options: { muiTableBodyRowDragHandleProps, onRowDrop }, } = table;
2298
+ const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
2299
+ ? muiTableBodyRowDragHandleProps({ row: cell.row, table })
2300
+ : muiTableBodyRowDragHandleProps;
2301
+ const handleDragStart = (e) => {
2302
+ e.dataTransfer.setDragImage(rowRef.current, 0, 0);
2303
+ table.setCurrentDraggingRow(cell.row);
2304
+ };
2305
+ const handleDragEnd = (event) => {
2306
+ onRowDrop === null || onRowDrop === void 0 ? void 0 : onRowDrop({
2307
+ event,
2308
+ draggedRow: table.getState().currentDraggingRow,
2309
+ targetRow: table.getState().currentHoveredRow,
2310
+ });
2311
+ table.setCurrentDraggingRow(null);
2312
+ table.setCurrentHoveredRow(null);
2313
+ };
2314
+ return (React__default["default"].createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
2315
+ };
2316
+
2317
+ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
2318
+ var _a, _b, _c, _d, _f, _g, _h, _j;
2319
+ const theme = material.useTheme();
2320
+ const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, tableId, }, setCurrentEditingCell, setCurrentHoveredColumn, } = table;
2321
+ const { currentDraggingColumn, currentEditingCell, currentEditingRow, currentHoveredColumn, density, isLoading, showSkeletons, } = getState();
2322
+ const { column, row } = cell;
2323
+ const { columnDef } = column;
2324
+ const { columnDefType } = columnDef;
2325
+ const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
2326
+ ? muiTableBodyCellProps({ cell, table })
2327
+ : muiTableBodyCellProps;
2328
+ const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
2329
+ ? columnDef.muiTableBodyCellProps({ cell, table })
2330
+ : columnDef.muiTableBodyCellProps;
2331
+ const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
2332
+ const isEditable = (enableEditing || columnDef.enableEditing) &&
2333
+ columnDef.enableEditing !== false;
2334
+ const isEditing = isEditable &&
2335
+ (editingMode === 'table' ||
2336
+ (currentEditingRow === null || currentEditingRow === void 0 ? void 0 : currentEditingRow.id) === row.id ||
2337
+ (currentEditingCell === null || currentEditingCell === void 0 ? void 0 : currentEditingCell.id) === cell.id);
2338
+ const [skeletonWidth, setSkeletonWidth] = React.useState(0);
2339
+ React.useEffect(() => setSkeletonWidth(isLoading || showSkeletons
2340
+ ? columnDefType === 'display'
2341
+ ? column.getSize() / 2
2342
+ : Math.round(Math.random() * (column.getSize() - column.getSize() / 3) +
2343
+ column.getSize() / 3)
2344
+ : 100), [isLoading, showSkeletons]);
2345
+ const handleDoubleClick = (_event) => {
2346
+ if ((enableEditing || columnDef.enableEditing) &&
2347
+ columnDef.enableEditing !== false &&
2348
+ editingMode === 'cell') {
2349
+ setCurrentEditingCell(cell);
2350
+ setTimeout(() => {
2351
+ const textField = document.getElementById(`mrt-${tableId}-edit-cell-text-field-${cell.id}`);
2352
+ if (textField) {
2353
+ textField.focus();
2354
+ textField.select();
2355
+ }
2356
+ }, 200);
2357
+ }
2358
+ };
2359
+ const getIsLastLeftPinnedColumn = () => {
2360
+ return (column.getIsPinned() === 'left' &&
2361
+ table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
2362
+ };
2363
+ const getIsFirstRightPinnedColumn = () => {
2364
+ return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
2365
+ };
2366
+ const getTotalRight = () => {
2367
+ return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
2368
+ };
2369
+ const handleDragEnter = (_e) => {
2370
+ if (enableGrouping && (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === 'drop-zone') {
2371
+ setCurrentHoveredColumn(null);
2372
+ }
2373
+ if (enableColumnOrdering && currentDraggingColumn) {
2374
+ setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
2375
+ }
2376
+ };
2377
+ const draggingBorder = (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id) === column.id
2378
+ ? `1px dashed ${theme.palette.text.secondary}`
2379
+ : (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
2380
+ ? `2px dashed ${theme.palette.primary.main}`
2381
+ : undefined;
2382
+ const draggingBorders = draggingBorder
2383
+ ? {
2384
+ borderLeft: draggingBorder,
2385
+ borderRight: draggingBorder,
2386
+ borderBottom: row.index ===
2387
+ (enablePagination
2388
+ ? table.getRowModel()
2389
+ : table.getPrePaginationRowModel()).rows.length -
2390
+ 1
2391
+ ? draggingBorder
2392
+ : undefined,
2393
+ }
2394
+ : undefined;
2395
+ return (React__default["default"].createElement(material.TableCell, Object.assign({ onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter }, tableCellProps, { sx: (theme) => {
2396
+ var _a;
2397
+ return (Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned()
2398
+ ? material.alpha(material.lighten(theme.palette.background.default, 0.04), 0.95)
2399
+ : undefined, boxShadow: getIsLastLeftPinnedColumn()
2400
+ ? `4px 0 4px -2px ${material.alpha(theme.palette.common.black, 0.1)}`
2401
+ : getIsFirstRightPinnedColumn()
2402
+ ? `-4px 0 4px -2px ${material.alpha(theme.palette.common.black, 0.1)}`
2403
+ : undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', left: column.getIsPinned() === 'left'
2404
+ ? `${column.getStart('left')}px`
2405
+ : undefined, opacity: (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id) === column.id ||
2406
+ (currentHoveredColumn === null || currentHoveredColumn === void 0 ? void 0 : currentHoveredColumn.id) === column.id
2407
+ ? 0.5
2408
+ : 1, overflow: 'hidden', p: density === 'compact'
2409
+ ? columnDefType === 'display'
2410
+ ? '0 0.5rem'
2411
+ : '0.5rem'
2412
+ : density === 'comfortable'
2413
+ ? columnDefType === 'display'
2414
+ ? '0.5rem 0.75rem'
2415
+ : '1rem'
2416
+ : columnDefType === 'display'
2417
+ ? '1rem 1.25rem'
2418
+ : '1.5rem', pl: column.id === 'mrt-row-expand'
2419
+ ? `${row.depth +
2420
+ (density === 'compact'
2421
+ ? 0.5
2422
+ : density === 'comfortable'
2423
+ ? 0.75
2424
+ : 1.25)}rem`
2425
+ : undefined, position: column.getIsPinned() ? 'sticky' : 'relative', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, transition: 'all 0.2s ease-in-out', whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (currentDraggingColumn === null || currentDraggingColumn === void 0 ? void 0 : currentDraggingColumn.id) === column.id
2426
+ ? 2
2427
+ : column.getIsPinned()
2428
+ ? 1
2429
+ : undefined, '&:hover': {
2430
+ backgroundColor: enableHover && enableEditing && editingMode !== 'row'
2431
+ ? theme.palette.mode === 'dark'
2432
+ ? `${material.lighten(theme.palette.background.default, 0.13)} !important`
2433
+ : `${material.darken(theme.palette.background.default, 0.07)} !important`
2434
+ : undefined,
2435
+ } }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
2436
+ ? tableCellProps.sx(theme)
2437
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: column.getSize() }));
2438
+ } }),
2439
+ React__default["default"].createElement(React__default["default"].Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React__default["default"].createElement(material.Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, muiTableBodyCellSkeletonProps))) : enableRowNumbers &&
2440
+ rowNumberMode === 'static' &&
2441
+ column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React__default["default"].createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, table })) : isEditing ? (React__default["default"].createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
2442
+ columnDef.enableClickToCopy !== false ? (React__default["default"].createElement(React__default["default"].Fragment, null,
2443
+ React__default["default"].createElement(MRT_CopyButton, { cell: cell, table: table },
2444
+ React__default["default"].createElement(React__default["default"].Fragment, null, (_c = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, table })) !== null && _c !== void 0 ? _c : cell.renderValue())),
2445
+ cell.getIsGrouped() && React__default["default"].createElement(React__default["default"].Fragment, null,
2446
+ " (", (_d = row.subRows) === null || _d === void 0 ? void 0 :
2447
+ _d.length,
2448
+ ")"))) : (React__default["default"].createElement(React__default["default"].Fragment, null, (_g = (_f = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _f === void 0 ? void 0 : _f.call(columnDef, { cell, column, table })) !== null && _g !== void 0 ? _g : cell.renderValue(),
2449
+ cell.getIsGrouped() && React__default["default"].createElement(React__default["default"].Fragment, null,
2450
+ " (", (_j = (_h = row.subRows) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : '',
2451
+ ")"))))));
2452
+ };
2453
+
2454
+ const MRT_TableDetailPanel = ({ row, table }) => {
2455
+ const { getVisibleLeafColumns, options: { muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
2456
+ const tableRowProps = muiTableBodyRowProps instanceof Function
2457
+ ? muiTableBodyRowProps({ row, table })
2458
+ : muiTableBodyRowProps;
2459
+ const tableCellProps = muiTableDetailPanelProps instanceof Function
2460
+ ? muiTableDetailPanelProps({ row, table })
2461
+ : muiTableDetailPanelProps;
2462
+ return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps),
2463
+ React__default["default"].createElement(material.TableCell, Object.assign({ colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ borderBottom: !row.getIsExpanded() ? 'none' : undefined, pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 0.2s ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
2464
+ ? tableCellProps.sx(theme)
2465
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React__default["default"].createElement(material.Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
2466
+ };
2467
+
2468
+ const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
2469
+ var _a, _b;
2470
+ const theme = material.useTheme();
2471
+ const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, muiTableBodyRowProps, renderDetailPanel }, setCurrentHoveredRow, } = table;
2472
+ const { currentDraggingRow, currentHoveredRow } = getState();
2473
+ const tableRowProps = muiTableBodyRowProps instanceof Function
2474
+ ? muiTableBodyRowProps({ row, table })
2475
+ : muiTableBodyRowProps;
2476
+ const handleDragEnter = (_e) => {
2477
+ if (enableRowOrdering && currentDraggingRow) {
2478
+ setCurrentHoveredRow(row);
2479
+ }
2480
+ };
2481
+ const rowRef = React.useRef(null);
2482
+ const draggingBorder = (currentDraggingRow === null || currentDraggingRow === void 0 ? void 0 : currentDraggingRow.id) === row.id
2483
+ ? `1px dashed ${theme.palette.text.secondary}`
2484
+ : (currentHoveredRow === null || currentHoveredRow === void 0 ? void 0 : currentHoveredRow.id) === row.id
2485
+ ? `2px dashed ${theme.palette.primary.main}`
2486
+ : undefined;
2487
+ const draggingBorders = draggingBorder
2488
+ ? {
2489
+ border: draggingBorder,
2490
+ }
2491
+ : undefined;
2492
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
2493
+ React__default["default"].createElement(material.TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: rowRef }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), opacity: (currentDraggingRow === null || currentDraggingRow === void 0 ? void 0 : currentDraggingRow.id) === row.id ||
2494
+ (currentHoveredRow === null || currentHoveredRow === void 0 ? void 0 : currentHoveredRow.id) === row.id
2495
+ ? 0.5
2496
+ : 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
2497
+ backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
2498
+ ? theme.palette.mode === 'dark'
2499
+ ? `${material.lighten(theme.palette.background.default, 0.12)}`
2500
+ : `${material.darken(theme.palette.background.default, 0.05)}`
2501
+ : undefined,
2502
+ } }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
2503
+ ? tableRowProps.sx(theme)
2504
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)), draggingBorders)) }), (_b = (_a = row === null || row === void 0 ? void 0 : row.getVisibleCells()) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (cell) => (React__default["default"].createElement(MRT_TableBodyCell, { cell: cell, key: cell.id, enableHover: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false, rowIndex: rowIndex, rowRef: rowRef, table: table })))),
2505
+ renderDetailPanel && !row.getIsGrouped() && (React__default["default"].createElement(MRT_TableDetailPanel, { row: row, table: table }))));
2506
+ };
2507
+
2508
+ const MRT_TableBody = ({ table, tableContainerRef }) => {
2509
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, muiTableBodyProps, virtualizerProps, }, } = table;
2510
+ const { globalFilter, pagination, sorting } = getState();
2511
+ const tableBodyProps = muiTableBodyProps instanceof Function
2512
+ ? muiTableBodyProps({ table })
2513
+ : muiTableBodyProps;
2514
+ const vProps = virtualizerProps instanceof Function
2515
+ ? virtualizerProps({ table })
2516
+ : virtualizerProps;
2517
+ const rows = React.useMemo(() => {
2518
+ if (enableGlobalFilterRankedResults &&
2519
+ globalFilter &&
2520
+ !Object.values(sorting).some(Boolean)) {
2521
+ const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2522
+ if (enablePagination) {
2523
+ return rankedRows.slice(pagination.pageIndex, pagination.pageSize);
2524
+ }
2525
+ return rankedRows;
2526
+ }
2527
+ return enablePagination
2528
+ ? getRowModel().rows
2529
+ : getPrePaginationRowModel().rows;
2530
+ }, [
2531
+ enableGlobalFilterRankedResults,
2532
+ (enableGlobalFilterRankedResults && globalFilter) || !enablePagination
2533
+ ? getPrePaginationRowModel().rows
2534
+ : getRowModel().rows,
2535
+ globalFilter,
2536
+ ]);
2537
+ const rowVirtualizer = enableRowVirtualization
2538
+ ? useVirtual(Object.assign({ size: rows.length, parentRef: tableContainerRef, overscan: 15 }, vProps))
2539
+ : {};
2540
+ // const rowVirtualizer: Virtualizer = enableRowVirtualization
2541
+ // ? useVirtualizer({
2542
+ // count: rows.length,
2543
+ // estimateSize: () => (density === 'compact' ? 25 : 50),
2544
+ // getScrollElement: () => tableContainerRef.current as HTMLDivElement,
2545
+ // overscan: 15,
2546
+ // ...vProps,
2547
+ // })
2548
+ // : ({} as any);
2549
+ const virtualRows = enableRowVirtualization
2550
+ ? rowVirtualizer.virtualItems
2551
+ : [];
2552
+ // const virtualRows = enableRowVirtualization
2553
+ // ? rowVirtualizer.getVirtualItems()
2554
+ // : [];
2555
+ let paddingTop = 0;
2556
+ let paddingBottom = 0;
2557
+ if (enableRowVirtualization) {
2558
+ paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
2559
+ paddingBottom = !!virtualRows.length
2560
+ ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end
2561
+ : 0;
2562
+ }
2563
+ // if (enableRowVirtualization) {
2564
+ // paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
2565
+ // paddingBottom = !!virtualRows.length
2566
+ // ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
2567
+ // : 0;
2568
+ // }
2569
+ return (React__default["default"].createElement(material.TableBody, Object.assign({}, tableBodyProps),
2570
+ enableRowVirtualization && paddingTop > 0 && (React__default["default"].createElement("tr", null,
2571
+ React__default["default"].createElement("td", { style: { height: `${paddingTop}px` } }))),
2572
+ (enableRowVirtualization ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
2573
+ const row = enableRowVirtualization
2574
+ ? rows[rowOrVirtualRow.index]
2575
+ : rowOrVirtualRow;
2576
+ return (React__default["default"].createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table }));
2577
+ }),
2578
+ enableRowVirtualization && paddingBottom > 0 && (React__default["default"].createElement("tr", null,
2579
+ React__default["default"].createElement("td", { style: { height: `${paddingBottom}px` } })))));
2580
+ };
2581
+
2582
+ const MRT_TableFooterCell = ({ footer, table }) => {
2583
+ var _a, _b, _c;
2584
+ const { getState, options: { muiTableFooterCellProps, enableColumnResizing }, } = table;
2585
+ const { density } = getState();
2586
+ const { column } = footer;
2587
+ const { columnDef } = column;
2588
+ const { columnDefType } = columnDef;
2589
+ const mTableFooterCellProps = muiTableFooterCellProps instanceof Function
2590
+ ? muiTableFooterCellProps({ column, table })
2591
+ : muiTableFooterCellProps;
2592
+ const mcTableFooterCellProps = columnDef.muiTableFooterCellProps instanceof Function
2593
+ ? columnDef.muiTableFooterCellProps({ column, table })
2594
+ : columnDef.muiTableFooterCellProps;
2595
+ const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
2596
+ return (React__default["default"].createElement(material.TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: theme.palette.background.default, backgroundImage: `linear-gradient(${material.alpha(theme.palette.common.white, 0.05)},${material.alpha(theme.palette.common.white, 0.05)})`, fontWeight: 'bold', maxWidth: `${column.getSize()}px`, minWidth: `${column.getSize()}px`, p: density === 'compact'
2597
+ ? '0.5rem'
2598
+ : density === 'comfortable'
2599
+ ? '1rem'
2600
+ : '1.5rem', transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`, width: column.getSize(), verticalAlign: 'text-top' }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
2601
+ ? tableCellProps.sx(theme)
2602
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }),
2603
+ React__default["default"].createElement(React__default["default"].Fragment, null, footer.isPlaceholder
2604
+ ? null
2605
+ : (_c = (_b = (columnDef.Footer instanceof Function
2606
+ ? (_a = columnDef.Footer) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
2607
+ column,
2608
+ footer,
2609
+ table,
2610
+ })
2611
+ : columnDef.Footer)) !== null && _b !== void 0 ? _b : columnDef.footer) !== null && _c !== void 0 ? _c : null)));
2612
+ };
2613
+
2614
+ const MRT_TableFooterRow = ({ footerGroup, table }) => {
2615
+ var _a;
2616
+ const { options: { muiTableFooterRowProps }, } = table;
2617
+ // if no content in row, skip row
2618
+ if (!((_a = footerGroup.headers) === null || _a === void 0 ? void 0 : _a.some((header) => (typeof header.column.columnDef.footer === 'string' &&
2619
+ !!header.column.columnDef.footer) ||
2620
+ header.column.columnDef.Footer)))
2621
+ return null;
2622
+ const tableRowProps = muiTableFooterRowProps instanceof Function
2623
+ ? muiTableFooterRowProps({ footerGroup, table })
2624
+ : muiTableFooterRowProps;
2625
+ return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps), footerGroup.headers.map((footer) => (React__default["default"].createElement(MRT_TableFooterCell, { footer: footer, key: footer.id, table: table })))));
2626
+ };
2627
+
2628
+ const MRT_TableFooter = ({ table }) => {
2629
+ const { getFooterGroups, options: { muiTableFooterProps }, } = table;
2630
+ const tableFooterProps = muiTableFooterProps instanceof Function
2631
+ ? muiTableFooterProps({ table })
2632
+ : muiTableFooterProps;
2633
+ return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps), getFooterGroups().map((footerGroup) => (React__default["default"].createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2634
+ };
2635
+
2636
+ const MRT_Table = ({ tableContainerRef, table }) => {
2637
+ const { getState, options: { enableColumnResizing, enableRowVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, muiTableProps, }, } = table;
2638
+ const { isFullScreen } = getState();
2639
+ const tableProps = muiTableProps instanceof Function
2640
+ ? muiTableProps({ table })
2641
+ : muiTableProps;
2642
+ return (React__default["default"].createElement(material.Table, Object.assign({ stickyHeader: enableStickyHeader || enableRowVirtualization || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto' }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
2643
+ ? tableProps.sx(theme)
2644
+ : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
2645
+ enableTableHead && React__default["default"].createElement(MRT_TableHead, { table: table }),
2646
+ React__default["default"].createElement(MRT_TableBody, { tableContainerRef: tableContainerRef, table: table }),
2647
+ enableTableFooter && React__default["default"].createElement(MRT_TableFooter, { table: table })));
2648
+ };
2649
+
2650
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
2651
+ const MRT_TableContainer = ({ table }) => {
2652
+ var _a;
2653
+ const { getState, options: { enableStickyHeader, enableRowVirtualization, muiTableContainerProps, tableId, }, } = table;
2654
+ const { isFullScreen } = getState();
2655
+ const [totalToolbarHeight, setTotalToolbarHeight] = React.useState(0);
2656
+ const tableContainerProps = muiTableContainerProps instanceof Function
2657
+ ? muiTableContainerProps({ table })
2658
+ : muiTableContainerProps;
2659
+ const tableContainerRef = (_a = tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) !== null && _a !== void 0 ? _a : React.useRef(null);
2660
+ useIsomorphicLayoutEffect(() => {
2661
+ var _a, _b, _c, _d;
2662
+ const topToolbarHeight = typeof document !== 'undefined'
2663
+ ? (_b = (_a = document === null || document === void 0 ? void 0 : document.getElementById(`mrt-${tableId}-toolbar-top`)) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
2664
+ : 0;
2665
+ const bottomToolbarHeight = typeof document !== 'undefined'
2666
+ ? (_d = (_c = document === null || document === void 0 ? void 0 : document.getElementById(`mrt-${tableId}-toolbar-bottom`)) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
2667
+ : 0;
2668
+ setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2669
+ });
2670
+ return (React__default["default"].createElement(material.TableContainer, Object.assign({ ref: tableContainerRef }, tableContainerProps, { sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader || enableRowVirtualization
2671
+ ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
2672
+ : undefined, overflow: 'auto' }, ((tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx) instanceof Function
2673
+ ? tableContainerProps.sx(theme)
2674
+ : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2675
+ ? `calc(100vh - ${totalToolbarHeight}px)`
2676
+ : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
2677
+ React__default["default"].createElement(MRT_Table, { tableContainerRef: tableContainerRef, table: table })));
2678
+ };
2679
+
2680
+ const MRT_TablePaper = ({ table }) => {
2681
+ const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, } = table;
2682
+ const { isFullScreen } = getState();
2683
+ React.useEffect(() => {
2684
+ if (typeof window !== 'undefined') {
2685
+ if (isFullScreen) {
2686
+ document.body.style.height = '100vh';
2687
+ }
2688
+ else {
2689
+ document.body.style.height = 'auto';
2690
+ }
2691
+ }
2692
+ }, [isFullScreen]);
2693
+ const tablePaperProps = muiTablePaperProps instanceof Function
2694
+ ? muiTablePaperProps({ table })
2695
+ : muiTablePaperProps;
2696
+ return (React__default["default"].createElement(material.Paper, Object.assign({ elevation: 2 }, tablePaperProps, { sx: Object.assign({ transition: 'all 0.2s ease-in-out' }, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), { height: isFullScreen ? '100vh' : undefined, margin: isFullScreen ? '0' : undefined, maxHeight: isFullScreen ? '100vh' : undefined, maxWidth: isFullScreen ? '100vw' : undefined, padding: isFullScreen ? '0' : undefined, width: isFullScreen ? '100vw' : undefined }) }),
2697
+ enableTopToolbar && React__default["default"].createElement(MRT_TopToolbar, { table: table }),
2698
+ React__default["default"].createElement(MRT_TableContainer, { table: table }),
2699
+ enableBottomToolbar && React__default["default"].createElement(MRT_BottomToolbar, { table: table })));
2700
+ };
2701
+
2702
+ const MRT_TableRoot = (props) => {
2703
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
2704
+ const [tableId, setIdPrefix] = React.useState(props.tableId);
2705
+ React.useEffect(() => { var _a; return setIdPrefix((_a = props.tableId) !== null && _a !== void 0 ? _a : Math.random().toString(36).substring(2, 9)); }, [props.tableId]);
2706
+ const initialState = React.useMemo(() => {
2707
+ var _a, _b;
2708
+ const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
2709
+ initState.columnOrder =
2710
+ (_b = initState.columnOrder) !== null && _b !== void 0 ? _b : getDefaultColumnOrderIds(props);
2711
+ return initState;
2712
+ }, []);
2713
+ const [columnOrder, setColumnOrder] = React.useState((_a = initialState.columnOrder) !== null && _a !== void 0 ? _a : []);
2714
+ const [currentDraggingColumn, setCurrentDraggingColumn] = React.useState((_b = initialState.currentDraggingColumn) !== null && _b !== void 0 ? _b : null);
2715
+ const [currentDraggingRow, setCurrentDraggingRow] = React.useState((_c = initialState.currentDraggingRow) !== null && _c !== void 0 ? _c : null);
2716
+ const [currentEditingCell, setCurrentEditingCell] = React.useState((_d = initialState.currentEditingCell) !== null && _d !== void 0 ? _d : null);
2717
+ const [currentEditingRow, setCurrentEditingRow] = React.useState((_e = initialState.currentEditingRow) !== null && _e !== void 0 ? _e : null);
2718
+ const [currentHoveredColumn, setCurrentHoveredColumn] = React.useState((_f = initialState.currentHoveredColumn) !== null && _f !== void 0 ? _f : null);
2719
+ const [currentHoveredRow, setCurrentHoveredRow] = React.useState((_g = initialState.currentHoveredRow) !== null && _g !== void 0 ? _g : null);
2720
+ const [density, setDensity] = React.useState((_h = initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _h !== void 0 ? _h : 'comfortable');
2721
+ const [isFullScreen, setIsFullScreen] = React.useState((_j = initialState === null || initialState === void 0 ? void 0 : initialState.isFullScreen) !== null && _j !== void 0 ? _j : false);
2722
+ const [showAlertBanner, setShowAlertBanner] = React.useState((_l = (_k = props.initialState) === null || _k === void 0 ? void 0 : _k.showAlertBanner) !== null && _l !== void 0 ? _l : false);
2723
+ const [showColumnFilters, setShowFilters] = React.useState((_m = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _m !== void 0 ? _m : false);
2724
+ const [showGlobalFilter, setShowGlobalFilter] = React.useState((_o = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _o !== void 0 ? _o : false);
2725
+ const [columnFilterFns, setColumnFilterFns] = React.useState(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
2726
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
2727
+ return ({
2728
+ [(_d = (_b = (_a = col.id) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : (_c = col.accessorKey) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : '']: col.filterFn instanceof Function
2729
+ ? (_e = col.filterFn.name) !== null && _e !== void 0 ? _e : 'custom'
2730
+ : (_m = (_f = col.filterFn) !== null && _f !== void 0 ? _f : (_g = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _g === void 0 ? void 0 : _g[(_l = (_j = (_h = col.id) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _j !== void 0 ? _j : (_k = col.accessorKey) === null || _k === void 0 ? void 0 : _k.toString()) !== null && _l !== void 0 ? _l : '']) !== null && _m !== void 0 ? _m : getDefaultColumnFilterFn(col),
2731
+ });
2732
+ })));
2733
+ const [globalFilterFn, setGlobalFilterFn] = React.useState(props.globalFilterFn instanceof String
2734
+ ? props.globalFilterFn
2735
+ : 'fuzzy');
2736
+ const displayColumns = React.useMemo(() => {
2737
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2738
+ return [
2739
+ columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: (_a = props.localization) === null || _a === void 0 ? void 0 : _a.move, size: 60 }, defaultDisplayColumnDefOptions), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-drag']), { id: 'mrt-row-drag' }),
2740
+ columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell }) => (React__default["default"].createElement(MRT_ToggleRowActionMenuButton, { row: cell.row, table: table })), header: (_c = props.localization) === null || _c === void 0 ? void 0 : _c.actions, size: 70 }, defaultDisplayColumnDefOptions), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-actions']), { id: 'mrt-row-actions' }),
2741
+ columnOrder.includes('mrt-row-expand') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell }) => (React__default["default"].createElement(MRT_ExpandButton, { row: cell.row, table: table })), Header: () => props.enableExpandAll ? (React__default["default"].createElement(MRT_ExpandAllButton, { table: table })) : null, header: (_e = props.localization) === null || _e === void 0 ? void 0 : _e.expand, size: 60 }, defaultDisplayColumnDefOptions), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-expand']), { id: 'mrt-row-expand' }),
2742
+ columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell }) => (React__default["default"].createElement(MRT_SelectCheckbox, { row: cell.row, table: table })), Header: () => props.enableSelectAll ? (React__default["default"].createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: (_g = props.localization) === null || _g === void 0 ? void 0 : _g.select, size: 60 }, defaultDisplayColumnDefOptions), (_h = props.displayColumnDefOptions) === null || _h === void 0 ? void 0 : _h['mrt-row-select']), { id: 'mrt-row-select' }),
2743
+ columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell }) => cell.row.index + 1, Header: () => { var _a; return (_a = props.localization) === null || _a === void 0 ? void 0 : _a.rowNumber; }, header: (_j = props.localization) === null || _j === void 0 ? void 0 : _j.rowNumbers, size: 60 }, defaultDisplayColumnDefOptions), (_k = props.displayColumnDefOptions) === null || _k === void 0 ? void 0 : _k['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
2744
+ ].filter(Boolean);
2745
+ }, [
2746
+ columnOrder,
2747
+ props.displayColumnDefOptions,
2748
+ props.editingMode,
2749
+ props.enableColumnDragging,
2750
+ props.enableColumnOrdering,
2751
+ props.enableEditing,
2752
+ props.enableExpandAll,
2753
+ props.enableExpanding,
2754
+ props.enableGrouping,
2755
+ props.enableRowActions,
2756
+ props.enableRowDragging,
2757
+ props.enableRowNumbers,
2758
+ props.enableRowOrdering,
2759
+ props.enableRowSelection,
2760
+ props.enableSelectAll,
2761
+ props.localization,
2762
+ props.muiTableBodyCellProps,
2763
+ props.muiTableHeadCellProps,
2764
+ props.positionActionsColumn,
2765
+ ]);
2766
+ const columnDefs = React.useMemo(() => prepareColumns([...displayColumns, ...props.columns], columnFilterFns, props.filterFns, props.sortingFns), [columnFilterFns, displayColumns, props.columns]);
2767
+ const data = React.useMemo(() => {
2768
+ var _a, _b, _c, _d, _e;
2769
+ return (((_a = props.state) === null || _a === void 0 ? void 0 : _a.isLoading) || ((_b = props.state) === null || _b === void 0 ? void 0 : _b.showSkeletons)) &&
2770
+ !props.data.length
2771
+ ? [
2772
+ ...Array(((_d = (_c = props.state) === null || _c === void 0 ? void 0 : _c.pagination) === null || _d === void 0 ? void 0 : _d.pageSize) ||
2773
+ ((_e = initialState === null || initialState === void 0 ? void 0 : initialState.pagination) === null || _e === void 0 ? void 0 : _e.pageSize) ||
2774
+ 10).fill(null),
2775
+ ].map(() => Object.assign({}, ...getAllLeafColumnDefs(props.columns).map((col) => {
2776
+ var _a, _b;
2777
+ return ({
2778
+ [(_b = (_a = col.id) !== null && _a !== void 0 ? _a : col.accessorKey) !== null && _b !== void 0 ? _b : '']: null,
2779
+ });
2780
+ })))
2781
+ : props.data;
2782
+ }, [props.data, (_p = props.state) === null || _p === void 0 ? void 0 : _p.isLoading, (_q = props.state) === null || _q === void 0 ? void 0 : _q.showSkeletons]);
2783
+ //@ts-ignore
2784
+ const table = Object.assign(Object.assign({}, reactTable.useReactTable(Object.assign(Object.assign({ getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: reactTable.getExpandedRowModel(), getFacetedRowModel: reactTable.getFacetedRowModel(), getFilteredRowModel: reactTable.getFilteredRowModel(), getGroupedRowModel: reactTable.getGroupedRowModel(), getPaginationRowModel: reactTable.getPaginationRowModel(), getSortedRowModel: reactTable.getSortedRowModel(), onColumnOrderChange: setColumnOrder, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows }, props), {
2785
+ //@ts-ignore
2786
+ columns: columnDefs, data, globalFilterFn:
2787
+ //@ts-ignore
2788
+ (_r = props.filterFns[globalFilterFn]) !== null && _r !== void 0 ? _r : props.filterFns.fuzzy, initialState, state: Object.assign({ columnOrder,
2789
+ currentDraggingColumn,
2790
+ currentDraggingRow,
2791
+ currentEditingCell,
2792
+ currentEditingRow,
2793
+ columnFilterFns,
2794
+ globalFilterFn,
2795
+ currentHoveredColumn,
2796
+ currentHoveredRow,
2797
+ density,
2798
+ isFullScreen,
2799
+ showAlertBanner,
2800
+ showColumnFilters,
2801
+ showGlobalFilter }, props.state), tableId }))), { setCurrentDraggingColumn: (_s = props.onCurrentDraggingColumnChange) !== null && _s !== void 0 ? _s : setCurrentDraggingColumn, setCurrentDraggingRow: (_t = props.onCurrentDraggingRowChange) !== null && _t !== void 0 ? _t : setCurrentDraggingRow, setCurrentEditingCell: (_u = props.onCurrentEditingCellChange) !== null && _u !== void 0 ? _u : setCurrentEditingCell, setCurrentEditingRow: (_v = props.onCurrentEditingRowChange) !== null && _v !== void 0 ? _v : setCurrentEditingRow, setColumnFilterFns: (_w = props.onCurrentFilterFnsChange) !== null && _w !== void 0 ? _w : setColumnFilterFns, setGlobalFilterFn: (_x = props.onCurrentGlobalFilterFnChange) !== null && _x !== void 0 ? _x : setGlobalFilterFn, setCurrentHoveredColumn: (_y = props.onCurrentHoveredColumnChange) !== null && _y !== void 0 ? _y : setCurrentHoveredColumn, setCurrentHoveredRow: (_z = props.onCurrentHoveredRowChange) !== null && _z !== void 0 ? _z : setCurrentHoveredRow, setDensity: (_0 = props.onDensityChange) !== null && _0 !== void 0 ? _0 : setDensity, setIsFullScreen: (_1 = props.onIsFullScreenChange) !== null && _1 !== void 0 ? _1 : setIsFullScreen, setShowAlertBanner: (_2 = props.onShowAlertBannerChange) !== null && _2 !== void 0 ? _2 : setShowAlertBanner, setShowFilters: (_3 = props.onShowFiltersChange) !== null && _3 !== void 0 ? _3 : setShowFilters, setShowGlobalFilter: (_4 = props.onShowGlobalFilterChange) !== null && _4 !== void 0 ? _4 : setShowGlobalFilter });
2802
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
2803
+ React__default["default"].createElement(material.Dialog, { PaperComponent: material.Box, TransitionComponent: material.Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
2804
+ React__default["default"].createElement(MRT_TablePaper, { table: table })),
2805
+ !isFullScreen && React__default["default"].createElement(MRT_TablePaper, { table: table })));
2806
+ };
2807
+
2808
+ var MaterialReactTable = (_a) => {
2809
+ var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, editingMode = 'row', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilterChangeMode = false, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterChangeMode = false, 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 = 'all', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilterChangeMode", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterChangeMode", "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"]);
2810
+ return (React__default["default"].createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilterChangeMode: enableColumnFilterChangeMode, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterChangeMode: enableGlobalFilterChangeMode, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_DefaultLocalization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
2811
+ };
2812
+
2813
+ exports.MRT_FullScreenToggleButton = MRT_FullScreenToggleButton;
2814
+ exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
2815
+ exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
2816
+ exports.MRT_ToggleDensePaddingButton = MRT_ToggleDensePaddingButton;
2817
+ exports.MRT_ToggleFiltersButton = MRT_ToggleFiltersButton;
2818
+ exports.MRT_ToggleGlobalFilterButton = MRT_ToggleGlobalFilterButton;
2819
+ exports["default"] = MaterialReactTable;
2820
+ //# sourceMappingURL=index.js.map