material-react-table 0.36.2 → 0.37.0
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 +1 -0
- package/dist/cjs/MaterialReactTable.d.ts +32 -14
- package/dist/cjs/index.js +119 -79
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/MaterialReactTable.d.ts +32 -14
- package/dist/esm/material-react-table.esm.js +119 -79
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +32 -14
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +47 -11
- package/src/body/MRT_EditRowModal.tsx +21 -19
- package/src/body/MRT_TableBodyCell.tsx +8 -10
- package/src/body/MRT_TableBodyRow.tsx +1 -1
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +3 -2
- package/src/buttons/MRT_CopyButton.tsx +2 -2
- package/src/buttons/MRT_EditActionButtons.tsx +13 -4
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +3 -16
- package/src/column.utils.ts +2 -3
- package/src/inputs/MRT_EditCellTextField.tsx +16 -5
- package/src/inputs/MRT_FilterTextField.tsx +9 -6
- package/src/inputs/MRT_GlobalFilterTextField.tsx +7 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +2 -12
- package/src/table/MRT_TableContainer.tsx +10 -10
- package/src/table/MRT_TableRoot.tsx +22 -18
- package/src/toolbar/MRT_BottomToolbar.tsx +8 -2
- package/src/toolbar/MRT_TopToolbar.tsx +8 -2
package/dist/cjs/index.js
CHANGED
|
@@ -508,10 +508,9 @@ const prepareColumns = (columnDefs, columnFilterFns, filterFns, sortingFns) => c
|
|
|
508
508
|
else if (columnDef.columnDefType === 'data') {
|
|
509
509
|
if (Object.keys(filterFns).includes(columnFilterFns[columnDef.id])) {
|
|
510
510
|
columnDef.filterFn =
|
|
511
|
-
// @ts-ignore
|
|
512
511
|
(_b = filterFns[columnFilterFns[columnDef.id]]) !== null && _b !== void 0 ? _b : filterFns.fuzzy;
|
|
513
|
-
|
|
514
|
-
|
|
512
|
+
columnDef._filterFn =
|
|
513
|
+
columnFilterFns[columnDef.id];
|
|
515
514
|
}
|
|
516
515
|
if (Object.keys(sortingFns).includes(columnDef.sortingFn)) {
|
|
517
516
|
// @ts-ignore
|
|
@@ -712,7 +711,7 @@ const commonListItemStyles = {
|
|
|
712
711
|
};
|
|
713
712
|
const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
714
713
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
715
|
-
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { enableColumnFilterChangeMode, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, columnFilterModeOptions, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, },
|
|
714
|
+
const { getState, toggleAllColumnsVisible, setColumnOrder, options: { enableColumnFilterChangeMode, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, columnFilterModeOptions, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, }, refs: { filterInputRefs }, setShowFilters, } = table;
|
|
716
715
|
const { column } = header;
|
|
717
716
|
const { columnDef } = column;
|
|
718
717
|
const { columnSizing, columnVisibility, density } = getState();
|
|
@@ -753,13 +752,7 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
|
753
752
|
};
|
|
754
753
|
const handleFilterByColumn = () => {
|
|
755
754
|
setShowFilters(true);
|
|
756
|
-
|
|
757
|
-
var _a, _b, _c;
|
|
758
|
-
return (_c = document
|
|
759
|
-
.getElementById(
|
|
760
|
-
// @ts-ignore
|
|
761
|
-
(_b = (_a = header.muiTableHeadCellFilterTextFieldProps) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : `mrt-${tableId}-${header.id}-filter-text-field`)) === null || _c === void 0 ? void 0 : _c.focus();
|
|
762
|
-
}, 200);
|
|
755
|
+
queueMicrotask(() => { var _a; return (_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
763
756
|
setAnchorEl(null);
|
|
764
757
|
};
|
|
765
758
|
const handleShowAllColumns = () => {
|
|
@@ -890,19 +883,25 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
|
|
|
890
883
|
};
|
|
891
884
|
|
|
892
885
|
const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
|
893
|
-
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditingRowSave, }, setEditingRow, } = table;
|
|
886
|
+
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onEditingRowSave, }, refs: { editInputRefs }, setEditingRow, } = table;
|
|
894
887
|
const { editingRow } = getState();
|
|
895
|
-
const handleCancel = () =>
|
|
896
|
-
setEditingRow(null);
|
|
897
|
-
};
|
|
888
|
+
const handleCancel = () => setEditingRow(null);
|
|
898
889
|
const handleSave = () => {
|
|
899
|
-
var _a;
|
|
890
|
+
var _a, _b;
|
|
891
|
+
//look for auto-filled input values
|
|
892
|
+
(_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
|
|
893
|
+
if (input.value !== undefined &&
|
|
894
|
+
Object.hasOwn(editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache, input.name)) {
|
|
895
|
+
// @ts-ignore
|
|
896
|
+
editingRow._valuesCache[input.name] = input.value;
|
|
897
|
+
}
|
|
898
|
+
});
|
|
900
899
|
onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
|
|
900
|
+
exitEditingMode: () => setEditingRow(null),
|
|
901
901
|
row: editingRow !== null && editingRow !== void 0 ? editingRow : row,
|
|
902
902
|
table,
|
|
903
|
-
values: (
|
|
903
|
+
values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
|
|
904
904
|
});
|
|
905
|
-
setEditingRow(null);
|
|
906
905
|
};
|
|
907
906
|
return (React__default["default"].createElement(material.Box, { sx: { display: 'flex', gap: '0.75rem' } }, variant === 'icon' ? (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
908
907
|
React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.cancel },
|
|
@@ -973,7 +972,7 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
|
973
972
|
|
|
974
973
|
const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
975
974
|
var _a;
|
|
976
|
-
const { getState, setGlobalFilter, options: { enableGlobalFilterChangeMode, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps,
|
|
975
|
+
const { getState, setGlobalFilter, options: { enableGlobalFilterChangeMode, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
|
977
976
|
const { globalFilter, showGlobalFilter } = getState();
|
|
978
977
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
979
978
|
const [searchValue, setSearchValue] = React.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
|
@@ -996,7 +995,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
996
995
|
? muiSearchTextFieldProps({ table })
|
|
997
996
|
: muiSearchTextFieldProps;
|
|
998
997
|
return (React__default["default"].createElement(material.Collapse, { in: showGlobalFilter, orientation: "horizontal" },
|
|
999
|
-
React__default["default"].createElement(material.TextField, Object.assign({
|
|
998
|
+
React__default["default"].createElement(material.TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
|
1000
999
|
startAdornment: enableGlobalFilterChangeMode ? (React__default["default"].createElement(material.InputAdornment, { position: "start" },
|
|
1001
1000
|
React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.changeSearchMode },
|
|
1002
1001
|
React__default["default"].createElement(material.IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
|
|
@@ -1006,7 +1005,12 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1006
1005
|
React__default["default"].createElement("span", null,
|
|
1007
1006
|
React__default["default"].createElement(material.IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small" },
|
|
1008
1007
|
React__default["default"].createElement(CloseIcon, null)))))),
|
|
1009
|
-
} }, textFieldProps)
|
|
1008
|
+
} }, textFieldProps, { inputRef: (inputRef) => {
|
|
1009
|
+
searchInputRef.current = inputRef;
|
|
1010
|
+
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
|
1011
|
+
textFieldProps.inputRef = inputRef;
|
|
1012
|
+
}
|
|
1013
|
+
} })),
|
|
1010
1014
|
React__default["default"].createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
|
|
1011
1015
|
};
|
|
1012
1016
|
|
|
@@ -1131,18 +1135,11 @@ const MRT_ToggleFiltersButton = (_a) => {
|
|
|
1131
1135
|
|
|
1132
1136
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
1133
1137
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
1134
|
-
const { getState, options: { icons: { SearchIcon, SearchOffIcon },
|
|
1138
|
+
const { getState, options: { icons: { SearchIcon, SearchOffIcon }, localization, }, refs: { searchInputRef }, setShowGlobalFilter, } = table;
|
|
1135
1139
|
const { showGlobalFilter } = getState();
|
|
1136
|
-
const textFieldProps = muiSearchTextFieldProps instanceof Function
|
|
1137
|
-
? muiSearchTextFieldProps({ table })
|
|
1138
|
-
: muiSearchTextFieldProps;
|
|
1139
1140
|
const handleToggleSearch = () => {
|
|
1140
1141
|
setShowGlobalFilter(!showGlobalFilter);
|
|
1141
|
-
|
|
1142
|
-
var _a, _b;
|
|
1143
|
-
return (_b = document
|
|
1144
|
-
.getElementById((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.id) !== null && _a !== void 0 ? _a : `mrt-${tableId}-search-text-field`)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1145
|
-
}, 200);
|
|
1142
|
+
queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
1146
1143
|
};
|
|
1147
1144
|
return (React__default["default"].createElement(material.Tooltip, { arrow: true, title: localization.showHideSearch },
|
|
1148
1145
|
React__default["default"].createElement(material.IconButton, Object.assign({ onClick: handleToggleSearch }, rest), showGlobalFilter ? React__default["default"].createElement(SearchOffIcon, null) : React__default["default"].createElement(SearchIcon, null))));
|
|
@@ -1201,14 +1198,20 @@ const commonToolbarStyles = ({ theme }) => ({
|
|
|
1201
1198
|
});
|
|
1202
1199
|
const MRT_TopToolbar = ({ table }) => {
|
|
1203
1200
|
var _a;
|
|
1204
|
-
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTableTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions,
|
|
1201
|
+
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTableTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
|
|
1205
1202
|
const { isFullScreen, showGlobalFilter } = getState();
|
|
1206
1203
|
const isMobile = material.useMediaQuery('(max-width:720px)');
|
|
1207
1204
|
const toolbarProps = muiTableTopToolbarProps instanceof Function
|
|
1208
1205
|
? muiTableTopToolbarProps({ table })
|
|
1209
1206
|
: muiTableTopToolbarProps;
|
|
1210
1207
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
|
1211
|
-
return (React__default["default"].createElement(material.Toolbar, Object.assign({
|
|
1208
|
+
return (React__default["default"].createElement(material.Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
|
1209
|
+
topToolbarRef.current = ref;
|
|
1210
|
+
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
|
1211
|
+
// @ts-ignore
|
|
1212
|
+
toolbarProps.ref.current = ref;
|
|
1213
|
+
}
|
|
1214
|
+
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
|
1212
1215
|
? toolbarProps.sx(theme)
|
|
1213
1216
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1214
1217
|
positionToolbarAlertBanner === 'top' && (React__default["default"].createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
|
@@ -1233,14 +1236,20 @@ const MRT_TopToolbar = ({ table }) => {
|
|
|
1233
1236
|
};
|
|
1234
1237
|
|
|
1235
1238
|
const MRT_BottomToolbar = ({ table }) => {
|
|
1236
|
-
const { getState, options: { enablePagination, muiTableBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions,
|
|
1239
|
+
const { getState, options: { enablePagination, muiTableBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
|
|
1237
1240
|
const { isFullScreen } = getState();
|
|
1238
1241
|
const isMobile = material.useMediaQuery('(max-width:720px)');
|
|
1239
1242
|
const toolbarProps = muiTableBottomToolbarProps instanceof Function
|
|
1240
1243
|
? muiTableBottomToolbarProps({ table })
|
|
1241
1244
|
: muiTableBottomToolbarProps;
|
|
1242
1245
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
|
1243
|
-
return (React__default["default"].createElement(material.Toolbar, Object.assign({
|
|
1246
|
+
return (React__default["default"].createElement(material.Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
|
1247
|
+
bottomToolbarRef.current = ref;
|
|
1248
|
+
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
|
1249
|
+
// @ts-ignore
|
|
1250
|
+
toolbarProps.ref.current = ref;
|
|
1251
|
+
}
|
|
1252
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `-3px 0 6px ${material.alpha(theme.palette.common.black, 0.1)}`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
|
1244
1253
|
? toolbarProps.sx(theme)
|
|
1245
1254
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1246
1255
|
React__default["default"].createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
|
@@ -1295,7 +1304,7 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
|
1295
1304
|
|
|
1296
1305
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1297
1306
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1298
|
-
const { getState, options: { enableColumnFilterChangeMode, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, muiTableHeadCellFilterTextFieldProps,
|
|
1307
|
+
const { getState, options: { enableColumnFilterChangeMode, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, muiTableHeadCellFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
|
1299
1308
|
const { column } = header;
|
|
1300
1309
|
const { columnDef } = column;
|
|
1301
1310
|
const { columnFilterFns } = getState();
|
|
@@ -1320,7 +1329,6 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1320
1329
|
const isTextboxFilter = columnDef.filterVariant === 'text' ||
|
|
1321
1330
|
(!isSelectFilter && !isMultiSelectFilter);
|
|
1322
1331
|
const currentFilterOption = columnFilterFns === null || columnFilterFns === void 0 ? void 0 : columnFilterFns[header.id];
|
|
1323
|
-
const filterId = `mrt-${tableId}-${header.id}-filter-text-field${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : ''}`;
|
|
1324
1332
|
const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
|
|
1325
1333
|
? //@ts-ignore
|
|
1326
1334
|
localization[`filter${((_b = (_a = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _a === void 0 ? void 0 : _a.call(currentFilterOption, 0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) +
|
|
@@ -1397,14 +1405,14 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1397
1405
|
return React__default["default"].createElement(React__default["default"].Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
|
|
1398
1406
|
}
|
|
1399
1407
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1400
|
-
React__default["default"].createElement(material.TextField, Object.assign({ fullWidth: true,
|
|
1408
|
+
React__default["default"].createElement(material.TextField, Object.assign({ fullWidth: true, inputProps: {
|
|
1401
1409
|
disabled: !!filterChipLabel,
|
|
1402
1410
|
sx: {
|
|
1403
1411
|
textOverflow: 'ellipsis',
|
|
1404
1412
|
width: filterChipLabel ? 0 : undefined,
|
|
1405
1413
|
},
|
|
1406
1414
|
title: filterPlaceholder,
|
|
1407
|
-
}, helperText: showChangeModeButton ? (React__default["default"].createElement("label",
|
|
1415
|
+
}, helperText: showChangeModeButton ? (React__default["default"].createElement("label", null, localization.filterMode.replace('{filterType}',
|
|
1408
1416
|
// @ts-ignore
|
|
1409
1417
|
localization[`filter${((_f = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _f === void 0 ? void 0 : _f.toUpperCase()) +
|
|
1410
1418
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
|
|
@@ -1436,7 +1444,13 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1436
1444
|
renderValue: isMultiSelectFilter
|
|
1437
1445
|
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (React__default["default"].createElement(material.Box, { sx: { opacity: 0.5 } }, filterPlaceholder)) : (React__default["default"].createElement(material.Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' } }, selected === null || selected === void 0 ? void 0 : selected.map((value) => (React__default["default"].createElement(material.Chip, { key: value, label: value })))))
|
|
1438
1446
|
: undefined,
|
|
1439
|
-
} }, textFieldProps, {
|
|
1447
|
+
} }, textFieldProps, { inputRef: (inputRef) => {
|
|
1448
|
+
filterInputRefs.current[`${column.id}-${rangeFilterIndex !== null && rangeFilterIndex !== void 0 ? rangeFilterIndex : 0}`] =
|
|
1449
|
+
inputRef;
|
|
1450
|
+
if (textFieldProps.inputRef) {
|
|
1451
|
+
textFieldProps.inputRef = inputRef;
|
|
1452
|
+
}
|
|
1453
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '6rem' : 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1440
1454
|
mr: '1.5rem',
|
|
1441
1455
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1442
1456
|
? textFieldProps.sx(theme)
|
|
@@ -1750,17 +1764,19 @@ const MRT_TableHead = ({ table }) => {
|
|
|
1750
1764
|
|
|
1751
1765
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
1752
1766
|
var _a;
|
|
1753
|
-
const { getState, options: {
|
|
1754
|
-
const { column } = cell;
|
|
1767
|
+
const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
|
|
1768
|
+
const { column, row } = cell;
|
|
1755
1769
|
const { columnDef } = column;
|
|
1756
1770
|
const { editingRow } = getState();
|
|
1757
1771
|
const [value, setValue] = React.useState(() => cell.getValue());
|
|
1758
1772
|
const mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function
|
|
1759
|
-
? muiTableBodyCellEditTextFieldProps({ cell, table })
|
|
1773
|
+
? muiTableBodyCellEditTextFieldProps({ cell, column, row, table })
|
|
1760
1774
|
: muiTableBodyCellEditTextFieldProps;
|
|
1761
1775
|
const mcTableBodyCellEditTextFieldProps = columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
|
|
1762
1776
|
? columnDef.muiTableBodyCellEditTextFieldProps({
|
|
1763
1777
|
cell,
|
|
1778
|
+
column,
|
|
1779
|
+
row,
|
|
1764
1780
|
table,
|
|
1765
1781
|
})
|
|
1766
1782
|
: columnDef.muiTableBodyCellEditTextFieldProps;
|
|
@@ -1779,14 +1795,21 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
|
1779
1795
|
setEditingCell(null);
|
|
1780
1796
|
};
|
|
1781
1797
|
if (columnDef.Edit) {
|
|
1782
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, table }));
|
|
1798
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }));
|
|
1783
1799
|
}
|
|
1784
|
-
return (React__default["default"].createElement(material.TextField, Object.assign({ disabled: columnDef.enableEditing === false, fullWidth: true,
|
|
1800
|
+
return (React__default["default"].createElement(material.TextField, Object.assign({ disabled: columnDef.enableEditing === false, fullWidth: true, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: cell.id, onClick: (e) => e.stopPropagation(), placeholder: columnDef.header, value: value, variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
|
|
1801
|
+
if (inputRef) {
|
|
1802
|
+
editInputRefs.current[column.id] = inputRef;
|
|
1803
|
+
if (textFieldProps.inputRef) {
|
|
1804
|
+
textFieldProps.inputRef = inputRef;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}, onBlur: handleBlur, onChange: handleChange })));
|
|
1785
1808
|
};
|
|
1786
1809
|
|
|
1787
1810
|
const MRT_CopyButton = ({ cell, children, table }) => {
|
|
1788
1811
|
const { options: { localization, muiTableBodyCellCopyButtonProps }, } = table;
|
|
1789
|
-
const { column } = cell;
|
|
1812
|
+
const { column, row } = cell;
|
|
1790
1813
|
const { columnDef } = column;
|
|
1791
1814
|
const [copied, setCopied] = React.useState(false);
|
|
1792
1815
|
const handleCopy = (text) => {
|
|
@@ -1795,7 +1818,7 @@ const MRT_CopyButton = ({ cell, children, table }) => {
|
|
|
1795
1818
|
setTimeout(() => setCopied(false), 4000);
|
|
1796
1819
|
};
|
|
1797
1820
|
const mTableBodyCellCopyButtonProps = muiTableBodyCellCopyButtonProps instanceof Function
|
|
1798
|
-
? muiTableBodyCellCopyButtonProps({ cell, table })
|
|
1821
|
+
? muiTableBodyCellCopyButtonProps({ cell, column, row, table })
|
|
1799
1822
|
: muiTableBodyCellCopyButtonProps;
|
|
1800
1823
|
const mcTableBodyCellCopyButtonProps = columnDef.muiTableBodyCellCopyButtonProps instanceof Function
|
|
1801
1824
|
? columnDef.muiTableBodyCellCopyButtonProps({
|
|
@@ -1812,12 +1835,13 @@ const MRT_CopyButton = ({ cell, children, table }) => {
|
|
|
1812
1835
|
|
|
1813
1836
|
const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
1814
1837
|
const { options: { muiTableBodyRowDragHandleProps, onRowDrop }, } = table;
|
|
1838
|
+
const { row } = cell;
|
|
1815
1839
|
const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
|
|
1816
|
-
? muiTableBodyRowDragHandleProps({ row
|
|
1840
|
+
? muiTableBodyRowDragHandleProps({ row, table })
|
|
1817
1841
|
: muiTableBodyRowDragHandleProps;
|
|
1818
1842
|
const handleDragStart = (e) => {
|
|
1819
1843
|
e.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
|
1820
|
-
table.setDraggingRow(
|
|
1844
|
+
table.setDraggingRow(row);
|
|
1821
1845
|
};
|
|
1822
1846
|
const handleDragEnd = (event) => {
|
|
1823
1847
|
onRowDrop === null || onRowDrop === void 0 ? void 0 : onRowDrop({
|
|
@@ -1834,13 +1858,13 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
|
1834
1858
|
const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
1835
1859
|
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
1836
1860
|
const theme = material.useTheme();
|
|
1837
|
-
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode,
|
|
1861
|
+
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enablePagination, enableRowNumbers, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
|
1838
1862
|
const { draggingColumn, editingCell, editingRow, hoveredColumn, density, isLoading, showSkeletons, } = getState();
|
|
1839
1863
|
const { column, row } = cell;
|
|
1840
1864
|
const { columnDef } = column;
|
|
1841
1865
|
const { columnDefType } = columnDef;
|
|
1842
1866
|
const mTableCellBodyProps = muiTableBodyCellProps instanceof Function
|
|
1843
|
-
? muiTableBodyCellProps({ cell, table })
|
|
1867
|
+
? muiTableBodyCellProps({ cell, column, row, table })
|
|
1844
1868
|
: muiTableBodyCellProps;
|
|
1845
1869
|
const mcTableCellBodyProps = columnDef.muiTableBodyCellProps instanceof Function
|
|
1846
1870
|
? columnDef.muiTableBodyCellProps({ cell, table })
|
|
@@ -1865,13 +1889,13 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
1865
1889
|
columnDef.enableEditing !== false &&
|
|
1866
1890
|
editingMode === 'cell') {
|
|
1867
1891
|
setEditingCell(cell);
|
|
1868
|
-
|
|
1869
|
-
const textField =
|
|
1892
|
+
queueMicrotask(() => {
|
|
1893
|
+
const textField = editInputRefs.current[column.id];
|
|
1870
1894
|
if (textField) {
|
|
1871
1895
|
textField.focus();
|
|
1872
1896
|
textField.select();
|
|
1873
1897
|
}
|
|
1874
|
-
}
|
|
1898
|
+
});
|
|
1875
1899
|
}
|
|
1876
1900
|
};
|
|
1877
1901
|
const getIsLastLeftPinnedColumn = () => {
|
|
@@ -1961,19 +1985,19 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
1961
1985
|
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React__default["default"].createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
|
1962
1986
|
(column.id === 'mrt-row-select' ||
|
|
1963
1987
|
column.id === 'mrt-row-expand' ||
|
|
1964
|
-
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, table })) : isEditing ? (React__default["default"].createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
|
1988
|
+
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (React__default["default"].createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
|
1965
1989
|
columnDef.enableClickToCopy !== false ? (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1966
1990
|
React__default["default"].createElement(MRT_CopyButton, { cell: cell, table: table },
|
|
1967
1991
|
React__default["default"].createElement(React__default["default"].Fragment, null, row.getIsGrouped() && !cell.getIsGrouped()
|
|
1968
1992
|
? null
|
|
1969
|
-
: (_c = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, table })) !== null && _c !== void 0 ? _c : cell.renderValue())),
|
|
1993
|
+
: (_c = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, row, table })) !== null && _c !== void 0 ? _c : cell.renderValue())),
|
|
1970
1994
|
cell.getIsGrouped() && React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1971
1995
|
" (", (_d = row.subRows) === null || _d === void 0 ? void 0 :
|
|
1972
1996
|
_d.length,
|
|
1973
1997
|
")"))) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1974
1998
|
row.getIsGrouped() && !cell.getIsGrouped()
|
|
1975
1999
|
? null
|
|
1976
|
-
: (_g = (_f = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _f === void 0 ? void 0 : _f.call(columnDef, { cell, column, table })) !== null && _g !== void 0 ? _g : cell.renderValue(),
|
|
2000
|
+
: (_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(),
|
|
1977
2001
|
cell.getIsGrouped() && React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1978
2002
|
" (", (_j = (_h = row.subRows) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : '',
|
|
1979
2003
|
")"))))));
|
|
@@ -2026,7 +2050,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
|
|
|
2026
2050
|
: undefined,
|
|
2027
2051
|
} }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
|
2028
2052
|
? tableRowProps.sx(theme)
|
|
2029
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)), draggingBorders)) }), (_b = (_a = row === null || row === void 0 ? void 0 : row.getVisibleCells()) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (cell) => (React__default["default"].createElement(MRT_TableBodyCell, { cell: cell,
|
|
2053
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)), draggingBorders)) }), (_b = (_a = row === null || row === void 0 ? void 0 : row.getVisibleCells()) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (cell) => (React__default["default"].createElement(MRT_TableBodyCell, { cell: cell, enableHover: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false, key: cell.id, rowIndex: rowIndex, rowRef: rowRef, table: table })))),
|
|
2030
2054
|
renderDetailPanel && !row.getIsGrouped() && (React__default["default"].createElement(MRT_TableDetailPanel, { row: row, table: table }))));
|
|
2031
2055
|
};
|
|
2032
2056
|
|
|
@@ -2174,25 +2198,29 @@ const MRT_Table = ({ tableContainerRef, table }) => {
|
|
|
2174
2198
|
|
|
2175
2199
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
2176
2200
|
const MRT_TableContainer = ({ table }) => {
|
|
2177
|
-
|
|
2178
|
-
const { getState, options: { enableStickyHeader, enableRowVirtualization, muiTableContainerProps, tableId, }, } = table;
|
|
2201
|
+
const { getState, options: { enableStickyHeader, enableRowVirtualization, muiTableContainerProps, }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
|
|
2179
2202
|
const { isFullScreen } = getState();
|
|
2180
2203
|
const [totalToolbarHeight, setTotalToolbarHeight] = React.useState(0);
|
|
2181
2204
|
const tableContainerProps = muiTableContainerProps instanceof Function
|
|
2182
2205
|
? muiTableContainerProps({ table })
|
|
2183
2206
|
: muiTableContainerProps;
|
|
2184
|
-
const tableContainerRef = (_a = tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) !== null && _a !== void 0 ? _a : React.useRef(null);
|
|
2185
2207
|
useIsomorphicLayoutEffect(() => {
|
|
2186
2208
|
var _a, _b, _c, _d;
|
|
2187
2209
|
const topToolbarHeight = typeof document !== 'undefined'
|
|
2188
|
-
? (_b = (_a =
|
|
2210
|
+
? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
|
|
2189
2211
|
: 0;
|
|
2190
2212
|
const bottomToolbarHeight = typeof document !== 'undefined'
|
|
2191
|
-
? (_d = (_c =
|
|
2213
|
+
? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
|
|
2192
2214
|
: 0;
|
|
2193
2215
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
|
2194
2216
|
});
|
|
2195
|
-
return (React__default["default"].createElement(material.TableContainer, Object.assign({
|
|
2217
|
+
return (React__default["default"].createElement(material.TableContainer, Object.assign({}, tableContainerProps, { ref: (ref) => {
|
|
2218
|
+
tableContainerRef.current = ref;
|
|
2219
|
+
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
|
2220
|
+
//@ts-ignore
|
|
2221
|
+
tableContainerProps.ref.current = ref;
|
|
2222
|
+
}
|
|
2223
|
+
}, sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader || enableRowVirtualization
|
|
2196
2224
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
|
2197
2225
|
: undefined, overflow: 'auto' }, ((tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx) instanceof Function
|
|
2198
2226
|
? tableContainerProps.sx(theme)
|
|
@@ -2229,22 +2257,27 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
|
2229
2257
|
return (React__default["default"].createElement(material.Dialog, { open: open },
|
|
2230
2258
|
React__default["default"].createElement(material.DialogTitle, { textAlign: "center" }, localization.edit),
|
|
2231
2259
|
React__default["default"].createElement(material.DialogContent, null,
|
|
2232
|
-
React__default["default"].createElement(
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2260
|
+
React__default["default"].createElement("form", { onSubmit: (e) => e.preventDefault() },
|
|
2261
|
+
React__default["default"].createElement(material.Stack, { sx: {
|
|
2262
|
+
width: '100%',
|
|
2263
|
+
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
|
2264
|
+
gap: '1.5rem',
|
|
2265
|
+
} }, row
|
|
2266
|
+
.getAllCells()
|
|
2267
|
+
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
|
2268
|
+
.map((cell) => (React__default["default"].createElement(MRT_EditCellTextField, { cell: cell, key: cell.id, showLabel: true, table: table })))))),
|
|
2240
2269
|
React__default["default"].createElement(material.DialogActions, { sx: { p: '1.25rem' } },
|
|
2241
2270
|
React__default["default"].createElement(MRT_EditActionButtons, { row: row, table: table, variant: "text" }))));
|
|
2242
2271
|
};
|
|
2243
2272
|
|
|
2244
2273
|
const MRT_TableRoot = (props) => {
|
|
2245
2274
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
2246
|
-
const
|
|
2247
|
-
|
|
2275
|
+
const bottomToolbarRef = React.useRef(null);
|
|
2276
|
+
const editInputRefs = React.useRef({});
|
|
2277
|
+
const filterInputRefs = React.useRef({});
|
|
2278
|
+
const searchInputRef = React.useRef(null);
|
|
2279
|
+
const tableContainerRef = React.useRef(null);
|
|
2280
|
+
const topToolbarRef = React.useRef(null);
|
|
2248
2281
|
const initialState = React.useMemo(() => {
|
|
2249
2282
|
var _a, _b;
|
|
2250
2283
|
const initState = (_a = props.initialState) !== null && _a !== void 0 ? _a : {};
|
|
@@ -2281,10 +2314,10 @@ const MRT_TableRoot = (props) => {
|
|
|
2281
2314
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2282
2315
|
return [
|
|
2283
2316
|
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' }),
|
|
2284
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({
|
|
2285
|
-
columnOrder.includes('mrt-row-expand') && Object.assign(Object.assign(Object.assign({ Cell: ({
|
|
2286
|
-
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({
|
|
2287
|
-
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({
|
|
2317
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].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' }),
|
|
2318
|
+
columnOrder.includes('mrt-row-expand') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React__default["default"].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' }),
|
|
2319
|
+
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default["default"].createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React__default["default"].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' }),
|
|
2320
|
+
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => { var _a; return (_a = props.localization) === null || _a === void 0 ? void 0 : _a.rowNumber; }, header: (_j = props.localization) === null || _j === void 0 ? void 0 : _j.rowNumbers, size: 60 }, defaultDisplayColumnDefOptions), (_k = props.displayColumnDefOptions) === null || _k === void 0 ? void 0 : _k['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
|
2288
2321
|
].filter(Boolean);
|
|
2289
2322
|
}, [
|
|
2290
2323
|
columnOrder,
|
|
@@ -2338,7 +2371,14 @@ const MRT_TableRoot = (props) => {
|
|
|
2338
2371
|
isFullScreen,
|
|
2339
2372
|
showAlertBanner,
|
|
2340
2373
|
showColumnFilters,
|
|
2341
|
-
showGlobalFilter }, props.state)
|
|
2374
|
+
showGlobalFilter }, props.state) }))), { refs: {
|
|
2375
|
+
bottomToolbarRef,
|
|
2376
|
+
editInputRefs,
|
|
2377
|
+
filterInputRefs,
|
|
2378
|
+
searchInputRef,
|
|
2379
|
+
tableContainerRef,
|
|
2380
|
+
topToolbarRef,
|
|
2381
|
+
}, setColumnFilterFns: (_v = props.onFilterFnsChange) !== null && _v !== void 0 ? _v : setColumnFilterFns, setDensity: (_w = props.onDensityChange) !== null && _w !== void 0 ? _w : setDensity, setDraggingColumn: (_x = props.onDraggingColumnChange) !== null && _x !== void 0 ? _x : setDraggingColumn, setDraggingRow: (_y = props.onDraggingRowChange) !== null && _y !== void 0 ? _y : setDraggingRow, setEditingCell: (_z = props.onEditingCellChange) !== null && _z !== void 0 ? _z : setEditingCell, setEditingRow: (_0 = props.onEditingRowChange) !== null && _0 !== void 0 ? _0 : setEditingRow, setGlobalFilterFn: (_1 = props.onGlobalFilterFnChange) !== null && _1 !== void 0 ? _1 : setGlobalFilterFn, setHoveredColumn: (_2 = props.onHoveredColumnChange) !== null && _2 !== void 0 ? _2 : setHoveredColumn, setHoveredRow: (_3 = props.onHoveredRowChange) !== null && _3 !== void 0 ? _3 : setHoveredRow, setIsFullScreen: (_4 = props.onIsFullScreenChange) !== null && _4 !== void 0 ? _4 : setIsFullScreen, setShowAlertBanner: (_5 = props.onShowAlertBannerChange) !== null && _5 !== void 0 ? _5 : setShowAlertBanner, setShowFilters: (_6 = props.onShowFiltersChange) !== null && _6 !== void 0 ? _6 : setShowFilters, setShowGlobalFilter: (_7 = props.onShowGlobalFilterChange) !== null && _7 !== void 0 ? _7 : setShowGlobalFilter });
|
|
2342
2382
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2343
2383
|
React__default["default"].createElement(material.Dialog, { PaperComponent: material.Box, TransitionComponent: material.Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
|
|
2344
2384
|
React__default["default"].createElement(MRT_TablePaper, { table: table })),
|
|
@@ -2347,7 +2387,7 @@ const MRT_TableRoot = (props) => {
|
|
|
2347
2387
|
};
|
|
2348
2388
|
|
|
2349
2389
|
var MaterialReactTable = (_a) => {
|
|
2350
|
-
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, editingMode = '
|
|
2390
|
+
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilterChangeMode = false, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterChangeMode = false, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, localization, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'all', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilterChangeMode", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterChangeMode", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "localization", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
|
2351
2391
|
return (React__default["default"].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)));
|
|
2352
2392
|
};
|
|
2353
2393
|
|