>
);
};
render() {
const element = this.renderContextMenu();
return (
<>
{this.props.withBackdrop && (
)}
>
);
}
}
ContextMenu.propTypes = {
/** Unique identifier of the element */
id: PropTypes.string,
/** An array of menuitems */
model: PropTypes.array,
/** An object of header with icon and label */
header: PropTypes.object,
/** Inline style of the component */
style: PropTypes.object,
/** Style class of the component */
className: PropTypes.string,
/** Attaches the menu to document instead of a particular item */
global: PropTypes.bool,
/** Sets the context menu to be rendered with a backdrop */
withBackdrop: PropTypes.bool,
/** Sets zIndex layering value automatically */
autoZIndex: PropTypes.bool,
/** Sets automatic layering management */
baseZIndex: PropTypes.number,
/** DOM element instance where the menu is mounted */
appendTo: PropTypes.any,
/** Specifies a callback function that is invoked when a popup menu is shown */
onShow: PropTypes.func,
/** Specifies a callback function that is invoked when a popup menu is hidden */
onHide: PropTypes.func,
/** Displays a reference to another component */
containerRef: PropTypes.any,
/** Scales width by the container component */
scaled: PropTypes.bool,
/** Fills the icons with default colors */
fillIcon: PropTypes.bool,
/** Function that returns an object containing the elements of the context menu */
getContextModel: PropTypes.func,
/** Specifies the offset */
leftOffset: PropTypes.number,
};
ContextMenu.defaultProps = {
id: null,
style: null,
className: null,
global: false,
autoZIndex: true,
baseZIndex: 0,
appendTo: null,
onShow: null,
onHide: null,
scaled: false,
containerRef: null,
leftOffset: 0,
fillIcon: true,
};
export default withTheme(ContextMenu);