From 789171dbebf5eab4fc45dec6de0bd24f445c2c1f Mon Sep 17 00:00:00 2001 From: Kennedy Date: Wed, 16 Oct 2024 13:01:32 +0200 Subject: [PATCH 01/12] NO-ISSUE: Adding new SVGs to the new BPMN Editor --- packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx | 3 +++ packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index d32bf47c998..03ff2948e9f 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -53,10 +53,12 @@ export function NodeIcon({ nodeType }: { nodeType: BpmnNodeType }) { export function EventDefitnitionIcon({ variant, filled, + fill, stroke, }: { variant?: EventVariant; filled: boolean; + fill?: string; stroke: string; }) { const cx = nodeSvgProps.x + nodeSvgProps.width / 2; @@ -69,6 +71,7 @@ export function EventDefitnitionIcon({ {variant === "messageEventDefinition" && ( From 9488dca7812b5bc65004d52505768c3fe391f0a6 Mon Sep 17 00:00:00 2001 From: Kbowers <92726146+kbowers-ibm@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:27:59 +0200 Subject: [PATCH 02/12] NO-ISSUE: Adding new SVGS to the BPMN editor (#132) * NO-ISSUE: Adding new SVGs to the new BPMN Editor * fixing fill changes --- packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx | 3 --- packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index 03ff2948e9f..d32bf47c998 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -53,12 +53,10 @@ export function NodeIcon({ nodeType }: { nodeType: BpmnNodeType }) { export function EventDefitnitionIcon({ variant, filled, - fill, stroke, }: { variant?: EventVariant; filled: boolean; - fill?: string; stroke: string; }) { const cx = nodeSvgProps.x + nodeSvgProps.width / 2; @@ -71,7 +69,6 @@ export function EventDefitnitionIcon({ {variant === "messageEventDefinition" && ( From 4c99fed064c120a38d37a18cd9bb81f0ebb1b7e0 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Tue, 22 Oct 2024 11:14:10 +0200 Subject: [PATCH 03/12] Improving morphing panel for events and gateways --- .../src/diagram/nodes/NodeIcons.tsx | 18 +- .../src/diagram/nodes/NodeSvgs.tsx | 505 +++++++++++++----- .../morphing/useEventNodeMorphingActions.tsx | 29 +- .../useGatewayNodeMorphingActions.tsx | 10 +- 4 files changed, 394 insertions(+), 168 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index d32bf47c998..57e31cbf6f9 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -50,7 +50,7 @@ export function NodeIcon({ nodeType }: { nodeType: BpmnNodeType }) { }); } -export function EventDefitnitionIcon({ +export function EventDefinitionIcon({ variant, filled, stroke, @@ -60,7 +60,7 @@ export function EventDefitnitionIcon({ stroke: string; }) { const cx = nodeSvgProps.x + nodeSvgProps.width / 2; - const cy = nodeSvgProps.y + nodeSvgProps.width / 2; + const cy = nodeSvgProps.y + nodeSvgProps.height / 2; const r = nodeSvgProps.width / 2; @@ -69,13 +69,15 @@ export function EventDefitnitionIcon({ @@ -130,10 +132,16 @@ export function CallActivityIcon() { ); } -export function GatewayIcon({ variant }: { variant?: GatewayVariant }) { +export function GatewayIcon({ variant, isMorphingPanel }: { variant?: GatewayVariant; isMorphingPanel?: boolean }) { return ( - + ); } diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index 253d9735a81..c46d90c1cfa 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -394,7 +394,9 @@ export function TaskNodeSvg( ); } -export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant | "none" }) { +export function GatewayNodeSvg( + __props: NodeSvgProps & { variant: GatewayVariant | "none"; isMorphingPanel?: boolean } +) { const { x, y, @@ -404,88 +406,226 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant props: { ..._props }, } = normalize(__props); - const { variant, ...props } = { ..._props }; + const { variant, isMorphingPanel, ...props } = { ..._props }; + const morphingPanelOffset = isMorphingPanel ? 25 : 0; return ( <> - + {!isMorphingPanel && ( + + )} {variant === "parallelGateway" && ( - <> - - - + )} {variant === "exclusiveGateway" && ( - <> - - - - - + )} {variant === "inclusiveGateway" && ( - <> - - + + )} + {variant === "eventBasedGateway" && ( + )} - {variant === "eventBasedGateway" && <>{/* TODO: Tiago */}} - {variant === "complexGateway" && <>{/* TODO: Tiago */}} + {variant === "complexGateway" && ( + + )} + + ); +} + +export function ParallelGatewaySvg({ + stroke, + strokeWidth, + cx, + cy, + size, +}: { + stroke: string; + strokeWidth?: number; + cx: number; + cy: number; + size: number; +}) { + return ( + <> + + + + ); +} + +export function ExclusiveGatewaySvg({ + stroke, + strokeWidth, + cx, + cy, + size, +}: { + stroke: string; + strokeWidth?: number; + cx: number; + cy: number; + size: number; +}) { + return ( + <> + + + + ); +} + +export function InclusiveGatewaySvg({ + stroke, + strokeWidth, + cx, + cy, + size, +}: { + stroke: string; + strokeWidth?: number; + cx: number; + cy: number; + size: number; +}) { + return ( + <> + + + ); +} + +export function EventBasedGatewaySvg({ + stroke, + strokeWidth, + circleStrokeWidth, + cx, + cy, + size, +}: { + stroke: string; + strokeWidth?: number; + circleStrokeWidth?: number; + cx: number; + cy: number; + size: number; +}) { + const pentagonPoints = Array.from({ length: 5 }, (_, i) => { + const angle = (i * 2 * Math.PI) / 5 - Math.PI / 2; + return { + x: cx + (size / 4) * Math.cos(angle), + y: cy + (size / 4) * Math.sin(angle), + }; + }); + + return ( + <> + + + `${point.x},${point.y}`).join(" ")} + stroke={stroke} + strokeWidth={strokeWidth} + fill="none" + /> + + ); +} + +export function ComplexGatewaySvg({ + stroke, + strokeWidth, + cx, + cy, + size, +}: { + stroke: string; + strokeWidth?: number; + cx: number; + cy: number; + size: number; +}) { + const lineLength = size / 3; + const diagonalLength = lineLength / Math.sqrt(2); + + return ( + <> + + + + ); } @@ -748,6 +888,7 @@ export function EventVariantSymbolSvg({ variant, stroke, strokeWidth, + isMorphingPanel, cx, cy, x, @@ -760,6 +901,7 @@ export function EventVariantSymbolSvg({ variant: EventVariant | "none"; stroke: string; strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; x: number; @@ -776,6 +918,8 @@ export function EventVariantSymbolSvg({ fill={fill ?? "none"} filled={filled} stroke={stroke} + strokeWidth={strokeWidth} + isMorphingPanel={isMorphingPanel} cx={cx} cy={cy} innerCircleRadius={innerCircleRadius} @@ -785,6 +929,8 @@ export function EventVariantSymbolSvg({ )} {variant === "cancelEventDefinition" && ( - + )} {variant === "compensateEventDefinition" && ( )} {variant === "linkEventDefinition" && ( - + )} {variant === "signalEventDefinition" && ( )} - {variant === "terminateEventDefinition" && ( <> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : fill} stroke={stroke} @@ -929,7 +1102,7 @@ export function MessageEventSymbolSvg({ x2={envelopeFlap[2].x} y2={envelopeFlap[2].y} stroke={fill} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} /> )} @@ -947,6 +1120,8 @@ export function MessageEventSymbolSvg({ export function TimerEventSymbolSvg({ stroke, + strokeWidth, + isMorphingPanel, cx, cy, innerCircleRadius, @@ -954,29 +1129,33 @@ export function TimerEventSymbolSvg({ filled, }: { stroke: string; + strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; innerCircleRadius: number; outerCircleRadius: number; filled: boolean; }) { - const padding = 1.2 * (outerCircleRadius - innerCircleRadius); - const clockRadius = innerCircleRadius - padding; + const scaleFactor = isMorphingPanel ? 1.4 : 1; + + const scaledPadding = 1.2 * (outerCircleRadius - innerCircleRadius) * scaleFactor; + const scaledClockRadius = (innerCircleRadius - scaledPadding) * scaleFactor; - const shortHandLength = clockRadius * 0.5; - const longHandLength = clockRadius * 0.9; + const scaledShortHandLength = scaledClockRadius * 0.5; + const scaledLongHandLength = scaledClockRadius * 0.9; const hourHandAngle = Math.PI / 12; const minuteHandAngle = (-5 * Math.PI) / 12; const hourHand = { - x: cx + shortHandLength * Math.cos(hourHandAngle), - y: cy + shortHandLength * Math.sin(hourHandAngle), + x: cx + scaledShortHandLength * Math.cos(hourHandAngle), + y: cy + scaledShortHandLength * Math.sin(hourHandAngle), }; const minuteHand = { - x: cx + longHandLength * Math.cos(minuteHandAngle), - y: cy + longHandLength * Math.sin(minuteHandAngle), + x: cx + scaledLongHandLength * Math.cos(minuteHandAngle), + y: cy + scaledLongHandLength * Math.sin(minuteHandAngle), }; return ( @@ -984,9 +1163,9 @@ export function TimerEventSymbolSvg({ @@ -996,7 +1175,7 @@ export function TimerEventSymbolSvg({ x2={hourHand.x} y2={hourHand.y} stroke={filled ? "transparent" : stroke} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} /> {Array.from({ length: 12 }, (_, index) => { const angle = (index / 12) * 2 * Math.PI; - const x1 = cx + clockRadius * Math.cos(angle); - const y1 = cy + clockRadius * Math.sin(angle); - const x2 = cx + (clockRadius - padding * 0.5) * Math.cos(angle); - const y2 = cy + (clockRadius - padding * 0.5) * Math.sin(angle); + const x1 = cx + scaledClockRadius * Math.cos(angle); + const y1 = cy + scaledClockRadius * Math.sin(angle); + const x2 = cx + (scaledClockRadius - scaledPadding * 0.5) * Math.cos(angle); + const y2 = cy + (scaledClockRadius - scaledPadding * 0.5) * Math.sin(angle); return ; })} @@ -1023,6 +1202,7 @@ export function TimerEventSymbolSvg({ export function ErrorEventSymbolSvg({ stroke, + strokeWidth, cx, cy, innerCircleRadius, @@ -1030,6 +1210,8 @@ export function ErrorEventSymbolSvg({ filled, }: { stroke: string; + strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; innerCircleRadius: number; @@ -1058,7 +1240,7 @@ export function ErrorEventSymbolSvg({ <> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : "transparent"} stroke={stroke} @@ -1069,32 +1251,38 @@ export function ErrorEventSymbolSvg({ export function EscalationEventSymbolSvg({ stroke, + strokeWidth, + isMorphingPanel, cx, cy, innerCircleRadius, filled, }: { stroke: string; + strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; innerCircleRadius: number; filled: boolean; }) { - const arrowHeight = innerCircleRadius * 1.2; - const arrowBaseWidth = innerCircleRadius * 1; + const scaleFactor = isMorphingPanel ? 1.8 : 1; + const scaledArrowHeight = innerCircleRadius * 1.2 * scaleFactor; + const scaledArrowBaseWidth = innerCircleRadius * scaleFactor; + const midCenterYOffset = ((innerCircleRadius * 1.2) / 20) * scaleFactor; const arrow = [ - { x: cx - arrowBaseWidth / 2, y: cy + arrowHeight / 2 }, // left - { x: cx, y: cy - arrowHeight / 2 }, // top center - { x: cx + arrowBaseWidth / 2, y: cy + arrowHeight / 2 }, // right - { x: cx, y: cy + arrowHeight / 20 }, // mid center + { x: cx - scaledArrowBaseWidth / 2, y: cy + scaledArrowHeight / 2 }, // left + { x: cx, y: cy - scaledArrowHeight / 2 }, // top center + { x: cx + scaledArrowBaseWidth / 2, y: cy + scaledArrowHeight / 2 }, // right + { x: cx, y: cy + midCenterYOffset }, // mid center ] as const; return ( <> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : "transparent"} stroke={stroke} @@ -1105,12 +1293,14 @@ export function EscalationEventSymbolSvg({ export function CancelEventSymbolSvg({ stroke, + strokeWidth, cx, cy, innerCircleRadius, filled, }: { stroke: string; + strokeWidth?: number; cx: number; cy: number; innerCircleRadius: number; @@ -1140,7 +1330,7 @@ export function CancelEventSymbolSvg({ <> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : "transparent"} stroke={stroke} @@ -1151,6 +1341,7 @@ export function CancelEventSymbolSvg({ export function CompensationEventSymbolSvg({ stroke, + strokeWidth, cx, cy, x, @@ -1160,6 +1351,7 @@ export function CompensationEventSymbolSvg({ filled, }: { stroke: string; + strokeWidth?: number; cx: number; cy: number; x: number; @@ -1191,14 +1383,14 @@ export function CompensationEventSymbolSvg({ <> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : "transparent"} stroke={stroke} /> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : "transparent"} stroke={stroke} @@ -1209,74 +1401,86 @@ export function CompensationEventSymbolSvg({ export function ConditionalEventSymbolSvg({ stroke, + strokeWidth, + isMorphingPanel, cx, cy, outerCircleRadius, filled, }: { stroke: string; + strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; outerCircleRadius: number; filled: boolean; }) { - const squareSize = outerCircleRadius * 1.1; + const scaleFactor = isMorphingPanel ? 1.8 : 1; + + const squareSize = outerCircleRadius * 1.1 * scaleFactor; + const halfSquareSize = squareSize / 2; const lineSpacing = squareSize / 5; - const lineThickness = 2; + const lineBuffer = isMorphingPanel ? 50 : 5; + const x1 = cx - halfSquareSize + lineBuffer; + const x2 = cx + halfSquareSize - lineBuffer; + + const squareX = cx - halfSquareSize; + const squareY = cy - halfSquareSize; return ( <> - {[...Array(4)].map((_, index) => ( - - ))} + {[...Array(4)].map((_, index) => { + const lineY = squareY + lineSpacing * (index + 1); + return ( + + ); + })} ); } - export function LinkEventSymbolSvg({ stroke, + strokeWidth, + isMorphingPanel, cx, cy, innerCircleRadius, filled, }: { stroke: string; + strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; innerCircleRadius: number; filled: boolean; }) { + const scaleFactor = isMorphingPanel ? 50 : 1; + const arrowHeight = innerCircleRadius * 1.2; const arrowBaseWidth = innerCircleRadius * 1; - const shiftLeft = 7; + const shiftLeft = 6; const rectangleHeight = 5; - const arrowPadding = 2; + const arrowPadding = 1; const arrow = [ - { x: cx - arrowBaseWidth / 2 - shiftLeft, y: cy + arrowHeight / 2 - rectangleHeight }, // bottom left rectangle - { x: cx - arrowBaseWidth / 2 - shiftLeft, y: cy - arrowHeight / 2 + rectangleHeight }, // top left rectangle + { x: cx - arrowBaseWidth / 2 - shiftLeft - scaleFactor, y: cy + arrowHeight / 2 - rectangleHeight }, // bottom left rectangle + { x: cx - arrowBaseWidth / 2 - shiftLeft - scaleFactor, y: cy - arrowHeight / 2 + rectangleHeight }, // top left rectangle { x: cx + arrowBaseWidth / 2, y: cy - arrowHeight / 2 + rectangleHeight }, // top right rectangle - { x: cx + arrowBaseWidth / 2, y: cy - arrowHeight / 2 - arrowPadding }, // upper arrow start - { x: cx + arrowBaseWidth / 2 + 8, y: cy }, // arrow point - { x: cx + arrowBaseWidth / 2, y: cy + arrowHeight / 2 + arrowPadding }, // lower arrow start + { x: cx + arrowBaseWidth / 2, y: cy - arrowHeight / 2 - arrowPadding - scaleFactor }, // upper arrow start + { x: cx + arrowBaseWidth / 2 + 7 + scaleFactor, y: cy }, // arrow point + { x: cx + arrowBaseWidth / 2, y: cy + arrowHeight / 2 + arrowPadding + scaleFactor }, // lower arrow start { x: cx + arrowBaseWidth / 2, y: cy + arrowHeight / 2 - rectangleHeight }, // bottom right rectangle ] as const; @@ -1284,7 +1488,7 @@ export function LinkEventSymbolSvg({ <> `${point.x},${point.y}`).join(" ")} - strokeWidth={1.5} + strokeWidth={strokeWidth ?? 1.5} strokeLinejoin={"round"} fill={filled ? stroke : "transparent"} stroke={stroke} @@ -1296,6 +1500,7 @@ export function LinkEventSymbolSvg({ export function SignalEventSymbolSvg({ stroke, strokeWidth, + isMorphingPanel, cx, cy, x, @@ -1306,6 +1511,7 @@ export function SignalEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; + isMorphingPanel?: boolean; cx: number; cy: number; x: number; @@ -1314,13 +1520,16 @@ export function SignalEventSymbolSvg({ outerCircleRadius: number; filled: boolean; }) { + const scaleFactor = isMorphingPanel ? 1.2 : 1; + const padding = 1.5 * (outerCircleRadius - innerCircleRadius); - const hx = x + innerCircleRadius - padding; - const hy = y + innerCircleRadius - padding; + const hx = (x + innerCircleRadius - padding) * scaleFactor; + const hy = (y + innerCircleRadius - padding) * scaleFactor; + const triangle = [ - { x: cx + cos30 * hx, y: padding / 4 + cy + sin30 * hy }, // right - { x: cx - cos30 * hx, y: padding / 4 + cy + sin30 * hy }, // left - { x: cx, y: padding / 4 + cy - hy }, // top + { x: cx + cos30 * hx, y: (padding / 4) * scaleFactor + cy + sin30 * hy }, // right + { x: cx - cos30 * hx, y: (padding / 4) * scaleFactor + cy + sin30 * hy }, // left + { x: cx, y: (padding / 4) * scaleFactor + cy - hy }, // top ] as const; return ( diff --git a/packages/bpmn-editor/src/diagram/nodes/morphing/useEventNodeMorphingActions.tsx b/packages/bpmn-editor/src/diagram/nodes/morphing/useEventNodeMorphingActions.tsx index bf5ba008eb6..558950973e7 100644 --- a/packages/bpmn-editor/src/diagram/nodes/morphing/useEventNodeMorphingActions.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/morphing/useEventNodeMorphingActions.tsx @@ -25,7 +25,7 @@ import { visitFlowElementsAndArtifacts } from "../../../mutations/_elementVisito import { addOrGetProcessAndDiagramElements } from "../../../mutations/addOrGetProcessAndDiagramElements"; import { Normalized } from "../../../normalization/normalize"; import { useBpmnEditorStoreApi } from "../../../store/StoreContext"; -import { EndEventIcon, EventDefitnitionIcon, IntermediateThrowEventIcon, StartEventIcon } from "../NodeIcons"; +import { EndEventIcon, EventDefinitionIcon, IntermediateThrowEventIcon, StartEventIcon } from "../NodeIcons"; import { BPMN20__tProcess } from "@kie-tools/bpmn-marshaller/src/schemas/bpmn-2_0/ts-gen/types"; import { ElementFilter } from "@kie-tools/xml-parser-ts/dist/elementFilter"; import { NODE_COLORS } from "../NodeSvgs"; @@ -41,6 +41,8 @@ export function useEventNodeMorphingActions(event: Event) { const bpmnEditorStoreApi = useBpmnEditorStoreApi(); const foregroundColor = NODE_COLORS[event.__$$element].foreground; + const backgroundColor = NODE_COLORS[event.__$$element].background; + const filled = event.__$$element === "intermediateThrowEvent" || event.__$$element === "endEvent"; const morphEvent = useCallback( @@ -165,63 +167,70 @@ export function useEventNodeMorphingActions(event: Event) { action: () => morphEvent(undefined), } as const, // none { - icon: , + icon: ( + + ), key: "2", title: "Message", id: "messageEventDefinition", action: () => morphEvent("messageEventDefinition"), } as const, { - icon: , + icon: , key: "3", title: "Timer", id: "timerEventDefinition", action: () => morphEvent("timerEventDefinition"), } as const, { - icon: , + icon: , key: "4", title: "Error", id: "errorEventDefinition", action: () => morphEvent("errorEventDefinition"), } as const, { - icon: , + icon: , key: "5", title: "Escalation", id: "escalationEventDefinition", action: () => morphEvent("escalationEventDefinition"), } as const, { - icon: , + icon: , key: "6", title: "Cancelation", id: "cancelEventDefinition", action: () => morphEvent("cancelEventDefinition"), } as const, { - icon: , + icon: , key: "7", title: "Compensation", id: "compensateEventDefinition", action: () => morphEvent("compensateEventDefinition"), } as const, { - icon: , + icon: , key: "8", title: "Conditional", id: "conditionalEventDefinition", action: () => morphEvent("conditionalEventDefinition"), } as const, { - icon: , + icon: , key: "9", title: "Link", id: "linkEventDefinition", action: () => morphEvent("linkEventDefinition"), } as const, { - icon: , + icon: , key: "0", title: "Signal", id: "signalEventDefinition", diff --git a/packages/bpmn-editor/src/diagram/nodes/morphing/useGatewayNodeMorphingActions.tsx b/packages/bpmn-editor/src/diagram/nodes/morphing/useGatewayNodeMorphingActions.tsx index dc4fc963c2b..5aa9eb7cf46 100644 --- a/packages/bpmn-editor/src/diagram/nodes/morphing/useGatewayNodeMorphingActions.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/morphing/useGatewayNodeMorphingActions.tsx @@ -67,35 +67,35 @@ export function useGatewayNodeMorphingActions(gateway: Gateway) { const morphingActions = useMemo(() => { return [ { - icon: , + icon: , key: "1", title: "Parallel", id: "parallelGateway", action: () => morphGateway("parallelGateway"), } as const, { - icon: , + icon: , key: "2", title: "Exclusive", id: "exclusiveGateway", action: () => morphGateway("exclusiveGateway"), } as const, { - icon: , + icon: , key: "3", title: "Inclusive", id: "inclusiveGateway", action: () => morphGateway("inclusiveGateway"), } as const, { - icon: , + icon: , key: "4", title: "Event", id: "eventBasedGateway", action: () => morphGateway("eventBasedGateway"), } as const, { - icon: , + icon: , key: "5", title: "Complex", id: "complexGateway", From a343b06308faf70ef00b19c413316ead7aae0214 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 31 Oct 2024 11:33:00 +0100 Subject: [PATCH 04/12] Adding new icons for tasks and gateways and fixing all morphing panels --- .../src/diagram/BpmnDiagramDomain.tsx | 4 +- .../src/diagram/nodes/NodeIcons.tsx | 4 +- .../src/diagram/nodes/NodeSvgs.tsx | 645 +++++++++++++++--- .../bpmn-editor/src/diagram/nodes/Nodes.tsx | 1 + .../morphing/useTaskNodeMorphingActions.tsx | 8 +- 5 files changed, 562 insertions(+), 100 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx b/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx index 814c1ff3516..fcb6f238a05 100644 --- a/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx +++ b/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx @@ -103,11 +103,11 @@ export type BpmnNodeType = Values; export type BpmnEdgeType = Values; export enum ActivityNodeMarker { - Compensation = "Compensation", MultiInstanceParallel = "MultiInstanceParallel", MultiInstanceSequential = "MultiInstanceSequential", - Collapsed = "Collapsed", Loop = "Loop", + Compensation = "Compensation", + Collapsed = "Collapsed", AdHocSubProcess = "AdHocSubProcess", } diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index 57e31cbf6f9..95288eed329 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -116,10 +116,10 @@ export function EndEventIcon({ variant }: { variant?: EventVariant }) { ); } -export function TaskIcon({ variant }: { variant?: TaskVariant }) { +export function TaskIcon({ variant, isMorphingPanel }: { variant?: TaskVariant; isMorphingPanel?: boolean }) { return ( - + ); } diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index c46d90c1cfa..ffe5672fe16 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -343,7 +343,8 @@ export function EndEventNodeSvg(__props: NodeSvgProps & { variant: EventVariant export function TaskNodeSvg( __props: NodeSvgProps & { markers?: (ActivityNodeMarker | "CallActivityPaletteIcon")[]; - variant?: TaskVariant | "none"; + variant?: TaskVariant | "task" | "callActivity" | "none"; + isMorphingPanel?: boolean; } ) { const { @@ -355,26 +356,64 @@ export function TaskNodeSvg( props: { ..._props }, } = normalize(__props); + const { variant, isMorphingPanel } = { ..._props }; const { markers: _markers, variant: _variant, ...props } = { ..._props }; const markers = useMemo(() => new Set(_markers), [_markers]); - const variant = _variant ?? "none"; + + const iconOffsets = { + scriptTask: isMorphingPanel ? { cx: x - 2, cy: y - 25 } : { cx: x + 3, cy: y + 3 }, + businessRuleTask: isMorphingPanel ? { cx: x - 10, cy: y - 10 } : { cx: x + 3, cy: y + 3 }, + serviceTask: isMorphingPanel ? { cx: x - 5, cy: y - 35 } : { cx: x + 3, cy: y + 3 }, + userTask: isMorphingPanel ? { cx: x - 5, cy: y - 45 } : { cx: x + 3, cy: y + 3 }, + }; return ( <> - + {!isMorphingPanel && ( + + )} + + {variant === "scriptTask" && ( + + + + )} + + {variant === "businessRuleTask" && ( + + + + )} + + {variant === "serviceTask" && ( + + + + )} + + {variant === "userTask" && ( + + + + )} + {markers.has("CallActivityPaletteIcon") && ( ); } + +export function ScriptTaskSvg({ stroke, size }: { stroke: string; size: number }) { + return ( + + + + + + + + + + ); +} + +export function BusinessRuleTaskSvg({ + stroke, + strokeWidth, + size, +}: { + stroke: string; + strokeWidth: number; + size: number; +}) { + const headerHeight = size / 5; + const rowHeight = size / 4; + const columnWidth1 = size / 3; + const columnWidth2 = (size / 3) * 2; + + return ( + <> + {/* Header row */} + + {/* First row */} + + + {/* Second row */} + + + + ); +} + +export function ServiceTaskSvg({ stroke, size }: { stroke: string; size: number }) { + return ( + + + + + + + ); +} + +export function UserTaskSvg({ stroke, size }: { stroke: string; size: number }) { + return ( + + + + + + ); +} export function GatewayNodeSvg( __props: NodeSvgProps & { variant: GatewayVariant | "none"; isMorphingPanel?: boolean } ) { @@ -1558,85 +1853,251 @@ export function ActivityNodeIcons({ height: number; icons: Set; }) { + const orderedMarkers = Object.values(ActivityNodeMarker); + const iconElements = orderedMarkers.filter((marker) => icons.has(marker)); + const iconSize = 20; + const iconSpacing = 2; + const stroke = NODE_COLORS.task.foreground; + const strokeWidth = 2; + const totalIconsWidth = iconElements.length * iconSize + (iconElements.length - 1) * iconSpacing; + const startX = x + (width - totalIconsWidth) / 2; + const bottomY = y + height; + return ( <> - {icons.has(ActivityNodeMarker.Loop) && ( - - ↻ - - )} - {icons.has(ActivityNodeMarker.AdHocSubProcess) && ( - - ~ - - )} - {icons.has(ActivityNodeMarker.Compensation) && ( - - ⏪ - - )} - {icons.has(ActivityNodeMarker.Collapsed) && ( - <> - - - + - - - )} - {icons.has(ActivityNodeMarker.MultiInstanceParallel) && ( - - ☰ - - )} - {icons.has(ActivityNodeMarker.MultiInstanceSequential) && ( - - ☰ - - )} + {iconElements.map((icon, index) => { + const iconX = startX + index * (iconSize + iconSpacing); + + return icon === ActivityNodeMarker.Collapsed ? ( + + + + ) : icon === ActivityNodeMarker.MultiInstanceParallel ? ( + + + + ) : icon === ActivityNodeMarker.MultiInstanceSequential ? ( + + + + ) : icon === ActivityNodeMarker.Loop ? ( + + + + ) : icon === ActivityNodeMarker.AdHocSubProcess ? ( + + + + ) : icon === ActivityNodeMarker.Compensation ? ( + + + + ) : null; + })} + + ); +} +export function LoopIconSvg({ stroke, size }: { stroke: string; size: number }) { + return ( + + + + + + ); +} + +export function AdHocSubProcessIconSvg({ stroke, size }: { stroke: string; size: number }) { + return ( + + + + + + ); +} + +export function CompensationIconSvg({ + stroke, + strokeWidth, + size, +}: { + stroke: string; + strokeWidth: number; + size: number; +}) { + const arrowWidth = size / 3; + const arrowHeight = size / 2; + const centerY = size / 2; + const offsetX = size / 4; + + return ( + <> + {/* Left Arrow */} + + + {/* Right Arrow */} + + + ); +} + +export function CollapsedIconSvg({ stroke, strokeWidth, size }: { stroke: string; strokeWidth: number; size: number }) { + const squareSize = size; + const padding = size * 0.25; + + return ( + <> + + + + + ); +} + +export function MultiInstanceSequentialIconSvg({ + stroke, + strokeWidth, + size, +}: { + stroke: string; + strokeWidth: number; + size: number; +}) { + const lineSpacing = size / 6; + const lineWidth = size * 0.5; + + return ( + <> + + + + + ); +} + +export function MultiInstanceParallelIconSvg({ + stroke, + strokeWidth, + size, +}: { + stroke: string; + strokeWidth: number; + size: number; +}) { + const lineSpacing = size / 6; + const lineHeight = size * 0.5; + + return ( + <> + + + ); } diff --git a/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx b/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx index 224a2fdead1..523b4cb41be 100644 --- a/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx @@ -726,6 +726,7 @@ export const TaskNode = React.memo( y={0} strokeWidth={task.__$$element === "callActivity" ? 5 : undefined} markers={icons} + variant={task.__$$element} /> diff --git a/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx b/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx index 8556288a5eb..620d350813b 100644 --- a/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx @@ -68,28 +68,28 @@ export function useTaskNodeMorphingActions(task: Task) { const morphingActions = useMemo(() => { return [ { - icon: <>U, + icon: , key: "1", title: "User task", id: "userTask", action: () => morphTask("userTask"), } as const, { - icon: <>B, + icon: , key: "2", title: "Business Rule task", id: "businessRuleTask", action: () => morphTask("businessRuleTask"), } as const, { - icon: <>S, + icon: , key: "3", title: "Service task", id: "serviceTask", action: () => morphTask("serviceTask"), } as const, { - icon: <>X, + icon: , key: "4", title: "Script task", id: "scriptTask", From 201f5fa3f7137679770fba002860a11e6282aa9e Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 31 Oct 2024 11:41:13 +0100 Subject: [PATCH 05/12] minor refactor --- packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index ffe5672fe16..99daa17d12f 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -361,11 +361,12 @@ export function TaskNodeSvg( const markers = useMemo(() => new Set(_markers), [_markers]); + const defaultOffset = { cx: x + 3, cy: y + 3 }; const iconOffsets = { - scriptTask: isMorphingPanel ? { cx: x - 2, cy: y - 25 } : { cx: x + 3, cy: y + 3 }, - businessRuleTask: isMorphingPanel ? { cx: x - 10, cy: y - 10 } : { cx: x + 3, cy: y + 3 }, - serviceTask: isMorphingPanel ? { cx: x - 5, cy: y - 35 } : { cx: x + 3, cy: y + 3 }, - userTask: isMorphingPanel ? { cx: x - 5, cy: y - 45 } : { cx: x + 3, cy: y + 3 }, + scriptTask: isMorphingPanel ? { cx: x - 2, cy: y - 25 } : defaultOffset, + businessRuleTask: isMorphingPanel ? { cx: x - 10, cy: y - 10 } : defaultOffset, + serviceTask: isMorphingPanel ? { cx: x - 5, cy: y - 35 } : defaultOffset, + userTask: isMorphingPanel ? { cx: x - 5, cy: y - 45 } : defaultOffset, }; return ( From 9cdc54832556a8a50520c99795c850ce30df2d40 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 31 Oct 2024 12:38:58 +0100 Subject: [PATCH 06/12] minor positioning adjustment --- packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index 99daa17d12f..0b702c000a6 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -1878,7 +1878,7 @@ export function ActivityNodeIcons({ ) : icon === ActivityNodeMarker.MultiInstanceSequential ? ( - + ) : icon === ActivityNodeMarker.Loop ? ( From 4de605ceb74ba2e0e755ab646c12a8cb4fc97487 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 31 Oct 2024 16:45:11 +0100 Subject: [PATCH 07/12] fixing marker order --- packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx b/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx index fcb6f238a05..85cdb8f3878 100644 --- a/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx +++ b/packages/bpmn-editor/src/diagram/BpmnDiagramDomain.tsx @@ -103,11 +103,11 @@ export type BpmnNodeType = Values; export type BpmnEdgeType = Values; export enum ActivityNodeMarker { + Collapsed = "Collapsed", MultiInstanceParallel = "MultiInstanceParallel", MultiInstanceSequential = "MultiInstanceSequential", Loop = "Loop", Compensation = "Compensation", - Collapsed = "Collapsed", AdHocSubProcess = "AdHocSubProcess", } From 716931e8c8734a49f8c01cb6ac61d58816e7753c Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 31 Oct 2024 17:02:12 +0100 Subject: [PATCH 08/12] updating order and potitioning --- packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index 0b702c000a6..c45f24137d5 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -1874,12 +1874,12 @@ export function ActivityNodeIcons({ ) : icon === ActivityNodeMarker.MultiInstanceParallel ? ( - - + + ) : icon === ActivityNodeMarker.MultiInstanceSequential ? ( - - + + ) : icon === ActivityNodeMarker.Loop ? ( @@ -2022,7 +2022,7 @@ export function MultiInstanceSequentialIconSvg({ strokeWidth: number; size: number; }) { - const lineSpacing = size / 6; + const lineSpacing = size / 5; const lineWidth = size * 0.5; return ( @@ -2067,7 +2067,7 @@ export function MultiInstanceParallelIconSvg({ strokeWidth: number; size: number; }) { - const lineSpacing = size / 6; + const lineSpacing = size / 5; const lineHeight = size * 0.5; return ( From 226754099000c99810808e419f709e49da76433e Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 7 Nov 2024 12:03:19 +0100 Subject: [PATCH 09/12] refactoring and adding updated images to properties panel --- .../src/diagram/nodes/NodeIcons.tsx | 24 ++-- .../src/diagram/nodes/NodeSvgs.tsx | 112 +++++++++--------- .../bpmn-editor/src/diagram/nodes/Nodes.tsx | 66 +++++------ .../useGatewayNodeMorphingActions.tsx | 10 +- .../morphing/useTaskNodeMorphingActions.tsx | 8 +- .../BusinessRuleTaskProperties.tsx | 5 +- .../ComplexGatewayProperties.tsx | 2 +- .../EndEventProperties.tsx | 15 ++- .../EventBasedGatewayProperties.tsx | 2 +- .../ExclusiveGatewayProperties.tsx | 2 +- .../InclusiveGatewayProperties.tsx | 2 +- .../IntermediateCatchEventProperties.tsx | 13 +- .../IntermediateThrowEventProperties.tsx | 14 ++- .../ParallelGatewayProperties.tsx | 2 +- .../ScriptTaskProperties.tsx | 2 +- .../ServiceTaskProperties.tsx | 2 +- .../StartEventProperties.tsx | 12 +- .../UserTaskProperties.tsx | 2 +- 18 files changed, 164 insertions(+), 131 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index 95288eed329..d1672acb015 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -69,7 +69,7 @@ export function EventDefinitionIcon({ @@ -92,7 +92,7 @@ export function StartEventIcon({ variant }: { variant?: EventVariant }) { ); } -export function IntermediateCatchEventIcon({ variant }: { variant?: EventVariant }) { +export function IntermediateCatchEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { return ( @@ -100,7 +100,7 @@ export function IntermediateCatchEventIcon({ variant }: { variant?: EventVariant ); } -export function IntermediateThrowEventIcon({ variant }: { variant?: EventVariant }) { +export function IntermediateThrowEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { return ( @@ -108,7 +108,7 @@ export function IntermediateThrowEventIcon({ variant }: { variant?: EventVariant ); } -export function EndEventIcon({ variant }: { variant?: EventVariant }) { +export function EndEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { return ( @@ -116,10 +116,10 @@ export function EndEventIcon({ variant }: { variant?: EventVariant }) { ); } -export function TaskIcon({ variant, isMorphingPanel }: { variant?: TaskVariant; isMorphingPanel?: boolean }) { +export function TaskIcon({ variant, isIcon }: { variant?: TaskVariant; isIcon?: boolean }) { return ( - + ); } @@ -132,16 +132,10 @@ export function CallActivityIcon() { ); } -export function GatewayIcon({ variant, isMorphingPanel }: { variant?: GatewayVariant; isMorphingPanel?: boolean }) { +export function GatewayIcon({ variant, isIcon }: { variant?: GatewayVariant; isIcon?: boolean }) { return ( - + ); } diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index c45f24137d5..ba9c800e748 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -344,7 +344,7 @@ export function TaskNodeSvg( __props: NodeSvgProps & { markers?: (ActivityNodeMarker | "CallActivityPaletteIcon")[]; variant?: TaskVariant | "task" | "callActivity" | "none"; - isMorphingPanel?: boolean; + isIcon?: boolean; } ) { const { @@ -356,22 +356,22 @@ export function TaskNodeSvg( props: { ..._props }, } = normalize(__props); - const { variant, isMorphingPanel } = { ..._props }; + const { variant, isIcon } = { ..._props }; const { markers: _markers, variant: _variant, ...props } = { ..._props }; const markers = useMemo(() => new Set(_markers), [_markers]); const defaultOffset = { cx: x + 3, cy: y + 3 }; const iconOffsets = { - scriptTask: isMorphingPanel ? { cx: x - 2, cy: y - 25 } : defaultOffset, - businessRuleTask: isMorphingPanel ? { cx: x - 10, cy: y - 10 } : defaultOffset, - serviceTask: isMorphingPanel ? { cx: x - 5, cy: y - 35 } : defaultOffset, - userTask: isMorphingPanel ? { cx: x - 5, cy: y - 45 } : defaultOffset, + scriptTask: isIcon ? { cx: x - 2, cy: y - 25 } : defaultOffset, + businessRuleTask: isIcon ? { cx: x - 10, cy: y - 10 } : defaultOffset, + serviceTask: isIcon ? { cx: x - 5, cy: y - 35 } : defaultOffset, + userTask: isIcon ? { cx: x - 5, cy: y - 45 } : defaultOffset, }; return ( <> - {!isMorphingPanel && ( + {!isIcon && ( - + )} @@ -397,21 +397,21 @@ export function TaskNodeSvg( )} {variant === "serviceTask" && ( - + )} {variant === "userTask" && ( - + )} @@ -690,9 +690,7 @@ export function UserTaskSvg({ stroke, size }: { stroke: string; size: number }) ); } -export function GatewayNodeSvg( - __props: NodeSvgProps & { variant: GatewayVariant | "none"; isMorphingPanel?: boolean } -) { +export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant | "none"; isIcon?: boolean }) { const { x, y, @@ -702,12 +700,12 @@ export function GatewayNodeSvg( props: { ..._props }, } = normalize(__props); - const { variant, isMorphingPanel, ...props } = { ..._props }; - const morphingPanelOffset = isMorphingPanel ? 25 : 0; + const { variant, isIcon, ...props } = { ..._props }; + const morphingPanelOffset = isIcon ? 25 : 0; return ( <> - {!isMorphingPanel && ( + {!isIcon && ( )} {variant === "exclusiveGateway" && ( )} {variant === "inclusiveGateway" && ( )} {variant === "eventBasedGateway" && ( )} {variant === "complexGateway" && ( )} @@ -1184,7 +1182,7 @@ export function EventVariantSymbolSvg({ variant, stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, x, @@ -1197,7 +1195,7 @@ export function EventVariantSymbolSvg({ variant: EventVariant | "none"; stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; x: number; @@ -1215,7 +1213,7 @@ export function EventVariantSymbolSvg({ filled={filled} stroke={stroke} strokeWidth={strokeWidth} - isMorphingPanel={isMorphingPanel} + isIcon={isIcon} cx={cx} cy={cy} innerCircleRadius={innerCircleRadius} @@ -1226,7 +1224,7 @@ export function EventVariantSymbolSvg({ filled={filled} stroke={stroke} strokeWidth={strokeWidth} - isMorphingPanel={isMorphingPanel} + isIcon={isIcon} cx={cx} cy={cy} innerCircleRadius={innerCircleRadius} @@ -1249,7 +1247,7 @@ export function EventVariantSymbolSvg({ filled={filled} stroke={stroke} strokeWidth={strokeWidth} - isMorphingPanel={isMorphingPanel} + isIcon={isIcon} cx={cx} cy={cy} innerCircleRadius={innerCircleRadius} @@ -1283,7 +1281,7 @@ export function EventVariantSymbolSvg({ filled={filled} stroke={stroke} strokeWidth={strokeWidth} - isMorphingPanel={isMorphingPanel} + isIcon={isIcon} cx={cx} cy={cy} outerCircleRadius={outerCircleRadius} @@ -1294,7 +1292,7 @@ export function EventVariantSymbolSvg({ filled={filled} stroke={stroke} strokeWidth={strokeWidth} - isMorphingPanel={isMorphingPanel} + isIcon={isIcon} cx={cx} cy={cy} innerCircleRadius={innerCircleRadius} @@ -1305,7 +1303,7 @@ export function EventVariantSymbolSvg({ filled={filled} stroke={stroke} strokeWidth={strokeWidth} - isMorphingPanel={isMorphingPanel} + isIcon={isIcon} x={x} y={y} cx={cx} @@ -1336,7 +1334,7 @@ export function EventVariantSymbolSvg({ export function MessageEventSymbolSvg({ stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, innerCircleRadius, @@ -1345,14 +1343,14 @@ export function MessageEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; innerCircleRadius: number; fill: string; filled: boolean; }) { - const scaleFactor = isMorphingPanel ? 1.9 : 1; + const scaleFactor = isIcon ? 1.9 : 1; const scaledBodyWidth = innerCircleRadius * 1.2 * scaleFactor; const scaledBodyHeight = innerCircleRadius * 0.8 * scaleFactor; @@ -1417,7 +1415,7 @@ export function MessageEventSymbolSvg({ export function TimerEventSymbolSvg({ stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, innerCircleRadius, @@ -1426,14 +1424,14 @@ export function TimerEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; innerCircleRadius: number; outerCircleRadius: number; filled: boolean; }) { - const scaleFactor = isMorphingPanel ? 1.4 : 1; + const scaleFactor = isIcon ? 1.4 : 1; const scaledPadding = 1.2 * (outerCircleRadius - innerCircleRadius) * scaleFactor; const scaledClockRadius = (innerCircleRadius - scaledPadding) * scaleFactor; @@ -1507,7 +1505,7 @@ export function ErrorEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; innerCircleRadius: number; @@ -1548,7 +1546,7 @@ export function ErrorEventSymbolSvg({ export function EscalationEventSymbolSvg({ stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, innerCircleRadius, @@ -1556,13 +1554,13 @@ export function EscalationEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; innerCircleRadius: number; filled: boolean; }) { - const scaleFactor = isMorphingPanel ? 1.8 : 1; + const scaleFactor = isIcon ? 1.8 : 1; const scaledArrowHeight = innerCircleRadius * 1.2 * scaleFactor; const scaledArrowBaseWidth = innerCircleRadius * scaleFactor; const midCenterYOffset = ((innerCircleRadius * 1.2) / 20) * scaleFactor; @@ -1698,7 +1696,7 @@ export function CompensationEventSymbolSvg({ export function ConditionalEventSymbolSvg({ stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, outerCircleRadius, @@ -1706,18 +1704,18 @@ export function ConditionalEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; outerCircleRadius: number; filled: boolean; }) { - const scaleFactor = isMorphingPanel ? 1.8 : 1; + const scaleFactor = isIcon ? 1.8 : 1; const squareSize = outerCircleRadius * 1.1 * scaleFactor; const halfSquareSize = squareSize / 2; const lineSpacing = squareSize / 5; - const lineBuffer = isMorphingPanel ? 50 : 5; + const lineBuffer = isIcon ? 50 : 5; const x1 = cx - halfSquareSize + lineBuffer; const x2 = cx + halfSquareSize - lineBuffer; @@ -1748,7 +1746,7 @@ export function ConditionalEventSymbolSvg({ export function LinkEventSymbolSvg({ stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, innerCircleRadius, @@ -1756,13 +1754,13 @@ export function LinkEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; innerCircleRadius: number; filled: boolean; }) { - const scaleFactor = isMorphingPanel ? 50 : 1; + const scaleFactor = isIcon ? 50 : 1; const arrowHeight = innerCircleRadius * 1.2; const arrowBaseWidth = innerCircleRadius * 1; @@ -1796,7 +1794,7 @@ export function LinkEventSymbolSvg({ export function SignalEventSymbolSvg({ stroke, strokeWidth, - isMorphingPanel, + isIcon, cx, cy, x, @@ -1807,7 +1805,7 @@ export function SignalEventSymbolSvg({ }: { stroke: string; strokeWidth?: number; - isMorphingPanel?: boolean; + isIcon?: boolean; cx: number; cy: number; x: number; @@ -1816,7 +1814,7 @@ export function SignalEventSymbolSvg({ outerCircleRadius: number; filled: boolean; }) { - const scaleFactor = isMorphingPanel ? 1.2 : 1; + const scaleFactor = isIcon ? 1.2 : 1; const padding = 1.5 * (outerCircleRadius - innerCircleRadius); const hx = (x + innerCircleRadius - padding) * scaleFactor; diff --git a/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx b/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx index 523b4cb41be..4faee06eb8b 100644 --- a/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/Nodes.tsx @@ -141,7 +141,7 @@ export const StartEventNode = React.memo( [bpmnEditorStoreApi, id] ); - const [isMorphingPanelExpanded, setMorphingPanelExpanded] = useState(false); + const [isIconExpanded, setMorphingPanelExpanded] = useState(false); useEffect(() => setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useEventNodeMorphingActions(startEvent); const disabledMorphingActionIds = useMemo["id"]>>( @@ -184,7 +184,7 @@ export const StartEventNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -196,7 +196,7 @@ export const StartEventNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && shouldActLikeHovered} + isVisible={!isIconExpanded && !isTargeted && shouldActLikeHovered} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.startEvent].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.startEvent].edges} /> @@ -204,7 +204,7 @@ export const StartEventNode = React.memo( {/* Creates a div element with the node size to push down the */} {
} - {(startEvent["@_name"] || isEditingLabel) && !isMorphingPanelExpanded && ( + {(startEvent["@_name"] || isEditingLabel) && !isIconExpanded && ( setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useEventNodeMorphingActions(intermediateCatchEvent); const disabledMorphingActionIds = useMemo["id"]>>( @@ -330,7 +330,7 @@ export const IntermediateCatchEventNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -342,7 +342,7 @@ export const IntermediateCatchEventNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && shouldActLikeHovered} + isVisible={!isIconExpanded && !isTargeted && shouldActLikeHovered} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.intermediateCatchEvent].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.intermediateCatchEvent].edges} /> @@ -350,7 +350,7 @@ export const IntermediateCatchEventNode = React.memo( {/* Creates a div element with the node size to push down the */} {
} - {(intermediateCatchEvent["@_name"] || isEditingLabel) && !isMorphingPanelExpanded && ( + {(intermediateCatchEvent["@_name"] || isEditingLabel) && !isIconExpanded && ( setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useEventNodeMorphingActions(intermediateThrowEvent); const disabledMorphingActionIds = useMemo["id"]>>( @@ -468,7 +468,7 @@ export const IntermediateThrowEventNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -480,7 +480,7 @@ export const IntermediateThrowEventNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && shouldActLikeHovered} + isVisible={!isIconExpanded && !isTargeted && shouldActLikeHovered} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.intermediateThrowEvent].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.intermediateThrowEvent].edges} /> @@ -488,7 +488,7 @@ export const IntermediateThrowEventNode = React.memo( {/* Creates a div element with the node size to push down the */} {
} - {(intermediateThrowEvent["@_name"] || isEditingLabel) && !isMorphingPanelExpanded && ( + {(intermediateThrowEvent["@_name"] || isEditingLabel) && !isIconExpanded && ( setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useEventNodeMorphingActions(endEvent); const disabledMorphingActionIds = useMemo["id"]>>( @@ -598,7 +598,7 @@ export const EndEventNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -610,7 +610,7 @@ export const EndEventNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && shouldActLikeHovered} + isVisible={!isIconExpanded && !isTargeted && shouldActLikeHovered} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.endEvent].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.endEvent].edges} /> @@ -618,7 +618,7 @@ export const EndEventNode = React.memo( {/* Creates a div element with the node size to push down the */} {
} - {(endEvent["@_name"] || isEditingLabel) && !isMorphingPanelExpanded && ( + {(endEvent["@_name"] || isEditingLabel) && !isIconExpanded && ( setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useTaskNodeMorphingActions(task); const disabledMorphingActionIds = useMemo["id"]>>(() => new Set(), []); @@ -743,7 +743,7 @@ export const TaskNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -778,7 +778,7 @@ export const TaskNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && shouldActLikeHovered} + isVisible={!isIconExpanded && !isTargeted && shouldActLikeHovered} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.task].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.task].edges} /> @@ -786,7 +786,7 @@ export const TaskNode = React.memo( setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useSubProcessNodeMorphingActions(subProcess); const disabledMorphingActionIds = useMemo["id"]>>(() => new Set(), []); @@ -897,7 +897,7 @@ export const SubProcessNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -932,7 +932,7 @@ export const SubProcessNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && isOnlySelectedNode && !dragging} + isVisible={!isIconExpanded && !isTargeted && isOnlySelectedNode && !dragging} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.subProcess].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.subProcess].edges} /> @@ -940,7 +940,7 @@ export const SubProcessNode = React.memo( setMorphingPanelExpanded(false), [isHovered]); const morphingActions = useGatewayNodeMorphingActions(gateway); const disabledMorphingActionIds = useMemo["id"]>>(() => new Set(), []); @@ -1037,7 +1037,7 @@ export const GatewayNode = React.memo(
*/}
{ bpmnEditorStoreApi.setState((state) => { state.propertiesPanel.isOpen = true; @@ -1049,7 +1049,7 @@ export const GatewayNode = React.memo( nodeMapping={bpmnNodesOutgoingStuffNodePanelMapping} edgeMapping={bpmnEdgesOutgoingStuffNodePanelMapping} nodeHref={id} - isVisible={!isMorphingPanelExpanded && !isTargeted && shouldActLikeHovered} + isVisible={!isIconExpanded && !isTargeted && shouldActLikeHovered} nodeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.gateway].nodes} edgeTypes={BPMN_OUTGOING_STRUCTURE[NODE_TYPES.gateway].edges} /> @@ -1057,7 +1057,7 @@ export const GatewayNode = React.memo( {/* Creates a div element with the node size to push down the */} {
} - {(gateway["@_name"] || isEditingLabel) && !isMorphingPanelExpanded && ( + {(gateway["@_name"] || isEditingLabel) && !isIconExpanded && ( { return [ { - icon: , + icon: , key: "1", title: "Parallel", id: "parallelGateway", action: () => morphGateway("parallelGateway"), } as const, { - icon: , + icon: , key: "2", title: "Exclusive", id: "exclusiveGateway", action: () => morphGateway("exclusiveGateway"), } as const, { - icon: , + icon: , key: "3", title: "Inclusive", id: "inclusiveGateway", action: () => morphGateway("inclusiveGateway"), } as const, { - icon: , + icon: , key: "4", title: "Event", id: "eventBasedGateway", action: () => morphGateway("eventBasedGateway"), } as const, { - icon: , + icon: , key: "5", title: "Complex", id: "complexGateway", diff --git a/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx b/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx index 620d350813b..685e24225b0 100644 --- a/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/morphing/useTaskNodeMorphingActions.tsx @@ -68,28 +68,28 @@ export function useTaskNodeMorphingActions(task: Task) { const morphingActions = useMemo(() => { return [ { - icon: , + icon: , key: "1", title: "User task", id: "userTask", action: () => morphTask("userTask"), } as const, { - icon: , + icon: , key: "2", title: "Business Rule task", id: "businessRuleTask", action: () => morphTask("businessRuleTask"), } as const, { - icon: , + icon: , key: "3", title: "Service task", id: "serviceTask", action: () => morphTask("serviceTask"), } as const, { - icon: , + icon: , key: "4", title: "Script task", id: "scriptTask", diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/BusinessRuleTaskProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/BusinessRuleTaskProperties.tsx index d873e6907e7..c30802c0296 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/BusinessRuleTaskProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/BusinessRuleTaskProperties.tsx @@ -50,7 +50,10 @@ export function BusinessRuleTaskProperties({ return ( <> - }> + } + > } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EndEventProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EndEventProperties.tsx index 58765b92a25..b3a24d53090 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EndEventProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EndEventProperties.tsx @@ -23,20 +23,31 @@ import { Normalized } from "../../normalization/normalize"; import { NameDocumentationAndId } from "../nameDocumentationAndId/NameDocumentationAndId"; import { InputOnlyAssociationFormSection } from "../assignments/AssignmentsFormSection"; import { EventDefinitionProperties } from "../eventDefinition/EventDefinitionProperties"; -import { EndEventIcon } from "../../diagram/nodes/NodeIcons"; +import { EndEventIcon, EventDefinitionIcon } from "../../diagram/nodes/NodeIcons"; import { PropertiesPanelHeaderFormSection } from "./_PropertiesPanelHeaderFormSection"; import { Divider } from "@patternfly/react-core/dist/js/components/Divider"; +import { NODE_COLORS } from "../../diagram/nodes/NodeSvgs"; export function EndEventProperties({ endEvent, }: { endEvent: Normalized & { __$$element: "endEvent" }; }) { + const foregroundColor = NODE_COLORS.endEvent.foreground; + const backgroundColor = NODE_COLORS.endEvent.background; + return ( <> } + icon={ + + } > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EventBasedGatewayProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EventBasedGatewayProperties.tsx index adaf97a7c3c..fd0e73801f0 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EventBasedGatewayProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/EventBasedGatewayProperties.tsx @@ -33,7 +33,7 @@ export function EventBasedGatewayProperties({ return ( } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ExclusiveGatewayProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ExclusiveGatewayProperties.tsx index 64c6f6e4956..84653dc5ead 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ExclusiveGatewayProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ExclusiveGatewayProperties.tsx @@ -34,7 +34,7 @@ export function ExclusiveGatewayProperties({ return ( } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/InclusiveGatewayProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/InclusiveGatewayProperties.tsx index 7bc6dd6f2e2..4744db7e283 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/InclusiveGatewayProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/InclusiveGatewayProperties.tsx @@ -34,7 +34,7 @@ export function InclusiveGatewayProperties({ return ( } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateCatchEventProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateCatchEventProperties.tsx index cb0c5e9df09..7e34ae9f3ae 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateCatchEventProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateCatchEventProperties.tsx @@ -23,20 +23,29 @@ import { Normalized } from "../../normalization/normalize"; import { NameDocumentationAndId } from "../nameDocumentationAndId/NameDocumentationAndId"; import { OutputOnlyAssociationFormSection } from "../assignments/AssignmentsFormSection"; import { EventDefinitionProperties } from "../eventDefinition/EventDefinitionProperties"; -import { IntermediateCatchEventIcon } from "../../diagram/nodes/NodeIcons"; +import { EventDefinitionIcon, IntermediateCatchEventIcon } from "../../diagram/nodes/NodeIcons"; import { PropertiesPanelHeaderFormSection } from "./_PropertiesPanelHeaderFormSection"; import { Divider } from "@patternfly/react-core/dist/js/components/Divider"; +import { NODE_COLORS } from "../../diagram/nodes/NodeSvgs"; export function IntermediateCatchEventProperties({ intermediateCatchEvent, }: { intermediateCatchEvent: Normalized & { __$$element: "intermediateCatchEvent" }; }) { + const foregroundColor = NODE_COLORS.intermediateCatchEvent.foreground; + return ( <> } + icon={ + + } > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateThrowEventProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateThrowEventProperties.tsx index 6616042743c..ed02440802d 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateThrowEventProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/IntermediateThrowEventProperties.tsx @@ -23,20 +23,30 @@ import { Normalized } from "../../normalization/normalize"; import { NameDocumentationAndId } from "../nameDocumentationAndId/NameDocumentationAndId"; import { InputOnlyAssociationFormSection } from "../assignments/AssignmentsFormSection"; import { EventDefinitionProperties } from "../eventDefinition/EventDefinitionProperties"; -import { IntermediateThrowEventIcon } from "../../diagram/nodes/NodeIcons"; +import { EventDefinitionIcon, IntermediateThrowEventIcon } from "../../diagram/nodes/NodeIcons"; import { PropertiesPanelHeaderFormSection } from "./_PropertiesPanelHeaderFormSection"; import { Divider } from "@patternfly/react-core/dist/js/components/Divider"; +import { NODE_COLORS } from "../../diagram/nodes/NodeSvgs"; export function IntermediateThrowEventProperties({ intermediateThrowEvent, }: { intermediateThrowEvent: Normalized & { __$$element: "intermediateThrowEvent" }; }) { + const foregroundColor = NODE_COLORS.intermediateThrowEvent.foreground; + const backgroundColor = NODE_COLORS.intermediateThrowEvent.background; return ( <> } + icon={ + + } > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ParallelGatewayProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ParallelGatewayProperties.tsx index b0cd7ab3784..db50350b4aa 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ParallelGatewayProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ParallelGatewayProperties.tsx @@ -33,7 +33,7 @@ export function ParallelGatewayProperties({ return ( } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ScriptTaskProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ScriptTaskProperties.tsx index f5f3b7f44e7..0ed700639e4 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ScriptTaskProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ScriptTaskProperties.tsx @@ -39,7 +39,7 @@ export function ScriptTaskProperties({ <> } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ServiceTaskProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ServiceTaskProperties.tsx index 87fd3e198c0..d9c355d1bcc 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ServiceTaskProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/ServiceTaskProperties.tsx @@ -54,7 +54,7 @@ export function ServiceTaskProperties({ <> } + icon={} > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/StartEventProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/StartEventProperties.tsx index 1f857cb141a..96669a04b0f 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/StartEventProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/StartEventProperties.tsx @@ -23,20 +23,28 @@ import { Normalized } from "../../normalization/normalize"; import { NameDocumentationAndId } from "../nameDocumentationAndId/NameDocumentationAndId"; import { OutputOnlyAssociationFormSection } from "../assignments/AssignmentsFormSection"; import { EventDefinitionProperties } from "../eventDefinition/EventDefinitionProperties"; -import { StartEventIcon } from "../../diagram/nodes/NodeIcons"; +import { EventDefinitionIcon, StartEventIcon } from "../../diagram/nodes/NodeIcons"; import { PropertiesPanelHeaderFormSection } from "./_PropertiesPanelHeaderFormSection"; import { Divider } from "@patternfly/react-core/dist/js/components/Divider"; +import { NODE_COLORS } from "../../diagram/nodes/NodeSvgs"; export function StartEventProperties({ startEvent, }: { startEvent: Normalized & { __$$element: "startEvent" }; }) { + const foregroundColor = NODE_COLORS.startEvent.foreground; return ( <> } + icon={ + + } > diff --git a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/UserTaskProperties.tsx b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/UserTaskProperties.tsx index 8413765f57a..1ee7d223e16 100644 --- a/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/UserTaskProperties.tsx +++ b/packages/bpmn-editor/src/propertiesPanel/singleNodeProperties/UserTaskProperties.tsx @@ -42,7 +42,7 @@ export function UserTaskProperties({ <> } + icon={} > From 33be2b489d39bef346e5295368cc238eaf642864 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 7 Nov 2024 12:05:20 +0100 Subject: [PATCH 10/12] removing unneeded changes --- packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index d1672acb015..4002d948a2c 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -84,7 +84,7 @@ export function EventDefinitionIcon({ ); } -export function StartEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { +export function StartEventIcon({ variant }: { variant?: EventVariant }) { return ( @@ -92,7 +92,7 @@ export function StartEventIcon({ variant, isIcon }: { variant?: EventVariant; is ); } -export function IntermediateCatchEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { +export function IntermediateCatchEventIcon({ variant }: { variant?: EventVariant }) { return ( @@ -100,7 +100,7 @@ export function IntermediateCatchEventIcon({ variant, isIcon }: { variant?: Even ); } -export function IntermediateThrowEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { +export function IntermediateThrowEventIcon({ variant }: { variant?: EventVariant }) { return ( @@ -108,7 +108,7 @@ export function IntermediateThrowEventIcon({ variant, isIcon }: { variant?: Even ); } -export function EndEventIcon({ variant, isIcon }: { variant?: EventVariant; isIcon?: boolean }) { +export function EndEventIcon({ variant }: { variant?: EventVariant }) { return ( From dfecbe27fa864082b42ec3f20195342cec2109f6 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Thu, 7 Nov 2024 12:49:26 +0100 Subject: [PATCH 11/12] minor refactoring --- .../src/diagram/nodes/NodeSvgs.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx index ba9c800e748..fd09c0a30ff 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeSvgs.tsx @@ -22,7 +22,6 @@ import { DEFAULT_INTRACTION_WIDTH } from "@kie-tools/xyflow-react-kie-diagram/di import { DEFAULT_NODE_FILL, DEFAULT_NODE_STROKE_COLOR } from "./NodeStyle"; import { containerNodeInteractionRectCssClassName, - DEFAULT_NODE_STROKE_WIDTH, NodeSvgProps, normalize, } from "@kie-tools/xyflow-react-kie-diagram/dist/nodes/NodeSvgs"; @@ -360,7 +359,8 @@ export function TaskNodeSvg( const { markers: _markers, variant: _variant, ...props } = { ..._props }; const markers = useMemo(() => new Set(_markers), [_markers]); - + const iconSize = 200; + const defaultSize = 25; const defaultOffset = { cx: x + 3, cy: y + 3 }; const iconOffsets = { scriptTask: isIcon ? { cx: x - 2, cy: y - 25 } : defaultOffset, @@ -389,7 +389,7 @@ export function TaskNodeSvg( {variant === "scriptTask" && ( - + )} @@ -397,7 +397,7 @@ export function TaskNodeSvg( @@ -405,13 +405,13 @@ export function TaskNodeSvg( {variant === "serviceTask" && ( - + )} {variant === "userTask" && ( - + )} @@ -701,7 +701,7 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant } = normalize(__props); const { variant, isIcon, ...props } = { ..._props }; - const morphingPanelOffset = isIcon ? 25 : 0; + const iconOffset = isIcon ? 25 : 0; return ( <> @@ -726,7 +726,7 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant stroke={NODE_COLORS.gateway.foreground} strokeWidth={isIcon ? 30 : 4.5} cx={x + width / 2} - cy={y + height / 2 - morphingPanelOffset} + cy={y + height / 2 - iconOffset} size={isIcon ? 210 : 30} /> )} @@ -735,7 +735,7 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant stroke={NODE_COLORS.gateway.foreground} strokeWidth={isIcon ? 30 : 4.5} cx={x + width / 2} - cy={y + height / 2 - morphingPanelOffset} + cy={y + height / 2 - iconOffset} size={isIcon ? 210 : 30} /> )} @@ -744,7 +744,7 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant stroke={NODE_COLORS.gateway.foreground} strokeWidth={isIcon ? 30 : 4.5} cx={x + width / 2} - cy={y + height / 2 - morphingPanelOffset} + cy={y + height / 2 - iconOffset} size={isIcon ? 275 : 40} /> )} @@ -754,7 +754,7 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant circleStrokeWidth={isIcon ? 10 : 1.5} strokeWidth={isIcon ? 30 : 2} cx={x + width / 2} - cy={y + height / 2 - morphingPanelOffset} + cy={y + height / 2 - iconOffset} size={isIcon ? 275 : 40} /> )} @@ -763,7 +763,7 @@ export function GatewayNodeSvg(__props: NodeSvgProps & { variant: GatewayVariant stroke={NODE_COLORS.gateway.foreground} strokeWidth={isIcon ? 30 : 4.5} cx={x + width / 2} - cy={y + height / 2 - morphingPanelOffset} + cy={y + height / 2 - iconOffset} size={isIcon ? 300 : 50} /> )} From befaed19e119785718097fbf0c8ffc55863bb845 Mon Sep 17 00:00:00 2001 From: Kennedy Date: Wed, 27 Nov 2024 13:57:21 +0100 Subject: [PATCH 12/12] oops --- packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx index 4002d948a2c..5346e2b872a 100644 --- a/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx +++ b/packages/bpmn-editor/src/diagram/nodes/NodeIcons.tsx @@ -53,10 +53,12 @@ export function NodeIcon({ nodeType }: { nodeType: BpmnNodeType }) { export function EventDefinitionIcon({ variant, filled, + fill, stroke, }: { variant?: EventVariant; filled: boolean; + fill?: string; stroke: string; }) { const cx = nodeSvgProps.x + nodeSvgProps.width / 2;