UNPKG

@eccenca/gui-elements

Version:

GUI elements based on other libraries, usable in React application, written in Typescript.

45 lines 1.9 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import React from "react"; import { ConnectionLineType, } from "@xyflow/react"; import { EdgeStraight, EdgeStep, EdgeBezier } from "./../index.js"; import { CLASSPREFIX as eccgui } from "../../../configuration/constants.js"; export var EdgeNew = function (edgeNewProps) { var connectionLineType = edgeNewProps.connectionLineType, fromX = edgeNewProps.fromX, fromY = edgeNewProps.fromY, toX = edgeNewProps.toX, toY = edgeNewProps.toY, connectionStatus = edgeNewProps.connectionStatus, fromPosition = edgeNewProps.fromPosition, toPosition = edgeNewProps.toPosition; var EdgeType; switch (connectionLineType) { case ConnectionLineType.Step: case ConnectionLineType.SmoothStep: EdgeType = EdgeStep; break; case ConnectionLineType.Bezier: case ConnectionLineType.SimpleBezier: EdgeType = EdgeBezier; break; default: EdgeType = EdgeStraight; } return React.createElement(EdgeType, __assign({}, { sourceX: fromX, sourceY: fromY, targetX: toX, targetY: toY, sourcePosition: fromPosition, targetPosition: toPosition, data: { strokeType: !connectionStatus ? "dashed" : undefined, edgeSvgProps: { className: "".concat(eccgui, "-graphviz__edge--dragged") }, intent: connectionStatus === "valid" ? "success" : connectionStatus === "invalid" ? "warning" : "accent" }, })); }; //# sourceMappingURL=EdgeNew.js.map