material-react-table 0.33.2 → 0.33.5

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