material-react-table 2.8.0 → 2.9.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/dist/index.d.ts +17 -9
- package/dist/index.esm.js +260 -218
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +259 -216
- package/dist/index.js.map +1 -1
- package/locales/ja/index.esm.js +4 -4
- package/locales/ja/index.js +4 -4
- package/package.json +6 -4
- package/src/components/body/MRT_TableBody.tsx +2 -3
- package/src/components/body/MRT_TableBodyCell.tsx +10 -3
- package/src/components/body/MRT_TableBodyRow.tsx +77 -57
- package/src/components/footer/MRT_TableFooterCell.tsx +10 -1
- package/src/components/footer/MRT_TableFooterRow.tsx +19 -8
- package/src/components/head/MRT_TableHeadCell.tsx +10 -0
- package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +4 -2
- package/src/components/head/MRT_TableHeadRow.tsx +19 -8
- package/src/components/inputs/MRT_EditCellTextField.tsx +4 -3
- package/src/components/inputs/MRT_SelectCheckbox.tsx +4 -6
- package/src/components/table/MRT_Table.tsx +4 -0
- package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +1 -1
- package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +1 -0
- package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +1 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +4 -2
- package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +1 -0
- package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +1 -0
- package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +2 -1
- package/src/hooks/useMRT_ColumnVirtualizer.ts +77 -76
- package/src/hooks/useMRT_RowVirtualizer.ts +30 -32
- package/src/hooks/useMRT_TableInstance.ts +1 -42
- package/src/hooks/useMRT_TableOptions.ts +60 -17
- package/src/locales/ja.ts +4 -4
- package/src/types.ts +3 -0
- package/src/utils/displayColumn.utils.ts +2 -2
- package/src/utils/row.utils.ts +25 -1
- package/src/utils/style.utils.ts +70 -30
- package/src/utils.ts +0 -0
package/dist/index.esm.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { flexRender as flexRender$1, createRow as createRow$1, aggregationFns, filterFns, sortingFns,
|
1
|
+
import { flexRender as flexRender$1, createRow as createRow$1, aggregationFns, filterFns, sortingFns, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
|
2
2
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
3
3
|
import { useMemo, useState, useReducer, useRef, useEffect, useCallback, memo, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
@@ -212,7 +212,7 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
|
|
212
212
|
[getColumnId(col)]: '',
|
213
213
|
}))), rowIndex, depth, subRows, parentId);
|
214
214
|
|
215
|
-
function defaultDisplayColumnProps({ header, id, size
|
215
|
+
function defaultDisplayColumnProps({ header, id, size, tableOptions, }) {
|
216
216
|
const { defaultDisplayColumn, displayColumnDefOptions, localization } = tableOptions;
|
217
217
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), { header: header ? localization[header] : '', size }), displayColumnDefOptions === null || displayColumnDefOptions === void 0 ? void 0 : displayColumnDefOptions[id]), { id });
|
218
218
|
}
|
@@ -270,6 +270,31 @@ const getDefaultColumnOrderIds = (tableOptions) => {
|
|
270
270
|
return [...leadingDisplayCols, ...allLeafColumnDefs, ...trailingDisplayCols];
|
271
271
|
};
|
272
272
|
|
273
|
+
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
274
|
+
const getValueAndLabel = (option) => {
|
275
|
+
var _a, _b, _c;
|
276
|
+
let label = '';
|
277
|
+
let value = '';
|
278
|
+
if (option) {
|
279
|
+
if (typeof option !== 'object') {
|
280
|
+
label = option;
|
281
|
+
value = option;
|
282
|
+
}
|
283
|
+
else {
|
284
|
+
label = (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : option.value;
|
285
|
+
value = (_c = option.value) !== null && _c !== void 0 ? _c : label;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
return { label, value };
|
289
|
+
};
|
290
|
+
|
291
|
+
const getIsRowSelected = ({ row, table, }) => {
|
292
|
+
const { options: { enableRowSelection }, } = table;
|
293
|
+
return (row.getIsSelected() ||
|
294
|
+
(parseFromValuesOrFunc(enableRowSelection, row) &&
|
295
|
+
row.getCanSelectSubRows() &&
|
296
|
+
row.getIsAllSubRowsSelected()));
|
297
|
+
};
|
273
298
|
const getCanRankRows = (table) => {
|
274
299
|
const { getState, options } = table;
|
275
300
|
const { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, } = options;
|
@@ -416,24 +441,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
416
441
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
417
442
|
};
|
418
443
|
|
419
|
-
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
420
|
-
const getValueAndLabel = (option) => {
|
421
|
-
var _a, _b, _c;
|
422
|
-
let label = '';
|
423
|
-
let value = '';
|
424
|
-
if (option) {
|
425
|
-
if (typeof option !== 'object') {
|
426
|
-
label = option;
|
427
|
-
value = option;
|
428
|
-
}
|
429
|
-
else {
|
430
|
-
label = (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : option.value;
|
431
|
-
value = (_c = option.value) !== null && _c !== void 0 ? _c : label;
|
432
|
-
}
|
433
|
-
}
|
434
|
-
return { label, value };
|
435
|
-
};
|
436
|
-
|
437
444
|
const MRT_EditActionButtons = (_a) => {
|
438
445
|
var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
|
439
446
|
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
@@ -493,40 +500,58 @@ const getMRTTheme = (table, theme) => {
|
|
493
500
|
? darken(theme.palette.warning.dark, 0.25)
|
494
501
|
: lighten(theme.palette.warning.light, 0.5), menuBackgroundColor: lighten(baseBackgroundColor, 0.07), pinnedRowBackgroundColor: alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: alpha(theme.palette.primary.main, 0.2) }, themeOverrides);
|
495
502
|
};
|
503
|
+
const pinnedBeforeAfterStyles = {
|
504
|
+
content: '""',
|
505
|
+
height: '100%',
|
506
|
+
left: 0,
|
507
|
+
position: 'absolute',
|
508
|
+
top: 0,
|
509
|
+
width: '100%',
|
510
|
+
zIndex: -1,
|
511
|
+
};
|
512
|
+
const getCommonPinnedCellStyles = ({ column, table, theme, }) => {
|
513
|
+
const { baseBackgroundColor } = getMRTTheme(table, theme);
|
514
|
+
return {
|
515
|
+
'&[data-pinned="true"]': {
|
516
|
+
'&:before': Object.assign({ backgroundColor: alpha(darken(baseBackgroundColor, theme.palette.mode === 'dark' ? 0.05 : 0.01), 0.97), boxShadow: column
|
517
|
+
? getIsLastLeftPinnedColumn(table, column)
|
518
|
+
? `-4px 0 4px -4px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
519
|
+
: getIsFirstRightPinnedColumn(column)
|
520
|
+
? `4px 0 4px -4px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
521
|
+
: undefined
|
522
|
+
: undefined }, pinnedBeforeAfterStyles),
|
523
|
+
},
|
524
|
+
};
|
525
|
+
};
|
496
526
|
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
497
|
-
var _a, _b, _c, _d, _e, _f
|
498
|
-
const { options: { layoutMode }, } = table;
|
527
|
+
var _a, _b, _c, _d, _e, _f;
|
528
|
+
const { options: { enableColumnVirtualization, layoutMode }, } = table;
|
499
529
|
const { columnDef } = column;
|
530
|
+
const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
|
500
531
|
const widthStyles = {
|
501
532
|
minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_a = header === null || header === void 0 ? void 0 : header.id) !== null && _a !== void 0 ? _a : column.id)}-size) * 1px), ${(_b = columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
|
502
|
-
width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_c = header === null || header === void 0 ? void 0 : header.id) !== null && _c !== void 0 ? _c : column.id)}-size) * 1px
|
533
|
+
width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_c = header === null || header === void 0 ? void 0 : header.id) !== null && _c !== void 0 ? _c : column.id)}-size) * 1px)`,
|
503
534
|
};
|
504
535
|
if (layoutMode === 'grid') {
|
505
536
|
widthStyles.flex = `${[0, false].includes(columnDef.grow)
|
506
537
|
? 0
|
507
|
-
: `var(--${header ? 'header' : 'col'}-${parseCSSVarId((
|
538
|
+
: `var(--${header ? 'header' : 'col'}-${parseCSSVarId((_d = header === null || header === void 0 ? void 0 : header.id) !== null && _d !== void 0 ? _d : column.id)}-size)`} 0 auto`;
|
508
539
|
}
|
509
540
|
else if (layoutMode === 'grid-no-grow') {
|
510
541
|
widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
|
511
542
|
}
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
?
|
520
|
-
: undefined, opacity: ((_g = table.getState().draggingColumn) === null || _g === void 0 ? void 0 : _g.id) === column.id ||
|
521
|
-
((_h = table.getState().hoveredColumn) === null || _h === void 0 ? void 0 : _h.id) === column.id
|
543
|
+
const pinnedStyles = isColumnPinned
|
544
|
+
? Object.assign(Object.assign({}, getCommonPinnedCellStyles({ column, table, theme })), { left: isColumnPinned === 'left'
|
545
|
+
? `${column.getStart('left')}px`
|
546
|
+
: undefined, opacity: 0.97, position: 'sticky', right: isColumnPinned === 'right'
|
547
|
+
? `${getTotalRight(table, column)}px`
|
548
|
+
: undefined, zIndex: 1 }) : {};
|
549
|
+
return Object.assign(Object.assign(Object.assign({ backgroundColor: 'inherit', backgroundImage: 'inherit', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: ((_e = table.getState().draggingColumn) === null || _e === void 0 ? void 0 : _e.id) === column.id ||
|
550
|
+
((_f = table.getState().hoveredColumn) === null || _f === void 0 ? void 0 : _f.id) === column.id
|
522
551
|
? 0.5
|
523
|
-
: 1, position:
|
524
|
-
? 'sticky'
|
525
|
-
: undefined, right: column.getIsPinned() === 'right'
|
526
|
-
? `${getTotalRight(table, column)}px`
|
527
|
-
: undefined, transition: table.options.enableColumnVirtualization
|
552
|
+
: 1, position: 'relative', transition: enableColumnVirtualization
|
528
553
|
? 'none'
|
529
|
-
: `padding 150ms ease-in-out
|
554
|
+
: `padding 150ms ease-in-out`, zIndex: 0 }, pinnedStyles), widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
530
555
|
};
|
531
556
|
const getCommonToolbarStyles = ({ table, theme, }) => ({
|
532
557
|
alignItems: 'flex-start',
|
@@ -961,6 +986,7 @@ const getMRT_RowActionsColumnDef = (tableOptions) => {
|
|
961
986
|
return Object.assign({ Cell: ({ cell, row, staticRowIndex, table }) => (jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, staticRowIndex: staticRowIndex, table: table })) }, defaultDisplayColumnProps({
|
962
987
|
header: 'actions',
|
963
988
|
id: 'mrt-row-actions',
|
989
|
+
size: 70,
|
964
990
|
tableOptions,
|
965
991
|
}));
|
966
992
|
};
|
@@ -1016,6 +1042,7 @@ const getMRT_RowDragColumnDef = (tableOptions) => {
|
|
1016
1042
|
return Object.assign({ Cell: ({ row, rowRef, table }) => (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), grow: false }, defaultDisplayColumnProps({
|
1017
1043
|
header: 'move',
|
1018
1044
|
id: 'mrt-row-drag',
|
1045
|
+
size: 60,
|
1019
1046
|
tableOptions,
|
1020
1047
|
}));
|
1021
1048
|
};
|
@@ -1070,6 +1097,7 @@ const MRT_ExpandButton = ({ row, staticRowIndex, table, }) => {
|
|
1070
1097
|
};
|
1071
1098
|
|
1072
1099
|
const getMRT_RowExpandColumnDef = (tableOptions) => {
|
1100
|
+
var _a;
|
1073
1101
|
if (!showRowExpandColumn(tableOptions)) {
|
1074
1102
|
return null;
|
1075
1103
|
}
|
@@ -1099,9 +1127,11 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
|
|
1099
1127
|
header: 'expand',
|
1100
1128
|
id: 'mrt-row-expand',
|
1101
1129
|
size: groupedColumnMode === 'remove'
|
1102
|
-
? defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size
|
1130
|
+
? (_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180
|
1103
1131
|
: renderDetailPanel
|
1104
|
-
?
|
1132
|
+
? enableExpandAll
|
1133
|
+
? 60
|
1134
|
+
: 70
|
1105
1135
|
: 100,
|
1106
1136
|
tableOptions,
|
1107
1137
|
}));
|
@@ -1121,6 +1151,7 @@ const getMRT_RowNumbersColumnDef = (tableOptions) => {
|
|
1121
1151
|
}, Header: () => localization.rowNumber, grow: false }, defaultDisplayColumnProps({
|
1122
1152
|
header: 'rowNumbers',
|
1123
1153
|
id: 'mrt-row-numbers',
|
1154
|
+
size: 50,
|
1124
1155
|
tableOptions,
|
1125
1156
|
}));
|
1126
1157
|
};
|
@@ -1169,15 +1200,17 @@ const getMRT_RowPinningColumnDef = (tableOptions) => {
|
|
1169
1200
|
return Object.assign({ Cell: ({ row, table }) => (jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), grow: false }, defaultDisplayColumnProps({
|
1170
1201
|
header: 'pin',
|
1171
1202
|
id: 'mrt-row-pin',
|
1203
|
+
size: 60,
|
1172
1204
|
tableOptions,
|
1173
1205
|
}));
|
1174
1206
|
};
|
1175
1207
|
|
1176
1208
|
const MRT_SelectCheckbox = (_a) => {
|
1177
1209
|
var _b;
|
1178
|
-
var { row,
|
1210
|
+
var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
|
1179
1211
|
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
1180
1212
|
const { density, isLoading } = getState();
|
1213
|
+
const selectAll = !row;
|
1181
1214
|
const checkboxProps = Object.assign(Object.assign({}, (!row
|
1182
1215
|
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
1183
1216
|
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
@@ -1215,10 +1248,7 @@ const MRT_SelectCheckbox = (_a) => {
|
|
1215
1248
|
};
|
1216
1249
|
const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
|
1217
1250
|
? localization.toggleSelectAll
|
1218
|
-
: localization.toggleSelectRow, checked: selectAll
|
1219
|
-
? allRowsSelected
|
1220
|
-
: (row === null || row === void 0 ? void 0 : row.getIsSelected()) ||
|
1221
|
-
((row === null || row === void 0 ? void 0 : row.getIsAllSubRowsSelected()) && row.getCanSelectSubRows()), disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
|
1251
|
+
: localization.toggleSelectRow, checked: selectAll ? allRowsSelected : getIsRowSelected({ row, table }), disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
|
1222
1252
|
'aria-label': selectAll
|
1223
1253
|
? localization.toggleSelectAll
|
1224
1254
|
: localization.toggleSelectRow,
|
@@ -1243,10 +1273,11 @@ const getMRT_RowSelectColumnDef = (tableOptions) => {
|
|
1243
1273
|
}
|
1244
1274
|
const { enableMultiRowSelection, enableSelectAll } = tableOptions;
|
1245
1275
|
return Object.assign({ Cell: ({ row, staticRowIndex, table }) => (jsx(MRT_SelectCheckbox, { row: row, staticRowIndex: staticRowIndex, table: table })), Header: enableSelectAll && enableMultiRowSelection
|
1246
|
-
? ({ table }) => jsx(MRT_SelectCheckbox, {
|
1276
|
+
? ({ table }) => jsx(MRT_SelectCheckbox, { table: table })
|
1247
1277
|
: undefined, grow: false }, defaultDisplayColumnProps({
|
1248
1278
|
header: 'select',
|
1249
1279
|
id: 'mrt-row-select',
|
1280
|
+
size: enableSelectAll ? 60 : 70,
|
1250
1281
|
tableOptions,
|
1251
1282
|
}));
|
1252
1283
|
};
|
@@ -1401,25 +1432,27 @@ const MRT_DefaultDisplayColumn = {
|
|
1401
1432
|
};
|
1402
1433
|
const useMRT_TableOptions = (_a) => {
|
1403
1434
|
var _b;
|
1404
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
1435
|
+
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
1405
1436
|
const theme = useTheme();
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1437
|
+
icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
1438
|
+
localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
1439
|
+
aggregationFns = useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
1440
|
+
filterFns = useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
1441
|
+
sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
1442
|
+
defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
1443
|
+
defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
1444
|
+
//cannot be changed after initialization
|
1445
|
+
[enableColumnVirtualization, enableRowVirtualization] = useMemo(() => [enableColumnVirtualization, enableRowVirtualization], []);
|
1413
1446
|
if (!columnResizeDirection) {
|
1414
1447
|
columnResizeDirection = theme.direction || 'ltr';
|
1415
1448
|
}
|
1416
1449
|
layoutMode =
|
1417
1450
|
layoutMode || (enableColumnResizing ? 'grid-no-grow' : 'semantic');
|
1418
1451
|
if (layoutMode === 'semantic' &&
|
1419
|
-
(
|
1452
|
+
(enableRowVirtualization || enableColumnVirtualization)) {
|
1420
1453
|
layoutMode = 'grid';
|
1421
1454
|
}
|
1422
|
-
if (
|
1455
|
+
if (enableRowVirtualization) {
|
1423
1456
|
enableStickyHeader = true;
|
1424
1457
|
}
|
1425
1458
|
if (enablePagination === false && manualPagination === undefined) {
|
@@ -1431,20 +1464,26 @@ const useMRT_TableOptions = (_a) => {
|
|
1431
1464
|
manualPagination = true;
|
1432
1465
|
manualSorting = true;
|
1433
1466
|
}
|
1434
|
-
return Object.assign({ aggregationFns
|
1467
|
+
return Object.assign({ aggregationFns,
|
1468
|
+
autoResetExpanded,
|
1435
1469
|
columnFilterDisplayMode,
|
1436
1470
|
columnResizeDirection,
|
1437
1471
|
columnResizeMode,
|
1438
|
-
createDisplayMode,
|
1472
|
+
createDisplayMode,
|
1473
|
+
defaultColumn,
|
1474
|
+
defaultDisplayColumn,
|
1475
|
+
editDisplayMode,
|
1439
1476
|
enableBottomToolbar,
|
1440
1477
|
enableColumnActions,
|
1441
1478
|
enableColumnFilters,
|
1442
1479
|
enableColumnOrdering,
|
1443
1480
|
enableColumnPinning,
|
1444
1481
|
enableColumnResizing,
|
1482
|
+
enableColumnVirtualization,
|
1445
1483
|
enableDensityToggle,
|
1446
1484
|
enableExpandAll,
|
1447
1485
|
enableExpanding,
|
1486
|
+
enableFacetedValues,
|
1448
1487
|
enableFilterMatchHighlighting,
|
1449
1488
|
enableFilters,
|
1450
1489
|
enableFullScreenToggle,
|
@@ -1457,13 +1496,26 @@ const useMRT_TableOptions = (_a) => {
|
|
1457
1496
|
enablePagination,
|
1458
1497
|
enableRowPinning,
|
1459
1498
|
enableRowSelection,
|
1499
|
+
enableRowVirtualization,
|
1460
1500
|
enableSelectAll,
|
1461
1501
|
enableSorting,
|
1462
1502
|
enableStickyHeader,
|
1463
1503
|
enableTableFooter,
|
1464
1504
|
enableTableHead,
|
1465
1505
|
enableToolbarInternalActions,
|
1466
|
-
enableTopToolbar,
|
1506
|
+
enableTopToolbar,
|
1507
|
+
filterFns, getCoreRowModel: getCoreRowModel(), getExpandedRowModel: enableExpanding || enableGrouping ? getExpandedRowModel() : undefined, getFacetedMinMaxValues: enableFacetedValues
|
1508
|
+
? getFacetedMinMaxValues()
|
1509
|
+
: undefined, getFacetedRowModel: enableFacetedValues ? getFacetedRowModel() : undefined, getFacetedUniqueValues: enableFacetedValues
|
1510
|
+
? getFacetedUniqueValues()
|
1511
|
+
: undefined, getFilteredRowModel: enableColumnFilters || enableGlobalFilter || enableFilters
|
1512
|
+
? getFilteredRowModel()
|
1513
|
+
: undefined, getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined, getPaginationRowModel: enablePagination
|
1514
|
+
? getPaginationRowModel()
|
1515
|
+
: undefined, getSortedRowModel: enableSorting ? getSortedRowModel() : undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, icons,
|
1516
|
+
layoutMode,
|
1517
|
+
localization,
|
1518
|
+
manualFiltering,
|
1467
1519
|
manualGrouping,
|
1468
1520
|
manualPagination,
|
1469
1521
|
manualSorting,
|
@@ -1477,7 +1529,8 @@ const useMRT_TableOptions = (_a) => {
|
|
1477
1529
|
positionToolbarDropZone,
|
1478
1530
|
rowNumberDisplayMode,
|
1479
1531
|
rowPinningDisplayMode,
|
1480
|
-
selectAllMode,
|
1532
|
+
selectAllMode,
|
1533
|
+
sortingFns }, rest);
|
1481
1534
|
};
|
1482
1535
|
|
1483
1536
|
const blankColProps = {
|
@@ -1674,25 +1727,7 @@ const useMRT_TableInstance = (_tableOptions) => {
|
|
1674
1727
|
tableOptions.state.showSkeletons,
|
1675
1728
|
]);
|
1676
1729
|
//@ts-ignore
|
1677
|
-
const table = useReactTable(Object.assign(Object.assign({
|
1678
|
-
? getExpandedRowModel()
|
1679
|
-
: undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
1680
|
-
? getFacetedMinMaxValues()
|
1681
|
-
: undefined, getFacetedRowModel: tableOptions.enableFacetedValues
|
1682
|
-
? getFacetedRowModel()
|
1683
|
-
: undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
|
1684
|
-
? getFacetedUniqueValues()
|
1685
|
-
: undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
|
1686
|
-
tableOptions.enableGlobalFilter ||
|
1687
|
-
tableOptions.enableFilters
|
1688
|
-
? getFilteredRowModel()
|
1689
|
-
: undefined, getGroupedRowModel: tableOptions.enableGrouping
|
1690
|
-
? getGroupedRowModel()
|
1691
|
-
: undefined, getPaginationRowModel: tableOptions.enablePagination
|
1692
|
-
? getPaginationRowModel()
|
1693
|
-
: undefined, getSortedRowModel: tableOptions.enableSorting
|
1694
|
-
? getSortedRowModel()
|
1695
|
-
: undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, onColumnOrderChange,
|
1730
|
+
const table = useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
|
1696
1731
|
onColumnSizingInfoChange,
|
1697
1732
|
onGroupingChange,
|
1698
1733
|
onPaginationChange }, tableOptions), { globalFilterFn: (_u = tableOptions.filterFns) === null || _u === void 0 ? void 0 : _u[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
|
@@ -1767,68 +1802,60 @@ const extraIndexRangeExtractor = (range, draggingIndex) => {
|
|
1767
1802
|
};
|
1768
1803
|
|
1769
1804
|
const useMRT_ColumnVirtualizer = (table) => {
|
1770
|
-
var _a, _b, _c, _d
|
1771
|
-
const { getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
1772
|
-
const { columnPinning,
|
1805
|
+
var _a, _b, _c, _d;
|
1806
|
+
const { getLeftLeafColumns, getRightLeafColumns, getState, getVisibleLeafColumns, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
1807
|
+
const { columnPinning, draggingColumn } = getState();
|
1808
|
+
if (!enableColumnVirtualization)
|
1809
|
+
return undefined;
|
1773
1810
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
|
1774
1811
|
table,
|
1775
1812
|
});
|
1776
|
-
const
|
1813
|
+
const visibleColumns = getVisibleLeafColumns();
|
1814
|
+
const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnPinning
|
1777
1815
|
? [
|
1778
|
-
|
1779
|
-
|
1780
|
-
.
|
1781
|
-
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1)
|
1816
|
+
getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
1817
|
+
getRightLeafColumns()
|
1818
|
+
.map((column) => visibleColumns.length - column.getPinnedIndex() - 1)
|
1782
1819
|
.sort((a, b) => a - b),
|
1783
1820
|
]
|
1784
|
-
: [[], []], [columnPinning,
|
1785
|
-
|
1786
|
-
const
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
((_f = (_e = virtualColumns[virtualColumns.length - rightPinnedIndexes.length - 1]) === null || _e === void 0 ? void 0 : _e.end) !== null && _f !== void 0 ? _f : 0) -
|
1823
|
-
(rightPinnedIndexes.length
|
1824
|
-
? columnVirtualizer.getTotalSize() -
|
1825
|
-
((_h = (_g = virtualColumns[virtualColumns.length - rightPinnedIndexes.length]) === null || _g === void 0 ? void 0 : _g.start) !== null && _h !== void 0 ? _h : 0)
|
1826
|
-
: 0);
|
1827
|
-
}
|
1828
|
-
if (columnVirtualizerInstanceRef) {
|
1829
|
-
//@ts-ignore
|
1830
|
-
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
1831
|
-
}
|
1821
|
+
: [[], []], [columnPinning, enableColumnPinning]);
|
1822
|
+
const numPinnedLeft = leftPinnedIndexes.length;
|
1823
|
+
const numPinnedRight = rightPinnedIndexes.length;
|
1824
|
+
const draggingColumnIndex = useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
|
1825
|
+
? visibleColumns.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id))
|
1826
|
+
: undefined, [draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id]);
|
1827
|
+
const columnVirtualizer = useVirtualizer(Object.assign({ count: visibleColumns.length, estimateSize: (index) => visibleColumns[index].getSize(), getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => {
|
1828
|
+
const newIndexes = extraIndexRangeExtractor(range, draggingColumnIndex);
|
1829
|
+
if (!numPinnedLeft && !numPinnedRight) {
|
1830
|
+
return newIndexes;
|
1831
|
+
}
|
1832
|
+
return [
|
1833
|
+
...new Set([
|
1834
|
+
...leftPinnedIndexes,
|
1835
|
+
...newIndexes,
|
1836
|
+
...rightPinnedIndexes,
|
1837
|
+
]),
|
1838
|
+
];
|
1839
|
+
}, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps));
|
1840
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
1841
|
+
columnVirtualizer.virtualColumns = virtualColumns;
|
1842
|
+
const numColumns = virtualColumns.length;
|
1843
|
+
if (numColumns) {
|
1844
|
+
const totalSize = columnVirtualizer.getTotalSize();
|
1845
|
+
const leftNonPinnedStart = ((_a = virtualColumns[numPinnedLeft]) === null || _a === void 0 ? void 0 : _a.start) || 0;
|
1846
|
+
const leftNonPinnedEnd = ((_b = virtualColumns[leftPinnedIndexes.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0;
|
1847
|
+
const rightNonPinnedStart = ((_c = virtualColumns[numColumns - numPinnedRight]) === null || _c === void 0 ? void 0 : _c.start) || 0;
|
1848
|
+
const rightNonPinnedEnd = ((_d = virtualColumns[numColumns - numPinnedRight - 1]) === null || _d === void 0 ? void 0 : _d.end) || 0;
|
1849
|
+
columnVirtualizer.virtualPaddingLeft =
|
1850
|
+
leftNonPinnedStart - leftNonPinnedEnd;
|
1851
|
+
columnVirtualizer.virtualPaddingRight =
|
1852
|
+
totalSize -
|
1853
|
+
rightNonPinnedEnd -
|
1854
|
+
(numPinnedRight ? totalSize - rightNonPinnedStart : 0);
|
1855
|
+
}
|
1856
|
+
if (columnVirtualizerInstanceRef) {
|
1857
|
+
//@ts-ignore
|
1858
|
+
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
1832
1859
|
}
|
1833
1860
|
return columnVirtualizer;
|
1834
1861
|
};
|
@@ -1837,31 +1864,28 @@ const useMRT_RowVirtualizer = (table, rows) => {
|
|
1837
1864
|
var _a;
|
1838
1865
|
const { getRowModel, getState, options: { enableRowVirtualization, renderDetailPanel, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
|
1839
1866
|
const { density, draggingRow, expanded } = getState();
|
1867
|
+
if (!enableRowVirtualization)
|
1868
|
+
return undefined;
|
1840
1869
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
1841
1870
|
table,
|
1842
1871
|
});
|
1843
1872
|
const rowCount = (_a = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _a !== void 0 ? _a : getRowModel().rows.length;
|
1844
1873
|
const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73;
|
1845
|
-
const rowVirtualizer =
|
1846
|
-
|
1847
|
-
?
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
rowVirtualizer.virtualRows = virtualRows;
|
1861
|
-
if (rowVirtualizerInstanceRef) {
|
1862
|
-
//@ts-ignore
|
1863
|
-
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1864
|
-
}
|
1874
|
+
const rowVirtualizer = useVirtualizer(Object.assign({ count: renderDetailPanel ? rowCount * 2 : rowCount, estimateSize: (index) => renderDetailPanel && index % 2 === 1
|
1875
|
+
? expanded === true
|
1876
|
+
? 100
|
1877
|
+
: 0
|
1878
|
+
: normalRowHeight, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
1879
|
+
navigator.userAgent.indexOf('Firefox') === -1
|
1880
|
+
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
1881
|
+
: undefined, overscan: 4, rangeExtractor: useCallback((range) => {
|
1882
|
+
var _a;
|
1883
|
+
return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
|
1884
|
+
}, [draggingRow]) }, rowVirtualizerProps));
|
1885
|
+
rowVirtualizer.virtualRows = rowVirtualizer.getVirtualItems();
|
1886
|
+
if (rowVirtualizerInstanceRef) {
|
1887
|
+
//@ts-ignore
|
1888
|
+
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1865
1889
|
}
|
1866
1890
|
return rowVirtualizer;
|
1867
1891
|
};
|
@@ -2035,10 +2059,9 @@ const MRT_EditCellTextField = (_a) => {
|
|
2035
2059
|
const { column, row } = cell;
|
2036
2060
|
const { columnDef } = column;
|
2037
2061
|
const { creatingRow, editingRow } = getState();
|
2038
|
-
const { editSelectOptions } = columnDef;
|
2062
|
+
const { editSelectOptions, editVariant } = columnDef;
|
2039
2063
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
2040
2064
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
2041
|
-
const isSelectEdit = columnDef.editVariant === 'select';
|
2042
2065
|
const [value, setValue] = useState(() => cell.getValue());
|
2043
2066
|
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
2044
2067
|
cell,
|
@@ -2057,6 +2080,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
2057
2080
|
row,
|
2058
2081
|
table,
|
2059
2082
|
});
|
2083
|
+
const isSelectEdit = editVariant === 'select' || (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select);
|
2060
2084
|
const saveInputValueToRowCache = (newValue) => {
|
2061
2085
|
//@ts-ignore
|
2062
2086
|
row._valuesCache[column.id] = newValue;
|
@@ -2071,7 +2095,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
2071
2095
|
var _a;
|
2072
2096
|
(_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
2073
2097
|
setValue(event.target.value);
|
2074
|
-
if (
|
2098
|
+
if (isSelectEdit) {
|
2075
2099
|
saveInputValueToRowCache(event.target.value);
|
2076
2100
|
}
|
2077
2101
|
};
|
@@ -2124,9 +2148,9 @@ const MRT_EditCellTextField = (_a) => {
|
|
2124
2148
|
|
2125
2149
|
const MRT_TableBodyCell = (_a) => {
|
2126
2150
|
var _b, _c, _d, _e, _f;
|
2127
|
-
var { cell, measureElement, numRows, rowRef, staticRowIndex, table
|
2151
|
+
var { cell, measureElement, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
|
2128
2152
|
const theme = useTheme();
|
2129
|
-
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
2153
|
+
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
2130
2154
|
const { columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
2131
2155
|
const { column, row } = cell;
|
2132
2156
|
const { columnDef } = column;
|
@@ -2197,6 +2221,9 @@ const MRT_TableBodyCell = (_a) => {
|
|
2197
2221
|
hoveredRow,
|
2198
2222
|
staticRowIndex,
|
2199
2223
|
]);
|
2224
|
+
const isColumnPinned = enableColumnPinning &&
|
2225
|
+
columnDef.columnDefType !== 'group' &&
|
2226
|
+
column.getIsPinned();
|
2200
2227
|
const isEditable = !cell.getIsPlaceholder() &&
|
2201
2228
|
parseFromValuesOrFunc(enableEditing, row) &&
|
2202
2229
|
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
@@ -2236,7 +2263,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2236
2263
|
cell,
|
2237
2264
|
table,
|
2238
2265
|
};
|
2239
|
-
return (jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index":
|
2266
|
+
return (jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, ref: (node) => {
|
2240
2267
|
if (node) {
|
2241
2268
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2242
2269
|
}
|
@@ -2318,8 +2345,10 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
2318
2345
|
const theme = useTheme();
|
2319
2346
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
2320
2347
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
2348
|
+
const visibleCells = row.getVisibleCells();
|
2321
2349
|
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
2322
|
-
const
|
2350
|
+
const isRowSelected = getIsRowSelected({ row, table });
|
2351
|
+
const isRowPinned = enableRowPinning && row.getIsPinned();
|
2323
2352
|
const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
|
2324
2353
|
const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
|
2325
2354
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
@@ -2355,47 +2384,49 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
2355
2384
|
};
|
2356
2385
|
const rowRef = useRef(null);
|
2357
2386
|
const { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, } = getMRTTheme(table, theme);
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2387
|
+
const cellHighlightColor = isRowSelected
|
2388
|
+
? selectedRowBackgroundColor
|
2389
|
+
: isRowPinned
|
2390
|
+
? pinnedRowBackgroundColor
|
2391
|
+
: undefined;
|
2392
|
+
const cellHighlightColorHover = (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2393
|
+
? isRowSelected
|
2394
|
+
? cellHighlightColor
|
2395
|
+
: theme.palette.mode === 'dark'
|
2396
|
+
? `${lighten(baseBackgroundColor, 0.3)}`
|
2397
|
+
: `${darken(baseBackgroundColor, 0.3)}`
|
2398
|
+
: undefined;
|
2399
|
+
return (jsxs(Fragment, { children: [jsxs(TableRow, Object.assign({ "data-index": renderDetailPanel ? staticRowIndex * 2 : staticRowIndex, "data-pinned": !!isRowPinned || undefined, "data-selected": isRowSelected || undefined, onDragEnter: handleDragEnter, ref: (node) => {
|
2361
2400
|
if (node) {
|
2362
2401
|
rowRef.current = node;
|
2363
2402
|
rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement(node);
|
2364
2403
|
}
|
2365
|
-
}, selected:
|
2404
|
+
}, selected: isRowSelected }, tableRowProps, { style: Object.assign({ transform: virtualRow
|
2366
2405
|
? `translateY(${virtualRow.start}px)`
|
2367
2406
|
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td': {
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
? `${lighten(baseBackgroundColor, 0.05)}`
|
2373
|
-
: `${darken(baseBackgroundColor, 0.05)}`
|
2374
|
-
: undefined,
|
2375
|
-
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
|
2407
|
+
'&:after': Object.assign({ backgroundColor: cellHighlightColorHover
|
2408
|
+
? alpha(cellHighlightColorHover, 0.3)
|
2409
|
+
: undefined }, pinnedBeforeAfterStyles),
|
2410
|
+
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
2376
2411
|
? `${bottomPinnedIndex * rowHeight +
|
2377
2412
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
2378
|
-
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity:
|
2413
|
+
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isRowPinned ? 0.97 : isDraggingRow || isHoveredRow ? 0.5 : 1, position: virtualRow
|
2379
2414
|
? 'absolute'
|
2380
|
-
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
2415
|
+
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
2381
2416
|
? 'sticky'
|
2382
|
-
: undefined, td: {
|
2383
|
-
backgroundColor: row.getIsSelected()
|
2384
|
-
? selectedRowBackgroundColor
|
2385
|
-
: isPinned
|
2386
|
-
? pinnedRowBackgroundColor
|
2387
|
-
: undefined,
|
2388
|
-
}, top: virtualRow
|
2417
|
+
: undefined, td: Object.assign({ '&:after': Object.assign({ backgroundColor: cellHighlightColor }, pinnedBeforeAfterStyles) }, getCommonPinnedCellStyles({ table, theme })), top: virtualRow
|
2389
2418
|
? 0
|
2390
|
-
: topPinnedIndex !== undefined &&
|
2419
|
+
: topPinnedIndex !== undefined && isRowPinned
|
2391
2420
|
? `${topPinnedIndex * rowHeight +
|
2392
2421
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
2393
|
-
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
2422
|
+
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
2394
2423
|
? 2
|
2395
|
-
: undefined }, sx)), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns :
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2424
|
+
: undefined }, sx)), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : visibleCells).map((cellOrVirtualCell, staticColumnIndex) => {
|
2425
|
+
let cell = cellOrVirtualCell;
|
2426
|
+
if (columnVirtualizer) {
|
2427
|
+
staticColumnIndex = cellOrVirtualCell.index;
|
2428
|
+
cell = visibleCells[staticColumnIndex];
|
2429
|
+
}
|
2399
2430
|
const props = {
|
2400
2431
|
cell,
|
2401
2432
|
measureElement: !isDraggingRow && !isHoveredRow
|
@@ -2403,11 +2434,9 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
2403
2434
|
: undefined,
|
2404
2435
|
numRows,
|
2405
2436
|
rowRef,
|
2437
|
+
staticColumnIndex,
|
2406
2438
|
staticRowIndex,
|
2407
2439
|
table,
|
2408
|
-
virtualColumnIndex: columnVirtualizer
|
2409
|
-
? cellOrVirtualCell.index
|
2410
|
-
: undefined,
|
2411
2440
|
};
|
2412
2441
|
return cell ? (memoMode === 'cells' &&
|
2413
2442
|
cell.column.columnDef.columnDefType === 'data' &&
|
@@ -2466,6 +2495,7 @@ const MRT_TableBody = (_a) => {
|
|
2466
2495
|
}, children: globalFilter || columnFilters.length
|
2467
2496
|
? localization.noResultsFound
|
2468
2497
|
: localization.noRecordsToDisplay })) }) })) : (jsx(Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, staticRowIndex) => {
|
2498
|
+
let row = rowOrVirtualRow;
|
2469
2499
|
if (rowVirtualizer) {
|
2470
2500
|
if (renderDetailPanel) {
|
2471
2501
|
if (rowOrVirtualRow.index % 2 === 1) {
|
@@ -2478,10 +2508,8 @@ const MRT_TableBody = (_a) => {
|
|
2478
2508
|
else {
|
2479
2509
|
staticRowIndex = rowOrVirtualRow.index;
|
2480
2510
|
}
|
2511
|
+
row = rows[staticRowIndex];
|
2481
2512
|
}
|
2482
|
-
const row = rowVirtualizer
|
2483
|
-
? rows[staticRowIndex]
|
2484
|
-
: rowOrVirtualRow;
|
2485
2513
|
const props = Object.assign(Object.assign({}, commonRowProps), { pinnedRowIds,
|
2486
2514
|
row,
|
2487
2515
|
rowVirtualizer,
|
@@ -2501,20 +2529,23 @@ const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.option
|
|
2501
2529
|
|
2502
2530
|
const MRT_TableFooterCell = (_a) => {
|
2503
2531
|
var _b, _c, _d;
|
2504
|
-
var { footer, table } = _a, rest = __rest(_a, ["footer", "table"]);
|
2532
|
+
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
2505
2533
|
const theme = useTheme();
|
2506
|
-
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
2534
|
+
const { getState, options: { enableColumnPinning, layoutMode, muiTableFooterCellProps }, } = table;
|
2507
2535
|
const { density } = getState();
|
2508
2536
|
const { column } = footer;
|
2509
2537
|
const { columnDef } = column;
|
2510
2538
|
const { columnDefType } = columnDef;
|
2539
|
+
const isColumnPinned = enableColumnPinning &&
|
2540
|
+
columnDef.columnDefType !== 'group' &&
|
2541
|
+
column.getIsPinned();
|
2511
2542
|
const args = { column, table };
|
2512
2543
|
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
2513
2544
|
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group'
|
2514
2545
|
? 'center'
|
2515
2546
|
: theme.direction === 'rtl'
|
2516
2547
|
? 'right'
|
2517
|
-
: 'left', colSpan: footer.colSpan, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
2548
|
+
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
2518
2549
|
? '0.5rem'
|
2519
2550
|
: density === 'comfortable'
|
2520
2551
|
? '1rem'
|
@@ -2546,11 +2577,14 @@ const MRT_TableFooterRow = (_a) => {
|
|
2546
2577
|
footerGroup,
|
2547
2578
|
table,
|
2548
2579
|
})), rest);
|
2549
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2580
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
|
2581
|
+
let footer = footerOrVirtualFooter;
|
2582
|
+
if (columnVirtualizer) {
|
2583
|
+
staticColumnIndex = footerOrVirtualFooter
|
2584
|
+
.index;
|
2585
|
+
footer = footerGroup.headers[staticColumnIndex];
|
2586
|
+
}
|
2587
|
+
return footer ? (jsx(MRT_TableFooterCell, { footer: footer, staticColumnIndex: staticColumnIndex, table: table }, footer.id)) : null;
|
2554
2588
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2555
2589
|
};
|
2556
2590
|
|
@@ -3049,6 +3083,7 @@ const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
3049
3083
|
const { getState, options: { columnResizeDirection, columnResizeMode }, setColumnSizingInfo, } = table;
|
3050
3084
|
const { density } = getState();
|
3051
3085
|
const { column } = header;
|
3086
|
+
const handler = header.getResizeHandler();
|
3052
3087
|
const mx = density === 'compact'
|
3053
3088
|
? '-8px'
|
3054
3089
|
: density === 'comfortable'
|
@@ -3058,7 +3093,7 @@ const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
3058
3093
|
return (jsx(Box, { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
|
3059
3094
|
setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
|
3060
3095
|
column.resetSize();
|
3061
|
-
}, onMouseDown:
|
3096
|
+
}, onMouseDown: handler, onTouchStart: handler, style: {
|
3062
3097
|
transform: column.getIsResizing() && columnResizeMode === 'onEnd'
|
3063
3098
|
? `translateX(${(columnResizeDirection === 'rtl' ? -1 : 1) *
|
3064
3099
|
((_b = getState().columnSizingInfo.deltaOffset) !== null && _b !== void 0 ? _b : 0)}px)`
|
@@ -3116,9 +3151,9 @@ const MRT_TableHeadCellSortLabel = (_a) => {
|
|
3116
3151
|
|
3117
3152
|
const MRT_TableHeadCell = (_a) => {
|
3118
3153
|
var _b, _c, _d, _f, _g, _h;
|
3119
|
-
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
3154
|
+
var { header, staticColumnIndex, table } = _a, rest = __rest(_a, ["header", "staticColumnIndex", "table"]);
|
3120
3155
|
const theme = useTheme();
|
3121
|
-
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3156
|
+
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3122
3157
|
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
3123
3158
|
const { column } = header;
|
3124
3159
|
const { columnDef } = column;
|
@@ -3128,6 +3163,9 @@ const MRT_TableHeadCell = (_a) => {
|
|
3128
3163
|
table,
|
3129
3164
|
})), rest);
|
3130
3165
|
const { draggingBorderColor } = getMRTTheme(table, theme);
|
3166
|
+
const isColumnPinned = enableColumnPinning &&
|
3167
|
+
columnDef.columnDefType !== 'group' &&
|
3168
|
+
column.getIsPinned();
|
3131
3169
|
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
3132
3170
|
columnDef.enableColumnActions !== false;
|
3133
3171
|
const showDragHandle = enableColumnDragging !== false &&
|
@@ -3189,7 +3227,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3189
3227
|
? 'center'
|
3190
3228
|
: theme.direction === 'rtl'
|
3191
3229
|
? 'right'
|
3192
|
-
: 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
3230
|
+
: 'left', colSpan: header.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, onDragEnter: handleDragEnter, ref: (node) => {
|
3193
3231
|
if (node) {
|
3194
3232
|
tableHeadCellRefs.current[column.id] = node;
|
3195
3233
|
}
|
@@ -3273,11 +3311,14 @@ const MRT_TableHeadRow = (_a) => {
|
|
3273
3311
|
headerGroup,
|
3274
3312
|
table,
|
3275
3313
|
})), rest);
|
3276
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3314
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader, staticColumnIndex) => {
|
3315
|
+
let header = headerOrVirtualHeader;
|
3316
|
+
if (columnVirtualizer) {
|
3317
|
+
staticColumnIndex = headerOrVirtualHeader
|
3318
|
+
.index;
|
3319
|
+
header = headerGroup.headers[staticColumnIndex];
|
3320
|
+
}
|
3321
|
+
return header ? (jsx(MRT_TableHeadCell, { header: header, staticColumnIndex: staticColumnIndex, table: table }, header.id)) : null;
|
3281
3322
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
3282
3323
|
};
|
3283
3324
|
|
@@ -3321,7 +3362,7 @@ const MRT_ToolbarAlertBanner = (_a) => {
|
|
3321
3362
|
: '0.25rem 0.5rem',
|
3322
3363
|
}, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectedAlert || groupedAlert) && (jsx("br", {})), jsxs(Box, { sx: { display: 'flex' }, children: [enableRowSelection &&
|
3323
3364
|
enableSelectAll &&
|
3324
|
-
positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, {
|
3365
|
+
positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsx("br", {}), groupedAlert] })] })) })) }));
|
3325
3366
|
};
|
3326
3367
|
|
3327
3368
|
const MRT_TableHead = (_a) => {
|
@@ -3347,9 +3388,10 @@ const MRT_TableHead = (_a) => {
|
|
3347
3388
|
|
3348
3389
|
const MRT_Table = (_a) => {
|
3349
3390
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
3350
|
-
const { getFlatHeaders, getState, options: { columns, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, } = table;
|
3391
|
+
const { getFlatHeaders, getState, options: { columns, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, renderCaption, }, } = table;
|
3351
3392
|
const { columnSizing, columnSizingInfo, columnVisibility, isFullScreen } = getState();
|
3352
3393
|
const tableProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableProps, { table })), rest);
|
3394
|
+
const Caption = parseFromValuesOrFunc(renderCaption, { table });
|
3353
3395
|
const columnSizeVars = useMemo(() => {
|
3354
3396
|
const headers = getFlatHeaders();
|
3355
3397
|
const colSizes = {};
|
@@ -3366,7 +3408,7 @@ const MRT_Table = (_a) => {
|
|
3366
3408
|
columnVirtualizer,
|
3367
3409
|
table,
|
3368
3410
|
};
|
3369
|
-
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3411
|
+
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [!!Caption && jsx("caption", { children: Caption }), enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3370
3412
|
};
|
3371
3413
|
|
3372
3414
|
const MRT_TableLoadingOverlay = (_a) => {
|
@@ -3922,5 +3964,5 @@ const MaterialReactTable = (props) => {
|
|
3922
3964
|
return jsx(MRT_TablePaper, { table: table });
|
3923
3965
|
};
|
3924
3966
|
|
3925
|
-
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
3967
|
+
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getIsRowSelected, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
3926
3968
|
//# sourceMappingURL=index.esm.js.map
|