material-react-table 0.9.2 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/MaterialReactTable.d.ts +2 -1
- package/dist/body/MRT_TableBody.d.ts +1 -1
- package/dist/body/MRT_TableBodyCell.d.ts +1 -0
- package/dist/body/MRT_TableBodyRow.d.ts +1 -0
- package/dist/material-react-table.cjs.development.js +608 -591
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +29 -12
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +4 -1
- package/src/body/MRT_TableBody.tsx +15 -10
- package/src/body/MRT_TableBodyCell.tsx +11 -1
- package/src/body/MRT_TableBodyRow.tsx +3 -1
- package/src/table/MRT_Table.tsx +12 -5
- package/src/toolbar/MRT_ToolbarBottom.tsx +1 -1
|
@@ -1912,7 +1912,7 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom(_ref) {
|
|
|
1912
1912
|
}, toolbarProps == null ? void 0 : toolbarProps.sx);
|
|
1913
1913
|
}
|
|
1914
1914
|
}), React.createElement(MRT_LinearProgressBar, {
|
|
1915
|
-
alignTo:
|
|
1915
|
+
alignTo: "top",
|
|
1916
1916
|
tableInstance: tableInstance
|
|
1917
1917
|
}), positionToolbarAlertBanner === 'bottom' && React.createElement(MRT_ToolbarAlertBanner, {
|
|
1918
1918
|
tableInstance: tableInstance
|
|
@@ -2731,6 +2731,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2731
2731
|
|
|
2732
2732
|
var cell = _ref.cell,
|
|
2733
2733
|
enableHover = _ref.enableHover,
|
|
2734
|
+
rowIndex = _ref.rowIndex,
|
|
2734
2735
|
tableInstance = _ref.tableInstance;
|
|
2735
2736
|
var getState = tableInstance.getState,
|
|
2736
2737
|
_tableInstance$option = tableInstance.options,
|
|
@@ -2738,10 +2739,12 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2738
2739
|
enableClickToCopy = _tableInstance$option.enableClickToCopy,
|
|
2739
2740
|
enableColumnOrdering = _tableInstance$option.enableColumnOrdering,
|
|
2740
2741
|
enableEditing = _tableInstance$option.enableEditing,
|
|
2741
|
-
|
|
2742
|
+
enableRowNumbers = _tableInstance$option.enableRowNumbers,
|
|
2742
2743
|
muiTableBodyCellProps = _tableInstance$option.muiTableBodyCellProps,
|
|
2743
2744
|
muiTableBodyCellSkeletonProps = _tableInstance$option.muiTableBodyCellSkeletonProps,
|
|
2744
2745
|
onMrtCellClick = _tableInstance$option.onMrtCellClick,
|
|
2746
|
+
rowNumberMode = _tableInstance$option.rowNumberMode,
|
|
2747
|
+
tableId = _tableInstance$option.tableId,
|
|
2745
2748
|
setColumnOrder = tableInstance.setColumnOrder,
|
|
2746
2749
|
setCurrentEditingCell = tableInstance.setCurrentEditingCell;
|
|
2747
2750
|
|
|
@@ -2826,10 +2829,12 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2826
2829
|
boxShadow: getIsLastLeftPinnedColumn() ? "4px 0 4px -2px " + alpha(theme.palette.common.black, 0.1) : getIsFirstRightPinnedColumn() ? "-4px 0 4px -2px " + alpha(theme.palette.common.black, 0.1) : undefined,
|
|
2827
2830
|
cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text',
|
|
2828
2831
|
left: column.getIsPinned() === 'left' ? column.getStart('left') + "px" : undefined,
|
|
2832
|
+
overflow: 'hidden',
|
|
2829
2833
|
p: isDensePadding ? columnDefType === 'display' ? '0 0.5rem' : '0.5rem' : columnDefType === 'display' ? '0.5rem 0.75rem' : '1rem',
|
|
2830
2834
|
pl: column.id === 'mrt-expand' ? row.depth + (isDensePadding ? 0.5 : 0.75) + "rem" : undefined,
|
|
2831
2835
|
position: column.getIsPinned() ? 'sticky' : 'relative',
|
|
2832
2836
|
right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
|
|
2837
|
+
textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
|
|
2833
2838
|
transition: 'all 0.2s ease-in-out',
|
|
2834
2839
|
whiteSpace: isDensePadding ? 'nowrap' : 'normal',
|
|
2835
2840
|
zIndex: column.getIsPinned() ? 1 : undefined,
|
|
@@ -2847,7 +2852,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2847
2852
|
animation: "wave",
|
|
2848
2853
|
height: 20,
|
|
2849
2854
|
width: skeletonWidth
|
|
2850
|
-
}, muiTableBodyCellSkeletonProps)) : columnDefType === 'display' ? columnDef.Cell == null ? void 0 : columnDef.Cell({
|
|
2855
|
+
}, muiTableBodyCellSkeletonProps)) : enableRowNumbers && rowNumberMode === 'static' && column.id === 'mrt-row-numbers' ? rowIndex + 1 : columnDefType === 'display' ? columnDef.Cell == null ? void 0 : columnDef.Cell({
|
|
2851
2856
|
cell: cell,
|
|
2852
2857
|
tableInstance: tableInstance
|
|
2853
2858
|
}) : cell.getIsPlaceholder() || row.getIsGrouped() && column.id !== row.groupingColumnId ? null : cell.getIsAggregated() ? cell.renderAggregatedCell() : isEditing ? React.createElement(MRT_EditCellTextField, {
|
|
@@ -2908,6 +2913,7 @@ var MRT_TableDetailPanel = function MRT_TableDetailPanel(_ref) {
|
|
|
2908
2913
|
|
|
2909
2914
|
var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
|
|
2910
2915
|
var row = _ref.row,
|
|
2916
|
+
rowIndex = _ref.rowIndex,
|
|
2911
2917
|
tableInstance = _ref.tableInstance;
|
|
2912
2918
|
var getIsSomeColumnsPinned = tableInstance.getIsSomeColumnsPinned,
|
|
2913
2919
|
_tableInstance$option = tableInstance.options,
|
|
@@ -2943,6 +2949,7 @@ var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
|
|
|
2943
2949
|
cell: cell,
|
|
2944
2950
|
key: cell.id,
|
|
2945
2951
|
enableHover: (tableRowProps == null ? void 0 : tableRowProps.hover) !== false,
|
|
2952
|
+
rowIndex: rowIndex,
|
|
2946
2953
|
tableInstance: tableInstance
|
|
2947
2954
|
});
|
|
2948
2955
|
})), renderDetailPanel && !row.getIsGrouped() && React.createElement(MRT_TableDetailPanel, {
|
|
@@ -2969,23 +2976,24 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
|
|
|
2969
2976
|
tableInstance: tableInstance
|
|
2970
2977
|
}) : muiTableBodyProps;
|
|
2971
2978
|
var rows = enablePagination ? getPaginationRowModel().rows : getPrePaginationRowModel().rows;
|
|
2972
|
-
var rowVirtualizer = useVirtual({
|
|
2979
|
+
var rowVirtualizer = enableRowVirtualization ? useVirtual({
|
|
2973
2980
|
overscan: isDensePadding ? 15 : 5,
|
|
2974
2981
|
size: rows.length,
|
|
2975
2982
|
parentRef: tableContainerRef
|
|
2976
|
-
});
|
|
2983
|
+
}) : {};
|
|
2977
2984
|
var virtualRows = rowVirtualizer.virtualItems;
|
|
2978
|
-
var paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
|
|
2979
|
-
var paddingBottom = virtualRows.length > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
|
|
2985
|
+
var paddingTop = (virtualRows == null ? void 0 : virtualRows.length) > 0 ? virtualRows[0].start : 0;
|
|
2986
|
+
var paddingBottom = (virtualRows == null ? void 0 : virtualRows.length) > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
|
|
2980
2987
|
return React.createElement(TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React.createElement("tr", null, React.createElement("td", {
|
|
2981
2988
|
style: {
|
|
2982
2989
|
height: paddingTop + "px"
|
|
2983
2990
|
}
|
|
2984
|
-
})), (enableRowVirtualization ? virtualRows : rows).map(function (rowOrVirtualRow) {
|
|
2991
|
+
})), (enableRowVirtualization ? virtualRows : rows).map(function (rowOrVirtualRow, rowIndex) {
|
|
2985
2992
|
var row = enableRowVirtualization ? rows[rowOrVirtualRow.index] : rowOrVirtualRow;
|
|
2986
2993
|
return React.createElement(MRT_TableBodyRow, {
|
|
2987
2994
|
key: row.id,
|
|
2988
2995
|
row: row,
|
|
2996
|
+
rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex,
|
|
2989
2997
|
tableInstance: tableInstance
|
|
2990
2998
|
});
|
|
2991
2999
|
}), enableRowVirtualization && paddingBottom > 0 && React.createElement("tr", null, React.createElement("td", {
|
|
@@ -3089,6 +3097,8 @@ var MRT_Table = function MRT_Table(_ref) {
|
|
|
3089
3097
|
var tableContainerRef = _ref.tableContainerRef,
|
|
3090
3098
|
tableInstance = _ref.tableInstance;
|
|
3091
3099
|
var _tableInstance$option = tableInstance.options,
|
|
3100
|
+
enableColumnResizing = _tableInstance$option.enableColumnResizing,
|
|
3101
|
+
enableRowVirtualization = _tableInstance$option.enableRowVirtualization,
|
|
3092
3102
|
enableStickyHeader = _tableInstance$option.enableStickyHeader,
|
|
3093
3103
|
enableTableFooter = _tableInstance$option.enableTableFooter,
|
|
3094
3104
|
enableTableHead = _tableInstance$option.enableTableHead,
|
|
@@ -3098,7 +3108,11 @@ var MRT_Table = function MRT_Table(_ref) {
|
|
|
3098
3108
|
}) : muiTableProps;
|
|
3099
3109
|
return React.createElement(Table, Object.assign({
|
|
3100
3110
|
stickyHeader: enableStickyHeader
|
|
3101
|
-
}, tableProps
|
|
3111
|
+
}, tableProps, {
|
|
3112
|
+
sx: _extends({
|
|
3113
|
+
tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : undefined
|
|
3114
|
+
}, tableProps == null ? void 0 : tableProps.sx)
|
|
3115
|
+
}), enableTableHead && React.createElement(MRT_TableHead, {
|
|
3102
3116
|
tableInstance: tableInstance
|
|
3103
3117
|
}), React.createElement(MRT_TableBody, {
|
|
3104
3118
|
tableContainerRef: tableContainerRef,
|
|
@@ -3460,7 +3474,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
3460
3474
|
}));
|
|
3461
3475
|
};
|
|
3462
3476
|
|
|
3463
|
-
var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enablePagination", "enablePinning", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "persistentStateMode", "positionActionsColumn", "positionPagination", "positionGlobalFilter", "positionToolbarActions", "positionToolbarAlertBanner", "selectAllMode"];
|
|
3477
|
+
var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enablePagination", "enablePinning", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "persistentStateMode", "positionActionsColumn", "positionPagination", "positionGlobalFilter", "positionToolbarActions", "positionToolbarAlertBanner", "rowNumberMode", "selectAllMode"];
|
|
3464
3478
|
var MaterialReactTable = (function (_ref) {
|
|
3465
3479
|
var _ref$autoResetExpande = _ref.autoResetExpanded,
|
|
3466
3480
|
autoResetExpanded = _ref$autoResetExpande === void 0 ? false : _ref$autoResetExpande,
|
|
@@ -3468,9 +3482,9 @@ var MaterialReactTable = (function (_ref) {
|
|
|
3468
3482
|
columnResizeMode = _ref$columnResizeMode === void 0 ? 'onEnd' : _ref$columnResizeMode,
|
|
3469
3483
|
_ref$defaultColumn = _ref.defaultColumn,
|
|
3470
3484
|
defaultColumn = _ref$defaultColumn === void 0 ? {
|
|
3471
|
-
minSize:
|
|
3485
|
+
minSize: 30,
|
|
3472
3486
|
maxSize: 1000,
|
|
3473
|
-
size:
|
|
3487
|
+
size: 180
|
|
3474
3488
|
} : _ref$defaultColumn,
|
|
3475
3489
|
_ref$editingMode = _ref.editingMode,
|
|
3476
3490
|
editingMode = _ref$editingMode === void 0 ? 'row' : _ref$editingMode,
|
|
@@ -3532,6 +3546,8 @@ var MaterialReactTable = (function (_ref) {
|
|
|
3532
3546
|
positionToolbarActions = _ref$positionToolbarA === void 0 ? 'top' : _ref$positionToolbarA,
|
|
3533
3547
|
_ref$positionToolbarA2 = _ref.positionToolbarAlertBanner,
|
|
3534
3548
|
positionToolbarAlertBanner = _ref$positionToolbarA2 === void 0 ? 'top' : _ref$positionToolbarA2,
|
|
3549
|
+
_ref$rowNumberMode = _ref.rowNumberMode,
|
|
3550
|
+
rowNumberMode = _ref$rowNumberMode === void 0 ? 'original' : _ref$rowNumberMode,
|
|
3535
3551
|
_ref$selectAllMode = _ref.selectAllMode,
|
|
3536
3552
|
selectAllMode = _ref$selectAllMode === void 0 ? 'all' : _ref$selectAllMode,
|
|
3537
3553
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
@@ -3571,6 +3587,7 @@ var MaterialReactTable = (function (_ref) {
|
|
|
3571
3587
|
positionPagination: positionPagination,
|
|
3572
3588
|
positionToolbarActions: positionToolbarActions,
|
|
3573
3589
|
positionToolbarAlertBanner: positionToolbarAlertBanner,
|
|
3590
|
+
rowNumberMode: rowNumberMode,
|
|
3574
3591
|
selectAllMode: selectAllMode
|
|
3575
3592
|
}, rest));
|
|
3576
3593
|
});
|