Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(context menu): Add the hideContextMenuKebab option to groups #261

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading