flow-lib-creomnia 1.0.3 → 1.0.5-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -12
- package/lib/assets/icons/ChoiceNodeIcon.svg +16 -16
- package/lib/assets/icons/LeftArrowIcon.svg +3 -3
- package/lib/assets/icons/ParallelIcon.svg +5 -5
- package/lib/assets/icons/RightArrowIcon.svg +3 -3
- package/lib/assets/icons/flowIcon.svg +7 -7
- package/lib/modules/common/components/ZoomToolbar/styled.js +7 -7
- package/lib/modules/common/types/index.d.ts +3 -0
- package/lib/modules/connection/components/AddButton/styled.js +26 -26
- package/lib/modules/connection/components/BaseConnection/styled.js +16 -16
- package/lib/modules/connection/components/ConnectionWithButton/styled.js +37 -37
- package/lib/modules/connection/services/connectionServices.js +53 -47
- package/lib/modules/flow/components/FlowSandbox/styled.js +22 -22
- package/lib/modules/flow/components/Space/styled.js +8 -8
- package/lib/modules/flow/types/index.d.ts +2 -0
- package/lib/modules/node/components/BaseNode/index.js +1 -1
- package/lib/modules/node/components/BaseNode/styled.js +83 -83
- package/lib/modules/node/components/ChoiseNode/index.js +1 -1
- package/lib/modules/node/components/ChoiseNode/styled.js +27 -27
- package/lib/modules/node/components/EndNode/styled.js +10 -10
- package/lib/modules/node/components/HubNode/styled.js +5 -5
- package/lib/modules/node/components/NodesMenu/index.js +10 -5
- package/lib/modules/node/components/NodesMenu/styled.js +52 -52
- package/lib/modules/node/components/ParallelNode/styled.js +9 -9
- package/lib/modules/node/components/StartNode/styled.js +10 -10
- package/lib/modules/node/contexts/SettingsContext/index.js +1 -1
- package/lib/modules/node/contexts/SettingsContext/styled.js +30 -30
- package/lib/modules/node/enums/index.d.ts +4 -0
- package/lib/modules/node/enums/index.js +6 -1
- package/lib/modules/node/index.js +1 -1
- package/lib/modules/node/services/expandCoefficientServices.d.ts +1 -1
- package/lib/modules/node/services/expandCoefficientServices.js +7 -2
- package/lib/modules/node/services/nodeServices.js +4 -2
- package/lib/modules/node/types/index.d.ts +1 -1
- package/package.json +68 -65
|
@@ -4,13 +4,16 @@ exports.expandCoefficientServices = void 0;
|
|
|
4
4
|
const config_1 = require("../../../config");
|
|
5
5
|
class ExpandCoefficientServices {
|
|
6
6
|
calculateNodeExpandCoefficient = (nodes) => {
|
|
7
|
+
const nodeMap = new Map(nodes.map((node) => [node.id, node]));
|
|
7
8
|
const calculateNodeExpandCoefficientRecursion = ({ startNode, expandCoefficient, indexOfEncapsulation, }) => {
|
|
8
9
|
if (!startNode.childrenIds?.length ||
|
|
9
10
|
(startNode.startSectionNodeId && indexOfEncapsulation <= 0)) {
|
|
10
11
|
return expandCoefficient;
|
|
11
12
|
}
|
|
12
13
|
if (startNode.startSectionNodeId && indexOfEncapsulation > 0) {
|
|
13
|
-
const childrenNodes =
|
|
14
|
+
const childrenNodes = (startNode.childrenIds || [])
|
|
15
|
+
.map((id) => nodeMap.get(id))
|
|
16
|
+
.filter((node) => !!node);
|
|
14
17
|
const nextExpandCoefficient = calculateNodeExpandCoefficientRecursion({
|
|
15
18
|
startNode: childrenNodes[0],
|
|
16
19
|
expandCoefficient: 0,
|
|
@@ -18,7 +21,9 @@ class ExpandCoefficientServices {
|
|
|
18
21
|
});
|
|
19
22
|
return Math.max(expandCoefficient, nextExpandCoefficient);
|
|
20
23
|
}
|
|
21
|
-
const childrenNodes =
|
|
24
|
+
const childrenNodes = (startNode.childrenIds || [])
|
|
25
|
+
.map((id) => nodeMap.get(id))
|
|
26
|
+
.filter((node) => !!node);
|
|
22
27
|
const childrenNodesExpandCoefficient = childrenNodes.map((node) => {
|
|
23
28
|
const isExpandable = config_1.Config.NODES_WITH_DOUBLE_CONNECTION.includes(startNode.type);
|
|
24
29
|
const calculatedExpandCoefficient = isExpandable
|
|
@@ -5,6 +5,7 @@ const enums_1 = require("../enums");
|
|
|
5
5
|
const pointCalculationServices_1 = require("./pointCalculationServices");
|
|
6
6
|
class NodeServices extends pointCalculationServices_1.NodeCalculationServices {
|
|
7
7
|
combineNodes = (currentNodes, nodes) => {
|
|
8
|
+
const nodeMap = new Map(nodes.map((node) => [node.id, node]));
|
|
8
9
|
const hubNodes = nodes.reduce((hubNodes, node) => {
|
|
9
10
|
if (node.startSectionNodeId) {
|
|
10
11
|
return {
|
|
@@ -25,7 +26,7 @@ class NodeServices extends pointCalculationServices_1.NodeCalculationServices {
|
|
|
25
26
|
const childrenIds = currentNode.childrenIds || [];
|
|
26
27
|
const childNodes = childrenIds
|
|
27
28
|
.map((childId) => {
|
|
28
|
-
return
|
|
29
|
+
return nodeMap.get(childId) || [];
|
|
29
30
|
})
|
|
30
31
|
.flat();
|
|
31
32
|
const blockedChildrenIds = currentNode.blockedChildrenIds || [];
|
|
@@ -79,10 +80,11 @@ class NodeServices extends pointCalculationServices_1.NodeCalculationServices {
|
|
|
79
80
|
childrenNodes: [],
|
|
80
81
|
updatedHubNodes: hubNodes,
|
|
81
82
|
});
|
|
83
|
+
const combinedNodesMap = new Map(combinedNodes.map((n) => [n.id, n]));
|
|
82
84
|
const drawableNodes = currentNodes.map((node) => {
|
|
83
85
|
const startSectionNodeId = node.startSectionNodeId;
|
|
84
86
|
const parent = startSectionNodeId
|
|
85
|
-
?
|
|
87
|
+
? combinedNodesMap.get(startSectionNodeId)
|
|
86
88
|
: combinedNodes.find((parentNode) => parentNode.nodeData?.childrenIds?.includes(node.id));
|
|
87
89
|
// TODO it works when node has 2 children but should be refactored
|
|
88
90
|
const isSecondBranch = parent?.nodeData?.rightChildrenId === node.id;
|
package/package.json
CHANGED
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "flow-lib-creomnia",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"private": false,
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test": "jest --config jestconfig.json",
|
|
10
|
-
"clean": "rm -rf ./lib",
|
|
11
|
-
"copy-files": "cp -R src/assets lib/assets",
|
|
12
|
-
"build": "npm run clean && tsc && npm run copy-files",
|
|
13
|
-
"publish-package": "npm run build && npm publish"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"@
|
|
23
|
-
"@types/
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"react-
|
|
58
|
-
"react-
|
|
59
|
-
"react
|
|
60
|
-
"react-
|
|
61
|
-
"react-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "flow-lib-creomnia",
|
|
3
|
+
"version": "1.0.5-dev.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"private": false,
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "jest --config jestconfig.json",
|
|
10
|
+
"clean": "rm -rf ./lib",
|
|
11
|
+
"copy-files": "cp -R src/assets lib/assets",
|
|
12
|
+
"build": "npm run clean && tsc && npm run copy-files",
|
|
13
|
+
"publish-package": "npm run build && npm publish",
|
|
14
|
+
"publishPackage": "npm run build && npm publish",
|
|
15
|
+
"publishPackageDev": "npm run build && npm publish --tag dev",
|
|
16
|
+
"publishPackageQa": "npm run build && npm publish --tag qa"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
23
|
+
"@types/jest": "^29.5.2",
|
|
24
|
+
"@types/react": "^18.2.12",
|
|
25
|
+
"@types/react-dom": "^18.2.5",
|
|
26
|
+
"@types/react-svg": "^5.0.0",
|
|
27
|
+
"jest": "^29.5.0",
|
|
28
|
+
"prettier": "^2.8.8",
|
|
29
|
+
"prop-types": "^15.8.1",
|
|
30
|
+
"react": "^18.2.0",
|
|
31
|
+
"react-dom": "^18.2.0",
|
|
32
|
+
"ts-jest": "^29.1.0",
|
|
33
|
+
"tslint": "^6.1.3",
|
|
34
|
+
"tslint-config-prettier": "^1.18.0",
|
|
35
|
+
"typescript": "^5.1.3"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"lib/**/*"
|
|
39
|
+
],
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@emotion/react": "^11.11.1",
|
|
42
|
+
"@emotion/styled": "^11.11.0",
|
|
43
|
+
"@mui/icons-material": "^5.11.16",
|
|
44
|
+
"@mui/material": "^5.13.5",
|
|
45
|
+
"@mui/styled-engine-sc": "^5.12.0",
|
|
46
|
+
"react": "^18.2.0",
|
|
47
|
+
"react-dom": "^18.2.0",
|
|
48
|
+
"react-svg": "^16.1.17",
|
|
49
|
+
"styled-components": "^5.3.11"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@emotion/react": "^11.11.1",
|
|
53
|
+
"@emotion/styled": "^11.11.0",
|
|
54
|
+
"@mui/icons-material": "^5.11.16",
|
|
55
|
+
"@mui/material": "^5.13.5",
|
|
56
|
+
"@mui/styled-engine-sc": "^5.12.0",
|
|
57
|
+
"@react-spring/rafz": "^9.7.3",
|
|
58
|
+
"@react-spring/web": "^9.7.3",
|
|
59
|
+
"react": "^18.2.0",
|
|
60
|
+
"react-dnd": "^16.0.1",
|
|
61
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
62
|
+
"react-dom": "^18.2.0",
|
|
63
|
+
"react-svg": "^16.1.17",
|
|
64
|
+
"react-zoom-pan-pinch": "^3.3.0",
|
|
65
|
+
"styled-components": "^5.3.11"
|
|
66
|
+
},
|
|
67
|
+
"readme": "ERROR: No README data found!"
|
|
68
|
+
}
|