material-react-table 0.6.6 → 0.6.7
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/MaterialReactTable.d.ts +2 -2
- package/dist/head/MRT_TableHeadCell.d.ts +9 -2
- package/dist/material-react-table.cjs.development.js +31 -30
- 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 +31 -30
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/MaterialReactTable.tsx +2 -2
- package/src/body/MRT_TableBodyCell.tsx +4 -7
- package/src/buttons/MRT_CopyButton.tsx +19 -19
- package/src/head/MRT_TableHeadCell.tsx +12 -1
- package/src/head/MRT_TableHeadCellActions.tsx +6 -1
|
@@ -31,9 +31,9 @@ export declare type MRT_ColumnInterface<D extends {} = {}> = ColumnInterface<D>
|
|
|
31
31
|
Header?: string;
|
|
32
32
|
accessor?: string;
|
|
33
33
|
columns?: MRT_ColumnInterface<D>[];
|
|
34
|
+
disableClickToCopy?: boolean;
|
|
34
35
|
disableEditing?: boolean;
|
|
35
36
|
disableFilters?: boolean;
|
|
36
|
-
disableCellCopyButton?: boolean;
|
|
37
37
|
filter?: MRT_FilterType | string | FilterType<D>;
|
|
38
38
|
filterSelectOptions?: (string | {
|
|
39
39
|
text: string;
|
|
@@ -79,7 +79,7 @@ export declare type MaterialReactTableProps<D extends {} = {}> = UseTableOptions
|
|
|
79
79
|
disableFullScreenToggle?: boolean;
|
|
80
80
|
disableSelectAll?: boolean;
|
|
81
81
|
disableSubRowTree?: boolean;
|
|
82
|
-
|
|
82
|
+
enableClickToCopy?: boolean;
|
|
83
83
|
enableColumnGrouping?: boolean;
|
|
84
84
|
enableColumnResizing?: boolean;
|
|
85
85
|
enableRowActions?: boolean;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
|
2
2
|
import type { MRT_HeaderGroup } from '..';
|
|
3
|
-
export declare const commonTableHeadCellStyles: (densePadding: boolean, enableColumnResizing?: boolean | undefined
|
|
3
|
+
export declare const commonTableHeadCellStyles: (densePadding: boolean, enableColumnResizing?: boolean | undefined, widths?: {
|
|
4
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
5
|
+
minWidth?: CSSProperties['minWidth'];
|
|
6
|
+
width?: CSSProperties['width'];
|
|
7
|
+
} | undefined) => {
|
|
8
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
9
|
+
minWidth?: CSSProperties['minWidth'];
|
|
10
|
+
width?: CSSProperties['width'];
|
|
4
11
|
fontWeight: string;
|
|
5
12
|
height: string;
|
|
6
13
|
p: string;
|
|
@@ -1033,15 +1033,15 @@ var MRT_ToggleColumnActionMenuButton = function MRT_ToggleColumnActionMenuButton
|
|
|
1033
1033
|
}));
|
|
1034
1034
|
};
|
|
1035
1035
|
|
|
1036
|
-
var commonTableHeadCellStyles = function commonTableHeadCellStyles(densePadding, enableColumnResizing) {
|
|
1037
|
-
return {
|
|
1036
|
+
var commonTableHeadCellStyles = function commonTableHeadCellStyles(densePadding, enableColumnResizing, widths) {
|
|
1037
|
+
return _extends({
|
|
1038
1038
|
fontWeight: 'bold',
|
|
1039
1039
|
height: '100%',
|
|
1040
1040
|
p: densePadding ? '0.5rem' : '1rem',
|
|
1041
1041
|
pt: densePadding ? '0.75rem' : '1.25rem',
|
|
1042
1042
|
transition: "all " + (enableColumnResizing ? '10ms' : '0.2s') + " ease-in-out",
|
|
1043
1043
|
verticalAlign: 'text-top'
|
|
1044
|
-
};
|
|
1044
|
+
}, widths);
|
|
1045
1045
|
};
|
|
1046
1046
|
var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
1047
1047
|
var _column$columns, _localization$sortByC, _localization$sortByC2;
|
|
@@ -1076,7 +1076,11 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
1076
1076
|
return React__default.createElement(material.TableCell, Object.assign({
|
|
1077
1077
|
align: isParentHeader ? 'center' : 'left'
|
|
1078
1078
|
}, tableCellProps, {
|
|
1079
|
-
sx: _extends({}, commonTableHeadCellStyles(tableInstance.state.densePadding, enableColumnResizing
|
|
1079
|
+
sx: _extends({}, commonTableHeadCellStyles(tableInstance.state.densePadding, enableColumnResizing, {
|
|
1080
|
+
maxWidth: column.maxWidth,
|
|
1081
|
+
minWidth: column.minWidth,
|
|
1082
|
+
width: column.width
|
|
1083
|
+
}), tableCellProps == null ? void 0 : tableCellProps.sx)
|
|
1080
1084
|
}), React__default.createElement(material.Box, {
|
|
1081
1085
|
sx: {
|
|
1082
1086
|
alignItems: 'flex-start',
|
|
@@ -1200,9 +1204,6 @@ var MRT_CopyButton = function MRT_CopyButton(_ref) {
|
|
|
1200
1204
|
var cell = _ref.cell;
|
|
1201
1205
|
|
|
1202
1206
|
var _useMRT = useMRT(),
|
|
1203
|
-
_useMRT$icons = _useMRT.icons,
|
|
1204
|
-
CheckBoxIcon = _useMRT$icons.CheckBoxIcon,
|
|
1205
|
-
ContentCopyIcon = _useMRT$icons.ContentCopyIcon,
|
|
1206
1207
|
localization = _useMRT.localization;
|
|
1207
1208
|
|
|
1208
1209
|
var _useState = React.useState(false),
|
|
@@ -1214,32 +1215,34 @@ var MRT_CopyButton = function MRT_CopyButton(_ref) {
|
|
|
1214
1215
|
setCopied(true);
|
|
1215
1216
|
setTimeout(function () {
|
|
1216
1217
|
return setCopied(false);
|
|
1217
|
-
},
|
|
1218
|
+
}, 4000);
|
|
1218
1219
|
};
|
|
1219
1220
|
|
|
1220
1221
|
return React__default.createElement(material.Tooltip, {
|
|
1221
1222
|
arrow: true,
|
|
1223
|
+
enterDelay: 1000,
|
|
1224
|
+
enterNextDelay: 1000,
|
|
1225
|
+
placement: "top",
|
|
1222
1226
|
title: copied ? localization.copiedToClipboard : localization.clickToCopy
|
|
1223
|
-
}, React__default.createElement(material.
|
|
1227
|
+
}, React__default.createElement(material.Button, {
|
|
1224
1228
|
"aria-label": localization.clickToCopy,
|
|
1225
1229
|
onClick: function onClick() {
|
|
1226
1230
|
return handleCopy(cell.value);
|
|
1227
1231
|
},
|
|
1228
1232
|
size: "small",
|
|
1229
1233
|
sx: {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
'
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
})));
|
|
1234
|
+
backgroundColor: 'transparent',
|
|
1235
|
+
color: 'inherit',
|
|
1236
|
+
letterSpacing: 'inherit',
|
|
1237
|
+
fontFamily: 'inherit',
|
|
1238
|
+
fontSize: 'inherit',
|
|
1239
|
+
m: '-0.25rem',
|
|
1240
|
+
textTransform: 'inherit',
|
|
1241
|
+
textAlign: 'inherit',
|
|
1242
|
+
minWidth: 'unset'
|
|
1243
|
+
},
|
|
1244
|
+
variant: "text"
|
|
1245
|
+
}, cell.render('Cell')));
|
|
1243
1246
|
};
|
|
1244
1247
|
|
|
1245
1248
|
var commonTableBodyCellStyles = function commonTableBodyCellStyles(densePadding) {
|
|
@@ -1260,7 +1263,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
1260
1263
|
var cell = _ref.cell;
|
|
1261
1264
|
|
|
1262
1265
|
var _useMRT = useMRT(),
|
|
1263
|
-
|
|
1266
|
+
enableClickToCopy = _useMRT.enableClickToCopy,
|
|
1264
1267
|
isLoading = _useMRT.isLoading,
|
|
1265
1268
|
muiTableBodyCellProps = _useMRT.muiTableBodyCellProps,
|
|
1266
1269
|
muiTableBodyCellSkeletonProps = _useMRT.muiTableBodyCellSkeletonProps,
|
|
@@ -1288,13 +1291,9 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
1288
1291
|
width: Math.random() * (120 - 60) + 60
|
|
1289
1292
|
}, muiTableBodyCellSkeletonProps)) : !cell.column.disableEditing && (currentEditingRow == null ? void 0 : currentEditingRow.id) === cell.row.id ? React__default.createElement(MRT_EditCellTextField, {
|
|
1290
1293
|
cell: cell
|
|
1291
|
-
}) : cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React__default.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") :
|
|
1292
|
-
sx: {
|
|
1293
|
-
whiteSpace: 'nowrap'
|
|
1294
|
-
}
|
|
1295
|
-
}, cell.render('Cell'), React__default.createElement(MRT_CopyButton, {
|
|
1294
|
+
}) : cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React__default.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") : enableClickToCopy && !cell.column.disableClickToCopy ? React__default.createElement(MRT_CopyButton, {
|
|
1296
1295
|
cell: cell
|
|
1297
|
-
})
|
|
1296
|
+
}) : cell.render('Cell'));
|
|
1298
1297
|
};
|
|
1299
1298
|
|
|
1300
1299
|
var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
@@ -1390,7 +1389,9 @@ var MRT_TableHeadCellActions = function MRT_TableHeadCellActions() {
|
|
|
1390
1389
|
textAlign: 'center'
|
|
1391
1390
|
},
|
|
1392
1391
|
sx: _extends({}, commonTableHeadCellStyles(densePadding), {
|
|
1393
|
-
textAlign: 'center'
|
|
1392
|
+
textAlign: 'center',
|
|
1393
|
+
maxWidth: '4rem',
|
|
1394
|
+
width: '4rem'
|
|
1394
1395
|
})
|
|
1395
1396
|
}, localization.actions);
|
|
1396
1397
|
};
|