Skip to content

Commit

Permalink
feat(context menu): Add the hideContextMenuKebab option to groups
Browse files Browse the repository at this point in the history
add feature to topology package demo
  • Loading branch information
jenny-s51 committed Dec 4, 2024
1 parent aa149a6 commit 08d3811
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const DemoGroup: React.FunctionComponent<DemoGroupProps> = ({ element, onContext
return (
<DefaultGroup
{...rest}
onContextMenu={data.showContextMenu ? onContextMenu : undefined}
onContextMenu={options.contextMenus ? onContextMenu : undefined}
hideContextMenuKebab={options.hideKebabMenu}
element={element}
collapsible
collapsedWidth={DEFAULT_NODE_SIZE}
Expand Down
2 changes: 2 additions & 0 deletions packages/module/src/components/groups/DefaultGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ interface DefaultGroupProps {
onContextMenu?: (e: React.MouseEvent) => void;
/** Flag indicating that the context menu for the node is currently open */
contextMenuOpen?: boolean;
/** Hide context menu kebab for the group */
hideContextMenuKebab?: boolean;
/** Flag indicating whether to use hull layout or rect layout for expanded groups. Defaults to hull (true) */
hulledOutline?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type DefaultGroupCollapsedProps = {
label?: string; // Defaults to element.getLabel()
secondaryLabel?: string;
showLabel?: boolean; // Defaults to true
hideContextMenuKebab?: boolean;
labelPosition?: LabelPosition; // Defaults to bottom
truncateLength?: number; // Defaults to 13
labelIconClass?: string; // Icon to show in label
Expand Down Expand Up @@ -72,6 +73,7 @@ const DefaultGroupCollapsed: React.FunctionComponent<DefaultGroupCollapsedProps>
dropTarget,
onContextMenu,
contextMenuOpen,
hideContextMenuKebab,
dragging,
labelPosition,
badge,
Expand Down Expand Up @@ -174,6 +176,7 @@ const DefaultGroupCollapsed: React.FunctionComponent<DefaultGroupCollapsedProps>
labelIconPadding={labelIconPadding}
onContextMenu={onContextMenu}
contextMenuOpen={contextMenuOpen}
hideContextMenuKebab={hideContextMenuKebab}
hover={isHover || labelHover}
actionIcon={collapsible ? <ExpandIcon /> : undefined}
onActionIconClick={() => onCollapseChange(element, false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type DefaultGroupExpandedProps = {
secondaryLabel?: string;
showLabel?: boolean; // Defaults to true
showLabelOnHover?: boolean;
hideContextMenuKebab?: boolean;
truncateLength?: number; // Defaults to 13
badge?: string;
badgeColor?: string;
Expand Down Expand Up @@ -128,6 +129,7 @@ const DefaultGroupExpanded: React.FunctionComponent<DefaultGroupExpandedProps> =
dropTarget,
onContextMenu,
contextMenuOpen,
hideContextMenuKebab,
dragging,
dragNodeRef,
badge,
Expand Down Expand Up @@ -270,6 +272,7 @@ const DefaultGroupExpanded: React.FunctionComponent<DefaultGroupExpandedProps> =
labelIconPadding={labelIconPadding}
onContextMenu={onContextMenu}
contextMenuOpen={contextMenuOpen}
hideContextMenuKebab={hideContextMenuKebab}
hover={isHover || labelHover}
actionIcon={collapsible ? <CollapseIcon /> : undefined}
onActionIconClick={() => onCollapseChange(element, true)}
Expand Down

0 comments on commit 08d3811

Please sign in to comment.