@pega/cosmos-react-build 2.1.6 → 2.1.7
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/AppHeader/AppHeader.d.ts +29 -0
- package/lib/components/AppHeader/AppHeader.d.ts.map +1 -0
- package/lib/components/AppHeader/AppHeader.js +32 -0
- package/lib/components/AppHeader/AppHeader.js.map +1 -0
- package/lib/components/AppHeader/AppHeader.styles.d.ts +12 -0
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -0
- package/lib/components/AppHeader/AppHeader.styles.js +123 -0
- package/lib/components/AppHeader/AppHeader.styles.js.map +1 -0
- package/lib/components/AppHeader/index.d.ts +3 -0
- package/lib/components/AppHeader/index.d.ts.map +1 -0
- package/lib/components/AppHeader/index.js +2 -0
- package/lib/components/AppHeader/index.js.map +1 -0
- package/lib/components/AppShell/AppShell.d.ts +4 -0
- package/lib/components/AppShell/AppShell.d.ts.map +1 -0
- package/lib/components/AppShell/AppShell.js +84 -0
- package/lib/components/AppShell/AppShell.js.map +1 -0
- package/lib/components/AppShell/AppShell.styles.d.ts +20 -0
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -0
- package/lib/components/AppShell/AppShell.styles.js +331 -0
- package/lib/components/AppShell/AppShell.styles.js.map +1 -0
- package/lib/components/AppShell/AppShell.types.d.ts +43 -0
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -0
- package/lib/components/AppShell/AppShell.types.js +2 -0
- package/lib/components/AppShell/AppShell.types.js.map +1 -0
- package/lib/components/AppShell/AppShellContext.d.ts +4 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -0
- package/lib/components/AppShell/AppShellContext.js +10 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -0
- package/lib/components/AppShell/index.d.ts +3 -0
- package/lib/components/AppShell/index.d.ts.map +1 -0
- package/lib/components/AppShell/index.js +2 -0
- package/lib/components/AppShell/index.js.map +1 -0
- package/lib/components/FlowModeller/AddNode.d.ts +16 -0
- package/lib/components/FlowModeller/AddNode.d.ts.map +1 -0
- package/lib/components/FlowModeller/AddNode.js +62 -0
- package/lib/components/FlowModeller/AddNode.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts +21 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.js +190 -0
- package/lib/components/FlowModeller/FlowModeller.js.map +1 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts +54 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node/Node.types.js +28 -0
- package/lib/components/FlowModeller/Node/Node.types.js.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +15 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +128 -0
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +6 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.js +64 -0
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -0
- package/lib/components/FlowModeller/NodeLibrary.d.ts +13 -0
- package/lib/components/FlowModeller/NodeLibrary.d.ts.map +1 -0
- package/lib/components/FlowModeller/NodeLibrary.js +51 -0
- package/lib/components/FlowModeller/NodeLibrary.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts +13 -0
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Connectors.js +47 -0
- package/lib/components/FlowModeller/Renderer/Connectors.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts +9 -0
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Nodes.js +25 -0
- package/lib/components/FlowModeller/Renderer/Nodes.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts +5 -0
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.js +17 -0
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +18 -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 +54 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +302 -0
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +35 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +107 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +24 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +152 -0
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -0
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts +16 -0
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/AddNodeUtils.js +118 -0
- package/lib/components/FlowModeller/Utils/AddNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/helper.d.ts +23 -0
- package/lib/components/FlowModeller/helper.d.ts.map +1 -0
- package/lib/components/FlowModeller/helper.js +128 -0
- package/lib/components/FlowModeller/helper.js.map +1 -0
- package/lib/components/FlowModeller/index.d.ts +10 -0
- package/lib/components/FlowModeller/index.d.ts.map +1 -0
- package/lib/components/FlowModeller/index.js +8 -0
- package/lib/components/FlowModeller/index.js.map +1 -0
- package/lib/components/LifeCycle/Category.d.ts +32 -0
- package/lib/components/LifeCycle/Category.d.ts.map +1 -0
- package/lib/components/LifeCycle/Category.js +98 -0
- package/lib/components/LifeCycle/Category.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.d.ts +22 -0
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.js +73 -0
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +56 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.types.js +2 -0
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts +22 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycleList.js +65 -0
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -0
- package/lib/components/LifeCycle/Stage.d.ts +49 -0
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -0
- package/lib/components/LifeCycle/Stage.js +293 -0
- package/lib/components/LifeCycle/Stage.js.map +1 -0
- package/lib/components/LifeCycle/Step.d.ts +51 -0
- package/lib/components/LifeCycle/Step.d.ts.map +1 -0
- package/lib/components/LifeCycle/Step.js +241 -0
- package/lib/components/LifeCycle/Step.js.map +1 -0
- package/lib/components/LifeCycle/Task.d.ts +53 -0
- package/lib/components/LifeCycle/Task.d.ts.map +1 -0
- package/lib/components/LifeCycle/Task.js +188 -0
- package/lib/components/LifeCycle/Task.js.map +1 -0
- package/lib/components/LifeCycle/index.d.ts +4 -0
- package/lib/components/LifeCycle/index.d.ts.map +1 -0
- package/lib/components/LifeCycle/index.js +2 -0
- package/lib/components/LifeCycle/index.js.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.d.ts +23 -0
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.js +23 -0
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.styles.d.ts +9 -0
- package/lib/components/PageTemplates/GalleryPage.styles.d.ts.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.styles.js +70 -0
- package/lib/components/PageTemplates/GalleryPage.styles.js.map +1 -0
- package/lib/components/PageTemplates/PageTemplates.d.ts +27 -0
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -0
- package/lib/components/PageTemplates/PageTemplates.js +105 -0
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -0
- package/lib/components/PageTemplates/index.d.ts +5 -0
- package/lib/components/PageTemplates/index.d.ts.map +1 -0
- package/lib/components/PageTemplates/index.js +4 -0
- package/lib/components/PageTemplates/index.js.map +1 -0
- package/lib/components/SummaryCard/SummaryCard.d.ts +16 -0
- package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -0
- package/lib/components/SummaryCard/SummaryCard.js +31 -0
- package/lib/components/SummaryCard/SummaryCard.js.map +1 -0
- package/lib/components/SummaryCard/index.d.ts +3 -0
- package/lib/components/SummaryCard/index.d.ts.map +1 -0
- package/lib/components/SummaryCard/index.js +3 -0
- package/lib/components/SummaryCard/index.js.map +1 -0
- package/lib/components/Visual/Visual.d.ts +17 -0
- package/lib/components/Visual/Visual.d.ts.map +1 -0
- package/lib/components/Visual/Visual.js +28 -0
- package/lib/components/Visual/Visual.js.map +1 -0
- package/lib/components/Visual/index.d.ts +3 -0
- package/lib/components/Visual/index.d.ts.map +1 -0
- package/lib/components/Visual/index.js +3 -0
- package/lib/components/Visual/index.js.map +1 -0
- package/lib/components/Workbench/ConfigurationPanel.d.ts +5 -0
- package/lib/components/Workbench/ConfigurationPanel.d.ts.map +1 -0
- package/lib/components/Workbench/ConfigurationPanel.js +21 -0
- package/lib/components/Workbench/ConfigurationPanel.js.map +1 -0
- package/lib/components/Workbench/Toolbar.d.ts +14 -0
- package/lib/components/Workbench/Toolbar.d.ts.map +1 -0
- package/lib/components/Workbench/Toolbar.js +14 -0
- package/lib/components/Workbench/Toolbar.js.map +1 -0
- package/lib/components/Workbench/UtilityPanel.d.ts +7 -0
- package/lib/components/Workbench/UtilityPanel.d.ts.map +1 -0
- package/lib/components/Workbench/UtilityPanel.js +12 -0
- package/lib/components/Workbench/UtilityPanel.js.map +1 -0
- package/lib/components/Workbench/Workbench.d.ts +6 -0
- package/lib/components/Workbench/Workbench.d.ts.map +1 -0
- package/lib/components/Workbench/Workbench.js +24 -0
- package/lib/components/Workbench/Workbench.js.map +1 -0
- package/lib/components/Workbench/Workbench.styles.d.ts +10 -0
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -0
- package/lib/components/Workbench/Workbench.styles.js +71 -0
- package/lib/components/Workbench/Workbench.styles.js.map +1 -0
- package/lib/components/Workbench/Workbench.types.d.ts +49 -0
- package/lib/components/Workbench/Workbench.types.d.ts.map +1 -0
- package/lib/components/Workbench/Workbench.types.js +2 -0
- package/lib/components/Workbench/Workbench.types.js.map +1 -0
- package/lib/components/Workbench/index.d.ts +2 -0
- package/lib/components/Workbench/index.d.ts.map +1 -0
- package/lib/components/Workbench/index.js +2 -0
- package/lib/components/Workbench/index.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createUID } from '@pega/cosmos-react-core';
|
|
2
|
+
import { DirectedGraph } from './Renderer/Utils/Graph';
|
|
3
|
+
import { STOP_NODETYPE } from './Node/Node.types';
|
|
4
|
+
import GraphTraversal from './Renderer/Utils/GraphTraversal';
|
|
5
|
+
const helpers = {
|
|
6
|
+
addBranch(graphData, nodeId, label, getNewConnector) {
|
|
7
|
+
const graph = new DirectedGraph(graphData);
|
|
8
|
+
const convergeData = GraphTraversal.getConvergenceData(graphData, nodeId);
|
|
9
|
+
if (convergeData) {
|
|
10
|
+
const newConnector = getNewConnector
|
|
11
|
+
? getNewConnector(nodeId, convergeData.nodeId)
|
|
12
|
+
: {
|
|
13
|
+
id: createUID(),
|
|
14
|
+
fromNodeId: nodeId,
|
|
15
|
+
toNodeId: convergeData.nodeId,
|
|
16
|
+
label: label || ''
|
|
17
|
+
};
|
|
18
|
+
graph.addConnector(newConnector);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
throw new Error('Invalid node, either the node does not exist or it does not support branches');
|
|
22
|
+
}
|
|
23
|
+
return graph.getGraphData();
|
|
24
|
+
},
|
|
25
|
+
deleteNode(graphData, nodeId) {
|
|
26
|
+
const graph = new DirectedGraph(graphData);
|
|
27
|
+
const outConnectors = graph.getOutConnectors(nodeId);
|
|
28
|
+
if (outConnectors.length > 1) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const inConnectors = graph.getInConnectors(nodeId);
|
|
32
|
+
inConnectors.forEach(con => {
|
|
33
|
+
graph.setConnector(con.id, {
|
|
34
|
+
toNodeId: outConnectors[0].toNodeId
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
graph.removeConnector(outConnectors[0].id);
|
|
38
|
+
graph.deleteNode(nodeId, true);
|
|
39
|
+
return graph.getGraphData();
|
|
40
|
+
},
|
|
41
|
+
deleteConnector: (graphData, connector) => {
|
|
42
|
+
const graph = new DirectedGraph(graphData);
|
|
43
|
+
const nodeId = connector.fromNodeId;
|
|
44
|
+
const outConnectors = graph.getOutConnectors(nodeId);
|
|
45
|
+
const toNode = graph.getNode(connector.toNodeId);
|
|
46
|
+
const inConnectors = graph.getInConnectors(connector.toNodeId);
|
|
47
|
+
let isRemoved = false;
|
|
48
|
+
if (inConnectors.length >= 2) {
|
|
49
|
+
graph.removeConnector(connector.id);
|
|
50
|
+
isRemoved = true;
|
|
51
|
+
}
|
|
52
|
+
if (toNode.type.id === STOP_NODETYPE.id && outConnectors.length > 1 && !isRemoved) {
|
|
53
|
+
graph.removeConnector(connector.id);
|
|
54
|
+
isRemoved = true;
|
|
55
|
+
}
|
|
56
|
+
if (outConnectors.length > 1 && !isRemoved) {
|
|
57
|
+
outConnectors.forEach(item => {
|
|
58
|
+
if (connector.toNodeId === item.toNodeId && item.id !== connector.id) {
|
|
59
|
+
// Connector without any node
|
|
60
|
+
graph.removeConnector(connector.id);
|
|
61
|
+
isRemoved = true;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (isRemoved) {
|
|
66
|
+
return graph.getGraphData();
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
},
|
|
70
|
+
addNode: ({ graphData, nodeType, metaData, getNewNode, getNewConnector, connectorsCount }) => {
|
|
71
|
+
const graph = new DirectedGraph(graphData);
|
|
72
|
+
const newNode = getNewNode
|
|
73
|
+
? getNewNode()
|
|
74
|
+
: {
|
|
75
|
+
...nodeType.defaults.node,
|
|
76
|
+
id: createUID(),
|
|
77
|
+
type: nodeType
|
|
78
|
+
};
|
|
79
|
+
// add new node
|
|
80
|
+
graph.addNode(newNode);
|
|
81
|
+
let toNodeId = '';
|
|
82
|
+
if (metaData.refType === 'connector') {
|
|
83
|
+
if (!Array.isArray(metaData.refId)) {
|
|
84
|
+
metaData.refId = [metaData.refId];
|
|
85
|
+
}
|
|
86
|
+
metaData.refId.forEach(conId => {
|
|
87
|
+
const refConnector = graph.getConnector(conId);
|
|
88
|
+
// backup current connectors toNodeId
|
|
89
|
+
toNodeId = refConnector.toNodeId;
|
|
90
|
+
// update the actual connector
|
|
91
|
+
graph.setConnector(conId, {
|
|
92
|
+
toNodeId: newNode.id
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else if (metaData.refType === 'node') {
|
|
97
|
+
toNodeId = metaData.refId;
|
|
98
|
+
// iterate and update all in-connectors to point to the new node
|
|
99
|
+
graph.getInConnectors(metaData.refId).forEach(con => {
|
|
100
|
+
graph.setConnector(con.id, {
|
|
101
|
+
toNodeId: newNode.id
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
let minConnectors = 1;
|
|
106
|
+
if (connectorsCount !== undefined) {
|
|
107
|
+
minConnectors = connectorsCount;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
minConnectors = nodeType.minConnectors !== undefined ? nodeType.minConnectors : 1;
|
|
111
|
+
}
|
|
112
|
+
for (let i = 0; i < minConnectors; i += 1) {
|
|
113
|
+
const newConnector = getNewConnector
|
|
114
|
+
? getNewConnector(newNode.id, toNodeId)
|
|
115
|
+
: {
|
|
116
|
+
id: createUID(),
|
|
117
|
+
fromNodeId: newNode.id,
|
|
118
|
+
toNodeId,
|
|
119
|
+
label: nodeType.defaults?.connector[i].label
|
|
120
|
+
};
|
|
121
|
+
graph.addConnector(newConnector);
|
|
122
|
+
}
|
|
123
|
+
// return the updated graphData
|
|
124
|
+
return graph.getGraphData();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
export default helpers;
|
|
128
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAA6B,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAuB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAgB7D,MAAM,OAAO,GAAG;IACd,SAAS,CACP,SAAuB,EACvB,MAAc,EACd,KAAc,EACd,eAAoD;QAEpD,MAAM,KAAK,GAAG,IAAI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KAAe,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBAC5D,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,EAAE;oBACzB,QAAQ,EAAE,OAAO,CAAC,EAAE;iBACrB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,eAAe,KAAK,SAAS,EAAE;YACjC,aAAa,GAAG,eAAe,CAAC;SACjC;aAAM;YACL,aAAa,GAAG,QAAQ,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;SACnF;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE;YACzC,MAAM,YAAY,GAAG,eAAe;gBAClC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC;gBACvC,CAAC,CAAC;oBACE,EAAE,EAAE,SAAS,EAAE;oBACf,UAAU,EAAE,OAAO,CAAC,EAAE;oBACtB,QAAQ;oBACR,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK;iBAC7C,CAAC;YACN,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;SAClC;QACD,+BAA+B;QAC/B,OAAO,KAAK,CAAC,YAAY,EAAE,CAAC;IAC9B,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { createUID } from '@pega/cosmos-react-core';\n\nimport { DirectedGraph, GraphData, ConnectorProps } from './Renderer/Utils/Graph';\nimport { AddNodeHandlerParams } from './Renderer/Renderer.types';\nimport { NodeProps, NodeType, STOP_NODETYPE } from './Node/Node.types';\nimport GraphTraversal from './Renderer/Utils/GraphTraversal';\n\ninterface NodeDataType {\n nodes: NodeProps[];\n connectors: ConnectorProps[];\n}\n\nexport interface AddHelperParams {\n nodeType: NodeType;\n graphData: GraphData<NodeProps, ConnectorProps>;\n metaData: AddNodeHandlerParams;\n connectorsCount?: number;\n getNewNode?: () => NodeProps;\n getNewConnector?: (fromNodeId: string, toNodeId: string) => ConnectorProps;\n}\n\nconst helpers = {\n addBranch(\n graphData: NodeDataType,\n nodeId: string,\n label?: string,\n getNewConnector?: AddHelperParams['getNewConnector']\n ) {\n const graph = new DirectedGraph<NodeProps, ConnectorProps>(graphData);\n const convergeData = GraphTraversal.getConvergenceData(graphData, nodeId);\n\n if (convergeData) {\n const newConnector = getNewConnector\n ? getNewConnector(nodeId, convergeData.nodeId)\n : {\n id: createUID(),\n fromNodeId: nodeId,\n toNodeId: convergeData.nodeId,\n label: label || ''\n };\n\n graph.addConnector(newConnector);\n } else {\n throw new Error(\n 'Invalid node, either the node does not exist or it does not support branches'\n );\n }\n\n return graph.getGraphData();\n },\n deleteNode(graphData: NodeDataType, nodeId: string) {\n const graph = new DirectedGraph<NodeProps, ConnectorProps>(graphData);\n const outConnectors = graph.getOutConnectors(nodeId);\n\n if (outConnectors.length > 1) {\n return null;\n }\n\n const inConnectors = graph.getInConnectors(nodeId);\n\n inConnectors.forEach(con => {\n graph.setConnector(con.id, {\n toNodeId: outConnectors[0].toNodeId\n });\n });\n\n graph.removeConnector(outConnectors[0].id);\n\n graph.deleteNode(nodeId, true);\n\n return graph.getGraphData();\n },\n deleteConnector: (graphData: NodeDataType, connector: ConnectorProps) => {\n const graph = new DirectedGraph<NodeProps, ConnectorProps>(graphData);\n const nodeId = connector.fromNodeId;\n const outConnectors = graph.getOutConnectors(nodeId);\n const toNode = graph.getNode(connector.toNodeId);\n const inConnectors = graph.getInConnectors(connector.toNodeId);\n let isRemoved = false;\n if (inConnectors.length >= 2) {\n graph.removeConnector(connector.id);\n isRemoved = true;\n }\n if (toNode.type.id === STOP_NODETYPE.id && outConnectors.length > 1 && !isRemoved) {\n graph.removeConnector(connector.id);\n isRemoved = true;\n }\n\n if (outConnectors.length > 1 && !isRemoved) {\n outConnectors.forEach(item => {\n if (connector.toNodeId === item.toNodeId && item.id !== connector.id) {\n // Connector without any node\n graph.removeConnector(connector.id);\n isRemoved = true;\n }\n });\n }\n if (isRemoved) {\n return graph.getGraphData();\n }\n return null;\n },\n addNode: ({\n graphData,\n nodeType,\n metaData,\n getNewNode,\n getNewConnector,\n connectorsCount\n }: AddHelperParams) => {\n const graph = new DirectedGraph(graphData);\n\n const newNode = getNewNode\n ? getNewNode()\n : {\n ...nodeType.defaults.node,\n id: createUID(),\n type: nodeType\n };\n\n // add new node\n graph.addNode(newNode);\n\n let toNodeId = '';\n if (metaData.refType === 'connector') {\n if (!Array.isArray(metaData.refId)) {\n metaData.refId = [metaData.refId];\n }\n\n metaData.refId.forEach(conId => {\n const refConnector = graph.getConnector(conId);\n\n // backup current connectors toNodeId\n toNodeId = refConnector.toNodeId;\n\n // update the actual connector\n graph.setConnector(conId, {\n toNodeId: newNode.id\n });\n });\n } else if (metaData.refType === 'node') {\n toNodeId = metaData.refId as string;\n\n // iterate and update all in-connectors to point to the new node\n graph.getInConnectors(metaData.refId as string).forEach(con => {\n graph.setConnector(con.id, {\n toNodeId: newNode.id\n });\n });\n }\n\n let minConnectors = 1;\n if (connectorsCount !== undefined) {\n minConnectors = connectorsCount;\n } else {\n minConnectors = nodeType.minConnectors !== undefined ? nodeType.minConnectors : 1;\n }\n\n for (let i = 0; i < minConnectors; i += 1) {\n const newConnector = getNewConnector\n ? getNewConnector(newNode.id, toNodeId)\n : {\n id: createUID(),\n fromNodeId: newNode.id,\n toNodeId,\n label: nodeType.defaults?.connector[i].label\n };\n graph.addConnector(newConnector);\n }\n // return the updated graphData\n return graph.getGraphData();\n }\n};\n\nexport default helpers;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default, FlowModellerProps } from './FlowModeller';
|
|
2
|
+
export { ActionParams, NodeProps, NodeType, NodeLibraryItem, START_NODETYPE, STOP_NODETYPE } from './Node/Node.types';
|
|
3
|
+
export { default as FlowRenderer } from './Renderer/Renderer';
|
|
4
|
+
export { RendererProps, RendererConnectorProps, RendererNodeProps, AddNodeHandlerParams } from './Renderer/Renderer.types';
|
|
5
|
+
export { DirectedGraph, GraphData, ConnectorProps } from './Renderer/Utils/Graph';
|
|
6
|
+
export { default as GraphTraversal } from './Renderer/Utils/GraphTraversal';
|
|
7
|
+
export { PlottedGraphConnector, PlottedGraphNode } from './Renderer/Utils/GraphLayout';
|
|
8
|
+
export { default as PlaceHolderHelper, isPlaceHolderConnector, isPlaceHolderNode, PlaceHolderConnector, PlaceHolderNode } from './Utils/AddNodeUtils';
|
|
9
|
+
export { default as FlowModellerHelper } from './helper';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FlowModeller/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,eAAe,EACf,cAAc,EACd,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default } from './FlowModeller';
|
|
2
|
+
export { START_NODETYPE, STOP_NODETYPE } from './Node/Node.types';
|
|
3
|
+
export { default as FlowRenderer } from './Renderer/Renderer';
|
|
4
|
+
export { DirectedGraph } from './Renderer/Utils/Graph';
|
|
5
|
+
export { default as GraphTraversal } from './Renderer/Utils/GraphTraversal';
|
|
6
|
+
export { default as PlaceHolderHelper, isPlaceHolderConnector, isPlaceHolderNode } from './Utils/AddNodeUtils';
|
|
7
|
+
export { default as FlowModellerHelper } from './helper';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FlowModeller/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAqB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAKL,cAAc,EACd,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAO9D,OAAO,EAAE,aAAa,EAA6B,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,sBAAsB,EACtB,iBAAiB,EAGlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { default, FlowModellerProps } from './FlowModeller';\nexport {\n ActionParams,\n NodeProps,\n NodeType,\n NodeLibraryItem,\n START_NODETYPE,\n STOP_NODETYPE\n} from './Node/Node.types';\nexport { default as FlowRenderer } from './Renderer/Renderer';\nexport {\n RendererProps,\n RendererConnectorProps,\n RendererNodeProps,\n AddNodeHandlerParams\n} from './Renderer/Renderer.types';\nexport { DirectedGraph, GraphData, ConnectorProps } from './Renderer/Utils/Graph';\nexport { default as GraphTraversal } from './Renderer/Utils/GraphTraversal';\nexport { PlottedGraphConnector, PlottedGraphNode } from './Renderer/Utils/GraphLayout';\nexport {\n default as PlaceHolderHelper,\n isPlaceHolderConnector,\n isPlaceHolderNode,\n PlaceHolderConnector,\n PlaceHolderNode\n} from './Utils/AddNodeUtils';\nexport { default as FlowModellerHelper } from './helper';\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FunctionComponent, Ref } from 'react';
|
|
2
|
+
import { ForwardProps, BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
|
+
import { StageItemProps, CategoryItemProps, CategoriesItemProps } from './LifeCycle.types';
|
|
4
|
+
import { TaskProps } from './Task';
|
|
5
|
+
export interface CategoriesProps extends CategoriesItemProps {
|
|
6
|
+
height?: number;
|
|
7
|
+
elementId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CategoryProps extends BaseProps, NoChildrenProp {
|
|
10
|
+
ref?: Ref<HTMLOListElement>;
|
|
11
|
+
item: CategoryItemProps;
|
|
12
|
+
showTitle?: boolean;
|
|
13
|
+
category?: CategoriesProps;
|
|
14
|
+
/** Task component prop */
|
|
15
|
+
task: TaskProps;
|
|
16
|
+
/** Stage data - to be passed in callbacks */
|
|
17
|
+
stageItem: StageItemProps;
|
|
18
|
+
/** Id for the component */
|
|
19
|
+
id?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const StyledCategory: import("styled-components").StyledComponent<"h3", import("styled-components").DefaultTheme, {
|
|
22
|
+
showTitle: boolean;
|
|
23
|
+
}, never>;
|
|
24
|
+
export declare const StyledList: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {
|
|
25
|
+
category?: CategoriesProps | undefined;
|
|
26
|
+
id: string;
|
|
27
|
+
}, never>;
|
|
28
|
+
export declare const StyledParallelTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
29
|
+
export declare const StyledAddTask: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
30
|
+
declare const Category: FunctionComponent<CategoryProps & ForwardProps>;
|
|
31
|
+
export default Category;
|
|
32
|
+
//# sourceMappingURL=Category.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/Category.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,GAAG,EAAyC,MAAM,OAAO,CAAC;AAGlG,OAAO,EACL,YAAY,EACZ,SAAS,EAST,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAE1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,cAAc;IAC9D,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAE5B,IAAI,EAAE,iBAAiB,CAAC;IAExB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,0BAA0B;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,6CAA6C;IAC7C,SAAS,EAAE,cAAc,CAAC;IAC1B,2BAA2B;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,cAAc;eAA0B,OAAO;SAQ1D,CAAC;AAEH,eAAO,MAAM,UAAU;eAA0B,eAAe,GAAG,SAAS;QAAM,MAAM;SAUvF,CAAC;AAEF,eAAO,MAAM,mBAAmB,yGA0B9B,CAAC;AAEH,eAAO,MAAM,aAAa,yGAaxB,CAAC;AAIH,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA+G7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, Fragment } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { Flex, Button, Icon, Tooltip, useElement, useI18n, createUID, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
|
+
import Task from './Task';
|
|
6
|
+
export const StyledCategory = styled.h3(({ showTitle, theme }) => {
|
|
7
|
+
return css `
|
|
8
|
+
${!showTitle &&
|
|
9
|
+
css `
|
|
10
|
+
visibility: hidden;
|
|
11
|
+
`}
|
|
12
|
+
margin: ${theme.base.spacing} 0 0 0;
|
|
13
|
+
`;
|
|
14
|
+
});
|
|
15
|
+
export const StyledList = styled.ol(({ category, theme, id }) => {
|
|
16
|
+
return css `
|
|
17
|
+
margin-block-start: ${theme.base.spacing};
|
|
18
|
+
margin-block-end: calc(2 * ${theme.base.spacing});
|
|
19
|
+
${category?.elementId !== id &&
|
|
20
|
+
` min-height: ${category?.height ? `${category.height}px` : 'auto'};
|
|
21
|
+
`}
|
|
22
|
+
`;
|
|
23
|
+
});
|
|
24
|
+
export const StyledParallelTitle = styled.div(({ theme }) => {
|
|
25
|
+
return css `
|
|
26
|
+
position: relative;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
margin-block-end: 0.5rem;
|
|
29
|
+
text-align: center;
|
|
30
|
+
&::before {
|
|
31
|
+
border-block-start: calc(0.2 * ${theme.base.spacing}) solid ${theme.base.colors.slate.medium};
|
|
32
|
+
content: '';
|
|
33
|
+
margin: 0 auto;
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 50%;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
bottom: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
z-index: -1;
|
|
41
|
+
}
|
|
42
|
+
span {
|
|
43
|
+
background: ${theme.base.colors.slate.medium};
|
|
44
|
+
padding: 0 ${theme.base.spacing};
|
|
45
|
+
border-radius: calc(0.25 * ${theme.base['border-radius']});
|
|
46
|
+
color: ${theme.base.colors.white};
|
|
47
|
+
text-transform: uppercase;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
});
|
|
51
|
+
export const StyledAddTask = styled.div(({ theme }) => {
|
|
52
|
+
return css `
|
|
53
|
+
> button {
|
|
54
|
+
background: ${theme.base.palette['secondary-background']};
|
|
55
|
+
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
56
|
+
width: 100%;
|
|
57
|
+
justify-content: flex-start;
|
|
58
|
+
padding: calc(1 * ${theme.base.spacing}) calc(1.75 * ${theme.base.spacing});
|
|
59
|
+
> div {
|
|
60
|
+
margin: 0 calc(2 * ${theme.base.spacing});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
});
|
|
65
|
+
StyledAddTask.defaultProps = defaultThemeProp;
|
|
66
|
+
const Category = forwardRef(({ item, showTitle = false, stageItem, category, id, task, ...restProps }, ref) => {
|
|
67
|
+
const [addTaskEl, setAddTaskEl] = useElement();
|
|
68
|
+
let showAddTaskButton = true;
|
|
69
|
+
const t = useI18n();
|
|
70
|
+
if (task?.addTask?.showOnce && item?.tasks?.length !== 0) {
|
|
71
|
+
showAddTaskButton = false;
|
|
72
|
+
}
|
|
73
|
+
/* Call back for click of add task button */
|
|
74
|
+
const onAddTaskClick = (e) => {
|
|
75
|
+
const param = {
|
|
76
|
+
category: item,
|
|
77
|
+
stage: stageItem
|
|
78
|
+
};
|
|
79
|
+
task?.addTask.onAddTask?.(param, e);
|
|
80
|
+
};
|
|
81
|
+
return (_jsxs(_Fragment, { children: [category?.label && (_jsx(StyledCategory, { showTitle: showTitle, tabIndex: -1, id: item?.categoryId, children: category?.label }, void 0)), _jsxs(StyledList, { ref: ref, role: 'gridcell', category: category, id: item?.id, "data-id": item?.categoryId, children: [item &&
|
|
82
|
+
item.tasks.length !== 0 &&
|
|
83
|
+
item.tasks.map((TaskItem, index) => {
|
|
84
|
+
if (Array.isArray(TaskItem)) {
|
|
85
|
+
if (task && task.addTask && task.addTask.showOnce && TaskItem.length !== 0) {
|
|
86
|
+
showAddTaskButton = false;
|
|
87
|
+
}
|
|
88
|
+
/* Using creatUID instead of useUID, since it is a list item and multiple ref is trying to get created which causes issue */
|
|
89
|
+
const parallelListItemId = createUID();
|
|
90
|
+
return (_jsxs(Fragment, { children: [index !== 0 && (_jsx(Flex, { as: StyledParallelTitle, container: { justify: 'center' }, children: _jsx("span", { children: t('parallel') }, void 0) }, void 0)), TaskItem.map((parallelTask) => {
|
|
91
|
+
return (_jsx(Task, { id: parallelTask.id, value: parallelTask.label, item: parallelTask, visual: parallelTask.visual, stageItem: stageItem, categoryItem: item, error: parallelTask.error, ...task, ...restProps }, parallelTask.id));
|
|
92
|
+
})] }, parallelListItemId));
|
|
93
|
+
}
|
|
94
|
+
return (_jsx(Task, { id: TaskItem.id, value: TaskItem.label, item: TaskItem, visual: TaskItem.visual, stageItem: stageItem, categoryItem: item, onAddStep: task?.onAddStep, error: TaskItem.error, ...task, ...restProps }, TaskItem.id));
|
|
95
|
+
}), (showAddTaskButton || !item) && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: StyledAddTask, children: _jsxs(Button, { variant: 'simple', icon: true, ref: setAddTaskEl, onClick: onAddTaskClick, children: [_jsx(Icon, { name: 'plus' }, void 0), _jsx(Flex, { children: task?.addTask.title }, void 0)] }, void 0) }, void 0), _jsx(Tooltip, { target: addTaskEl, "aria-hidden": 'true', children: `${t('add')} ${task?.addTask.title}` }, void 0)] }, void 0))] }, void 0)] }, void 0));
|
|
96
|
+
});
|
|
97
|
+
export default Category;
|
|
98
|
+
//# sourceMappingURL=Category.js.map
|
|
@@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Z,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, Ref, Fragment, PropsWithoutRef, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n ForwardProps,\n BaseProps,\n Flex,\n Button,\n Icon,\n Tooltip,\n useElement,\n useI18n,\n createUID,\n defaultThemeProp,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport {\n TaskItemProps,\n StageItemProps,\n CategoryItemProps,\n CategoriesItemProps,\n LifeCycleActionParam\n} from './LifeCycle.types';\nimport Task, { TaskProps } from './Task';\n\nexport interface CategoriesProps extends CategoriesItemProps {\n /* height property used to manipulate height of catergory dom */\n height?: number;\n elementId?: string;\n}\n\nexport interface CategoryProps extends BaseProps, NoChildrenProp {\n ref?: Ref<HTMLOListElement>;\n /* Pass the category items */\n item: CategoryItemProps;\n /* Enable the title for categories */\n showTitle?: boolean;\n /* Props of the categoryColumn */\n category?: CategoriesProps;\n /** Task component prop */\n task: TaskProps;\n /** Stage data - to be passed in callbacks */\n stageItem: StageItemProps;\n /** Id for the component */\n id?: string;\n}\n\nexport const StyledCategory = styled.h3<{ showTitle: boolean }>(({ showTitle, theme }) => {\n return css`\n ${!showTitle &&\n css`\n visibility: hidden;\n `}\n margin: ${theme.base.spacing} 0 0 0;\n `;\n});\n\nexport const StyledList = styled.ol<{ category?: CategoriesProps | undefined; id: string }>(\n ({ category, theme, id }) => {\n return css`\n margin-block-start: ${theme.base.spacing};\n margin-block-end: calc(2 * ${theme.base.spacing});\n ${category?.elementId !== id &&\n ` min-height: ${category?.height ? `${category.height}px` : 'auto'};\n `}\n `;\n }\n);\n\nexport const StyledParallelTitle = styled.div(({ theme }) => {\n return css`\n position: relative;\n z-index: 1;\n margin-block-end: 0.5rem;\n text-align: center;\n &::before {\n border-block-start: calc(0.2 * ${theme.base.spacing}) solid ${theme.base.colors.slate.medium};\n content: '';\n margin: 0 auto;\n position: absolute;\n top: 50%;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: -1;\n }\n span {\n background: ${theme.base.colors.slate.medium};\n padding: 0 ${theme.base.spacing};\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n color: ${theme.base.colors.white};\n text-transform: uppercase;\n }\n `;\n});\n\nexport const StyledAddTask = styled.div(({ theme }) => {\n return css`\n > button {\n background: ${theme.base.palette['secondary-background']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n width: 100%;\n justify-content: flex-start;\n padding: calc(1 * ${theme.base.spacing}) calc(1.75 * ${theme.base.spacing});\n > div {\n margin: 0 calc(2 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledAddTask.defaultProps = defaultThemeProp;\n\nconst Category: FunctionComponent<CategoryProps & ForwardProps> = forwardRef(\n (\n {\n item,\n showTitle = false,\n stageItem,\n category,\n id,\n task,\n ...restProps\n }: PropsWithoutRef<CategoryProps>,\n ref: CategoryProps['ref']\n ) => {\n const [addTaskEl, setAddTaskEl] = useElement();\n let showAddTaskButton = true;\n const t = useI18n();\n\n if (task?.addTask?.showOnce && item?.tasks?.length !== 0) {\n showAddTaskButton = false;\n }\n /* Call back for click of add task button */\n const onAddTaskClick = (e: MouseEvent<HTMLButtonElement>) => {\n const param: LifeCycleActionParam = {\n category: item,\n stage: stageItem\n };\n task?.addTask.onAddTask?.(param, e);\n };\n\n return (\n <>\n {category?.label && (\n <StyledCategory showTitle={showTitle} tabIndex={-1} id={item?.categoryId}>\n {category?.label}\n </StyledCategory>\n )}\n <StyledList\n ref={ref}\n role='gridcell'\n category={category}\n id={item?.id}\n data-id={item?.categoryId}\n >\n {item &&\n item.tasks.length !== 0 &&\n item.tasks.map((TaskItem: TaskItemProps | TaskItemProps[], index: number) => {\n if (Array.isArray(TaskItem)) {\n if (task && task.addTask && task.addTask.showOnce && TaskItem.length !== 0) {\n showAddTaskButton = false;\n }\n /* Using creatUID instead of useUID, since it is a list item and multiple ref is trying to get created which causes issue */\n const parallelListItemId = createUID();\n return (\n <Fragment key={parallelListItemId}>\n {index !== 0 && (\n <Flex as={StyledParallelTitle} container={{ justify: 'center' }}>\n <span>{t('parallel')}</span>\n </Flex>\n )}\n {TaskItem.map((parallelTask: TaskItemProps) => {\n return (\n <Task\n key={parallelTask.id}\n id={parallelTask.id}\n value={parallelTask.label}\n item={parallelTask}\n visual={parallelTask.visual}\n stageItem={stageItem}\n categoryItem={item}\n error={parallelTask.error}\n {...task}\n {...restProps}\n />\n );\n })}\n </Fragment>\n );\n }\n return (\n <Task\n key={TaskItem.id}\n id={TaskItem.id}\n value={TaskItem.label}\n item={TaskItem}\n visual={TaskItem.visual}\n stageItem={stageItem}\n categoryItem={item}\n onAddStep={task?.onAddStep}\n error={TaskItem.error}\n {...task}\n {...restProps}\n />\n );\n })}\n {(showAddTaskButton || !item) && (\n <>\n <Flex as={StyledAddTask}>\n <Button variant='simple' icon ref={setAddTaskEl} onClick={onAddTaskClick}>\n <Icon name='plus' />\n <Flex>{task?.addTask.title}</Flex>\n </Button>\n </Flex>\n <Tooltip target={addTaskEl} aria-hidden='true'>\n {`${t('add')} ${task?.addTask.title}`}\n </Tooltip>\n </>\n )}\n </StyledList>\n </>\n );\n }\n);\n\nexport default Category;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FunctionComponent, Ref } from 'react';
|
|
2
|
+
import { BaseProps, ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
|
+
import { StageItemProps } from './LifeCycle.types';
|
|
4
|
+
import { StageProps } from './Stage';
|
|
5
|
+
import { CategoriesProps } from './Category';
|
|
6
|
+
import { TaskProps } from './Task';
|
|
7
|
+
import { StepProps } from './Step';
|
|
8
|
+
export interface LifeCycleProps extends BaseProps, NoChildrenProp {
|
|
9
|
+
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
items: StageItemProps[];
|
|
11
|
+
alternateItems?: StageItemProps[];
|
|
12
|
+
task: TaskProps[];
|
|
13
|
+
stage: StageProps;
|
|
14
|
+
alternateStage: StageProps;
|
|
15
|
+
categories: CategoriesProps[];
|
|
16
|
+
step: StepProps[];
|
|
17
|
+
onAddStage: () => void;
|
|
18
|
+
onAddAlternateStage: () => void;
|
|
19
|
+
}
|
|
20
|
+
declare const LifeCycle: FunctionComponent<LifeCycleProps & ForwardProps>;
|
|
21
|
+
export default LifeCycle;
|
|
22
|
+
//# sourceMappingURL=LifeCycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifeCycle.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,SAAS,EACT,YAAY,EAKZ,cAAc,EACf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAE/D,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAE1B,KAAK,EAAE,cAAc,EAAE,CAAC;IAExB,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC;IAElC,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB,KAAK,EAAE,UAAU,CAAC;IAElB,cAAc,EAAE,UAAU,CAAC;IAE3B,UAAU,EAAE,eAAe,EAAE,CAAC;IAE9B,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB,UAAU,EAAE,MAAM,IAAI,CAAC;IAEvB,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAeD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CA4H/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { defaultThemeProp, Flex, Button, Icon, useI18n } from '@pega/cosmos-react-core';
|
|
5
|
+
import LifeCycleList from './LifeCycleList';
|
|
6
|
+
const StyledLifeCycle = styled.ol ``;
|
|
7
|
+
StyledLifeCycle.defaultProps = defaultThemeProp;
|
|
8
|
+
const StyledAddButton = styled(Button)(({ theme }) => {
|
|
9
|
+
return css `
|
|
10
|
+
align-self: flex-start;
|
|
11
|
+
margin-block-start: calc(${theme.base.spacing} / 2);
|
|
12
|
+
`;
|
|
13
|
+
});
|
|
14
|
+
StyledAddButton.defaultProps = defaultThemeProp;
|
|
15
|
+
const LifeCycle = forwardRef(({ items, categories, alternateItems = [], onAddStage, onAddAlternateStage, stage, alternateStage, ...restProps }, ref) => {
|
|
16
|
+
const lifeCycleEl = useRef(null);
|
|
17
|
+
const t = useI18n();
|
|
18
|
+
const [categoriesState, setcategoriesState] = useState(categories);
|
|
19
|
+
const categoryElements = [];
|
|
20
|
+
const setRef = (element) => {
|
|
21
|
+
if (element) {
|
|
22
|
+
categoryElements.push(element);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
useLayoutEffect(() => {
|
|
26
|
+
let isHeightChanged = false;
|
|
27
|
+
const categoriesColumn = [...categories];
|
|
28
|
+
if (categoriesColumn && categoriesColumn.length > 0) {
|
|
29
|
+
categoriesColumn.forEach((categoryItem, index) => {
|
|
30
|
+
const categoryElm = [...categoryElements];
|
|
31
|
+
let isActiveElement = false;
|
|
32
|
+
const categoryComponent = categoryElm.filter((element) => {
|
|
33
|
+
if (element.getAttribute('data-id') === categoryItem.id) {
|
|
34
|
+
if (categoryItem.elementId === element.getAttribute('id')) {
|
|
35
|
+
isActiveElement = true;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
});
|
|
41
|
+
if (!isActiveElement) {
|
|
42
|
+
categoryItem.elementId = '';
|
|
43
|
+
categoryItem.height = 0;
|
|
44
|
+
}
|
|
45
|
+
categoryComponent.forEach(categoryElement => {
|
|
46
|
+
const columnHeight = categoryItem?.height ?? 0;
|
|
47
|
+
const height = categoryElement.scrollHeight;
|
|
48
|
+
const elementId = categoryElement.getAttribute('id');
|
|
49
|
+
if (height > columnHeight ||
|
|
50
|
+
(categoryItem.elementId === elementId && height !== columnHeight)) {
|
|
51
|
+
isHeightChanged = true;
|
|
52
|
+
categoriesColumn[index].height = height;
|
|
53
|
+
if (elementId)
|
|
54
|
+
categoriesColumn[index].elementId = elementId;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
if (isHeightChanged) {
|
|
59
|
+
isHeightChanged = false;
|
|
60
|
+
setcategoriesState(categoriesColumn);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return (_jsxs(Flex, { container: { itemGap: 2 }, ref: ref, children: [_jsxs(Flex, { as: StyledLifeCycle, ref: lifeCycleEl, container: true, role: 'grid', "aria-label": t('stage'), children: [items.map((stageItem, index, stageArray) => {
|
|
65
|
+
const listId = stageItem.id;
|
|
66
|
+
return (_jsx(LifeCycleList, { id: listId, item: stageItem, isFirstItem: index === 0, isLastItem: index === stageArray.length - 1, ref: setRef, stage: stage, categories: categoriesState, ...restProps }, listId));
|
|
67
|
+
}), _jsx(StyledAddButton, { variant: 'simple', label: t('add_stage'), icon: true, onClick: onAddStage, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0), alternateItems.length !== 0 && (_jsxs(Flex, { as: StyledLifeCycle, container: true, ref: lifeCycleEl, role: 'grid', "aria-label": t('alternate_stage'), children: [alternateItems.map((stageItem) => {
|
|
68
|
+
const listId = stageItem.id;
|
|
69
|
+
return (_jsx(LifeCycleList, { id: listId, item: stageItem, ref: setRef, categories: categoriesState, stageVariant: 'alternate', stage: alternateStage, ...restProps }, listId));
|
|
70
|
+
}), _jsx(StyledAddButton, { variant: 'simple', label: t('add_alternate_stage'), icon: true, onClick: onAddAlternateStage, children: _jsx(Icon, { name: 'plus' }, void 0) }, void 0)] }, void 0))] }, void 0));
|
|
71
|
+
});
|
|
72
|
+
export default LifeCycle;
|
|
73
|
+
//# sourceMappingURL=LifeCycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifeCycle.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,eAAe,EACf,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAGhB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EAER,MAAM,yBAAyB,CAAC;AAEjC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AA8B5C,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAEpC,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnD,OAAO,GAAG,CAAA;;+BAEmB,KAAK,CAAC,IAAI,CAAC,OAAO;GAC9C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,SAAS,GAAqD,UAAU,CAC5E,CACE,EACE,KAAK,EACL,UAAU,EACV,cAAc,GAAG,EAAE,EACnB,UAAU,EACV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styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n BaseProps,\n ForwardProps,\n Flex,\n Button,\n Icon,\n useI18n,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport LifeCycleList from './LifeCycleList';\nimport { StageItemProps } from './LifeCycle.types';\nimport { StageProps } from './Stage';\nimport { CategoriesProps } from './Category';\nimport { TaskProps } from './Task';\nimport { StepProps } from './Step';\n\nexport interface LifeCycleProps extends BaseProps, NoChildrenProp {\n /* Pass reference to the LifeCycleComponent */\n ref?: Ref<HTMLDivElement>;\n /* Array of stages and its contents */\n items: StageItemProps[];\n /* Array of alternate stages and its contents */\n alternateItems?: StageItemProps[];\n /* Props for the task component */\n task: TaskProps[];\n /* Props for the Stage component */\n stage: StageProps;\n /* Props for the AlternatStage component */\n alternateStage: StageProps;\n /* Props for the Cluster component */\n categories: CategoriesProps[];\n /* Props for the Step component */\n step: StepProps[];\n /* Call back function for on AddState */\n onAddStage: () => void;\n /* Call back function to add alternate stages */\n onAddAlternateStage: () => void;\n}\n\nconst StyledLifeCycle = styled.ol``;\n\nStyledLifeCycle.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(({ theme }) => {\n return css`\n align-self: flex-start;\n margin-block-start: calc(${theme.base.spacing} / 2);\n `;\n});\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst LifeCycle: FunctionComponent<LifeCycleProps & ForwardProps> = forwardRef(\n (\n {\n items,\n categories,\n alternateItems = [],\n onAddStage,\n onAddAlternateStage,\n stage,\n alternateStage,\n ...restProps\n }: PropsWithoutRef<LifeCycleProps>,\n ref: LifeCycleProps['ref']\n ) => {\n const lifeCycleEl = useRef(null);\n const t = useI18n();\n const [categoriesState, setcategoriesState] = useState(categories);\n const categoryElements: HTMLElement[] = [];\n const setRef = (element: HTMLOListElement) => {\n if (element) {\n categoryElements.push(element);\n }\n };\n\n useLayoutEffect(() => {\n let isHeightChanged = false;\n const categoriesColumn = [...categories];\n if (categoriesColumn && categoriesColumn.length > 0) {\n categoriesColumn.forEach((categoryItem, index) => {\n const categoryElm = [...categoryElements];\n let isActiveElement = false;\n const categoryComponent = categoryElm.filter((element: HTMLElement) => {\n if (element.getAttribute('data-id') === categoryItem.id) {\n if (categoryItem.elementId === element.getAttribute('id')) {\n isActiveElement = true;\n }\n return true;\n }\n return false;\n });\n if (!isActiveElement) {\n categoryItem.elementId = '';\n categoryItem.height = 0;\n }\n categoryComponent.forEach(categoryElement => {\n const columnHeight = categoryItem?.height ?? 0;\n const height = categoryElement.scrollHeight;\n const elementId = categoryElement.getAttribute('id');\n if (\n height > columnHeight ||\n (categoryItem.elementId === elementId && height !== columnHeight)\n ) {\n isHeightChanged = true;\n categoriesColumn[index].height = height;\n if (elementId) categoriesColumn[index].elementId = elementId;\n }\n });\n });\n if (isHeightChanged) {\n isHeightChanged = false;\n setcategoriesState(categoriesColumn);\n }\n }\n });\n\n return (\n <Flex container={{ itemGap: 2 }} ref={ref}>\n <Flex as={StyledLifeCycle} ref={lifeCycleEl} container role='grid' aria-label={t('stage')}>\n {items.map((stageItem: StageItemProps, index: number, stageArray: StageItemProps[]) => {\n const listId = stageItem.id;\n return (\n <LifeCycleList\n key={listId}\n id={listId}\n item={stageItem}\n isFirstItem={index === 0}\n isLastItem={index === stageArray.length - 1}\n ref={setRef}\n stage={stage}\n categories={categoriesState}\n {...restProps}\n />\n );\n })}\n <StyledAddButton variant='simple' label={t('add_stage')} icon onClick={onAddStage}>\n <Icon name='plus' />\n </StyledAddButton>\n </Flex>\n {alternateItems.length !== 0 && (\n <Flex\n as={StyledLifeCycle}\n container\n ref={lifeCycleEl}\n role='grid'\n aria-label={t('alternate_stage')}\n >\n {alternateItems.map((stageItem: StageItemProps) => {\n const listId = stageItem.id;\n return (\n <LifeCycleList\n key={listId}\n id={listId}\n item={stageItem}\n ref={setRef}\n categories={categoriesState}\n stageVariant='alternate'\n stage={alternateStage}\n {...restProps}\n />\n );\n })}\n <StyledAddButton\n variant='simple'\n label={t('add_alternate_stage')}\n icon\n onClick={onAddAlternateStage}\n >\n <Icon name='plus' />\n </StyledAddButton>\n </Flex>\n )}\n </Flex>\n );\n }\n);\n\nexport default LifeCycle;\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { Action, StatusProps } from '@pega/cosmos-react-core';
|
|
3
|
+
export interface VisualColorProps {
|
|
4
|
+
color: 'magenta' | 'studio' | 'congressBlue' | 'Japaneselaurel' | 'violet' | 'yellow' | 'orange' | 'darkyellow';
|
|
5
|
+
}
|
|
6
|
+
export interface StepItemProps {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
visual: {
|
|
10
|
+
color: VisualColorProps['color'];
|
|
11
|
+
icon: string;
|
|
12
|
+
label: string;
|
|
13
|
+
imgurl: string;
|
|
14
|
+
};
|
|
15
|
+
status: {
|
|
16
|
+
type?: StatusProps['variant'] | '';
|
|
17
|
+
label: string;
|
|
18
|
+
};
|
|
19
|
+
error: string;
|
|
20
|
+
}
|
|
21
|
+
export interface TaskItemProps {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
visual: {
|
|
25
|
+
imgurl: string;
|
|
26
|
+
};
|
|
27
|
+
error: string;
|
|
28
|
+
steps: StepItemProps[];
|
|
29
|
+
}
|
|
30
|
+
export interface StageItemProps {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
categories: CategoryItemProps[];
|
|
34
|
+
type: 'start' | 'default' | 'resolution' | 'alternate';
|
|
35
|
+
error: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CategoryItemProps {
|
|
38
|
+
id: string;
|
|
39
|
+
categoryId: string;
|
|
40
|
+
tasks: TaskItemProps[] | TaskItemProps[][];
|
|
41
|
+
}
|
|
42
|
+
export interface CategoriesItemProps {
|
|
43
|
+
label: string;
|
|
44
|
+
id: string;
|
|
45
|
+
}
|
|
46
|
+
export interface LifeCycleActionParam {
|
|
47
|
+
value?: string;
|
|
48
|
+
stage?: StageItemProps;
|
|
49
|
+
task?: TaskItemProps;
|
|
50
|
+
category?: CategoryItemProps;
|
|
51
|
+
step?: StepItemProps;
|
|
52
|
+
}
|
|
53
|
+
export interface LifeCycleAction extends Omit<Action, 'onClick'> {
|
|
54
|
+
onClick: (param: LifeCycleActionParam, e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>) => void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=LifeCycle.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifeCycle.types.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EACD,SAAS,GACT,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAE7B,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,MAAM,CAAC;IAEd,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAEhC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAEhC,EAAE,EAAE,MAAM,CAAC;IAEX,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC;IAC9D,OAAO,EAAE,CACP,KAAK,EAAE,oBAAoB,EAC3B,CAAC,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC,KACpE,IAAI,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifeCycle.types.js","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycle.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent } from 'react';\n\nimport { Action, StatusProps } from '@pega/cosmos-react-core';\n\nexport interface VisualColorProps {\n color:\n | 'magenta'\n | 'studio'\n | 'congressBlue'\n | 'Japaneselaurel'\n | 'violet'\n | 'yellow'\n | 'orange'\n | 'darkyellow';\n}\n\nexport interface StepItemProps {\n id: string;\n label: string;\n visual: {\n color: VisualColorProps['color'];\n icon: string;\n label: string;\n imgurl: string;\n };\n status: { type?: StatusProps['variant'] | ''; label: string };\n error: string;\n}\n\nexport interface TaskItemProps {\n id: string;\n label: string;\n visual: {\n imgurl: string;\n };\n error: string;\n steps: StepItemProps[];\n}\n\nexport interface StageItemProps {\n /* Data model should have id of the stage item */\n id: string;\n /* Data model should have the stage label */\n label: string;\n /* Data model should have the categoryData array */\n categories: CategoryItemProps[];\n /* Data model should have the stageType as below */\n type: 'start' | 'default' | 'resolution' | 'alternate';\n error: string;\n}\n\nexport interface CategoryItemProps {\n /* Data model should have id of the stage item */\n id: string;\n /* Data model should have id of the stage item */\n categoryId: string;\n /* Data model should have the categoryData array */\n tasks: TaskItemProps[] | TaskItemProps[][];\n}\n\nexport interface CategoriesItemProps {\n label: string;\n id: string;\n}\n\nexport interface LifeCycleActionParam {\n value?: string;\n stage?: StageItemProps;\n task?: TaskItemProps;\n category?: CategoryItemProps;\n step?: StepItemProps;\n}\n\nexport interface LifeCycleAction extends Omit<Action, 'onClick'> {\n onClick: (\n param: LifeCycleActionParam,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>\n ) => void;\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FunctionComponent, Ref } from 'react';
|
|
2
|
+
import type { NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
|
+
import { StageItemProps } from './LifeCycle.types';
|
|
4
|
+
import { StageProps } from './Stage';
|
|
5
|
+
import { CategoriesProps } from './Category';
|
|
6
|
+
import { TaskProps } from './Task';
|
|
7
|
+
import { StepProps } from './Step';
|
|
8
|
+
export interface LifeCycleListProps extends NoChildrenProp {
|
|
9
|
+
ref?: Ref<HTMLOListElement>;
|
|
10
|
+
categories: CategoriesProps[];
|
|
11
|
+
task: TaskProps[];
|
|
12
|
+
stage?: StageProps;
|
|
13
|
+
step?: StepProps[];
|
|
14
|
+
item: StageItemProps;
|
|
15
|
+
isFirstItem?: boolean;
|
|
16
|
+
isLastItem?: boolean;
|
|
17
|
+
stageVariant?: 'start' | 'default' | 'resolution' | 'alternate';
|
|
18
|
+
id?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const LifeCycleList: FunctionComponent<LifeCycleListProps>;
|
|
21
|
+
export default LifeCycleList;
|
|
22
|
+
//# sourceMappingURL=LifeCycleList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifeCycleList.d.ts","sourceRoot":"","sources":["../../../src/components/LifeCycle/LifeCycleList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACtE,OAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IAExD,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAE5B,UAAU,EAAE,eAAe,EAAE,CAAC;IAE9B,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IAEnB,IAAI,EAAE,cAAc,CAAC;IAErB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;IAEhE,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAoBD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAiGxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|