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.js
CHANGED
@@ -301,7 +301,7 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
|
|
301
301
|
[getColumnId(col)]: '',
|
302
302
|
}))), rowIndex, depth, subRows, parentId);
|
303
303
|
|
304
|
-
function defaultDisplayColumnProps({ header, id, size
|
304
|
+
function defaultDisplayColumnProps({ header, id, size, tableOptions, }) {
|
305
305
|
const { defaultDisplayColumn, displayColumnDefOptions, localization } = tableOptions;
|
306
306
|
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 });
|
307
307
|
}
|
@@ -359,6 +359,31 @@ const getDefaultColumnOrderIds = (tableOptions) => {
|
|
359
359
|
return [...leadingDisplayCols, ...allLeafColumnDefs, ...trailingDisplayCols];
|
360
360
|
};
|
361
361
|
|
362
|
+
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
363
|
+
const getValueAndLabel = (option) => {
|
364
|
+
var _a, _b, _c;
|
365
|
+
let label = '';
|
366
|
+
let value = '';
|
367
|
+
if (option) {
|
368
|
+
if (typeof option !== 'object') {
|
369
|
+
label = option;
|
370
|
+
value = option;
|
371
|
+
}
|
372
|
+
else {
|
373
|
+
label = (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : option.value;
|
374
|
+
value = (_c = option.value) !== null && _c !== void 0 ? _c : label;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
return { label, value };
|
378
|
+
};
|
379
|
+
|
380
|
+
const getIsRowSelected = ({ row, table, }) => {
|
381
|
+
const { options: { enableRowSelection }, } = table;
|
382
|
+
return (row.getIsSelected() ||
|
383
|
+
(parseFromValuesOrFunc(enableRowSelection, row) &&
|
384
|
+
row.getCanSelectSubRows() &&
|
385
|
+
row.getIsAllSubRowsSelected()));
|
386
|
+
};
|
362
387
|
const getCanRankRows = (table) => {
|
363
388
|
const { getState, options } = table;
|
364
389
|
const { enableGlobalFilterRankedResults, manualExpanding, manualFiltering, manualGrouping, manualSorting, } = options;
|
@@ -505,24 +530,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
505
530
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
506
531
|
};
|
507
532
|
|
508
|
-
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
509
|
-
const getValueAndLabel = (option) => {
|
510
|
-
var _a, _b, _c;
|
511
|
-
let label = '';
|
512
|
-
let value = '';
|
513
|
-
if (option) {
|
514
|
-
if (typeof option !== 'object') {
|
515
|
-
label = option;
|
516
|
-
value = option;
|
517
|
-
}
|
518
|
-
else {
|
519
|
-
label = (_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.text) !== null && _b !== void 0 ? _b : option.value;
|
520
|
-
value = (_c = option.value) !== null && _c !== void 0 ? _c : label;
|
521
|
-
}
|
522
|
-
}
|
523
|
-
return { label, value };
|
524
|
-
};
|
525
|
-
|
526
533
|
const MRT_EditActionButtons = (_a) => {
|
527
534
|
var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
|
528
535
|
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
@@ -582,40 +589,58 @@ const getMRTTheme = (table, theme) => {
|
|
582
589
|
? styles.darken(theme.palette.warning.dark, 0.25)
|
583
590
|
: styles.lighten(theme.palette.warning.light, 0.5), menuBackgroundColor: styles.lighten(baseBackgroundColor, 0.07), pinnedRowBackgroundColor: styles.alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: styles.alpha(theme.palette.primary.main, 0.2) }, themeOverrides);
|
584
591
|
};
|
592
|
+
const pinnedBeforeAfterStyles = {
|
593
|
+
content: '""',
|
594
|
+
height: '100%',
|
595
|
+
left: 0,
|
596
|
+
position: 'absolute',
|
597
|
+
top: 0,
|
598
|
+
width: '100%',
|
599
|
+
zIndex: -1,
|
600
|
+
};
|
601
|
+
const getCommonPinnedCellStyles = ({ column, table, theme, }) => {
|
602
|
+
const { baseBackgroundColor } = getMRTTheme(table, theme);
|
603
|
+
return {
|
604
|
+
'&[data-pinned="true"]': {
|
605
|
+
'&:before': Object.assign({ backgroundColor: styles.alpha(styles.darken(baseBackgroundColor, theme.palette.mode === 'dark' ? 0.05 : 0.01), 0.97), boxShadow: column
|
606
|
+
? getIsLastLeftPinnedColumn(table, column)
|
607
|
+
? `-4px 0 4px -4px ${styles.alpha(theme.palette.grey[700], 0.5)} inset`
|
608
|
+
: getIsFirstRightPinnedColumn(column)
|
609
|
+
? `4px 0 4px -4px ${styles.alpha(theme.palette.grey[700], 0.5)} inset`
|
610
|
+
: undefined
|
611
|
+
: undefined }, pinnedBeforeAfterStyles),
|
612
|
+
},
|
613
|
+
};
|
614
|
+
};
|
585
615
|
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
586
|
-
var _a, _b, _c, _d, _e, _f
|
587
|
-
const { options: { layoutMode }, } = table;
|
616
|
+
var _a, _b, _c, _d, _e, _f;
|
617
|
+
const { options: { enableColumnVirtualization, layoutMode }, } = table;
|
588
618
|
const { columnDef } = column;
|
619
|
+
const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
|
589
620
|
const widthStyles = {
|
590
621
|
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)`,
|
591
|
-
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
|
622
|
+
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)`,
|
592
623
|
};
|
593
624
|
if (layoutMode === 'grid') {
|
594
625
|
widthStyles.flex = `${[0, false].includes(columnDef.grow)
|
595
626
|
? 0
|
596
|
-
: `var(--${header ? 'header' : 'col'}-${parseCSSVarId((
|
627
|
+
: `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`;
|
597
628
|
}
|
598
629
|
else if (layoutMode === 'grid-no-grow') {
|
599
630
|
widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
|
600
631
|
}
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
?
|
609
|
-
: undefined, opacity: ((_g = table.getState().draggingColumn) === null || _g === void 0 ? void 0 : _g.id) === column.id ||
|
610
|
-
((_h = table.getState().hoveredColumn) === null || _h === void 0 ? void 0 : _h.id) === column.id
|
632
|
+
const pinnedStyles = isColumnPinned
|
633
|
+
? Object.assign(Object.assign({}, getCommonPinnedCellStyles({ column, table, theme })), { left: isColumnPinned === 'left'
|
634
|
+
? `${column.getStart('left')}px`
|
635
|
+
: undefined, opacity: 0.97, position: 'sticky', right: isColumnPinned === 'right'
|
636
|
+
? `${getTotalRight(table, column)}px`
|
637
|
+
: undefined, zIndex: 1 }) : {};
|
638
|
+
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 ||
|
639
|
+
((_f = table.getState().hoveredColumn) === null || _f === void 0 ? void 0 : _f.id) === column.id
|
611
640
|
? 0.5
|
612
|
-
: 1, position:
|
613
|
-
? 'sticky'
|
614
|
-
: undefined, right: column.getIsPinned() === 'right'
|
615
|
-
? `${getTotalRight(table, column)}px`
|
616
|
-
: undefined, transition: table.options.enableColumnVirtualization
|
641
|
+
: 1, position: 'relative', transition: enableColumnVirtualization
|
617
642
|
? 'none'
|
618
|
-
: `padding 150ms ease-in-out
|
643
|
+
: `padding 150ms ease-in-out`, zIndex: 0 }, pinnedStyles), widthStyles), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme));
|
619
644
|
};
|
620
645
|
const getCommonToolbarStyles = ({ table, theme, }) => ({
|
621
646
|
alignItems: 'flex-start',
|
@@ -1050,6 +1075,7 @@ const getMRT_RowActionsColumnDef = (tableOptions) => {
|
|
1050
1075
|
return Object.assign({ Cell: ({ cell, row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, staticRowIndex: staticRowIndex, table: table })) }, defaultDisplayColumnProps({
|
1051
1076
|
header: 'actions',
|
1052
1077
|
id: 'mrt-row-actions',
|
1078
|
+
size: 70,
|
1053
1079
|
tableOptions,
|
1054
1080
|
}));
|
1055
1081
|
};
|
@@ -1105,6 +1131,7 @@ const getMRT_RowDragColumnDef = (tableOptions) => {
|
|
1105
1131
|
return Object.assign({ Cell: ({ row, rowRef, table }) => (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), grow: false }, defaultDisplayColumnProps({
|
1106
1132
|
header: 'move',
|
1107
1133
|
id: 'mrt-row-drag',
|
1134
|
+
size: 60,
|
1108
1135
|
tableOptions,
|
1109
1136
|
}));
|
1110
1137
|
};
|
@@ -1159,6 +1186,7 @@ const MRT_ExpandButton = ({ row, staticRowIndex, table, }) => {
|
|
1159
1186
|
};
|
1160
1187
|
|
1161
1188
|
const getMRT_RowExpandColumnDef = (tableOptions) => {
|
1189
|
+
var _a;
|
1162
1190
|
if (!showRowExpandColumn(tableOptions)) {
|
1163
1191
|
return null;
|
1164
1192
|
}
|
@@ -1188,9 +1216,11 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
|
|
1188
1216
|
header: 'expand',
|
1189
1217
|
id: 'mrt-row-expand',
|
1190
1218
|
size: groupedColumnMode === 'remove'
|
1191
|
-
? defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size
|
1219
|
+
? (_a = defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.size) !== null && _a !== void 0 ? _a : 180
|
1192
1220
|
: renderDetailPanel
|
1193
|
-
?
|
1221
|
+
? enableExpandAll
|
1222
|
+
? 60
|
1223
|
+
: 70
|
1194
1224
|
: 100,
|
1195
1225
|
tableOptions,
|
1196
1226
|
}));
|
@@ -1210,6 +1240,7 @@ const getMRT_RowNumbersColumnDef = (tableOptions) => {
|
|
1210
1240
|
}, Header: () => localization.rowNumber, grow: false }, defaultDisplayColumnProps({
|
1211
1241
|
header: 'rowNumbers',
|
1212
1242
|
id: 'mrt-row-numbers',
|
1243
|
+
size: 50,
|
1213
1244
|
tableOptions,
|
1214
1245
|
}));
|
1215
1246
|
};
|
@@ -1258,15 +1289,17 @@ const getMRT_RowPinningColumnDef = (tableOptions) => {
|
|
1258
1289
|
return Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), grow: false }, defaultDisplayColumnProps({
|
1259
1290
|
header: 'pin',
|
1260
1291
|
id: 'mrt-row-pin',
|
1292
|
+
size: 60,
|
1261
1293
|
tableOptions,
|
1262
1294
|
}));
|
1263
1295
|
};
|
1264
1296
|
|
1265
1297
|
const MRT_SelectCheckbox = (_a) => {
|
1266
1298
|
var _b;
|
1267
|
-
var { row,
|
1299
|
+
var { row, staticRowIndex, table } = _a, rest = __rest(_a, ["row", "staticRowIndex", "table"]);
|
1268
1300
|
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
1269
1301
|
const { density, isLoading } = getState();
|
1302
|
+
const selectAll = !row;
|
1270
1303
|
const checkboxProps = Object.assign(Object.assign({}, (!row
|
1271
1304
|
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
1272
1305
|
: parseFromValuesOrFunc(muiSelectCheckboxProps, {
|
@@ -1304,10 +1337,7 @@ const MRT_SelectCheckbox = (_a) => {
|
|
1304
1337
|
};
|
1305
1338
|
const commonProps = Object.assign(Object.assign({ 'aria-label': selectAll
|
1306
1339
|
? localization.toggleSelectAll
|
1307
|
-
: localization.toggleSelectRow, checked: selectAll
|
1308
|
-
? allRowsSelected
|
1309
|
-
: (row === null || row === void 0 ? void 0 : row.getIsSelected()) ||
|
1310
|
-
((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: {
|
1340
|
+
: 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: {
|
1311
1341
|
'aria-label': selectAll
|
1312
1342
|
? localization.toggleSelectAll
|
1313
1343
|
: localization.toggleSelectRow,
|
@@ -1332,10 +1362,11 @@ const getMRT_RowSelectColumnDef = (tableOptions) => {
|
|
1332
1362
|
}
|
1333
1363
|
const { enableMultiRowSelection, enableSelectAll } = tableOptions;
|
1334
1364
|
return Object.assign({ Cell: ({ row, staticRowIndex, table }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, staticRowIndex: staticRowIndex, table: table })), Header: enableSelectAll && enableMultiRowSelection
|
1335
|
-
? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, {
|
1365
|
+
? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { table: table })
|
1336
1366
|
: undefined, grow: false }, defaultDisplayColumnProps({
|
1337
1367
|
header: 'select',
|
1338
1368
|
id: 'mrt-row-select',
|
1369
|
+
size: enableSelectAll ? 60 : 70,
|
1339
1370
|
tableOptions,
|
1340
1371
|
}));
|
1341
1372
|
};
|
@@ -1490,25 +1521,27 @@ const MRT_DefaultDisplayColumn = {
|
|
1490
1521
|
};
|
1491
1522
|
const useMRT_TableOptions = (_a) => {
|
1492
1523
|
var _b;
|
1493
|
-
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"]);
|
1524
|
+
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"]);
|
1494
1525
|
const theme = styles.useTheme();
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1526
|
+
icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
1527
|
+
localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
1528
|
+
aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
1529
|
+
filterFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_FilterFns), filterFns)), []);
|
1530
|
+
sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
1531
|
+
defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
1532
|
+
defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
1533
|
+
//cannot be changed after initialization
|
1534
|
+
[enableColumnVirtualization, enableRowVirtualization] = react.useMemo(() => [enableColumnVirtualization, enableRowVirtualization], []);
|
1502
1535
|
if (!columnResizeDirection) {
|
1503
1536
|
columnResizeDirection = theme.direction || 'ltr';
|
1504
1537
|
}
|
1505
1538
|
layoutMode =
|
1506
1539
|
layoutMode || (enableColumnResizing ? 'grid-no-grow' : 'semantic');
|
1507
1540
|
if (layoutMode === 'semantic' &&
|
1508
|
-
(
|
1541
|
+
(enableRowVirtualization || enableColumnVirtualization)) {
|
1509
1542
|
layoutMode = 'grid';
|
1510
1543
|
}
|
1511
|
-
if (
|
1544
|
+
if (enableRowVirtualization) {
|
1512
1545
|
enableStickyHeader = true;
|
1513
1546
|
}
|
1514
1547
|
if (enablePagination === false && manualPagination === undefined) {
|
@@ -1520,20 +1553,26 @@ const useMRT_TableOptions = (_a) => {
|
|
1520
1553
|
manualPagination = true;
|
1521
1554
|
manualSorting = true;
|
1522
1555
|
}
|
1523
|
-
return Object.assign({ aggregationFns
|
1556
|
+
return Object.assign({ aggregationFns,
|
1557
|
+
autoResetExpanded,
|
1524
1558
|
columnFilterDisplayMode,
|
1525
1559
|
columnResizeDirection,
|
1526
1560
|
columnResizeMode,
|
1527
|
-
createDisplayMode,
|
1561
|
+
createDisplayMode,
|
1562
|
+
defaultColumn,
|
1563
|
+
defaultDisplayColumn,
|
1564
|
+
editDisplayMode,
|
1528
1565
|
enableBottomToolbar,
|
1529
1566
|
enableColumnActions,
|
1530
1567
|
enableColumnFilters,
|
1531
1568
|
enableColumnOrdering,
|
1532
1569
|
enableColumnPinning,
|
1533
1570
|
enableColumnResizing,
|
1571
|
+
enableColumnVirtualization,
|
1534
1572
|
enableDensityToggle,
|
1535
1573
|
enableExpandAll,
|
1536
1574
|
enableExpanding,
|
1575
|
+
enableFacetedValues,
|
1537
1576
|
enableFilterMatchHighlighting,
|
1538
1577
|
enableFilters,
|
1539
1578
|
enableFullScreenToggle,
|
@@ -1546,13 +1585,26 @@ const useMRT_TableOptions = (_a) => {
|
|
1546
1585
|
enablePagination,
|
1547
1586
|
enableRowPinning,
|
1548
1587
|
enableRowSelection,
|
1588
|
+
enableRowVirtualization,
|
1549
1589
|
enableSelectAll,
|
1550
1590
|
enableSorting,
|
1551
1591
|
enableStickyHeader,
|
1552
1592
|
enableTableFooter,
|
1553
1593
|
enableTableHead,
|
1554
1594
|
enableToolbarInternalActions,
|
1555
|
-
enableTopToolbar,
|
1595
|
+
enableTopToolbar,
|
1596
|
+
filterFns, getCoreRowModel: reactTable.getCoreRowModel(), getExpandedRowModel: enableExpanding || enableGrouping ? reactTable.getExpandedRowModel() : undefined, getFacetedMinMaxValues: enableFacetedValues
|
1597
|
+
? reactTable.getFacetedMinMaxValues()
|
1598
|
+
: undefined, getFacetedRowModel: enableFacetedValues ? reactTable.getFacetedRowModel() : undefined, getFacetedUniqueValues: enableFacetedValues
|
1599
|
+
? reactTable.getFacetedUniqueValues()
|
1600
|
+
: undefined, getFilteredRowModel: enableColumnFilters || enableGlobalFilter || enableFilters
|
1601
|
+
? reactTable.getFilteredRowModel()
|
1602
|
+
: undefined, getGroupedRowModel: enableGrouping ? reactTable.getGroupedRowModel() : undefined, getPaginationRowModel: enablePagination
|
1603
|
+
? reactTable.getPaginationRowModel()
|
1604
|
+
: undefined, getSortedRowModel: enableSorting ? reactTable.getSortedRowModel() : undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, icons,
|
1605
|
+
layoutMode,
|
1606
|
+
localization,
|
1607
|
+
manualFiltering,
|
1556
1608
|
manualGrouping,
|
1557
1609
|
manualPagination,
|
1558
1610
|
manualSorting,
|
@@ -1566,7 +1618,8 @@ const useMRT_TableOptions = (_a) => {
|
|
1566
1618
|
positionToolbarDropZone,
|
1567
1619
|
rowNumberDisplayMode,
|
1568
1620
|
rowPinningDisplayMode,
|
1569
|
-
selectAllMode,
|
1621
|
+
selectAllMode,
|
1622
|
+
sortingFns }, rest);
|
1570
1623
|
};
|
1571
1624
|
|
1572
1625
|
const blankColProps = {
|
@@ -1763,25 +1816,7 @@ const useMRT_TableInstance = (_tableOptions) => {
|
|
1763
1816
|
tableOptions.state.showSkeletons,
|
1764
1817
|
]);
|
1765
1818
|
//@ts-ignore
|
1766
|
-
const table = reactTable.useReactTable(Object.assign(Object.assign({
|
1767
|
-
? reactTable.getExpandedRowModel()
|
1768
|
-
: undefined, getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
1769
|
-
? reactTable.getFacetedMinMaxValues()
|
1770
|
-
: undefined, getFacetedRowModel: tableOptions.enableFacetedValues
|
1771
|
-
? reactTable.getFacetedRowModel()
|
1772
|
-
: undefined, getFacetedUniqueValues: tableOptions.enableFacetedValues
|
1773
|
-
? reactTable.getFacetedUniqueValues()
|
1774
|
-
: undefined, getFilteredRowModel: tableOptions.enableColumnFilters ||
|
1775
|
-
tableOptions.enableGlobalFilter ||
|
1776
|
-
tableOptions.enableFilters
|
1777
|
-
? reactTable.getFilteredRowModel()
|
1778
|
-
: undefined, getGroupedRowModel: tableOptions.enableGrouping
|
1779
|
-
? reactTable.getGroupedRowModel()
|
1780
|
-
: undefined, getPaginationRowModel: tableOptions.enablePagination
|
1781
|
-
? reactTable.getPaginationRowModel()
|
1782
|
-
: undefined, getSortedRowModel: tableOptions.enableSorting
|
1783
|
-
? reactTable.getSortedRowModel()
|
1784
|
-
: undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, onColumnOrderChange,
|
1819
|
+
const table = reactTable.useReactTable(Object.assign(Object.assign({ onColumnOrderChange,
|
1785
1820
|
onColumnSizingInfoChange,
|
1786
1821
|
onGroupingChange,
|
1787
1822
|
onPaginationChange }, tableOptions), { globalFilterFn: (_u = tableOptions.filterFns) === null || _u === void 0 ? void 0 : _u[globalFilterFn !== null && globalFilterFn !== void 0 ? globalFilterFn : 'fuzzy'] }));
|
@@ -1856,68 +1891,60 @@ const extraIndexRangeExtractor = (range, draggingIndex) => {
|
|
1856
1891
|
};
|
1857
1892
|
|
1858
1893
|
const useMRT_ColumnVirtualizer = (table) => {
|
1859
|
-
var _a, _b, _c, _d
|
1860
|
-
const { getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
1861
|
-
const { columnPinning,
|
1894
|
+
var _a, _b, _c, _d;
|
1895
|
+
const { getLeftLeafColumns, getRightLeafColumns, getState, getVisibleLeafColumns, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
1896
|
+
const { columnPinning, draggingColumn } = getState();
|
1897
|
+
if (!enableColumnVirtualization)
|
1898
|
+
return undefined;
|
1862
1899
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
|
1863
1900
|
table,
|
1864
1901
|
});
|
1865
|
-
const
|
1902
|
+
const visibleColumns = getVisibleLeafColumns();
|
1903
|
+
const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnPinning
|
1866
1904
|
? [
|
1867
|
-
|
1868
|
-
|
1869
|
-
.
|
1870
|
-
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1)
|
1905
|
+
getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
1906
|
+
getRightLeafColumns()
|
1907
|
+
.map((column) => visibleColumns.length - column.getPinnedIndex() - 1)
|
1871
1908
|
.sort((a, b) => a - b),
|
1872
1909
|
]
|
1873
|
-
: [[], []], [columnPinning,
|
1874
|
-
|
1875
|
-
const
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
((_f = (_e = virtualColumns[virtualColumns.length - rightPinnedIndexes.length - 1]) === null || _e === void 0 ? void 0 : _e.end) !== null && _f !== void 0 ? _f : 0) -
|
1912
|
-
(rightPinnedIndexes.length
|
1913
|
-
? columnVirtualizer.getTotalSize() -
|
1914
|
-
((_h = (_g = virtualColumns[virtualColumns.length - rightPinnedIndexes.length]) === null || _g === void 0 ? void 0 : _g.start) !== null && _h !== void 0 ? _h : 0)
|
1915
|
-
: 0);
|
1916
|
-
}
|
1917
|
-
if (columnVirtualizerInstanceRef) {
|
1918
|
-
//@ts-ignore
|
1919
|
-
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
1920
|
-
}
|
1910
|
+
: [[], []], [columnPinning, enableColumnPinning]);
|
1911
|
+
const numPinnedLeft = leftPinnedIndexes.length;
|
1912
|
+
const numPinnedRight = rightPinnedIndexes.length;
|
1913
|
+
const draggingColumnIndex = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
|
1914
|
+
? visibleColumns.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id))
|
1915
|
+
: undefined, [draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id]);
|
1916
|
+
const columnVirtualizer = reactVirtual.useVirtualizer(Object.assign({ count: visibleColumns.length, estimateSize: (index) => visibleColumns[index].getSize(), getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => {
|
1917
|
+
const newIndexes = extraIndexRangeExtractor(range, draggingColumnIndex);
|
1918
|
+
if (!numPinnedLeft && !numPinnedRight) {
|
1919
|
+
return newIndexes;
|
1920
|
+
}
|
1921
|
+
return [
|
1922
|
+
...new Set([
|
1923
|
+
...leftPinnedIndexes,
|
1924
|
+
...newIndexes,
|
1925
|
+
...rightPinnedIndexes,
|
1926
|
+
]),
|
1927
|
+
];
|
1928
|
+
}, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps));
|
1929
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
1930
|
+
columnVirtualizer.virtualColumns = virtualColumns;
|
1931
|
+
const numColumns = virtualColumns.length;
|
1932
|
+
if (numColumns) {
|
1933
|
+
const totalSize = columnVirtualizer.getTotalSize();
|
1934
|
+
const leftNonPinnedStart = ((_a = virtualColumns[numPinnedLeft]) === null || _a === void 0 ? void 0 : _a.start) || 0;
|
1935
|
+
const leftNonPinnedEnd = ((_b = virtualColumns[leftPinnedIndexes.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0;
|
1936
|
+
const rightNonPinnedStart = ((_c = virtualColumns[numColumns - numPinnedRight]) === null || _c === void 0 ? void 0 : _c.start) || 0;
|
1937
|
+
const rightNonPinnedEnd = ((_d = virtualColumns[numColumns - numPinnedRight - 1]) === null || _d === void 0 ? void 0 : _d.end) || 0;
|
1938
|
+
columnVirtualizer.virtualPaddingLeft =
|
1939
|
+
leftNonPinnedStart - leftNonPinnedEnd;
|
1940
|
+
columnVirtualizer.virtualPaddingRight =
|
1941
|
+
totalSize -
|
1942
|
+
rightNonPinnedEnd -
|
1943
|
+
(numPinnedRight ? totalSize - rightNonPinnedStart : 0);
|
1944
|
+
}
|
1945
|
+
if (columnVirtualizerInstanceRef) {
|
1946
|
+
//@ts-ignore
|
1947
|
+
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
1921
1948
|
}
|
1922
1949
|
return columnVirtualizer;
|
1923
1950
|
};
|
@@ -1926,31 +1953,28 @@ const useMRT_RowVirtualizer = (table, rows) => {
|
|
1926
1953
|
var _a;
|
1927
1954
|
const { getRowModel, getState, options: { enableRowVirtualization, renderDetailPanel, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
|
1928
1955
|
const { density, draggingRow, expanded } = getState();
|
1956
|
+
if (!enableRowVirtualization)
|
1957
|
+
return undefined;
|
1929
1958
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
1930
1959
|
table,
|
1931
1960
|
});
|
1932
1961
|
const rowCount = (_a = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _a !== void 0 ? _a : getRowModel().rows.length;
|
1933
1962
|
const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73;
|
1934
|
-
const rowVirtualizer =
|
1935
|
-
|
1936
|
-
?
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
rowVirtualizer.virtualRows = virtualRows;
|
1950
|
-
if (rowVirtualizerInstanceRef) {
|
1951
|
-
//@ts-ignore
|
1952
|
-
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1953
|
-
}
|
1963
|
+
const rowVirtualizer = reactVirtual.useVirtualizer(Object.assign({ count: renderDetailPanel ? rowCount * 2 : rowCount, estimateSize: (index) => renderDetailPanel && index % 2 === 1
|
1964
|
+
? expanded === true
|
1965
|
+
? 100
|
1966
|
+
: 0
|
1967
|
+
: normalRowHeight, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
1968
|
+
navigator.userAgent.indexOf('Firefox') === -1
|
1969
|
+
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
1970
|
+
: undefined, overscan: 4, rangeExtractor: react.useCallback((range) => {
|
1971
|
+
var _a;
|
1972
|
+
return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
|
1973
|
+
}, [draggingRow]) }, rowVirtualizerProps));
|
1974
|
+
rowVirtualizer.virtualRows = rowVirtualizer.getVirtualItems();
|
1975
|
+
if (rowVirtualizerInstanceRef) {
|
1976
|
+
//@ts-ignore
|
1977
|
+
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1954
1978
|
}
|
1955
1979
|
return rowVirtualizer;
|
1956
1980
|
};
|
@@ -2124,10 +2148,9 @@ const MRT_EditCellTextField = (_a) => {
|
|
2124
2148
|
const { column, row } = cell;
|
2125
2149
|
const { columnDef } = column;
|
2126
2150
|
const { creatingRow, editingRow } = getState();
|
2127
|
-
const { editSelectOptions } = columnDef;
|
2151
|
+
const { editSelectOptions, editVariant } = columnDef;
|
2128
2152
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
2129
2153
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
2130
|
-
const isSelectEdit = columnDef.editVariant === 'select';
|
2131
2154
|
const [value, setValue] = react.useState(() => cell.getValue());
|
2132
2155
|
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
2133
2156
|
cell,
|
@@ -2146,6 +2169,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
2146
2169
|
row,
|
2147
2170
|
table,
|
2148
2171
|
});
|
2172
|
+
const isSelectEdit = editVariant === 'select' || (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select);
|
2149
2173
|
const saveInputValueToRowCache = (newValue) => {
|
2150
2174
|
//@ts-ignore
|
2151
2175
|
row._valuesCache[column.id] = newValue;
|
@@ -2160,7 +2184,7 @@ const MRT_EditCellTextField = (_a) => {
|
|
2160
2184
|
var _a;
|
2161
2185
|
(_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
2162
2186
|
setValue(event.target.value);
|
2163
|
-
if (
|
2187
|
+
if (isSelectEdit) {
|
2164
2188
|
saveInputValueToRowCache(event.target.value);
|
2165
2189
|
}
|
2166
2190
|
};
|
@@ -2213,9 +2237,9 @@ const MRT_EditCellTextField = (_a) => {
|
|
2213
2237
|
|
2214
2238
|
const MRT_TableBodyCell = (_a) => {
|
2215
2239
|
var _b, _c, _d, _e, _f;
|
2216
|
-
var { cell, measureElement, numRows, rowRef, staticRowIndex, table
|
2240
|
+
var { cell, measureElement, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
|
2217
2241
|
const theme = styles.useTheme();
|
2218
|
-
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
2242
|
+
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
2219
2243
|
const { columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
2220
2244
|
const { column, row } = cell;
|
2221
2245
|
const { columnDef } = column;
|
@@ -2286,6 +2310,9 @@ const MRT_TableBodyCell = (_a) => {
|
|
2286
2310
|
hoveredRow,
|
2287
2311
|
staticRowIndex,
|
2288
2312
|
]);
|
2313
|
+
const isColumnPinned = enableColumnPinning &&
|
2314
|
+
columnDef.columnDefType !== 'group' &&
|
2315
|
+
column.getIsPinned();
|
2289
2316
|
const isEditable = !cell.getIsPlaceholder() &&
|
2290
2317
|
parseFromValuesOrFunc(enableEditing, row) &&
|
2291
2318
|
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
@@ -2325,7 +2352,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2325
2352
|
cell,
|
2326
2353
|
table,
|
2327
2354
|
};
|
2328
|
-
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index":
|
2355
|
+
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, ref: (node) => {
|
2329
2356
|
if (node) {
|
2330
2357
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2331
2358
|
}
|
@@ -2407,8 +2434,10 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
2407
2434
|
const theme = styles.useTheme();
|
2408
2435
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
2409
2436
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
2437
|
+
const visibleCells = row.getVisibleCells();
|
2410
2438
|
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
2411
|
-
const
|
2439
|
+
const isRowSelected = getIsRowSelected({ row, table });
|
2440
|
+
const isRowPinned = enableRowPinning && row.getIsPinned();
|
2412
2441
|
const isDraggingRow = (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id;
|
2413
2442
|
const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
|
2414
2443
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
@@ -2444,47 +2473,49 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
2444
2473
|
};
|
2445
2474
|
const rowRef = react.useRef(null);
|
2446
2475
|
const { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, } = getMRTTheme(table, theme);
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2476
|
+
const cellHighlightColor = isRowSelected
|
2477
|
+
? selectedRowBackgroundColor
|
2478
|
+
: isRowPinned
|
2479
|
+
? pinnedRowBackgroundColor
|
2480
|
+
: undefined;
|
2481
|
+
const cellHighlightColorHover = (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2482
|
+
? isRowSelected
|
2483
|
+
? cellHighlightColor
|
2484
|
+
: theme.palette.mode === 'dark'
|
2485
|
+
? `${styles.lighten(baseBackgroundColor, 0.3)}`
|
2486
|
+
: `${styles.darken(baseBackgroundColor, 0.3)}`
|
2487
|
+
: undefined;
|
2488
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": renderDetailPanel ? staticRowIndex * 2 : staticRowIndex, "data-pinned": !!isRowPinned || undefined, "data-selected": isRowSelected || undefined, onDragEnter: handleDragEnter, ref: (node) => {
|
2450
2489
|
if (node) {
|
2451
2490
|
rowRef.current = node;
|
2452
2491
|
rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement(node);
|
2453
2492
|
}
|
2454
|
-
}, selected:
|
2493
|
+
}, selected: isRowSelected }, tableRowProps, { style: Object.assign({ transform: virtualRow
|
2455
2494
|
? `translateY(${virtualRow.start}px)`
|
2456
2495
|
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), sx: (theme) => (Object.assign({ '&:hover td': {
|
2457
|
-
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2461
|
-
? `${styles.lighten(baseBackgroundColor, 0.05)}`
|
2462
|
-
: `${styles.darken(baseBackgroundColor, 0.05)}`
|
2463
|
-
: undefined,
|
2464
|
-
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
|
2496
|
+
'&:after': Object.assign({ backgroundColor: cellHighlightColorHover
|
2497
|
+
? styles.alpha(cellHighlightColorHover, 0.3)
|
2498
|
+
: undefined }, pinnedBeforeAfterStyles),
|
2499
|
+
}, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
2465
2500
|
? `${bottomPinnedIndex * rowHeight +
|
2466
2501
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
2467
|
-
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity:
|
2502
|
+
: 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
|
2468
2503
|
? 'absolute'
|
2469
|
-
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
2504
|
+
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
2470
2505
|
? 'sticky'
|
2471
|
-
: undefined, td: {
|
2472
|
-
backgroundColor: row.getIsSelected()
|
2473
|
-
? selectedRowBackgroundColor
|
2474
|
-
: isPinned
|
2475
|
-
? pinnedRowBackgroundColor
|
2476
|
-
: undefined,
|
2477
|
-
}, top: virtualRow
|
2506
|
+
: undefined, td: Object.assign({ '&:after': Object.assign({ backgroundColor: cellHighlightColor }, pinnedBeforeAfterStyles) }, getCommonPinnedCellStyles({ table, theme })), top: virtualRow
|
2478
2507
|
? 0
|
2479
|
-
: topPinnedIndex !== undefined &&
|
2508
|
+
: topPinnedIndex !== undefined && isRowPinned
|
2480
2509
|
? `${topPinnedIndex * rowHeight +
|
2481
2510
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
2482
|
-
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
2511
|
+
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
2483
2512
|
? 2
|
2484
|
-
: undefined }, sx)), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns :
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2513
|
+
: undefined }, sx)), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : visibleCells).map((cellOrVirtualCell, staticColumnIndex) => {
|
2514
|
+
let cell = cellOrVirtualCell;
|
2515
|
+
if (columnVirtualizer) {
|
2516
|
+
staticColumnIndex = cellOrVirtualCell.index;
|
2517
|
+
cell = visibleCells[staticColumnIndex];
|
2518
|
+
}
|
2488
2519
|
const props = {
|
2489
2520
|
cell,
|
2490
2521
|
measureElement: !isDraggingRow && !isHoveredRow
|
@@ -2492,11 +2523,9 @@ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVi
|
|
2492
2523
|
: undefined,
|
2493
2524
|
numRows,
|
2494
2525
|
rowRef,
|
2526
|
+
staticColumnIndex,
|
2495
2527
|
staticRowIndex,
|
2496
2528
|
table,
|
2497
|
-
virtualColumnIndex: columnVirtualizer
|
2498
|
-
? cellOrVirtualCell.index
|
2499
|
-
: undefined,
|
2500
2529
|
};
|
2501
2530
|
return cell ? (memoMode === 'cells' &&
|
2502
2531
|
cell.column.columnDef.columnDefType === 'data' &&
|
@@ -2555,6 +2584,7 @@ const MRT_TableBody = (_a) => {
|
|
2555
2584
|
}, children: globalFilter || columnFilters.length
|
2556
2585
|
? localization.noResultsFound
|
2557
2586
|
: localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, staticRowIndex) => {
|
2587
|
+
let row = rowOrVirtualRow;
|
2558
2588
|
if (rowVirtualizer) {
|
2559
2589
|
if (renderDetailPanel) {
|
2560
2590
|
if (rowOrVirtualRow.index % 2 === 1) {
|
@@ -2567,10 +2597,8 @@ const MRT_TableBody = (_a) => {
|
|
2567
2597
|
else {
|
2568
2598
|
staticRowIndex = rowOrVirtualRow.index;
|
2569
2599
|
}
|
2600
|
+
row = rows[staticRowIndex];
|
2570
2601
|
}
|
2571
|
-
const row = rowVirtualizer
|
2572
|
-
? rows[staticRowIndex]
|
2573
|
-
: rowOrVirtualRow;
|
2574
2602
|
const props = Object.assign(Object.assign({}, commonRowProps), { pinnedRowIds,
|
2575
2603
|
row,
|
2576
2604
|
rowVirtualizer,
|
@@ -2590,20 +2618,23 @@ const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.
|
|
2590
2618
|
|
2591
2619
|
const MRT_TableFooterCell = (_a) => {
|
2592
2620
|
var _b, _c, _d;
|
2593
|
-
var { footer, table } = _a, rest = __rest(_a, ["footer", "table"]);
|
2621
|
+
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
2594
2622
|
const theme = styles.useTheme();
|
2595
|
-
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
2623
|
+
const { getState, options: { enableColumnPinning, layoutMode, muiTableFooterCellProps }, } = table;
|
2596
2624
|
const { density } = getState();
|
2597
2625
|
const { column } = footer;
|
2598
2626
|
const { columnDef } = column;
|
2599
2627
|
const { columnDefType } = columnDef;
|
2628
|
+
const isColumnPinned = enableColumnPinning &&
|
2629
|
+
columnDef.columnDefType !== 'group' &&
|
2630
|
+
column.getIsPinned();
|
2600
2631
|
const args = { column, table };
|
2601
2632
|
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
2602
2633
|
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
|
2603
2634
|
? 'center'
|
2604
2635
|
: theme.direction === 'rtl'
|
2605
2636
|
? 'right'
|
2606
|
-
: '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'
|
2637
|
+
: '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'
|
2607
2638
|
? '0.5rem'
|
2608
2639
|
: density === 'comfortable'
|
2609
2640
|
? '1rem'
|
@@ -2635,11 +2666,14 @@ const MRT_TableFooterRow = (_a) => {
|
|
2635
2666
|
footerGroup,
|
2636
2667
|
table,
|
2637
2668
|
})), rest);
|
2638
|
-
return (jsxRuntime.jsxs(TableRow__default["default"], 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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2669
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], 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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter, staticColumnIndex) => {
|
2670
|
+
let footer = footerOrVirtualFooter;
|
2671
|
+
if (columnVirtualizer) {
|
2672
|
+
staticColumnIndex = footerOrVirtualFooter
|
2673
|
+
.index;
|
2674
|
+
footer = footerGroup.headers[staticColumnIndex];
|
2675
|
+
}
|
2676
|
+
return footer ? (jsxRuntime.jsx(MRT_TableFooterCell, { footer: footer, staticColumnIndex: staticColumnIndex, table: table }, footer.id)) : null;
|
2643
2677
|
}), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2644
2678
|
};
|
2645
2679
|
|
@@ -3138,6 +3172,7 @@ const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
3138
3172
|
const { getState, options: { columnResizeDirection, columnResizeMode }, setColumnSizingInfo, } = table;
|
3139
3173
|
const { density } = getState();
|
3140
3174
|
const { column } = header;
|
3175
|
+
const handler = header.getResizeHandler();
|
3141
3176
|
const mx = density === 'compact'
|
3142
3177
|
? '-8px'
|
3143
3178
|
: density === 'comfortable'
|
@@ -3147,7 +3182,7 @@ const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
3147
3182
|
return (jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-ResizeHandle-Wrapper", onDoubleClick: () => {
|
3148
3183
|
setColumnSizingInfo((old) => (Object.assign(Object.assign({}, old), { isResizingColumn: false })));
|
3149
3184
|
column.resetSize();
|
3150
|
-
}, onMouseDown:
|
3185
|
+
}, onMouseDown: handler, onTouchStart: handler, style: {
|
3151
3186
|
transform: column.getIsResizing() && columnResizeMode === 'onEnd'
|
3152
3187
|
? `translateX(${(columnResizeDirection === 'rtl' ? -1 : 1) *
|
3153
3188
|
((_b = getState().columnSizingInfo.deltaOffset) !== null && _b !== void 0 ? _b : 0)}px)`
|
@@ -3205,9 +3240,9 @@ const MRT_TableHeadCellSortLabel = (_a) => {
|
|
3205
3240
|
|
3206
3241
|
const MRT_TableHeadCell = (_a) => {
|
3207
3242
|
var _b, _c, _d, _f, _g, _h;
|
3208
|
-
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
3243
|
+
var { header, staticColumnIndex, table } = _a, rest = __rest(_a, ["header", "staticColumnIndex", "table"]);
|
3209
3244
|
const theme = styles.useTheme();
|
3210
|
-
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3245
|
+
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3211
3246
|
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
3212
3247
|
const { column } = header;
|
3213
3248
|
const { columnDef } = column;
|
@@ -3217,6 +3252,9 @@ const MRT_TableHeadCell = (_a) => {
|
|
3217
3252
|
table,
|
3218
3253
|
})), rest);
|
3219
3254
|
const { draggingBorderColor } = getMRTTheme(table, theme);
|
3255
|
+
const isColumnPinned = enableColumnPinning &&
|
3256
|
+
columnDef.columnDefType !== 'group' &&
|
3257
|
+
column.getIsPinned();
|
3220
3258
|
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
3221
3259
|
columnDef.enableColumnActions !== false;
|
3222
3260
|
const showDragHandle = enableColumnDragging !== false &&
|
@@ -3278,7 +3316,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3278
3316
|
? 'center'
|
3279
3317
|
: theme.direction === 'rtl'
|
3280
3318
|
? 'right'
|
3281
|
-
: 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
3319
|
+
: 'left', colSpan: header.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, onDragEnter: handleDragEnter, ref: (node) => {
|
3282
3320
|
if (node) {
|
3283
3321
|
tableHeadCellRefs.current[column.id] = node;
|
3284
3322
|
}
|
@@ -3362,11 +3400,14 @@ const MRT_TableHeadRow = (_a) => {
|
|
3362
3400
|
headerGroup,
|
3363
3401
|
table,
|
3364
3402
|
})), rest);
|
3365
|
-
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${styles.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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
3366
|
-
|
3367
|
-
|
3368
|
-
|
3369
|
-
|
3403
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${styles.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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader, staticColumnIndex) => {
|
3404
|
+
let header = headerOrVirtualHeader;
|
3405
|
+
if (columnVirtualizer) {
|
3406
|
+
staticColumnIndex = headerOrVirtualHeader
|
3407
|
+
.index;
|
3408
|
+
header = headerGroup.headers[staticColumnIndex];
|
3409
|
+
}
|
3410
|
+
return header ? (jsxRuntime.jsx(MRT_TableHeadCell, { header: header, staticColumnIndex: staticColumnIndex, table: table }, header.id)) : null;
|
3370
3411
|
}), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
3371
3412
|
};
|
3372
3413
|
|
@@ -3410,7 +3451,7 @@ const MRT_ToolbarAlertBanner = (_a) => {
|
|
3410
3451
|
: '0.25rem 0.5rem',
|
3411
3452
|
}, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectedAlert || groupedAlert) && (jsxRuntime.jsx("br", {})), jsxRuntime.jsxs(Box__default["default"], { sx: { display: 'flex' }, children: [enableRowSelection &&
|
3412
3453
|
enableSelectAll &&
|
3413
|
-
positionToolbarAlertBanner === 'head-overlay' && (jsxRuntime.jsx(MRT_SelectCheckbox, {
|
3454
|
+
positionToolbarAlertBanner === 'head-overlay' && (jsxRuntime.jsx(MRT_SelectCheckbox, { table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsxRuntime.jsx("br", {}), groupedAlert] })] })) })) }));
|
3414
3455
|
};
|
3415
3456
|
|
3416
3457
|
const MRT_TableHead = (_a) => {
|
@@ -3436,9 +3477,10 @@ const MRT_TableHead = (_a) => {
|
|
3436
3477
|
|
3437
3478
|
const MRT_Table = (_a) => {
|
3438
3479
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
3439
|
-
const { getFlatHeaders, getState, options: { columns, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, } = table;
|
3480
|
+
const { getFlatHeaders, getState, options: { columns, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, renderCaption, }, } = table;
|
3440
3481
|
const { columnSizing, columnSizingInfo, columnVisibility, isFullScreen } = getState();
|
3441
3482
|
const tableProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableProps, { table })), rest);
|
3483
|
+
const Caption = parseFromValuesOrFunc(renderCaption, { table });
|
3442
3484
|
const columnSizeVars = react.useMemo(() => {
|
3443
3485
|
const headers = getFlatHeaders();
|
3444
3486
|
const colSizes = {};
|
@@ -3455,7 +3497,7 @@ const MRT_Table = (_a) => {
|
|
3455
3497
|
columnVirtualizer,
|
3456
3498
|
table,
|
3457
3499
|
};
|
3458
|
-
return (jsxRuntime.jsxs(Table__default["default"], 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 && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3500
|
+
return (jsxRuntime.jsxs(Table__default["default"], 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 && jsxRuntime.jsx("caption", { children: Caption }), enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3459
3501
|
};
|
3460
3502
|
|
3461
3503
|
const MRT_TableLoadingOverlay = (_a) => {
|
@@ -4091,6 +4133,7 @@ exports.getIsFirstColumn = getIsFirstColumn;
|
|
4091
4133
|
exports.getIsFirstRightPinnedColumn = getIsFirstRightPinnedColumn;
|
4092
4134
|
exports.getIsLastColumn = getIsLastColumn;
|
4093
4135
|
exports.getIsLastLeftPinnedColumn = getIsLastLeftPinnedColumn;
|
4136
|
+
exports.getIsRowSelected = getIsRowSelected;
|
4094
4137
|
exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;
|
4095
4138
|
exports.getTotalRight = getTotalRight;
|
4096
4139
|
exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
|