material-react-table 0.24.1 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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
@@ -60,6 +60,7 @@ var MRT_DefaultLocalization_EN = {
|
|
60
60
|
expand: 'Expand',
|
61
61
|
expandAll: 'Expand all',
|
62
62
|
filterBetween: 'Between',
|
63
|
+
filterBetweenInclusive: 'Between Inclusive',
|
63
64
|
filterByColumn: 'Filter by {column}',
|
64
65
|
filterContains: 'Contains',
|
65
66
|
filterEmpty: 'Empty',
|
@@ -67,7 +68,9 @@ var MRT_DefaultLocalization_EN = {
|
|
67
68
|
filterEquals: 'Equals',
|
68
69
|
filterFuzzy: 'Fuzzy',
|
69
70
|
filterGreaterThan: 'Greater Than',
|
71
|
+
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
70
72
|
filterLessThan: 'Less Than',
|
73
|
+
filterLessThanOrEqualTo: 'Less Than Or Equal To',
|
71
74
|
filterMode: 'Filter Mode: {filterType}',
|
72
75
|
filterNotEmpty: 'Not Empty',
|
73
76
|
filterNotEquals: 'Not Equals',
|
@@ -221,10 +224,12 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
221
224
|
disabled: !row.getCanExpand() && !renderDetailPanel,
|
222
225
|
onClick: handleToggleExpand
|
223
226
|
}, iconButtonProps, {
|
224
|
-
sx:
|
225
|
-
|
226
|
-
|
227
|
-
|
227
|
+
sx: function sx(theme) {
|
228
|
+
return _extends({
|
229
|
+
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
230
|
+
width: density === 'compact' ? '1.75rem' : '2.25rem'
|
231
|
+
}, (iconButtonProps == null ? void 0 : iconButtonProps.sx) instanceof Function ? iconButtonProps.sx(theme) : iconButtonProps == null ? void 0 : iconButtonProps.sx);
|
232
|
+
}
|
228
233
|
}), React__default.createElement(ExpandMoreIcon, {
|
229
234
|
style: {
|
230
235
|
transform: "rotate(" + (!row.getCanExpand() && !renderDetailPanel ? -90 : row.getIsExpanded() ? -180 : 0) + "deg)",
|
@@ -233,11 +238,6 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
233
238
|
}))));
|
234
239
|
};
|
235
240
|
|
236
|
-
var commonMenuItemStyles = {
|
237
|
-
py: '6px',
|
238
|
-
my: 0,
|
239
|
-
alignItems: 'center'
|
240
|
-
};
|
241
241
|
var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
242
242
|
var _columnDef$enabledCol;
|
243
243
|
|
@@ -269,46 +269,72 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
269
269
|
var filterOptions = React.useMemo(function () {
|
270
270
|
return [{
|
271
271
|
option: 'fuzzy',
|
272
|
+
symbol: '≈',
|
272
273
|
label: localization.filterFuzzy,
|
273
274
|
divider: false
|
274
275
|
}, {
|
275
276
|
option: 'contains',
|
277
|
+
symbol: '*',
|
276
278
|
label: localization.filterContains,
|
277
279
|
divider: false
|
278
280
|
}, {
|
279
281
|
option: 'startsWith',
|
282
|
+
symbol: 'a',
|
280
283
|
label: localization.filterStartsWith,
|
281
284
|
divider: false
|
282
285
|
}, {
|
283
286
|
option: 'endsWith',
|
287
|
+
symbol: 'z',
|
284
288
|
label: localization.filterEndsWith,
|
285
289
|
divider: true
|
286
290
|
}, {
|
287
291
|
option: 'equals',
|
292
|
+
symbol: '=',
|
288
293
|
label: localization.filterEquals,
|
289
294
|
divider: false
|
290
295
|
}, {
|
291
296
|
option: 'notEquals',
|
297
|
+
symbol: '≠',
|
292
298
|
label: localization.filterNotEquals,
|
293
299
|
divider: true
|
294
300
|
}, {
|
295
301
|
option: 'between',
|
302
|
+
symbol: '⇿',
|
296
303
|
label: localization.filterBetween,
|
297
304
|
divider: false
|
305
|
+
}, {
|
306
|
+
option: 'betweenInclusive',
|
307
|
+
symbol: '⬌',
|
308
|
+
label: localization.filterBetweenInclusive,
|
309
|
+
divider: true
|
298
310
|
}, {
|
299
311
|
option: 'greaterThan',
|
312
|
+
symbol: '>',
|
300
313
|
label: localization.filterGreaterThan,
|
301
314
|
divider: false
|
315
|
+
}, {
|
316
|
+
option: 'greaterThanOrEqualTo',
|
317
|
+
symbol: '≥',
|
318
|
+
label: localization.filterGreaterThanOrEqualTo,
|
319
|
+
divider: false
|
302
320
|
}, {
|
303
321
|
option: 'lessThan',
|
322
|
+
symbol: '<',
|
304
323
|
label: localization.filterLessThan,
|
324
|
+
divider: false
|
325
|
+
}, {
|
326
|
+
option: 'lessThanOrEqualTo',
|
327
|
+
symbol: '≤',
|
328
|
+
label: localization.filterLessThanOrEqualTo,
|
305
329
|
divider: true
|
306
330
|
}, {
|
307
331
|
option: 'empty',
|
332
|
+
symbol: '∅',
|
308
333
|
label: localization.filterEmpty,
|
309
334
|
divider: false
|
310
335
|
}, {
|
311
336
|
option: 'notEmpty',
|
337
|
+
symbol: '!∅',
|
312
338
|
label: localization.filterNotEmpty,
|
313
339
|
divider: false
|
314
340
|
}].filter(function (filterType) {
|
@@ -356,7 +382,8 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
356
382
|
}, filterOptions.map(function (_ref4, index) {
|
357
383
|
var option = _ref4.option,
|
358
384
|
label = _ref4.label,
|
359
|
-
divider = _ref4.divider
|
385
|
+
divider = _ref4.divider,
|
386
|
+
symbol = _ref4.symbol;
|
360
387
|
return React__default.createElement(material.MenuItem, {
|
361
388
|
divider: divider,
|
362
389
|
key: index,
|
@@ -364,9 +391,20 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
|
|
364
391
|
return handleSelectFilterType(option);
|
365
392
|
},
|
366
393
|
selected: option === filterOption,
|
367
|
-
sx:
|
394
|
+
sx: {
|
395
|
+
py: '6px',
|
396
|
+
my: 0,
|
397
|
+
alignItems: 'center',
|
398
|
+
display: 'flex',
|
399
|
+
gap: '2ch'
|
400
|
+
},
|
368
401
|
value: option
|
369
|
-
},
|
402
|
+
}, React__default.createElement(material.Box, {
|
403
|
+
sx: {
|
404
|
+
fontSize: '1.25rem',
|
405
|
+
width: '2ch'
|
406
|
+
}
|
407
|
+
}, symbol), label);
|
370
408
|
}));
|
371
409
|
};
|
372
410
|
|
@@ -512,21 +550,37 @@ notEquals.autoRemove = function (val) {
|
|
512
550
|
};
|
513
551
|
|
514
552
|
var greaterThan = function greaterThan(row, id, filterValue) {
|
515
|
-
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id)
|
553
|
+
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id) > +filterValue : row.getValue(id).toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
|
516
554
|
};
|
517
555
|
|
518
556
|
greaterThan.autoRemove = function (val) {
|
519
557
|
return !val;
|
520
558
|
};
|
521
559
|
|
560
|
+
var greaterThanOrEqualTo = function greaterThanOrEqualTo(row, id, filterValue) {
|
561
|
+
return equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
562
|
+
};
|
563
|
+
|
564
|
+
greaterThanOrEqualTo.autoRemove = function (val) {
|
565
|
+
return !val;
|
566
|
+
};
|
567
|
+
|
522
568
|
var lessThan = function lessThan(row, id, filterValue) {
|
523
|
-
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id)
|
569
|
+
return !isNaN(+filterValue) && !isNaN(+row.getValue(id)) ? +row.getValue(id) < +filterValue : row.getValue(id).toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
|
524
570
|
};
|
525
571
|
|
526
572
|
lessThan.autoRemove = function (val) {
|
527
573
|
return !val;
|
528
574
|
};
|
529
575
|
|
576
|
+
var lessThanOrEqualTo = function lessThanOrEqualTo(row, id, filterValue) {
|
577
|
+
return equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
578
|
+
};
|
579
|
+
|
580
|
+
lessThanOrEqualTo.autoRemove = function (val) {
|
581
|
+
return !val;
|
582
|
+
};
|
583
|
+
|
530
584
|
var between = function between(row, id, filterValues) {
|
531
585
|
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]));
|
532
586
|
};
|
@@ -535,6 +589,14 @@ between.autoRemove = function (val) {
|
|
535
589
|
return !val;
|
536
590
|
};
|
537
591
|
|
592
|
+
var betweenInclusive = function betweenInclusive(row, id, filterValues) {
|
593
|
+
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]));
|
594
|
+
};
|
595
|
+
|
596
|
+
betweenInclusive.autoRemove = function (val) {
|
597
|
+
return !val;
|
598
|
+
};
|
599
|
+
|
538
600
|
var empty = function empty(row, id, _filterValue) {
|
539
601
|
return !row.getValue(id).toString().trim();
|
540
602
|
};
|
@@ -553,13 +615,16 @@ notEmpty.autoRemove = function (val) {
|
|
553
615
|
|
554
616
|
var MRT_FilterFns = /*#__PURE__*/_extends({}, reactTable.filterFns, {
|
555
617
|
between: between,
|
618
|
+
betweenInclusive: betweenInclusive,
|
556
619
|
contains: contains,
|
557
620
|
empty: empty,
|
558
621
|
endsWith: endsWith,
|
559
622
|
equals: equals,
|
560
623
|
fuzzy: fuzzy,
|
561
624
|
greaterThan: greaterThan,
|
625
|
+
greaterThanOrEqualTo: greaterThanOrEqualTo,
|
562
626
|
lessThan: lessThan,
|
627
|
+
lessThanOrEqualTo: lessThanOrEqualTo,
|
563
628
|
notEmpty: notEmpty,
|
564
629
|
notEquals: notEquals,
|
565
630
|
startsWith: startsWith
|
@@ -911,7 +976,7 @@ var MRT_ShowHideColumnsMenu = function MRT_ShowHideColumnsMenu(_ref) {
|
|
911
976
|
}));
|
912
977
|
};
|
913
978
|
|
914
|
-
var commonMenuItemStyles
|
979
|
+
var commonMenuItemStyles = {
|
915
980
|
py: '6px',
|
916
981
|
my: 0,
|
917
982
|
justifyContent: 'space-between',
|
@@ -1055,14 +1120,14 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1055
1120
|
disabled: !column.getIsSorted(),
|
1056
1121
|
key: 0,
|
1057
1122
|
onClick: handleClearSort,
|
1058
|
-
sx: commonMenuItemStyles
|
1123
|
+
sx: commonMenuItemStyles
|
1059
1124
|
}, React__default.createElement(material.Box, {
|
1060
1125
|
sx: commonListItemStyles
|
1061
1126
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ClearAllIcon, null)), localization.clearSort)), React__default.createElement(material.MenuItem, {
|
1062
1127
|
disabled: column.getIsSorted() === 'asc',
|
1063
1128
|
key: 1,
|
1064
1129
|
onClick: handleSortAsc,
|
1065
|
-
sx: commonMenuItemStyles
|
1130
|
+
sx: commonMenuItemStyles
|
1066
1131
|
}, React__default.createElement(material.Box, {
|
1067
1132
|
sx: commonListItemStyles
|
1068
1133
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, null)), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(columnDef.header)))), React__default.createElement(material.MenuItem, {
|
@@ -1070,7 +1135,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1070
1135
|
key: 2,
|
1071
1136
|
disabled: column.getIsSorted() === 'desc',
|
1072
1137
|
onClick: handleSortDesc,
|
1073
|
-
sx: commonMenuItemStyles
|
1138
|
+
sx: commonMenuItemStyles
|
1074
1139
|
}, React__default.createElement(material.Box, {
|
1075
1140
|
sx: commonListItemStyles
|
1076
1141
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, {
|
@@ -1081,14 +1146,14 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1081
1146
|
disabled: !column.getFilterValue(),
|
1082
1147
|
key: 0,
|
1083
1148
|
onClick: handleClearFilter,
|
1084
|
-
sx: commonMenuItemStyles
|
1149
|
+
sx: commonMenuItemStyles
|
1085
1150
|
}, React__default.createElement(material.Box, {
|
1086
1151
|
sx: commonListItemStyles
|
1087
1152
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListOffIcon, null)), localization.clearFilter)), React__default.createElement(material.MenuItem, {
|
1088
1153
|
divider: enableGrouping || enableHiding,
|
1089
1154
|
key: 1,
|
1090
1155
|
onClick: handleFilterByColumn,
|
1091
|
-
sx: commonMenuItemStyles
|
1156
|
+
sx: commonMenuItemStyles
|
1092
1157
|
}, React__default.createElement(material.Box, {
|
1093
1158
|
sx: commonListItemStyles
|
1094
1159
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListIcon, null)), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(columnDef.header))), showFilterModeSubMenu && React__default.createElement(material.IconButton, {
|
@@ -1109,7 +1174,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1109
1174
|
divider: enablePinning,
|
1110
1175
|
key: 0,
|
1111
1176
|
onClick: handleGroupByColumn,
|
1112
|
-
sx: commonMenuItemStyles
|
1177
|
+
sx: commonMenuItemStyles
|
1113
1178
|
}, React__default.createElement(material.Box, {
|
1114
1179
|
sx: commonListItemStyles
|
1115
1180
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(DynamicFeedIcon, null)), (_localization = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(columnDef.header))))], enablePinning && column.getCanPin() && [React__default.createElement(material.MenuItem, {
|
@@ -1118,7 +1183,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1118
1183
|
onClick: function onClick() {
|
1119
1184
|
return handlePinColumn('left');
|
1120
1185
|
},
|
1121
|
-
sx: commonMenuItemStyles
|
1186
|
+
sx: commonMenuItemStyles
|
1122
1187
|
}, React__default.createElement(material.Box, {
|
1123
1188
|
sx: commonListItemStyles
|
1124
1189
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, {
|
@@ -1131,7 +1196,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1131
1196
|
onClick: function onClick() {
|
1132
1197
|
return handlePinColumn('right');
|
1133
1198
|
},
|
1134
|
-
sx: commonMenuItemStyles
|
1199
|
+
sx: commonMenuItemStyles
|
1135
1200
|
}, React__default.createElement(material.Box, {
|
1136
1201
|
sx: commonListItemStyles
|
1137
1202
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, {
|
@@ -1145,21 +1210,21 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1145
1210
|
onClick: function onClick() {
|
1146
1211
|
return handlePinColumn(false);
|
1147
1212
|
},
|
1148
|
-
sx: commonMenuItemStyles
|
1213
|
+
sx: commonMenuItemStyles
|
1149
1214
|
}, React__default.createElement(material.Box, {
|
1150
1215
|
sx: commonListItemStyles
|
1151
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && [React__default.createElement(material.MenuItem, {
|
1152
|
-
disabled: !
|
1216
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(PushPinIcon, null)), localization.unpin))], enableColumnResizing && column.getCanResize() && [React__default.createElement(material.MenuItem, {
|
1217
|
+
disabled: !columnSizing[column.id],
|
1153
1218
|
key: 0,
|
1154
1219
|
onClick: handleResetColumnSize,
|
1155
|
-
sx: commonMenuItemStyles
|
1220
|
+
sx: commonMenuItemStyles
|
1156
1221
|
}, React__default.createElement(material.Box, {
|
1157
1222
|
sx: commonListItemStyles
|
1158
1223
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(RestartAltIcon, null)), localization.resetColumnSize))], enableHiding && [React__default.createElement(material.MenuItem, {
|
1159
1224
|
disabled: columnDef.enableHiding === false,
|
1160
1225
|
key: 0,
|
1161
1226
|
onClick: handleHideColumn,
|
1162
|
-
sx: commonMenuItemStyles
|
1227
|
+
sx: commonMenuItemStyles
|
1163
1228
|
}, React__default.createElement(material.Box, {
|
1164
1229
|
sx: commonListItemStyles
|
1165
1230
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(VisibilityOffIcon, null)), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(columnDef.header)))), React__default.createElement(material.MenuItem, {
|
@@ -1168,7 +1233,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
1168
1233
|
}).length,
|
1169
1234
|
key: 1,
|
1170
1235
|
onClick: handleShowAllColumns,
|
1171
|
-
sx: commonMenuItemStyles
|
1236
|
+
sx: commonMenuItemStyles
|
1172
1237
|
}, React__default.createElement(material.Box, {
|
1173
1238
|
sx: commonListItemStyles
|
1174
1239
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ViewColumnIcon, null)), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(columnDef.header))), React__default.createElement(material.IconButton, {
|
@@ -1214,7 +1279,7 @@ var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
|
|
1214
1279
|
}
|
1215
1280
|
}, enableEditing && React__default.createElement(material.MenuItem, {
|
1216
1281
|
onClick: handleEdit,
|
1217
|
-
sx: commonMenuItemStyles
|
1282
|
+
sx: commonMenuItemStyles
|
1218
1283
|
}, React__default.createElement(material.Box, {
|
1219
1284
|
sx: commonListItemStyles
|
1220
1285
|
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(EditIcon, null)), localization.edit)), renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems({
|
@@ -1365,19 +1430,7 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
1365
1430
|
var _getState = getState(),
|
1366
1431
|
density = _getState.density;
|
1367
1432
|
|
1368
|
-
var
|
1369
|
-
if (selectAll) {
|
1370
|
-
if (selectAllMode === 'all') {
|
1371
|
-
table.getToggleAllRowsSelectedHandler()(event);
|
1372
|
-
} else if (selectAllMode === 'page') {
|
1373
|
-
table.getToggleAllPageRowsSelectedHandler()(event);
|
1374
|
-
}
|
1375
|
-
} else if (row) {
|
1376
|
-
row == null ? void 0 : row.getToggleSelectedHandler()(event);
|
1377
|
-
}
|
1378
|
-
};
|
1379
|
-
|
1380
|
-
var checkboxProps = selectAll ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
1433
|
+
var checkboxProps = !row ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
1381
1434
|
table: table
|
1382
1435
|
}) : muiSelectAllCheckboxProps : muiSelectCheckboxProps instanceof Function ? muiSelectCheckboxProps({
|
1383
1436
|
row: row,
|
@@ -1394,13 +1447,16 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
1394
1447
|
inputProps: {
|
1395
1448
|
'aria-label': selectAll ? localization.toggleSelectAll : localization.toggleSelectRow
|
1396
1449
|
},
|
1397
|
-
onChange:
|
1450
|
+
onChange: !row ? selectAllMode === 'all' ? table.getToggleAllRowsSelectedHandler() : table.getToggleAllPageRowsSelectedHandler() : row.getToggleSelectedHandler(),
|
1398
1451
|
size: density === 'compact' ? 'small' : 'medium'
|
1399
1452
|
}, checkboxProps, {
|
1400
|
-
sx:
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1453
|
+
sx: function sx(theme) {
|
1454
|
+
return _extends({
|
1455
|
+
height: density === 'compact' ? '1.5rem' : '2rem',
|
1456
|
+
width: density === 'compact' ? '1.5rem' : '2rem',
|
1457
|
+
m: '-1re.m'
|
1458
|
+
}, (checkboxProps == null ? void 0 : checkboxProps.sx) instanceof Function ? checkboxProps.sx(theme) : checkboxProps == null ? void 0 : checkboxProps.sx);
|
1459
|
+
}
|
1404
1460
|
})));
|
1405
1461
|
};
|
1406
1462
|
|
@@ -1751,12 +1807,14 @@ var MRT_TablePagination = function MRT_TablePagination(_ref) {
|
|
1751
1807
|
showFirstButton: showFirstLastPageButtons,
|
1752
1808
|
showLastButton: showFirstLastPageButtons
|
1753
1809
|
}, tablePaginationProps, {
|
1754
|
-
sx:
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1810
|
+
sx: function sx(theme) {
|
1811
|
+
return _extends({
|
1812
|
+
m: '0 0.5rem',
|
1813
|
+
mt: position === 'top' && enableToolbarInternalActions && !showGlobalFilter ? '3.5rem' : undefined,
|
1814
|
+
position: 'relative',
|
1815
|
+
zIndex: 2
|
1816
|
+
}, (tablePaginationProps == null ? void 0 : tablePaginationProps.sx) instanceof Function ? tablePaginationProps.sx(theme) : tablePaginationProps == null ? void 0 : tablePaginationProps.sx);
|
1817
|
+
}
|
1760
1818
|
}));
|
1761
1819
|
};
|
1762
1820
|
|
@@ -1798,17 +1856,19 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner(_ref) {
|
|
1798
1856
|
color: "info",
|
1799
1857
|
icon: false
|
1800
1858
|
}, alertProps, {
|
1801
|
-
sx:
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1859
|
+
sx: function sx(theme) {
|
1860
|
+
return _extends({
|
1861
|
+
borderRadius: 0,
|
1862
|
+
fontSize: '1rem',
|
1863
|
+
left: 0,
|
1864
|
+
p: 0,
|
1865
|
+
position: 'relative',
|
1866
|
+
right: 0,
|
1867
|
+
top: 0,
|
1868
|
+
width: '100%',
|
1869
|
+
zIndex: 2
|
1870
|
+
}, (alertProps == null ? void 0 : alertProps.sx) instanceof Function ? alertProps.sx(theme) : alertProps == null ? void 0 : alertProps.sx);
|
1871
|
+
}
|
1812
1872
|
}), (alertProps == null ? void 0 : alertProps.title) && React__default.createElement(material.AlertTitle, null, alertProps.title), React__default.createElement(material.Box, {
|
1813
1873
|
sx: {
|
1814
1874
|
p: '0.5rem 1rem'
|
@@ -1897,7 +1957,7 @@ var MRT_ToolbarTop = function MRT_ToolbarTop(_ref2) {
|
|
1897
1957
|
top: isFullScreen ? '0' : undefined
|
1898
1958
|
}, commonToolbarStyles({
|
1899
1959
|
theme: theme
|
1900
|
-
}), toolbarProps == null ? void 0 : toolbarProps.sx);
|
1960
|
+
}), (toolbarProps == null ? void 0 : toolbarProps.sx) instanceof Function ? toolbarProps.sx(theme) : toolbarProps == null ? void 0 : toolbarProps.sx);
|
1901
1961
|
}
|
1902
1962
|
}), positionToolbarAlertBanner === 'top' && React__default.createElement(MRT_ToolbarAlertBanner, {
|
1903
1963
|
stackAlertBanner: stackAlertBanner,
|
@@ -1963,7 +2023,7 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom(_ref) {
|
|
1963
2023
|
left: 0,
|
1964
2024
|
position: isFullScreen ? 'fixed' : 'relative',
|
1965
2025
|
right: 0
|
1966
|
-
}, toolbarProps == null ? void 0 : toolbarProps.sx);
|
2026
|
+
}, (toolbarProps == null ? void 0 : toolbarProps.sx) instanceof Function ? toolbarProps.sx(theme) : toolbarProps == null ? void 0 : toolbarProps.sx);
|
1967
2027
|
}
|
1968
2028
|
}), React__default.createElement(MRT_LinearProgressBar, {
|
1969
2029
|
isTopToolbar: false,
|
@@ -2038,16 +2098,18 @@ var MRT_TableHeadCellColumnActionsButton = function MRT_TableHeadCellColumnActio
|
|
2038
2098
|
onClick: handleClick,
|
2039
2099
|
size: "small"
|
2040
2100
|
}, iconButtonProps, {
|
2041
|
-
sx:
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2101
|
+
sx: function sx(theme) {
|
2102
|
+
return _extends({
|
2103
|
+
height: '2rem',
|
2104
|
+
mt: '-0.2rem',
|
2105
|
+
opacity: 0.5,
|
2106
|
+
transition: 'opacity 0.2s',
|
2107
|
+
width: '2rem',
|
2108
|
+
'&:hover': {
|
2109
|
+
opacity: 1
|
2110
|
+
}
|
2111
|
+
}, (iconButtonProps == null ? void 0 : iconButtonProps.sx) instanceof Function ? iconButtonProps.sx(theme) : iconButtonProps == null ? void 0 : iconButtonProps.sx);
|
2112
|
+
}
|
2051
2113
|
}), React__default.createElement(MoreVertIcon, null))), React__default.createElement(MRT_ColumnActionMenu, {
|
2052
2114
|
anchorEl: anchorEl,
|
2053
2115
|
header: header,
|
@@ -2103,16 +2165,16 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
2103
2165
|
setFilterValue = _useState2[1];
|
2104
2166
|
|
2105
2167
|
var handleChangeDebounced = React.useCallback(material.debounce(function (event) {
|
2168
|
+
var value = textFieldProps.type === 'date' ? new Date(event.target.value) : event.target.value;
|
2169
|
+
|
2106
2170
|
if (inputIndex !== undefined) {
|
2107
2171
|
column.setFilterValue(function (old) {
|
2108
2172
|
var newFilterValues = old != null ? old : ['', ''];
|
2109
|
-
newFilterValues[inputIndex] =
|
2173
|
+
newFilterValues[inputIndex] = value;
|
2110
2174
|
return newFilterValues;
|
2111
2175
|
});
|
2112
2176
|
} else {
|
2113
|
-
|
2114
|
-
|
2115
|
-
column.setFilterValue((_event$target$value = event.target.value) != null ? _event$target$value : undefined);
|
2177
|
+
column.setFilterValue(value != null ? value : undefined);
|
2116
2178
|
}
|
2117
2179
|
}, 200), []);
|
2118
2180
|
|
@@ -2232,15 +2294,17 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
2232
2294
|
}, React__default.createElement(CloseIcon, null)))))
|
2233
2295
|
}
|
2234
2296
|
}, textFieldProps, {
|
2235
|
-
sx:
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2297
|
+
sx: function sx(theme) {
|
2298
|
+
return _extends({
|
2299
|
+
m: '-0.25rem',
|
2300
|
+
p: 0,
|
2301
|
+
minWidth: !filterChipLabel ? '8rem' : 'auto',
|
2302
|
+
width: 'calc(100% + 0.5rem)',
|
2303
|
+
'& .MuiSelect-icon': {
|
2304
|
+
mr: '1.5rem'
|
2305
|
+
}
|
2306
|
+
}, (textFieldProps == null ? void 0 : textFieldProps.sx) instanceof Function ? textFieldProps.sx(theme) : textFieldProps == null ? void 0 : textFieldProps.sx);
|
2307
|
+
}
|
2244
2308
|
}), isSelectFilter && React__default.createElement(material.MenuItem, {
|
2245
2309
|
divider: true,
|
2246
2310
|
disabled: !filterValue,
|
@@ -2519,11 +2583,6 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2519
2583
|
|
2520
2584
|
var tableCellProps = _extends({}, mTableHeadCellProps, mcTableHeadCellProps);
|
2521
2585
|
|
2522
|
-
var headerElement = (_ref2 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
2523
|
-
header: header,
|
2524
|
-
table: table
|
2525
|
-
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref2 : columnDef.header;
|
2526
|
-
|
2527
2586
|
var getIsLastLeftPinnedColumn = function getIsLastLeftPinnedColumn() {
|
2528
2587
|
return column.getIsPinned() === 'left' && table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex();
|
2529
2588
|
};
|
@@ -2538,17 +2597,21 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2538
2597
|
|
2539
2598
|
var handleDragEnter = function handleDragEnter(_e) {
|
2540
2599
|
if (enableColumnOrdering && currentDraggingColumn) {
|
2541
|
-
setCurrentHoveredColumn(
|
2600
|
+
setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2542
2601
|
}
|
2543
2602
|
};
|
2544
2603
|
|
2545
|
-
var tableHeadCellRef = React__default.useRef(null);
|
2546
2604
|
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;
|
2547
2605
|
var draggingBorders = draggingBorder ? {
|
2548
2606
|
borderLeft: draggingBorder,
|
2549
2607
|
borderRight: draggingBorder,
|
2550
2608
|
borderTop: draggingBorder
|
2551
2609
|
} : undefined;
|
2610
|
+
var headerElement = (_ref2 = (columnDef == null ? void 0 : columnDef.Header) instanceof Function ? columnDef == null ? void 0 : columnDef.Header == null ? void 0 : columnDef.Header({
|
2611
|
+
header: header,
|
2612
|
+
table: table
|
2613
|
+
}) : columnDef == null ? void 0 : columnDef.Header) != null ? _ref2 : columnDef.header;
|
2614
|
+
var tableHeadCellRef = React__default.useRef(null);
|
2552
2615
|
return React__default.createElement(material.TableCell, Object.assign({
|
2553
2616
|
align: columnDefType === 'group' ? 'center' : 'left',
|
2554
2617
|
colSpan: header.colSpan,
|
@@ -2573,15 +2636,15 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2573
2636
|
right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
|
2574
2637
|
transition: "all " + (enableColumnResizing ? 0 : '0.2s') + " ease-in-out",
|
2575
2638
|
userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
|
2576
|
-
verticalAlign: '
|
2639
|
+
verticalAlign: 'top',
|
2577
2640
|
zIndex: column.getIsResizing() || (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id ? 3 : column.getIsPinned() && columnDefType !== 'group' ? 2 : 1
|
2578
|
-
}, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2641
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2579
2642
|
maxWidth: "min(" + column.getSize() + "px, fit-content)",
|
2580
2643
|
minWidth: "max(" + column.getSize() + "px, " + ((_columnDef$minSize = columnDef.minSize) != null ? _columnDef$minSize : 30) + "px)",
|
2581
2644
|
width: header.getSize()
|
2582
2645
|
});
|
2583
2646
|
}
|
2584
|
-
}), header.isPlaceholder ? null :
|
2647
|
+
}), header.isPlaceholder ? null : React__default.createElement(material.Box, {
|
2585
2648
|
sx: {
|
2586
2649
|
alignItems: 'flex-start',
|
2587
2650
|
display: 'flex',
|
@@ -2598,27 +2661,27 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
2598
2661
|
flexWrap: 'nowrap',
|
2599
2662
|
whiteSpace: ((_columnDef$header$len = (_columnDef$header = columnDef.header) == null ? void 0 : _columnDef$header.length) != null ? _columnDef$header$len : 0) < 24 ? 'nowrap' : 'normal'
|
2600
2663
|
}
|
2601
|
-
}, headerElement,
|
2664
|
+
}, headerElement, column.getCanSort() && React__default.createElement(MRT_TableHeadCellSortLabel, {
|
2602
2665
|
header: header,
|
2603
2666
|
table: table
|
2604
|
-
}),
|
2667
|
+
}), column.getCanFilter() && React__default.createElement(MRT_TableHeadCellFilterLabel, {
|
2605
2668
|
header: header,
|
2606
2669
|
table: table
|
2607
|
-
})), React__default.createElement(material.Box, {
|
2670
|
+
})), columnDefType !== 'group' && React__default.createElement(material.Box, {
|
2608
2671
|
sx: {
|
2609
2672
|
whiteSpace: 'nowrap'
|
2610
2673
|
}
|
2611
|
-
},
|
2674
|
+
}, (enableColumnDragging && columnDef.enableColumnDragging !== false || enableColumnOrdering && columnDef.enableColumnOrdering !== false || enableGrouping && columnDef.enableGrouping !== false) && React__default.createElement(MRT_TableHeadCellGrabHandle, {
|
2612
2675
|
column: column,
|
2613
2676
|
table: table,
|
2614
2677
|
tableHeadCellRef: tableHeadCellRef
|
2615
|
-
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false &&
|
2678
|
+
}), (enableColumnActions || columnDef.enableColumnActions) && columnDef.enableColumnActions !== false && React__default.createElement(MRT_TableHeadCellColumnActionsButton, {
|
2616
2679
|
header: header,
|
2617
2680
|
table: table
|
2618
2681
|
})), column.getCanResize() && React__default.createElement(MRT_TableHeadCellResizeHandle, {
|
2619
2682
|
header: header,
|
2620
2683
|
table: table
|
2621
|
-
})),
|
2684
|
+
})), column.getCanFilter() && React__default.createElement(MRT_TableHeadCellFilterContainer, {
|
2622
2685
|
header: header,
|
2623
2686
|
table: table
|
2624
2687
|
}));
|
@@ -2797,19 +2860,21 @@ var MRT_CopyButton = function MRT_CopyButton(_ref) {
|
|
2797
2860
|
type: "button",
|
2798
2861
|
variant: "text"
|
2799
2862
|
}, buttonProps, {
|
2800
|
-
sx:
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2863
|
+
sx: function sx(theme) {
|
2864
|
+
return _extends({
|
2865
|
+
backgroundColor: 'transparent',
|
2866
|
+
border: 'none',
|
2867
|
+
color: 'inherit',
|
2868
|
+
cursor: 'copy',
|
2869
|
+
fontFamily: 'inherit',
|
2870
|
+
fontSize: 'inherit',
|
2871
|
+
letterSpacing: 'inherit',
|
2872
|
+
m: '-0.25rem',
|
2873
|
+
minWidth: 'unset',
|
2874
|
+
textAlign: 'inherit',
|
2875
|
+
textTransform: 'inherit'
|
2876
|
+
}, (buttonProps == null ? void 0 : buttonProps.sx) instanceof Function ? buttonProps.sx(theme) : buttonProps == null ? void 0 : buttonProps.sx);
|
2877
|
+
}
|
2813
2878
|
}), children));
|
2814
2879
|
};
|
2815
2880
|
|
@@ -2929,7 +2994,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
2929
2994
|
|
2930
2995
|
var handleDragEnter = function handleDragEnter(_e) {
|
2931
2996
|
if (enableColumnOrdering && currentDraggingColumn) {
|
2932
|
-
setCurrentHoveredColumn(
|
2997
|
+
setCurrentHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2933
2998
|
}
|
2934
2999
|
};
|
2935
3000
|
|
@@ -2964,7 +3029,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
2964
3029
|
'&:hover': {
|
2965
3030
|
backgroundColor: enableHover && enableEditing && editingMode !== 'row' ? theme.palette.mode === 'dark' ? material.lighten(theme.palette.background["default"], 0.13) + " !important" : material.darken(theme.palette.background["default"], 0.07) + " !important" : undefined
|
2966
3031
|
}
|
2967
|
-
}, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
3032
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
|
2968
3033
|
maxWidth: "min(" + column.getSize() + "px, fit-content)",
|
2969
3034
|
minWidth: "max(" + column.getSize() + "px, " + ((_columnDef$minSize = columnDef.minSize) != null ? _columnDef$minSize : 30) + "px)",
|
2970
3035
|
width: column.getSize()
|
@@ -3015,13 +3080,15 @@ var MRT_TableDetailPanel = function MRT_TableDetailPanel(_ref) {
|
|
3015
3080
|
return React__default.createElement(material.TableRow, Object.assign({}, tableRowProps), React__default.createElement(material.TableCell, Object.assign({
|
3016
3081
|
colSpan: getVisibleLeafColumns().length
|
3017
3082
|
}, tableCellProps, {
|
3018
|
-
sx:
|
3019
|
-
|
3020
|
-
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3083
|
+
sx: function sx(theme) {
|
3084
|
+
return _extends({
|
3085
|
+
borderBottom: !row.getIsExpanded() ? 'none' : undefined,
|
3086
|
+
pb: row.getIsExpanded() ? '1rem' : 0,
|
3087
|
+
pt: row.getIsExpanded() ? '1rem' : 0,
|
3088
|
+
transition: 'all 0.2s ease-in-out',
|
3089
|
+
width: table.getTotalSize() + "px"
|
3090
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx);
|
3091
|
+
}
|
3025
3092
|
}), renderDetailPanel && React__default.createElement(material.Collapse, {
|
3026
3093
|
"in": row.getIsExpanded()
|
3027
3094
|
}, renderDetailPanel({
|
@@ -3079,7 +3146,7 @@ var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
|
|
3079
3146
|
'&:hover td': {
|
3080
3147
|
backgroundColor: (tableRowProps == null ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned() ? theme.palette.mode === 'dark' ? "" + material.lighten(theme.palette.background["default"], 0.12) : "" + material.darken(theme.palette.background["default"], 0.05) : undefined
|
3081
3148
|
}
|
3082
|
-
}, tableRowProps == null ? void 0 : tableRowProps.sx, draggingBorders);
|
3149
|
+
}, (tableRowProps == null ? void 0 : tableRowProps.sx) instanceof Function ? tableRowProps.sx(theme) : tableRowProps == null ? void 0 : tableRowProps.sx, draggingBorders);
|
3083
3150
|
}
|
3084
3151
|
}), row == null ? void 0 : (_row$getVisibleCells = row.getVisibleCells()) == null ? void 0 : _row$getVisibleCells.map == null ? void 0 : _row$getVisibleCells.map(function (cell) {
|
3085
3152
|
return React__default.createElement(MRT_TableBodyCell, {
|
@@ -3215,7 +3282,7 @@ var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
|
|
3215
3282
|
transition: "all " + (enableColumnResizing ? '10ms' : '0.2s') + " ease-in-out",
|
3216
3283
|
width: column.getSize(),
|
3217
3284
|
verticalAlign: 'text-top'
|
3218
|
-
}, tableCellProps == null ? void 0 : tableCellProps.sx);
|
3285
|
+
}, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx);
|
3219
3286
|
}
|
3220
3287
|
}), React__default.createElement(React__default.Fragment, null, footer.isPlaceholder ? null : (_ref2 = (_ref3 = columnDef.Footer instanceof Function ? columnDef.Footer == null ? void 0 : columnDef.Footer({
|
3221
3288
|
footer: footer,
|
@@ -3283,9 +3350,11 @@ var MRT_Table = function MRT_Table(_ref) {
|
|
3283
3350
|
return React__default.createElement(material.Table, Object.assign({
|
3284
3351
|
stickyHeader: enableStickyHeader || enableRowVirtualization || isFullScreen
|
3285
3352
|
}, tableProps, {
|
3286
|
-
sx:
|
3287
|
-
|
3288
|
-
|
3353
|
+
sx: function sx(theme) {
|
3354
|
+
return _extends({
|
3355
|
+
tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto'
|
3356
|
+
}, (tableProps == null ? void 0 : tableProps.sx) instanceof Function ? tableProps.sx(theme) : tableProps == null ? void 0 : tableProps.sx);
|
3357
|
+
}
|
3289
3358
|
}), enableTableHead && React__default.createElement(MRT_TableHead, {
|
3290
3359
|
table: table
|
3291
3360
|
}), React__default.createElement(MRT_TableBody, {
|
@@ -3327,11 +3396,13 @@ var MRT_TableContainer = function MRT_TableContainer(_ref) {
|
|
3327
3396
|
return React__default.createElement(material.TableContainer, Object.assign({
|
3328
3397
|
ref: tableContainerRef
|
3329
3398
|
}, tableContainerProps, {
|
3330
|
-
sx:
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3399
|
+
sx: function sx(theme) {
|
3400
|
+
return _extends({
|
3401
|
+
maxWidth: '100%',
|
3402
|
+
maxHeight: enableStickyHeader || enableRowVirtualization ? "clamp(350px, calc(100vh - " + totalToolbarHeight + "px), 9999px)" : undefined,
|
3403
|
+
overflow: 'auto'
|
3404
|
+
}, (tableContainerProps == null ? void 0 : tableContainerProps.sx) instanceof Function ? tableContainerProps.sx(theme) : tableContainerProps == null ? void 0 : tableContainerProps.sx);
|
3405
|
+
},
|
3335
3406
|
style: _extends({
|
3336
3407
|
maxHeight: isFullScreen ? "calc(100vh - " + totalToolbarHeight + "px)" : undefined
|
3337
3408
|
}, tableContainerProps == null ? void 0 : tableContainerProps.style)
|
@@ -3387,8 +3458,23 @@ var MRT_TablePaper = function MRT_TablePaper(_ref) {
|
|
3387
3458
|
}));
|
3388
3459
|
};
|
3389
3460
|
|
3461
|
+
var defaultDisplayColumnDefOptions = {
|
3462
|
+
columnDefType: 'display',
|
3463
|
+
enableClickToCopy: false,
|
3464
|
+
enableColumnActions: false,
|
3465
|
+
enableColumnDragging: false,
|
3466
|
+
enableColumnFilter: false,
|
3467
|
+
enableColumnOrdering: false,
|
3468
|
+
enableEditing: false,
|
3469
|
+
enableGlobalFilter: false,
|
3470
|
+
enableGrouping: false,
|
3471
|
+
enableHiding: false,
|
3472
|
+
enablePinning: false,
|
3473
|
+
enableResizing: false,
|
3474
|
+
enableSorting: false
|
3475
|
+
};
|
3390
3476
|
var MRT_TableRoot = function MRT_TableRoot(props) {
|
3391
|
-
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;
|
3477
|
+
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;
|
3392
3478
|
|
3393
3479
|
var _useState = React.useState(props.tableId),
|
3394
3480
|
tableId = _useState[0],
|
@@ -3411,27 +3497,27 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3411
3497
|
columnOrder = _useState2[0],
|
3412
3498
|
setColumnOrder = _useState2[1];
|
3413
3499
|
|
3414
|
-
var _useState3 = React.useState(null),
|
3500
|
+
var _useState3 = React.useState((_initialState$current = initialState.currentDraggingColumn) != null ? _initialState$current : null),
|
3415
3501
|
currentDraggingColumn = _useState3[0],
|
3416
3502
|
setCurrentDraggingColumn = _useState3[1];
|
3417
3503
|
|
3418
|
-
var _useState4 = React.useState(null),
|
3504
|
+
var _useState4 = React.useState((_initialState$current2 = initialState.currentDraggingRow) != null ? _initialState$current2 : null),
|
3419
3505
|
currentDraggingRow = _useState4[0],
|
3420
3506
|
setCurrentDraggingRow = _useState4[1];
|
3421
3507
|
|
3422
|
-
var _useState5 = React.useState((_initialState$
|
3508
|
+
var _useState5 = React.useState((_initialState$current3 = initialState.currentEditingCell) != null ? _initialState$current3 : null),
|
3423
3509
|
currentEditingCell = _useState5[0],
|
3424
3510
|
setCurrentEditingCell = _useState5[1];
|
3425
3511
|
|
3426
|
-
var _useState6 = React.useState((_initialState$
|
3512
|
+
var _useState6 = React.useState((_initialState$current4 = initialState.currentEditingRow) != null ? _initialState$current4 : null),
|
3427
3513
|
currentEditingRow = _useState6[0],
|
3428
3514
|
setCurrentEditingRow = _useState6[1];
|
3429
3515
|
|
3430
|
-
var _useState7 = React.useState(null),
|
3516
|
+
var _useState7 = React.useState((_initialState$current5 = initialState.currentHoveredColumn) != null ? _initialState$current5 : null),
|
3431
3517
|
currentHoveredColumn = _useState7[0],
|
3432
3518
|
setCurrentHoveredColumn = _useState7[1];
|
3433
3519
|
|
3434
|
-
var _useState8 = React.useState(null),
|
3520
|
+
var _useState8 = React.useState((_initialState$current6 = initialState.currentHoveredRow) != null ? _initialState$current6 : null),
|
3435
3521
|
currentHoveredRow = _useState8[0],
|
3436
3522
|
setCurrentHoveredRow = _useState8[1];
|
3437
3523
|
|
@@ -3457,9 +3543,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3457
3543
|
|
3458
3544
|
var _useState14 = React.useState(function () {
|
3459
3545
|
return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (col) {
|
3460
|
-
var _ref, _col$id$toString, _col$id, _col$accessorKey, _col$filterFn$name, _ref2, _col$filterFn, _initialState$
|
3546
|
+
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;
|
3461
3547
|
|
3462
|
-
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$
|
3548
|
+
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;
|
3463
3549
|
})));
|
3464
3550
|
}),
|
3465
3551
|
currentFilterFns = _useState14[0],
|
@@ -3470,16 +3556,14 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3470
3556
|
setCurrentGlobalFilterFn = _useState15[1];
|
3471
3557
|
|
3472
3558
|
var displayColumns = React.useMemo(function () {
|
3473
|
-
var _props$localization, _props$localization2, _props$localization3, _props$localization4, _props$localization6;
|
3559
|
+
var _props$localization, _props$displayColumnD, _props$localization2, _props$displayColumnD2, _props$localization3, _props$displayColumnD3, _props$localization4, _props$displayColumnD4, _props$localization6, _props$displayColumnD5;
|
3474
3560
|
|
3475
|
-
return [columnOrder.includes('mrt-row-drag') && {
|
3476
|
-
columnDefType: 'display',
|
3561
|
+
return [columnOrder.includes('mrt-row-drag') && _extends({
|
3477
3562
|
header: (_props$localization = props.localization) == null ? void 0 : _props$localization.move,
|
3478
|
-
id: 'mrt-row-drag',
|
3479
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3480
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3481
3563
|
size: 60
|
3482
|
-
},
|
3564
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD['mrt-row-drag'], {
|
3565
|
+
id: 'mrt-row-drag'
|
3566
|
+
}), columnOrder.includes('mrt-row-actions') && _extends({
|
3483
3567
|
Cell: function Cell(_ref5) {
|
3484
3568
|
var cell = _ref5.cell;
|
3485
3569
|
return React__default.createElement(MRT_ToggleRowActionMenuButton, {
|
@@ -3487,13 +3571,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3487
3571
|
table: table
|
3488
3572
|
});
|
3489
3573
|
},
|
3490
|
-
columnDefType: 'display',
|
3491
3574
|
header: (_props$localization2 = props.localization) == null ? void 0 : _props$localization2.actions,
|
3492
|
-
id: 'mrt-row-actions',
|
3493
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3494
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3495
3575
|
size: 70
|
3496
|
-
},
|
3576
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD2 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD2['mrt-row-actions'], {
|
3577
|
+
id: 'mrt-row-actions'
|
3578
|
+
}), columnOrder.includes('mrt-row-expand') && _extends({
|
3497
3579
|
Cell: function Cell(_ref6) {
|
3498
3580
|
var cell = _ref6.cell;
|
3499
3581
|
return React__default.createElement(MRT_ExpandButton, {
|
@@ -3506,13 +3588,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3506
3588
|
table: table
|
3507
3589
|
}) : null;
|
3508
3590
|
},
|
3509
|
-
columnDefType: 'display',
|
3510
3591
|
header: (_props$localization3 = props.localization) == null ? void 0 : _props$localization3.expand,
|
3511
|
-
id: 'mrt-row-expand',
|
3512
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3513
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3514
3592
|
size: 60
|
3515
|
-
},
|
3593
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD3 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD3['mrt-row-expand'], {
|
3594
|
+
id: 'mrt-row-expand'
|
3595
|
+
}), columnOrder.includes('mrt-row-select') && _extends({
|
3516
3596
|
Cell: function Cell(_ref7) {
|
3517
3597
|
var cell = _ref7.cell;
|
3518
3598
|
return React__default.createElement(MRT_SelectCheckbox, {
|
@@ -3526,13 +3606,11 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3526
3606
|
table: table
|
3527
3607
|
}) : null;
|
3528
3608
|
},
|
3529
|
-
columnDefType: 'display',
|
3530
3609
|
header: (_props$localization4 = props.localization) == null ? void 0 : _props$localization4.select,
|
3531
|
-
id: 'mrt-row-select',
|
3532
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3533
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3534
3610
|
size: 60
|
3535
|
-
},
|
3611
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD4 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD4['mrt-row-select'], {
|
3612
|
+
id: 'mrt-row-select'
|
3613
|
+
}), columnOrder.includes('mrt-row-numbers') && _extends({
|
3536
3614
|
Cell: function Cell(_ref8) {
|
3537
3615
|
var cell = _ref8.cell;
|
3538
3616
|
return cell.row.index + 1;
|
@@ -3542,14 +3620,12 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
3542
3620
|
|
3543
3621
|
return (_props$localization5 = props.localization) == null ? void 0 : _props$localization5.rowNumber;
|
3544
3622
|
},
|
3545
|
-
columnDefType: 'display',
|
3546
3623
|
header: (_props$localization6 = props.localization) == null ? void 0 : _props$localization6.rowNumbers,
|
3547
|
-
id: 'mrt-row-numbers',
|
3548
|
-
muiTableBodyCellProps: props.muiTableBodyCellProps,
|
3549
|
-
muiTableHeadCellProps: props.muiTableHeadCellProps,
|
3550
3624
|
size: 60
|
3551
|
-
}
|
3552
|
-
|
3625
|
+
}, defaultDisplayColumnDefOptions, (_props$displayColumnD5 = props.displayColumnDefOptions) == null ? void 0 : _props$displayColumnD5['mrt-row-numbers'], {
|
3626
|
+
id: 'mrt-row-numbers'
|
3627
|
+
})].filter(Boolean);
|
3628
|
+
}, [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]);
|
3553
3629
|
var columnDefs = React.useMemo(function () {
|
3554
3630
|
return prepareColumns([].concat(displayColumns, props.columns), currentFilterFns);
|
3555
3631
|
}, [currentFilterFns, displayColumns, props.columns]);
|