@dooherceg/material-react-table 3.2.10 → 3.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1679,7 +1679,13 @@ const MRT_ExpandAllButton = (_a) => {
1679
1679
  table,
1680
1680
  })), rest);
1681
1681
  const isAllRowsExpanded = getIsAllRowsExpanded();
1682
- return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : (isAllRowsExpanded ? localization.collapseAll : localization.expandAll), children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_c = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _c !== void 0 ? _c : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
1682
+ const handleToggleExpandAll = (event) => {
1683
+ var _a;
1684
+ event.stopPropagation();
1685
+ toggleAllRowsExpanded(!isAllRowsExpanded);
1686
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1687
+ };
1688
+ return (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : (isAllRowsExpanded ? localization.collapseAll : localization.expandAll), children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()) }, iconButtonProps, { onClick: handleToggleExpandAll, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_c = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _c !== void 0 ? _c : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
1683
1689
  transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
1684
1690
  transition: 'transform 150ms',
1685
1691
  } })) })) }) })));
@@ -1722,18 +1728,29 @@ const MRT_ExpandButton = ({ row, staticRowIndex, table, }) => {
1722
1728
  const INSERT_HERE_TOOLTIP = 'Insert here';
1723
1729
  const ACTION_ICON_SIZE$1 = 'small';
1724
1730
  const MRT_InsertHereAction = ({ onClick, }) => {
1725
- return (jsxRuntime.jsx(Tooltip, { title: INSERT_HERE_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: onClick, size: ACTION_ICON_SIZE$1, children: jsxRuntime.jsx(SubdirectoryArrowLeftIcon, { color: "warning" }) }) }));
1731
+ const handleClick = (event) => {
1732
+ event.stopPropagation();
1733
+ onClick();
1734
+ };
1735
+ return (jsxRuntime.jsx(Tooltip, { title: INSERT_HERE_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: handleClick, size: ACTION_ICON_SIZE$1, children: jsxRuntime.jsx(SubdirectoryArrowLeftIcon, { color: "warning" }) }) }));
1726
1736
  };
1727
1737
 
1728
1738
  const MOVE_TO_TOP_TOOLTIP = 'Move to top level';
1729
1739
  const ACTION_ICON_SIZE = 'small';
1730
1740
  const ACTION_BUTTON_HEIGHT = '1.75rem';
1731
1741
  const MRT_MoveToTopAction = ({ onClick }) => {
1732
- return (jsxRuntime.jsx(Tooltip, { title: MOVE_TO_TOP_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: onClick, size: ACTION_ICON_SIZE, sx: { height: ACTION_BUTTON_HEIGHT }, children: jsxRuntime.jsx(VerticalAlignTopIcon, { fontSize: "small" }) }) }));
1742
+ const handleClick = (event) => {
1743
+ event.stopPropagation();
1744
+ onClick();
1745
+ };
1746
+ return (jsxRuntime.jsx(Tooltip, { title: MOVE_TO_TOP_TOOLTIP, disableInteractive: true, children: jsxRuntime.jsx(IconButton, { onClick: handleClick, size: ACTION_ICON_SIZE, sx: { height: ACTION_BUTTON_HEIGHT }, children: jsxRuntime.jsx(VerticalAlignTopIcon, { fontSize: "small" }) }) }));
1733
1747
  };
1734
1748
 
