@dooherceg/material-react-table 3.2.2-alpha.11 → 3.2.2-alpha.16
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 +6 -4
- package/dist/index.esm.js +85 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +85 -44
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -1564,7 +1564,7 @@ interface MRT_DimensionsDef {
|
|
|
1564
1564
|
};
|
|
1565
1565
|
fieldsPerRow?: number;
|
|
1566
1566
|
}
|
|
1567
|
-
type ExtraFieldFilterOption<TData extends
|
|
1567
|
+
type ExtraFieldFilterOption<TData extends RowData> = Pick<MRT_ColumnDef<TData & MRT_RowData>, 'type' | 'accessorKey' | 'header' | 'meta'>;
|
|
1568
1568
|
declare module '@tanstack/react-table' {
|
|
1569
1569
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
1570
1570
|
enumValues?: Array<{
|
|
@@ -1573,7 +1573,7 @@ declare module '@tanstack/react-table' {
|
|
|
1573
1573
|
}>;
|
|
1574
1574
|
availableIcons?: MRT_AvailableIconOption[];
|
|
1575
1575
|
dimensions?: MRT_DimensionsDef;
|
|
1576
|
-
extraFieldFilters?:
|
|
1576
|
+
extraFieldFilters?: ExtraFieldFilterOption<TData>[];
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
1579
|
|
|
@@ -1774,8 +1774,9 @@ interface MRT_TableBodyCellProps<TData extends MRT_RowData> extends TableCellPro
|
|
|
1774
1774
|
staticColumnIndex?: number;
|
|
1775
1775
|
staticRowIndex: number;
|
|
1776
1776
|
table: MRT_TableInstance<TData>;
|
|
1777
|
+
theme: Theme;
|
|
1777
1778
|
}
|
|
1778
|
-
declare const MRT_TableBodyCell: <TData extends MRT_RowData>({ cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table, ...rest }: MRT_TableBodyCellProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1779
|
+
declare const MRT_TableBodyCell: <TData extends MRT_RowData>({ cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table, theme, ...rest }: MRT_TableBodyCellProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1779
1780
|
declare const Memo_MRT_TableBodyCell: typeof MRT_TableBodyCell;
|
|
1780
1781
|
|
|
1781
1782
|
interface MRT_TableBodyCellValueProps<TData extends MRT_RowData> {
|
|
@@ -1795,9 +1796,10 @@ interface MRT_TableBodyRowProps<TData extends MRT_RowData> extends TableRowProps
|
|
|
1795
1796
|
rowVirtualizer?: MRT_RowVirtualizer;
|
|
1796
1797
|
staticRowIndex: number;
|
|
1797
1798
|
table: MRT_TableInstance<TData>;
|
|
1799
|
+
theme: Theme;
|
|
1798
1800
|
virtualRow?: VirtualItem;
|
|
1799
1801
|
}
|
|
1800
|
-
declare const MRT_TableBodyRow: <TData extends MRT_RowData>({ columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow, ...rest }: MRT_TableBodyRowProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1802
|
+
declare const MRT_TableBodyRow: <TData extends MRT_RowData>({ columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, theme, virtualRow, ...rest }: MRT_TableBodyRowProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1801
1803
|
declare const Memo_MRT_TableBodyRow: typeof MRT_TableBodyRow;
|
|
1802
1804
|
|
|
1803
1805
|
interface MRT_TableBodyRowGrabHandleProps<TData extends MRT_RowData> extends IconButtonProps {
|
package/dist/index.esm.js
CHANGED
|
@@ -1946,7 +1946,7 @@ const MRT_DefaultDisplayColumn = {
|
|
|
1946
1946
|
};
|
|
1947
1947
|
const useMRT_TableOptions = (_a) => {
|
|
1948
1948
|
var _b;
|
|
1949
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = true, enableColumnPinning = true, enableColumnResizing = true, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, maxDepth, enableExpanding, enableRowReordering, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = false, enableAdvancedFilters = true, enableGlobalFilter = false, enableGlobalFilterRankedResults = true, enableGrouping = true, enableHiding = true, enableKeyboardShortcuts = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = true, enableRowSelection = true, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = true, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, id = useId(), layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, mrtTheme, 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", "enableBatchRowSelection", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "maxDepth", "enableExpanding", "enableRowReordering", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableAdvancedFilters", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableKeyboardShortcuts", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "id", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "mrtTheme", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
|
1949
|
+
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = true, enableColumnPinning = true, enableColumnResizing = true, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, maxDepth, enableExpanding, enableRowReordering, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = false, enableAdvancedFilters = true, enableGlobalFilter = false, enableGlobalFilterRankedResults = true, enableGrouping = true, enableHiding = true, enableKeyboardShortcuts = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = true, enableRowSelection = true, enableRowVirtualization = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = true, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, id = useId(), layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, mrtTheme, 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", "enableBatchRowSelection", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "maxDepth", "enableExpanding", "enableRowReordering", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableAdvancedFilters", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableKeyboardShortcuts", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "id", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "mrtTheme", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
|
1950
1950
|
const theme = useTheme();
|
|
1951
1951
|
icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
|
1952
1952
|
localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
|
@@ -2340,38 +2340,66 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
|
2340
2340
|
//The table options now include all state needed to help determine column visibility and order logic
|
|
2341
2341
|
const statefulTableOptions = definedTableOptions;
|
|
2342
2342
|
const resolveRowId = (_1 = statefulTableOptions.getRowId) !== null && _1 !== void 0 ? _1 : ((_originalRow, index, _parentRow) => String(index));
|
|
2343
|
-
//
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2343
|
+
//keep the prepared column tree referentially stable so TanStack's
|
|
2344
|
+
//getAllColumns/getAllLeafColumns/row.getAllCells memo chain doesn't
|
|
2345
|
+
//recompute (and recreate every cell of every row) on unrelated renders
|
|
2346
|
+
//like hover, menu open/close, or density toggle
|
|
2347
|
+
const rawColumns = statefulTableOptions.columns;
|
|
2348
|
+
const { aggregationFns, createDisplayMode, defaultDisplayColumn, displayColumnDefOptions, editDisplayMode, enableEditing, enableExpanding, enableGrouping, enableRowActions, enableRowDragging, enableRowNumbers, enableRowOrdering, enableRowPinning, enableRowSelection, filterFns, layoutMode, localization, renderDetailPanel, rowNumberDisplayMode, rowPinningDisplayMode, sortingFns, } = statefulTableOptions;
|
|
2349
|
+
//read from the final merged state (consumers/MaterialReactServerTableInstance
|
|
2350
|
+
//may control these via the `state` option, which overrides the internal
|
|
2351
|
+
//useState values above)
|
|
2352
|
+
const { columnFilterFns: stateColumnFilterFns, creatingRow: stateCreatingRow, grouping: stateGrouping, } = statefulTableOptions.state;
|
|
2353
|
+
statefulTableOptions.columns = useMemo(() => prepareColumns({
|
|
2354
|
+
columnDefs: [
|
|
2355
|
+
...[
|
|
2356
|
+
showRowPinningColumn(statefulTableOptions) &&
|
|
2357
|
+
getMRT_RowPinningColumnDef(statefulTableOptions),
|
|
2358
|
+
showRowDragColumn(statefulTableOptions) &&
|
|
2359
|
+
getMRT_RowDragColumnDef(statefulTableOptions),
|
|
2360
|
+
showRowActionsColumn(statefulTableOptions) &&
|
|
2361
|
+
getMRT_RowActionsColumnDef(statefulTableOptions),
|
|
2362
|
+
showRowExpandColumn(statefulTableOptions) &&
|
|
2363
|
+
getMRT_RowExpandColumnDef(statefulTableOptions),
|
|
2364
|
+
showRowSelectionColumn(statefulTableOptions) &&
|
|
2365
|
+
getMRT_RowSelectColumnDef(statefulTableOptions),
|
|
2366
|
+
showRowNumbersColumn(statefulTableOptions) &&
|
|
2367
|
+
getMRT_RowNumbersColumnDef(statefulTableOptions),
|
|
2368
|
+
].filter(Boolean),
|
|
2369
|
+
...rawColumns,
|
|
2370
|
+
...[
|
|
2371
|
+
showRowSpacerColumn(statefulTableOptions) &&
|
|
2372
|
+
getMRT_RowSpacerColumnDef(statefulTableOptions),
|
|
2373
|
+
].filter(Boolean),
|
|
2374
|
+
],
|
|
2375
|
+
tableOptions: statefulTableOptions,
|
|
2376
|
+
}), [
|
|
2377
|
+
rawColumns,
|
|
2378
|
+
aggregationFns,
|
|
2379
|
+
createDisplayMode,
|
|
2380
|
+
defaultDisplayColumn,
|
|
2381
|
+
displayColumnDefOptions,
|
|
2382
|
+
editDisplayMode,
|
|
2383
|
+
enableEditing,
|
|
2384
|
+
enableExpanding,
|
|
2385
|
+
enableGrouping,
|
|
2386
|
+
enableRowActions,
|
|
2387
|
+
enableRowDragging,
|
|
2388
|
+
enableRowNumbers,
|
|
2389
|
+
enableRowOrdering,
|
|
2390
|
+
enableRowPinning,
|
|
2391
|
+
enableRowSelection,
|
|
2392
|
+
filterFns,
|
|
2393
|
+
layoutMode,
|
|
2394
|
+
localization,
|
|
2395
|
+
renderDetailPanel,
|
|
2396
|
+
rowNumberDisplayMode,
|
|
2397
|
+
rowPinningDisplayMode,
|
|
2398
|
+
sortingFns,
|
|
2399
|
+
stateColumnFilterFns,
|
|
2400
|
+
stateCreatingRow,
|
|
2401
|
+
stateGrouping,
|
|
2402
|
+
]);
|
|
2375
2403
|
//if loading, generate blank rows to show skeleton loaders
|
|
2376
2404
|
statefulTableOptions.data = useMemo(() => (statefulTableOptions.state.isLoading ||
|
|
2377
2405
|
statefulTableOptions.state.showSkeletons) &&
|
|
@@ -2589,7 +2617,10 @@ const useMRT_RowVirtualizer = (table, rows) => {
|
|
|
2589
2617
|
? realRows.findIndex((r) => r.id === (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id))
|
|
2590
2618
|
: undefined, [realRows, draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id]);
|
|
2591
2619
|
const rowCount = realRows.length;
|
|
2592
|
-
|
|
2620
|
+
//matches the defaultRowHeight assumption in MRT_TableBodyRow so the
|
|
2621
|
+
//initial estimate (before measureElement corrects it for dynamic content)
|
|
2622
|
+
//doesn't cause scroll-position drift
|
|
2623
|
+
const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
|
|
2593
2624
|
const rowVirtualizer = useVirtualizer(Object.assign({ count: renderDetailPanel ? rowCount * 2 : rowCount, estimateSize: (index) => renderDetailPanel && index % 2 === 1
|
|
2594
2625
|
? expanded === true
|
|
2595
2626
|
? 100
|
|
@@ -4370,7 +4401,7 @@ const MRT_AdvancedFiltersRuleRow = ({ filterableColumns, isFirst, isPinned, logi
|
|
|
4370
4401
|
xs: 'auto minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 1.5fr) auto auto',
|
|
4371
4402
|
},
|
|
4372
4403
|
width: '100%',
|
|
4373
|
-
}, children: [jsxs(TextField, { disabled: !isFirst, fullWidth: true, onChange: (event) => onUpdateLogicOperator(event.target.value), select: true, size: "small", value: logicOperator, variant: "outlined", children: [jsx(MenuItem, { value: "and", children: localization.and }), jsx(MenuItem, { value: "or", children: localization.or })] }), jsx(TextField, { fullWidth: true, label: localization.columns, onChange: (event) => handleColumnChange(event.target.value), select: true, size: "small", value: selectedColumn.id, variant: "outlined", children: filterableColumns.map((column) => (jsx(MenuItem, { value: column.id, children: column.columnDef.header || localization[column.id] || column.id }, column.id))) }), jsx(TextField, { fullWidth: true, label: localization.filterOperator, onChange: (event) => handleOperatorChange(event.target.value), select: true, size: "small", value: selectedOperator.id, variant: "outlined", children: availableOperators.map((operator) => (jsx(MenuItem, { value: operator.id, children: getLocalizedFilterOperatorLabel(localization, operator.id, operator.label) }, operator.id))) }), jsx(Box, { "data-testid": FILTER_RULE_VALUE_TEST_ID, onKeyDown: (event) => {
|
|
4404
|
+
}, children: [jsxs(TextField, { disabled: !isFirst, fullWidth: true, onChange: (event) => onUpdateLogicOperator(event.target.value), select: true, size: "small", value: logicOperator, variant: "outlined", "data-testid": "logic-operator", children: [jsx(MenuItem, { value: "and", children: localization.and }), jsx(MenuItem, { value: "or", children: localization.or })] }), jsx(TextField, { fullWidth: true, label: localization.columns, onChange: (event) => handleColumnChange(event.target.value), select: true, size: "small", value: selectedColumn.id, variant: "outlined", children: filterableColumns.map((column) => (jsx(MenuItem, { value: column.id, children: column.columnDef.header || localization[column.id] || column.id }, column.id))) }), jsx(TextField, { fullWidth: true, label: localization.filterOperator, onChange: (event) => handleOperatorChange(event.target.value), select: true, size: "small", value: selectedOperator.id, variant: "outlined", children: availableOperators.map((operator) => (jsx(MenuItem, { value: operator.id, children: getLocalizedFilterOperatorLabel(localization, operator.id, operator.label) }, operator.id))) }), jsx(Box, { "data-testid": FILTER_RULE_VALUE_TEST_ID, onKeyDown: (event) => {
|
|
4374
4405
|
const shouldApplyOnEnter = selectedOperator.valueShape !== 'multi';
|
|
4375
4406
|
if (event.key === 'Enter' && onApply && shouldApplyOnEnter) {
|
|
4376
4407
|
// Prevent the Enter from bubbling to MUI Drawer/Modal infrastructure
|
|
@@ -5373,7 +5404,7 @@ const MRT_SavedFiltersButton = ({ onSelectFilter, table, }) => {
|
|
|
5373
5404
|
justifyContent: 'space-between',
|
|
5374
5405
|
gap: 1,
|
|
5375
5406
|
minWidth: 180,
|
|
5376
|
-
}, children: [jsx(ListItemText, { onClick: () => handleSelectFilter(savedFilter), primary: savedFilter.name, sx: { cursor: 'pointer', flexGrow: 1 } }), onDeleteSavedFilter && (jsxs(Fragment, { children: [jsx(Divider, { flexItem: true, orientation: "vertical" }), jsx(DeleteForeverIcon, { color: "error", fontSize: "small", onClick: (event) => {
|
|
5407
|
+
}, children: [jsx(ListItemText, { onClick: () => handleSelectFilter(savedFilter), primary: savedFilter.name, sx: { cursor: 'pointer', flexGrow: 1 }, "data-testid": "saved-filter-item" }), onDeleteSavedFilter && (jsxs(Fragment, { children: [jsx(Divider, { flexItem: true, orientation: "vertical" }), jsx(DeleteForeverIcon, { color: "error", fontSize: "small", onClick: (event) => {
|
|
5377
5408
|
event.stopPropagation();
|
|
5378
5409
|
handleDeleteFilter(savedFilter.name);
|
|
5379
5410
|
}, sx: { cursor: 'pointer', flexShrink: 0 } })] }))] }, savedFilter.name)))] })] }));
|
|
@@ -6435,8 +6466,7 @@ const MRT_TableBodyCellValue = ({ cell, rowRef, staticColumnIndex, staticRowInde
|
|
|
6435
6466
|
|
|
6436
6467
|
const MRT_TableBodyCell = (_a) => {
|
|
6437
6468
|
var _b, _c, _d, _e;
|
|
6438
|
-
var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
|
|
6439
|
-
const theme = useTheme();
|
|
6469
|
+
var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table, theme } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table", "theme"]);
|
|
6440
6470
|
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableKeyboardShortcuts, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
|
|
6441
6471
|
const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
|
6442
6472
|
const { column, row } = cell;
|
|
@@ -6635,8 +6665,7 @@ const MRT_TableDetailPanel = (_a) => {
|
|
|
6635
6665
|
|
|
6636
6666
|
const MRT_TableBodyRow = (_a) => {
|
|
6637
6667
|
var _b, _c, _d, _f;
|
|
6638
|
-
var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "virtualRow"]);
|
|
6639
|
-
const theme = useTheme();
|
|
6668
|
+
var { columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, theme, virtualRow } = _a, rest = __rest(_a, ["columnVirtualizer", "numRows", "pinnedRowIds", "row", "rowVirtualizer", "staticRowIndex", "table", "theme", "virtualRow"]);
|
|
6640
6669
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, mrtTheme: { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, }, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
|
6641
6670
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, rowPinning, } = getState();
|
|
6642
6671
|
const visibleCells = row.getVisibleCells();
|
|
@@ -6701,7 +6730,11 @@ const MRT_TableBodyRow = (_a) => {
|
|
|
6701
6730
|
? Object.assign({ backgroundColor: alpha(cellHighlightColorHover, 0.3) }, commonCellBeforeAfterStyles) : undefined, backgroundColor: `${baseBackgroundColor} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
|
6702
6731
|
? `${bottomPinnedIndex * rowHeight +
|
|
6703
6732
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
|
6704
|
-
: 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,
|
|
6733
|
+
: 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,
|
|
6734
|
+
//prevents the browser from "anchoring" scroll position to this
|
|
6735
|
+
//row as virtualized rows are recycled in and out — see
|
|
6736
|
+
//tanstack/virtual#860
|
|
6737
|
+
overflowAnchor: virtualRow ? 'none' : undefined, position: virtualRow
|
|
6705
6738
|
? 'absolute'
|
|
6706
6739
|
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isRowPinned
|
|
6707
6740
|
? 'sticky'
|
|
@@ -6724,6 +6757,7 @@ const MRT_TableBodyRow = (_a) => {
|
|
|
6724
6757
|
staticColumnIndex,
|
|
6725
6758
|
staticRowIndex,
|
|
6726
6759
|
table,
|
|
6760
|
+
theme,
|
|
6727
6761
|
};
|
|
6728
6762
|
const key = `${cell.id}-${staticRowIndex}`;
|
|
6729
6763
|
return cell ? (memoMode === 'cells' &&
|
|
@@ -6741,6 +6775,10 @@ const MRT_TableBody = (_a) => {
|
|
|
6741
6775
|
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
|
6742
6776
|
const { getBottomRows, getIsSomeRowsPinned, getRowModel, getState, getTopRows, options: { enableStickyFooter, enableStickyHeader, layoutMode, localization, memoMode, muiTableBodyProps, renderDetailPanel, renderEmptyRowsFallback, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
|
|
6743
6777
|
const { columnFilters, globalFilter, rowPinning } = getState();
|
|
6778
|
+
//read once per body render instead of once per row/cell, since every
|
|
6779
|
+
//subscriber otherwise pays its own useContext lookup on every mount
|
|
6780
|
+
//(noticeable when a burst of new rows mounts on a fast scroll jump)
|
|
6781
|
+
const theme = useTheme();
|
|
6744
6782
|
const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyProps, { table })), rest);
|
|
6745
6783
|
const tableHeadHeight = (enableStickyHeader && ((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
|
|
6746
6784
|
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
|
@@ -6759,6 +6797,7 @@ const MRT_TableBody = (_a) => {
|
|
|
6759
6797
|
columnVirtualizer,
|
|
6760
6798
|
numRows: rows.length,
|
|
6761
6799
|
table,
|
|
6800
|
+
theme,
|
|
6762
6801
|
};
|
|
6763
6802
|
return (jsxs(Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
|
6764
6803
|
getIsSomeRowsPinned('top') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', top: tableHeadHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getTopRows().map((row, staticRowIndex) => {
|
|
@@ -7475,7 +7514,7 @@ const MRT_Table = (_a) => {
|
|
|
7475
7514
|
columnVirtualizer,
|
|
7476
7515
|
table,
|
|
7477
7516
|
};
|
|
7478
|
-
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader }, 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,
|
|
7517
|
+
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader }, 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, position: 'relative' }, 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))] })));
|
|
7479
7518
|
};
|
|
7480
7519
|
|
|
7481
7520
|
const MRT_TableLoadingOverlay = (_a) => {
|
|
@@ -7501,7 +7540,7 @@ const MRT_TableLoadingOverlay = (_a) => {
|
|
|
7501
7540
|
|
|
7502
7541
|
const MRT_TableContainer = (_a) => {
|
|
7503
7542
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
7504
|
-
const { getState, options: { createDisplayMode, editDisplayMode, enableCellActions, muiTableContainerProps, }, refs: { tableContainerRef }, } = table;
|
|
7543
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableCellActions, enableRowVirtualization, muiTableContainerProps, }, refs: { tableContainerRef }, } = table;
|
|
7505
7544
|
const { actionCell, creatingRow, editingRow, isLoading, showLoadingOverlay, newEntryModal, } = getState();
|
|
7506
7545
|
const loading = showLoadingOverlay !== false && (isLoading || showLoadingOverlay);
|
|
7507
7546
|
const tableContainerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableContainerProps, {
|
|
@@ -7517,7 +7556,9 @@ const MRT_TableContainer = (_a) => {
|
|
|
7517
7556
|
tableContainerProps.ref.current = node;
|
|
7518
7557
|
}
|
|
7519
7558
|
}
|
|
7520
|
-
}, style: Object.assign({}, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ flex: '1 1 auto', height: '100%', display: 'flex', flexDirection: 'column', maxWidth: '100%', overflow: 'auto', position: 'relative' },
|
|
7559
|
+
}, style: Object.assign({}, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign(Object.assign({ flex: '1 1 auto', height: '100%', display: 'flex', flexDirection: 'column', maxWidth: '100%', overflow: 'auto', position: 'relative' }, (enableRowVirtualization
|
|
7560
|
+
? { contain: 'paint', willChange: 'transform' }
|
|
7561
|
+
: null)), parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table })), newEntryModal.open && jsx(MRT_NewEntryModal, { table: table }), enableCellActions && actionCell && jsx(MRT_CellActionMenu, { table: table })] })));
|
|
7521
7562
|
};
|
|
7522
7563
|
|
|
7523
7564
|
const MRT_TablePaper = (_a) => {
|