@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
35 lines • 1.59 kB
JavaScript
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, { memo } from "react";
import { getSmoothStepPath } from "@xyflow/react";
import { ReactFlowVersions, useReactFlowVersion } from "../versionsupport.js";
import { EdgeDefault } from "./EdgeDefault.js";
import { drawEdgeStep } from "./utils.js";
/**
* This element cannot be used directly, it must be connected via a `edgeTypes` definition.
* @see https://reactflow.dev/docs/api/nodes/
*/
export var EdgeStep = memo(function (props) {
var flowVersionCheck = useReactFlowVersion();
switch (flowVersionCheck) {
case ReactFlowVersions.V9:
return React.createElement(EdgeDefault, __assign({}, props, { drawSvgPath: drawEdgeStep }));
case ReactFlowVersions.V12:
return (React.createElement(EdgeDefault, __assign({}, props, { getPath: function (params) {
var _a, _b;
return getSmoothStepPath(__assign(__assign({}, params), { borderRadius: (_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a.stepCornerRadius) !== null && _b !== void 0 ? _b : 7 }));
} })));
default:
return React.createElement(React.Fragment, null);
}
});
//# sourceMappingURL=EdgeStep.js.map