refactor(parsedata): destruct data

This commit is contained in:
moklick
2019-08-06 16:41:58 +02:00
parent fbbd0a93ba
commit 59cd72ddef
5 changed files with 46 additions and 39 deletions
+14 -12
View File
@@ -29835,21 +29835,23 @@
}; };
var parseElement = function parseElement(e) { var parseElement = function parseElement(e) {
e.type = e.type || 'default';
if (isEdge(e)) { if (isEdge(e)) {
e.id = e.id ? e.id.toString() : getEdgeId(e); return _objectSpread2({}, e, {
return e; type: e.type || 'default',
id: e.id ? e.id.toString() : getEdgeId(e)
});
} }
e.id = e.id.toString(); return _objectSpread2({}, e, {
e.__rg = { id: e.id.toString(),
position: e.position, type: e.type || 'default',
width: null, __rg: {
height: null, position: e.position,
handleBounds: {} width: null,
}; height: null,
return _objectSpread2({}, e); handleBounds: {}
}
});
}; };
var getBoundingBox = function getBoundingBox(nodes) { var getBoundingBox = function getBoundingBox(nodes) {
var bbox = nodes.reduce(function (res, node) { var bbox = nodes.reduce(function (res, node) {
+15 -13
View File
@@ -37639,21 +37639,23 @@ var getEdgeId = function getEdgeId(e) {
}; };
var parseElement = function parseElement(e) { var parseElement = function parseElement(e) {
e.type = e.type || 'default';
if (isEdge(e)) { if (isEdge(e)) {
e.id = e.id ? e.id.toString() : getEdgeId(e); return _objectSpread({}, e, {
return e; type: e.type || 'default',
id: e.id ? e.id.toString() : getEdgeId(e)
});
} }
e.id = e.id.toString(); return _objectSpread({}, e, {
e.__rg = { id: e.id.toString(),
position: e.position, type: e.type || 'default',
width: null, __rg: {
height: null, position: e.position,
handleBounds: {} width: null,
}; height: null,
return _objectSpread({}, e); handleBounds: {}
}
});
}; };
exports.parseElement = parseElement; exports.parseElement = parseElement;
@@ -42916,7 +42918,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "61389" + '/'); var ws = new WebSocket(protocol + '://' + hostname + ':' + "52012" + '/');
ws.onmessage = function (event) { ws.onmessage = function (event) {
checkedAssets = {}; checkedAssets = {};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname; var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "61389" + '/'); var ws = new WebSocket(protocol + '://' + hostname + ':' + "52012" + '/');
ws.onmessage = function (event) { ws.onmessage = function (event) {
checkedAssets = {}; checkedAssets = {};
+15 -12
View File
@@ -26,22 +26,25 @@ export const removeElements = (elements, elementsToRemove) => {
const getEdgeId = (e) => `react-graph__edge-${e.source}-${e.target}`; const getEdgeId = (e) => `react-graph__edge-${e.source}-${e.target}`;
export const parseElement = (e) => { export const parseElement = (e) => {
e.type = e.type || 'default';
if (isEdge(e)) { if (isEdge(e)) {
e.id = e.id ? e.id.toString() : getEdgeId(e); return {
return e; ...e,
type: e.type || 'default',
id: e.id ? e.id.toString() : getEdgeId(e)
};
} }
e.id = e.id.toString(); return {
e.__rg = { ...e,
position: e.position, id: e.id.toString(),
width: null, type: e.type || 'default',
height: null, __rg: {
handleBounds : {} position: e.position,
width: null,
height: null,
handleBounds : {}
}
}; };
return { ...e };
}; };
export const separateElements = (res, element) => { export const separateElements = (res, element) => {