material-react-table 0.24.1 → 0.26.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -11
- package/dist/MaterialReactTable.d.ts +18 -16
- package/dist/{utils.d.ts → column.utils.d.ts} +3 -3
- package/dist/filtersFns.d.ts +22 -54
- package/dist/localization.d.ts +3 -0
- package/dist/material-react-table.cjs.development.js +251 -175
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +251 -175
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/table/MRT_TableRoot.d.ts +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +29 -24
- package/src/body/MRT_TableBodyCell.tsx +6 -2
- package/src/body/MRT_TableBodyRow.tsx +3 -1
- package/src/body/MRT_TableDetailPanel.tsx +5 -3
- package/src/buttons/MRT_CopyButton.tsx +5 -3
- package/src/buttons/MRT_ExpandButton.tsx +5 -3
- package/src/{utils.ts → column.utils.ts} +2 -1
- package/src/filtersFns.ts +47 -13
- package/src/footer/MRT_TableFooterCell.tsx +3 -1
- package/src/head/MRT_TableHeadCell.tsx +32 -30
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +5 -3
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +1 -1
- package/src/inputs/MRT_FilterTextField.tsx +12 -6
- package/src/inputs/MRT_SelectCheckbox.tsx +18 -21
- package/src/localization.ts +6 -0
- package/src/menus/MRT_ColumnActionMenu.tsx +16 -15
- package/src/menus/MRT_FilterOptionMenu.tsx +105 -72
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +1 -1
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +1 -1
- package/src/table/MRT_Table.tsx +5 -3
- package/src/table/MRT_TableContainer.tsx +5 -3
- package/src/table/MRT_TableRoot.tsx +57 -40
- package/src/toolbar/MRT_TablePagination.tsx +5 -3
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +5 -3
- package/src/toolbar/MRT_ToolbarBottom.tsx +3 -1
- package/src/toolbar/MRT_ToolbarTop.tsx +3 -1
@@ -53,6 +53,7 @@ var MRT_DefaultLocalization_EN = {
|
|
53
53
|
expand: 'Expand',
|
54
54
|
expandAll: 'Expand all',
|
55
55
|
filterBetween: 'Between',
|
56
|
+
filterBetweenInclusive: 'Between Inclusive',
|
56
57
|
filterByColumn: 'Filter by {column}',
|
57
58
|
filterContains: 'Contains',
|
58
59
|
filterEmpty: 'Empty',
|
@@ -60,7 +61,9 @@ var MRT_DefaultLocalization_EN = {
|
|
60
61
|
filterEquals: 'Equals',
|
61
62
|
filterFuzzy: 'Fuzzy',
|
62
63
|
filterGreaterThan: 'Greater Than',
|
64
|
+
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
63
65
|
filterLessThan: 'Less Than',
|
66
|
+
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
64
67
|
filterMode: 'Filter Mode: {filterType}',
|
65
68
|
filterNotEmpty: 'Not Empty',
|
66
69
|
filterNotEquals: 'Not Equals',
|
@@ -214,10 +217,12 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
214
217
|
disabled: !row.getCanExpand() && !renderDetailPanel,
|
215
218
|
onClick: handleToggleExpand
|
216
219
|
}, iconButtonProps, {
|
217
|
-
sx:
|
218
|
-
|
219
|
-
|
220
|
-
|
220
|
+
sx: function sx(theme) {
|
221
|
+
return _extends({
|
222
|
+
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
223
|
+
width: density === 'compact' ? '1.75rem' : '2.25rem'
|
224
|
+
}, (iconButtonProps == null ? void 0 : iconButtonProps.sx) instanceof Function ? iconButtonProps.sx(theme) : iconButtonProps == null ? void 0 : iconButtonProps.sx);
|
225
|
+
}
|
221
226
|
}), React.createElement(ExpandMoreIcon, {
|
222
227
|
style: {
|
223
228
|
transform: "rotate(" + (!row.getCanExpand() && !renderDetailPanel ? -90 : row.getIsExpanded() ? -180 : 0) + "deg)",
|
@@ -226,11 +231,6 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
226
231
|
}))));
|
227
232
|
};
|
228
233
|
|
229
|
-
var commonMenuItemStyles = {
|
230
|
-
py: '6px',
|
231
|
-
my: 0,
|
232
|
-
alignItems: 'center'
|
233
|
-
};
|
234
234
|
var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
235
235
|
var _columnDef$enabledCol;
|
236
236
|
|
@@ -262,46 +262,72 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
262
262
|
var filterOptions = useMemo(function () {
|
263
263
|
return [{
|
264
264
|
option: 'fuzzy',
|
265
|
+
symbol: '≈',
|
265
266
|
label: localization.filterFuzzy,
|
266
267
|
divider: false
|
267
268
|
}, {
|
268
269
|
option: 'contains',
|
270
|
+
symbol: '*',
|
269
271
|
label: localization.filterContains,
|
270
272
|
divider: false
|
271
273
|
}, {
|
272
274
|
option: 'startsWith',
|
275
|
+
symbol: 'a',
|
273
276
|
label: localization.filterStartsWith,
|
274
277
|
divider: false
|
275
278
|
}, {
|
276
279
|
option: 'endsWith',
|
280
|
+
symbol: 'z',
|
277
281
|
label: localization.filterEndsWith,
|
278
282
|
divider: true
|
279
283
|
}, {
|
280
284
|
option: 'equals',
|
285
|
+
symbol: '=',
|
281
286
|
label: localization.filterEquals,
|
282
287
|
divider: false
|
283
288
|
}, {
|
284
289
|
option: 'notEquals',
|
290
|
+
symbol: '≠',
|
285
291
|
label: localization.filterNotEquals,
|
286
292
|
divider: true
|
287
293
|
}, {
|
288
294
|
option: 'between',
|
295
|
+
symbol: '⇿',
|
289
296
|
label: localization.filterBetween,
|
290
297
|
divider: false
|
298
|
+
}, {
|
299
|
+
option: 'betweenInclusive',
|
300
|
+
symbol: '⬌',
|
301
|
+
label: localization.filterBetweenInclusive,
|
302
|
+
divider: true
|
291
303
|
}, {
|
292
304
|
option: 'greaterThan',
|
305
|
+
symbol: '>',
|
293
306
|
label: localization.filterGreaterThan,
|
294
307
|
divider: false
|
308
|
+
}, {
|
309
|
+
option: 'greaterThanOrEqualTo',
|
310
|
+
symbol: '≥',
|
311
|
+
label: localization.filterGreaterThanOrEqualTo,
|
312
|
+
divider: false
|
295
313
|
}, {
|
296
314
|
option: 'lessThan',
|
315
|
+
symbol: '<',
|
297
316
|
label: localization.filterLessThan,
|
317
|
+
divider: false
|
318
|
+
}, {
|
319
|
+
option: 'lessThanOrEqualTo',
|
320
|
+
symbol: '≤',
|
321
|
+
label: localization.filterLessThanOrEqualTo,
|
298
322
|
divider: true
|
299
323
|
}, {
|
300
324
|
option: 'empty',
|
325
|
+
symbol: '∅',
|
301
326
|
label: localization.filterEmpty,
|
302
327
|
divider: false
|
303
328
|
}, {
|
304
329
|
option: 'notEmpty',
|
330
|
+
symbol: '!∅',
|
305
331
|
label: localization.filterNotEmpty,
|
306
332
|
divider: false
|
307
333
|
}].filter(function (filterType) {
|
@@ -349,7 +375,8 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
349
375
|
}, filterOptions.map(function (_ref4, index) {
|
350
376
|
var option = _ref4.option,
|
351
377
|
label = _ref4.label,
|
352
|
-
divider = _ref4.divider
|
378
|
+
divider = _ref4.divider,
|
379
|
+
symbol = _ref4.symbol;
|
353
380
|
return React.createElement(MenuItem, {
|
354
381
|
divider: divider,
|
355
382
|
key: index,
|
@@ -357,9 +384,20 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
357
384
|
return handleSelectFilterType(option);
|
358
385
|
},
|
359
386
|
selected: option === filterOption,
|
360
|
-
sx:
|
387
|
+
sx: {
|
388
|
+
py: '6px',
|
389
|
+
my: 0,
|
390
|
+
alignItems: 'center',
|
391
|
+
display: 'flex',
|
392
|
+
gap: '2ch'
|
393
|
+
},
|
361
394
|
value: option
|
362
|
-
},
|
395
|
+
}, React.createElement(Box, {
|
396
|
+
sx: {
|
397
|
+
fontSize: '1.25rem',
|
398
|
+
width: '2ch'
|
399
|
+
}
|
400
|
+
}, symbol), label);
|
363
401
|
}));
|
364
402
|
};
|
365
403
|
|
@@ -505,21 +543,37 @@ notEquals.autoRemove = function (val) {
|
|
505
543
|
};
|
506
544
|
|
507
545
|
var greaterThan = function greaterThan(row, id, filterValue) {
|
508
|
-
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id)
|
546
|
+
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id) > +filterValue : row.getValue(id).toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
|
509
547
|
};
|
510
548
|
|
511
549
|
greaterThan.autoRemove = function (val) {
|
512
550
|
return !val;
|
513
551
|
};
|
514
552
|
|
553
|
+
var greaterThanOrEqualTo = function greaterThanOrEqualTo(row, id, filterValue) {
|
554
|
+
return equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
555
|
+
};
|
556
|
+
|
557
|
+
greaterThanOrEqualTo.autoRemove = function (val) {
|
558
|
+
return !val;
|
559
|
+
};
|
560
|
+
|
515
561
|
var lessThan = function lessThan(row, id, filterValue) {
|
516
|
-
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id)
|
562
|
+
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id) < +filterValue : row.getValue(id).toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
|
517
563
|
};
|
518
564
|
|
519
565
|
lessThan.autoRemove = function (val) {
|
520
566
|
return !val;
|
521
567
|
};
|
522
568
|
|
569
|
+
var lessThanOrEqualTo = function lessThanOrEqualTo(row, id, filterValue) {
|
570
|
+
return equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
571
|
+
};
|
572
|
+
|
573
|
+
lessThanOrEqualTo.autoRemove = function (val) {
|
574
|
+
return !val;
|
575
|
+
};
|
576
|
+
|
523
577
|
var between = function between(row, id, filterValues) {
|
524
578
|
return (['', undefined].includes(filterValues[0]) || greaterThan(row, id, filterValues[0])) && (!isNaN(+filterValues[0]) && !isNaN(+filterValues[1]) && +filterValues[0] > +filterValues[1] || ['', undefined].includes(filterValues[1]) || lessThan(row, id, filterValues[1]));
|
525
579
|
};
|
@@ -528,6 +582,14 @@ between.autoRemove = function (val) {
|
|
528
582
|
return !val;
|
529
583
|
};
|
530
584
|
|
585
|
+
var betweenInclusive = function betweenInclusive(row, id, filterValues) {
|
586
|
+
return (['', undefined].includes(filterValues[0]) || greaterThanOrEqualTo(row, id, filterValues[0])) && (!isNaN(+filterValues[0]) && !isNaN(+filterValues[1]) && +filterValues[0] > +filterValues[1] || ['', undefined].includes(filterValues[1]) || lessThanOrEqualTo(row, id, filterValues[1]));
|
587
|
+
};
|
588
|
+
|
589
|
+
betweenInclusive.autoRemove = function (val) {
|
590
|
+
return !val;
|
591
|
+
};
|
592
|
+
|
531
593
|
var empty = function empty(row, id, _filterValue) {
|
532
594
|
return !row.getValue(id).toString().trim();
|
533
595
|
};
|
@@ -546,13 +608,16 @@ notEmpty.autoRemove = function (val) {
|
|
546
608
|
|
547
609
|
var MRT_FilterFns = /*#__PURE__*/_extends({}, filterFns, {
|
548
610
|
between: between,
|
611
|
+
betweenInclusive: betweenInclusive,
|
549
612
|
contains: contains,
|
550
613
|
empty: empty,
|
551
614
|
endsWith: endsWith,
|
552
615
|
equals: equals,
|
553
616
|
fuzzy: fuzzy,
|
554
617
|
greaterThan: greaterThan,
|
618
|
+
greaterThanOrEqualTo: greaterThanOrEqualTo,
|
555
619
|
lessThan: lessThan,
|
620
|
+
lessThanOrEqualTo: lessThanOrEqualTo,
|
556
621
|
notEmpty: notEmpty,
|
557
622
|
notEquals: notEquals,
|
558
623
|
startsWith: startsWith
|
@@ -904,7 +969,7 @@ var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
904
969
|
}));
|
905
970
|
};
|
906
971
|
|
907
|
-
var commonMenuItemStyles
|
972
|
+
var commonMenuItemStyles = {
|
908
973
|
py: '6px',
|
909
974
|
my: 0,
|
910
975
|
justifyContent: 'space-between',
|
@@ -1048,14 +1113,14 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1048
1113
|
disabled: !column.getIsSorted(),
|
1049
1114
|
key: 0,
|
1050
1115
|
onClick: handleClearSort,
|
1051
|
-
sx: commonMenuItemStyles
|
1116
|
+
sx: commonMenuItemStyles
|
1052
1117
|
}, React.createElement(Box, {
|
1053
1118
|
sx: commonListItemStyles
|
1054
1119
|
}, React.createElement(ListItemIcon, null, React.createElement(ClearAllIcon, null)), localization.clearSort)), React.createElement(MenuItem, {
|
1055
1120
|
disabled: column.getIsSorted() === 'asc',
|
1056
1121
|
key: 1,
|
1057
1122
|
onClick: handleSortAsc,
|
1058
|
-
sx: commonMenuItemStyles
|
1123
|
+
sx: commonMenuItemStyles
|
1059
1124
|
}, React.createElement(Box, {
|
1060
1125
|
sx: commonListItemStyles
|
1061
1126
|
}, React.createElement(ListItemIcon, null, React.createElement(SortIcon, null)), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(columnDef.header)))), React.createElement(MenuItem, {
|
@@ -1063,7 +1128,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1063
1128
|
key: 2,
|
1064
1129
|
disabled: column.getIsSorted() === 'desc',
|
1065
1130
|
onClick: handleSortDesc,
|
1066
|
-
sx: commonMenuItemStyles
|
1131
|
+
sx: commonMenuItemStyles
|
1067
1132
|
}, React.createElement(Box, {
|
1068
1133
|
sx: commonListItemStyles
|
1069
1134
|
}, React.createElement(ListItemIcon, null, React.createElement(SortIcon, {
|
@@ -1074,14 +1139,14 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1074
1139
|
disabled: !column.getFilterValue(),
|
1075
1140
|
key: 0,
|
1076
1141
|
onClick: handleClearFilter,
|
1077
|
-
sx: commonMenuItemStyles
|
1142
|
+
sx: commonMenuItemStyles
|
1078
1143
|
}, React.createElement(Box, {
|
1079
1144
|
sx: commonListItemStyles
|
1080
1145
|
}, React.createElement(ListItemIcon, null, React.createElement(FilterListOffIcon, null)), localization.clearFilter)), React.createElement(MenuItem, {
|
1081
1146
|
divider: enableGrouping || enableHiding,
|
1082
1147
|
key: 1,
|
1083
1148
|
onClick: handleFilterByColumn,
|
1084
|
-
sx: commonMenuItemStyles
|
1149
|
+
sx: commonMenuItemStyles
|
1085
1150
|
}, React.createElement(Box, {
|
1086
1151
|
sx: commonListItemStyles
|
1087
1152
|
}, React.createElement(ListItemIcon, null, React.createElement(FilterListIcon, null)), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(columnDef.header))), showFilterModeSubMenu && React.createElement(IconButton, {
|
@@ -1102,7 +1167,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1102
1167
|
divider: enablePinning,
|
1103
1168
|
key: 0,
|
1104
1169
|
onClick: handleGroupByColumn,
|
1105
|
-
sx: commonMenuItemStyles
|
1170
|
+
sx: commonMenuItemStyles
|
1106
1171
|
}, React.createElement(Box, {
|
1107
1172
|
sx: commonListItemStyles
|
1108
1173
|
}, React.createElement(ListItemIcon, null, React.createElement(DynamicFeedIcon, null)), (_localization = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(columnDef.header))))], enablePinning && column.getCanPin() && [React.createElement(MenuItem, {
|
@@ -1111,7 +1176,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1111
1176
|
onClick: function onClick() {
|
1112
1177
|
return handlePinColumn('left');
|
1113
1178
|
},
|
1114
|
-
sx: commonMenuItemStyles
|
1179
|
+
sx: commonMenuItemStyles
|
1115
1180
|
}, React.createElement(Box, {
|
1116
1181
|
sx: commonListItemStyles
|
1117
1182
|
}, React.createElement(ListItemIcon, null, React.createElement(PushPinIcon, {
|
@@ -1124,7 +1189,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1124
1189
|
onClick: function onClick() {
|
1125
1190
|
return handlePinColumn('right');
|
1126
1191
|
},
|
1127
|
-
sx: commonMenuItemStyles
|
1192
|
+
sx: commonMenuItemStyles
|
1128
1193
|
}, React.createElement(Box, {
|
1129
1194
|
sx: commonListItemStyles
|
1130
1195
|
}, React.createElement(ListItemIcon, null, React.createElement(PushPinIcon, {
|
@@ -1138,21 +1203,21 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1138
1203
|
onClick: function onClick() {
|
1139
1204
|
return handlePinColumn(false);
|
1140
1205
|
},
|
1141
|
-
sx: commonMenuItemStyles
|
1206
|
+
sx: commonMenuItemStyles
|
1142
1207
|
}, React.createElement(Box, {
|
1143
1208
|
sx: commonListItemStyles
|
1144
|
-
}, React.createElement(ListItemIcon, null, React.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && [React.createElement(MenuItem, {
|
1145
|
-
disabled: !
|
1209
|
+
}, React.createElement(ListItemIcon, null, React.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && column.getCanResize() && [React.createElement(MenuItem, {
|
1210
|
+
disabled: !columnSizing[column.id],
|
1146
1211
|
key: 0,
|
1147
1212
|
onClick: handleResetColumnSize,
|
1148
|
-
sx: commonMenuItemStyles
|
1213
|
+
sx: commonMenuItemStyles
|
1149
1214
|
}, React.createElement(Box, {
|
1150
1215
|
sx: commonListItemStyles
|
1151
1216
|
}, React.createElement(ListItemIcon, null, React.createElement(RestartAltIcon, null)), localization.resetColumnSize))], enableHiding && [React.createElement(MenuItem, {
|
1152
1217
|
disabled: columnDef.enableHiding === false,
|
1153
1218
|
key: 0,
|
1154
1219
|
onClick: handleHideColumn,
|
1155
|
-
sx: commonMenuItemStyles
|
1220
|
+
sx: commonMenuItemStyles
|
1156
1221
|
}, React.createElement(Box, {
|
1157
1222
|
sx: commonListItemStyles
|
1158
1223
|
}, React.createElement(ListItemIcon, null, React.createElement(VisibilityOffIcon, null)), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(columnDef.header)))), React.createElement(MenuItem, {
|
@@ -1161,7 +1226,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1161
1226
|
}).length,
|
1162
1227
|
key: 1,
|
1163
1228
|
onClick: handleShowAllColumns,
|
1164
|
-
sx: commonMenuItemStyles
|
1229
|
+
sx: commonMenuItemStyles
|
1165
1230
|
}, React.createElement(Box, {
|
1166
1231
|
sx: commonListItemStyles
|
1167
1232
|
}, React.createElement(ListItemIcon, null, React.createElement(ViewColumnIcon, null)), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(columnDef.header))), React.createElement(IconButton, {
|
@@ -1207,7 +1272,7 @@ var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
|
|
1207
1272
|
}
|
1208
1273
|
}, enableEditing && React.createElement(MenuItem, {
|
1209
1274
|
onClick: handleEdit,
|
1210
|
-
sx: commonMenuItemStyles
|
1275
|
+
sx: commonMenuItemStyles
|
1211
1276
|
}, React.createElement(Box, {
|
1212
1277
|
sx: commonListItemStyles
|
1213
1278
|
}, React.createElement(ListItemIcon, null, React.createElement(EditIcon, null)), localization.edit)), renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems({
|
@@ -1358,19 +1423,7 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
1358
1423
|
var _getState = getState(),
|
1359
1424
|
density = _getState.density;
|
1360
1425
|
|
1361
|
-
var
|
1362
|
-
if (selectAll) {
|
1363
|
-
if (selectAllMode === 'all') {
|
1364
|
-
table.getToggleAllRowsSelectedHandler()(event);
|
1365
|
-
} else if (selectAllMode === 'page') {
|
1366
|
-
table.getToggleAllPageRowsSelectedHandler()(event);
|
1367
|
-
}
|
1368
|
-
} else if (row) {
|
1369
|
-
row == null ? void 0 : row.getToggleSelectedHandler()(event);
|
1370
|
-
}
|
1371
|
-
};
|
1372
|
-
|
1373
|
-
var checkboxProps = selectAll ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
1426
|
+
var checkboxProps = !row ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
1374
1427
|
table: table
|
1375
1428
|
}) : muiSelectAllCheckboxProps : muiSelectCheckboxProps instanceof Function ? muiSelectCheckboxProps({
|
1376
1429
|
row: row,
|
@@ -1387,13 +1440,16 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
1387
1440
|
inputProps: {
|
1388
1441
|
'aria-label': selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
1389
1442
|
},
|
1390
|
-
onChange:
|
1443
|
+
onChange: !row ? selectAllMode === 'all' ? table.getToggleAllRowsSelectedHandler() : table.getToggleAllPageRowsSelectedHandler() : row.getToggleSelectedHandler(),
|
1391
1444
|
size: density === 'compact' ? 'small' : 'medium'
|
1392
1445
|
}, checkboxProps, {
|
1393
|
-
sx:
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1446
|
+
sx: function sx(theme) {
|
1447
|
+
return _extends({
|
1448
|
+
height: density === 'compact' ? '1.5rem' : '2rem',
|
1449
|
+
width: density === 'compact' ? '1.5rem' : '2rem',
|
1450
|
+
m: '-1re.m'
|
1451
|
+
}, (checkboxProps == null ? void 0 : checkboxProps.sx) instanceof Function ? checkboxProps.sx(theme) : checkboxProps == null ? void 0 : checkboxProps.sx);
|
1452
|
+
}
|
1397
1453
|
})));
|
1398
1454
|
};
|
1399
1455
|
|
@@ -1744,12 +1800,14 @@ var MRT_TablePagination = function MRT_TablePagination(_ref) {
|
|
1744
1800
|
showFirstButton: showFirstLastPageButtons,
|
1745
1801
|
showLastButton: showFirstLastPageButtons
|
1746
1802
|
}, tablePaginationProps, {
|
1747
|
-
sx:
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1803
|
+
sx: function sx(theme) {
|
1804
|
+
return _extends({
|
1805
|
+
m: '0 0.5rem',
|
1806
|
+
mt: position === 'top' && enableToolbarInternalActions && !showGlobalFilter ? '3.5rem' : undefined,
|
1807
|
+
position: 'relative',
|
1808
|
+
zIndex: 2
|
1809
|
+
}, (tablePaginationProps == null ? void 0 : tablePaginationProps.sx) instanceof Function ? tablePaginationProps.sx(theme) : tablePaginationProps == null ? void 0 : tablePaginationProps.sx);
|
1810
|
+
}
|
1753
1811
|
}));
|
1754
1812
|
};
|
1755
1813
|
|
@@ -1791,17 +1849,19 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner(_ref) {
|
|
1791
1849
|
color: "info",
|
1792
1850
|
icon: false
|
1793
1851
|
}, alertProps, {
|
1794
|
-
sx:
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1852
|
+
sx: function sx(theme) {
|
1853
|
+
return _extends({
|
1854
|
+
borderRadius: 0,
|
1855
|
+
fontSize: '1rem',
|
1856
|
+
left: 0,
|
1857
|
+
p: 0,
|
1858
|
+
position: 'relative',
|
1859
|
+
right: 0,
|
1860
|
+
top: 0,
|
1861
|
+
width: '100%',
|
1862
|
+
zIndex: 2
|
1863
|
+
}, (alertProps == null ? void 0 : alertProps.sx) instanceof Function ? alertProps.sx(theme) : alertProps == null ? void 0 : alertProps.sx);
|
1864
|
+
}
|
1805
1865
|
}), (alertProps == null ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title), React.createElement(Box, {
|
1806
1866
|
sx: {
|
1807
1867
|
p: '0.5rem 1rem'
|
@@ -1890,7 +1950,7 @@ var MRT_ToolbarTop = function MRT_ToolbarTop(_ref2) {
|
|
1890
1950
|
top: isFullScreen ? '0' : undefined
|
1891
1951
|
}, commonToolbarStyles({
|
1892
1952
|
theme: theme
|
1893
|
-
}), toolbarProps == null ? void 0 : toolbarProps.sx);
|
1953
|
+
}), (toolbarProps == null ? void 0 : toolbarProps.sx) instanceof Function ? toolbarProps.sx(theme) : toolbarProps == null ? void 0 : toolbarProps.sx);
|
1894
1954
|
}
|
1895
1955
|
}), positionToolbarAlertBanner === 'top' && React.createElement(MRT_ToolbarAlertBanner, {
|
1896
1956
|
stackAlertBanner: stackAlertBanner,
|
@@ -1956,7 +2016,7 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom(_ref) {
|
|
1956
2016
|
left: 0,
|
1957
2017
|
position: isFullScreen ? 'fixed' : 'relative',
|
1958
2018
|
right: 0
|
1959
|
-
}, toolbarProps == null ? void 0 : toolbarProps.sx);
|
2019
|
+
}, (toolbarProps == null ? void 0 : toolbarProps.sx) instanceof Function ? toolbarProps.sx(theme) : toolbarProps == null ? void 0 : toolbarProps.sx);
|
1960
2020
|
}
|
1961
2021
|
}), React.createElement(MRT_LinearProgressBar, {
|
1962
2022
|
isTopToolbar: false,
|
@@ -2031,16 +2091,18 @@ var MRT_TableHeadCellColumnActionsButton = function MRT_TableHeadCellColumnActio
|
|
2031
2091
|
onClick: handleClick,
|
2032
2092
|
size: "small"
|
2033
2093
|
}, iconButtonProps, {
|
2034
|
-
sx:
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2094
|
+
sx: function sx(theme) {
|
2095
|
+
return _extends({
|
2096
|
+
height: '2rem',
|
2097
|
+
mt: '-0.2rem',
|
2098
|
+
opacity: 0.5,
|
2099
|
+
transition: 'opacity 0.2s',
|
2100
|
+
width: '2rem',
|
2101
|
+
'&:hover': {
|
2102
|
+
opacity: 1
|
2103
|
+
}
|
2104
|
+
}, (iconButtonProps == null ? void 0 : iconButtonProps.sx) instanceof Function ? iconButtonProps.sx(theme) : iconButtonProps == null ? void 0 : iconButtonProps.sx);
|
2105
|
+
}
|
2044
2106
|
}), React.createElement(MoreVertIcon, null))), React.createElement(MRT_ColumnActionMenu, {
|
2045
2107
|
anchorEl: anchorEl,
|
2046
2108
|
header: header,
|
@@ -2096,16 +2158,16 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
2096
2158
|
setFilterValue = _useState2[1];
|
2097
2159
|
|
2098
2160
|
var handleChangeDebounced = useCallback(debounce(function (event) {
|
2161
|
+
var value = textFieldProps.type === 'date' ? new Date(event.target.value) : event.target.value;
|
2162
|
+
|
2099
2163
|
if (inputIndex !== undefined) {
|
2100
2164
|
column.setFilterValue(function (old) {
|
2101
2165
|
var newFilterValues = old != null ? old : ['', ''];
|
2102
|
-
newFilterValues[inputIndex] =
|
2166
|
+
newFilterValues[inputIndex] = value;
|
2103
2167
|
return newFilterValues;
|
2104
2168
|
});
|
2105
2169
|
} else {
|
2106
|
-
|
2107
|
-
|
2108
|
-
column.setFilterValue((_event$target$value = event.target.value) != null ? _event$target$value : undefined);
|
2170
|
+
column.setFilterValue(value != null ? value : undefined);
|
2109
2171
|
}
|
2110
2172
|
}, 200), []);
|
2111
2173
|
|
@@ -2225,15 +2287,17 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
2225
2287
|
}, React.createElement(CloseIcon, null)))))
|
2226
2288
|
}
|
2227
2289
|
}, textFieldProps, {
|
2228
|
-
sx:
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2290
|
+
sx: function sx(theme) {
|
2291
|
+
return _extends({
|
2292
|
+
m: '-0.25rem',
|
2293
|
+
p: 0,
|
2294
|
+
minWidth: !filterChipLabel ? '8rem' : 'auto',
|
2295
|
+
width: 'calc(100% + 0.5rem)',
|
2296
|
+
'& .MuiSelect-icon': {
|
2297
|
+
mr: '1.5rem'
|
2298
|
+
}
|
2299
|
+
}, (textFieldProps == null ? void 0 : textFieldProps.sx) instanceof Function ? textFieldProps.sx(theme) : textFieldProps == null ? void 0 : textFieldProps.sx);
|
2300
|
+
}
|
2237
2301
|
}), isSelectFilter && React.createElement(MenuItem, {
|
2238
2302
|
divider: true,
|
2239
2303
|
disabled: !filterValue,
|
@@ -2512,11 +2576,6 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2512
2576
|
|
2513
2577
|
var tableCellProps = _extends({}, mTableHeadCellProps, mcTableHeadCellProps);
|
2514
2578
|
|
2515
|
-
var headerElement = (_ref2 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
2516
|
-
header: header,
|
2517
|
-
table: table
|
2518
|
-
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref2 : columnDef.header;
|
2519
|
-
|
2520
2579
|
var getIsLastLeftPinnedColumn = function getIsLastLeftPinnedColumn() {
|
2521
2580
|
return column.getIsPinned() === 'left' && table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex();
|
2522
2581
|
};
|
@@ -2531,17 +2590,21 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2531
2590
|
|
2532
2591
|
var handleDragEnter = function handleDragEnter(_e) {
|
2533
2592
|
if (enableColumnOrdering && currentDraggingColumn) {
|
2534
|
-
setCurrentHoveredColumn(
|
2593
|
+
setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2535
2594
|
}
|
2536
2595
|
};
|
2537
2596
|
|
2538
|
-
var tableHeadCellRef = React.useRef(null);
|
2539
2597
|
var draggingBorder = (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id ? "1px dashed " + theme.palette.divider : (currentHoveredColumn == null ? void 0 : currentHoveredColumn.id) === column.id ? "2px dashed " + theme.palette.primary.main : undefined;
|
2540
2598
|
var draggingBorders = draggingBorder ? {
|
2541
2599
|
borderLeft: draggingBorder,
|
2542
2600
|
borderRight: draggingBorder,
|
2543
2601
|
borderTop: draggingBorder
|
2544
2602
|
} : undefined;
|
2603
|
+
var headerElement = (_ref2 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
2604
|
+
header: header,
|
2605
|
+
table: table
|
2606
|
+
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref2 : columnDef.header;
|
2607
|
+
var tableHeadCellRef = React.useRef(null);
|
2545
2608
|
return React.createElement(TableCell, Object.assign({
|
2546
2609
|
align: columnDefType === 'group' ? 'center' : 'left',
|
2547
2610
|
colSpan: header.colSpan,
|
@@ -2566,15 +2629,15 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2566
2629
|
right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
|
2567
2630
|
transition: "all " + (enableColumnResizing ? 0 : '0.2s') + " ease-in-out",
|
2568
2631
|
userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
|
2569
|
-
verticalAlign: '
|
2632
|
+
verticalAlign: 'top',
|
2570
2633
|
zIndex: column.getIsResizing() || (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id ? 3 : column.getIsPinned() && columnDefType !== 'group' ? 2 : 1
|
2571
|
-
}, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2634
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2572
2635
|
maxWidth: "min(" + column.getSize() + "px, fit-content)",
|
2573
2636
|
minWidth: "max(" + column.getSize() + "px, " + ((_columnDef$minSize = columnDef.minSize) != null ? _columnDef$minSize : 30) + "px)",
|
2574
2637
|
width: header.getSize()
|
2575
2638
|
});
|
2576
2639
|
}
|
2577
|
-
}), header.isPlaceholder ? null :
|
2640
|
+
}), header.isPlaceholder ? null : React.createElement(Box, {
|
2578
2641
|
sx: {
|
2579
2642
|
alignItems: 'flex-start',
|
2580
2643
|
display: 'flex',
|
@@ -2591,27 +2654,27 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2591
2654
|
flexWrap: 'nowrap',
|
2592
2655
|
whiteSpace: ((_columnDef$header$len = (_columnDef$header = columnDef.header) == null ? void 0 : _columnDef$header.length) != null ? _columnDef$header$len : 0) < 24 ? 'nowrap' : 'normal'
|
2593
2656
|
}
|
2594
|
-
}, headerElement,
|
2657
|
+
}, headerElement, column.getCanSort() && React.createElement(MRT_TableHeadCellSortLabel, {
|
2595
2658
|
header: header,
|
2596
2659
|
table: table
|
2597
|
-
}),
|
2660
|
+
}), column.getCanFilter() && React.createElement(MRT_TableHeadCellFilterLabel, {
|
2598
2661
|
header: header,
|
2599
2662
|
table: table
|
2600
|
-
})), React.createElement(Box, {
|
2663
|
+
})), columnDefType !== 'group' && React.createElement(Box, {
|
2601
2664
|
sx: {
|
2602
2665
|
whiteSpace: 'nowrap'
|
2603
2666
|
}
|
2604
|
-
},
|
2667
|
+
}, (enableColumnDragging && columnDef.enableColumnDragging !== false || enableColumnOrdering && columnDef.enableColumnOrdering !== false || enableGrouping && columnDef.enableGrouping !== false) && React.createElement(MRT_TableHeadCellGrabHandle, {
|
2605
2668
|
column: column,
|
2606
2669
|
table: table,
|
2607
2670
|
tableHeadCellRef: tableHeadCellRef
|
2608
|
-
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false &&
|
2671
|
+
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false && React.createElement(MRT_TableHeadCellColumnActionsButton, {
|
2609
2672
|
header: header,
|
2610
2673
|
table: table
|
2611
2674
|
})), column.getCanResize() && React.createElement(MRT_TableHeadCellResizeHandle, {
|
2612
2675
|
header: header,
|
2613
2676
|
table: table
|
2614
|
-
})),
|
2677
|
+
})), column.getCanFilter() && React.createElement(MRT_TableHeadCellFilterContainer, {
|
2615
2678
|
header: header,
|
2616
2679
|
table: table
|
2617
2680
|
}));
|
@@ -2790,19 +2853,21 @@ var MRT_CopyButton = function MRT_CopyButton(_ref) {
|
|
2790
2853
|
type: "button",
|
2791
2854
|
variant: "text"
|
2792
2855
|
}, buttonProps, {
|
2793
|
-
sx:
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2856
|
+
sx: function sx(theme) {
|
2857
|
+
return _extends({
|
2858
|
+
backgroundColor: 'transparent',
|
2859
|
+
border: 'none',
|
2860
|
+
color: 'inherit',
|
2861
|
+
cursor: 'copy',
|
2862
|
+
fontFamily: 'inherit',
|
2863
|
+
fontSize: 'inherit',
|
2864
|
+
letterSpacing: 'inherit',
|
2865
|
+
m: '-0.25rem',
|
2866
|
+
minWidth: 'unset',
|
2867
|
+
textAlign: 'inherit',
|
2868
|
+
textTransform: 'inherit'
|
2869
|
+
}, (buttonProps == null ? void 0 : buttonProps.sx) instanceof Function ? buttonProps.sx(theme) : buttonProps == null ? void 0 : buttonProps.sx);
|
2870
|
+
}
|
2806
2871
|
}), children));
|
2807
2872
|
};
|
2808
2873
|
|
@@ -2922,7 +2987,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
2922
2987
|
|
2923
2988
|
var handleDragEnter = function handleDragEnter(_e) {
|
2924
2989
|
if (enableColumnOrdering && currentDraggingColumn) {
|
2925
|
-
setCurrentHoveredColumn(
|
2990
|
+
setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2926
2991
|
}
|
2927
2992
|
};
|
2928
2993
|
|
@@ -2957,7 +3022,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
2957
3022
|
'&:hover': {
|
2958
3023
|
backgroundColor: enableHover && enableEditing && editingMode !== 'row' ? theme.palette.mode === 'dark' ? lighten(theme.palette.background["default"], 0.13) + " !important" : darken(theme.palette.background["default"], 0.07) + " !important" : undefined
|
2959
3024
|
}
|
2960
|
-
}, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
3025
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2961
3026
|
maxWidth: "min(" + column.getSize() + "px, fit-content)",
|
2962
3027
|
minWidth: "max(" + column.getSize() + "px, " + ((_columnDef$minSize = columnDef.minSize) != null ? _columnDef$minSize : 30) + "px)",
|
2963
3028
|
width: column.getSize()
|
@@ -3008,13 +3073,15 @@ var MRT_TableDetailPanel = function MRT_TableDetailPanel(_ref) {
|
|
3008
3073
|
return React.createElement(TableRow, Object.assign({}, tableRowProps), React.createElement(TableCell, Object.assign({
|
3009
3074
|
colSpan: getVisibleLeafColumns().length
|
3010
3075
|
}, tableCellProps, {
|
3011
|
-
sx:
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3076
|
+
sx: function sx(theme) {
|
3077
|
+
return _extends({
|
3078
|
+
borderBottom: !row.getIsExpanded() ? 'none' : undefined,
|
3079
|
+
pb: row.getIsExpanded() ? '1rem' : 0,
|
3080
|
+
pt: row.getIsExpanded() ? '1rem' : 0,
|
3081
|
+
transition: 'all 0.2s ease-in-out',
|
3082
|
+
width: table.getTotalSize() + "px"
|
3083
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx);
|
3084
|
+
}
|
3018
3085
|
}), renderDetailPanel && React.createElement(Collapse, {
|
3019
3086
|
"in": row.getIsExpanded()
|
3020
3087
|
}, renderDetailPanel({
|
@@ -3072,7 +3139,7 @@ var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
|
|
3072
3139
|
'&:hover td': {
|
3073
3140
|
backgroundColor: (tableRowProps == null ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned() ? theme.palette.mode === 'dark' ? "" + lighten(theme.palette.background["default"], 0.12) : "" + darken(theme.palette.background["default"], 0.05) : undefined
|
3074
3141
|
}
|
3075
|
-
}, tableRowProps == null ? void 0 : tableRowProps.sx, draggingBorders);
|
3142
|
+
}, (tableRowProps == null ? void 0 : tableRowProps.sx) instanceof Function ? tableRowProps.sx(theme) : tableRowProps == null ? void 0 : tableRowProps.sx, draggingBorders);
|
3076
3143
|
}
|
3077
3144
|
}), row == null ? void 0 : (_row$getVisibleCells = row.getVisibleCells()) == null ? void 0 : _row$getVisibleCells.map == null ? void 0 : _row$getVisibleCells.map(function (cell) {
|
3078
3145
|
return React.createElement(MRT_TableBodyCell, {
|
@@ -3208,7 +3275,7 @@ var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
|
|
3208
3275
|
transition: "all " + (enableColumnResizing ? '10ms' : '0.2s') + " ease-in-out",
|
3209
3276
|
width: column.getSize(),
|
3210
3277
|
verticalAlign: 'text-top'
|
3211
|
-
}, tableCellProps == null ? void 0 : tableCellProps.sx);
|
3278
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx);
|
3212
3279
|
}
|
3213
3280
|
}), React.createElement(React.Fragment, null, footer.isPlaceholder ? null : (_ref2 = (_ref3 = columnDef.Footer instanceof Function ? columnDef.Footer == null ? void 0 : columnDef.Footer({
|
3214
3281
|
footer: footer,
|
@@ -3276,9 +3343,11 @@ var MRT_Table = function MRT_Table(_ref) {
|
|
3276
3343
|
return React.createElement(Table, Object.assign({
|
3277
3344
|
stickyHeader: enableStickyHeader || enableRowVirtualization || isFullScreen
|
3278
3345
|
}, tableProps, {
|
3279
|
-
sx:
|
3280
|
-
|
3281
|
-
|
3346
|
+
sx: function sx(theme) {
|
3347
|
+
return _extends({
|
3348
|
+
tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto'
|
3349
|
+
}, (tableProps == null ? void 0 : tableProps.sx) instanceof Function ? tableProps.sx(theme) : tableProps == null ? void 0 : tableProps.sx);
|
3350
|
+
}
|
3282
3351
|
}), enableTableHead && React.createElement(MRT_TableHead, {
|
3283
3352
|
table: table
|
3284
3353
|
}), React.createElement(MRT_TableBody, {
|
@@ -3320,11 +3389,13 @@ var MRT_TableContainer = function MRT_TableContainer(_ref) {
|
|
3320
3389
|
return React.createElement(TableContainer, Object.assign({
|
3321
3390
|
ref: tableContainerRef
|
3322
3391
|
}, tableContainerProps, {
|
3323
|
-
sx:
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3392
|
+
sx: function sx(theme) {
|
3393
|
+
return _extends({
|
3394
|
+
maxWidth: '100%',
|
3395
|
+
maxHeight: enableStickyHeader || enableRowVirtualization ? "clamp(350px, calc(100vh - " + totalToolbarHeight + "px), 9999px)" : undefined,
|
3396
|
+
overflow: 'auto'
|
3397
|
+
}, (tableContainerProps == null ? void 0 : tableContainerProps.sx) instanceof Function ? tableContainerProps.sx(theme) : tableContainerProps == null ? void 0 : tableContainerProps.sx);
|
3398
|
+
},
|
3328
3399
|
style: _extends({
|
3329
3400
|
maxHeight: isFullScreen ? "calc(100vh - " + totalToolbarHeight + "px)" : undefined
|
3330
3401
|
}, tableContainerProps == null ? void 0 : tableContainerProps.style)
|
@@ -3380,8 +3451,23 @@ var MRT_TablePaper = function MRT_TablePaper(_ref) {
|
|
3380
3451
|
}));
|
3381
3452
|
};
|
3382
3453
|
|
3454
|
+
var defaultDisplayColumnDefOptions = {
|
3455
|
+
columnDefType: 'display',
|
3456
|
+
enableClickToCopy: false,
|
3457
|
+
enableColumnActions: false,
|
3458
|
+
enableColumnDragging: false,
|
3459
|
+
enableColumnFilter: false,
|
3460
|
+
enableColumnOrdering: false,
|
3461
|
+
enableEditing: false,
|
3462
|
+
enableGlobalFilter: false,
|
3463
|
+
enableGrouping: false,
|
3464
|
+
enableHiding: false,
|
3465
|
+
enablePinning: false,
|
3466
|
+
enableResizing: false,
|
3467
|
+
enableSorting: false
|
3468
|
+
};
|
3383
3469
|
var MRT_TableRoot = function MRT_TableRoot(props) {
|
3384
|
-
var _initialState$columnO, _initialState$current, _initialState$current2, _initialState$density, _initialState$isFullS, _props$initialState$s, _props$initialState2, _initialState$showCol, _initialState$showGlo, _props$state3, _props$state4, _MRT_FilterFns$curren, _props$onCurrentDragg, _props$onCurrentDragg2, _props$onCurrentEditi, _props$onCurrentEditi2, _props$onCurrentFilte, _props$onCurrentGloba, _props$onCurrentHover, _props$onCurrentHover2, _props$onDensityChang, _props$onIsFullScreen, _props$onShowAlertBan, _props$onShowFiltersC, _props$onShowGlobalFi;
|
3470
|
+
var _initialState$columnO, _initialState$current, _initialState$current2, _initialState$current3, _initialState$current4, _initialState$current5, _initialState$current6, _initialState$density, _initialState$isFullS, _props$initialState$s, _props$initialState2, _initialState$showCol, _initialState$showGlo, _props$state3, _props$state4, _MRT_FilterFns$curren, _props$onCurrentDragg, _props$onCurrentDragg2, _props$onCurrentEditi, _props$onCurrentEditi2, _props$onCurrentFilte, _props$onCurrentGloba, _props$onCurrentHover, _props$onCurrentHover2, _props$onDensityChang, _props$onIsFullScreen, _props$onShowAlertBan, _props$onShowFiltersC, _props$onShowGlobalFi;
|
3385
3471
|
|
3386
3472
|
var _useState = useState(props.tableId),
|
3387
3473
|
tableId = _useState[0],
|
@@ -3404,27 +3490,27 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3404
3490
|
columnOrder = _useState2[0],
|
3405
3491
|
setColumnOrder = _useState2[1];
|
3406
3492
|
|
3407
|
-
var _useState3 = useState(null),
|
3493
|
+
var _useState3 = useState((_initialState$current = initialState.currentDraggingColumn) != null ? _initialState$current : null),
|
3408
3494
|
currentDraggingColumn = _useState3[0],
|
3409
3495
|
setCurrentDraggingColumn = _useState3[1];
|
3410
3496
|
|
3411
|
-
var _useState4 = useState(null),
|
3497
|
+
var _useState4 = useState((_initialState$current2 = initialState.currentDraggingRow) != null ? _initialState$current2 : null),
|
3412
3498
|
currentDraggingRow = _useState4[0],
|
3413
3499
|
setCurrentDraggingRow = _useState4[1];
|
3414
3500
|
|
3415
|
-
var _useState5 = useState((_initialState$
|
3501
|
+
var _useState5 = useState((_initialState$current3 = initialState.currentEditingCell) != null ? _initialState$current3 : null),
|
3416
3502
|
currentEditingCell = _useState5[0],
|
3417
3503
|
setCurrentEditingCell = _useState5[1];
|
3418
3504
|
|
3419
|
-
var _useState6 = useState((_initialState$
|
3505
|
+
var _useState6 = useState((_initialState$current4 = initialState.currentEditingRow) != null ? _initialState$current4 : null),
|
3420
3506
|
currentEditingRow = _useState6[0],
|
3421
3507
|
setCurrentEditingRow = _useState6[1];
|
3422
3508
|
|
3423
|
-
var _useState7 = useState(null),
|
3509
|
+
var _useState7 = useState((_initialState$current5 = initialState.currentHoveredColumn) != null ? _initialState$current5 : null),
|
3424
3510
|
currentHoveredColumn = _useState7[0],
|
3425
3511
|
setCurrentHoveredColumn = _useState7[1];
|
3426
3512
|
|
3427
|
-
var _useState8 = useState(null),
|
3513
|
+
var _useState8 = useState((_initialState$current6 = initialState.currentHoveredRow) != null ? _initialState$current6 : null),
|
3428
3514
|
currentHoveredRow = _useState8[0],
|
3429
3515
|
setCurrentHoveredRow = _useState8[1];
|
3430
3516
|
|
@@ -3450,9 +3536,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3450
3536
|
|
3451
3537
|
var _useState14 = useState(function () {
|
3452
3538
|
return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (col) {
|
3453
|
-
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$
|
3539
|
+
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$current7, _ref3, _col$id$toString2, _col$id2, _col$accessorKey2, _col$filterSelectOpti, _ref4;
|
3454
3540
|
|
3455
|
-
return _ref4 = {}, _ref4[(_ref = (_col$id$toString = (_col$id = col.id) == null ? void 0 : _col$id.toString()) != null ? _col$id$toString : (_col$accessorKey = col.accessorKey) == null ? void 0 : _col$accessorKey.toString()) != null ? _ref : ''] = col.filterFn instanceof Function ? (_col$filterFn$name = col.filterFn.name) != null ? _col$filterFn$name : 'custom' : (_ref2 = (_col$filterFn = col.filterFn) != null ? _col$filterFn : initialState == null ? void 0 : (_initialState$
|
3541
|
+
return _ref4 = {}, _ref4[(_ref = (_col$id$toString = (_col$id = col.id) == null ? void 0 : _col$id.toString()) != null ? _col$id$toString : (_col$accessorKey = col.accessorKey) == null ? void 0 : _col$accessorKey.toString()) != null ? _ref : ''] = col.filterFn instanceof Function ? (_col$filterFn$name = col.filterFn.name) != null ? _col$filterFn$name : 'custom' : (_ref2 = (_col$filterFn = col.filterFn) != null ? _col$filterFn : initialState == null ? void 0 : (_initialState$current7 = initialState.currentFilterFns) == null ? void 0 : _initialState$current7[(_ref3 = (_col$id$toString2 = (_col$id2 = col.id) == null ? void 0 : _col$id2.toString()) != null ? _col$id$toString2 : (_col$accessorKey2 = col.accessorKey) == null ? void 0 : _col$accessorKey2.toString()) != null ? _ref3 : '']) != null ? _ref2 : !!((_col$filterSelectOpti = col.filterSelectOptions) != null && _col$filterSelectOpti.length) ? 'equals' : 'fuzzy', _ref4;
|
3456
3542
|
})));
|
3457
3543
|
}),
|
3458
3544
|
currentFilterFns = _useState14[0],
|
@@ -3463,16 +3549,14 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3463
3549
|
setCurrentGlobalFilterFn = _useState15[1];
|
3464
3550
|
|
3465
3551
|
var displayColumns = useMemo(function () {
|
3466
|
-
var _props$localization, _props$localization2, _props$localization3, _props$localization4, _props$localization6;
|
3552
|
+
var _props$localization, _props$displayColumnD, _props$localization2, _props$displayColumnD2, _props$localization3, _props$displayColumnD3, _props$localization4, _props$displayColumnD4, _props$localization6, _props$displayColumnD5;
|
3467
3553
|
|
3468
|
-
return [columnOrder.includes('mrt-row-drag') && {
|
3469
|
-
columnDefType: 'display',
|
3554
|
+
return [columnOrder.includes('mrt-row-drag') && _extends({
|
3470
3555
|
header: (_props$localization = props.localization) == null ? void 0 : _props$localization.move,
|
3471
|
-
id: 'mrt-row-drag',
|
3472
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3473
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3474
3556
|
size: 60
|
3475
|
-
},
|
3557
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD['mrt-row-drag'], {
|
3558
|
+
id: 'mrt-row-drag'
|
3559
|
+
}), columnOrder.includes('mrt-row-actions') && _extends({
|
3476
3560
|
Cell: function Cell(_ref5) {
|
3477
3561
|
var cell = _ref5.cell;
|
3478
3562
|
return React.createElement(MRT_ToggleRowActionMenuButton, {
|
@@ -3480,13 +3564,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3480
3564
|
table: table
|
3481
3565
|
});
|
3482
3566
|
},
|
3483
|
-
columnDefType: 'display',
|
3484
3567
|
header: (_props$localization2 = props.localization) == null ? void 0 : _props$localization2.actions,
|
3485
|
-
id: 'mrt-row-actions',
|
3486
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3487
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3488
3568
|
size: 70
|
3489
|
-
},
|
3569
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD2 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD2['mrt-row-actions'], {
|
3570
|
+
id: 'mrt-row-actions'
|
3571
|
+
}), columnOrder.includes('mrt-row-expand') && _extends({
|
3490
3572
|
Cell: function Cell(_ref6) {
|
3491
3573
|
var cell = _ref6.cell;
|
3492
3574
|
return React.createElement(MRT_ExpandButton, {
|
@@ -3499,13 +3581,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3499
3581
|
table: table
|
3500
3582
|
}) : null;
|
3501
3583
|
},
|
3502
|
-
columnDefType: 'display',
|
3503
3584
|
header: (_props$localization3 = props.localization) == null ? void 0 : _props$localization3.expand,
|
3504
|
-
id: 'mrt-row-expand',
|
3505
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3506
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3507
3585
|
size: 60
|
3508
|
-
},
|
3586
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD3 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD3['mrt-row-expand'], {
|
3587
|
+
id: 'mrt-row-expand'
|
3588
|
+
}), columnOrder.includes('mrt-row-select') && _extends({
|
3509
3589
|
Cell: function Cell(_ref7) {
|
3510
3590
|
var cell = _ref7.cell;
|
3511
3591
|
return React.createElement(MRT_SelectCheckbox, {
|
@@ -3519,13 +3599,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3519
3599
|
table: table
|
3520
3600
|
}) : null;
|
3521
3601
|
},
|
3522
|
-
columnDefType: 'display',
|
3523
3602
|
header: (_props$localization4 = props.localization) == null ? void 0 : _props$localization4.select,
|
3524
|
-
id: 'mrt-row-select',
|
3525
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3526
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3527
3603
|
size: 60
|
3528
|
-
},
|
3604
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD4 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD4['mrt-row-select'], {
|
3605
|
+
id: 'mrt-row-select'
|
3606
|
+
}), columnOrder.includes('mrt-row-numbers') && _extends({
|
3529
3607
|
Cell: function Cell(_ref8) {
|
3530
3608
|
var cell = _ref8.cell;
|
3531
3609
|
return cell.row.index + 1;
|
@@ -3535,14 +3613,12 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3535
3613
|
|
3536
3614
|
return (_props$localization5 = props.localization) == null ? void 0 : _props$localization5.rowNumber;
|
3537
3615
|
},
|
3538
|
-
columnDefType: 'display',
|
3539
3616
|
header: (_props$localization6 = props.localization) == null ? void 0 : _props$localization6.rowNumbers,
|
3540
|
-
id: 'mrt-row-numbers',
|
3541
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3542
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3543
3617
|
size: 60
|
3544
|
-
}
|
3545
|
-
|
3618
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD5 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD5['mrt-row-numbers'], {
|
3619
|
+
id: 'mrt-row-numbers'
|
3620
|
+
})].filter(Boolean);
|
3621
|
+
}, [columnOrder, props.displayColumnDefOptions, props.editingMode, props.enableColumnDragging, props.enableColumnOrdering, props.enableEditing, props.enableExpandAll, props.enableExpanding, props.enableGrouping, props.enableRowActions, props.enableRowDragging, props.enableRowNumbers, props.enableRowOrdering, props.enableRowSelection, props.enableSelectAll, props.localization, props.muiTableBodyCellProps, props.muiTableHeadCellProps, props.positionActionsColumn]);
|
3546
3622
|
var columnDefs = useMemo(function () {
|
3547
3623
|
return prepareColumns([].concat(displayColumns, props.columns), currentFilterFns);
|
3548
3624
|
}, [currentFilterFns, displayColumns, props.columns]);
|