Files
madbase/control-plane-ui/node_modules/@mui/x-data-grid/modern/components/cell/GridActionsCellItem.js
Vlad Durnea cffdf8af86
Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
wip:milestone 0 fixes
2026-03-15 12:35:42 +02:00

73 lines
2.4 KiB
JavaScript

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["label", "icon", "showInMenu", "onClick"],
_excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
import * as React from 'react';
import PropTypes from 'prop-types';
import MenuItem from '@mui/material/MenuItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
const rootProps = useGridRootProps();
if (!props.showInMenu) {
const {
label,
icon,
onClick
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const handleClick = event => {
onClick?.(event);
};
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
ref: ref,
size: "small",
role: "menuitem",
"aria-label": label
}, other, {
onClick: handleClick
}, rootProps.slotProps?.baseIconButton, {
children: /*#__PURE__*/React.cloneElement(icon, {
fontSize: 'small'
})
}));
}
const {
label,
icon,
onClick,
closeMenuOnClick = true,
closeMenu
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded2);
const handleClick = event => {
onClick?.(event);
if (closeMenuOnClick) {
closeMenu?.();
}
};
return /*#__PURE__*/_jsxs(MenuItem, _extends({
ref: ref
}, other, {
onClick: handleClick,
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
children: icon
}), label]
}));
});
process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component
*/
component: PropTypes.elementType,
icon: PropTypes.element,
label: PropTypes.string.isRequired,
showInMenu: PropTypes.bool
} : void 0;
export { GridActionsCellItem };