flow-lib-creomnia 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/lib/assets/icons/ChoiceNodeIcon.svg +16 -0
- package/lib/assets/icons/LeftArrowIcon.svg +3 -0
- package/lib/assets/icons/ParallelIcon.svg +5 -0
- package/lib/assets/icons/RightArrowIcon.svg +3 -0
- package/lib/assets/icons/flowIcon.svg +7 -0
- package/lib/config/colors.d.ts +13 -0
- package/lib/config/colors.js +16 -0
- package/lib/config/index.d.ts +20 -0
- package/lib/config/index.js +28 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +24 -0
- package/lib/modules/common/components/HorizontalDrawer/index.d.ts +9 -0
- package/lib/modules/common/components/HorizontalDrawer/index.js +86 -0
- package/lib/modules/common/components/ZoomToolbar/index.d.ts +8 -0
- package/lib/modules/common/components/ZoomToolbar/index.js +15 -0
- package/lib/modules/common/components/ZoomToolbar/styled.d.ts +9 -0
- package/lib/modules/common/components/ZoomToolbar/styled.js +13 -0
- package/lib/modules/common/components/index.d.ts +2 -0
- package/lib/modules/common/components/index.js +10 -0
- package/lib/modules/common/contexts/ThemeContext/index.d.ts +24 -0
- package/lib/modules/common/contexts/ThemeContext/index.js +9 -0
- package/lib/modules/common/hooks/useDragNode.d.ts +10 -0
- package/lib/modules/common/hooks/useDragNode.js +27 -0
- package/lib/modules/common/hooks/useDropNode.d.ts +11 -0
- package/lib/modules/common/hooks/useDropNode.js +16 -0
- package/lib/modules/common/types/index.d.ts +69 -0
- package/lib/modules/common/types/index.js +2 -0
- package/lib/modules/connection/components/AddButton/index.d.ts +16 -0
- package/lib/modules/connection/components/AddButton/index.js +45 -0
- package/lib/modules/connection/components/AddButton/styled.d.ts +29 -0
- package/lib/modules/connection/components/AddButton/styled.js +41 -0
- package/lib/modules/connection/components/BaseConnection/index.d.ts +4 -0
- package/lib/modules/connection/components/BaseConnection/index.js +40 -0
- package/lib/modules/connection/components/BaseConnection/styled.d.ts +18 -0
- package/lib/modules/connection/components/BaseConnection/styled.js +28 -0
- package/lib/modules/connection/components/ConnectionWithButton/index.d.ts +12 -0
- package/lib/modules/connection/components/ConnectionWithButton/index.js +83 -0
- package/lib/modules/connection/components/ConnectionWithButton/styled.d.ts +44 -0
- package/lib/modules/connection/components/ConnectionWithButton/styled.js +55 -0
- package/lib/modules/connection/enums/index.d.ts +4 -0
- package/lib/modules/connection/enums/index.js +8 -0
- package/lib/modules/connection/index.d.ts +9 -0
- package/lib/modules/connection/index.js +11 -0
- package/lib/modules/connection/services/connectionParametersServices.d.ts +28 -0
- package/lib/modules/connection/services/connectionParametersServices.js +84 -0
- package/lib/modules/connection/services/connectionServices.d.ts +7 -0
- package/lib/modules/connection/services/connectionServices.js +82 -0
- package/lib/modules/connection/types/index.d.ts +41 -0
- package/lib/modules/connection/types/index.js +2 -0
- package/lib/modules/flow/components/FlowSandbox/index.d.ts +18 -0
- package/lib/modules/flow/components/FlowSandbox/index.js +63 -0
- package/lib/modules/flow/components/FlowSandbox/styled.d.ts +9 -0
- package/lib/modules/flow/components/FlowSandbox/styled.js +32 -0
- package/lib/modules/flow/components/NodesFlow/index.d.ts +4 -0
- package/lib/modules/flow/components/NodesFlow/index.js +36 -0
- package/lib/modules/flow/components/Space/index.d.ts +3 -0
- package/lib/modules/flow/components/Space/index.js +35 -0
- package/lib/modules/flow/components/Space/styled.d.ts +2 -0
- package/lib/modules/flow/components/Space/styled.js +13 -0
- package/lib/modules/flow/context/FlowPosition/index.d.ts +13 -0
- package/lib/modules/flow/context/FlowPosition/index.js +23 -0
- package/lib/modules/flow/types/index.d.ts +29 -0
- package/lib/modules/flow/types/index.js +2 -0
- package/lib/modules/node/components/BaseNode/index.d.ts +4 -0
- package/lib/modules/node/components/BaseNode/index.js +51 -0
- package/lib/modules/node/components/BaseNode/styled.d.ts +18 -0
- package/lib/modules/node/components/BaseNode/styled.js +98 -0
- package/lib/modules/node/components/ChoiseNode/index.d.ts +4 -0
- package/lib/modules/node/components/ChoiseNode/index.js +45 -0
- package/lib/modules/node/components/ChoiseNode/styled.d.ts +20 -0
- package/lib/modules/node/components/ChoiseNode/styled.js +39 -0
- package/lib/modules/node/components/DragWrapper/index.d.ts +8 -0
- package/lib/modules/node/components/DragWrapper/index.js +15 -0
- package/lib/modules/node/components/EndNode/index.d.ts +3 -0
- package/lib/modules/node/components/EndNode/index.js +8 -0
- package/lib/modules/node/components/EndNode/styled.d.ts +16 -0
- package/lib/modules/node/components/EndNode/styled.js +22 -0
- package/lib/modules/node/components/HubNode/index.d.ts +3 -0
- package/lib/modules/node/components/HubNode/index.js +8 -0
- package/lib/modules/node/components/HubNode/styled.d.ts +2 -0
- package/lib/modules/node/components/HubNode/styled.js +12 -0
- package/lib/modules/node/components/NodesMenu/index.d.ts +14 -0
- package/lib/modules/node/components/NodesMenu/index.js +28 -0
- package/lib/modules/node/components/NodesMenu/styled.d.ts +127 -0
- package/lib/modules/node/components/NodesMenu/styled.js +69 -0
- package/lib/modules/node/components/ParallelNode/index.d.ts +4 -0
- package/lib/modules/node/components/ParallelNode/index.js +22 -0
- package/lib/modules/node/components/ParallelNode/styled.d.ts +2 -0
- package/lib/modules/node/components/ParallelNode/styled.js +16 -0
- package/lib/modules/node/components/StartNode/index.d.ts +3 -0
- package/lib/modules/node/components/StartNode/index.js +8 -0
- package/lib/modules/node/components/StartNode/styled.d.ts +16 -0
- package/lib/modules/node/components/StartNode/styled.js +22 -0
- package/lib/modules/node/contexts/SettingsContext/index.d.ts +10 -0
- package/lib/modules/node/contexts/SettingsContext/index.js +47 -0
- package/lib/modules/node/contexts/SettingsContext/styled.d.ts +20 -0
- package/lib/modules/node/contexts/SettingsContext/styled.js +40 -0
- package/lib/modules/node/enums/index.d.ts +8 -0
- package/lib/modules/node/enums/index.js +12 -0
- package/lib/modules/node/index.d.ts +10 -0
- package/lib/modules/node/index.js +22 -0
- package/lib/modules/node/services/expandCoefficientServices.d.ts +24 -0
- package/lib/modules/node/services/expandCoefficientServices.js +47 -0
- package/lib/modules/node/services/nodeServices.d.ts +11 -0
- package/lib/modules/node/services/nodeServices.js +145 -0
- package/lib/modules/node/services/pointCalculationServices.d.ts +11 -0
- package/lib/modules/node/services/pointCalculationServices.js +22 -0
- package/lib/modules/node/types/index.d.ts +49 -0
- package/lib/modules/node/types/index.js +2 -0
- package/package.json +65 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const styled_1 = require("./styled");
|
|
9
|
+
const node_1 = require("../../../node");
|
|
10
|
+
const connection_1 = require("../../../connection");
|
|
11
|
+
const config_1 = require("../../../../config");
|
|
12
|
+
const Space_1 = __importDefault(require("../Space"));
|
|
13
|
+
const react_zoom_pan_pinch_1 = require("react-zoom-pan-pinch");
|
|
14
|
+
const components_1 = require("../../../common/components");
|
|
15
|
+
const FlowPosition_1 = require("../../context/FlowPosition");
|
|
16
|
+
const FlowSandbox = ({ nodeDrawers, connectionDrawers, containerRef, permissions, processedNodeIds, failedNodeId, failedNodeColor, onRedirect, onUpdateNodePosition }) => {
|
|
17
|
+
const sandboxWidth = containerRef?.current?.offsetWidth || 0;
|
|
18
|
+
const [maxWidth, setMaxWidth] = (0, react_1.useState)(sandboxWidth);
|
|
19
|
+
const [minWidth, setMinWidth] = (0, react_1.useState)(0);
|
|
20
|
+
const flowPosition = (0, react_1.useContext)(FlowPosition_1.FlowPositionContext);
|
|
21
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
22
|
+
const maxHorizontalPoint = Math.max(...nodeDrawers.map((node) => node.renderPoint.x));
|
|
23
|
+
const minHorizontalPoint = Math.min(...nodeDrawers.map((node) => node.renderPoint.x));
|
|
24
|
+
const maxVerticalPoint = Math.max(...nodeDrawers.map((node) => node.renderPoint.y));
|
|
25
|
+
setMaxWidth(maxHorizontalPoint + config_1.Config.HORIZONTAL_SHIFT);
|
|
26
|
+
setMinWidth(minHorizontalPoint - config_1.Config.HORIZONTAL_SHIFT);
|
|
27
|
+
}, [nodeDrawers]);
|
|
28
|
+
const connections = (0, react_1.useMemo)(() => connectionDrawers.map((connectionDrawer, index) => {
|
|
29
|
+
const Connection = permissions.canCreate
|
|
30
|
+
? connection_1.moduleConnection.connections.connectionWithButton
|
|
31
|
+
: connection_1.moduleConnection.connections.baseConnection;
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(Connection, { ...connectionDrawer.connectionData, startPoint: {
|
|
33
|
+
x: connectionDrawer.connectionData.startPoint.x - minWidth,
|
|
34
|
+
y: connectionDrawer.connectionData.startPoint.y,
|
|
35
|
+
}, endPoint: {
|
|
36
|
+
x: connectionDrawer.connectionData.endPoint.x - minWidth,
|
|
37
|
+
y: connectionDrawer.connectionData.endPoint.y,
|
|
38
|
+
} }, `connection:${connectionDrawer.connectionData.node.id}-${connectionDrawer.connectionData.connectionIndex}`));
|
|
39
|
+
}), [connectionDrawers, minWidth]);
|
|
40
|
+
const nodes = (0, react_1.useMemo)(() => nodeDrawers.map((nodeDrawer) => {
|
|
41
|
+
const Node = node_1.nodeModule.nodes?.[nodeDrawer.type] || node_1.nodeModule.nodes.baseNode;
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(styled_1.NodeWrapper, { style: {
|
|
43
|
+
top: nodeDrawer.renderPoint.y,
|
|
44
|
+
left: nodeDrawer.renderPoint.x - minWidth,
|
|
45
|
+
}, children: (0, jsx_runtime_1.jsx)(Node, { nodeData: nodeDrawer.nodeData, renderPoint: nodeDrawer.renderPoint, id: nodeDrawer.id, type: nodeDrawer.type, isProcessed: processedNodeIds?.includes(nodeDrawer.nodeData?.id), isFailed: failedNodeId === nodeDrawer.nodeData?.id, failedNodeColor: failedNodeColor, onRedirect: onRedirect, onUpdatePosition: onUpdateNodePosition }) }, nodeDrawer.id));
|
|
46
|
+
}), [minWidth, nodeDrawers]);
|
|
47
|
+
const FlowContainer = (0, react_1.useMemo)(() => (0, styled_1.createFlowContainer)({
|
|
48
|
+
scaleValue: 1,
|
|
49
|
+
width: maxWidth - minWidth,
|
|
50
|
+
}), [maxWidth, minWidth]);
|
|
51
|
+
const initialScale = (0, react_1.useMemo)(() => {
|
|
52
|
+
const maxHorizontalPoint = Math.max(...nodeDrawers.map((node) => node.renderPoint.x));
|
|
53
|
+
const minHorizontalPoint = Math.min(...nodeDrawers.map((node) => node.renderPoint.x));
|
|
54
|
+
const zoom = sandboxWidth / (maxHorizontalPoint - minHorizontalPoint + 2 * config_1.Config.HORIZONTAL_SHIFT);
|
|
55
|
+
return zoom > 1 ? 1 : zoom;
|
|
56
|
+
}, [sandboxWidth]);
|
|
57
|
+
const positionShift = sandboxWidth / 2 - (maxWidth - minWidth) / 2;
|
|
58
|
+
const InitialPositionX = (0, react_1.useMemo)(() => (initialScale < 1 ? 0 : positionShift), [sandboxWidth]);
|
|
59
|
+
if (!sandboxWidth)
|
|
60
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(react_zoom_pan_pinch_1.TransformWrapper, { minScale: config_1.Config.MIN_SCALE, maxScale: config_1.Config.MAX_SCALE, initialPositionX: flowPosition.position.positionX || InitialPositionX, initialPositionY: flowPosition.position.positionY || 0, limitToBounds: false, initialScale: initialScale, pinch: { disabled: false }, onZoomStop: (e) => flowPosition.setPosition(e.state), onPanningStop: (e) => flowPosition.setPosition(e.state), children: (zoomProps) => ((0, jsx_runtime_1.jsxs)(Space_1.default, { children: [(0, jsx_runtime_1.jsx)(styled_1.ZoomToolbarContainer, { children: (0, jsx_runtime_1.jsx)(components_1.ZoomToolbar, { ...zoomProps }) }), (0, jsx_runtime_1.jsx)(react_zoom_pan_pinch_1.TransformComponent, { wrapperStyle: { width: "100%", height: "100%" }, children: (0, jsx_runtime_1.jsxs)(FlowContainer, { children: [nodes, connections] }) })] })) }));
|
|
62
|
+
};
|
|
63
|
+
exports.default = FlowSandbox;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type CreateFlowContainerPropsType = {
|
|
3
|
+
scaleValue: number;
|
|
4
|
+
width: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const createFlowContainer: ({ scaleValue, width, }: CreateFlowContainerPropsType) => import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
+
export declare const NodeWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
export declare const ConnectionWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
export declare const ZoomToolbarContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZoomToolbarContainer = exports.ConnectionWrapper = exports.NodeWrapper = exports.createFlowContainer = void 0;
|
|
4
|
+
const system_1 = require("@mui/system");
|
|
5
|
+
const config_1 = require("../../../../config");
|
|
6
|
+
const createFlowContainer = ({ scaleValue, width, }) => (0, system_1.styled)('div') `
|
|
7
|
+
transform: scale(${scaleValue});
|
|
8
|
+
min-width: ${width}px;
|
|
9
|
+
min-height: fit-content;
|
|
10
|
+
background-color: blue;
|
|
11
|
+
`;
|
|
12
|
+
exports.createFlowContainer = createFlowContainer;
|
|
13
|
+
exports.NodeWrapper = (0, system_1.styled)('div') `
|
|
14
|
+
width: 0;
|
|
15
|
+
height: ${config_1.Config.NODE_HEIGHT}px;
|
|
16
|
+
position: absolute;
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
z-index: 2;
|
|
21
|
+
`;
|
|
22
|
+
exports.ConnectionWrapper = (0, system_1.styled)('div') `
|
|
23
|
+
z-index: 1;
|
|
24
|
+
`;
|
|
25
|
+
exports.ZoomToolbarContainer = (0, system_1.styled)('div') `
|
|
26
|
+
cursor: default;
|
|
27
|
+
position: fixed;
|
|
28
|
+
z-index: 1000;
|
|
29
|
+
padding: 24px;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const FlowSandbox_1 = __importDefault(require("../FlowSandbox"));
|
|
9
|
+
const nodeServices_1 = require("../../../node/services/nodeServices");
|
|
10
|
+
const connectionServices_1 = require("../../../connection/services/connectionServices");
|
|
11
|
+
const SettingsContext_1 = require("../../../node/contexts/SettingsContext");
|
|
12
|
+
const ThemeContext_1 = require("../../../common/contexts/ThemeContext");
|
|
13
|
+
const expandCoefficientServices_1 = require("../../../node/services/expandCoefficientServices");
|
|
14
|
+
const material_1 = require("@mui/material");
|
|
15
|
+
const FlowPosition_1 = require("../../context/FlowPosition");
|
|
16
|
+
const react_dnd_html5_backend_1 = require("react-dnd-html5-backend");
|
|
17
|
+
const react_dnd_1 = require("react-dnd");
|
|
18
|
+
const colors_1 = require("../../../../config/colors");
|
|
19
|
+
const NodesFlow = ({ theme, nodes, menuTabs, addNewNodeCallback, permissions, drawerProps, processedNodeIds, failedNodeId, failedNodeColor, onRedirect, onUpdateNodePosition }) => {
|
|
20
|
+
const nodeDrawers = (0, react_1.useMemo)(() => {
|
|
21
|
+
const { startNodeList, nodeListWithEndNode } = nodeServices_1.nodeServices.createListOfStartNodesAndEndNodes(nodes);
|
|
22
|
+
const nodeListWithExpandCoefficients = expandCoefficientServices_1.expandCoefficientServices.calculateNodeExpandCoefficient(nodeListWithEndNode);
|
|
23
|
+
const combinedNodes = nodeServices_1.nodeServices.combineNodes(startNodeList, nodeListWithExpandCoefficients);
|
|
24
|
+
return combinedNodes;
|
|
25
|
+
}, [nodes]);
|
|
26
|
+
const connectionDrawers = (0, react_1.useMemo)(() => connectionServices_1.connectionServices.buildConnections({
|
|
27
|
+
processedNodeIds: processedNodeIds || [],
|
|
28
|
+
failedNodeId,
|
|
29
|
+
nodeDrawers,
|
|
30
|
+
menuTabs,
|
|
31
|
+
addNewNodeCallback,
|
|
32
|
+
}), [nodeDrawers, menuTabs, addNewNodeCallback, processedNodeIds]);
|
|
33
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: permissions.canRead && ((0, jsx_runtime_1.jsx)(ThemeContext_1.ThemeContextProvider, { themContextValue: theme, children: (0, jsx_runtime_1.jsx)(react_dnd_1.DndProvider, { backend: react_dnd_html5_backend_1.HTML5Backend, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ref: containerRef, style: { height: "100%", width: "100%", background: theme?.palette.background.default || colors_1.Colors.DIRTY_WHITE }, children: (0, jsx_runtime_1.jsx)(SettingsContext_1.NodeSettingsProvider, { permissions: permissions, drawerProps: drawerProps, children: (0, jsx_runtime_1.jsx)(FlowPosition_1.FlowPositionProvider, { children: (0, jsx_runtime_1.jsx)(FlowSandbox_1.default, { permissions: permissions, connectionDrawers: connectionDrawers, nodeDrawers: nodeDrawers, containerRef: containerRef, processedNodeIds: processedNodeIds, failedNodeId: failedNodeId, failedNodeColor: failedNodeColor, onRedirect: onRedirect, onUpdateNodePosition: onUpdateNodePosition }) }) }) }) }) })) }));
|
|
35
|
+
};
|
|
36
|
+
exports.default = NodesFlow;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const styled_1 = require("./styled");
|
|
6
|
+
const Space = ({ children }) => {
|
|
7
|
+
const spaceRef = (0, react_1.useRef)(null);
|
|
8
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
9
|
+
const [startX, setStartX] = (0, react_1.useState)(0);
|
|
10
|
+
const [startY, setStartY] = (0, react_1.useState)(0);
|
|
11
|
+
const [scrollLeft, setScrollLeft] = (0, react_1.useState)(0);
|
|
12
|
+
const [scrollTop, setScrollTop] = (0, react_1.useState)(0);
|
|
13
|
+
const handleMouseDown = (event) => {
|
|
14
|
+
setIsDragging(true);
|
|
15
|
+
setStartX(event.pageX - spaceRef.current.offsetLeft);
|
|
16
|
+
setStartY(event.pageY - spaceRef.current.offsetTop);
|
|
17
|
+
setScrollLeft(spaceRef.current.scrollLeft);
|
|
18
|
+
setScrollTop(spaceRef.current.scrollTop);
|
|
19
|
+
};
|
|
20
|
+
const handleMouseMove = (event) => {
|
|
21
|
+
if (!isDragging)
|
|
22
|
+
return;
|
|
23
|
+
const x = event.pageX - spaceRef.current.offsetLeft;
|
|
24
|
+
const y = event.pageY - spaceRef.current.offsetTop;
|
|
25
|
+
const walkX = x - startX;
|
|
26
|
+
const walkY = y - startY;
|
|
27
|
+
spaceRef.current.scrollLeft = scrollLeft - walkX;
|
|
28
|
+
spaceRef.current.scrollTop = scrollTop - walkY;
|
|
29
|
+
};
|
|
30
|
+
const stopDragging = () => {
|
|
31
|
+
setIsDragging(false);
|
|
32
|
+
};
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(styled_1.SpaceContainer, { ref: spaceRef, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: stopDragging, onMouseLeave: stopDragging, children: children }));
|
|
34
|
+
};
|
|
35
|
+
exports.default = Space;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SpaceContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpaceContainer = void 0;
|
|
4
|
+
const system_1 = require("@mui/system");
|
|
5
|
+
exports.SpaceContainer = (0, system_1.styled)('div') `
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
cursor: grab;
|
|
9
|
+
-webkit-user-select: none;
|
|
10
|
+
-moz-user-select: none;
|
|
11
|
+
-ms-user-select: none;
|
|
12
|
+
user-select: none;
|
|
13
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { FC, PropsWithChildren } from "react";
|
|
2
|
+
type IPosition = {
|
|
3
|
+
positionX: number;
|
|
4
|
+
positionY: number;
|
|
5
|
+
scale: number;
|
|
6
|
+
};
|
|
7
|
+
type PropTypes = {
|
|
8
|
+
setPosition: (data: IPosition) => void;
|
|
9
|
+
position: IPosition;
|
|
10
|
+
} & PropsWithChildren;
|
|
11
|
+
declare const FlowPositionContext: React.Context<PropTypes>;
|
|
12
|
+
declare const FlowPositionProvider: FC<PropsWithChildren>;
|
|
13
|
+
export { FlowPositionContext, FlowPositionProvider };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowPositionProvider = exports.FlowPositionContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const FlowPositionContext = (0, react_1.createContext)({
|
|
7
|
+
setPosition: () => 0,
|
|
8
|
+
position: {
|
|
9
|
+
scale: 0,
|
|
10
|
+
positionY: 0,
|
|
11
|
+
positionX: 0
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports.FlowPositionContext = FlowPositionContext;
|
|
15
|
+
const FlowPositionProvider = ({ children }) => {
|
|
16
|
+
const [position, setPosition] = (0, react_1.useState)({
|
|
17
|
+
scale: 0,
|
|
18
|
+
positionY: 0,
|
|
19
|
+
positionX: 0
|
|
20
|
+
});
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(FlowPositionContext.Provider, { value: { setPosition, position }, children: children });
|
|
22
|
+
};
|
|
23
|
+
exports.FlowPositionProvider = FlowPositionProvider;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MenuTabType, Theme, UpdateNodePosition } from "../../common/types";
|
|
2
|
+
import { NodeType } from "../../node/types";
|
|
3
|
+
export type AddNewNodeCallbackType = (params: {
|
|
4
|
+
menuItemId: string;
|
|
5
|
+
parentId: string | undefined;
|
|
6
|
+
connectionIndex: number;
|
|
7
|
+
}) => void;
|
|
8
|
+
export type NodeFlowPropsType = {
|
|
9
|
+
nodes: NodeType[];
|
|
10
|
+
menuTabs: MenuTabType[];
|
|
11
|
+
addNewNodeCallback?: AddNewNodeCallbackType;
|
|
12
|
+
permissions: Permissions;
|
|
13
|
+
drawerProps: IDrawerProps;
|
|
14
|
+
processedNodeIds?: string[];
|
|
15
|
+
failedNodeId?: string;
|
|
16
|
+
failedNodeColor?: string;
|
|
17
|
+
onRedirect?: (flowId: string) => void;
|
|
18
|
+
onUpdateNodePosition: UpdateNodePosition;
|
|
19
|
+
theme: Theme;
|
|
20
|
+
};
|
|
21
|
+
export type IDrawerProps = {
|
|
22
|
+
isOpen: boolean;
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
onOpen: () => void;
|
|
25
|
+
};
|
|
26
|
+
export type PermissionsTypes = "canUpdate" | "canRead" | "canCreate" | "canDelete";
|
|
27
|
+
export type Permissions = {
|
|
28
|
+
[key in PermissionsTypes]: boolean;
|
|
29
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const styled_1 = require("./styled");
|
|
9
|
+
const SettingsContext_1 = require("../../contexts/SettingsContext");
|
|
10
|
+
const web_1 = require("@react-spring/web");
|
|
11
|
+
const colors_1 = require("../../../../config/colors");
|
|
12
|
+
const flowIcon_svg_1 = __importDefault(require("../../../../assets/icons/flowIcon.svg"));
|
|
13
|
+
const material_1 = require("@mui/material");
|
|
14
|
+
const DragWrapper_1 = require("../DragWrapper");
|
|
15
|
+
const BaseNode = ({ nodeData, isProcessed, isFailed, failedNodeColor, onRedirect, onUpdatePosition }) => {
|
|
16
|
+
const { setNode, node } = (0, react_1.useContext)(SettingsContext_1.SettingsContext);
|
|
17
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
18
|
+
const theme = (0, material_1.useTheme)();
|
|
19
|
+
const baseColor = theme.palette?.background?.paper || colors_1.Colors.WHITE;
|
|
20
|
+
const prevColorRef = (0, react_1.useRef)(baseColor);
|
|
21
|
+
const color = (isHovered || node?.id === nodeData?.id) ? colors_1.Colors.BLUE :
|
|
22
|
+
isFailed ? (failedNodeColor || colors_1.Colors.RED) :
|
|
23
|
+
isProcessed ? colors_1.Colors.GREEN :
|
|
24
|
+
baseColor;
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
prevColorRef.current = color;
|
|
27
|
+
}, [color]);
|
|
28
|
+
const isLongAction = (color === colors_1.Colors.GREEN ||
|
|
29
|
+
color === colors_1.Colors.RED ||
|
|
30
|
+
color === failedNodeColor) && prevColorRef.current !== colors_1.Colors.BLUE;
|
|
31
|
+
const props = (0, web_1.useSpring)({
|
|
32
|
+
borderColor: color,
|
|
33
|
+
config: {
|
|
34
|
+
duration: isLongAction ? 1000 : 150
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const onNodeClick = () => {
|
|
38
|
+
setNode(nodeData || null);
|
|
39
|
+
};
|
|
40
|
+
const AnimatedContainer = (0, web_1.animated)(styled_1.Container);
|
|
41
|
+
const redirectToParentFlow = (e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
if (nodeData?.childFlowId && onRedirect) {
|
|
44
|
+
onRedirect(nodeData?.childFlowId);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const component = (0, react_1.useRef)();
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(DragWrapper_1.DragWrapper, { onUpdatePosition: onUpdatePosition, nodeId: nodeData?.id || '', children: (0, jsx_runtime_1.jsx)(material_1.Box, { ref: component, children: (0, jsx_runtime_1.jsxs)(AnimatedContainer, { onClick: onNodeClick, style: props, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [(0, jsx_runtime_1.jsxs)(styled_1.IconWrapper, { children: [(0, jsx_runtime_1.jsx)(styled_1.IconBorder, {}), nodeData?.icon] }), (0, jsx_runtime_1.jsxs)(styled_1.ContentContainer, { children: [(0, jsx_runtime_1.jsxs)(styled_1.NameOfExtension, { children: ["Type: ", nodeData?.extensionName] }), (0, jsx_runtime_1.jsx)(styled_1.Name, { children: nodeData?.name })] }), nodeData?.childFlowId &&
|
|
49
|
+
(0, jsx_runtime_1.jsx)(styled_1.ChildFlowWrapper, { onClick: redirectToParentFlow, children: (0, jsx_runtime_1.jsx)("img", { src: flowIcon_svg_1.default }) })] }) }) }));
|
|
50
|
+
};
|
|
51
|
+
exports.default = BaseNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").PaperClasses> | undefined;
|
|
5
|
+
elevation?: number | undefined;
|
|
6
|
+
square?: boolean | undefined;
|
|
7
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
8
|
+
variant?: import("@mui/types").OverridableStringUnion<"elevation" | "outlined", import("@mui/material").PaperPropsVariantOverrides> | undefined;
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
10
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
+
}, "variant" | "square" | "children" | "elevation" | "sx" | keyof import("@mui/material/OverridableComponent").CommonProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
|
|
12
|
+
export declare const IconBorder: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
+
export declare const IconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const Name: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
15
|
+
export declare const NameOfExtension: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const ContentContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
|
+
export declare const ChildFlowWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
export declare const NodeMenu: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeMenu = exports.ChildFlowWrapper = exports.ContentContainer = exports.NameOfExtension = exports.Name = exports.IconWrapper = exports.IconBorder = exports.Container = void 0;
|
|
4
|
+
const system_1 = require("@mui/system");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const config_1 = require("../../../../config");
|
|
7
|
+
const colors_1 = require("../../../../config/colors");
|
|
8
|
+
exports.Container = (0, system_1.styled)(material_1.Paper)(() => `
|
|
9
|
+
width: ${config_1.Config.NODE_WIDTH}px;
|
|
10
|
+
height: ${config_1.Config.NODE_HEIGHT}px;
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
box-shadow: 0px 6px 30px 0px rgba(0, 0, 0, 0.08);
|
|
13
|
+
border: 2px solid ${colors_1.Colors.WHITE};
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
position: relative;
|
|
19
|
+
z-index: 0;
|
|
20
|
+
`);
|
|
21
|
+
exports.IconBorder = (0, system_1.styled)('div') `
|
|
22
|
+
position: absolute;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
border-radius: 6px;
|
|
26
|
+
border: 1px solid rgba(17, 25, 39, 0.12);
|
|
27
|
+
`;
|
|
28
|
+
exports.IconWrapper = (0, system_1.styled)('div') `
|
|
29
|
+
width: 56px;
|
|
30
|
+
min-width: 56px;
|
|
31
|
+
max-width: 56px;
|
|
32
|
+
height: 56px;
|
|
33
|
+
background: ${props => `${props.theme.palette?.background?.default}`};
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
align-items: center;
|
|
37
|
+
border-radius: 6px;
|
|
38
|
+
object-fit: contain;
|
|
39
|
+
margin-left: 8px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
position: relative;
|
|
42
|
+
`;
|
|
43
|
+
exports.Name = (0, system_1.styled)('div') `
|
|
44
|
+
//font-size: 16px;
|
|
45
|
+
display: -webkit-box;
|
|
46
|
+
-webkit-line-clamp: 2;
|
|
47
|
+
-webkit-box-orient: vertical;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
width: 240px;
|
|
50
|
+
text-align: left;
|
|
51
|
+
font-family: Inter, 'circular', serif;
|
|
52
|
+
font-size: 16px;
|
|
53
|
+
font-style: normal;
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
line-height: 150%;
|
|
56
|
+
`;
|
|
57
|
+
exports.NameOfExtension = (0, system_1.styled)('div') `
|
|
58
|
+
text-align: left;
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
color: ${colors_1.Colors.GRAY};
|
|
61
|
+
width: 240px;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
font-family: Inter, 'circular', serif;
|
|
66
|
+
font-style: normal;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
line-height: 14px; /* 116.667% */
|
|
69
|
+
letter-spacing: 0.15px;
|
|
70
|
+
`;
|
|
71
|
+
exports.ContentContainer = (0, system_1.styled)('div') `
|
|
72
|
+
margin-left: 16px;
|
|
73
|
+
height: 62px;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
display: flex;
|
|
77
|
+
width: min-content;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 5px
|
|
80
|
+
`;
|
|
81
|
+
exports.ChildFlowWrapper = (0, system_1.styled)('div') `
|
|
82
|
+
width: min-content;
|
|
83
|
+
height: min-content;
|
|
84
|
+
position: absolute;
|
|
85
|
+
z-index: 10;
|
|
86
|
+
top: 10px;
|
|
87
|
+
right: 10px;
|
|
88
|
+
`;
|
|
89
|
+
exports.NodeMenu = (0, system_1.styled)('div') `
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: -2px;
|
|
92
|
+
right: 0;
|
|
93
|
+
width: 40px;
|
|
94
|
+
height: calc(100% + 4px);
|
|
95
|
+
background-color: #D8DBDC;
|
|
96
|
+
margin-right: -2px;
|
|
97
|
+
border-radius: 0 8px 8px 0;
|
|
98
|
+
`;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const styled_1 = require("./styled");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const SettingsContext_1 = require("../../contexts/SettingsContext");
|
|
11
|
+
const LeftArrowIcon_svg_1 = __importDefault(require("../../../../assets/icons/LeftArrowIcon.svg"));
|
|
12
|
+
const RightArrowIcon_svg_1 = __importDefault(require("../../../../assets/icons/RightArrowIcon.svg"));
|
|
13
|
+
const ChoiceNodeIcon_svg_1 = __importDefault(require("../../../../assets/icons/ChoiceNodeIcon.svg"));
|
|
14
|
+
const web_1 = require("@react-spring/web");
|
|
15
|
+
const colors_1 = require("../../../../config/colors");
|
|
16
|
+
const ChoiceNode = ({ nodeData, isProcessed, isFailed, failedNodeColor }) => {
|
|
17
|
+
const { setNode, node } = (0, react_1.useContext)(SettingsContext_1.SettingsContext);
|
|
18
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
19
|
+
const theme = (0, material_1.useTheme)();
|
|
20
|
+
const baseColor = theme.palette?.background?.paper || colors_1.Colors.WHITE;
|
|
21
|
+
const prevColorRef = (0, react_1.useRef)(baseColor);
|
|
22
|
+
const color = (isHovered || node?.id === nodeData?.id) ? colors_1.Colors.BLUE :
|
|
23
|
+
isFailed ? (failedNodeColor || colors_1.Colors.RED) :
|
|
24
|
+
isProcessed ? colors_1.Colors.GREEN :
|
|
25
|
+
baseColor;
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
|
+
prevColorRef.current = color;
|
|
28
|
+
}, [color]);
|
|
29
|
+
const isLongAction = (color === colors_1.Colors.GREEN || color === colors_1.Colors.RED || color === failedNodeColor) && prevColorRef.current !== colors_1.Colors.BLUE;
|
|
30
|
+
const onNodeClick = () => {
|
|
31
|
+
setNode(nodeData || null);
|
|
32
|
+
};
|
|
33
|
+
const props = (0, web_1.useSpring)({
|
|
34
|
+
stroke: color,
|
|
35
|
+
strokeWidth: 2,
|
|
36
|
+
strokeLinecap: 'round',
|
|
37
|
+
config: {
|
|
38
|
+
duration: isLongAction ? 1000 : 150
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const ChoiceNodeImg = (0, react_1.useMemo)(() => (0, styled_1.createChoiceNodeImg)(), [color, node?.id, nodeData?.id]);
|
|
42
|
+
const AnimatedChoiceNodeImg = (0, web_1.animated)(ChoiceNodeImg);
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(AnimatedChoiceNodeImg, { src: ChoiceNodeIcon_svg_1.default, style: props }), (0, jsx_runtime_1.jsx)(styled_1.Container, { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: onNodeClick, children: (0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, children: (0, jsx_runtime_1.jsx)(styled_1.ArrowImg, { src: LeftArrowIcon_svg_1.default, alt: "leftArrow" }) }), (0, jsx_runtime_1.jsx)(styled_1.NameGreed, { flexGrow: 1, item: true, children: nodeData?.name || nodeData?.extensionName }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, children: (0, jsx_runtime_1.jsx)(styled_1.ArrowImg, { src: RightArrowIcon_svg_1.default, alt: "RightArrow" }) })] }) })] }));
|
|
44
|
+
};
|
|
45
|
+
exports.default = ChoiceNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const createChoiceNodeImg: () => FC<any>;
|
|
4
|
+
export declare const NameGreed: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
classes?: Partial<import("@mui/material").GridClasses> | undefined;
|
|
7
|
+
columns?: import("@mui/system").ResponsiveStyleValue<number> | undefined;
|
|
8
|
+
columnSpacing?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridSpacing> | undefined;
|
|
9
|
+
container?: boolean | undefined;
|
|
10
|
+
direction?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridDirection> | undefined;
|
|
11
|
+
item?: boolean | undefined;
|
|
12
|
+
rowSpacing?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridSpacing> | undefined;
|
|
13
|
+
spacing?: import("@mui/system").ResponsiveStyleValue<import("@mui/material").GridSpacing> | undefined;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
wrap?: import("@mui/material").GridWrap | undefined;
|
|
16
|
+
zeroMinWidth?: boolean | undefined;
|
|
17
|
+
} & import("@mui/material").RegularBreakpoints & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
19
|
+
}, "item" | "columns" | "container" | "direction" | "children" | "wrap" | "spacing" | ("flex" | "height" | "width" | "left" | "top" | "alignContent" | "alignItems" | "alignSelf" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "bottom" | "boxShadow" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gap" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridRow" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "margin" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "overflow" | "padding" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "zIndex" | "p" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "sx" | "columnSpacing" | "rowSpacing" | keyof import("@mui/material/OverridableComponent").CommonProps | "zeroMinWidth" | keyof import("@mui/material").RegularBreakpoints> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, {}, {}>;
|
|
20
|
+
export declare const ArrowImg: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrowImg = exports.NameGreed = exports.createChoiceNodeImg = exports.Container = void 0;
|
|
4
|
+
const config_1 = require("../../../../config");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const system_1 = require("@mui/system");
|
|
7
|
+
const react_svg_1 = require("react-svg");
|
|
8
|
+
exports.Container = (0, system_1.styled)('div') `
|
|
9
|
+
min-width: 300px;
|
|
10
|
+
height: ${config_1.Config.NODE_HEIGHT}px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
align-items: center;
|
|
15
|
+
z-index: 1000;
|
|
16
|
+
`;
|
|
17
|
+
const createChoiceNodeImg = () => (0, system_1.styled)(react_svg_1.ReactSVG) `
|
|
18
|
+
top: -23px;
|
|
19
|
+
position: absolute;
|
|
20
|
+
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.1));
|
|
21
|
+
svg {
|
|
22
|
+
fill: ${props => `${props.theme.palette?.background?.paper}`};
|
|
23
|
+
stroke-width: 2;
|
|
24
|
+
stroke-linecap: round;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
exports.createChoiceNodeImg = createChoiceNodeImg;
|
|
28
|
+
exports.NameGreed = (0, system_1.styled)(material_1.Grid) `
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
font-size: 16px;
|
|
33
|
+
font-weight: 700;
|
|
34
|
+
color: ${props => `${props.theme.palette.text.primary}`};
|
|
35
|
+
font-family: Inter, 'circular', serif;;
|
|
36
|
+
`;
|
|
37
|
+
exports.ArrowImg = (0, system_1.styled)('img') `
|
|
38
|
+
margin-top: 5px;
|
|
39
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UpdateNodePosition } from "../../../common/types";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
interface IProps {
|
|
4
|
+
nodeId: string;
|
|
5
|
+
onUpdatePosition?: UpdateNodePosition;
|
|
6
|
+
}
|
|
7
|
+
export declare const DragWrapper: ({ children, nodeId, onUpdatePosition }: PropsWithChildren<IProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DragWrapper = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const useDragNode_1 = require("../../../common/hooks/useDragNode");
|
|
7
|
+
const DragWrapper = ({ children, nodeId, onUpdatePosition }) => {
|
|
8
|
+
const { isDragging, drag } = (0, useDragNode_1.useDragNode)({
|
|
9
|
+
id: nodeId || '',
|
|
10
|
+
onUpdate: onUpdatePosition,
|
|
11
|
+
});
|
|
12
|
+
const opacity = isDragging ? 0.4 : 1;
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { opacity, display: 'flex', justifyContent: 'center' }, ref: drag, onMouseDown: event => event.stopPropagation(), children: children }));
|
|
14
|
+
};
|
|
15
|
+
exports.DragWrapper = DragWrapper;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const styled_1 = require("./styled");
|
|
5
|
+
const EndNode = () => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)(styled_1.IconContainer, { children: (0, jsx_runtime_1.jsx)(styled_1.Icon, {}) }));
|
|
7
|
+
};
|
|
8
|
+
exports.default = EndNode;
|