@pega/cosmos-react-build 9.0.0-build.9.9 → 9.0.0
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 @@
|
|
|
1
|
+
{"version":3,"file":"GraphLayout.js","sourceRoot":"","sources":["../../../../../src/components/FlowModeller/Renderer/Utils/GraphLayout.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,OAAO,KAAK,MAAM,gBAAgB,CAAC;AA2BnC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;CAClB,CAAC;AAKF,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,wBAAwB;IACxB,MAAM,CAAC,IAAI,CACT,SAAY,EACZ,WAAoB,KAAK,EACzB,YAAsC,oBAAoB,CAAC,WAAW;QAEtE,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAElE,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAE3C,MAAM,gBAAgB,GAAG,GAAG,CAAC;QAC7B,MAAM,iBAAiB,GAAG,GAAG,CAAC;QAE9B,UAAU,CAAC,QAAQ,CAAC;YAClB,OAAO,EAAE,SAAS;YAClB,O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port type { ConnectorProps, GraphData, Node } from './Graph';\n\nexport interface PlottedGraphNode<T = unknown> extends Node<T> {\n dimensions: {\n width: number;\n height: number;\n };\n position: {\n x: number;\n y: number;\n };\n referencedNode?: T;\n}\n\nexport interface PlottedGraphConnector<T = unknown> extends ConnectorProps<T> {\n points: { x: number; y: number }[];\n labelLayout?: {\n value: string;\n width: number;\n height: number;\n x: number;\n y: number;\n };\n}\n\nexport const GraphLayoutDirection = {\n LeftToRight: 'LR',\n TopToBottom: 'TB'\n};\n\nexport type GraphLayoutDirectionType =\n (typeof GraphLayoutDirection)[keyof typeof GraphLayoutDirection];\n\nconst DEFAULT_GRAPH_WIDTH = 2000;\nconst DEFAULT_GRAPH_HEIGHT = 2000;\n\nexport default class GraphLayout {\n // Using Dagre layouting\n static plot<T extends GraphData<PlottedGraphNode, PlottedGraphConnector>>(\n graphData: T,\n readOnly: boolean = false,\n direction: GraphLayoutDirectionType = GraphLayoutDirection.TopToBottom\n ) {\n const dagreGraph = new dagre.graphlib.Graph({ multigraph: true });\n\n dagreGraph.setDefaultEdgeLabel(() => ({}));\n\n const defaultNodeWidth = 280;\n const defaultNodeHeight = 112;\n\n dagreGraph.setGraph({\n rankdir: direction,\n ranksep: readOnly ? 2 : 4,\n edgesep: defaultNodeWidth / 2,\n nodesep: 20,\n marginx: 200,\n marginy: 32\n });\n\n graphData.nodes.forEach(node => {\n dagreGraph.setNode(node.id, {\n width: node.dimensions.width ?? defaultNodeWidth,\n height: node.dimensions.height ?? defaultNodeHeight\n });\n });\n\n graphData.connectors.forEach((con, index) => {\n dagreGraph.setEdge(\n con.fromNodeId,\n con.toNodeId,\n {\n weight: 1,\n minlen: 2,\n label:\n con.data &&\n typeof con.data === 'object' &&\n 'label' in con.data &&\n typeof con.data.label === 'string'\n ? con.data.label\n : '',\n width: 250,\n height: con.data && typeof con.data === 'object' && 'label' in con.data ? 90 : 40,\n lablepos: 'c',\n labeloffset: 0\n },\n index.toString()\n );\n });\n\n dagre.layout(dagreGraph, { disableOptimalOrderHeuristic: true });\n\n graphData.nodes.forEach(el => {\n const node = dagreGraph.node(el.id);\n el.position.x = node.x - el.dimensions.width / 2;\n el.position.y = node.y - el.dimensions.height / 2;\n });\n\n graphData.connectors.forEach((con, index) => {\n const edge = dagreGraph.edge(con.fromNodeId, con.toNodeId, index.toString());\n\n con.labelLayout = {\n value: edge.label,\n x: edge.x,\n y: edge.y,\n width: edge.width,\n height: edge.height\n };\n\n const lastIndex = edge.points.length - 1;\n let firstPoint = edge.points[0];\n const secondPoint = edge.points[1];\n let lastPoint = edge.points[lastIndex];\n const secondLastPoint = edge.points[lastIndex - 1];\n\n const fromNode = dagreGraph.node(con.fromNodeId);\n const toNode = dagreGraph.node(con.toNodeId);\n\n firstPoint =\n firstPoint.x !== secondPoint.x\n ? {\n ...edge.points[0],\n x: fromNode.x,\n y: edge.points[1].y\n }\n : firstPoint;\n\n lastPoint =\n lastPoint.x !== secondLastPoint.x\n ? {\n ...edge.points[lastIndex],\n x: toNode.x,\n y: edge.points[lastIndex - 1].y\n }\n : lastPoint;\n\n con.points = [\n { x: fromNode.x, y: fromNode.y + fromNode.height / 2 },\n { ...firstPoint, y: firstPoint.y + 10 },\n { ...secondPoint, y: secondPoint.y + 10 },\n ...edge.points.slice(2, lastIndex),\n lastPoint\n ];\n\n // Only add the last point incase the edge has an arc at end\n if (edge.points[lastIndex].x !== edge.points[lastIndex - 1].x) {\n con.points.push({ x: toNode.x, y: toNode.y });\n }\n\n // if current edge source node is an placeholder node move down the starting point of placeholder node by 12\n if (fromNode.height === 0) {\n con.points[0].y += 12;\n }\n\n const edgeLastPointIndex = con.points.length - 1;\n\n // Move the merging arcs last point to the starting point of placeholder node\n if (\n con.points[edgeLastPointIndex].x === con.points[edgeLastPointIndex - 1].x &&\n toNode.height === 0\n ) {\n con.points[edgeLastPointIndex].y += 12;\n }\n });\n\n const { width } = dagreGraph.graph();\n const { height } = dagreGraph.graph();\n\n return {\n width: Number.isFinite(width) ? width : DEFAULT_GRAPH_WIDTH,\n height: Number.isFinite(height) ? height : DEFAULT_GRAPH_HEIGHT\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ConnectorProps, GraphData, Node } from './Graph';
|
|
2
|
+
import { DirectedGraph } from './Graph';
|
|
3
|
+
export interface NestedArray<T> extends Array<T | NestedArray<T>> {
|
|
4
|
+
}
|
|
5
|
+
export interface ConvergenceData<T extends Node, U extends ConnectorProps> {
|
|
6
|
+
nodeId: string;
|
|
7
|
+
connectors: NestedArray<string>;
|
|
8
|
+
summary: {
|
|
9
|
+
nodesInvolved: Record<string, T>;
|
|
10
|
+
connectorsInvolved: Record<string, U>;
|
|
11
|
+
};
|
|
12
|
+
paths?: NestedArray<ConvergenceData<T, U>>;
|
|
13
|
+
}
|
|
14
|
+
export default class GraphTraversal {
|
|
15
|
+
static bfs(gd: GraphData, src?: string): string[];
|
|
16
|
+
static dfs(gd: GraphData, src?: string): string[];
|
|
17
|
+
static findRootNode(graph: DirectedGraph): string | false;
|
|
18
|
+
static findLeafNode(graph: DirectedGraph): string | false;
|
|
19
|
+
/**
|
|
20
|
+
* Given the graphData and the source node with morethan one branch, It calculates the convergence node, involved connectors and paths
|
|
21
|
+
* Assuming, goTo is not supported
|
|
22
|
+
*
|
|
23
|
+
* @param gd graphData to process on
|
|
24
|
+
* @param src id of the source node. This needs to be a node with multiple branches
|
|
25
|
+
* @returns id of the destination node or null if not found
|
|
26
|
+
*/
|
|
27
|
+
static getConvergenceData<T extends Node = Node, U extends ConnectorProps = ConnectorProps>(gd: GraphData<T, U>, src: string): ConvergenceData<T, U> | false;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=GraphTraversal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphTraversal.d.ts","sourceRoot":"","sources":["../../../../../src/components/FlowModeller/Renderer/Utils/GraphTraversal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc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jC"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { DirectedGraph } from './Graph';
|
|
2
|
+
export default class GraphTraversal {
|
|
3
|
+
static bfs(gd, src) {
|
|
4
|
+
const graph = new DirectedGraph(gd);
|
|
5
|
+
if (!src) {
|
|
6
|
+
const rootNodeId = GraphTraversal.findRootNode(graph);
|
|
7
|
+
if (!rootNodeId) {
|
|
8
|
+
throw Error('Invalid graph, cannot find root node.');
|
|
9
|
+
}
|
|
10
|
+
src = rootNodeId;
|
|
11
|
+
}
|
|
12
|
+
const queue = [src];
|
|
13
|
+
const result = [];
|
|
14
|
+
const map = { src }; // needed for duplicate comparison
|
|
15
|
+
while (queue.length > 0) {
|
|
16
|
+
const source = queue.shift();
|
|
17
|
+
if (source !== undefined) {
|
|
18
|
+
result.push(source);
|
|
19
|
+
const nextNodes = graph.getNextNodes(source);
|
|
20
|
+
nextNodes.forEach((node) => {
|
|
21
|
+
if (!map[node.id]) {
|
|
22
|
+
queue.push(node.id);
|
|
23
|
+
map[node.id] = node.id;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
static dfs(gd, src) {
|
|
31
|
+
const graph = new DirectedGraph(gd);
|
|
32
|
+
// finding the start node automatically
|
|
33
|
+
if (!src) {
|
|
34
|
+
const rootNodeId = GraphTraversal.findRootNode(graph);
|
|
35
|
+
if (!rootNodeId) {
|
|
36
|
+
throw Error('Invalid graph, cannot find root node.');
|
|
37
|
+
}
|
|
38
|
+
src = rootNodeId;
|
|
39
|
+
}
|
|
40
|
+
const stack = [src];
|
|
41
|
+
const result = [];
|
|
42
|
+
const map = {
|
|
43
|
+
src
|
|
44
|
+
}; // needed for duplicate comparison
|
|
45
|
+
while (stack.length > 0) {
|
|
46
|
+
const source = stack.pop();
|
|
47
|
+
if (source !== undefined) {
|
|
48
|
+
result.push(source);
|
|
49
|
+
const nextNodes = graph.getNextNodes(source);
|
|
50
|
+
nextNodes.forEach(node => {
|
|
51
|
+
if (map[node.id] === undefined) {
|
|
52
|
+
stack.push(node.id);
|
|
53
|
+
map[node.id] = node.id;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
// Assuming the given graph has no unconnected nodes and the graph is not cyclic(if start node have in-connectors(ie., cyclic), this will fail).
|
|
61
|
+
// - returns first encountered node with no in-connectors as a root node, if more than one exists
|
|
62
|
+
static findRootNode(graph) {
|
|
63
|
+
const nodes = graph.getNodes();
|
|
64
|
+
for (let i = 0; i < nodes.length; i += 1) {
|
|
65
|
+
if (graph.getPrevNodesCount(nodes[i].id) === 0) {
|
|
66
|
+
return nodes[i].id;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
// - returns first encountered node with no out-connectors as a leaf node, if more than one exists
|
|
72
|
+
static findLeafNode(graph) {
|
|
73
|
+
for (const node of graph.getNodes()) {
|
|
74
|
+
if (graph.isLeaf(node.id)) {
|
|
75
|
+
return node.id;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Given the graphData and the source node with morethan one branch, It calculates the convergence node, involved connectors and paths
|
|
82
|
+
* Assuming, goTo is not supported
|
|
83
|
+
*
|
|
84
|
+
* @param gd graphData to process on
|
|
85
|
+
* @param src id of the source node. This needs to be a node with multiple branches
|
|
86
|
+
* @returns id of the destination node or null if not found
|
|
87
|
+
*/
|
|
88
|
+
// TODO-OPTIMIZE Memoize, for a given GraphData
|
|
89
|
+
static getConvergenceData(gd, src) {
|
|
90
|
+
const graph = new DirectedGraph(gd);
|
|
91
|
+
// return false, if there is no node with given source node id
|
|
92
|
+
if (graph.getNode(src) === undefined || graph.getNextNodesCount(src) < 2) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
// traverse the nodes -- and record the paths of each connector
|
|
96
|
+
const path = []; // array of path-arrays
|
|
97
|
+
const initialConnectors = graph.getOutConnectors(src);
|
|
98
|
+
// iterate the initial set of connectors
|
|
99
|
+
initialConnectors.forEach((item, index) => {
|
|
100
|
+
path[index] = [];
|
|
101
|
+
let currentConnector = item;
|
|
102
|
+
// traverse through each connector and push the encountered nodes
|
|
103
|
+
while (currentConnector && currentConnector.toNodeId !== undefined) {
|
|
104
|
+
path[index].push({
|
|
105
|
+
nodeId: currentConnector.toNodeId,
|
|
106
|
+
connectors: [currentConnector.id],
|
|
107
|
+
summary: {
|
|
108
|
+
nodesInvolved: {
|
|
109
|
+
[currentConnector.toNodeId]: graph.getNode(currentConnector.toNodeId)
|
|
110
|
+
},
|
|
111
|
+
connectorsInvolved: { [currentConnector.id]: currentConnector }
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const inConnectors = graph.getInConnectors(currentConnector.toNodeId);
|
|
115
|
+
// if this node has multiple in connectors, that means this is a join [IMP TODO NOTE until we support goTo option]
|
|
116
|
+
if (inConnectors.length > 1) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let outConnectors = graph.getOutConnectors(currentConnector.toNodeId);
|
|
120
|
+
let newCurrentNodeId = currentConnector.toNodeId;
|
|
121
|
+
// check if this node has multiple branches and call recursively
|
|
122
|
+
while (outConnectors.length > 1) {
|
|
123
|
+
const result = GraphTraversal.getConvergenceData(gd, newCurrentNodeId);
|
|
124
|
+
// handle resultNodeId val as false use case: just cancel futher processing and return false
|
|
125
|
+
if (result === false) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
// add result node to the path
|
|
129
|
+
path[index].push(result);
|
|
130
|
+
/** if the result node has multiple in-connectors and few of them(i.e foreign connectors or connector belonging to other/parent multi branch scenario)
|
|
131
|
+
* are not a part of the current multi branch scenario then the resultant node is a merging point for other branches.
|
|
132
|
+
* ************************** Check for foreign connectors - START ************************** */
|
|
133
|
+
const resultNodeInConnectors = Array.from(graph.getInConnectors(result.nodeId), con => con.id);
|
|
134
|
+
// All the connectors involved in the current multi branch scenario
|
|
135
|
+
const connectorsInvolved = Object.keys(result.summary.connectorsInvolved);
|
|
136
|
+
let hasForeignConnector = false;
|
|
137
|
+
for (let i = 0; i < resultNodeInConnectors.length; i += 1) {
|
|
138
|
+
if (!connectorsInvolved.some(con => con === resultNodeInConnectors[i])) {
|
|
139
|
+
hasForeignConnector = true;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// if we have a foreign in-connector on result node then skip current path
|
|
144
|
+
if (hasForeignConnector) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// ************************** check for foreign connector - END **************************
|
|
148
|
+
// handle, resultNode as a shape with multiple out-connectors(multi branch)
|
|
149
|
+
outConnectors = graph.getOutConnectors(result.nodeId);
|
|
150
|
+
newCurrentNodeId = result.nodeId;
|
|
151
|
+
}
|
|
152
|
+
// else if out connectors is 1
|
|
153
|
+
currentConnector = outConnectors[0];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// validate and return false if no convergence node found
|
|
157
|
+
for (let i = 1; i < path.length; i += 1) {
|
|
158
|
+
if (path[i][path[i].length - 1].nodeId !== path[i - 1][path[i - 1].length - 1].nodeId) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const result = {
|
|
163
|
+
nodeId: path[0][path[0].length - 1].nodeId,
|
|
164
|
+
connectors: [],
|
|
165
|
+
paths: [],
|
|
166
|
+
summary: {
|
|
167
|
+
nodesInvolved: {},
|
|
168
|
+
connectorsInvolved: {}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
for (let i = 0; i < path.length; i += 1) {
|
|
172
|
+
const current = path[i];
|
|
173
|
+
result.connectors.push(current[current.length - 1].connectors);
|
|
174
|
+
if (result.paths !== undefined) {
|
|
175
|
+
result.paths[i] = current;
|
|
176
|
+
}
|
|
177
|
+
current.forEach(item => {
|
|
178
|
+
result.summary.nodesInvolved = {
|
|
179
|
+
...result.summary.nodesInvolved,
|
|
180
|
+
...item.summary.nodesInvolved
|
|
181
|
+
};
|
|
182
|
+
result.summary.connectorsInvolved = {
|
|
183
|
+
...result.summary.connectorsInvolved,
|
|
184
|
+
...item.summary.connectorsInvolved
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=GraphTraversal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphTraversal.js","sourceRoot":"","sources":["../../../../../src/components/FlowModeller/Renderer/Utils/GraphTraversal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAcxC,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,MAAM,CAAC,GAAG,CAAC,EAAa,EAAE,GAAY;QACpC,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC;QAEpC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,UAAU,GAAG,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAEtD,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,KAAK,CAAC,uCAAuC,CAAC,CAAC;YACvD,CAAC;YAED,GAAG,GAAG,UAAU,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAa,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,GAAG,GAA2B,EAAE,GAAG,EAAE,CAAC,CAAC,kCAAkC;QAE/E,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,MAAM,CAAC,IAAI,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O,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACrB,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG;oBAC7B,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa;oBAC/B,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa;iBAC9B,CAAC;gBAEF,MAAM,CAAC,OAAO,CAAC,kBAAkB,GAAG;oBAClC,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB;oBACpC,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB;iBACnC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import type { ConnectorProps, GraphData, Node } from './Graph';\nimport { DirectedGraph } from './Graph';\n\nexport interface NestedArray<T> extends Array<T | NestedArray<T>> {}\n\nexport interface ConvergenceData<T extends Node, U extends ConnectorProps> {\n nodeId: string;\n connectors: NestedArray<string>;\n summary: {\n nodesInvolved: Record<string, T>;\n connectorsInvolved: Record<string, U>;\n };\n paths?: NestedArray<ConvergenceData<T, U>>;\n}\n\nexport default class GraphTraversal {\n static bfs(gd: GraphData, src?: string): string[] {\n const graph = new DirectedGraph(gd);\n\n if (!src) {\n const rootNodeId = GraphTraversal.findRootNode(graph);\n\n if (!rootNodeId) {\n throw Error('Invalid graph, cannot find root node.');\n }\n\n src = rootNodeId;\n }\n\n const queue: string[] = [src];\n const result: string[] = [];\n const map: Record<string, string> = { src }; // needed for duplicate comparison\n\n while (queue.length > 0) {\n const source = queue.shift();\n if (source !== undefined) {\n result.push(source);\n\n const nextNodes = graph.getNextNodes(source);\n nextNodes.forEach((node: Node) => {\n if (!map[node.id]) {\n queue.push(node.id);\n map[node.id] = node.id;\n }\n });\n }\n }\n\n return result;\n }\n\n static dfs(gd: GraphData, src?: string): string[] {\n const graph = new DirectedGraph(gd);\n\n // finding the start node automatically\n if (!src) {\n const rootNodeId = GraphTraversal.findRootNode(graph);\n\n if (!rootNodeId) {\n throw Error('Invalid graph, cannot find root node.');\n }\n\n src = rootNodeId;\n }\n\n const stack: string[] = [src];\n const result: string[] = [];\n const map: Record<string, string> = {\n src\n }; // needed for duplicate comparison\n\n while (stack.length > 0) {\n const source = stack.pop();\n if (source !== undefined) {\n result.push(source);\n\n const nextNodes = graph.getNextNodes(source);\n\n nextNodes.forEach(node => {\n if (map[node.id] === undefined) {\n stack.push(node.id);\n map[node.id] = node.id;\n }\n });\n }\n }\n\n return result;\n }\n\n // Assuming the given graph has no unconnected nodes and the graph is not cyclic(if start node have in-connectors(ie., cyclic), this will fail).\n // - returns first encountered node with no in-connectors as a root node, if more than one exists\n static findRootNode(graph: DirectedGraph): string | false {\n const nodes = graph.getNodes();\n\n for (let i = 0; i < nodes.length; i += 1) {\n if (graph.getPrevNodesCount(nodes[i].id) === 0) {\n return nodes[i].id;\n }\n }\n\n return false;\n }\n\n // - returns first encountered node with no out-connectors as a leaf node, if more than one exists\n static findLeafNode(graph: DirectedGraph): string | false {\n for (const node of graph.getNodes()) {\n if (graph.isLeaf(node.id)) {\n return node.id;\n }\n }\n\n return false;\n }\n\n /**\n * Given the graphData and the source node with morethan one branch, It calculates the convergence node, involved connectors and paths\n * Assuming, goTo is not supported\n *\n * @param gd graphData to process on\n * @param src id of the source node. This needs to be a node with multiple branches\n * @returns id of the destination node or null if not found\n */\n // TODO-OPTIMIZE Memoize, for a given GraphData\n static getConvergenceData<T extends Node = Node, U extends ConnectorProps = ConnectorProps>(\n gd: GraphData<T, U>,\n src: string\n ): ConvergenceData<T, U> | false {\n const graph = new DirectedGraph<T, U>(gd);\n\n // return false, if there is no node with given source node id\n if (graph.getNode(src) === undefined || graph.getNextNodesCount(src) < 2) {\n return false;\n }\n\n // traverse the nodes -- and record the paths of each connector\n const path: ConvergenceData<T, U>[][] = []; // array of path-arrays\n const initialConnectors = graph.getOutConnectors(src);\n\n // iterate the initial set of connectors\n initialConnectors.forEach((item, index) => {\n path[index] = [];\n\n let currentConnector = item;\n // traverse through each connector and push the encountered nodes\n while (currentConnector && currentConnector.toNodeId !== undefined) {\n path[index].push({\n nodeId: currentConnector.toNodeId,\n connectors: [currentConnector.id],\n summary: {\n nodesInvolved: {\n [currentConnector.toNodeId]: graph.getNode(currentConnector.toNodeId)\n },\n connectorsInvolved: { [currentConnector.id]: currentConnector }\n }\n });\n\n const inConnectors = graph.getInConnectors(currentConnector.toNodeId);\n // if this node has multiple in connectors, that means this is a join [IMP TODO NOTE until we support goTo option]\n if (inConnectors.length > 1) {\n return;\n }\n\n let outConnectors = graph.getOutConnectors(currentConnector.toNodeId);\n\n let newCurrentNodeId = currentConnector.toNodeId;\n // check if this node has multiple branches and call recursively\n while (outConnectors.length > 1) {\n const result = GraphTraversal.getConvergenceData(gd, newCurrentNodeId);\n\n // handle resultNodeId val as false use case: just cancel futher processing and return false\n if (result === false) {\n break;\n }\n\n // add result node to the path\n path[index].push(result);\n\n /** if the result node has multiple in-connectors and few of them(i.e foreign connectors or connector belonging to other/parent multi branch scenario)\n * are not a part of the current multi branch scenario then the resultant node is a merging point for other branches.\n * ************************** Check for foreign connectors - START ************************** */\n const resultNodeInConnectors = Array.from(\n graph.getInConnectors(result.nodeId),\n con => con.id\n );\n\n // All the connectors involved in the current multi branch scenario\n const connectorsInvolved = Object.keys(result.summary.connectorsInvolved);\n\n let hasForeignConnector = false;\n\n for (let i = 0; i < resultNodeInConnectors.length; i += 1) {\n if (!connectorsInvolved.some(con => con === resultNodeInConnectors[i])) {\n hasForeignConnector = true;\n break;\n }\n }\n // if we have a foreign in-connector on result node then skip current path\n if (hasForeignConnector) {\n return;\n }\n // ************************** check for foreign connector - END **************************\n\n // handle, resultNode as a shape with multiple out-connectors(multi branch)\n outConnectors = graph.getOutConnectors(result.nodeId);\n newCurrentNodeId = result.nodeId;\n }\n\n // else if out connectors is 1\n\n currentConnector = outConnectors[0];\n }\n });\n\n // validate and return false if no convergence node found\n for (let i = 1; i < path.length; i += 1) {\n if (path[i][path[i].length - 1].nodeId !== path[i - 1][path[i - 1].length - 1].nodeId) {\n return false;\n }\n }\n\n const result: ConvergenceData<T, U> = {\n nodeId: path[0][path[0].length - 1].nodeId,\n connectors: [],\n paths: [],\n summary: {\n nodesInvolved: {},\n connectorsInvolved: {}\n }\n };\n\n for (let i = 0; i < path.length; i += 1) {\n const current = path[i];\n result.connectors.push(current[current.length - 1].connectors);\n\n if (result.paths !== undefined) {\n result.paths[i] = current;\n }\n\n current.forEach(item => {\n result.summary.nodesInvolved = {\n ...result.summary.nodesInvolved,\n ...item.summary.nodesInvolved\n };\n\n result.summary.connectorsInvolved = {\n ...result.summary.connectorsInvolved,\n ...item.summary.connectorsInvolved\n };\n });\n }\n\n return result;\n }\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DirectedGraph } from './Graph';
|
|
2
|
+
import type { PlottedGraphConnector, PlottedGraphNode } from './GraphLayout';
|
|
3
|
+
import type { ConvergenceData } from './GraphTraversal';
|
|
4
|
+
export type ParentConvergence = {
|
|
5
|
+
convergence: ConvergenceData<PlottedGraphNode, PlottedGraphConnector>;
|
|
6
|
+
pathIndex: number;
|
|
7
|
+
itemIndexInPath: number;
|
|
8
|
+
parent: PlottedGraphNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the given graphItem is a part of multi branch convergence scenario and returns the convergence data and parent id
|
|
12
|
+
* @param graphItem - node or connector
|
|
13
|
+
* @param graph - Directed graph object
|
|
14
|
+
*/
|
|
15
|
+
export declare const getParentConvergence: (graphItem: PlottedGraphNode | PlottedGraphConnector, graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>) => ParentConvergence | false;
|
|
16
|
+
/** Returns an object where keys are y-cords of node/connector and
|
|
17
|
+
* values are an array of node/connector id's having same y-cord as key
|
|
18
|
+
* @param graph - Directed graph object
|
|
19
|
+
*/
|
|
20
|
+
export declare const groupByPosition: (graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>) => Record<string, [string]>;
|
|
21
|
+
interface VerticalNavigationProps {
|
|
22
|
+
activeGraphItemId: string;
|
|
23
|
+
activeGraphItem: PlottedGraphNode | PlottedGraphConnector;
|
|
24
|
+
readOnly: boolean;
|
|
25
|
+
graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>;
|
|
26
|
+
}
|
|
27
|
+
interface HorizontalNavigationProps {
|
|
28
|
+
activeGraphItem: VerticalNavigationProps['activeGraphItem'];
|
|
29
|
+
keyEvent: 'ArrowLeft' | 'ArrowRight';
|
|
30
|
+
positions: Record<string, [string]>;
|
|
31
|
+
graph: DirectedGraph<PlottedGraphNode, PlottedGraphConnector>;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const arrowUpKey: ({ activeGraphItemId, activeGraphItem, readOnly, graph }: VerticalNavigationProps) => string | false | undefined;
|
|
35
|
+
export declare const arrowDownKey: ({ activeGraphItemId, activeGraphItem, readOnly, graph }: VerticalNavigationProps) => string | false;
|
|
36
|
+
export declare const horizontalNavigation: ({ positions, activeGraphItem, keyEvent, graph, readOnly }: HorizontalNavigationProps) => string | undefined;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=RendererUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RendererUtils.d.ts","sourceRoot":"","sources":["../../../../../src/components/FlowModeller/Renderer/Utils/RendererUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,eAAe,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,gBAAgB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