@pega/cosmos-react-build 2.1.3 → 2.1.6
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/package.json +3 -3
- package/lib/components/AppHeader/AppHeader.d.ts +0 -29
- package/lib/components/AppHeader/AppHeader.d.ts.map +0 -1
- package/lib/components/AppHeader/AppHeader.js +0 -32
- package/lib/components/AppHeader/AppHeader.js.map +0 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts +0 -12
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +0 -1
- package/lib/components/AppHeader/AppHeader.styles.js +0 -123
- package/lib/components/AppHeader/AppHeader.styles.js.map +0 -1
- package/lib/components/AppHeader/index.d.ts +0 -3
- package/lib/components/AppHeader/index.d.ts.map +0 -1
- package/lib/components/AppHeader/index.js +0 -2
- package/lib/components/AppHeader/index.js.map +0 -1
- package/lib/components/AppShell/AppShell.d.ts +0 -4
- package/lib/components/AppShell/AppShell.d.ts.map +0 -1
- package/lib/components/AppShell/AppShell.js +0 -84
- package/lib/components/AppShell/AppShell.js.map +0 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +0 -20
- package/lib/components/AppShell/AppShell.styles.d.ts.map +0 -1
- package/lib/components/AppShell/AppShell.styles.js +0 -331
- package/lib/components/AppShell/AppShell.styles.js.map +0 -1
- package/lib/components/AppShell/AppShell.types.d.ts +0 -43
- package/lib/components/AppShell/AppShell.types.d.ts.map +0 -1
- package/lib/components/AppShell/AppShell.types.js +0 -2
- package/lib/components/AppShell/AppShell.types.js.map +0 -1
- package/lib/components/AppShell/AppShellContext.d.ts +0 -4
- package/lib/components/AppShell/AppShellContext.d.ts.map +0 -1
- package/lib/components/AppShell/AppShellContext.js +0 -10
- package/lib/components/AppShell/AppShellContext.js.map +0 -1
- package/lib/components/AppShell/index.d.ts +0 -3
- package/lib/components/AppShell/index.d.ts.map +0 -1
- package/lib/components/AppShell/index.js +0 -2
- package/lib/components/AppShell/index.js.map +0 -1
- package/lib/components/FlowModeller/AddNode.d.ts +0 -16
- package/lib/components/FlowModeller/AddNode.d.ts.map +0 -1
- package/lib/components/FlowModeller/AddNode.js +0 -62
- package/lib/components/FlowModeller/AddNode.js.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.d.ts +0 -21
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.js +0 -190
- package/lib/components/FlowModeller/FlowModeller.js.map +0 -1
- package/lib/components/FlowModeller/Node/Node.types.d.ts +0 -54
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/Node.types.js +0 -28
- package/lib/components/FlowModeller/Node/Node.types.js.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +0 -15
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +0 -128
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +0 -6
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +0 -64
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +0 -1
- package/lib/components/FlowModeller/NodeLibrary.d.ts +0 -13
- package/lib/components/FlowModeller/NodeLibrary.d.ts.map +0 -1
- package/lib/components/FlowModeller/NodeLibrary.js +0 -51
- package/lib/components/FlowModeller/NodeLibrary.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts +0 -13
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Connectors.js +0 -47
- package/lib/components/FlowModeller/Renderer/Connectors.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts +0 -9
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Nodes.js +0 -25
- package/lib/components/FlowModeller/Renderer/Nodes.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts +0 -5
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.js +0 -17
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +0 -18
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.js +0 -2
- package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +0 -54
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +0 -302
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +0 -35
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +0 -107
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +0 -24
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +0 -152
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +0 -1
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts +0 -16
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts.map +0 -1
- package/lib/components/FlowModeller/Utils/AddNodeUtils.js +0 -118
- package/lib/components/FlowModeller/Utils/AddNodeUtils.js.map +0 -1
- package/lib/components/FlowModeller/helper.d.ts +0 -23
- package/lib/components/FlowModeller/helper.d.ts.map +0 -1
- package/lib/components/FlowModeller/helper.js +0 -128
- package/lib/components/FlowModeller/helper.js.map +0 -1
- package/lib/components/FlowModeller/index.d.ts +0 -10
- package/lib/components/FlowModeller/index.d.ts.map +0 -1
- package/lib/components/FlowModeller/index.js +0 -8
- package/lib/components/FlowModeller/index.js.map +0 -1
- package/lib/components/LifeCycle/Category.d.ts +0 -32
- package/lib/components/LifeCycle/Category.d.ts.map +0 -1
- package/lib/components/LifeCycle/Category.js +0 -98
- package/lib/components/LifeCycle/Category.js.map +0 -1
- package/lib/components/LifeCycle/LifeCycle.d.ts +0 -22
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +0 -1
- package/lib/components/LifeCycle/LifeCycle.js +0 -73
- package/lib/components/LifeCycle/LifeCycle.js.map +0 -1
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +0 -56
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +0 -1
- package/lib/components/LifeCycle/LifeCycle.types.js +0 -2
- package/lib/components/LifeCycle/LifeCycle.types.js.map +0 -1
- package/lib/components/LifeCycle/LifeCycleList.d.ts +0 -22
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +0 -1
- package/lib/components/LifeCycle/LifeCycleList.js +0 -65
- package/lib/components/LifeCycle/LifeCycleList.js.map +0 -1
- package/lib/components/LifeCycle/Stage.d.ts +0 -49
- package/lib/components/LifeCycle/Stage.d.ts.map +0 -1
- package/lib/components/LifeCycle/Stage.js +0 -293
- package/lib/components/LifeCycle/Stage.js.map +0 -1
- package/lib/components/LifeCycle/Step.d.ts +0 -51
- package/lib/components/LifeCycle/Step.d.ts.map +0 -1
- package/lib/components/LifeCycle/Step.js +0 -241
- package/lib/components/LifeCycle/Step.js.map +0 -1
- package/lib/components/LifeCycle/Task.d.ts +0 -53
- package/lib/components/LifeCycle/Task.d.ts.map +0 -1
- package/lib/components/LifeCycle/Task.js +0 -188
- package/lib/components/LifeCycle/Task.js.map +0 -1
- package/lib/components/LifeCycle/index.d.ts +0 -4
- package/lib/components/LifeCycle/index.d.ts.map +0 -1
- package/lib/components/LifeCycle/index.js +0 -2
- package/lib/components/LifeCycle/index.js.map +0 -1
- package/lib/components/PageTemplates/GalleryPage.d.ts +0 -23
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +0 -1
- package/lib/components/PageTemplates/GalleryPage.js +0 -23
- package/lib/components/PageTemplates/GalleryPage.js.map +0 -1
- package/lib/components/PageTemplates/GalleryPage.styles.d.ts +0 -9
- package/lib/components/PageTemplates/GalleryPage.styles.d.ts.map +0 -1
- package/lib/components/PageTemplates/GalleryPage.styles.js +0 -70
- package/lib/components/PageTemplates/GalleryPage.styles.js.map +0 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +0 -27
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +0 -1
- package/lib/components/PageTemplates/PageTemplates.js +0 -105
- package/lib/components/PageTemplates/PageTemplates.js.map +0 -1
- package/lib/components/PageTemplates/index.d.ts +0 -5
- package/lib/components/PageTemplates/index.d.ts.map +0 -1
- package/lib/components/PageTemplates/index.js +0 -4
- package/lib/components/PageTemplates/index.js.map +0 -1
- package/lib/components/SummaryCard/SummaryCard.d.ts +0 -16
- package/lib/components/SummaryCard/SummaryCard.d.ts.map +0 -1
- package/lib/components/SummaryCard/SummaryCard.js +0 -31
- package/lib/components/SummaryCard/SummaryCard.js.map +0 -1
- package/lib/components/SummaryCard/index.d.ts +0 -3
- package/lib/components/SummaryCard/index.d.ts.map +0 -1
- package/lib/components/SummaryCard/index.js +0 -3
- package/lib/components/SummaryCard/index.js.map +0 -1
- package/lib/components/Visual/Visual.d.ts +0 -17
- package/lib/components/Visual/Visual.d.ts.map +0 -1
- package/lib/components/Visual/Visual.js +0 -28
- package/lib/components/Visual/Visual.js.map +0 -1
- package/lib/components/Visual/index.d.ts +0 -3
- package/lib/components/Visual/index.d.ts.map +0 -1
- package/lib/components/Visual/index.js +0 -3
- package/lib/components/Visual/index.js.map +0 -1
- package/lib/components/Workbench/ConfigurationPanel.d.ts +0 -5
- package/lib/components/Workbench/ConfigurationPanel.d.ts.map +0 -1
- package/lib/components/Workbench/ConfigurationPanel.js +0 -21
- package/lib/components/Workbench/ConfigurationPanel.js.map +0 -1
- package/lib/components/Workbench/Toolbar.d.ts +0 -14
- package/lib/components/Workbench/Toolbar.d.ts.map +0 -1
- package/lib/components/Workbench/Toolbar.js +0 -14
- package/lib/components/Workbench/Toolbar.js.map +0 -1
- package/lib/components/Workbench/UtilityPanel.d.ts +0 -7
- package/lib/components/Workbench/UtilityPanel.d.ts.map +0 -1
- package/lib/components/Workbench/UtilityPanel.js +0 -12
- package/lib/components/Workbench/UtilityPanel.js.map +0 -1
- package/lib/components/Workbench/Workbench.d.ts +0 -6
- package/lib/components/Workbench/Workbench.d.ts.map +0 -1
- package/lib/components/Workbench/Workbench.js +0 -24
- package/lib/components/Workbench/Workbench.js.map +0 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +0 -10
- package/lib/components/Workbench/Workbench.styles.d.ts.map +0 -1
- package/lib/components/Workbench/Workbench.styles.js +0 -71
- package/lib/components/Workbench/Workbench.styles.js.map +0 -1
- package/lib/components/Workbench/Workbench.types.d.ts +0 -49
- package/lib/components/Workbench/Workbench.types.d.ts.map +0 -1
- package/lib/components/Workbench/Workbench.types.js +0 -2
- package/lib/components/Workbench/Workbench.types.js.map +0 -1
- package/lib/components/Workbench/index.d.ts +0 -2
- package/lib/components/Workbench/index.d.ts.map +0 -1
- package/lib/components/Workbench/index.js +0 -2
- package/lib/components/Workbench/index.js.map +0 -1
- package/lib/index.d.ts +0 -13
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -14
- package/lib/index.js.map +0 -1
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useReducer, useCallback } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { createUID, useElement, useOuterEvent, Flex, Text, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
|
-
import FlowRenderer from './Renderer/Renderer';
|
|
6
|
-
import { StartNode, EndNode, DefaultNode } from './Node/NodeTemplates';
|
|
7
|
-
import { START_NODETYPE, STOP_NODETYPE } from './Node/Node.types';
|
|
8
|
-
import NodeLibrary from './NodeLibrary';
|
|
9
|
-
import PlaceHolderHelper, { isPlaceHolderConnector } from './Utils/AddNodeUtils';
|
|
10
|
-
import { AddButton } from './AddNode';
|
|
11
|
-
const initState = {
|
|
12
|
-
showLib: false,
|
|
13
|
-
activeAddBtnMeta: {
|
|
14
|
-
target: null,
|
|
15
|
-
meta: {
|
|
16
|
-
refType: 'node',
|
|
17
|
-
refId: ''
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
graphData: { nodes: [], connectors: [] },
|
|
21
|
-
connectorComponent: () => _jsx(_Fragment, {}, void 0),
|
|
22
|
-
nodeComponent: () => _jsx(_Fragment, {}, void 0)
|
|
23
|
-
};
|
|
24
|
-
const reducer = (state, action) => {
|
|
25
|
-
switch (action.type) {
|
|
26
|
-
case 'showLibrary':
|
|
27
|
-
// minor optimization, not to update state.. if no change in the value
|
|
28
|
-
return action.payload.show === state.showLib
|
|
29
|
-
? state
|
|
30
|
-
: { ...state, showLib: action.payload.show };
|
|
31
|
-
case 'setActiveAddButton':
|
|
32
|
-
state.activeAddBtnMeta = {
|
|
33
|
-
...action.payload
|
|
34
|
-
};
|
|
35
|
-
return {
|
|
36
|
-
...state,
|
|
37
|
-
showLib: true
|
|
38
|
-
};
|
|
39
|
-
case 'setGraphData':
|
|
40
|
-
return {
|
|
41
|
-
...state,
|
|
42
|
-
graphData: action.payload.graphData,
|
|
43
|
-
connectorComponent: action.payload.connectorComponent,
|
|
44
|
-
nodeComponent: action.payload.nodeComponent
|
|
45
|
-
};
|
|
46
|
-
default:
|
|
47
|
-
return state;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const StyledLabel = styled(Text)(({ theme }) => {
|
|
51
|
-
return css `
|
|
52
|
-
border-radius: ${theme.base['border-radius']};
|
|
53
|
-
background: ${theme.base.colors.slate.dark};
|
|
54
|
-
color: ${theme.base.colors.white};
|
|
55
|
-
text-align: center;
|
|
56
|
-
padding: calc(0.5 * ${theme.base.spacing});
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
text-overflow: ellipsis;
|
|
59
|
-
max-width: 32ch;
|
|
60
|
-
white-space: nowrap;
|
|
61
|
-
`;
|
|
62
|
-
});
|
|
63
|
-
StyledLabel.defaultProps = defaultThemeProp;
|
|
64
|
-
const FlowModeller = ({ graphData, onNodeActionClick, onNodeClick, onNodeAdd, nodeLibrary, actions }) => {
|
|
65
|
-
const [state, dispatch] = useReducer(reducer, initState);
|
|
66
|
-
const [popoverEl, setPopoverEl] = useElement(null);
|
|
67
|
-
const onNodeCreate = (el, meta) => {
|
|
68
|
-
dispatch({
|
|
69
|
-
type: 'setActiveAddButton',
|
|
70
|
-
payload: {
|
|
71
|
-
target: el,
|
|
72
|
-
meta
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
const closeMenu = () => {
|
|
77
|
-
dispatch({
|
|
78
|
-
type: 'showLibrary',
|
|
79
|
-
payload: {
|
|
80
|
-
show: false
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
const onGetNewPHNode = metaData => {
|
|
86
|
-
return {
|
|
87
|
-
id: createUID(),
|
|
88
|
-
children: (_jsx(AddButton, { addNodeHandler: (e) => {
|
|
89
|
-
onNodeCreate(e.currentTarget, metaData);
|
|
90
|
-
} }, void 0)),
|
|
91
|
-
position: { x: 0, y: 0 },
|
|
92
|
-
dimensions: { width: 1, height: 0 }
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
const onGetNewPHConnector = (fromNodeId, toNodeId) => {
|
|
96
|
-
return {
|
|
97
|
-
id: createUID(),
|
|
98
|
-
fromNodeId,
|
|
99
|
-
toNodeId,
|
|
100
|
-
points: []
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
const Connector = props => {
|
|
104
|
-
const { id, labelLayout } = props;
|
|
105
|
-
const refId = isPlaceHolderConnector(props)
|
|
106
|
-
? props.realConnectors
|
|
107
|
-
: id.toString();
|
|
108
|
-
const metaData = {
|
|
109
|
-
refType: 'connector',
|
|
110
|
-
refId
|
|
111
|
-
};
|
|
112
|
-
return (_jsxs(_Fragment, { children: [labelLayout?.value && (_jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledLabel, { children: labelLayout.value }, void 0) }, void 0)), _jsx(AddButton, { addNodeHandler: (e) => {
|
|
113
|
-
onNodeCreate(e.currentTarget, metaData);
|
|
114
|
-
} }, void 0)] }, void 0));
|
|
115
|
-
};
|
|
116
|
-
const Node = ({ id, type, label, description, additionalData }) => {
|
|
117
|
-
if (!type) {
|
|
118
|
-
return _jsx("div", {}, void 0);
|
|
119
|
-
}
|
|
120
|
-
if (type?.id === START_NODETYPE.id) {
|
|
121
|
-
return _jsx(StartNode, { id: id, type: type, label: label.toUpperCase() }, void 0);
|
|
122
|
-
}
|
|
123
|
-
if (type?.id === STOP_NODETYPE.id) {
|
|
124
|
-
return _jsx(EndNode, { id: id, type: type, label: label.toUpperCase() }, void 0);
|
|
125
|
-
}
|
|
126
|
-
return (_jsx(DefaultNode, { id: id, label: label, type: type, description: description, onActionClick: onNodeActionClick, onClick: onNodeClick, actions: actions, additionalData: additionalData }, void 0));
|
|
127
|
-
};
|
|
128
|
-
const flowNodes = graphData.nodes.map(node => {
|
|
129
|
-
const flowNode = {
|
|
130
|
-
...node,
|
|
131
|
-
dimensions: {
|
|
132
|
-
width: 280,
|
|
133
|
-
height: 120
|
|
134
|
-
},
|
|
135
|
-
position: {
|
|
136
|
-
x: 0,
|
|
137
|
-
y: 0
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
if (node.type.id === START_NODETYPE.id || node.type.id === STOP_NODETYPE.id) {
|
|
141
|
-
flowNode.dimensions.width = 58;
|
|
142
|
-
flowNode.dimensions.height = 58;
|
|
143
|
-
}
|
|
144
|
-
return flowNode;
|
|
145
|
-
});
|
|
146
|
-
const connectors = graphData.connectors.map(connector => {
|
|
147
|
-
return {
|
|
148
|
-
...connector,
|
|
149
|
-
points: [],
|
|
150
|
-
data: {
|
|
151
|
-
label: connector.label
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
// inject the placeholderAddNodes dynamically
|
|
156
|
-
const newGraphData = PlaceHolderHelper.injectPlaceholderNodes({ nodes: flowNodes, connectors }, onGetNewPHNode, onGetNewPHConnector);
|
|
157
|
-
dispatch({
|
|
158
|
-
type: 'setGraphData',
|
|
159
|
-
payload: {
|
|
160
|
-
graphData: newGraphData,
|
|
161
|
-
connectorComponent: Connector,
|
|
162
|
-
nodeComponent: Node
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}, [graphData]);
|
|
166
|
-
/**
|
|
167
|
-
* Library popover functionality
|
|
168
|
-
*/
|
|
169
|
-
const onLibraryItemSelect = useCallback((libItem) => {
|
|
170
|
-
const metaData = state.activeAddBtnMeta.meta;
|
|
171
|
-
closeMenu();
|
|
172
|
-
onNodeAdd(libItem.type, metaData);
|
|
173
|
-
}, [state.activeAddBtnMeta]);
|
|
174
|
-
const onKeydown = useCallback((e) => {
|
|
175
|
-
if (e.key === 'Escape') {
|
|
176
|
-
closeMenu();
|
|
177
|
-
}
|
|
178
|
-
}, [closeMenu]);
|
|
179
|
-
useOuterEvent('mousedown', [popoverEl], closeMenu);
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
document.addEventListener('keydown', onKeydown);
|
|
182
|
-
return () => {
|
|
183
|
-
document.removeEventListener('keydown', onKeydown);
|
|
184
|
-
};
|
|
185
|
-
}, []);
|
|
186
|
-
const items = nodeLibrary !== undefined ? nodeLibrary : [];
|
|
187
|
-
return (_jsxs("div", { children: [_jsx(FlowRenderer, { graphData: state.graphData, connector: state.connectorComponent, node: state.nodeComponent }, void 0), _jsx(NodeLibrary, { show: state.showLib, target: state.activeAddBtnMeta.target, items: items, onClick: onLibraryItemSelect, ref: setPopoverEl }, void 0)] }, void 0));
|
|
188
|
-
};
|
|
189
|
-
export default FlowModeller;
|
|
190
|
-
//# sourceMappingURL=FlowModeller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowModeller.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/FlowModeller.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,SAAS,EAET,UAAU,EAGV,WAAW,EAEZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,SAAS,EACT,UAAU,EACV,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAIL,cAAc,EACd,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,iBAAiB,EAAE,EACxB,sBAAsB,EAEvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA2BtC,MAAM,SAAS,GAAkB;IAC/B,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE;QAChB,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,EAAE;SACV;KACF;IACD,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;IACxC,kBAAkB,EAAE,GAAG,EAAE,CAAC,2BAAK;IAC/B,aAAa,EAAE,GAAG,EAAE,CAAC,2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IACV,IAAI,EAAE,KAAK,CAAC,OAAO,EACnB,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,EACrC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,mBAAmB,EAC5B,GAAG,EAAE,YAAY,WACjB,YACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n PropsWithoutRef,\n useEffect,\n MouseEvent,\n useReducer,\n FC,\n Reducer,\n useCallback,\n ComponentType\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Action,\n createUID,\n useElement,\n useOuterEvent,\n Flex,\n Text,\n defaultThemeProp\n} from '@pega/cosmos-react-core';\n\nimport { GraphData, ConnectorProps } from './Renderer/Utils/Graph';\nimport {\n AddNodeHandlerParams,\n RendererConnectorProps,\n RendererNodeProps\n} from './Renderer/Renderer.types';\nimport FlowRenderer from './Renderer/Renderer';\nimport { StartNode, EndNode, DefaultNode } from './Node/NodeTemplates';\nimport {\n ActionParams,\n NodeProps,\n NodeLibraryItem,\n START_NODETYPE,\n STOP_NODETYPE,\n NodeType\n} from './Node/Node.types';\nimport NodeLibrary from './NodeLibrary';\nimport PlaceHolderHelper, {\n isPlaceHolderConnector,\n PlaceHolderConnector\n} from './Utils/AddNodeUtils';\nimport { AddButton } from './AddNode';\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?: (nodeId: string) => void;\n /** Callback for actions on Node */\n onNodeActionClick?: (param: ActionParams, e: MouseEvent) => void;\n /** Types of nodes */\n nodeLibrary: NodeLibraryItem[];\n}\n\ntype ModellerState = {\n showLib: boolean;\n activeAddBtnMeta: {\n target: null; // we will maintain ref of an Element\n meta: AddNodeHandlerParams;\n };\n graphData: GraphData<RendererNodeProps, RendererConnectorProps>;\n connectorComponent: ComponentType<RendererConnectorProps>;\n nodeComponent: ComponentType<RendererNodeProps>;\n};\n\nconst initState: ModellerState = {\n showLib: false,\n activeAddBtnMeta: {\n target: null,\n meta: {\n refType: 'node',\n refId: ''\n }\n },\n graphData: { nodes: [], connectors: [] },\n connectorComponent: () => <></>,\n nodeComponent: () => <></>\n};\n\nconst reducer = (state: ModellerState, action: { type: string; payload: any }) => {\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 };\n case 'setActiveAddButton':\n state.activeAddBtnMeta = {\n ...action.payload\n };\n return {\n ...state,\n showLib: true\n };\n case 'setGraphData':\n return {\n ...state,\n graphData: action.payload.graphData,\n connectorComponent: action.payload.connectorComponent,\n nodeComponent: action.payload.nodeComponent\n };\n default:\n return state;\n }\n};\n\nconst StyledLabel = styled(Text)(({ theme }) => {\n return css`\n border-radius: ${theme.base['border-radius']};\n background: ${theme.base.colors.slate.dark};\n color: ${theme.base.colors.white};\n text-align: center;\n padding: calc(0.5 * ${theme.base.spacing});\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 32ch;\n white-space: nowrap;\n `;\n});\n\nStyledLabel.defaultProps = defaultThemeProp;\n\nconst FlowModeller = ({\n graphData,\n onNodeActionClick,\n onNodeClick,\n onNodeAdd,\n nodeLibrary,\n actions\n}: PropsWithoutRef<FlowModellerProps>) => {\n const [state, dispatch] = useReducer<Reducer<ModellerState, any>>(reducer, initState);\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>(null);\n\n const onNodeCreate = (el: HTMLElement | SVGForeignObjectElement, meta: AddNodeHandlerParams) => {\n dispatch({\n type: 'setActiveAddButton',\n payload: {\n target: el,\n meta\n }\n });\n };\n\n const closeMenu = () => {\n dispatch({\n type: 'showLibrary',\n payload: {\n show: false\n }\n });\n };\n\n useEffect(() => {\n const onGetNewPHNode: (metaData: AddNodeHandlerParams) => RendererNodeProps = metaData => {\n return {\n id: createUID(),\n children: (\n <AddButton\n addNodeHandler={(e: MouseEvent<HTMLButtonElement>) => {\n onNodeCreate(e.currentTarget as HTMLElement, metaData);\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 ) => RendererConnectorProps = (fromNodeId, toNodeId) => {\n return {\n id: createUID(),\n fromNodeId,\n toNodeId,\n points: []\n };\n };\n\n const Connector: FC<RendererConnectorProps> = props => {\n const { id, labelLayout } = props;\n\n const refId = isPlaceHolderConnector(props)\n ? (props as PlaceHolderConnector).realConnectors\n : id.toString();\n\n const metaData: AddNodeHandlerParams = {\n refType: 'connector',\n refId\n };\n\n return (\n <>\n {labelLayout?.value && (\n <Flex container={{ justify: 'center' }}>\n <StyledLabel>{labelLayout.value}</StyledLabel>\n </Flex>\n )}\n <AddButton\n addNodeHandler={(e: MouseEvent<HTMLButtonElement>) => {\n onNodeCreate(e.currentTarget, metaData);\n }}\n />\n </>\n );\n };\n const Node: FC<NodeProps> = ({ id, type, label, description, additionalData }) => {\n if (!type) {\n return <div />;\n }\n if (type?.id === START_NODETYPE.id) {\n return <StartNode id={id} type={type} label={label.toUpperCase()} />;\n }\n if (type?.id === STOP_NODETYPE.id) {\n return <EndNode id={id} type={type} label={label.toUpperCase()} />;\n }\n return (\n <DefaultNode\n id={id}\n label={label}\n type={type}\n description={description}\n onActionClick={onNodeActionClick}\n onClick={onNodeClick}\n actions={actions}\n additionalData={additionalData}\n />\n );\n };\n\n const flowNodes: RendererNodeProps[] = graphData.nodes.map(node => {\n const flowNode: RendererNodeProps = {\n ...node,\n dimensions: {\n width: 280,\n height: 120\n },\n position: {\n x: 0,\n y: 0\n }\n };\n\n if (node.type.id === START_NODETYPE.id || node.type.id === STOP_NODETYPE.id) {\n flowNode.dimensions.width = 58;\n flowNode.dimensions.height = 58;\n }\n return flowNode;\n });\n\n const connectors: RendererConnectorProps[] = graphData.connectors.map(connector => {\n return {\n ...connector,\n points: [],\n data: {\n label: connector.label\n }\n };\n });\n\n // inject the placeholderAddNodes dynamically\n const newGraphData: GraphData<RendererNodeProps, RendererConnectorProps> =\n PlaceHolderHelper.injectPlaceholderNodes(\n { nodes: flowNodes, connectors },\n onGetNewPHNode,\n onGetNewPHConnector\n );\n\n dispatch({\n type: 'setGraphData',\n payload: {\n graphData: newGraphData,\n connectorComponent: Connector,\n nodeComponent: Node\n }\n });\n }, [graphData]);\n\n /**\n * Library popover functionality\n */\n const onLibraryItemSelect = useCallback(\n (libItem: NodeLibraryItem) => {\n const metaData = state.activeAddBtnMeta.meta;\n closeMenu();\n onNodeAdd(libItem.type, metaData);\n },\n [state.activeAddBtnMeta]\n );\n\n const onKeydown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n closeMenu();\n }\n },\n [closeMenu]\n );\n\n useOuterEvent('mousedown', [popoverEl], closeMenu);\n\n useEffect(() => {\n document.addEventListener('keydown', onKeydown);\n return () => {\n document.removeEventListener('keydown', onKeydown);\n };\n }, []);\n\n const items: NodeLibraryItem[] = nodeLibrary !== undefined ? nodeLibrary : [];\n\n return (\n <div>\n <FlowRenderer\n graphData={state.graphData}\n connector={state.connectorComponent}\n node={state.nodeComponent}\n />\n <NodeLibrary\n show={state.showLib}\n target={state.activeAddBtnMeta.target}\n items={items}\n onClick={onLibraryItemSelect}\n ref={setPopoverEl}\n />\n </div>\n );\n};\n\nexport default FlowModeller;\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Ref, MouseEvent } from 'react';
|
|
2
|
-
import { Action, MenuItemProps, OmitStrict } from '@pega/cosmos-react-core';
|
|
3
|
-
import { Node } from '../Renderer/Utils/Graph';
|
|
4
|
-
export interface NodeType {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
color: string;
|
|
8
|
-
icon: string;
|
|
9
|
-
minConnectors: number;
|
|
10
|
-
defaults: {
|
|
11
|
-
node: OmitStrict<NodeProps, 'type' | 'id'>;
|
|
12
|
-
connector: {
|
|
13
|
-
label: string;
|
|
14
|
-
}[];
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export interface NodeProps extends Node {
|
|
18
|
-
/** Unique id for Node */
|
|
19
|
-
id: string;
|
|
20
|
-
/** Label for Node */
|
|
21
|
-
label: string;
|
|
22
|
-
/** Description for Node */
|
|
23
|
-
description?: string;
|
|
24
|
-
/** Additional data for Node */
|
|
25
|
-
additionalData?: AdditionalDataItemProps[];
|
|
26
|
-
type: NodeType;
|
|
27
|
-
}
|
|
28
|
-
export interface NodeComponentProps extends NodeProps {
|
|
29
|
-
/** Callback for the node actions click */
|
|
30
|
-
onActionClick?: (params: ActionParams, e: MouseEvent) => void;
|
|
31
|
-
/** Callback for the node click */
|
|
32
|
-
onClick?: (nodeId: NodeProps['id']) => void;
|
|
33
|
-
/** Actions for the node click */
|
|
34
|
-
actions?: Action[];
|
|
35
|
-
/** Ref of the node */
|
|
36
|
-
ref?: Ref<HTMLElement>;
|
|
37
|
-
}
|
|
38
|
-
export interface AdditionalDataItemProps {
|
|
39
|
-
id: string;
|
|
40
|
-
label: string;
|
|
41
|
-
value: string;
|
|
42
|
-
}
|
|
43
|
-
export interface ActionParams {
|
|
44
|
-
actionId: string;
|
|
45
|
-
nodeId: NodeProps['id'];
|
|
46
|
-
}
|
|
47
|
-
export interface NodeLibraryItem extends MenuItemProps {
|
|
48
|
-
id: string;
|
|
49
|
-
type: NodeType;
|
|
50
|
-
items?: NodeLibraryItem[];
|
|
51
|
-
}
|
|
52
|
-
export declare const START_NODETYPE: NodeType;
|
|
53
|
-
export declare const STOP_NODETYPE: NodeType;
|
|
54
|
-
//# sourceMappingURL=Node.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Node.types.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/Node.types.ts"],"names":[],"mappings":"AAAA,OAAO,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X,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,QAY3B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,QAY1B,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { themeDefinition } from '@pega/cosmos-react-core';
|
|
2
|
-
export const START_NODETYPE = Object.freeze({
|
|
3
|
-
id: 'start',
|
|
4
|
-
name: 'start',
|
|
5
|
-
color: themeDefinition.base.colors.green.medium.$value,
|
|
6
|
-
icon: 'circle',
|
|
7
|
-
minConnectors: 1,
|
|
8
|
-
defaults: {
|
|
9
|
-
node: {
|
|
10
|
-
label: 'Start'
|
|
11
|
-
},
|
|
12
|
-
connector: []
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export const STOP_NODETYPE = Object.freeze({
|
|
16
|
-
id: 'stop',
|
|
17
|
-
name: 'stop',
|
|
18
|
-
color: themeDefinition.base.colors.red.light.$value,
|
|
19
|
-
icon: 'circle',
|
|
20
|
-
minConnectors: 0,
|
|
21
|
-
defaults: {
|
|
22
|
-
node: {
|
|
23
|
-
label: 'Stop'
|
|
24
|
-
},
|
|
25
|
-
connector: []
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=Node.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Node.types.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/Node.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqC,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA+D7F,MAAM,CAAC,MAAM,cAAc,GAAa,MAAM,CAAC,MAAM,CAAC;IACpD,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;IACtD,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,KAAK,EAAE,OAAO;SACf;QACD,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAa,MAAM,CAAC,MAAM,CAAC;IACnD,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM;IACnD,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;SACd;QACD,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC","sourcesContent":["import { Ref, MouseEvent } from 'react';\n\nimport { Action, MenuItemProps, OmitStrict, themeDefinition } from '@pega/cosmos-react-core';\n\nimport { Node } from '../Renderer/Utils/Graph';\n\nexport interface NodeType {\n /* node type id. this must be unique */\n id: string;\n /* human readable name of the type */\n name: string;\n /* color that represents the type */\n color: string;\n /* icon that represents the type */\n icon: string;\n /* min no. of connectors */\n minConnectors: number;\n defaults: {\n node: OmitStrict<NodeProps, 'type' | 'id'>;\n connector: {\n label: string;\n }[];\n };\n}\n\nexport interface NodeProps extends Node {\n /** Unique id for Node */\n id: string;\n /** Label for Node */\n label: string;\n /** Description for Node */\n description?: string;\n /** Additional data for Node */\n additionalData?: AdditionalDataItemProps[];\n /* type of the Node */\n type: NodeType;\n}\n\nexport interface NodeComponentProps extends NodeProps {\n /** Callback for the node actions click */\n onActionClick?: (params: ActionParams, e: MouseEvent) => void;\n /** Callback for the node click */\n onClick?: (nodeId: NodeProps['id']) => void;\n /** Actions for the node click */\n actions?: Action[];\n /** Ref of the node */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface AdditionalDataItemProps {\n id: string;\n label: string;\n value: string;\n}\nexport interface ActionParams {\n actionId: string;\n nodeId: NodeProps['id'];\n}\n\nexport interface NodeLibraryItem extends MenuItemProps {\n id: string;\n type: NodeType;\n items?: NodeLibraryItem[];\n}\n\nexport const START_NODETYPE: NodeType = Object.freeze({\n id: 'start',\n name: 'start',\n color: themeDefinition.base.colors.green.medium.$value,\n icon: 'circle',\n minConnectors: 1,\n defaults: {\n node: {\n label: 'Start'\n },\n connector: []\n }\n});\n\nexport const STOP_NODETYPE: NodeType = Object.freeze({\n id: 'stop',\n name: 'stop',\n color: themeDefinition.base.colors.red.light.$value,\n icon: 'circle',\n minConnectors: 0,\n defaults: {\n node: {\n label: 'Stop'\n },\n connector: []\n }\n});\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { NodeType } from './Node.types';
|
|
2
|
-
export declare const StyledCircle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
-
export declare const StyledLabel: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
|
|
4
|
-
nodeType: NodeType;
|
|
5
|
-
}, never>;
|
|
6
|
-
export declare const StyledIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
-
export declare const StyledCardHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
-
export declare const StyledText: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
-
export declare const StyledCard: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
-
export declare const StyledCardFooter: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardFooterProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
11
|
-
export declare const StyledCardContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
12
|
-
export declare const StyledAdditionalData: import("styled-components").StyledComponent<"dl", import("styled-components").DefaultTheme, {}, never>;
|
|
13
|
-
export declare const StyledAdditionalDataItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
14
|
-
export declare const StyledTextWithEllipsis: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
15
|
-
//# sourceMappingURL=NodeTemplate.styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplate.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,YAAY,yGAYvB,CAAC;AAIH,eAAO,MAAM,WAAW;cAA4B,QAAQ;SAW1D,CAAC;AAIH,eAAO,MAAM,UAAU,yGAWrB,CAAC;AAIH,eAAO,MAAM,gBAAgB,4GAQ3B,CAAC;AAIH,eAAO,MAAM,UAAU,mOAOrB,CAAC;AAIH,eAAO,MAAM,UAAU,mOAoBrB,CAAC;AAEH,eAAO,MAAM,gBAAgB,yOAO3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAa5B,CAAC;AAIH,eAAO,MAAM,oBAAoB,wGAEhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,yGAMnC,CAAC;AAGH,eAAO,MAAM,sBAAsB,mOAQjC,CAAC"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { defaultThemeProp, Card, Text, CardFooter } from '@pega/cosmos-react-core';
|
|
3
|
-
export const StyledCircle = styled.div(({ theme }) => {
|
|
4
|
-
return css `
|
|
5
|
-
height: 2rem;
|
|
6
|
-
width: 2rem;
|
|
7
|
-
background: var(--bg-color);
|
|
8
|
-
border-radius: 50%;
|
|
9
|
-
align-self: center;
|
|
10
|
-
&:focus {
|
|
11
|
-
outline: none;
|
|
12
|
-
box-shadow: ${theme.base.shadow.focus};
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
});
|
|
16
|
-
StyledCircle.defaultProps = defaultThemeProp;
|
|
17
|
-
export const StyledLabel = styled(Text)(({ nodeType, theme }) => {
|
|
18
|
-
return css `
|
|
19
|
-
align-self: center;
|
|
20
|
-
${nodeType.name === 'start'
|
|
21
|
-
? css `
|
|
22
|
-
padding-block-end: ${theme.base.spacing};
|
|
23
|
-
`
|
|
24
|
-
: css `
|
|
25
|
-
padding-block-start: ${theme.base.spacing};
|
|
26
|
-
`}
|
|
27
|
-
`;
|
|
28
|
-
});
|
|
29
|
-
StyledLabel.defaultProps = defaultThemeProp;
|
|
30
|
-
export const StyledIcon = styled.div(({ theme }) => {
|
|
31
|
-
return css `
|
|
32
|
-
min-height: 2rem;
|
|
33
|
-
min-width: 2rem;
|
|
34
|
-
padding: calc(0.5 * ${theme.base.spacing});
|
|
35
|
-
margin-inline-end: ${theme.base.spacing};
|
|
36
|
-
text-align: center;
|
|
37
|
-
background-color: var(--bg-color);
|
|
38
|
-
color: var(--fg-color);
|
|
39
|
-
border-radius: ${theme.base['border-radius']};
|
|
40
|
-
`;
|
|
41
|
-
});
|
|
42
|
-
StyledIcon.defaultProps = defaultThemeProp;
|
|
43
|
-
export const StyledCardHeader = styled.header(({ theme }) => {
|
|
44
|
-
return css `
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
button {
|
|
47
|
-
visibility: hidden;
|
|
48
|
-
border-radius: ${theme.base['border-radius']};
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
});
|
|
52
|
-
StyledCardHeader.defaultProps = defaultThemeProp;
|
|
53
|
-
export const StyledText = styled(Text)(({ theme }) => {
|
|
54
|
-
return css `
|
|
55
|
-
padding-inline-end: ${theme.base.spacing};
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
min-width: 12rem;
|
|
58
|
-
text-overflow: ellipsis;
|
|
59
|
-
`;
|
|
60
|
-
});
|
|
61
|
-
StyledText.defaultProps = defaultThemeProp;
|
|
62
|
-
export const StyledCard = styled(Card)(({ theme }) => {
|
|
63
|
-
return css `
|
|
64
|
-
width: 17.5rem;
|
|
65
|
-
height: 7.5rem;
|
|
66
|
-
align-self: center;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
&&& {
|
|
69
|
-
border-radius: ${theme.base['border-radius']};
|
|
70
|
-
}
|
|
71
|
-
&:focus-within,
|
|
72
|
-
&:hover {
|
|
73
|
-
box-shadow: ${theme.base.shadow.focus};
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
${StyledCardHeader} {
|
|
76
|
-
button {
|
|
77
|
-
visibility: visible;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
});
|
|
83
|
-
export const StyledCardFooter = styled(CardFooter)(() => {
|
|
84
|
-
return css `
|
|
85
|
-
margin-top: auto;
|
|
86
|
-
&:not(${StyledCard} ${StyledCard} > &) {
|
|
87
|
-
padding: 0.5rem;
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
});
|
|
91
|
-
StyledCard.defaultProps = defaultThemeProp;
|
|
92
|
-
export const StyledCardContent = styled.div(({ theme }) => {
|
|
93
|
-
return css `
|
|
94
|
-
padding: ${theme.base.spacing};
|
|
95
|
-
padding-block-start: 0;
|
|
96
|
-
max-height: 2.5rem;
|
|
97
|
-
display: -webkit-box;
|
|
98
|
-
-webkit-line-clamp: 2;
|
|
99
|
-
-webkit-box-orient: vertical;
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
text-overflow: ellipsis;
|
|
102
|
-
white-space: pre-wrap;
|
|
103
|
-
word-wrap: break-word;
|
|
104
|
-
`;
|
|
105
|
-
});
|
|
106
|
-
StyledCardContent.defaultProps = defaultThemeProp;
|
|
107
|
-
export const StyledAdditionalData = styled.dl `
|
|
108
|
-
overflow: hidden;
|
|
109
|
-
`;
|
|
110
|
-
export const StyledAdditionalDataItem = styled.div(({ theme }) => {
|
|
111
|
-
return css `
|
|
112
|
-
padding: 0 calc(0.5 * ${theme.base.spacing});
|
|
113
|
-
background-color: ${theme.base.palette['secondary-background']};
|
|
114
|
-
border-radius: ${theme.base['border-radius']};
|
|
115
|
-
`;
|
|
116
|
-
});
|
|
117
|
-
StyledAdditionalDataItem.defaultProps = defaultThemeProp;
|
|
118
|
-
export const StyledTextWithEllipsis = styled(Text)(() => {
|
|
119
|
-
return css `
|
|
120
|
-
overflow: hidden;
|
|
121
|
-
width: auto;
|
|
122
|
-
display: inline-block;
|
|
123
|
-
white-space: nowrap;
|
|
124
|
-
text-overflow: ellipsis;
|
|
125
|
-
`;
|
|
126
|
-
});
|
|
127
|
-
StyledTextWithEllipsis.defaultProps = defaultThemeProp;
|
|
128
|
-
//# sourceMappingURL=NodeTemplate.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplate.styles.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplate.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAInF,MAAM,CAAC,MAAM,YAA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,OAAO;wBACtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC;qBAC7C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;GAC7C,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE;IACtD,OAAO,GAAG,CAAA;;;;;;GAMT,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp, Card, Text, CardFooter } from '@pega/cosmos-react-core';\n\nimport { NodeType } from './Node.types';\n\nexport const StyledCircle = styled.div(({ theme }) => {\n return css`\n height: 2rem;\n width: 2rem;\n background: var(--bg-color);\n border-radius: 50%;\n align-self: center;\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledCircle.defaultProps = defaultThemeProp;\n\nexport const StyledLabel = styled(Text)<{ nodeType: NodeType }>(({ nodeType, theme }) => {\n return css`\n align-self: center;\n ${nodeType.name === 'start'\n ? css`\n padding-block-end: ${theme.base.spacing};\n `\n : css`\n padding-block-start: ${theme.base.spacing};\n `}\n `;\n});\n\nStyledLabel.defaultProps = defaultThemeProp;\n\nexport const StyledIcon = styled.div(({ theme }) => {\n return css`\n min-height: 2rem;\n min-width: 2rem;\n padding: calc(0.5 * ${theme.base.spacing});\n margin-inline-end: ${theme.base.spacing};\n text-align: center;\n background-color: var(--bg-color);\n color: var(--fg-color);\n border-radius: ${theme.base['border-radius']};\n `;\n});\n\nStyledIcon.defaultProps = defaultThemeProp;\n\nexport const StyledCardHeader = styled.header(({ theme }) => {\n return css`\n white-space: nowrap;\n button {\n visibility: hidden;\n border-radius: ${theme.base['border-radius']};\n }\n `;\n});\n\nStyledCardHeader.defaultProps = defaultThemeProp;\n\nexport const StyledText = styled(Text)(({ theme }) => {\n return css`\n padding-inline-end: ${theme.base.spacing};\n overflow: hidden;\n min-width: 12rem;\n text-overflow: ellipsis;\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nexport const StyledCard = styled(Card)(({ theme }) => {\n return css`\n width: 17.5rem;\n height: 7.5rem;\n align-self: center;\n overflow: hidden;\n &&& {\n border-radius: ${theme.base['border-radius']};\n }\n &:focus-within,\n &:hover {\n box-shadow: ${theme.base.shadow.focus};\n cursor: pointer;\n ${StyledCardHeader} {\n button {\n visibility: visible;\n }\n }\n }\n `;\n});\n\nexport const StyledCardFooter = styled(CardFooter)(() => {\n return css`\n margin-top: auto;\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: 0.5rem;\n }\n `;\n});\n\nStyledCard.defaultProps = defaultThemeProp;\n\nexport const StyledCardContent = styled.div(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n padding-block-start: 0;\n max-height: 2.5rem;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre-wrap;\n word-wrap: break-word;\n `;\n});\n\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledAdditionalData = styled.dl`\n overflow: hidden;\n`;\n\nexport const StyledAdditionalDataItem = styled.div(({ theme }) => {\n return css`\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${theme.base.palette['secondary-background']};\n border-radius: ${theme.base['border-radius']};\n `;\n});\nStyledAdditionalDataItem.defaultProps = defaultThemeProp;\n\nexport const StyledTextWithEllipsis = styled(Text)(() => {\n return css`\n overflow: hidden;\n width: auto;\n display: inline-block;\n white-space: nowrap;\n text-overflow: ellipsis;\n `;\n});\nStyledTextWithEllipsis.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithoutRef } from 'react';
|
|
2
|
-
import { NodeProps, NodeComponentProps } from './Node.types';
|
|
3
|
-
export declare const DefaultNode: import("react").ForwardRefExoticComponent<Pick<NodeComponentProps, "description" | "data" | "label" | "id" | "type" | "onClick" | "actions" | "additionalData" | "onActionClick"> & import("react").RefAttributes<HTMLElement>>;
|
|
4
|
-
export declare const StartNode: ({ type, label }: PropsWithoutRef<NodeProps>) => JSX.Element;
|
|
5
|
-
export declare const EndNode: ({ type, label }: PropsWithoutRef<NodeProps>) => JSX.Element;
|
|
6
|
-
//# sourceMappingURL=NodeTemplates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplates.d.ts","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAOhB,MAAM,OAAO,CAAC;AA2Bf,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AA8DtF,eAAO,MAAM,WAAW,iOAuGvB,CAAC;AAEF,eAAO,MAAM,SAAS,oBAAqB,gBAAgB,SAAS,CAAC,gBAmBpE,CAAC;AAEF,eAAO,MAAM,OAAO,oBAAqB,gBAAgB,SAAS,CAAC,gBAmBlE,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, forwardRef } from 'react';
|
|
3
|
-
import { readableColor } from 'polished';
|
|
4
|
-
import { MenuButton, Icon, Flex, Tooltip, useElement, useI18n, cap, Text } from '@pega/cosmos-react-core';
|
|
5
|
-
import { StyledLabel, StyledCircle, StyledIcon, StyledCardHeader, StyledCardContent, StyledCard, StyledText, StyledTextWithEllipsis, StyledAdditionalData, StyledCardFooter, StyledAdditionalDataItem } from './NodeTemplate.styles';
|
|
6
|
-
const MetaListItem = ({ label, value }) => {
|
|
7
|
-
const [nodeAdditionalDataItem, setNodeAdditionalDataItem] = useElement();
|
|
8
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: StyledAdditionalDataItem, container: { wrap: 'nowrap', pad: 0.25, gap: 0.25 }, item: { grow: 1 }, ref: setNodeAdditionalDataItem, children: [_jsx(StyledTextWithEllipsis, { as: 'dd', children: label }, void 0), _jsx(Text, { role: 'separator', variant: 'secondary', "aria-hidden": 'true', children: ":\u00A0" }, void 0), _jsx(StyledTextWithEllipsis, { as: 'dt', children: value }, void 0)] }, void 0), _jsx(Tooltip, { target: nodeAdditionalDataItem, hideDelay: 'none', children: `${label}:${value}` }, void 0)] }, void 0));
|
|
9
|
-
};
|
|
10
|
-
const MetaList = ({ metadata }) => {
|
|
11
|
-
const [nodeAdditionalData, setNodeAdditionalData] = useElement();
|
|
12
|
-
let additionalDataValue = '';
|
|
13
|
-
metadata?.forEach((item, index) => {
|
|
14
|
-
if (index > 1) {
|
|
15
|
-
additionalDataValue += `${item.label}: ${item.value}
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return (_jsxs(Flex, { as: StyledAdditionalData, container: { wrap: 'nowrap', colGap: 1, rowGap: 0.25 }, children: [metadata?.map((data, index) => {
|
|
20
|
-
if (index >= 2) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
return _jsx(MetaListItem, { ...data }, data.id);
|
|
24
|
-
}), metadata && metadata.length > 2 && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: StyledAdditionalDataItem, container: { pad: 0.25 }, item: { grow: 1, shrink: 0 }, ref: setNodeAdditionalData, children: _jsx(StyledTextWithEllipsis, { as: 'dt', children: `+${metadata?.length - 2}` }, void 0) }, void 0), additionalDataValue && (_jsx(Tooltip, { target: nodeAdditionalData, hideDelay: 'none', children: additionalDataValue }, void 0))] }, void 0))] }, void 0));
|
|
25
|
-
};
|
|
26
|
-
export const DefaultNode = forwardRef(({ id, label, type, description, additionalData, actions, onActionClick, onClick, ...restProps }, ref) => {
|
|
27
|
-
const t = useI18n();
|
|
28
|
-
const actionItems = actions?.map(actionItem => {
|
|
29
|
-
return {
|
|
30
|
-
id: actionItem.id,
|
|
31
|
-
primary: actionItem.text,
|
|
32
|
-
onClick: (actionId, e) => {
|
|
33
|
-
e.stopPropagation();
|
|
34
|
-
onActionClick?.({ actionId, nodeId: id }, e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
const handleEnterKeyDown = useCallback((e) => {
|
|
39
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
40
|
-
onClick?.(id);
|
|
41
|
-
}
|
|
42
|
-
}, [onClick]);
|
|
43
|
-
const [nodeLabel, setNodeLabel] = useElement();
|
|
44
|
-
const [nodeDescription, setNodeDescription] = useElement();
|
|
45
|
-
const [nodeIcon, setNodeIcon] = useElement();
|
|
46
|
-
const color = readableColor(type.color);
|
|
47
|
-
return (_jsxs(StyledCard, { "aria-label": label, onClick: () => onClick?.(id), onKeyDown: handleEnterKeyDown, ref: ref, ...restProps, children: [_jsxs(Flex, { as: StyledCardHeader, container: { alignItems: 'center', pad: 1 }, children: [_jsx(StyledIcon, { id: id, style: {
|
|
48
|
-
'--bg-color': type.color,
|
|
49
|
-
'--fg-color': color
|
|
50
|
-
}, ref: setNodeIcon, children: _jsx(Icon, { name: type.icon }, void 0) }, void 0), _jsx(Tooltip, { target: nodeIcon, hideDelay: 'none', children: cap(type.name) }, void 0), _jsx(StyledText, { variant: 'h4', ref: setNodeLabel, children: label }, void 0), _jsx(Tooltip, { describeTarget: false, target: nodeLabel, hideDelay: 'none', children: label }, void 0), actionItems && (_jsx(MenuButton, { portal: true, variant: 'simple', text: t('actions'), icon: 'more', iconOnly: true, onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), menu: {
|
|
51
|
-
items: actionItems
|
|
52
|
-
} }, void 0))] }, void 0), description && (_jsxs(_Fragment, { children: [_jsx(StyledCardContent, { ref: setNodeDescription, children: description }, void 0), _jsx(Tooltip, { describeTarget: false, target: nodeDescription, hideDelay: 'none', children: description }, void 0)] }, void 0)), additionalData && (_jsx(StyledCardFooter, { children: _jsx(MetaList, { metadata: additionalData }, void 0) }, void 0))] }, void 0));
|
|
53
|
-
});
|
|
54
|
-
export const StartNode = ({ type, label }) => {
|
|
55
|
-
return (_jsxs(Flex, { container: { justify: 'center', direction: 'column' }, children: [_jsx(Flex, { as: StyledLabel, nodeType: type, children: label }, void 0), _jsx(Flex, { as: StyledCircle, style: {
|
|
56
|
-
'--bg-color': type.color
|
|
57
|
-
}, tabIndex: '0', "aria-label": label, role: 'button' }, void 0)] }, void 0));
|
|
58
|
-
};
|
|
59
|
-
export const EndNode = ({ type, label }) => {
|
|
60
|
-
return (_jsxs(Flex, { container: { justify: 'center', direction: 'column' }, children: [_jsx(Flex, { as: StyledCircle, style: {
|
|
61
|
-
'--bg-color': type.color
|
|
62
|
-
}, tabIndex: '0', "aria-label": label, role: 'button' }, void 0), _jsx(Flex, { as: StyledLabel, nodeType: type, children: label }, void 0)] }, void 0));
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=NodeTemplates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTemplates.js","sourceRoot":"","sources":["../../../../src/components/FlowModeller/Node/NodeTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EAGX,UAAU,EAEX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,UAAU,EACV,OAAO,EACP,GAAG,EACH,IAAI,EACL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,YAAY,GAAG,CA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AE,YAAY,EAChB,KAAK,EACH;oBACE,YAAY,EAAE,IAAI,CAAC,KAAK;iBACR,EAEpB,QAAQ,EAAC,GAAG,gBACA,KAAK,EACjB,IAAI,EAAC,QAAQ,WACb,YACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAA8B,EAAE,EAAE;IACrE,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aACzD,KAAC,IAAI,IACH,EAAE,EAAE,YAAY,EAChB,KAAK,EACH;oBACE,YAAY,EAAE,IAAI,CAAC,KAAK;iBACR,EAEpB,QAAQ,EAAC,GAAG,gBACA,KAAK,EACjB,IAAI,EAAC,QAAQ,WACb,EACF,KAAC,IAAI,IAAC,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,YAClC,KAAK,WACD,YACF,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n PropsWithoutRef,\n CSSProperties,\n useCallback,\n MouseEvent,\n KeyboardEvent,\n forwardRef,\n FC\n} from 'react';\nimport { readableColor } from 'polished';\n\nimport {\n MenuButton,\n Icon,\n Flex,\n Tooltip,\n useElement,\n useI18n,\n cap,\n Text\n} from '@pega/cosmos-react-core';\n\nimport {\n StyledLabel,\n StyledCircle,\n StyledIcon,\n StyledCardHeader,\n StyledCardContent,\n StyledCard,\n StyledText,\n StyledTextWithEllipsis,\n StyledAdditionalData,\n StyledCardFooter,\n StyledAdditionalDataItem\n} from './NodeTemplate.styles';\nimport { NodeProps, NodeComponentProps, AdditionalDataItemProps } from './Node.types';\n\nconst MetaListItem = ({ label, value }: AdditionalDataItemProps) => {\n const [nodeAdditionalDataItem, setNodeAdditionalDataItem] = useElement();\n return (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ wrap: 'nowrap', pad: 0.25, gap: 0.25 }}\n item={{ grow: 1 }}\n ref={setNodeAdditionalDataItem}\n >\n <StyledTextWithEllipsis as='dd'>{label}</StyledTextWithEllipsis>\n <Text role='separator' variant='secondary' aria-hidden='true'>\n : \n </Text>\n <StyledTextWithEllipsis as='dt'>{value}</StyledTextWithEllipsis>\n </Flex>\n <Tooltip target={nodeAdditionalDataItem} hideDelay='none'>\n {`${label}:${value}`}\n </Tooltip>\n </>\n );\n};\n\nconst MetaList: FC<{ metadata: NodeProps['additionalData'] }> = ({ metadata }) => {\n const [nodeAdditionalData, setNodeAdditionalData] = useElement();\n let additionalDataValue = '';\n metadata?.forEach((item: AdditionalDataItemProps, index: number) => {\n if (index > 1) {\n additionalDataValue += `${item.label}: ${item.value}\n `;\n }\n });\n return (\n <Flex as={StyledAdditionalData} container={{ wrap: 'nowrap', colGap: 1, rowGap: 0.25 }}>\n {metadata?.map((data: AdditionalDataItemProps, index: number) => {\n if (index >= 2) {\n return;\n }\n return <MetaListItem key={data.id} {...data} />;\n })}\n {metadata && metadata.length > 2 && (\n <>\n <Flex\n as={StyledAdditionalDataItem}\n container={{ pad: 0.25 }}\n item={{ grow: 1, shrink: 0 }}\n ref={setNodeAdditionalData}\n >\n <StyledTextWithEllipsis as='dt'>{`+${metadata?.length - 2}`}</StyledTextWithEllipsis>\n </Flex>\n {additionalDataValue && (\n <Tooltip target={nodeAdditionalData} hideDelay='none'>\n {additionalDataValue}\n </Tooltip>\n )}\n </>\n )}\n </Flex>\n );\n};\nexport const DefaultNode = forwardRef(\n (\n {\n id,\n label,\n type,\n description,\n additionalData,\n actions,\n onActionClick,\n onClick,\n ...restProps\n }: PropsWithoutRef<NodeComponentProps>,\n ref: NodeComponentProps['ref']\n ) => {\n const t = useI18n();\n const actionItems = actions?.map(actionItem => {\n return {\n id: actionItem.id,\n primary: actionItem.text,\n onClick: (actionId: string, e: MouseEvent) => {\n e.stopPropagation();\n onActionClick?.({ actionId, nodeId: id }, e);\n }\n };\n });\n\n const handleEnterKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n onClick?.(id);\n }\n },\n [onClick]\n );\n\n const [nodeLabel, setNodeLabel] = useElement();\n const [nodeDescription, setNodeDescription] = useElement();\n\n const [nodeIcon, setNodeIcon] = useElement();\n const color = readableColor(type.color);\n return (\n <StyledCard\n aria-label={label}\n onClick={() => onClick?.(id)}\n onKeyDown={handleEnterKeyDown}\n ref={ref}\n {...restProps}\n >\n <Flex as={StyledCardHeader} container={{ alignItems: 'center', pad: 1 }}>\n <StyledIcon\n id={id}\n style={\n {\n '--bg-color': type.color,\n '--fg-color': color\n } as CSSProperties\n }\n ref={setNodeIcon}\n >\n <Icon name={type.icon} />\n </StyledIcon>\n <Tooltip target={nodeIcon} hideDelay='none'>\n {cap(type.name)}\n </Tooltip>\n <StyledText variant='h4' ref={setNodeLabel}>\n {label}\n </StyledText>\n <Tooltip describeTarget={false} target={nodeLabel} hideDelay='none'>\n {label}\n </Tooltip>\n\n {actionItems && (\n <MenuButton\n portal\n variant='simple'\n text={t('actions')}\n icon='more'\n iconOnly\n onClick={(e: MouseEvent) => e.stopPropagation()}\n onKeyDown={(e: KeyboardEvent) => e.stopPropagation()}\n menu={{\n items: actionItems\n }}\n />\n )}\n </Flex>\n {description && (\n <>\n <StyledCardContent ref={setNodeDescription}>{description}</StyledCardContent>\n <Tooltip describeTarget={false} target={nodeDescription} hideDelay='none'>\n {description}\n </Tooltip>\n </>\n )}\n {additionalData && (\n <StyledCardFooter>\n <MetaList metadata={additionalData} />\n </StyledCardFooter>\n )}\n </StyledCard>\n );\n }\n);\n\nexport const StartNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <Flex as={StyledLabel} nodeType={type}>\n {label}\n </Flex>\n <Flex\n as={StyledCircle}\n style={\n {\n '--bg-color': type.color\n } as CSSProperties\n }\n tabIndex='0'\n aria-label={label}\n role='button'\n />\n </Flex>\n );\n};\n\nexport const EndNode = ({ type, label }: PropsWithoutRef<NodeProps>) => {\n return (\n <Flex container={{ justify: 'center', direction: 'column' }}>\n <Flex\n as={StyledCircle}\n style={\n {\n '--bg-color': type.color\n } as CSSProperties\n }\n tabIndex='0'\n aria-label={label}\n role='button'\n />\n <Flex as={StyledLabel} nodeType={type}>\n {label}\n </Flex>\n </Flex>\n );\n};\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FC, Ref } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { NodeLibraryItem } from './Node/Node.types';
|
|
4
|
-
export interface NodeLibraryProps {
|
|
5
|
-
show: boolean;
|
|
6
|
-
target: HTMLElement | null;
|
|
7
|
-
items: NodeLibraryItem[];
|
|
8
|
-
onClick: (libItem: NodeLibraryItem) => void;
|
|
9
|
-
ref?: Ref<HTMLDivElement>;
|
|
10
|
-
}
|
|
11
|
-
declare const NodeLibrary: FC<NodeLibraryProps & ForwardProps>;
|
|
12
|
-
export default NodeLibrary;
|
|
13
|
-
//# sourceMappingURL=NodeLibrary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeLibrary.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/NodeLibrary.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EAGF,GAAG,EAOJ,MAAM,OAAO,CAAC;AAIf,OAAO,EACL,YAAY,EAWb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOpD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,OAAO,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG,YAAY,CAwFpD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|