@pega/cosmos-react-build 9.0.0-build.9.8 → 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,359 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useReducer, useCallback, useRef, useMemo, memo } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { createUID, useI18n, useEscape, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
|
+
import { resizeDrawerDefaultWidth } from '@pega/cosmos-react-core/lib/styles/constants';
|
|
6
|
+
import ItemLibrary from '../ItemLibrary/ItemLibrary';
|
|
7
|
+
import { DirectedGraph } from './Renderer/Utils/Graph';
|
|
8
|
+
import FlowRenderer from './Renderer/Renderer';
|
|
9
|
+
import { START_NODETYPE, END_NODETYPE } from './Node/Node.types';
|
|
10
|
+
import PlaceHolderHelper from './Utils/addNodeUtils';
|
|
11
|
+
import AddButton from './AddNode';
|
|
12
|
+
import FlowModellerHelper from './helper';
|
|
13
|
+
import DeleteDialog from './DeleteDialog';
|
|
14
|
+
import Connector from './Connector';
|
|
15
|
+
import Node from './Node';
|
|
16
|
+
import FlowModellerContext from './FlowModellerContext';
|
|
17
|
+
import deleteNodeUtils from './Utils/deleteNodeUtils';
|
|
18
|
+
import FlowAuthoringPanel from './FlowAuthoringPanel/FlowAuthoringPanel';
|
|
19
|
+
const isNodeLibraryItem = (item) => 'minConnectors' in item.type;
|
|
20
|
+
const initState = {
|
|
21
|
+
showLib: false,
|
|
22
|
+
activeItem: null,
|
|
23
|
+
allowNonBranchNode: false,
|
|
24
|
+
activeAddBtnMeta: {
|
|
25
|
+
target: null,
|
|
26
|
+
meta: {
|
|
27
|
+
refType: 'node',
|
|
28
|
+
refId: ''
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
graphData: { nodes: [], connectors: [] },
|
|
32
|
+
highlightItems: undefined,
|
|
33
|
+
showDeleteDialog: false,
|
|
34
|
+
deleteProps: undefined
|
|
35
|
+
};
|
|
36
|
+
const reducer = (state, action) => {
|
|
37
|
+
switch (action.type) {
|
|
38
|
+
case 'showLibrary':
|
|
39
|
+
// minor optimization, not to update state.. if no change in the value
|
|
40
|
+
return action.payload.show === state.showLib
|
|
41
|
+
? state
|
|
42
|
+
: { ...state, showLib: action.payload.show, allowNonBranchNode: false };
|
|
43
|
+
case 'setActiveItem':
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
activeItem: action.payload.target
|
|
47
|
+
};
|
|
48
|
+
case 'setActiveAddButton':
|
|
49
|
+
return {
|
|
50
|
+
...state,
|
|
51
|
+
activeAddBtnMeta: {
|
|
52
|
+
...action.payload
|
|
53
|
+
},
|
|
54
|
+
showLib: true,
|
|
55
|
+
allowNonBranchNode: action.payload.allowNonBranchNode
|
|
56
|
+
};
|
|
57
|
+
case 'setGraphData':
|
|
58
|
+
return {
|
|
59
|
+
...state,
|
|
60
|
+
graphData: action.payload.graphData,
|
|
61
|
+
highlightItems: action.payload.highlightItems
|
|
62
|
+
};
|
|
63
|
+
case 'highlight':
|
|
64
|
+
// minor optimization to avoid unnecessary re-render
|
|
65
|
+
if (action.payload.hideDeleteDialog === !state.showDeleteDialog) {
|
|
66
|
+
return state;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...state,
|
|
70
|
+
highlightItems: action.payload.highlightItems,
|
|
71
|
+
showDeleteDialog: action.payload.hideDeleteDialog !== true && state.showDeleteDialog
|
|
72
|
+
};
|
|
73
|
+
case 'showDeleteDialog':
|
|
74
|
+
return {
|
|
75
|
+
...state,
|
|
76
|
+
showDeleteDialog: action.payload.showDeleteDialog,
|
|
77
|
+
deleteProps: action.payload.deleteProps
|
|
78
|
+
};
|
|
79
|
+
default:
|
|
80
|
+
return state;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const StyledFlowModellerWrapper = styled.div(({ theme }) => {
|
|
84
|
+
const { palette } = theme.base;
|
|
85
|
+
return css `
|
|
86
|
+
position: absolute;
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
top: 0;
|
|
90
|
+
background-color: ${palette['secondary-background']};
|
|
91
|
+
display: flex;
|
|
92
|
+
`;
|
|
93
|
+
});
|
|
94
|
+
StyledFlowModellerWrapper.defaultProps = defaultThemeProp;
|
|
95
|
+
const StyledFlowModellerContent = styled.div(() => {
|
|
96
|
+
return css `
|
|
97
|
+
flex: 1;
|
|
98
|
+
position: relative;
|
|
99
|
+
min-width: 0;
|
|
100
|
+
overflow: auto;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
`;
|
|
104
|
+
});
|
|
105
|
+
const StyledFlowAuthoringPanelWrapper = styled.div(({ $open }) => {
|
|
106
|
+
return css `
|
|
107
|
+
position: relative;
|
|
108
|
+
flex-shrink: 0;
|
|
109
|
+
width: ${$open ? `var(--resize-drawer-width, ${resizeDrawerDefaultWidth})` : '0'};
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
`;
|
|
112
|
+
});
|
|
113
|
+
const FlowModeller = ({ graphData, highlightData, onNodeActionClick, onNodeAdd, nodeLibrary, onNodeClick, onDelete, actions, readOnly = false, selectedNodeId, panel }) => {
|
|
114
|
+
const [state, dispatch] = useReducer(reducer, initState);
|
|
115
|
+
const stateRef = useRef(initState);
|
|
116
|
+
const flowModellerRef = useRef(null);
|
|
117
|
+
const skipConnectorFocus = useRef(false);
|
|
118
|
+
// stateRef always refers to the same state obj
|
|
119
|
+
// "fixed" callbacks can refer to this object whenever
|
|
120
|
+
// it need the current value. Note: the callbacks will not
|
|
121
|
+
// be reactive - they will not re-run the instant state changes,
|
|
122
|
+
// but they *will* see the current value whenever they do run
|
|
123
|
+
stateRef.current = state;
|
|
124
|
+
const t = useI18n();
|
|
125
|
+
const onNodeCreate = (el, meta) => {
|
|
126
|
+
const graph = new DirectedGraph(graphData);
|
|
127
|
+
let isAllowNonBranchNode = false;
|
|
128
|
+
if (meta.refType === 'connector') {
|
|
129
|
+
if (!Array.isArray(meta.refId)) {
|
|
130
|
+
meta.refId = [meta.refId];
|
|
131
|
+
}
|
|
132
|
+
const connectorData = graph.getConnector(meta.refId[0]);
|
|
133
|
+
const toNode = graph.getNode(connectorData.toNodeId);
|
|
134
|
+
const inConnectors = graph.getInConnectors(toNode.id);
|
|
135
|
+
let hiddenConnectorsCount = 0;
|
|
136
|
+
inConnectors.forEach(connector => {
|
|
137
|
+
const node = graph.getNode(connector.fromNodeId);
|
|
138
|
+
if (node.type.minConnectors === 0) {
|
|
139
|
+
hiddenConnectorsCount += 1;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const isPlaceholderConnector = meta.refId.length > 1;
|
|
143
|
+
/** if node is being added on a placeholder connector then reduce number of in connectors of destination node
|
|
144
|
+
* by total number of connectors converging/joining to form placeholder connector and add one to the in connector count
|
|
145
|
+
*/
|
|
146
|
+
const inConnectorsCount = isPlaceholderConnector
|
|
147
|
+
? inConnectors.length - meta.refId.length + 1
|
|
148
|
+
: inConnectors.length;
|
|
149
|
+
/** if node is being added on a placeholder connector then reduce number of hidden connectors of destination node
|
|
150
|
+
* by total number of connectors converging/joining to from placeholder connector and are originating from go to nodes
|
|
151
|
+
*/
|
|
152
|
+
if (isPlaceholderConnector) {
|
|
153
|
+
meta.refId.forEach(connector => {
|
|
154
|
+
if (graph.getNode(graph.getConnector(connector).fromNodeId).type.minConnectors === 0) {
|
|
155
|
+
hiddenConnectorsCount -= 1;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/** check destination/target node in connectors count is more than one
|
|
160
|
+
* check non-hidden/visible connectors among in connectors of destination/target node are more than 1
|
|
161
|
+
* check connectors converging/joining to form a placeholder connector are not equal to total number of in connectors
|
|
162
|
+
*/
|
|
163
|
+
if (inConnectorsCount > 1 &&
|
|
164
|
+
inConnectorsCount - hiddenConnectorsCount > 1 &&
|
|
165
|
+
inConnectors.length !== meta.refId.length) {
|
|
166
|
+
isAllowNonBranchNode = true;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
isAllowNonBranchNode = false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
skipConnectorFocus.current = false;
|
|
173
|
+
dispatch({
|
|
174
|
+
type: 'setActiveAddButton',
|
|
175
|
+
payload: {
|
|
176
|
+
target: el,
|
|
177
|
+
meta,
|
|
178
|
+
allowNonBranchNode: isAllowNonBranchNode
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
const closeMenu = () => {
|
|
183
|
+
dispatch({
|
|
184
|
+
type: 'showLibrary',
|
|
185
|
+
payload: {
|
|
186
|
+
show: false
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
const closeDeleteModel = () => {
|
|
191
|
+
// un-highlight the nodes and connectors
|
|
192
|
+
dispatch({
|
|
193
|
+
type: 'highlight',
|
|
194
|
+
payload: {
|
|
195
|
+
highlightItems: undefined,
|
|
196
|
+
hideDeleteDialog: true
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const onDeleteWrapper = (params, e) => {
|
|
201
|
+
const result = FlowModellerHelper.deleteNode(graphData, params.nodeId);
|
|
202
|
+
if (result) {
|
|
203
|
+
if (result.error) {
|
|
204
|
+
onDelete?.({ ...params, additionalData: result }, deleteNodeUtils.getDeleteModalContent(t('delete_step_error'), result.references), e);
|
|
205
|
+
}
|
|
206
|
+
onDelete?.({ ...params, additionalData: result }, '', e);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
const targetElement = document.getElementById(`modeller-node-${params.nodeId}`);
|
|
210
|
+
if (targetElement) {
|
|
211
|
+
dispatch({
|
|
212
|
+
type: 'showDeleteDialog',
|
|
213
|
+
payload: {
|
|
214
|
+
showDeleteDialog: true,
|
|
215
|
+
deleteProps: {
|
|
216
|
+
flowGraphData: graphData,
|
|
217
|
+
rendererGraphData: graphData,
|
|
218
|
+
nodeId: params.nodeId,
|
|
219
|
+
target: targetElement,
|
|
220
|
+
onChange: highlights => {
|
|
221
|
+
dispatch({
|
|
222
|
+
type: 'highlight',
|
|
223
|
+
payload: {
|
|
224
|
+
highlightItems: highlights
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
onSubmit: outcome => {
|
|
229
|
+
// un-highlight the nodes and connectors
|
|
230
|
+
closeDeleteModel();
|
|
231
|
+
if (outcome.error) {
|
|
232
|
+
onDelete?.({ ...params, additionalData: outcome }, deleteNodeUtils.getDeleteModalContent(t('delete_step_error'), outcome.references), e);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
onDelete?.({ ...params, additionalData: outcome }, '', e);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
onCancel: closeDeleteModel
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
const graph = new DirectedGraph(graphData);
|
|
247
|
+
const onGetNewPHNode = metaData => {
|
|
248
|
+
return {
|
|
249
|
+
id: createUID(),
|
|
250
|
+
children: (_jsx(AddButton, { addNodeHandler: (e) => {
|
|
251
|
+
if (e.currentTarget) {
|
|
252
|
+
onNodeCreate(e.currentTarget, metaData);
|
|
253
|
+
}
|
|
254
|
+
} })),
|
|
255
|
+
position: { x: 0, y: 0 },
|
|
256
|
+
dimensions: { width: 1, height: 0 }
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
const onGetNewPHConnector = (fromNodeId, toNodeId) => {
|
|
260
|
+
return {
|
|
261
|
+
id: createUID(),
|
|
262
|
+
fromNodeId,
|
|
263
|
+
toNodeId,
|
|
264
|
+
points: [],
|
|
265
|
+
data: {
|
|
266
|
+
onNodeCreate,
|
|
267
|
+
type: 'default'
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
const flowNodes = graphData.nodes.map(node => {
|
|
272
|
+
const flowNode = {
|
|
273
|
+
...node,
|
|
274
|
+
dimensions: {
|
|
275
|
+
width: 280,
|
|
276
|
+
height: 120
|
|
277
|
+
},
|
|
278
|
+
position: {
|
|
279
|
+
x: 0,
|
|
280
|
+
y: 0
|
|
281
|
+
},
|
|
282
|
+
data: {
|
|
283
|
+
selected: selectedNodeId === node.id,
|
|
284
|
+
actions,
|
|
285
|
+
onDelete: onDeleteWrapper,
|
|
286
|
+
onActionClick: onNodeActionClick,
|
|
287
|
+
onClick: onNodeClick
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
if (node.type.id === START_NODETYPE.id || node.type.id === END_NODETYPE.id) {
|
|
291
|
+
flowNode.dimensions.width = 59;
|
|
292
|
+
flowNode.dimensions.height = node.label ? 90 : 59;
|
|
293
|
+
}
|
|
294
|
+
return flowNode;
|
|
295
|
+
});
|
|
296
|
+
const connectors = graphData.connectors.map(connector => {
|
|
297
|
+
const nodeData = graph.getNode(connector.fromNodeId);
|
|
298
|
+
const isBranchNode = nodeData.type.minConnectors === 0;
|
|
299
|
+
return {
|
|
300
|
+
...connector,
|
|
301
|
+
points: [],
|
|
302
|
+
data: {
|
|
303
|
+
label: connector.label,
|
|
304
|
+
onNodeCreate,
|
|
305
|
+
type: !isBranchNode ? 'default' : 'hidden'
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
// inject the placeholderAddNodes dynamically
|
|
310
|
+
const newGraphData = PlaceHolderHelper.injectPlaceholderNodes({ nodes: flowNodes, connectors }, onGetNewPHNode, onGetNewPHConnector);
|
|
311
|
+
dispatch({
|
|
312
|
+
type: 'setGraphData',
|
|
313
|
+
payload: {
|
|
314
|
+
graphData: newGraphData
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}, [graphData, selectedNodeId]);
|
|
318
|
+
// Library popover functionality
|
|
319
|
+
const onLibraryItemSelect = useCallback((libItem) => {
|
|
320
|
+
const metaData = state.activeAddBtnMeta.meta;
|
|
321
|
+
skipConnectorFocus.current = true;
|
|
322
|
+
closeMenu();
|
|
323
|
+
if (isNodeLibraryItem(libItem)) {
|
|
324
|
+
onNodeAdd(libItem.type, metaData);
|
|
325
|
+
}
|
|
326
|
+
}, [state.activeAddBtnMeta]);
|
|
327
|
+
useEscape(() => {
|
|
328
|
+
const currState = stateRef.current;
|
|
329
|
+
if (currState.showDeleteDialog) {
|
|
330
|
+
closeDeleteModel();
|
|
331
|
+
document.getElementById(`modeller-node-${currState?.deleteProps?.nodeId}`)?.focus();
|
|
332
|
+
}
|
|
333
|
+
}, flowModellerRef);
|
|
334
|
+
const items = useMemo(() => {
|
|
335
|
+
if (!state.allowNonBranchNode) {
|
|
336
|
+
return nodeLibrary.filter(shapeTypes => {
|
|
337
|
+
if (shapeTypes.type) {
|
|
338
|
+
return shapeTypes.type.minConnectors !== 0;
|
|
339
|
+
}
|
|
340
|
+
return true;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
return nodeLibrary;
|
|
344
|
+
}, [nodeLibrary, state.allowNonBranchNode]);
|
|
345
|
+
const ctxValue = useMemo(() => {
|
|
346
|
+
return {
|
|
347
|
+
readOnly,
|
|
348
|
+
highlights: highlightData
|
|
349
|
+
? FlowModellerHelper.getHighlightsWithPlaceholders(graphData, highlightData, selectedNodeId)
|
|
350
|
+
: state.highlightItems,
|
|
351
|
+
showNodeLibrary: state.showLib
|
|
352
|
+
};
|
|
353
|
+
}, [readOnly, state.highlightItems, highlightData, state.showLib, graphData]);
|
|
354
|
+
return (_jsxs(StyledFlowModellerWrapper, { ref: flowModellerRef, children: [_jsxs(StyledFlowModellerContent, { children: [_jsx(FlowModellerContext.Provider, { value: ctxValue, children: _jsx(FlowRenderer, { graphData: state.graphData, connector: Connector, node: Node, selectedNodeId: selectedNodeId }) }), state.showDeleteDialog && state.deleteProps && _jsx(DeleteDialog, { ...state.deleteProps }), state.showLib && (_jsx(ItemLibrary, { target: state.showLib && state.activeAddBtnMeta.target instanceof HTMLElement
|
|
355
|
+
? state.activeAddBtnMeta.target
|
|
356
|
+
: null, placeholder: t('search_placeholder_default'), items: items, onClick: onLibraryItemSelect, onDismiss: closeMenu, position: 'bottom', skipTargetFocus: skipConnectorFocus }))] }), _jsx(StyledFlowAuthoringPanelWrapper, { "$open": panel?.open, children: panel && _jsx(FlowAuthoringPanel, { ...panel }) })] }));
|
|
357
|
+
};
|
|
358
|
+
export default memo(FlowModeller);
|
|
359
|
+
//# sourceMappingURL=FlowModeller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModeller.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAE/C,OAAO,E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,KAAK,EAAE,IAAI,YAChD,KAAK,IAAI,KAAC,kBAAkB,OAAK,KAAK,GAAI,GACX,IACR,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import { useEffect, useReducer, useCallback, useRef, useMemo, memo } from 'react';\nimport type { Reducer, MouseEvent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { createUID, useI18n, useEscape, defaultThemeProp } from '@pega/cosmos-react-core';\nimport { resizeDrawerDefaultWidth } from '@pega/cosmos-react-core/lib/styles/constants';\n\nimport ItemLibrary from '../ItemLibrary/ItemLibrary';\nimport type { LibraryItem } from '../ItemLibrary/ItemLibrary';\n\nimport { DirectedGraph } from './Renderer/Utils/Graph';\nimport type { GraphData } from './Renderer/Utils/Graph';\nimport type { AddNodeHandlerParams } from './Renderer/Renderer.types';\nimport FlowRenderer from './Renderer/Renderer';\nimport type { ActionParams, NodeLibraryItem, NodeProps } from './Node/Node.types';\nimport { START_NODETYPE, END_NODETYPE } from './Node/Node.types';\nimport PlaceHolderHelper from './Utils/addNodeUtils';\nimport AddButton from './AddNode';\nimport FlowModellerHelper from './helper';\nimport DeleteDialog from './DeleteDialog';\nimport Connector from './Connector';\nimport Node from './Node';\nimport FlowModellerContext from './FlowModellerContext';\nimport type { PlottedGraphNode, PlottedGraphConnector } from './Renderer/Utils/GraphLayout';\nimport type { DeleteNodeOutcome } from './Utils/deleteNodeUtils';\nimport deleteNodeUtils from './Utils/deleteNodeUtils';\nimport type { FlowModellerProps, ModellerState, ReducerAction } from './FlowModeller.types';\nimport FlowAuthoringPanel from './FlowAuthoringPanel/FlowAuthoringPanel';\n\nconst isNodeLibraryItem = (item: LibraryItem): item is NodeLibraryItem =>\n 'minConnectors' in item.type;\n\nconst initState: ModellerState = {\n showLib: false,\n activeItem: null,\n allowNonBranchNode: false,\n activeAddBtnMeta: {\n target: null,\n meta: {\n refType: 'node',\n refId: ''\n }\n },\n graphData: { nodes: [], connectors: [] },\n highlightItems: undefined,\n showDeleteDialog: false,\n deleteProps: undefined\n};\n\nconst reducer = (state: ModellerState, action: ReducerAction) => {\n switch (action.type) {\n case 'showLibrary':\n // minor optimization, not to update state.. if no change in the value\n return action.payload.show === state.showLib\n ? state\n : { ...state, showLib: action.payload.show, allowNonBranchNode: false };\n case 'setActiveItem':\n return {\n ...state,\n activeItem: action.payload.target\n };\n case 'setActiveAddButton':\n return {\n ...state,\n activeAddBtnMeta: {\n ...action.payload\n },\n showLib: true,\n allowNonBranchNode: action.payload.allowNonBranchNode\n };\n case 'setGraphData':\n return {\n ...state,\n graphData: action.payload.graphData,\n highlightItems: action.payload.highlightItems\n };\n case 'highlight':\n // minor optimization to avoid unnecessary re-render\n if (action.payload.hideDeleteDialog === !state.showDeleteDialog) {\n return state;\n }\n\n return {\n ...state,\n highlightItems: action.payload.highlightItems,\n showDeleteDialog: action.payload.hideDeleteDialog !== true && state.showDeleteDialog\n };\n case 'showDeleteDialog':\n return {\n ...state,\n showDeleteDialog: action.payload.showDeleteDialog,\n deleteProps: action.payload.deleteProps\n };\n default:\n return state;\n }\n};\n\nconst StyledFlowModellerWrapper = styled.div(({ theme }) => {\n const { palette } = theme.base;\n return css`\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n background-color: ${palette['secondary-background']};\n display: flex;\n `;\n});\n\nStyledFlowModellerWrapper.defaultProps = defaultThemeProp;\n\nconst StyledFlowModellerContent = styled.div(() => {\n return css`\n flex: 1;\n position: relative;\n min-width: 0;\n overflow: auto;\n display: flex;\n flex-direction: row;\n `;\n});\n\nconst StyledFlowAuthoringPanelWrapper = styled.div<{ $open?: boolean }>(({ $open }) => {\n return css`\n position: relative;\n flex-shrink: 0;\n width: ${$open ? `var(--resize-drawer-width, ${resizeDrawerDefaultWidth})` : '0'};\n overflow: hidden;\n `;\n});\n\nconst FlowModeller = ({\n graphData,\n highlightData,\n onNodeActionClick,\n onNodeAdd,\n nodeLibrary,\n onNodeClick,\n onDelete,\n actions,\n readOnly = false,\n selectedNodeId,\n panel\n}: PropsWithoutRef<FlowModellerProps>) => {\n const [state, dispatch] = useReducer<Reducer<ModellerState, ReducerAction>>(reducer, initState);\n const stateRef = useRef<ModellerState>(initState);\n const flowModellerRef = useRef<HTMLDivElement>(null);\n const skipConnectorFocus = useRef(false);\n\n // stateRef always refers to the same state obj\n // \"fixed\" callbacks can refer to this object whenever\n // it need the current value. Note: the callbacks will not\n // be reactive - they will not re-run the instant state changes,\n // but they *will* see the current value whenever they do run\n stateRef.current = state;\n const t = useI18n();\n\n const onNodeCreate = (el: HTMLElement | SVGForeignObjectElement, meta: AddNodeHandlerParams) => {\n const graph = new DirectedGraph(graphData);\n let isAllowNonBranchNode = false;\n if (meta.refType === 'connector') {\n if (!Array.isArray(meta.refId)) {\n meta.refId = [meta.refId];\n }\n const connectorData = graph.getConnector(meta.refId[0]);\n const toNode = graph.getNode(connectorData.toNodeId);\n const inConnectors = graph.getInConnectors(toNode.id);\n let hiddenConnectorsCount = 0;\n inConnectors.forEach(connector => {\n const node = graph.getNode(connector.fromNodeId);\n if (node.type.minConnectors === 0) {\n hiddenConnectorsCount += 1;\n }\n });\n const isPlaceholderConnector = meta.refId.length > 1;\n\n /** if node is being added on a placeholder connector then reduce number of in connectors of destination node\n * by total number of connectors converging/joining to form placeholder connector and add one to the in connector count\n */\n const inConnectorsCount = isPlaceholderConnector\n ? inConnectors.length - meta.refId.length + 1\n : inConnectors.length;\n\n /** if node is being added on a placeholder connector then reduce number of hidden connectors of destination node\n * by total number of connectors converging/joining to from placeholder connector and are originating from go to nodes\n */\n if (isPlaceholderConnector) {\n meta.refId.forEach(connector => {\n if (graph.getNode(graph.getConnector(connector).fromNodeId).type.minConnectors === 0) {\n hiddenConnectorsCount -= 1;\n }\n });\n }\n\n /** check destination/target node in connectors count is more than one\n * check non-hidden/visible connectors among in connectors of destination/target node are more than 1\n * check connectors converging/joining to form a placeholder connector are not equal to total number of in connectors\n */\n if (\n inConnectorsCount > 1 &&\n inConnectorsCount - hiddenConnectorsCount > 1 &&\n inConnectors.length !== meta.refId.length\n ) {\n isAllowNonBranchNode = true;\n } else {\n isAllowNonBranchNode = false;\n }\n }\n skipConnectorFocus.current = false;\n dispatch({\n type: 'setActiveAddButton',\n payload: {\n target: el,\n meta,\n allowNonBranchNode: isAllowNonBranchNode\n }\n });\n };\n\n const closeMenu = () => {\n dispatch({\n type: 'showLibrary',\n payload: {\n show: false\n }\n });\n };\n\n const closeDeleteModel = () => {\n // un-highlight the nodes and connectors\n dispatch({\n type: 'highlight',\n payload: {\n highlightItems: undefined,\n hideDeleteDialog: true\n }\n });\n };\n\n const onDeleteWrapper = (params: ActionParams, e: MouseEvent) => {\n const result: DeleteNodeOutcome | false = FlowModellerHelper.deleteNode(\n graphData,\n params.nodeId\n );\n if (result) {\n if (result.error) {\n onDelete?.(\n { ...params, additionalData: result },\n deleteNodeUtils.getDeleteModalContent(t('delete_step_error'), result.references),\n e\n );\n }\n onDelete?.({ ...params, additionalData: result }, '', e);\n } else {\n const targetElement = document.getElementById(`modeller-node-${params.nodeId}`);\n if (targetElement) {\n dispatch({\n type: 'showDeleteDialog',\n payload: {\n showDeleteDialog: true,\n deleteProps: {\n flowGraphData: graphData,\n rendererGraphData: graphData,\n nodeId: params.nodeId,\n target: targetElement,\n onChange: highlights => {\n dispatch({\n type: 'highlight',\n payload: {\n highlightItems: highlights\n }\n });\n },\n onSubmit: outcome => {\n // un-highlight the nodes and connectors\n closeDeleteModel();\n if (outcome.error) {\n onDelete?.(\n { ...params, additionalData: outcome },\n deleteNodeUtils.getDeleteModalContent(\n t('delete_step_error'),\n outcome.references\n ),\n e\n );\n } else {\n onDelete?.({ ...params, additionalData: outcome }, '', e);\n }\n },\n onCancel: closeDeleteModel\n }\n }\n });\n }\n }\n };\n\n useEffect(() => {\n const graph = new DirectedGraph(graphData);\n const onGetNewPHNode: (metaData: AddNodeHandlerParams) => PlottedGraphNode = metaData => {\n return {\n id: createUID(),\n children: (\n <AddButton\n addNodeHandler={(e: MouseEvent<HTMLButtonElement>) => {\n if (e.currentTarget) {\n onNodeCreate(e.currentTarget, metaData);\n }\n }}\n />\n ),\n position: { x: 0, y: 0 },\n dimensions: { width: 1, height: 0 }\n };\n };\n\n const onGetNewPHConnector: (\n fromNodeId: string,\n toNodeId: string,\n metaData: AddNodeHandlerParams\n ) => PlottedGraphConnector = (fromNodeId, toNodeId) => {\n return {\n id: createUID(),\n fromNodeId,\n toNodeId,\n points: [],\n data: {\n onNodeCreate,\n type: 'default'\n }\n };\n };\n\n const flowNodes: PlottedGraphNode[] = graphData.nodes.map(node => {\n const flowNode: PlottedGraphNode & NodeProps = {\n ...node,\n dimensions: {\n width: 280,\n height: 120\n },\n position: {\n x: 0,\n y: 0\n },\n data: {\n selected: selectedNodeId === node.id,\n actions,\n onDelete: onDeleteWrapper,\n onActionClick: onNodeActionClick,\n onClick: onNodeClick\n }\n };\n\n if (node.type.id === START_NODETYPE.id || node.type.id === END_NODETYPE.id) {\n flowNode.dimensions.width = 59;\n flowNode.dimensions.height = node.label ? 90 : 59;\n }\n return flowNode;\n });\n\n const connectors: PlottedGraphConnector[] = graphData.connectors.map(connector => {\n const nodeData = graph.getNode(connector.fromNodeId);\n const isBranchNode = nodeData.type.minConnectors === 0;\n return {\n ...connector,\n points: [],\n data: {\n label: connector.label,\n onNodeCreate,\n type: !isBranchNode ? 'default' : 'hidden'\n }\n };\n });\n\n // inject the placeholderAddNodes dynamically\n const newGraphData: GraphData<PlottedGraphNode, PlottedGraphConnector> =\n PlaceHolderHelper.injectPlaceholderNodes(\n { nodes: flowNodes, connectors },\n onGetNewPHNode,\n onGetNewPHConnector\n );\n dispatch({\n type: 'setGraphData',\n payload: {\n graphData: newGraphData\n }\n });\n }, [graphData, selectedNodeId]);\n // Library popover functionality\n const onLibraryItemSelect = useCallback(\n (libItem: LibraryItem) => {\n const metaData = state.activeAddBtnMeta.meta;\n skipConnectorFocus.current = true;\n closeMenu();\n if (isNodeLibraryItem(libItem)) {\n onNodeAdd(libItem.type, metaData);\n }\n },\n [state.activeAddBtnMeta]\n );\n\n useEscape(() => {\n const currState = stateRef.current;\n if (currState.showDeleteDialog) {\n closeDeleteModel();\n document.getElementById(`modeller-node-${currState?.deleteProps?.nodeId}`)?.focus();\n }\n }, flowModellerRef);\n\n const items: NodeLibraryItem[] = useMemo(() => {\n if (!state.allowNonBranchNode) {\n return nodeLibrary.filter(shapeTypes => {\n if (shapeTypes.type) {\n return shapeTypes.type.minConnectors !== 0;\n }\n return true;\n });\n }\n return nodeLibrary;\n }, [nodeLibrary, state.allowNonBranchNode]);\n\n const ctxValue = useMemo(() => {\n return {\n readOnly,\n highlights: highlightData\n ? FlowModellerHelper.getHighlightsWithPlaceholders(graphData, highlightData, selectedNodeId)\n : state.highlightItems,\n showNodeLibrary: state.showLib\n };\n }, [readOnly, state.highlightItems, highlightData, state.showLib, graphData]);\n return (\n <StyledFlowModellerWrapper ref={flowModellerRef}>\n <StyledFlowModellerContent>\n <FlowModellerContext.Provider value={ctxValue}>\n <FlowRenderer\n graphData={state.graphData}\n connector={Connector}\n node={Node}\n selectedNodeId={selectedNodeId}\n />\n </FlowModellerContext.Provider>\n {state.showDeleteDialog && state.deleteProps && <DeleteDialog {...state.deleteProps} />}\n {state.showLib && (\n <ItemLibrary\n target={\n state.showLib && state.activeAddBtnMeta.target instanceof HTMLElement\n ? state.activeAddBtnMeta.target\n : null\n }\n placeholder={t('search_placeholder_default')}\n items={items}\n onClick={onLibraryItemSelect}\n onDismiss={closeMenu}\n position='bottom'\n skipTargetFocus={skipConnectorFocus}\n />\n )}\n </StyledFlowModellerContent>\n <StyledFlowAuthoringPanelWrapper $open={panel?.open}>\n {panel && <FlowAuthoringPanel {...panel} />}\n </StyledFlowAuthoringPanelWrapper>\n </StyledFlowModellerWrapper>\n );\n};\n\nexport default memo(FlowModeller);\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const getConnectorTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
2
|
+
export declare const getNodeTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly string[]>;
|
|
3
|
+
//# sourceMappingURL=FlowModeller.test-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModeller.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.test-ids.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,uIAAyC,CAAC;AAC1E,eAAO,MAAM,cAAc,6IAA2D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createTestIds } from '@pega/cosmos-react-core';
|
|
2
|
+
const FlowModellerActions = ['action-button', 'add-button'];
|
|
3
|
+
export const getConnectorTestIds = createTestIds('add-node', []);
|
|
4
|
+
export const getNodeTestIds = createTestIds('node', [...FlowModellerActions]);
|
|
5
|
+
//# sourceMappingURL=FlowModeller.test-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModeller.test-ids.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,mBAAmB,GAAG,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,UAAU,EAAE,EAAW,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAmB,CAAU,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nconst FlowModellerActions = ['action-button', 'add-button'];\n\nexport const getConnectorTestIds = createTestIds('add-node', [] as const);\nexport const getNodeTestIds = createTestIds('node', [...FlowModellerActions] as const);\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import type { Action } from '@pega/cosmos-react-core';
|
|
3
|
+
import type { GraphData, ConnectorProps } from './Renderer/Utils/Graph';
|
|
4
|
+
import type { AddNodeHandlerParams, RendererProps } from './Renderer/Renderer.types';
|
|
5
|
+
import type { ActionParams, NodeProps, NodeLibraryItem, NodeType, NodeComponentData } from './Node/Node.types';
|
|
6
|
+
import type { PlottedGraphNode, PlottedGraphConnector } from './Renderer/Utils/GraphLayout';
|
|
7
|
+
import type { DeleteNodeModalOption } from './Utils/deleteNodeUtils';
|
|
8
|
+
import type { DeleteDialogProps } from './DeleteDialog';
|
|
9
|
+
import type { FlowAuthoringPanelProps } from './FlowAuthoringPanel/FlowAuthoringPanel.types';
|
|
10
|
+
export interface FlowModellerProps {
|
|
11
|
+
graphData: GraphData<NodeProps, ConnectorProps>;
|
|
12
|
+
/** Node actions */
|
|
13
|
+
actions?: Action[];
|
|
14
|
+
/** Callback to add node from connector */
|
|
15
|
+
onNodeAdd: (nodeType: NodeType, params: AddNodeHandlerParams) => void;
|
|
16
|
+
/** Callback for handling the click on the node */
|
|
17
|
+
onNodeClick?: NodeComponentData['onClick'];
|
|
18
|
+
/** Callback for actions on Node */
|
|
19
|
+
onNodeActionClick?: (param: ActionParams, e: MouseEvent) => void;
|
|
20
|
+
/** Callback for node deletion */
|
|
21
|
+
onDelete?: (param: ActionParams, error: ReactNode, e: MouseEvent) => void;
|
|
22
|
+
/** Types of nodes */
|
|
23
|
+
nodeLibrary: NodeLibraryItem[];
|
|
24
|
+
/** Highlights */
|
|
25
|
+
highlightData?: RendererProps['highlights'];
|
|
26
|
+
/** To make FlowModeller readOnly state
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
/** Current selected node */
|
|
31
|
+
selectedNodeId?: NodeProps['id'];
|
|
32
|
+
/** Props to render the FlowAuthoringPanel inside the FlowModeller */
|
|
33
|
+
panel?: FlowAuthoringPanelProps;
|
|
34
|
+
}
|
|
35
|
+
export type ModellerState = {
|
|
36
|
+
showLib: boolean;
|
|
37
|
+
allowNonBranchNode: boolean;
|
|
38
|
+
activeItem: Element | null;
|
|
39
|
+
activeAddBtnMeta: {
|
|
40
|
+
target: HTMLElement | SVGForeignObjectElement | null;
|
|
41
|
+
meta: AddNodeHandlerParams;
|
|
42
|
+
};
|
|
43
|
+
graphData: GraphData<PlottedGraphNode, PlottedGraphConnector>;
|
|
44
|
+
highlightItems?: DeleteNodeModalOption['pathItems'];
|
|
45
|
+
showDeleteDialog: boolean;
|
|
46
|
+
deleteProps: DeleteDialogProps | undefined;
|
|
47
|
+
};
|
|
48
|
+
export type ReducerAction = {
|
|
49
|
+
type: 'showLibrary';
|
|
50
|
+
payload: {
|
|
51
|
+
show: boolean;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: 'setActiveItem';
|
|
55
|
+
payload: {
|
|
56
|
+
target: Element | null;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
type: 'setActiveAddButton';
|
|
60
|
+
payload: {
|
|
61
|
+
target: HTMLElement | SVGForeignObjectElement | null;
|
|
62
|
+
meta: AddNodeHandlerParams;
|
|
63
|
+
allowNonBranchNode: boolean;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
type: 'setGraphData';
|
|
67
|
+
payload: {
|
|
68
|
+
graphData: GraphData<PlottedGraphNode, PlottedGraphConnector>;
|
|
69
|
+
highlightItems?: DeleteNodeModalOption['pathItems'];
|
|
70
|
+
};
|
|
71
|
+
} | {
|
|
72
|
+
type: 'highlight';
|
|
73
|
+
payload: {
|
|
74
|
+
highlightItems?: DeleteNodeModalOption['pathItems'];
|
|
75
|
+
hideDeleteDialog?: boolean;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
type: 'showDeleteDialog';
|
|
79
|
+
payload: {
|
|
80
|
+
showDeleteDialog: boolean;
|
|
81
|
+
deleteProps?: DeleteDialogProps;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=FlowModeller.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModeller.types.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,QAAQ,EACR,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAE7F,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAChD,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,0CAA0C;IAC1C,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACtE,kDAAkD;IAClD,WAAW,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC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AAE,CAAA;CAAE,GAC9D;IACE,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE;QACP,MAAM,EAAE,WAAW,GAAG,uBAAuB,GAAG,IAAI,CAAC;QACrD,IAAI,EAAE,oBAAoB,CAAC;QAC3B,kBAAkB,EAAE,OAAO,CAAC;KAC7B,CAAC;CACH,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE;QACP,SAAS,EAAE,SAAS,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QAC9D,cAAc,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;KACrD,CAAC;CACH,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE;QAAE,cAAc,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC9F,GACD;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE;QAAE,gBAAgB,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,iBAAiB,CAAA;KAAE,CAAC;CACzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModeller.types.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\n\nimport type { Action } from '@pega/cosmos-react-core';\n\nimport type { GraphData, ConnectorProps } from './Renderer/Utils/Graph';\nimport type { AddNodeHandlerParams, RendererProps } from './Renderer/Renderer.types';\nimport type {\n ActionParams,\n NodeProps,\n NodeLibraryItem,\n NodeType,\n NodeComponentData\n} from './Node/Node.types';\nimport type { PlottedGraphNode, PlottedGraphConnector } from './Renderer/Utils/GraphLayout';\nimport type { DeleteNodeModalOption } from './Utils/deleteNodeUtils';\nimport type { DeleteDialogProps } from './DeleteDialog';\nimport type { FlowAuthoringPanelProps } from './FlowAuthoringPanel/FlowAuthoringPanel.types';\n\nexport interface FlowModellerProps {\n graphData: GraphData<NodeProps, ConnectorProps>;\n /** Node actions */\n actions?: Action[];\n /** Callback to add node from connector */\n onNodeAdd: (nodeType: NodeType, params: AddNodeHandlerParams) => void;\n /** Callback for handling the click on the node */\n onNodeClick?: NodeComponentData['onClick'];\n /** Callback for actions on Node */\n onNodeActionClick?: (param: ActionParams, e: MouseEvent) => void;\n /** Callback for node deletion */\n onDelete?: (param: ActionParams, error: ReactNode, e: MouseEvent) => void;\n /** Types of nodes */\n nodeLibrary: NodeLibraryItem[];\n /** Highlights */\n highlightData?: RendererProps['highlights'];\n /** To make FlowModeller readOnly state\n * @default false\n */\n readOnly?: boolean;\n /** Current selected node */\n selectedNodeId?: NodeProps['id'];\n /** Props to render the FlowAuthoringPanel inside the FlowModeller */\n panel?: FlowAuthoringPanelProps;\n}\n\nexport type ModellerState = {\n showLib: boolean;\n allowNonBranchNode: boolean;\n activeItem: Element | null;\n activeAddBtnMeta: {\n target: HTMLElement | SVGForeignObjectElement | null; // we will maintain ref of an Element\n meta: AddNodeHandlerParams;\n };\n graphData: GraphData<PlottedGraphNode, PlottedGraphConnector>;\n highlightItems?: DeleteNodeModalOption['pathItems'];\n showDeleteDialog: boolean;\n deleteProps: DeleteDialogProps | undefined;\n};\n\nexport type ReducerAction =\n | { type: 'showLibrary'; payload: { show: boolean } }\n | { type: 'setActiveItem'; payload: { target: Element | null } }\n | {\n type: 'setActiveAddButton';\n payload: {\n target: HTMLElement | SVGForeignObjectElement | null;\n meta: AddNodeHandlerParams;\n allowNonBranchNode: boolean;\n };\n }\n | {\n type: 'setGraphData';\n payload: {\n graphData: GraphData<PlottedGraphNode, PlottedGraphConnector>;\n highlightItems?: DeleteNodeModalOption['pathItems'];\n };\n }\n | {\n type: 'highlight';\n payload: { highlightItems?: DeleteNodeModalOption['pathItems']; hideDeleteDialog?: boolean };\n }\n | {\n type: 'showDeleteDialog';\n payload: { showDeleteDialog: boolean; deleteProps?: DeleteDialogProps };\n };\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FlowModellerProps } from './FlowModeller.types';
|
|
2
|
+
import type { RendererProps } from './Renderer/Renderer.types';
|
|
3
|
+
export interface FlowModellerContextValue {
|
|
4
|
+
readOnly: FlowModellerProps['readOnly'];
|
|
5
|
+
highlights: RendererProps['highlights'];
|
|
6
|
+
showNodeLibrary: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const FlowModellerContext: import("react").Context<FlowModellerContextValue>;
|
|
9
|
+
export default FlowModellerContext;
|
|
10
|
+
//# sourceMappingURL=FlowModellerContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModellerContext.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModellerContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACxC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,QAAA,MAAM,mBAAmB,mDAIvB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const FlowModellerContext = createContext({
|
|
3
|
+
readOnly: false,
|
|
4
|
+
highlights: { nodes: {}, connectors: {} },
|
|
5
|
+
showNodeLibrary: false
|
|
6
|
+
});
|
|
7
|
+
export default FlowModellerContext;
|
|
8
|
+
//# sourceMappingURL=FlowModellerContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowModellerContext.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModellerContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAWtC,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IAClE,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;IACzC,eAAe,EAAE,KAAK;CACvB,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport type { FlowModellerProps } from './FlowModeller.types';\nimport type { RendererProps } from './Renderer/Renderer.types';\n\nexport interface FlowModellerContextValue {\n readOnly: FlowModellerProps['readOnly'];\n highlights: RendererProps['highlights'];\n showNodeLibrary: boolean;\n}\n\nconst FlowModellerContext = createContext<FlowModellerContextValue>({\n readOnly: false,\n highlights: { nodes: {}, connectors: {} },\n showNodeLibrary: false\n});\n\nexport default FlowModellerContext;\n"]}
|