This is an automated email from the ASF dual-hosted git repository.
tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new a93715f17fc kie-issues#234: Identify DMN DRD elements with collapsed
dependencies with ellipsis (...) notation (#2154)
a93715f17fc is described below
commit a93715f17fcdee48b63d4fae0df2ca24eef463cd
Author: Luiz João Motta <[email protected]>
AuthorDate: Tue Feb 20 14:25:27 2024 -0300
kie-issues#234: Identify DMN DRD elements with collapsed dependencies with
ellipsis (...) notation (#2154)
---
packages/dmn-editor/src/diagram/Diagram.tsx | 6 +-
.../src/diagram/connections/ConnectionLine.tsx | 11 +-
packages/dmn-editor/src/diagram/graph/graph.ts | 2 +
packages/dmn-editor/src/diagram/nodes/NodeSvgs.tsx | 192 +++++++++++++++++++--
packages/dmn-editor/src/diagram/nodes/Nodes.tsx | 18 +-
.../src/diagram/nodes/OutgoingStuffNodePanel.tsx | 12 +-
packages/dmn-editor/src/icons/Icons.tsx | 9 +-
packages/dmn-editor/src/mutations/deleteNode.ts | 2 +
.../src/store/computed/computeDiagramData.ts | 24 ++-
packages/dmn-editor/src/svg/DmnDiagramSvg.tsx | 3 +
10 files changed, 246 insertions(+), 33 deletions(-)
diff --git a/packages/dmn-editor/src/diagram/Diagram.tsx
b/packages/dmn-editor/src/diagram/Diagram.tsx
index 3740b0ea1c4..129967d485c 100644
--- a/packages/dmn-editor/src/diagram/Diagram.tsx
+++ b/packages/dmn-editor/src/diagram/Diagram.tsx
@@ -60,7 +60,7 @@ import {
MIME_TYPE_FOR_DMN_EDITOR_EXTERNAL_NODES_FROM_INCLUDED_MODELS,
} from "../externalNodes/ExternalNodesPanel";
import { getNewDmnIdRandomizer } from "../idRandomizer/dmnIdRandomizer";
-import { nodeNatures } from "../mutations/NodeNature";
+import { NodeNature, nodeNatures } from "../mutations/NodeNature";
import { addConnectedNode } from "../mutations/addConnectedNode";
import { addDecisionToDecisionService } from
"../mutations/addDecisionToDecisionService";
import { addEdge } from "../mutations/addEdge";
@@ -1785,6 +1785,10 @@ export function KeyboardShortcuts(props: {}) {
}
for (const node of rf.getNodes().filter((s) => s.selected)) {
+ // Prevent hiding artifact nodes from DRD;
+ if (nodeNatures[node.type as NodeType] === NodeNature.ARTIFACT) {
+ continue;
+ }
const { deletedDmnShapeOnCurrentDrd: deletedShape } = deleteNode({
drgEdges: [], // Deleting from DRD only.
definitions: state.dmn.model.definitions,
diff --git a/packages/dmn-editor/src/diagram/connections/ConnectionLine.tsx
b/packages/dmn-editor/src/diagram/connections/ConnectionLine.tsx
index 0830064b255..425e3fec7b9 100644
--- a/packages/dmn-editor/src/diagram/connections/ConnectionLine.tsx
+++ b/packages/dmn-editor/src/diagram/connections/ConnectionLine.tsx
@@ -120,6 +120,8 @@ export function ConnectionLine({ toX, toY, fromNode,
fromHandle }: RF.Connection
y={toYsnapped}
width={defaultSize["@_width"]}
height={defaultSize["@_height"]}
+ isCollection={false}
+ hasHiddenRequirements={false}
/>
</g>
);
@@ -127,7 +129,13 @@ export function ConnectionLine({ toX, toY, fromNode,
fromHandle }: RF.Connection
return (
<g className={"pulse"}>
{edgeSvg}
- <BkmNodeSvg x={toXsnapped} y={toYsnapped}
width={defaultSize["@_width"]} height={defaultSize["@_height"]} />
+ <BkmNodeSvg
+ x={toXsnapped}
+ y={toYsnapped}
+ width={defaultSize["@_width"]}
+ height={defaultSize["@_height"]}
+ hasHiddenRequirements={false}
+ />
</g>
);
} else if (nodeType === NODE_TYPES.knowledgeSource) {
@@ -139,6 +147,7 @@ export function ConnectionLine({ toX, toY, fromNode,
fromHandle }: RF.Connection
y={toYsnapped}
width={defaultSize["@_width"]}
height={defaultSize["@_height"]}
+ hasHiddenRequirements={false}
/>
</g>
);
diff --git a/packages/dmn-editor/src/diagram/graph/graph.ts
b/packages/dmn-editor/src/diagram/graph/graph.ts
index eff1914b59a..ebb751a5bb2 100644
--- a/packages/dmn-editor/src/diagram/graph/graph.ts
+++ b/packages/dmn-editor/src/diagram/graph/graph.ts
@@ -40,6 +40,8 @@ export type DrgEdge = {
};
};
+export type DrgAdjacencyList = Map<string, { dependencies: Set<string> }>;
+
export function getAdjMatrix(edges: DrgEdge[]): AdjMatrix {
const __adjMatrix: AdjMatrix = {};
for (const e of edges) {
diff --git a/packages/dmn-editor/src/diagram/nodes/NodeSvgs.tsx
b/packages/dmn-editor/src/diagram/nodes/NodeSvgs.tsx
index dac36faa500..ca004813e7f 100644
--- a/packages/dmn-editor/src/diagram/nodes/NodeSvgs.tsx
+++ b/packages/dmn-editor/src/diagram/nodes/NodeSvgs.tsx
@@ -66,7 +66,7 @@ export function normalize<T extends NodeSvgProps>(_props: T) {
};
}
-export function InputDataNodeSvg(__props: NodeSvgProps & { isCollection?:
boolean }) {
+export function InputDataNodeSvg(__props: NodeSvgProps & { isCollection:
boolean }) {
const {
strokeWidth,
x,
@@ -107,13 +107,24 @@ export function InputDataNodeSvg(__props: NodeSvgProps &
{ isCollection?: boolea
rx={rx}
ry={ry}
/>
- {isCollection && <NodeCollectionMarker {...__props} anchor={"bottom"} />}
+ {isCollection && (
+ <NodeCollectionMarker
+ x={x}
+ y={y}
+ width={width}
+ height={height}
+ fillColor={fillColor}
+ strokeColor={strokeColor}
+ strokeWidth={strokeWidth}
+ anchor={"bottom"}
+ />
+ )}
</>
);
}
export function AlternativeInputDataNodeSvg(
- __props: NodeSvgProps & { isCollection?: boolean; isIcon: boolean;
transform?: string }
+ __props: NodeSvgProps & { isCollection: boolean; isIcon: boolean;
transform?: string }
) {
const {
strokeWidth,
@@ -163,12 +174,23 @@ export function AlternativeInputDataNodeSvg(
/>
</>
)}
- {isCollection && <NodeCollectionMarker {...__props} anchor={"bottom"} />}
+ {isCollection && (
+ <NodeCollectionMarker
+ x={x}
+ y={y}
+ width={width}
+ height={height}
+ fillColor={fillColor}
+ strokeColor={strokeColor}
+ strokeWidth={strokeWidth}
+ anchor={"bottom"}
+ />
+ )}
</>
);
}
-export function DecisionNodeSvg(__props: NodeSvgProps & { isCollection?:
boolean }) {
+export function DecisionNodeSvg(__props: NodeSvgProps & { isCollection:
boolean; hasHiddenRequirements: boolean }) {
const {
strokeWidth,
x,
@@ -177,7 +199,7 @@ export function DecisionNodeSvg(__props: NodeSvgProps & {
isCollection?: boolean
height,
fillColor,
strokeColor,
- props: { isCollection, ...props },
+ props: { isCollection, hasHiddenRequirements, ...props },
} = normalize(__props);
return (
@@ -193,13 +215,44 @@ export function DecisionNodeSvg(__props: NodeSvgProps & {
isCollection?: boolean
strokeLinejoin={"round"}
{...props}
/>
- {isCollection && <NodeCollectionMarker {...__props} anchor="top" />}
+ {isCollection && (
+ <NodeCollectionMarker
+ x={x}
+ y={y}
+ width={width}
+ height={height}
+ fillColor={fillColor}
+ strokeColor={strokeColor}
+ strokeWidth={strokeWidth}
+ anchor="top"
+ />
+ )}
+ {hasHiddenRequirements && (
+ <NodeHiddenRequirementMarker
+ x={x}
+ y={y}
+ width={width}
+ height={height}
+ strokeColor={strokeColor}
+ strokeWidth={strokeWidth}
+ anchor={"middle"}
+ />
+ )}
</>
);
}
-export function BkmNodeSvg(__props: NodeSvgProps) {
- const { strokeWidth, x, y, width, height, fillColor, strokeColor, props } =
normalize(__props);
+export function BkmNodeSvg(__props: NodeSvgProps & { hasHiddenRequirements:
boolean }) {
+ const {
+ strokeWidth,
+ x,
+ y,
+ width,
+ height,
+ fillColor,
+ strokeColor,
+ props: { hasHiddenRequirements, ...props },
+ } = normalize(__props);
const bevel = 25;
return (
<>
@@ -212,12 +265,32 @@ export function BkmNodeSvg(__props: NodeSvgProps) {
strokeLinejoin={"round"}
transform={`translate(${x},${y})`}
/>
+ {hasHiddenRequirements && (
+ <NodeHiddenRequirementMarker
+ x={x}
+ y={y}
+ width={width}
+ height={height}
+ strokeColor={strokeColor}
+ strokeWidth={strokeWidth}
+ anchor={"middle"}
+ />
+ )}
</>
);
}
-export function KnowledgeSourceNodeSvg(__props: NodeSvgProps) {
- const { strokeWidth, x, y, width, height: totalHeight, fillColor,
strokeColor, props } = normalize(__props);
+export function KnowledgeSourceNodeSvg(__props: NodeSvgProps & {
hasHiddenRequirements: boolean }) {
+ const {
+ strokeWidth,
+ x,
+ y,
+ width,
+ height: totalHeight,
+ fillColor,
+ strokeColor,
+ props: { hasHiddenRequirements, ...props },
+ } = normalize(__props);
const amplitude = 20;
const height = totalHeight - amplitude / 2; // Need to leave some space for
the wave at the bottom.
@@ -234,6 +307,17 @@ export function KnowledgeSourceNodeSvg(__props:
NodeSvgProps) {
strokeLinejoin={"round"}
transform={`translate(${x},${y})`}
/>
+ {hasHiddenRequirements && (
+ <NodeHiddenRequirementMarker
+ x={x}
+ y={y}
+ width={width}
+ height={totalHeight}
+ strokeColor={strokeColor}
+ strokeWidth={strokeWidth}
+ anchor={"left"}
+ />
+ )}
</>
);
}
@@ -456,18 +540,34 @@ export function UnknownNodeSvg(_props: NodeSvgProps & {
strokeDasharray?: string
);
}
-function NodeCollectionMarker(__props: NodeSvgProps & { anchor: "top" |
"bottom" }) {
- const { strokeWidth, x, y, width, height, fillColor, strokeColor, props } =
normalize(__props);
-
+function NodeCollectionMarker({
+ strokeWidth,
+ strokeColor,
+ fillColor,
+ x,
+ y,
+ width,
+ height,
+ anchor,
+}: {
+ strokeWidth: number;
+ strokeColor?: string;
+ fillColor?: string;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ anchor: "top" | "bottom";
+}) {
const xPosition = x + width / 2;
+ // Arbitrary space between the lines
const xSpacing = 7;
- const y1Position = props.anchor === "bottom" ? y + height - 4 : y + 4;
- const y2Position = props.anchor === "bottom" ? y + height - 18 : y + 18;
+ const y1Position = anchor === "bottom" ? y + height - 4 : y + 4;
+ const y2Position = anchor === "bottom" ? y + height - 18 : y + 18;
return (
<>
<line
- {...props}
x1={xPosition - xSpacing}
x2={xPosition - xSpacing}
y1={y1Position}
@@ -477,7 +577,6 @@ function NodeCollectionMarker(__props: NodeSvgProps & {
anchor: "top" | "bottom"
stroke={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
/>
<line
- {...props}
x1={xPosition}
x2={xPosition}
y1={y1Position}
@@ -487,7 +586,6 @@ function NodeCollectionMarker(__props: NodeSvgProps & {
anchor: "top" | "bottom"
stroke={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
/>
<line
- {...props}
x1={xPosition + xSpacing}
x2={xPosition + xSpacing}
y1={y1Position}
@@ -499,3 +597,59 @@ function NodeCollectionMarker(__props: NodeSvgProps & {
anchor: "top" | "bottom"
</>
);
}
+
+function NodeHiddenRequirementMarker({
+ strokeWidth,
+ strokeColor,
+ x,
+ y,
+ width,
+ height,
+ anchor,
+}: {
+ strokeWidth: number;
+ strokeColor?: string;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ anchor: "middle" | "left";
+}) {
+ // Set the radius to 1 to create a dot.
+ const dotRadius = 1;
+ const xPosition = anchor === "middle" ? x + width / 2 : x + width / 4;
+ // Arbitrary spacing between the dots;
+ const xSpacing = 7;
+ // For the nodes where we position in the middle we need to take into
account the "Edit" button
+ // making it necessary to be into a heigher position.
+ const yPosition = anchor === "middle" ? y + height - 18 : y + height - 11;
+
+ return (
+ <>
+ <circle
+ r={dotRadius}
+ cx={xPosition - xSpacing}
+ cy={yPosition}
+ strokeWidth={strokeWidth}
+ fill={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
+ stroke={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
+ />
+ <circle
+ r={dotRadius}
+ cx={xPosition}
+ cy={yPosition}
+ strokeWidth={strokeWidth}
+ fill={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
+ stroke={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
+ />
+ <circle
+ r={dotRadius}
+ cx={xPosition + xSpacing}
+ cy={yPosition}
+ strokeWidth={strokeWidth}
+ fill={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
+ stroke={strokeColor ?? DEFAULT_NODE_STROKE_COLOR}
+ />
+ </>
+ );
+}
diff --git a/packages/dmn-editor/src/diagram/nodes/Nodes.tsx
b/packages/dmn-editor/src/diagram/nodes/Nodes.tsx
index d12b8989674..78770ff415a 100644
--- a/packages/dmn-editor/src/diagram/nodes/Nodes.tsx
+++ b/packages/dmn-editor/src/diagram/nodes/Nodes.tsx
@@ -89,6 +89,7 @@ export type DmnDiagramNodeData<T extends NodeDmnObjects =
NodeDmnObjects> = {
dmnObject: T;
shape: DMNDI15__DMNShape & { index: number };
index: number;
+ hasHiddenRequirements: boolean;
/**
* We don't use Reactflow's parenting mechanism because it is
* too opinionated on how it deletes nodes/edges that are
@@ -318,7 +319,15 @@ export const InputDataNode = React.memo(
export const DecisionNode = React.memo(
({
- data: { parentRfNode, dmnObject: decision, shape, index, dmnObjectQName,
dmnObjectNamespace },
+ data: {
+ parentRfNode,
+ dmnObject: decision,
+ shape,
+ index,
+ dmnObjectQName,
+ dmnObjectNamespace,
+ hasHiddenRequirements,
+ },
selected,
dragging,
zIndex,
@@ -410,6 +419,7 @@ export const DecisionNode = React.memo(
strokeWidth={parentRfNode ? 3 : shapeStyle.strokeWidth}
fillColor={shapeStyle.fillColor}
strokeColor={shapeStyle.strokeColor}
+ hasHiddenRequirements={hasHiddenRequirements}
/>
</svg>
@@ -472,7 +482,7 @@ export const DecisionNode = React.memo(
export const BkmNode = React.memo(
({
- data: { dmnObject: bkm, shape, index, dmnObjectQName, dmnObjectNamespace },
+ data: { dmnObject: bkm, shape, index, dmnObjectQName, dmnObjectNamespace,
hasHiddenRequirements },
selected,
dragging,
zIndex,
@@ -545,6 +555,7 @@ export const BkmNode = React.memo(
strokeWidth={shapeStyle.strokeWidth}
fillColor={shapeStyle.fillColor}
strokeColor={shapeStyle.strokeColor}
+ hasHiddenRequirements={hasHiddenRequirements}
/>
</svg>
@@ -605,7 +616,7 @@ export const BkmNode = React.memo(
export const KnowledgeSourceNode = React.memo(
({
- data: { dmnObject: knowledgeSource, shape, index, dmnObjectQName },
+ data: { dmnObject: knowledgeSource, shape, index, dmnObjectQName,
hasHiddenRequirements },
selected,
dragging,
zIndex,
@@ -670,6 +681,7 @@ export const KnowledgeSourceNode = React.memo(
strokeWidth={shapeStyle.strokeWidth}
fillColor={shapeStyle.fillColor}
strokeColor={shapeStyle.strokeColor}
+ hasHiddenRequirements={hasHiddenRequirements}
/>
</svg>
diff --git a/packages/dmn-editor/src/diagram/nodes/OutgoingStuffNodePanel.tsx
b/packages/dmn-editor/src/diagram/nodes/OutgoingStuffNodePanel.tsx
index 64143129949..7bd5321e616 100644
--- a/packages/dmn-editor/src/diagram/nodes/OutgoingStuffNodePanel.tsx
+++ b/packages/dmn-editor/src/diagram/nodes/OutgoingStuffNodePanel.tsx
@@ -117,9 +117,11 @@ export function OutgoingStuffNodePanel(props: { isVisible:
boolean; nodeTypes: N
viewBox={`0 0 ${nodeSvgViewboxSize} ${nodeSvgViewboxSize}`}
style={{ padding: `${svgViewboxPadding}px` }}
>
- {nodeType === NODE_TYPES.inputData && <InputDataNodeSvg
{...nodeSvgProps} />}
- {nodeType === NODE_TYPES.decision && <DecisionNodeSvg
{...nodeSvgProps} />}
- {nodeType === NODE_TYPES.bkm && <BkmNodeSvg
{...nodeSvgProps} />}
+ {nodeType === NODE_TYPES.inputData && <InputDataNodeSvg
{...nodeSvgProps} isCollection={false} />}
+ {nodeType === NODE_TYPES.decision && (
+ <DecisionNodeSvg {...nodeSvgProps} isCollection={false}
hasHiddenRequirements={false} />
+ )}
+ {nodeType === NODE_TYPES.bkm && <BkmNodeSvg
{...nodeSvgProps} hasHiddenRequirements={false} />}
{nodeType === NODE_TYPES.decisionService && (
<DecisionServiceNodeSvg
{...nodeSvgProps}
@@ -129,7 +131,9 @@ export function OutgoingStuffNodePanel(props: { isVisible:
boolean; nodeTypes: N
isReadonly={true}
/>
)}
- {nodeType === NODE_TYPES.knowledgeSource &&
<KnowledgeSourceNodeSvg {...nodeSvgProps} />}
+ {nodeType === NODE_TYPES.knowledgeSource && (
+ <KnowledgeSourceNodeSvg {...nodeSvgProps}
hasHiddenRequirements={false} />
+ )}
{nodeType === NODE_TYPES.textAnnotation &&
<TextAnnotationNodeSvg {...nodeSvgProps} />}
{nodeType === NODE_TYPES.group && <GroupNodeSvg
{...nodeSvgProps} />}
</svg>
diff --git a/packages/dmn-editor/src/icons/Icons.tsx
b/packages/dmn-editor/src/icons/Icons.tsx
index e58f7558b33..c5f748f43b3 100644
--- a/packages/dmn-editor/src/icons/Icons.tsx
+++ b/packages/dmn-editor/src/icons/Icons.tsx
@@ -89,7 +89,7 @@ export function NodeIcon({ isAlternativeInputDataShape,
nodeType }: NodeIcons) {
export function InputDataIcon(props: { padding?: string; height?: number }) {
return (
<RoundSvg padding={props.padding} height={props.height}>
- <InputDataNodeSvg {...nodeSvgProps} />
+ <InputDataNodeSvg {...nodeSvgProps} isCollection={false} />
</RoundSvg>
);
}
@@ -109,6 +109,7 @@ export function AlternativeInputDataIcon(props: {
height={100}
strokeWidth={8}
transform={props.transform ?? "translate(80, 60)"}
+ isCollection={false}
/>
</RoundSvg>
);
@@ -117,21 +118,21 @@ export function AlternativeInputDataIcon(props: {
export function DecisionIcon() {
return (
<RoundSvg>
- <DecisionNodeSvg {...nodeSvgProps} />
+ <DecisionNodeSvg {...nodeSvgProps} hasHiddenRequirements={false}
isCollection={false} />
</RoundSvg>
);
}
export function BkmIcon() {
return (
<RoundSvg>
- <BkmNodeSvg {...nodeSvgProps} />
+ <BkmNodeSvg {...nodeSvgProps} hasHiddenRequirements={false} />
</RoundSvg>
);
}
export function KnowledgeSourceIcon() {
return (
<RoundSvg>
- <KnowledgeSourceNodeSvg {...nodeSvgProps} />
+ <KnowledgeSourceNodeSvg {...nodeSvgProps} hasHiddenRequirements={false}
/>
</RoundSvg>
);
}
diff --git a/packages/dmn-editor/src/mutations/deleteNode.ts
b/packages/dmn-editor/src/mutations/deleteNode.ts
index c9eef1eb81e..894e9c0b043 100644
--- a/packages/dmn-editor/src/mutations/deleteNode.ts
+++ b/packages/dmn-editor/src/mutations/deleteNode.ts
@@ -110,6 +110,8 @@ export function deleteNode({
if (mode === NodeDeletionMode.FROM_DRG_AND_ALL_DRDS) {
const nodeIndex = (definitions.artifact ?? []).findIndex((a) =>
a["@_id"] === dmnObjectId);
dmnObject = definitions.artifact?.splice(nodeIndex, 1)?.[0];
+ } else {
+ throw new Error(`DMN MUTATION: Can't hide an artifact node.`);
}
} else if (nodeNature === NodeNature.DRG_ELEMENT) {
const nodeIndex = (definitions.drgElement ?? []).findIndex((d) =>
d["@_id"] === dmnObjectId);
diff --git a/packages/dmn-editor/src/store/computed/computeDiagramData.ts
b/packages/dmn-editor/src/store/computed/computeDiagramData.ts
index 21484fc6632..e64bebb35e9 100644
--- a/packages/dmn-editor/src/store/computed/computeDiagramData.ts
+++ b/packages/dmn-editor/src/store/computed/computeDiagramData.ts
@@ -25,7 +25,7 @@ import { snapShapeDimensions, snapShapePosition } from
"../../diagram/SnapGrid";
import { EdgeType, NodeType } from "../../diagram/connections/graphStructure";
import { EDGE_TYPES } from "../../diagram/edges/EdgeTypes";
import { DmnDiagramEdgeData } from "../../diagram/edges/Edges";
-import { DrgEdge, EdgeVisitor, NodeVisitor, getAdjMatrix, traverse } from
"../../diagram/graph/graph";
+import { DrgEdge, DrgAdjacencyList, EdgeVisitor, NodeVisitor, getAdjMatrix,
traverse } from "../../diagram/graph/graph";
import { getNodeTypeFromDmnObject } from "../../diagram/maths/DmnMaths";
import { DECISION_SERVICE_COLLAPSED_DIMENSIONS, MIN_NODE_SIZES } from
"../../diagram/nodes/DefaultSizes";
import {
___NASTY_HACK_FOR_SAFARI_to_force_redrawing_svgs_and_avoid_repaint_glitches }
from "../../diagram/nodes/NodeSvgs";
@@ -88,6 +88,7 @@ export function computeDiagramData(
const edges: RF.Edge<DmnDiagramEdgeData>[] = [];
const drgEdges: DrgEdge[] = [];
+ const drgAdjacencyList: DrgAdjacencyList = new Map();
const ackEdge: AckEdge = ({ id, type, dmnObject, source, target }) => {
const data = {
@@ -115,6 +116,13 @@ export function computeDiagramData(
drgEdges.push({ id, sourceId: source, targetId: target, dmnObject });
+ const targetAdjancyList = drgAdjacencyList.get(target);
+ if (!targetAdjancyList) {
+ drgAdjacencyList.set(target, { dependencies: new Set([source]) });
+ } else {
+ targetAdjancyList.dependencies.add(source);
+ }
+
return edge;
};
@@ -171,6 +179,9 @@ export function computeDiagramData(
dmnObject,
shape,
index,
+
+ // Properties to be overridden
+ hasHiddenRequirements: false,
parentRfNode: undefined,
};
@@ -320,6 +331,16 @@ export function computeDiagramData(
.filter((e) => nodesById.has(e.source) && nodesById.has(e.target))
.sort((a, b) => Number(selectedEdges.has(a.id)) -
Number(selectedEdges.has(b.id)));
+ // Search on the node list for the missing dependencies on the DRD.
+ for (const node of sortedNodes) {
+ for (const dependencyNodeId of drgAdjacencyList.get(node.id)?.dependencies
?? new Set()) {
+ if (!nodesById.get(dependencyNodeId)) {
+ node.data.hasHiddenRequirements = true;
+ break;
+ }
+ }
+ }
+
// console.timeEnd("nodes");
if (diagram.overlays.enableNodeHierarchyHighlight) {
assignClassesToHighlightedHierarchyNodes(diagram._selectedNodes,
nodesById, edgesById, drgEdges);
@@ -327,6 +348,7 @@ export function computeDiagramData(
return {
drgEdges,
+ drgAdjacencyList,
nodes: sortedNodes,
edges: sortedEdges,
edgesById,
diff --git a/packages/dmn-editor/src/svg/DmnDiagramSvg.tsx
b/packages/dmn-editor/src/svg/DmnDiagramSvg.tsx
index f232d5dab75..550c0aca4b3 100644
--- a/packages/dmn-editor/src/svg/DmnDiagramSvg.tsx
+++ b/packages/dmn-editor/src/svg/DmnDiagramSvg.tsx
@@ -155,6 +155,7 @@ export function DmnDiagramSvg({
{...style}
{...shapeStyle}
isCollection={isCollection}
+ hasHiddenRequirements={node.data.hasHiddenRequirements ?? false}
/>
)}
{node.type === NODE_TYPES.bkm && (
@@ -165,6 +166,7 @@ export function DmnDiagramSvg({
y={node.positionAbsolute!.y}
{...style}
{...shapeStyle}
+ hasHiddenRequirements={node.data.hasHiddenRequirements ?? false}
/>
)}
{node.type === NODE_TYPES.knowledgeSource && (
@@ -175,6 +177,7 @@ export function DmnDiagramSvg({
y={node.positionAbsolute!.y}
{...style}
{...shapeStyle}
+ hasHiddenRequirements={node.data.hasHiddenRequirements ?? false}
/>
)}
{node.type === NODE_TYPES.decisionService && (
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]