material-react-table 0.37.1 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cjs/MaterialReactTable.d.ts +20 -10
- package/dist/cjs/body/MRT_TableBodyCellValue.d.ts +8 -0
- package/dist/cjs/buttons/MRT_CopyButton.d.ts +5 -5
- package/dist/cjs/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +64 -45
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/MaterialReactTable.d.ts +20 -10
- package/dist/esm/body/MRT_TableBodyCellValue.d.ts +8 -0
- package/dist/esm/buttons/MRT_CopyButton.d.ts +5 -5
- package/dist/esm/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/material-react-table.esm.js +64 -46
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +28 -11
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +25 -8
- package/src/body/MRT_TableBodyCell.tsx +8 -18
- package/src/body/MRT_TableBodyCellValue.tsx +35 -0
- package/src/buttons/MRT_CopyButton.tsx +9 -5
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +9 -4
- package/src/head/MRT_TableHeadCell.tsx +3 -5
- package/src/index.tsx +2 -0
- package/src/inputs/MRT_EditCellTextField.tsx +11 -2
- package/src/inputs/MRT_FilterTextField.tsx +1 -1
- package/src/table/MRT_TableRoot.tsx +6 -2
- package/src/toolbar/MRT_BottomToolbar.tsx +5 -7
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +14 -5
- package/src/toolbar/MRT_TopToolbar.tsx +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, DragEvent, MutableRefObject, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import type { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
|
|
2
|
+
import type { AlertProps, ButtonProps, CheckboxProps, ChipProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
|
|
3
3
|
import type { Cell, Column, ColumnDef, DeepKeys, FilterFn, Header, HeaderGroup, OnChangeFn, Row, SortingFn, Table, TableOptions, TableState } from '@tanstack/react-table';
|
|
4
4
|
import type { Options as VirtualizerOptions } from 'react-virtual';
|
|
5
5
|
import { MRT_Icons } from './icons';
|
|
@@ -48,8 +48,8 @@ export declare type MRT_TableInstance<TData extends Record<string, any> = {}> =
|
|
|
48
48
|
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
49
49
|
setDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
|
50
50
|
setDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
|
|
51
|
-
setEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
|
|
52
|
-
setEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
|
|
51
|
+
setEditingCell: Dispatch<SetStateAction<MRT_Cell<TData> | null>>;
|
|
52
|
+
setEditingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
|
|
53
53
|
setGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
|
|
54
54
|
setHoveredColumn: Dispatch<SetStateAction<MRT_Column<TData> | {
|
|
55
55
|
id: string;
|
|
@@ -113,6 +113,12 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
|
|
|
113
113
|
footer: MRT_Header<TData>;
|
|
114
114
|
table: MRT_TableInstance<TData>;
|
|
115
115
|
}) => ReactNode);
|
|
116
|
+
GroupedCell?: ({ cell, column, row, table, }: {
|
|
117
|
+
cell: MRT_Cell<TData>;
|
|
118
|
+
column: MRT_Column<TData>;
|
|
119
|
+
row: MRT_Row<TData>;
|
|
120
|
+
table: MRT_TableInstance<TData>;
|
|
121
|
+
}) => ReactNode;
|
|
116
122
|
Header?: ReactNode | (({ column, header, table, }: {
|
|
117
123
|
column: MRT_Column<TData>;
|
|
118
124
|
header: MRT_Header<TData>;
|
|
@@ -292,6 +298,9 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
292
298
|
icons?: Partial<MRT_Icons>;
|
|
293
299
|
initialState?: Partial<MRT_TableState<TData>>;
|
|
294
300
|
localization?: Partial<MRT_Localization>;
|
|
301
|
+
muiBottomToolbarProps?: ToolbarProps | (({ table }: {
|
|
302
|
+
table: MRT_TableInstance<TData>;
|
|
303
|
+
}) => ToolbarProps);
|
|
295
304
|
muiExpandAllButtonProps?: IconButtonProps | (({ table }: {
|
|
296
305
|
table: MRT_TableInstance<TData>;
|
|
297
306
|
}) => IconButtonProps);
|
|
@@ -346,9 +355,6 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
346
355
|
table: MRT_TableInstance<TData>;
|
|
347
356
|
row: MRT_Row<TData>;
|
|
348
357
|
}) => TableRowProps);
|
|
349
|
-
muiTableBottomToolbarProps?: ToolbarProps | (({ table }: {
|
|
350
|
-
table: MRT_TableInstance<TData>;
|
|
351
|
-
}) => ToolbarProps);
|
|
352
358
|
muiTableContainerProps?: TableContainerProps | (({ table, }: {
|
|
353
359
|
table: MRT_TableInstance<TData>;
|
|
354
360
|
}) => TableContainerProps);
|
|
@@ -400,10 +406,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
400
406
|
muiTableProps?: TableProps | (({ table }: {
|
|
401
407
|
table: MRT_TableInstance<TData>;
|
|
402
408
|
}) => TableProps);
|
|
403
|
-
|
|
409
|
+
muiToolbarAlertBannerChipProps?: ChipProps | (({ table }: {
|
|
410
|
+
table: MRT_TableInstance<TData>;
|
|
411
|
+
}) => ChipProps);
|
|
412
|
+
muiToolbarAlertBannerProps?: AlertProps | (({ table }: {
|
|
404
413
|
table: MRT_TableInstance<TData>;
|
|
405
414
|
}) => AlertProps);
|
|
406
|
-
|
|
415
|
+
muiTopToolbarProps?: ToolbarProps | (({ table }: {
|
|
407
416
|
table: MRT_TableInstance<TData>;
|
|
408
417
|
}) => ToolbarProps);
|
|
409
418
|
onColumnDrop?: ({ event, draggedColumn, targetColumn, }: {
|
|
@@ -416,13 +425,13 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
416
425
|
onDensityChange?: OnChangeFn<boolean>;
|
|
417
426
|
onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
418
427
|
onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
428
|
+
onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
|
|
419
429
|
onEditingRowSave?: ({ exitEditingMode, row, table, values, }: {
|
|
420
430
|
exitEditingMode: () => void;
|
|
421
431
|
row: MRT_Row<TData>;
|
|
422
432
|
table: MRT_TableInstance<TData>;
|
|
423
433
|
values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
|
|
424
434
|
}) => Promise<void> | void;
|
|
425
|
-
onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
|
|
426
435
|
onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
427
436
|
onFilterFnsChange?: OnChangeFn<{
|
|
428
437
|
[key: string]: MRT_FilterOption;
|
|
@@ -459,7 +468,8 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
459
468
|
row: MRT_Row<TData>;
|
|
460
469
|
table: MRT_TableInstance<TData>;
|
|
461
470
|
}) => ReactNode[];
|
|
462
|
-
renderRowActions?: ({ row, table, }: {
|
|
471
|
+
renderRowActions?: ({ cell, row, table, }: {
|
|
472
|
+
cell: MRT_Cell<TData>;
|
|
463
473
|
row: MRT_Row<TData>;
|
|
464
474
|
table: MRT_TableInstance<TData>;
|
|
465
475
|
}) => ReactNode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { MRT_Cell, MRT_TableInstance } from '..';
|
|
3
|
-
interface Props {
|
|
4
|
-
cell: MRT_Cell
|
|
3
|
+
interface Props<TData extends Record<string, any> = {}> {
|
|
4
|
+
cell: MRT_Cell<TData>;
|
|
5
5
|
children: ReactNode;
|
|
6
|
-
table: MRT_TableInstance
|
|
6
|
+
table: MRT_TableInstance<TData>;
|
|
7
7
|
}
|
|
8
|
-
export declare const MRT_CopyButton:
|
|
8
|
+
export declare const MRT_CopyButton: <TData extends Record<string, any> = {}>({ cell, children, table, }: Props<TData>) => JSX.Element;
|
|
9
9
|
export {};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ export * from './MaterialReactTable';
|
|
|
4
4
|
import type { MRT_Icons } from './icons';
|
|
5
5
|
import type { MRT_Localization } from './localization';
|
|
6
6
|
export type { MRT_Localization, MRT_Icons };
|
|
7
|
+
import { MRT_CopyButton } from './buttons/MRT_CopyButton';
|
|
7
8
|
import { MRT_FullScreenToggleButton } from './buttons/MRT_FullScreenToggleButton';
|
|
8
9
|
import { MRT_GlobalFilterTextField } from './inputs/MRT_GlobalFilterTextField';
|
|
9
10
|
import { MRT_ShowHideColumnsButton } from './buttons/MRT_ShowHideColumnsButton';
|
|
10
11
|
import { MRT_ToggleDensePaddingButton } from './buttons/MRT_ToggleDensePaddingButton';
|
|
11
12
|
import { MRT_ToggleFiltersButton } from './buttons/MRT_ToggleFiltersButton';
|
|
12
13
|
import { MRT_ToggleGlobalFilterButton } from './buttons/MRT_ToggleGlobalFilterButton';
|
|
13
|
-
export { MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, };
|
|
14
|
+
export { MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_CopyButton, };
|
|
@@ -915,7 +915,7 @@ const commonIconButtonStyles = {
|
|
|
915
915
|
opacity: 1,
|
|
916
916
|
},
|
|
917
917
|
};
|
|
918
|
-
const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
|
|
918
|
+
const MRT_ToggleRowActionMenuButton = ({ cell, row, table }) => {
|
|
919
919
|
const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
|
920
920
|
const { editingRow } = getState();
|
|
921
921
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -928,8 +928,8 @@ const MRT_ToggleRowActionMenuButton = ({ row, table }) => {
|
|
|
928
928
|
setEditingRow(Object.assign({}, row));
|
|
929
929
|
setAnchorEl(null);
|
|
930
930
|
};
|
|
931
|
-
return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
|
932
|
-
React.createElement(IconButton, { sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
|
931
|
+
return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ cell, row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
|
932
|
+
React.createElement(IconButton, { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
|
933
933
|
React.createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React.createElement(React.Fragment, null,
|
|
934
934
|
React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
|
|
935
935
|
React.createElement(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles },
|
|
@@ -1045,11 +1045,14 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1045
1045
|
|
|
1046
1046
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1047
1047
|
var _a, _b;
|
|
1048
|
-
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization,
|
|
1048
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, }, } = table;
|
|
1049
1049
|
const { grouping, showAlertBanner } = getState();
|
|
1050
|
-
const alertProps =
|
|
1051
|
-
?
|
|
1052
|
-
:
|
|
1050
|
+
const alertProps = muiToolbarAlertBannerProps instanceof Function
|
|
1051
|
+
? muiToolbarAlertBannerProps({ table })
|
|
1052
|
+
: muiToolbarAlertBannerProps;
|
|
1053
|
+
const chipProps = muiToolbarAlertBannerChipProps instanceof Function
|
|
1054
|
+
? muiToolbarAlertBannerChipProps({ table })
|
|
1055
|
+
: muiToolbarAlertBannerChipProps;
|
|
1053
1056
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
|
1054
1057
|
? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', getPrePaginationRowModel().rows.length.toString())
|
|
1055
1058
|
: null;
|
|
@@ -1058,7 +1061,7 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
1058
1061
|
' ',
|
|
1059
1062
|
grouping.map((columnId, index) => (React.createElement(Fragment, { key: `${index}-${columnId}` },
|
|
1060
1063
|
index > 0 ? localization.thenBy : '',
|
|
1061
|
-
React.createElement(Chip, {
|
|
1064
|
+
React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
|
|
1062
1065
|
return (React.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
|
|
1063
1066
|
React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
|
|
1064
1067
|
? alertProps.sx(theme)
|
|
@@ -1189,12 +1192,12 @@ const commonToolbarStyles = ({ theme }) => ({
|
|
|
1189
1192
|
});
|
|
1190
1193
|
const MRT_TopToolbar = ({ table }) => {
|
|
1191
1194
|
var _a;
|
|
1192
|
-
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions,
|
|
1195
|
+
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
|
|
1193
1196
|
const { isFullScreen, showGlobalFilter } = getState();
|
|
1194
1197
|
const isMobile = useMediaQuery('(max-width:720px)');
|
|
1195
|
-
const toolbarProps =
|
|
1196
|
-
?
|
|
1197
|
-
:
|
|
1198
|
+
const toolbarProps = muiTopToolbarProps instanceof Function
|
|
1199
|
+
? muiTopToolbarProps({ table })
|
|
1200
|
+
: muiTopToolbarProps;
|
|
1198
1201
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
|
1199
1202
|
return (React.createElement(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
|
1200
1203
|
topToolbarRef.current = ref;
|
|
@@ -1227,12 +1230,12 @@ const MRT_TopToolbar = ({ table }) => {
|
|
|
1227
1230
|
};
|
|
1228
1231
|
|
|
1229
1232
|
const MRT_BottomToolbar = ({ table }) => {
|
|
1230
|
-
const { getState, options: { enablePagination,
|
|
1233
|
+
const { getState, options: { enablePagination, muiBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
|
|
1231
1234
|
const { isFullScreen } = getState();
|
|
1232
1235
|
const isMobile = useMediaQuery('(max-width:720px)');
|
|
1233
|
-
const toolbarProps =
|
|
1234
|
-
?
|
|
1235
|
-
:
|
|
1236
|
+
const toolbarProps = muiBottomToolbarProps instanceof Function
|
|
1237
|
+
? muiBottomToolbarProps({ table })
|
|
1238
|
+
: muiBottomToolbarProps;
|
|
1236
1239
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
|
1237
1240
|
return (React.createElement(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
|
1238
1241
|
bottomToolbarRef.current = ref;
|
|
@@ -1251,7 +1254,7 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
|
1251
1254
|
justifyContent: 'space-between',
|
|
1252
1255
|
width: '100%',
|
|
1253
1256
|
} },
|
|
1254
|
-
renderBottomToolbarCustomActions ? (
|
|
1257
|
+
renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (React.createElement("span", null)),
|
|
1255
1258
|
React.createElement(Box, { sx: {
|
|
1256
1259
|
display: 'flex',
|
|
1257
1260
|
justifyContent: 'flex-end',
|
|
@@ -1441,7 +1444,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1441
1444
|
if (textFieldProps.inputRef) {
|
|
1442
1445
|
textFieldProps.inputRef = inputRef;
|
|
1443
1446
|
}
|
|
1444
|
-
}, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '
|
|
1447
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '150px' : 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1445
1448
|
mr: '1.5rem',
|
|
1446
1449
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1447
1450
|
? textFieldProps.sx(theme)
|
|
@@ -1633,7 +1636,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1633
1636
|
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1634
1637
|
setHoveredColumn(null);
|
|
1635
1638
|
}
|
|
1636
|
-
if (enableColumnOrdering && draggingColumn) {
|
|
1639
|
+
if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
|
|
1637
1640
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
1638
1641
|
}
|
|
1639
1642
|
};
|
|
@@ -1683,13 +1686,11 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1683
1686
|
? '0.4rem'
|
|
1684
1687
|
: '0.6rem', position: column.getIsPinned() && columnDefType !== 'group'
|
|
1685
1688
|
? 'sticky'
|
|
1686
|
-
: undefined, pt: columnDefType === 'group'
|
|
1687
|
-
? 0
|
|
1688
|
-
: density === '
|
|
1689
|
-
? '
|
|
1690
|
-
:
|
|
1691
|
-
? '.75rem'
|
|
1692
|
-
: '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1689
|
+
: undefined, pt: columnDefType === 'group' || density === 'compact'
|
|
1690
|
+
? '0.25rem'
|
|
1691
|
+
: density === 'comfortable'
|
|
1692
|
+
? '.75rem'
|
|
1693
|
+
: '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1693
1694
|
? 3
|
|
1694
1695
|
: column.getIsPinned() && columnDefType !== 'group'
|
|
1695
1696
|
? 2
|
|
@@ -1776,6 +1777,9 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
|
1776
1777
|
var _a;
|
|
1777
1778
|
(_a = textFieldProps.onChange) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, event);
|
|
1778
1779
|
setValue(event.target.value);
|
|
1780
|
+
if ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.select) && editingRow) {
|
|
1781
|
+
setEditingRow(Object.assign(Object.assign({}, editingRow), { _valuesCache: Object.assign(Object.assign({}, editingRow._valuesCache), { [column.id]: event.target.value }) }));
|
|
1782
|
+
}
|
|
1779
1783
|
};
|
|
1780
1784
|
const handleBlur = (event) => {
|
|
1781
1785
|
var _a;
|
|
@@ -1788,7 +1792,7 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
|
1788
1792
|
if (columnDef.Edit) {
|
|
1789
1793
|
return React.createElement(React.Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }));
|
|
1790
1794
|
}
|
|
1791
|
-
return (React.createElement(TextField, Object.assign({ disabled: columnDef.enableEditing === false, fullWidth: true, label: showLabel ? column.columnDef.header : undefined, margin: "none", name:
|
|
1795
|
+
return (React.createElement(TextField, Object.assign({ disabled: columnDef.enableEditing === false, fullWidth: true, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, onClick: (e) => e.stopPropagation(), placeholder: columnDef.header, value: value, variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
|
|
1792
1796
|
if (inputRef) {
|
|
1793
1797
|
editInputRefs.current[column.id] = inputRef;
|
|
1794
1798
|
if (textFieldProps.inputRef) {
|
|
@@ -1798,7 +1802,7 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
|
1798
1802
|
}, onBlur: handleBlur, onChange: handleChange })));
|
|
1799
1803
|
};
|
|
1800
1804
|
|
|
1801
|
-
const MRT_CopyButton = ({ cell, children, table }) => {
|
|
1805
|
+
const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
1802
1806
|
const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
|
|
1803
1807
|
const { column, row } = cell;
|
|
1804
1808
|
const { columnDef } = column;
|
|
@@ -1846,8 +1850,31 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
|
1846
1850
|
return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
|
1847
1851
|
};
|
|
1848
1852
|
|
|
1853
|
+
const MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
1854
|
+
var _a, _b, _c, _d;
|
|
1855
|
+
const { column, row } = cell;
|
|
1856
|
+
const { columnDef } = column;
|
|
1857
|
+
return (React.createElement(React.Fragment, null, cell.getIsAggregated() && column.columnDef.aggregationFn
|
|
1858
|
+
? (_a = columnDef.AggregatedCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
|
1859
|
+
cell,
|
|
1860
|
+
column,
|
|
1861
|
+
row,
|
|
1862
|
+
table,
|
|
1863
|
+
})
|
|
1864
|
+
: row.getIsGrouped() && !cell.getIsGrouped()
|
|
1865
|
+
? null
|
|
1866
|
+
: (cell.getIsGrouped() &&
|
|
1867
|
+
((_b = columnDef.GroupedCell) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
|
1868
|
+
cell,
|
|
1869
|
+
column,
|
|
1870
|
+
row,
|
|
1871
|
+
table,
|
|
1872
|
+
}))) ||
|
|
1873
|
+
((_d = (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : cell.renderValue())));
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1849
1876
|
const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
1850
|
-
var _a, _b
|
|
1877
|
+
var _a, _b;
|
|
1851
1878
|
const theme = useTheme();
|
|
1852
1879
|
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
|
1853
1880
|
const { draggingColumn, editingCell, editingRow, hoveredColumn, density, isLoading, showSkeletons, } = getState();
|
|
@@ -1977,21 +2004,12 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
1977
2004
|
(column.id === 'mrt-row-select' ||
|
|
1978
2005
|
column.id === 'mrt-row-expand' ||
|
|
1979
2006
|
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (React.createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
|
1980
|
-
columnDef.enableClickToCopy !== false ? (React.createElement(
|
|
1981
|
-
React.createElement(
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
" (", (_d = row.subRows) === null || _d === void 0 ? void 0 :
|
|
1987
|
-
_d.length,
|
|
1988
|
-
")"))) : (React.createElement(React.Fragment, null,
|
|
1989
|
-
row.getIsGrouped() && !cell.getIsGrouped()
|
|
1990
|
-
? null
|
|
1991
|
-
: (_g = (_f = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _f === void 0 ? void 0 : _f.call(columnDef, { cell, column, row, table })) !== null && _g !== void 0 ? _g : cell.renderValue(),
|
|
1992
|
-
cell.getIsGrouped() && React.createElement(React.Fragment, null,
|
|
1993
|
-
" (", (_j = (_h = row.subRows) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : '',
|
|
1994
|
-
")"))))));
|
|
2007
|
+
columnDef.enableClickToCopy !== false ? (React.createElement(MRT_CopyButton, { cell: cell, table: table },
|
|
2008
|
+
React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))) : (React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))),
|
|
2009
|
+
cell.getIsGrouped() && !columnDef.GroupedCell && (React.createElement(React.Fragment, null,
|
|
2010
|
+
" (", (_b = row.subRows) === null || _b === void 0 ? void 0 :
|
|
2011
|
+
_b.length,
|
|
2012
|
+
")"))));
|
|
1995
2013
|
};
|
|
1996
2014
|
|
|
1997
2015
|
const MRT_TableDetailPanel = ({ row, table }) => {
|
|
@@ -2306,7 +2324,7 @@ const MRT_TableRoot = (props) => {
|
|
|
2306
2324
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2307
2325
|
return [
|
|
2308
2326
|
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: (_a = props.localization) === null || _a === void 0 ? void 0 : _a.move, size: 60 }, defaultDisplayColumnDefOptions), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
|
2309
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { row: row, table: table })), header: (_c = props.localization) === null || _c === void 0 ? void 0 : _c.actions, size: 70 }, defaultDisplayColumnDefOptions), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
|
2327
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: (_c = props.localization) === null || _c === void 0 ? void 0 : _c.actions, size: 70 }, defaultDisplayColumnDefOptions), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
|
2310
2328
|
columnOrder.includes('mrt-row-expand') &&
|
|
2311
2329
|
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header: (_e = props.localization) === null || _e === void 0 ? void 0 : _e.expand, size: 60 }, defaultDisplayColumnDefOptions), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
|
2312
2330
|
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: (_g = props.localization) === null || _g === void 0 ? void 0 : _g.select, size: 60 }, defaultDisplayColumnDefOptions), (_h = props.displayColumnDefOptions) === null || _h === void 0 ? void 0 : _h['mrt-row-select']), { id: 'mrt-row-select' }),
|
|
@@ -2387,5 +2405,5 @@ var MaterialReactTable = (_a) => {
|
|
|
2387
2405
|
return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilterChangeMode: enableColumnFilterChangeMode, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterChangeMode: enableGlobalFilterChangeMode, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_DefaultLocalization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
|
|
2388
2406
|
};
|
|
2389
2407
|
|
|
2390
|
-
export { MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
|
|
2408
|
+
export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
|
|
2391
2409
|
//# sourceMappingURL=material-react-table.esm.js.map
|