From 7ec88553350b6ee81fcf866dd7b497b5b66c33bf Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:37:34 -0500 Subject: [PATCH] feat(labels): add prop to hide the context menu kebab --- packages/module/src/behavior/withContextMenu.tsx | 1 + packages/module/src/components/nodes/DefaultNode.tsx | 6 +++++- packages/module/src/components/nodes/labels/NodeLabel.tsx | 3 ++- packages/module/src/pipelines/components/nodes/TaskNode.tsx | 2 ++ packages/module/src/pipelines/components/nodes/TaskPill.tsx | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/module/src/behavior/withContextMenu.tsx b/packages/module/src/behavior/withContextMenu.tsx index c51884b..e1c7070 100644 --- a/packages/module/src/behavior/withContextMenu.tsx +++ b/packages/module/src/behavior/withContextMenu.tsx @@ -10,6 +10,7 @@ type Reference = React.ComponentProps['reference']; export interface WithContextMenuProps { onContextMenu?: (e: React.MouseEvent) => void; contextMenuOpen?: boolean; + hideContextMenuKebab?: boolean; } export const withContextMenu = diff --git a/packages/module/src/components/nodes/DefaultNode.tsx b/packages/module/src/components/nodes/DefaultNode.tsx index c342076..f22d167 100644 --- a/packages/module/src/components/nodes/DefaultNode.tsx +++ b/packages/module/src/components/nodes/DefaultNode.tsx @@ -118,6 +118,8 @@ interface DefaultNodeProps { 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 node */ + hideContextMenuKebab?: boolean; } const SCALE_UP_TIME = 200; @@ -166,7 +168,8 @@ const DefaultNodeInner: React.FunctionComponent = observe onHideCreateConnector, onShowCreateConnector, onContextMenu, - contextMenuOpen + contextMenuOpen, + hideContextMenuKebab }) => { const [hovered, hoverRef] = useHover(); const status = nodeStatus || element.getNodeStatus(); @@ -379,6 +382,7 @@ const DefaultNodeInner: React.FunctionComponent = observe badgeLocation={badgeLocation} onContextMenu={onContextMenu} contextMenuOpen={contextMenuOpen} + hideContextMenuKebab={hideContextMenuKebab} hover={isHover} labelIconClass={labelIconClass} labelIcon={labelIcon} diff --git a/packages/module/src/components/nodes/labels/NodeLabel.tsx b/packages/module/src/components/nodes/labels/NodeLabel.tsx index 0f5d0ca..dc8f922 100644 --- a/packages/module/src/components/nodes/labels/NodeLabel.tsx +++ b/packages/module/src/components/nodes/labels/NodeLabel.tsx @@ -77,6 +77,7 @@ const NodeLabel: React.FunctionComponent = ({ dropTarget, onContextMenu, contextMenuOpen, + hideContextMenuKebab, actionIcon, actionIconClassName, onActionIconClick, @@ -291,7 +292,7 @@ const NodeLabel: React.FunctionComponent = ({ /> )} - {textSize && onContextMenu && ( + {textSize && onContextMenu && !hideContextMenuKebab && ( <> void; /** Flag indicating that the context menu for the node is currently open */ contextMenuOpen?: boolean; + /** Hide context menu kebab for the node */ + hideContextMenuKebab?: boolean; /** Number of shadowed pills to show */ shadowCount?: number; /** Offset for each shadow */ diff --git a/packages/module/src/pipelines/components/nodes/TaskPill.tsx b/packages/module/src/pipelines/components/nodes/TaskPill.tsx index c2318db..012d97b 100644 --- a/packages/module/src/pipelines/components/nodes/TaskPill.tsx +++ b/packages/module/src/pipelines/components/nodes/TaskPill.tsx @@ -71,6 +71,7 @@ const TaskPill: React.FC = observer( hasWhenExpression = false, onContextMenu, contextMenuOpen, + hideContextMenuKebab, actionIcon, actionIconClassName, onActionIconClick, @@ -429,7 +430,7 @@ const TaskPill: React.FC = observer( /> )} - {textSize && onContextMenu && ( + {textSize && onContextMenu && !hideContextMenuKebab && ( <>