refactor(nodewrap): dont pass all props
This commit is contained in:
Vendored
+36
-47
@@ -33224,7 +33224,12 @@
|
||||
};
|
||||
|
||||
var _onStart = function onStart(evt, _ref) {
|
||||
var setOffset = _ref.setOffset,
|
||||
var dispatch = _ref.dispatch,
|
||||
setOffset = _ref.setOffset,
|
||||
onClick = _ref.onClick,
|
||||
id = _ref.id,
|
||||
type = _ref.type,
|
||||
data = _ref.data,
|
||||
position = _ref.position,
|
||||
transform = _ref.transform;
|
||||
|
||||
@@ -33238,10 +33243,21 @@
|
||||
};
|
||||
var offsetX = scaledClient.x - position.x - [transform[0]];
|
||||
var offsetY = scaledClient.y - position.y - [transform[1]];
|
||||
var node = {
|
||||
id: id,
|
||||
type: type,
|
||||
position: position,
|
||||
data: data
|
||||
};
|
||||
dispatch(setSelectedElements({
|
||||
id: id,
|
||||
type: type
|
||||
}));
|
||||
setOffset({
|
||||
x: offsetX,
|
||||
y: offsetY
|
||||
});
|
||||
onClick(node);
|
||||
};
|
||||
|
||||
var _onDrag = function onDrag(evt, _ref2) {
|
||||
@@ -33261,40 +33277,15 @@
|
||||
}));
|
||||
};
|
||||
|
||||
var onNodeClick = function onNodeClick(evt, _ref3) {
|
||||
var onClick = _ref3.onClick,
|
||||
dispatch = _ref3.dispatch,
|
||||
var _onStop = function onStop(_ref3) {
|
||||
var onNodeDragStop = _ref3.onNodeDragStop,
|
||||
setDragging = _ref3.setDragging,
|
||||
isDragging = _ref3.isDragging,
|
||||
id = _ref3.id,
|
||||
type = _ref3.type,
|
||||
position = _ref3.position,
|
||||
data = _ref3.data;
|
||||
|
||||
if (isInput(evt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var node = {
|
||||
id: id,
|
||||
type: type,
|
||||
position: position,
|
||||
data: data
|
||||
};
|
||||
dispatch(setSelectedElements({
|
||||
id: id,
|
||||
type: type
|
||||
}));
|
||||
onClick(node);
|
||||
};
|
||||
|
||||
var _onStop = function onStop(_ref4) {
|
||||
var onNodeDragStop = _ref4.onNodeDragStop,
|
||||
setDragging = _ref4.setDragging,
|
||||
isDragging = _ref4.isDragging,
|
||||
id = _ref4.id,
|
||||
type = _ref4.type,
|
||||
position = _ref4.position,
|
||||
data = _ref4.data;
|
||||
|
||||
if (!isDragging) {
|
||||
return false;
|
||||
}
|
||||
@@ -33333,9 +33324,9 @@
|
||||
yPos = props.yPos,
|
||||
selected = props.selected,
|
||||
dispatch = props.dispatch,
|
||||
getNodeById = props.getNodeById,
|
||||
_onClick = props.onClick,
|
||||
onNodeDragStop = props.onNodeDragStop;
|
||||
onClick = props.onClick,
|
||||
onNodeDragStop = props.onNodeDragStop,
|
||||
style = props.style;
|
||||
var position = {
|
||||
x: xPos,
|
||||
y: yPos
|
||||
@@ -33364,6 +33355,11 @@
|
||||
return React__default.createElement(reactDraggable.DraggableCore, {
|
||||
onStart: function onStart(evt) {
|
||||
return _onStart(evt, {
|
||||
dispatch: dispatch,
|
||||
onClick: onClick,
|
||||
id: id,
|
||||
type: type,
|
||||
data: data,
|
||||
setOffset: setOffset,
|
||||
transform: transform,
|
||||
position: position
|
||||
@@ -33393,23 +33389,16 @@
|
||||
}, React__default.createElement("div", {
|
||||
className: nodeClasses,
|
||||
ref: nodeElement,
|
||||
style: nodeStyle,
|
||||
onClick: function onClick(evt) {
|
||||
return onNodeClick(evt, {
|
||||
getNodeById: getNodeById,
|
||||
onClick: _onClick,
|
||||
dispatch: dispatch,
|
||||
id: id,
|
||||
type: type,
|
||||
position: position,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
style: nodeStyle
|
||||
}, React__default.createElement(Provider$2, {
|
||||
value: id
|
||||
}, React__default.createElement(NodeComponent, _extends({}, props, {
|
||||
}, React__default.createElement(NodeComponent, {
|
||||
id: id,
|
||||
data: data,
|
||||
type: type,
|
||||
style: style,
|
||||
selected: selected
|
||||
})))));
|
||||
}))));
|
||||
});
|
||||
WrappedComp.displayName = 'Wrapped Node';
|
||||
WrappedComp.whyDidYouRender = false;
|
||||
|
||||
Reference in New Issue
Block a user