fix(rg): destruct props

This commit is contained in:
moklick
2019-08-19 15:36:06 +02:00
parent df216aa875
commit 3c9b152e1b
2 changed files with 14 additions and 12 deletions
+8 -6
View File
@@ -33884,6 +33884,8 @@
onElementClick = _ref.onElementClick, onElementClick = _ref.onElementClick,
elements = _ref.elements, elements = _ref.elements,
children = _ref.children, children = _ref.children,
nodeTypes = _ref.nodeTypes,
edgeTypes = _ref.edgeTypes,
onLoad = _ref.onLoad, onLoad = _ref.onLoad,
onMove = _ref.onMove, onMove = _ref.onMove,
onElementsRemove = _ref.onElementsRemove, onElementsRemove = _ref.onElementsRemove,
@@ -33891,11 +33893,11 @@
onNodeDragStop = _ref.onNodeDragStop, onNodeDragStop = _ref.onNodeDragStop,
connectionLineType = _ref.connectionLineType, connectionLineType = _ref.connectionLineType,
connectionLineStyle = _ref.connectionLineStyle; connectionLineStyle = _ref.connectionLineStyle;
var nodeTypes = React.useMemo(function () { var nodeTypesParsed = React.useMemo(function () {
return createNodeTypes(props.nodeTypes); return createNodeTypes(nodeTypes);
}, []); }, []);
var edgeTypes = React.useMemo(function () { var edgeTypesParsed = React.useMemo(function () {
return createEdgeTypes(props.edgeTypes); return createEdgeTypes(edgeTypes);
}, []); }, []);
return React__default.createElement("div", { return React__default.createElement("div", {
style: style, style: style,
@@ -33907,8 +33909,8 @@
onMove: onMove, onMove: onMove,
onElementClick: onElementClick, onElementClick: onElementClick,
onNodeDragStop: onNodeDragStop, onNodeDragStop: onNodeDragStop,
nodeTypes: nodeTypes, nodeTypes: nodeTypesParsed,
edgeTypes: edgeTypes, edgeTypes: edgeTypesParsed,
connectionLineType: connectionLineType, connectionLineType: connectionLineType,
connectionLineStyle: connectionLineStyle, connectionLineStyle: connectionLineStyle,
onConnect: onConnect onConnect: onConnect
+6 -6
View File
@@ -23,11 +23,11 @@ import '../style.css';
const ReactGraph = ({ const ReactGraph = ({
style, onElementClick, elements, children, style, onElementClick, elements, children,
onLoad, onMove, onElementsRemove, onConnect, nodeTypes, edgeTypes, onLoad, onMove, onElementsRemove,
onNodeDragStop, connectionLineType, connectionLineStyle onConnect, onNodeDragStop, connectionLineType, connectionLineStyle
}) => { }) => {
const nodeTypes = useMemo(() => createNodeTypes(props.nodeTypes), []); const nodeTypesParsed = useMemo(() => createNodeTypes(nodeTypes), []);
const edgeTypes = useMemo(() => createEdgeTypes(props.edgeTypes), []); const edgeTypesParsed = useMemo(() => createEdgeTypes(edgeTypes), []);
return ( return (
<div style={style} className="react-graph"> <div style={style} className="react-graph">
@@ -37,8 +37,8 @@ const ReactGraph = ({
onMove={onMove} onMove={onMove}
onElementClick={onElementClick} onElementClick={onElementClick}
onNodeDragStop={onNodeDragStop} onNodeDragStop={onNodeDragStop}
nodeTypes={nodeTypes} nodeTypes={nodeTypesParsed}
edgeTypes={edgeTypes} edgeTypes={edgeTypesParsed}
connectionLineType={connectionLineType} connectionLineType={connectionLineType}
connectionLineStyle={connectionLineStyle} connectionLineStyle={connectionLineStyle}
onConnect={onConnect} onConnect={onConnect}