1735
1749
  const MRT_ReorderRowCheckbox = ({ onChange, isSelected, }) => {
1736
- return (jsxRuntime.jsx(Checkbox, { checked: isSelected, color: "warning", disableRipple: true, onChange: onChange, sx: {
1750
+ const handleClick = (event) => {
1751
+ event.stopPropagation();
1752
+ };
1753
+ return (jsxRuntime.jsx(Checkbox, { checked: isSelected, color: "warning", disableRipple: true, onChange: onChange, onClick: handleClick, sx: {
1737
1754
  color: (theme) => theme.palette.warning.main,
1738
1755
  '&.Mui-checked': {
1739
1756
  color: (theme) => theme.palette.warning.main,
@@ -2004,7 +2021,7 @@ const getMRT_RowExpandColumnDef = (tableOptions) => {
2004
2021
  });
2005
2022
  if (groupedColumnMode === 'remove' && row.groupingColumnId) {
2006
2023
  const defaultGroupedCell = (jsxRuntime.jsx(Tooltip, Object.assign({}, getCommonTooltipProps('right'), { title: table.getColumn(row.groupingColumnId).columnDef.header, children: jsxRuntime.jsx("span", { children: row.groupingValue }) })));
2007
- return (jsxRuntime.jsxs(Stack, { alignItems: "center", flexDirection: "row", gap: TREE_REORDER_ICON_SPACING, onMouseEnter: cellLogic.handleRowHoverEnter, onMouseLeave: cellLogic.handleRowHoverLeave, width: "100%", children: [jsxRuntime.jsx(MRT_ExpandButton, Object.assign({}, expandButtonProps)), column.columnDef.GroupedCell
2024
+ return (jsxRuntime.jsxs(Stack, { alignItems: "center", flexDirection: "row", gap: TREE_REORDER_ICON_SPACING, onMouseEnter: cellLogic.handleRowHoverEnter, onMouseLeave: cellLogic.handleRowHoverLeave, children: [jsxRuntime.jsx(MRT_ExpandButton, Object.assign({}, expandButtonProps)), column.columnDef.GroupedCell
2008
2025
  ? customGroupedCell
2009
2026
  : defaultGroupedCell, cellLogic.shouldShowReorderCheckbox && (jsxRuntime.jsx(MRT_ReorderRowCheckbox, { isSelected: cellLogic.isReorderCheckboxSelected, onChange: cellLogic.handleReorderCheckboxChange })), cellLogic.shouldShowInsertHereAction && (jsxRuntime.jsx(MRT_InsertHereAction, { onClick: cellLogic.handleInsertHereActionClick })), !!subRowsLength && jsxRuntime.jsxs("span", { children: ["(", subRowsLength, ")"] })] }));
2010
2027
  }
@@ -6321,15 +6338,19 @@ const MRT_SavedFiltersButton = ({ onSelectFilter, table, }) => {
6321
6338
  };
6322
6339
 
6323
6340
  const MRT_NewEntryButton = (_a) => {
6324
- var _b;
6341
+ var _b, _c;
6325
6342
  var { table } = _a, rest = __rest(_a, ["table"]);
6326
- const { options: { icons: { AddIcon }, localization, }, setNewEntryModal, } = table;
6343
+ const { options: { icons: { AddIcon }, localization, newEntryButtonProps, }, setNewEntryModal, } = table;
6327
6344
  const handleOpenNewEntryModal = (event) => {
6328
6345
  // Prevent bubbling to muiTableBodyRowProps onClick (row click handlers)
6329
6346
  event.stopPropagation();
6330
6347
  setNewEntryModal({ open: true });
6331
6348
  };
6332
- return (jsxRuntime.jsx(Tooltip, { title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.newEntry, children: jsxRuntime.jsx(Button, Object.assign({ "aria-label": localization.newEntry, onClick: handleOpenNewEntryModal, size: "small", startIcon: jsxRuntime.jsx(AddIcon, { fontSize: "small" }), variant: "text" }, rest, { title: undefined, children: localization.newEntry })) }));
6349
+ // When the consumer supplies onClick via newEntryButtonProps (or rest), it fully
6350
+ // replaces handleOpenNewEntryModal below — matches the override convention used by
6351
+ // every other mui*ButtonProps option in this codebase.
6352
+ const buttonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(newEntryButtonProps, { table })), rest);
6353
+ return (jsxRuntime.jsx(Tooltip, { title: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _b !== void 0 ? _b : localization.newEntry, children: jsxRuntime.jsx(Button, Object.assign({ "aria-label": localization.newEntry, onClick: handleOpenNewEntryModal, size: "small", startIcon: jsxRuntime.jsx(AddIcon, { fontSize: "small" }), variant: "text" }, buttonProps, { title: undefined, children: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.children) !== null && _c !== void 0 ? _c : localization.newEntry })) }));
6333
6354
  };
6334
6355
 
6335
6356
  const MRT_ShowHideColumnsMenuItems = (_a) => {