@pega/cosmos-react-build 9.0.0-build.9.9 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppShell/AppShell.styles.d.ts +13 -11
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts +11 -7
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/Header/BranchButton.d.ts +6 -4
- package/lib/components/AppShell/Header/BranchButton.d.ts.map +1 -1
- package/lib/components/AppShell/Header/BranchButton.js.map +1 -1
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts +753 -15
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.d.ts.map +1 -1
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.js +5 -4
- package/lib/components/AuthoringPanel/AuthoringPanel.styles.js.map +1 -1
- package/lib/components/Automation/Automation.js.map +1 -1
- package/lib/components/Automation/Automation.styles.d.ts +33 -10
- package/lib/components/Automation/Automation.styles.d.ts.map +1 -1
- package/lib/components/Automation/Automation.styles.js +1 -1
- package/lib/components/Automation/Automation.styles.js.map +1 -1
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts +375 -11
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts.map +1 -1
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +8 -4
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js +88 -68
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.d.ts +2 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.js +9 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.js.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +12 -3
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js +2 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.js +11 -5
- package/lib/components/DynamicInput/DynamicInput.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts +187 -2
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.js +29 -2
- package/lib/components/DynamicInput/DynamicInput.styles.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.d.ts +4 -2
- package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
- package/lib/components/DynamicInput/SourceButton.d.ts +1 -1
- package/lib/components/DynamicInput/SourceButton.d.ts.map +1 -1
- package/lib/components/DynamicInput/SourceButton.js.map +1 -1
- package/lib/components/DynamicInput/utils.d.ts.map +1 -1
- package/lib/components/DynamicInput/utils.js +5 -1
- package/lib/components/DynamicInput/utils.js.map +1 -1
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts +5 -5
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.d.ts.map +1 -1
- package/lib/components/EmptyRuleTemplate/EmptyRuleTemplate.js.map +1 -1
- package/lib/components/Expression/Expression.styles.d.ts +376 -8
- package/lib/components/Expression/Expression.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +138 -41
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +190 -8
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +53 -32
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +2 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +7 -7
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js +7 -6
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +211 -22
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +6 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +5 -3
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionItem.js +17 -13
- package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.js +18 -13
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/index.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.styles.d.ts +20 -11
- package/lib/components/FieldReference/FieldReference.styles.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.styles.js +10 -1
- package/lib/components/FieldReference/FieldReference.styles.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceDisplay.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceDisplay.js +3 -3
- package/lib/components/FieldReference/FieldReferenceDisplay.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.js +13 -5
- package/lib/components/FieldReference/FieldReferenceInput.js.map +1 -1
- package/lib/components/FlowModeller/AddNode.d.ts +22 -0
- package/lib/components/FlowModeller/AddNode.d.ts.map +1 -0
- package/lib/components/FlowModeller/AddNode.js +95 -0
- package/lib/components/FlowModeller/AddNode.js.map +1 -0
- package/lib/components/FlowModeller/Connector.d.ts +12 -0
- package/lib/components/FlowModeller/Connector.d.ts.map +1 -0
- package/lib/components/FlowModeller/Connector.js +84 -0
- package/lib/components/FlowModeller/Connector.js.map +1 -0
- package/lib/components/FlowModeller/DeleteDialog.d.ts +39 -0
- package/lib/components/FlowModeller/DeleteDialog.d.ts.map +1 -0
- package/lib/components/FlowModeller/DeleteDialog.js +158 -0
- package/lib/components/FlowModeller/DeleteDialog.js.map +1 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.d.ts +4 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.js +37 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.js.map +1 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.d.ts +8 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.js +80 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.styles.js.map +1 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.d.ts +36 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.js +2 -0
- package/lib/components/FlowModeller/FlowAuthoringPanel/FlowAuthoringPanel.types.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts +5 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.js +359 -0
- package/lib/components/FlowModeller/FlowModeller.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.test-ids.d.ts +3 -0
- package/lib/components/FlowModeller/FlowModeller.test-ids.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.test-ids.js +5 -0
- package/lib/components/FlowModeller/FlowModeller.test-ids.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.types.d.ts +84 -0
- package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.types.js +2 -0
- package/lib/components/FlowModeller/FlowModeller.types.js.map +1 -0
- package/lib/components/FlowModeller/FlowModellerContext.d.ts +10 -0
- package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModellerContext.js +8 -0
- package/lib/components/FlowModeller/FlowModellerContext.js.map +1 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts +93 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node/Node.types.js +27 -0
- package/lib/components/FlowModeller/Node/Node.types.js.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +212 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +144 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +5 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.js +130 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -0
- package/lib/components/FlowModeller/Node.d.ts +10 -0
- package/lib/components/FlowModeller/Node.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node.js +43 -0
- package/lib/components/FlowModeller/Node.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts +4 -0
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.js +198 -0
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +20 -0
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.types.js +2 -0
- package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +63 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +291 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +37 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +114 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +29 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +191 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.d.ts +38 -0
- package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.js +363 -0
- package/lib/components/FlowModeller/Renderer/Utils/RendererUtils.js.map +1 -0
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts +18 -0
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/addNodeUtils.js +148 -0
- package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +33 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +89 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/constants.d.ts +10 -0
- package/lib/components/FlowModeller/constants.d.ts.map +1 -0
- package/lib/components/FlowModeller/constants.js +9 -0
- package/lib/components/FlowModeller/constants.js.map +1 -0
- package/lib/components/FlowModeller/helper.d.ts +39 -0
- package/lib/components/FlowModeller/helper.d.ts.map +1 -0
- package/lib/components/FlowModeller/helper.js +230 -0
- package/lib/components/FlowModeller/helper.js.map +1 -0
- package/lib/components/FlowModeller/index.d.ts +18 -0
- package/lib/components/FlowModeller/index.d.ts.map +1 -0
- package/lib/components/FlowModeller/index.js +11 -0
- package/lib/components/FlowModeller/index.js.map +1 -0
- package/lib/components/IconTile/IconTile.d.ts +2 -2
- package/lib/components/IconTile/IconTile.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.d.ts +2 -2
- package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.js +5 -1
- package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts +6 -6
- package/lib/components/LifeCycle/Category.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.d.ts +184 -2
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +70 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts +6 -6
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts +8 -8
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +1 -1
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +14 -10
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/TaskGroup.d.ts +3 -1
- package/lib/components/LifeCycle/TaskGroup.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +2 -2
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts +10 -8
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.d.ts.map +1 -1
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.js +1 -1
- package/lib/components/ObjectSelect/InputTree/InputTree.styles.js.map +1 -1
- package/lib/components/PageBanner/PageBanner.d.ts +3 -3
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.js +6 -2
- package/lib/components/PageBanner/PageBanner.js.map +1 -1
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts +4 -2
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.d.ts.map +1 -1
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js +23 -12
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageHeader.js.map +1 -1
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.d.ts.map +1 -1
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js +14 -5
- package/lib/components/PageTemplates/ConstructPageTemplate/ConstructPageTemplate.js.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.d.ts +2 -2
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/HeaderActionButtons.d.ts.map +1 -1
- package/lib/components/PageTemplates/HeaderActionButtons.js +11 -3
- package/lib/components/PageTemplates/HeaderActionButtons.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplate.styles.d.ts +375 -8
- package/lib/components/PageTemplates/PageTemplate.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplate.styles.js +18 -10
- package/lib/components/PageTemplates/PageTemplate.styles.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplate.types.d.ts +18 -13
- package/lib/components/PageTemplates/PageTemplate.types.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplate.types.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +4 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +9 -5
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/ShowcasePage.d.ts +2 -2
- package/lib/components/PageTemplates/ShowcasePage.d.ts.map +1 -1
- package/lib/components/RulePicker/RulePicker.d.ts +1 -1
- package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.js +13 -1
- package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +12 -8
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/typeIconMapping.d.ts.map +1 -1
- package/lib/utils/typeIconMapping.js +2 -0
- package/lib/utils/typeIconMapping.js.map +1 -1
- package/lib/utils/utils.d.ts +5 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +19 -0
- package/lib/utils/utils.js.map +1 -0
- package/package.json +7 -10
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { DirectedGraph } from './Graph';
|
|
2
|
+
import GraphTraversal from './GraphTraversal';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the given graphItem is a part of multi branch convergence scenario and returns the convergence data and parent id
|
|
5
|
+
* @param graphItem - node or connector
|
|
6
|
+
* @param graph - Directed graph object
|
|
7
|
+
*/
|
|
8
|
+
export const getParentConvergence = (graphItem, graph) => {
|
|
9
|
+
const gd = graph.getGraphData();
|
|
10
|
+
/** As convergence data exists only for node
|
|
11
|
+
* if the given graphItem is a connector then
|
|
12
|
+
* reset it to the source node of first in-connector
|
|
13
|
+
*/
|
|
14
|
+
let parent = 'dimensions' in graphItem ? graphItem : graph.getNode(graphItem.fromNodeId);
|
|
15
|
+
// loop until a node with convergence data is found and the given graphItem is a part of the convergence data
|
|
16
|
+
while (graph.getInConnectors(parent.id).length > 0) {
|
|
17
|
+
/** if convergence data exists check whether the graphItem is exists in nodesInvolved or connectorsInvolved
|
|
18
|
+
* if graphItem exists in the summary then return the current convergence data
|
|
19
|
+
*/
|
|
20
|
+
const convergence = GraphTraversal.getConvergenceData(gd, parent.id);
|
|
21
|
+
if (convergence &&
|
|
22
|
+
convergence.paths &&
|
|
23
|
+
(graphItem.id in convergence.summary.nodesInvolved ||
|
|
24
|
+
graphItem.id in convergence.summary.connectorsInvolved)) {
|
|
25
|
+
for (let i = 0; i < convergence.paths.length; i += 1) {
|
|
26
|
+
const pathData = convergence.paths[i];
|
|
27
|
+
if (Array.isArray(pathData)) {
|
|
28
|
+
for (let j = 0; j < pathData.length; j += 1) {
|
|
29
|
+
const pathItem = pathData[j];
|
|
30
|
+
if (!Array.isArray(pathItem) &&
|
|
31
|
+
(graphItem.id in pathItem.summary.nodesInvolved ||
|
|
32
|
+
graphItem.id in pathItem.summary.connectorsInvolved)) {
|
|
33
|
+
return { convergence, pathIndex: i, itemIndexInPath: j, parent };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** if current graphItem(parent) is not a part of convergence data
|
|
40
|
+
* set it to source node of first in-connector
|
|
41
|
+
*/
|
|
42
|
+
parent = graph.getNode(graph.getInConnectors(parent.id)[0].fromNodeId);
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
/** Returns an object where keys are y-cords of node/connector and
|
|
47
|
+
* values are an array of node/connector id's having same y-cord as key
|
|
48
|
+
* @param graph - Directed graph object
|
|
49
|
+
*/
|
|
50
|
+
export const groupByPosition = (graph) => {
|
|
51
|
+
const graphData = [...graph.getNodes(), ...graph.getConnectors()];
|
|
52
|
+
const positions = {};
|
|
53
|
+
graphData.forEach((graphItem) => {
|
|
54
|
+
/** check if current graphItem's y-cord exists as a key in positions object
|
|
55
|
+
* if key exists then insert the current graphItem id in appropriate index of the value array sorted by x-cord
|
|
56
|
+
* else create a key value pair where key is the y-cord and value is an array with current graphItem id
|
|
57
|
+
*/
|
|
58
|
+
if (graphItem) {
|
|
59
|
+
if ('dimensions' in graphItem) {
|
|
60
|
+
const yCoordinate = graphItem.dimensions.height
|
|
61
|
+
? graphItem.position.y
|
|
62
|
+
: graphItem.position.y - 60;
|
|
63
|
+
if (yCoordinate in positions) {
|
|
64
|
+
const graphItemIds = positions[yCoordinate];
|
|
65
|
+
for (let i = graphItemIds.length - 1; i >= 0; i -= 1) {
|
|
66
|
+
const node = graph.getNode(graphItemIds[i]);
|
|
67
|
+
if (graphItem.position && node.position && graphItem.position.x < node.position.x) {
|
|
68
|
+
if (i === 0) {
|
|
69
|
+
graphItemIds.unshift(graphItem.id);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (graphItemIds.length === 1) {
|
|
74
|
+
graphItemIds.push(graphItem.id);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
graphItemIds.splice(i + 1, 0, graphItem.id);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
positions[graphItem.position.y] = [graphItem.id];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (graphItem.points.length > 3) {
|
|
87
|
+
const y = graphItem.points[3].y - 20;
|
|
88
|
+
if (y in positions) {
|
|
89
|
+
const graphItemIds = positions[y];
|
|
90
|
+
for (let i = graphItemIds.length - 1; i >= 0; i -= 1) {
|
|
91
|
+
const connector = graph.getConnector(graphItemIds[i]);
|
|
92
|
+
if (graphItem.points.length &&
|
|
93
|
+
connector?.points?.length &&
|
|
94
|
+
graphItem.points[3].x < connector.points[3].x) {
|
|
95
|
+
if (i === 0) {
|
|
96
|
+
graphItemIds.unshift(graphItem.id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (graphItemIds.length === 1) {
|
|
101
|
+
graphItemIds.push(graphItem.id);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
graphItemIds.splice(i + 1, 0, graphItem.id);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
positions[y] = [graphItem.id];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return positions;
|
|
116
|
+
};
|
|
117
|
+
export const arrowUpKey = ({ activeGraphItemId, activeGraphItem, readOnly, graph }) => {
|
|
118
|
+
if (readOnly) {
|
|
119
|
+
const prevNode = graph.getPrevNodes(activeGraphItemId).slice(-1)[0];
|
|
120
|
+
if (!prevNode) {
|
|
121
|
+
return GraphTraversal.findLeafNode(graph);
|
|
122
|
+
}
|
|
123
|
+
if (!prevNode.dimensions.height) {
|
|
124
|
+
const inConnectors = graph.getInConnectors(prevNode.id);
|
|
125
|
+
return inConnectors[0].fromNodeId;
|
|
126
|
+
}
|
|
127
|
+
return prevNode.id;
|
|
128
|
+
}
|
|
129
|
+
// Node
|
|
130
|
+
if ('dimensions' in activeGraphItem) {
|
|
131
|
+
const inConnectors = graph.getInConnectors(activeGraphItemId);
|
|
132
|
+
if (inConnectors.length > 0) {
|
|
133
|
+
return inConnectors[0].id;
|
|
134
|
+
}
|
|
135
|
+
return GraphTraversal.findLeafNode(graph);
|
|
136
|
+
}
|
|
137
|
+
// for Connector
|
|
138
|
+
const targetNode = graph.getNode(graph.getConnector(activeGraphItemId).fromNodeId);
|
|
139
|
+
if (targetNode.dimensions.height) {
|
|
140
|
+
return targetNode.id;
|
|
141
|
+
}
|
|
142
|
+
const parentConvergence = getParentConvergence(targetNode, graph);
|
|
143
|
+
if (parentConvergence) {
|
|
144
|
+
const connectorId = parentConvergence.convergence.connectors[0]?.[0];
|
|
145
|
+
if (typeof connectorId !== 'string') {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
const connectorFromNode = graph.getNode(graph.getConnector(connectorId).fromNodeId);
|
|
149
|
+
if (connectorFromNode.type?.minConnectors || !connectorFromNode.dimensions.height) {
|
|
150
|
+
return connectorId;
|
|
151
|
+
}
|
|
152
|
+
if (connectorFromNode.dimensions.height) {
|
|
153
|
+
return graph.getConnector(connectorId).fromNodeId;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
};
|
|
158
|
+
export const arrowDownKey = ({ activeGraphItemId, activeGraphItem, readOnly, graph }) => {
|
|
159
|
+
if (readOnly) {
|
|
160
|
+
let nextNode = graph.getNextNodes(activeGraphItemId)[0];
|
|
161
|
+
if (!nextNode) {
|
|
162
|
+
return GraphTraversal.findRootNode(graph);
|
|
163
|
+
}
|
|
164
|
+
while (!nextNode.dimensions.height) {
|
|
165
|
+
[nextNode] = graph.getNextNodes(nextNode.id);
|
|
166
|
+
}
|
|
167
|
+
return nextNode.id;
|
|
168
|
+
}
|
|
169
|
+
// for Node
|
|
170
|
+
if ('dimensions' in activeGraphItem) {
|
|
171
|
+
const outConnectors = graph.getOutConnectors(activeGraphItemId);
|
|
172
|
+
if (outConnectors.length > 0) {
|
|
173
|
+
if (activeGraphItem.type?.minConnectors) {
|
|
174
|
+
return outConnectors[0].id;
|
|
175
|
+
}
|
|
176
|
+
return graph.getOutConnectors(outConnectors[0].toNodeId)[0].id;
|
|
177
|
+
}
|
|
178
|
+
return GraphTraversal.findRootNode(graph);
|
|
179
|
+
}
|
|
180
|
+
// for Connector
|
|
181
|
+
const targetNode = graph.getNode(graph.getConnector(activeGraphItemId).toNodeId);
|
|
182
|
+
if (targetNode.dimensions.height) {
|
|
183
|
+
return targetNode.id;
|
|
184
|
+
}
|
|
185
|
+
return graph.getOutConnectors(targetNode.id)[0].id;
|
|
186
|
+
};
|
|
187
|
+
export const horizontalNavigation = ({ positions, activeGraphItem, keyEvent, graph, readOnly }) => {
|
|
188
|
+
const pointsIndex = 3;
|
|
189
|
+
const yCoordinate = 20;
|
|
190
|
+
let focusId;
|
|
191
|
+
const rankGroup = 'dimensions' in activeGraphItem
|
|
192
|
+
? positions[activeGraphItem.position.y]
|
|
193
|
+
: positions[activeGraphItem.points[pointsIndex].y - yCoordinate];
|
|
194
|
+
let itemIndex = rankGroup.indexOf(activeGraphItem.id);
|
|
195
|
+
if (keyEvent === 'ArrowLeft') {
|
|
196
|
+
/**
|
|
197
|
+
* If current active graph item is a connector and previous connector in rank group is originating from a Go to node
|
|
198
|
+
* then iterate the rank group until we find a connector thats not originating from a go to node
|
|
199
|
+
* and is not the first connector in the rank group
|
|
200
|
+
*/
|
|
201
|
+
while (itemIndex > 0 && !('dimensions' in activeGraphItem)) {
|
|
202
|
+
const previousConnector = graph.getConnector(rankGroup[itemIndex - 1]);
|
|
203
|
+
const sourceNode = graph.getNode(previousConnector.fromNodeId);
|
|
204
|
+
if (sourceNode.type?.minConnectors === 0) {
|
|
205
|
+
itemIndex -= 1;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (itemIndex > 0) {
|
|
212
|
+
/**
|
|
213
|
+
* If current focused graph item is a node and previous node to focus in rank group is a placeholder node
|
|
214
|
+
* then get the in-connectors of placeholder node and focus on the last focusable item(node/connector add node button)
|
|
215
|
+
* of the last in-connector
|
|
216
|
+
* If the previous node in rank group is not placeholder node then directly focus it
|
|
217
|
+
*/
|
|
218
|
+
if ('dimensions' in activeGraphItem) {
|
|
219
|
+
const parallelNodeInPreviousPath = graph.getNode(rankGroup[itemIndex - 1]);
|
|
220
|
+
if (parallelNodeInPreviousPath.dimensions.height) {
|
|
221
|
+
focusId = rankGroup[itemIndex - 1];
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
const inConnectors = graph.getInConnectors(parallelNodeInPreviousPath.id);
|
|
225
|
+
const lastInConnectorIndex = inConnectors.length - 1;
|
|
226
|
+
if (readOnly) {
|
|
227
|
+
let sourceNode = graph.getNode(inConnectors[lastInConnectorIndex].fromNodeId);
|
|
228
|
+
while (!sourceNode.dimensions.height) {
|
|
229
|
+
const sourceNodeInConnectors = graph.getInConnectors(sourceNode.id);
|
|
230
|
+
if (sourceNodeInConnectors.length) {
|
|
231
|
+
sourceNode = graph.getNode(sourceNodeInConnectors[sourceNodeInConnectors.length - 1].fromNodeId);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
focusId = sourceNode.id;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
const sourceNode = graph.getNode(inConnectors[lastInConnectorIndex].fromNodeId);
|
|
238
|
+
if (sourceNode.type?.minConnectors === 0) {
|
|
239
|
+
focusId = inConnectors[lastInConnectorIndex].fromNodeId;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
focusId = inConnectors[lastInConnectorIndex].id;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
focusId = rankGroup[itemIndex - 1];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
/**
|
|
253
|
+
* If current focused item is the first item in the rank group
|
|
254
|
+
* then check if there is branch of the same convergence or any parent convergence is present to the left of the current focused item
|
|
255
|
+
* if so then focus on the first focusable in that branch/path
|
|
256
|
+
*/
|
|
257
|
+
let result = getParentConvergence(activeGraphItem, graph);
|
|
258
|
+
while (result && result.pathIndex === 0) {
|
|
259
|
+
result = getParentConvergence(result.parent, graph);
|
|
260
|
+
}
|
|
261
|
+
if (result) {
|
|
262
|
+
const connectorInPreviousPath = graph.getOutConnectors(result.parent.id)[result.pathIndex - 1];
|
|
263
|
+
if (readOnly) {
|
|
264
|
+
let nodeIdInPreviousPath = graph.getNode(connectorInPreviousPath.toNodeId);
|
|
265
|
+
while (!nodeIdInPreviousPath.dimensions.height) {
|
|
266
|
+
const outConnectors = graph.getOutConnectors(nodeIdInPreviousPath.id);
|
|
267
|
+
if (outConnectors.length) {
|
|
268
|
+
nodeIdInPreviousPath = graph.getNode(outConnectors[0].toNodeId);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
focusId = nodeIdInPreviousPath.id;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
focusId = connectorInPreviousPath.id;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (keyEvent === 'ArrowRight') {
|
|
280
|
+
/**
|
|
281
|
+
* If current active graph item is a connector and next connector in rank group is originating from a Goto node
|
|
282
|
+
* then iterate the rank group until we find a connector thats not originating from a Goto node
|
|
283
|
+
* and is not the last connector in the rank group
|
|
284
|
+
*/
|
|
285
|
+
while (itemIndex < rankGroup.length - 1 && !('dimensions' in activeGraphItem)) {
|
|
286
|
+
const nextConnector = graph.getConnector(rankGroup[itemIndex + 1]);
|
|
287
|
+
const sourceNode = graph.getNode(nextConnector.fromNodeId);
|
|
288
|
+
if (sourceNode.type?.minConnectors === 0) {
|
|
289
|
+
itemIndex += 1;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (itemIndex < rankGroup.length - 1) {
|
|
296
|
+
if ('dimensions' in activeGraphItem) {
|
|
297
|
+
/**
|
|
298
|
+
* If current focused graph item is a node and next node to focus in rank group is a placeholder node
|
|
299
|
+
* then get the in-connectors of placeholder node and focus on the last focusable item(node/connector add node button)
|
|
300
|
+
* of the first in-connector
|
|
301
|
+
* If the next node in rank group is not placeholder node then directly focus it
|
|
302
|
+
*/
|
|
303
|
+
const parallelNodeInNextPath = graph.getNode(rankGroup[itemIndex + 1]);
|
|
304
|
+
if (parallelNodeInNextPath.dimensions.height) {
|
|
305
|
+
focusId = rankGroup[itemIndex + 1];
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
const inConnectors = graph.getInConnectors(parallelNodeInNextPath.id);
|
|
309
|
+
if (readOnly) {
|
|
310
|
+
let sourceNode = graph.getNode(inConnectors[0].fromNodeId);
|
|
311
|
+
while (!sourceNode.dimensions.height) {
|
|
312
|
+
const sourceNodeInConnectors = graph.getInConnectors(sourceNode.id);
|
|
313
|
+
if (sourceNodeInConnectors.length) {
|
|
314
|
+
sourceNode = graph.getNode(sourceNodeInConnectors[0].fromNodeId);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
focusId = sourceNode.id;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
const sourceNode = graph.getNode(inConnectors[0].fromNodeId);
|
|
321
|
+
if (sourceNode.type?.minConnectors === 0) {
|
|
322
|
+
focusId = inConnectors[0].fromNodeId;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
focusId = inConnectors[0].id;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
focusId = rankGroup[itemIndex + 1];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
/**
|
|
336
|
+
* If current focused item is the last item in the rank group
|
|
337
|
+
* then check if there is branch of the same convergence or any parent convergence is present to the right of the current focused item
|
|
338
|
+
* if so then focus on the first focusable in that branch/path
|
|
339
|
+
*/
|
|
340
|
+
let result = getParentConvergence(activeGraphItem, graph);
|
|
341
|
+
while (result &&
|
|
342
|
+
result.convergence.paths &&
|
|
343
|
+
result.pathIndex === result.convergence.paths.length - 1) {
|
|
344
|
+
result = getParentConvergence(result.parent, graph);
|
|
345
|
+
}
|
|
346
|
+
if (result) {
|
|
347
|
+
const connectorInNextPath = graph.getOutConnectors(result.parent.id)[result.pathIndex + 1];
|
|
348
|
+
if (readOnly) {
|
|
349
|
+
let nodeIdInNextPath = graph.getNode(connectorInNextPath.toNodeId);
|
|
350
|
+
while (!nodeIdInNextPath.dimensions.height) {
|
|
351
|
+
nodeIdInNextPath = graph.getNode(graph.getOutConnectors(nodeIdInNextPath.id)[0].toNodeId);
|
|
352
|
+
}
|
|
353
|
+
focusId = nodeIdInNextPath.id;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
focusId = connectorInNextPath.id;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return focusId;
|
|
362
|
+
};
|
|
363
|
+
//# sourceMappingURL=RendererUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EACxD,CAAC;gBACD,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,mBAAmB,GAAG,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC3F,IAAI,QAAQ,EAAE,CAAC;oBACb,IAAI,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;oBACnE,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;wBAC3C,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAC9B,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CACxD,CAAC;oBACJ,CAAC;oBACD,OAAO,GAAG,gBAAgB,CAAC,EAAE,CAAC;gBAChC,CAAC;qBAAM,CAAC;oBACN,OAAO,GAAG,mBAAmB,CAAC,EAAE,CAAC;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import type { NodeProps } from '../../Node/Node.types';\n\nimport { DirectedGraph } from './Graph';\nimport type { ConnectorProps } from './Graph';\nimport type { PlottedGraphConnector, PlottedGraphNode } from './GraphLayout';\nimport GraphTraversal from './GraphTraversal';\nimport type { ConvergenceData } from './GraphTraversal';\n\nexport type ParentConvergence = {\n convergence: ConvergenceData<PlottedGraphNode, PlottedGraphConnector>;\n pathIndex: number;\n itemIndexInPath: number;\n parent: PlottedGraphNode;\n};\n\n/**\n * Checks if the given graphItem is a part of multi branch convergence scenario and returns the convergence data and parent id\n * @param graphItem - node or connector\n * @param graph - Directed graph object\n */\nexport const getParentConvergence = (\n graphItem: PlottedGraphNode | PlottedGraphConnector,\n graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>\n): ParentConvergence | false => {\n const gd = graph.getGraphData();\n /** As convergence data exists only for node\n * if the given graphItem is a connector then\n * reset it to the source node of first in-connector\n */\n let parent: PlottedGraphNode | PlottedGraphConnector =\n 'dimensions' in graphItem ? graphItem : graph.getNode(graphItem.fromNodeId);\n\n // loop until a node with convergence data is found and the given graphItem is a part of the convergence data\n while (graph.getInConnectors(parent.id).length > 0) {\n /** if convergence data exists check whether the graphItem is exists in nodesInvolved or connectorsInvolved\n * if graphItem exists in the summary then return the current convergence data\n */\n const convergence = GraphTraversal.getConvergenceData<PlottedGraphNode, PlottedGraphConnector>(\n gd,\n parent.id\n );\n if (\n convergence &&\n convergence.paths &&\n (graphItem.id in convergence.summary.nodesInvolved ||\n graphItem.id in convergence.summary.connectorsInvolved)\n ) {\n for (let i = 0; i < convergence.paths.length; i += 1) {\n const pathData = convergence.paths[i];\n if (Array.isArray(pathData)) {\n for (let j = 0; j < pathData.length; j += 1) {\n const pathItem = pathData[j];\n if (\n !Array.isArray(pathItem) &&\n (graphItem.id in pathItem.summary.nodesInvolved ||\n graphItem.id in pathItem.summary.connectorsInvolved)\n ) {\n return { convergence, pathIndex: i, itemIndexInPath: j, parent };\n }\n }\n }\n }\n }\n /** if current graphItem(parent) is not a part of convergence data\n * set it to source node of first in-connector\n */\n parent = graph.getNode(graph.getInConnectors(parent.id)[0].fromNodeId);\n }\n\n return false;\n};\n\n/** Returns an object where keys are y-cords of node/connector and\n * values are an array of node/connector id's having same y-cord as key\n * @param graph - Directed graph object\n */\nexport const groupByPosition = (graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>) => {\n const graphData = [...graph.getNodes(), ...graph.getConnectors()];\n const positions: Record<\n NodeProps['id'] | ConnectorProps['id'],\n [NodeProps['id'] | ConnectorProps['id']]\n > = {};\n\n graphData.forEach((graphItem: PlottedGraphNode | PlottedGraphConnector) => {\n /** check if current graphItem's y-cord exists as a key in positions object\n * if key exists then insert the current graphItem id in appropriate index of the value array sorted by x-cord\n * else create a key value pair where key is the y-cord and value is an array with current graphItem id\n */\n if (graphItem) {\n if ('dimensions' in graphItem) {\n const yCoordinate = graphItem.dimensions.height\n ? graphItem.position.y\n : graphItem.position.y - 60;\n if (yCoordinate in positions) {\n const graphItemIds = positions[yCoordinate];\n for (let i = graphItemIds.length - 1; i >= 0; i -= 1) {\n const node = graph.getNode(graphItemIds[i]);\n if (graphItem.position && node.position && graphItem.position.x < node.position.x) {\n if (i === 0) {\n graphItemIds.unshift(graphItem.id);\n }\n } else {\n if (graphItemIds.length === 1) {\n graphItemIds.push(graphItem.id);\n break;\n }\n graphItemIds.splice(i + 1, 0, graphItem.id);\n break;\n }\n }\n } else {\n positions[graphItem.position.y] = [graphItem.id];\n }\n } else if (graphItem.points.length > 3) {\n const y = graphItem.points[3].y - 20;\n if (y in positions) {\n const graphItemIds = positions[y];\n for (let i = graphItemIds.length - 1; i >= 0; i -= 1) {\n const connector = graph.getConnector(graphItemIds[i]);\n if (\n graphItem.points.length &&\n connector?.points?.length &&\n graphItem.points[3].x < connector.points[3].x\n ) {\n if (i === 0) {\n graphItemIds.unshift(graphItem.id);\n }\n } else {\n if (graphItemIds.length === 1) {\n graphItemIds.push(graphItem.id);\n break;\n }\n graphItemIds.splice(i + 1, 0, graphItem.id);\n break;\n }\n }\n } else {\n positions[y] = [graphItem.id];\n }\n }\n }\n });\n\n return positions;\n};\n\ninterface VerticalNavigationProps {\n activeGraphItemId: string;\n activeGraphItem: PlottedGraphNode | PlottedGraphConnector;\n readOnly: boolean;\n graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>;\n}\n\ninterface HorizontalNavigationProps {\n activeGraphItem: VerticalNavigationProps['activeGraphItem'];\n keyEvent: 'ArrowLeft' | 'ArrowRight';\n positions: Record<string, [string]>;\n graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>;\n readOnly?: boolean;\n}\n\nexport const arrowUpKey = ({\n activeGraphItemId,\n activeGraphItem,\n readOnly,\n graph\n}: VerticalNavigationProps) => {\n if (readOnly) {\n const prevNode = graph.getPrevNodes(activeGraphItemId).slice(-1)[0];\n if (!prevNode) {\n return GraphTraversal.findLeafNode(graph);\n }\n if (!prevNode.dimensions.height) {\n const inConnectors = graph.getInConnectors(prevNode.id);\n return inConnectors[0].fromNodeId;\n }\n return prevNode.id;\n }\n\n // Node\n if ('dimensions' in activeGraphItem) {\n const inConnectors = graph.getInConnectors(activeGraphItemId);\n if (inConnectors.length > 0) {\n return inConnectors[0].id;\n }\n return GraphTraversal.findLeafNode(graph);\n }\n\n // for Connector\n const targetNode = graph.getNode(graph.getConnector(activeGraphItemId).fromNodeId);\n if (targetNode.dimensions.height) {\n return targetNode.id;\n }\n const parentConvergence = getParentConvergence(targetNode, graph);\n if (parentConvergence) {\n const connectorId = parentConvergence.convergence.connectors[0]?.[0];\n if (typeof connectorId !== 'string') {\n return undefined;\n }\n\n const connectorFromNode = graph.getNode(graph.getConnector(connectorId).fromNodeId);\n if (connectorFromNode.type?.minConnectors || !connectorFromNode.dimensions.height) {\n return connectorId;\n }\n if (connectorFromNode.dimensions.height) {\n return graph.getConnector(connectorId).fromNodeId;\n }\n }\n\n return undefined;\n};\n\nexport const arrowDownKey = ({\n activeGraphItemId,\n activeGraphItem,\n readOnly,\n graph\n}: VerticalNavigationProps) => {\n if (readOnly) {\n let nextNode = graph.getNextNodes(activeGraphItemId)[0];\n if (!nextNode) {\n return GraphTraversal.findRootNode(graph);\n }\n while (!nextNode.dimensions.height) {\n [nextNode] = graph.getNextNodes(nextNode.id);\n }\n return nextNode.id;\n }\n // for Node\n if ('dimensions' in activeGraphItem) {\n const outConnectors = graph.getOutConnectors(activeGraphItemId);\n if (outConnectors.length > 0) {\n if (activeGraphItem.type?.minConnectors) {\n return outConnectors[0].id;\n }\n return graph.getOutConnectors(outConnectors[0].toNodeId)[0].id;\n }\n return GraphTraversal.findRootNode(graph);\n }\n // for Connector\n const targetNode = graph.getNode(graph.getConnector(activeGraphItemId).toNodeId);\n if (targetNode.dimensions.height) {\n return targetNode.id;\n }\n return graph.getOutConnectors(targetNode.id)[0].id;\n};\n\nexport const horizontalNavigation = ({\n positions,\n activeGraphItem,\n keyEvent,\n graph,\n readOnly\n}: HorizontalNavigationProps) => {\n const pointsIndex = 3;\n const yCoordinate = 20;\n let focusId: string | undefined;\n\n const rankGroup =\n 'dimensions' in activeGraphItem\n ? positions[activeGraphItem.position.y]\n : positions[activeGraphItem.points[pointsIndex].y - yCoordinate];\n let itemIndex = rankGroup.indexOf(activeGraphItem.id);\n\n if (keyEvent === 'ArrowLeft') {\n /**\n * If current active graph item is a connector and previous connector in rank group is originating from a Go to node\n * then iterate the rank group until we find a connector thats not originating from a go to node\n * and is not the first connector in the rank group\n */\n while (itemIndex > 0 && !('dimensions' in activeGraphItem)) {\n const previousConnector = graph.getConnector(rankGroup[itemIndex - 1]);\n const sourceNode = graph.getNode(previousConnector.fromNodeId);\n if (sourceNode.type?.minConnectors === 0) {\n itemIndex -= 1;\n } else {\n break;\n }\n }\n if (itemIndex > 0) {\n /**\n * If current focused graph item is a node and previous node to focus in rank group is a placeholder node\n * then get the in-connectors of placeholder node and focus on the last focusable item(node/connector add node button)\n * of the last in-connector\n * If the previous node in rank group is not placeholder node then directly focus it\n */\n if ('dimensions' in activeGraphItem) {\n const parallelNodeInPreviousPath = graph.getNode(rankGroup[itemIndex - 1]);\n if (parallelNodeInPreviousPath.dimensions.height) {\n focusId = rankGroup[itemIndex - 1];\n } else {\n const inConnectors = graph.getInConnectors(parallelNodeInPreviousPath.id);\n const lastInConnectorIndex = inConnectors.length - 1;\n\n if (readOnly) {\n let sourceNode = graph.getNode(inConnectors[lastInConnectorIndex].fromNodeId);\n while (!sourceNode.dimensions.height) {\n const sourceNodeInConnectors = graph.getInConnectors(sourceNode.id);\n if (sourceNodeInConnectors.length) {\n sourceNode = graph.getNode(\n sourceNodeInConnectors[sourceNodeInConnectors.length - 1].fromNodeId\n );\n }\n }\n focusId = sourceNode.id;\n } else {\n const sourceNode = graph.getNode(inConnectors[lastInConnectorIndex].fromNodeId);\n if (sourceNode.type?.minConnectors === 0) {\n focusId = inConnectors[lastInConnectorIndex].fromNodeId;\n } else {\n focusId = inConnectors[lastInConnectorIndex].id;\n }\n }\n }\n } else {\n focusId = rankGroup[itemIndex - 1];\n }\n } else {\n /**\n * If current focused item is the first item in the rank group\n * then check if there is branch of the same convergence or any parent convergence is present to the left of the current focused item\n * if so then focus on the first focusable in that branch/path\n */\n let result = getParentConvergence(activeGraphItem, graph);\n while (result && result.pathIndex === 0) {\n result = getParentConvergence(result.parent, graph);\n }\n if (result) {\n const connectorInPreviousPath = graph.getOutConnectors(result.parent.id)[\n result.pathIndex - 1\n ];\n if (readOnly) {\n let nodeIdInPreviousPath = graph.getNode(connectorInPreviousPath.toNodeId);\n while (!nodeIdInPreviousPath.dimensions.height) {\n const outConnectors = graph.getOutConnectors(nodeIdInPreviousPath.id);\n if (outConnectors.length) {\n nodeIdInPreviousPath = graph.getNode(outConnectors[0].toNodeId);\n }\n }\n focusId = nodeIdInPreviousPath.id;\n } else {\n focusId = connectorInPreviousPath.id;\n }\n }\n }\n }\n if (keyEvent === 'ArrowRight') {\n /**\n * If current active graph item is a connector and next connector in rank group is originating from a Goto node\n * then iterate the rank group until we find a connector thats not originating from a Goto node\n * and is not the last connector in the rank group\n */\n while (itemIndex < rankGroup.length - 1 && !('dimensions' in activeGraphItem)) {\n const nextConnector = graph.getConnector(rankGroup[itemIndex + 1]);\n const sourceNode = graph.getNode(nextConnector.fromNodeId);\n if (sourceNode.type?.minConnectors === 0) {\n itemIndex += 1;\n } else {\n break;\n }\n }\n\n if (itemIndex < rankGroup.length - 1) {\n if ('dimensions' in activeGraphItem) {\n /**\n * If current focused graph item is a node and next node to focus in rank group is a placeholder node\n * then get the in-connectors of placeholder node and focus on the last focusable item(node/connector add node button)\n * of the first in-connector\n * If the next node in rank group is not placeholder node then directly focus it\n */\n const parallelNodeInNextPath = graph.getNode(rankGroup[itemIndex + 1]);\n if (parallelNodeInNextPath.dimensions.height) {\n focusId = rankGroup[itemIndex + 1];\n } else {\n const inConnectors = graph.getInConnectors(parallelNodeInNextPath.id);\n\n if (readOnly) {\n let sourceNode = graph.getNode(inConnectors[0].fromNodeId);\n while (!sourceNode.dimensions.height) {\n const sourceNodeInConnectors = graph.getInConnectors(sourceNode.id);\n if (sourceNodeInConnectors.length) {\n sourceNode = graph.getNode(sourceNodeInConnectors[0].fromNodeId);\n }\n }\n focusId = sourceNode.id;\n } else {\n const sourceNode = graph.getNode(inConnectors[0].fromNodeId);\n if (sourceNode.type?.minConnectors === 0) {\n focusId = inConnectors[0].fromNodeId;\n } else {\n focusId = inConnectors[0].id;\n }\n }\n }\n } else {\n focusId = rankGroup[itemIndex + 1];\n }\n } else {\n /**\n * If current focused item is the last item in the rank group\n * then check if there is branch of the same convergence or any parent convergence is present to the right of the current focused item\n * if so then focus on the first focusable in that branch/path\n */\n let result = getParentConvergence(activeGraphItem, graph);\n while (\n result &&\n result.convergence.paths &&\n result.pathIndex === result.convergence.paths.length - 1\n ) {\n result = getParentConvergence(result.parent, graph);\n }\n if (result) {\n const connectorInNextPath = graph.getOutConnectors(result.parent.id)[result.pathIndex + 1];\n if (readOnly) {\n let nodeIdInNextPath = graph.getNode(connectorInNextPath.toNodeId);\n while (!nodeIdInNextPath.dimensions.height) {\n nodeIdInNextPath = graph.getNode(\n graph.getOutConnectors(nodeIdInNextPath.id)[0].toNodeId\n );\n }\n focusId = nodeIdInNextPath.id;\n } else {\n focusId = connectorInNextPath.id;\n }\n }\n }\n }\n return focusId;\n};\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AddNodeHandlerParams } from '../Renderer/Renderer.types';
|
|
2
|
+
import type { ConnectorProps, GraphData, Node } from '../Renderer/Utils/Graph';
|
|
3
|
+
import { DirectedGraph } from '../Renderer/Utils/Graph';
|
|
4
|
+
import type { PlottedGraphNode, PlottedGraphConnector } from '../Renderer/Utils/GraphLayout';
|
|
5
|
+
export interface PlaceHolderNode extends PlottedGraphNode {
|
|
6
|
+
realConnectors: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface PlaceHolderConnector extends PlottedGraphConnector {
|
|
9
|
+
realConnectors: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const isPlaceHolderNode: (node: PlaceHolderNode | Node) => node is PlaceHolderNode;
|
|
12
|
+
export declare const isPlaceHolderConnector: (connector: PlaceHolderConnector | ConnectorProps) => connector is PlaceHolderConnector;
|
|
13
|
+
declare const PlaceHolderHelper: {
|
|
14
|
+
insertAtConnectorsMerge: (graph: DirectedGraph, getNewPHNodeCB: (addNodeMeta: AddNodeHandlerParams) => PlottedGraphNode, getNewPHConnectorCB: (fromNode: string, toNode: string, addNodeMeta: AddNodeHandlerParams) => PlottedGraphConnector) => void;
|
|
15
|
+
injectPlaceholderNodes: (graphData: GraphData<PlottedGraphNode, PlottedGraphConnector>, onGetNewNode: (metaData: AddNodeHandlerParams) => PlottedGraphNode, onGetNewConnector: (fromNodeId: string, toNodeId: string, metaData: AddNodeHandlerParams) => PlottedGraphConnector) => GraphData<PlottedGraphNode<unknown>, PlottedGraphConnector<unknown>>;
|
|
16
|
+
};
|
|
17
|
+
export default PlaceHolderHelper;
|
|
18
|
+
//# sourceMappingURL=addNodeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addNodeUtils.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Utils/addNodeUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAI7F,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AACD,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAGD,eAAO,MAAM,iBAAiB,GAAI,MAAM,eAAe,GAAG,IAAI,KAAG,IAAI,IAAI,eAExE,CAAC;AAGF,eAAO,MAAM,sBAAsB,GACjC,WAAW,oBAAoB,GAAG,cAAc,KAC/C,SAAS,IAAI,oBAEf,CAAC;AA+BF,QAAA,MAAM,iBAAiB;qCAEZ,aAAa,kBACJ,CAAC,WAAW,EAAE,oBAAoB,KAAK,gBAAgB,uBAClD,CACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,oBAAoB,KAC9B,qBAAqB;wCAsEf,SAAS,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,gBAC/C,CAAC,QAAQ,EAAE,oBAAoB,KAAK,gBAAgB,qBAC/C,CACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,oBAAoB,KAC3B,qBAAqB;CA8D7B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { DirectedGraph } from '../Renderer/Utils/Graph';
|
|
2
|
+
import GraphTraversal from '../Renderer/Utils/GraphTraversal';
|
|
3
|
+
// type-guard PlaceHolderNode
|
|
4
|
+
export const isPlaceHolderNode = (node) => {
|
|
5
|
+
return 'realConnectors' in node && node.realConnectors !== undefined;
|
|
6
|
+
};
|
|
7
|
+
// type-guard PlaceHolderConnector
|
|
8
|
+
export const isPlaceHolderConnector = (connector) => {
|
|
9
|
+
return 'realConnectors' in connector && connector.realConnectors !== undefined;
|
|
10
|
+
};
|
|
11
|
+
// Extracts the first string from a NestedArray item.
|
|
12
|
+
const getFirstString = (item) => {
|
|
13
|
+
let current = item;
|
|
14
|
+
while (typeof current !== 'string') {
|
|
15
|
+
[current] = current;
|
|
16
|
+
}
|
|
17
|
+
return current;
|
|
18
|
+
};
|
|
19
|
+
const countInvisibleConnectors = (graph, connectors) => {
|
|
20
|
+
let invisibleConnectorsCount = 0;
|
|
21
|
+
for (let i = 0; i < connectors.length; i += 1) {
|
|
22
|
+
const connector = connectors[i];
|
|
23
|
+
if (Array.isArray(connector)) {
|
|
24
|
+
invisibleConnectorsCount += countInvisibleConnectors(graph, connector);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const connectorData = graph.getConnector(connector);
|
|
28
|
+
const fromNode = graph.getNode(connectorData.fromNodeId);
|
|
29
|
+
if (fromNode?.type?.minConnectors === 0) {
|
|
30
|
+
invisibleConnectorsCount += 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return invisibleConnectorsCount;
|
|
35
|
+
};
|
|
36
|
+
const PlaceHolderHelper = {
|
|
37
|
+
insertAtConnectorsMerge: (graph, getNewPHNodeCB, getNewPHConnectorCB) => {
|
|
38
|
+
const gd = graph.getGraphData();
|
|
39
|
+
// process the graph and find the first node automatically. We can find it easily by iterating and finding the node with no in-connectors
|
|
40
|
+
const bfs = GraphTraversal.bfs(gd);
|
|
41
|
+
bfs.reverse().forEach(nodeId => {
|
|
42
|
+
const node = graph.getNode(nodeId);
|
|
43
|
+
// get the node's convergence data
|
|
44
|
+
const result = GraphTraversal.getConvergenceData(graph.getGraphData(), node.id);
|
|
45
|
+
// if node has more than one out-connector and has convergence data
|
|
46
|
+
if (result !== false) {
|
|
47
|
+
// iterate over the resultant connectors
|
|
48
|
+
for (let i = 0; i < result.connectors.length; i += 1) {
|
|
49
|
+
const connectorsToUpdate = result.connectors[i];
|
|
50
|
+
let invisibleConnectorsCount = 0;
|
|
51
|
+
/** Count number of invisible connectors originating from go to shapes forming a convergence/join
|
|
52
|
+
* compare invisible connectors count with connectors forming a convergence
|
|
53
|
+
*/
|
|
54
|
+
if (typeof connectorsToUpdate !== 'string' && connectorsToUpdate.length > 1) {
|
|
55
|
+
invisibleConnectorsCount = countInvisibleConnectors(graph, connectorsToUpdate);
|
|
56
|
+
// ensure connectors converging are greater than invisible connectors
|
|
57
|
+
if (connectorsToUpdate.length > invisibleConnectorsCount) {
|
|
58
|
+
let refConnectorIdsArray = [];
|
|
59
|
+
connectorsToUpdate.forEach(itrConId => {
|
|
60
|
+
const conId = getFirstString(itrConId);
|
|
61
|
+
const connector = graph.getConnector(conId);
|
|
62
|
+
if (isPlaceHolderConnector(connector)) {
|
|
63
|
+
refConnectorIdsArray = [...refConnectorIdsArray, ...connector.realConnectors];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
refConnectorIdsArray.push(conId);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const addNodeMeta = {
|
|
70
|
+
refType: 'connector',
|
|
71
|
+
refId: refConnectorIdsArray
|
|
72
|
+
};
|
|
73
|
+
const newNode = getNewPHNodeCB(addNodeMeta);
|
|
74
|
+
const newPNode = {
|
|
75
|
+
...newNode,
|
|
76
|
+
realConnectors: refConnectorIdsArray
|
|
77
|
+
};
|
|
78
|
+
graph.addNode(newPNode);
|
|
79
|
+
connectorsToUpdate.forEach(item => {
|
|
80
|
+
graph.setConnector(getFirstString(item), {
|
|
81
|
+
toNodeId: newNode.id
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
const newConnector = getNewPHConnectorCB(newNode.id, result.nodeId, addNodeMeta);
|
|
85
|
+
const newPConnector = {
|
|
86
|
+
...newConnector,
|
|
87
|
+
realConnectors: refConnectorIdsArray
|
|
88
|
+
};
|
|
89
|
+
graph.addConnector(newPConnector);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
injectPlaceholderNodes: (graphData, onGetNewNode, onGetNewConnector) => {
|
|
97
|
+
// gets GraphData<RendererNodeProps, RendererConnectorProps>
|
|
98
|
+
const targetGraph = new DirectedGraph(graphData);
|
|
99
|
+
// insert placeholder-nodes at connector convergence point for nodes with multiple out connectors.
|
|
100
|
+
PlaceHolderHelper.insertAtConnectorsMerge(targetGraph, onGetNewNode, onGetNewConnector);
|
|
101
|
+
// iterate all nodes with more than one in-connectors and insert addNode before current one.
|
|
102
|
+
targetGraph.getNodes().forEach(node => {
|
|
103
|
+
// should not add a node before a placeholder node
|
|
104
|
+
if (isPlaceHolderNode(node)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (targetGraph.getPrevNodesCount(node.id) > 1) {
|
|
108
|
+
let refConnectorIdsArray = [];
|
|
109
|
+
// connect all in-connectors to a new node and create a new connector that connects from new node to the actual toNodeId.
|
|
110
|
+
targetGraph.getInConnectors(node.id).forEach(con => {
|
|
111
|
+
const connector = targetGraph.getConnector(con.id);
|
|
112
|
+
if (isPlaceHolderConnector(connector)) {
|
|
113
|
+
refConnectorIdsArray = [...refConnectorIdsArray, ...connector.realConnectors];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
refConnectorIdsArray.push(con.id);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const metaData = {
|
|
120
|
+
refType: 'connector',
|
|
121
|
+
refId: refConnectorIdsArray
|
|
122
|
+
};
|
|
123
|
+
// create a new placeholder node
|
|
124
|
+
const newNode = onGetNewNode(metaData);
|
|
125
|
+
const placeHolderNode = {
|
|
126
|
+
...newNode,
|
|
127
|
+
realConnectors: refConnectorIdsArray
|
|
128
|
+
};
|
|
129
|
+
targetGraph.addNode(placeHolderNode);
|
|
130
|
+
// connect all in-connectors to a new node and create a new connector that connects from new node to the actual toNodeId.
|
|
131
|
+
targetGraph.getInConnectors(node.id).forEach(con => {
|
|
132
|
+
targetGraph.setConnector(con.id, {
|
|
133
|
+
toNodeId: placeHolderNode.id
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
const newConnector = onGetNewConnector(placeHolderNode.id, node.id, metaData);
|
|
137
|
+
const placeholderConnector = {
|
|
138
|
+
...newConnector,
|
|
139
|
+
realConnectors: refConnectorIdsArray
|
|
140
|
+
};
|
|
141
|
+
targetGraph.addConnector(placeholderConnector);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return targetGraph.getGraphData();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
export default PlaceHolderHelper;
|
|
148
|
+
//# sourceMappingURL=addNodeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addNodeUtils.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Utils/addNodeUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAU9D,6BAA6B;AAC7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAA4B,EAA2B,EAAE;IACzF,OAAO,gBAAgB,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC;AACvE,CAAC,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,SAAgD,EACb,EAAE;IACrC,OAAO,gBAAgB,IAAI,SAAS,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC;AACjF,CAAC,CAAC;AAEF,qDAAqD;AACrD,MAAM,cAAc,GAAG,CAAC,IAAkC,EAAU,EAAE;IACpE,IAAI,OAAO,GAAiC,IAAI,CAAC;IACjD,OAAO,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACnC,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAC/B,KAAoB,EACpB,UAA+B,EACvB,EAAE;IACV,IA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from '@pega/cosmos-react-core';\n\nimport type { AddNodeProps } from '../AddNode';\nimport type { AddNodeHandlerParams } from '../Renderer/Renderer.types';\nimport type { ConnectorProps, GraphData, Node } from '../Renderer/Utils/Graph';\nimport { DirectedGraph } from '../Renderer/Utils/Graph';\nimport type { PlottedGraphNode, PlottedGraphConnector } from '../Renderer/Utils/GraphLayout';\nimport GraphTraversal from '../Renderer/Utils/GraphTraversal';\nimport type { NestedArray } from '../Renderer/Utils/GraphTraversal';\n\nexport interface PlaceHolderNode extends PlottedGraphNode {\n realConnectors: string[];\n}\nexport interface PlaceHolderConnector extends PlottedGraphConnector {\n realConnectors: string[];\n}\n\n// type-guard PlaceHolderNode\nexport const isPlaceHolderNode = (node: PlaceHolderNode | Node): node is PlaceHolderNode => {\n return 'realConnectors' in node && node.realConnectors !== undefined;\n};\n\n// type-guard PlaceHolderConnector\nexport const isPlaceHolderConnector = (\n connector: PlaceHolderConnector | ConnectorProps\n): connector is PlaceHolderConnector => {\n return 'realConnectors' in connector && connector.realConnectors !== undefined;\n};\n\n// Extracts the first string from a NestedArray item.\nconst getFirstString = (item: string | NestedArray<string>): string => {\n let current: string | NestedArray<string> = item;\n while (typeof current !== 'string') {\n [current] = current;\n }\n return current;\n};\n\nconst countInvisibleConnectors = (\n graph: DirectedGraph,\n connectors: NestedArray<string>\n): number => {\n let invisibleConnectorsCount = 0;\n for (let i = 0; i < connectors.length; i += 1) {\n const connector = connectors[i];\n if (Array.isArray(connector)) {\n invisibleConnectorsCount += countInvisibleConnectors(graph, connector);\n } else {\n const connectorData = graph.getConnector(connector);\n const fromNode = graph.getNode(connectorData.fromNodeId);\n if (fromNode?.type?.minConnectors === 0) {\n invisibleConnectorsCount += 1;\n }\n }\n }\n return invisibleConnectorsCount;\n};\n\nconst PlaceHolderHelper = {\n insertAtConnectorsMerge: (\n graph: DirectedGraph,\n getNewPHNodeCB: (addNodeMeta: AddNodeHandlerParams) => PlottedGraphNode,\n getNewPHConnectorCB: (\n fromNode: string,\n toNode: string,\n addNodeMeta: AddNodeHandlerParams\n ) => PlottedGraphConnector\n ) => {\n const gd = graph.getGraphData();\n\n // process the graph and find the first node automatically. We can find it easily by iterating and finding the node with no in-connectors\n const bfs = GraphTraversal.bfs(gd);\n bfs.reverse().forEach(nodeId => {\n const node = graph.getNode(nodeId);\n\n // get the node's convergence data\n const result = GraphTraversal.getConvergenceData(graph.getGraphData(), node.id);\n\n // if node has more than one out-connector and has convergence data\n if (result !== false) {\n // iterate over the resultant connectors\n for (let i = 0; i < result.connectors.length; i += 1) {\n const connectorsToUpdate = result.connectors[i];\n let invisibleConnectorsCount = 0;\n\n /** Count number of invisible connectors originating from go to shapes forming a convergence/join\n * compare invisible connectors count with connectors forming a convergence\n */\n if (typeof connectorsToUpdate !== 'string' && connectorsToUpdate.length > 1) {\n invisibleConnectorsCount = countInvisibleConnectors(graph, connectorsToUpdate);\n\n // ensure connectors converging are greater than invisible connectors\n if (connectorsToUpdate.length > invisibleConnectorsCount) {\n let refConnectorIdsArray: string[] = [];\n\n connectorsToUpdate.forEach(itrConId => {\n const conId = getFirstString(itrConId);\n\n const connector = graph.getConnector(conId);\n if (isPlaceHolderConnector(connector)) {\n refConnectorIdsArray = [...refConnectorIdsArray, ...connector.realConnectors];\n } else {\n refConnectorIdsArray.push(conId);\n }\n });\n\n const addNodeMeta: AddNodeHandlerParams = {\n refType: 'connector',\n refId: refConnectorIdsArray\n };\n const newNode = getNewPHNodeCB(addNodeMeta);\n const newPNode: PlaceHolderNode = {\n ...newNode,\n realConnectors: refConnectorIdsArray\n };\n graph.addNode(newPNode);\n\n connectorsToUpdate.forEach(item => {\n graph.setConnector(getFirstString(item), {\n toNodeId: newNode.id\n });\n });\n\n const newConnector = getNewPHConnectorCB(newNode.id, result.nodeId, addNodeMeta);\n const newPConnector: PlaceHolderConnector = {\n ...newConnector,\n realConnectors: refConnectorIdsArray\n };\n graph.addConnector(newPConnector);\n }\n }\n }\n }\n });\n },\n injectPlaceholderNodes: (\n graphData: GraphData<PlottedGraphNode, PlottedGraphConnector>,\n onGetNewNode: (metaData: AddNodeHandlerParams) => PlottedGraphNode,\n onGetNewConnector: (\n fromNodeId: string,\n toNodeId: string,\n metaData: AddNodeHandlerParams\n ) => PlottedGraphConnector\n ) => {\n // gets GraphData<RendererNodeProps, RendererConnectorProps>\n const targetGraph = new DirectedGraph(graphData);\n\n // insert placeholder-nodes at connector convergence point for nodes with multiple out connectors.\n PlaceHolderHelper.insertAtConnectorsMerge(targetGraph, onGetNewNode, onGetNewConnector);\n\n // iterate all nodes with more than one in-connectors and insert addNode before current one.\n targetGraph.getNodes().forEach(node => {\n // should not add a node before a placeholder node\n if (isPlaceHolderNode(node)) {\n return;\n }\n\n if (targetGraph.getPrevNodesCount(node.id) > 1) {\n let refConnectorIdsArray: string[] = [];\n\n // connect all in-connectors to a new node and create a new connector that connects from new node to the actual toNodeId.\n targetGraph.getInConnectors(node.id).forEach(con => {\n const connector = targetGraph.getConnector(con.id);\n if (isPlaceHolderConnector(connector)) {\n refConnectorIdsArray = [...refConnectorIdsArray, ...connector.realConnectors];\n } else {\n refConnectorIdsArray.push(con.id);\n }\n });\n\n const metaData: AddNodeHandlerParams = {\n refType: 'connector',\n refId: refConnectorIdsArray\n };\n\n // create a new placeholder node\n const newNode: OmitStrict<AddNodeProps, 'highlight' | 'addNodeHandler'> =\n onGetNewNode(metaData);\n const placeHolderNode: PlaceHolderNode = {\n ...newNode,\n realConnectors: refConnectorIdsArray\n };\n\n targetGraph.addNode(placeHolderNode);\n\n // connect all in-connectors to a new node and create a new connector that connects from new node to the actual toNodeId.\n targetGraph.getInConnectors(node.id).forEach(con => {\n targetGraph.setConnector(con.id, {\n toNodeId: placeHolderNode.id\n });\n });\n\n const newConnector = onGetNewConnector(placeHolderNode.id, node.id, metaData);\n const placeholderConnector: PlaceHolderConnector = {\n ...newConnector,\n realConnectors: refConnectorIdsArray\n };\n\n targetGraph.addConnector(placeholderConnector);\n }\n });\n\n return targetGraph.getGraphData();\n }\n};\n\nexport default PlaceHolderHelper;\n"]}
|