>
);
};
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,
/** Tell when context menu was render with backdrop */
withBackdrop: PropTypes.bool,
/** Base zIndex value to use in layering */
autoZIndex: PropTypes.bool,
/** Whether to automatically manage layering */
baseZIndex: PropTypes.number,
/** DOM element instance where the menu should be mounted */
appendTo: PropTypes.any,
/** Callback to invoke when a popup menu is shown */
onShow: PropTypes.func,
/** Callback to invoke when a popup menu is hidden */
onHide: PropTypes.func,
/** If you want to display relative to another component */
containerRef: PropTypes.any,
/** Scale with by container component*/
scaled: PropTypes.bool,
/** If you want to fill icons with default colors or not */
fillIcon: PropTypes.bool,
getContextModel: PropTypes.func,
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 ContextMenu;