Override joint.util.deepClone and remove ugly workaround
This commit is contained in:
10
package.json
10
package.json
@@ -46,8 +46,8 @@
|
||||
"dependencies": {
|
||||
"codemirror": "5.40.0",
|
||||
"jointjs": "2.1.4",
|
||||
"ts-disposables": "2.2.3",
|
||||
"postinstall-build": "5.0.3"
|
||||
"postinstall-build": "5.0.3",
|
||||
"ts-disposables": "2.2.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": ">=6.0.0 <7.0.0",
|
||||
@@ -69,18 +69,18 @@
|
||||
"@types/codemirror": "0.0.45",
|
||||
"@types/jasmine": "2.5.36",
|
||||
"@types/jquery": "3.3.4",
|
||||
"@types/lodash": "4.14.110",
|
||||
"@types/lodash": "3.10.2",
|
||||
"@types/node": "6.0.46",
|
||||
"camelcase": "4.0.0",
|
||||
"chalk": "2.4.1",
|
||||
"codemirror": "5.28.0",
|
||||
"codemirror": "5.40.0",
|
||||
"concurrently": "4.0.1",
|
||||
"core-js": "2.5.7",
|
||||
"glob": "7.1.1",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-inline-ng2-template": "5.0.1",
|
||||
"jasmine-core": "2.5.2",
|
||||
"jointjs": "2.1.3",
|
||||
"jointjs": "2.1.4",
|
||||
"jquery": "3.1.1",
|
||||
"jshint": "2.6.3",
|
||||
"karma": "1.5.0",
|
||||
|
||||
@@ -13,7 +13,9 @@ export class Utils {
|
||||
|
||||
_.chain(graph.getConnectedLinks(cell)).groupBy((link: dia.Link) => {
|
||||
// the key of the group is the model id of the link's source or target, but not our cell id.
|
||||
return _.omit([link.get('source').id, link.get('target').id], cell.id)[0];
|
||||
const sourceId = link.get('source').id;
|
||||
const targetId = link.get('target').id;
|
||||
return cell.id !== sourceId ? sourceId : targetId;
|
||||
}).each((group: any, key: string) => {
|
||||
// If the member of the group has both source and target model adjust vertices.
|
||||
let toRoute: any = {};
|
||||
|
||||
@@ -430,14 +430,11 @@ export class EditorComponent implements OnInit, OnDestroy {
|
||||
link.attr('.marker-vertices/display', 'none');
|
||||
link.attr('.connection-wrap/display', 'none');
|
||||
} else {
|
||||
// link.removeAttr('.link-tools/display');
|
||||
Flo.removeAttr(link, '.link-tools/display');
|
||||
link.removeAttr('.link-tools/display');
|
||||
if (this.editor && this.editor.allowLinkVertexEdit) {
|
||||
// link.removeAttr('.marker-vertices/display');
|
||||
Flo.removeAttr(link, '.marker-vertices/display');
|
||||
link.removeAttr('.marker-vertices/display');
|
||||
}
|
||||
// link.removeAttr('.connection-wrap/display');
|
||||
Flo.removeAttr(link, '.connection-wrap/display');
|
||||
link.removeAttr('.connection-wrap/display');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -238,14 +238,6 @@ export namespace Flo {
|
||||
}
|
||||
}
|
||||
|
||||
export function removeAttr(cell: dia.Cell, attr: string) {
|
||||
// Bug in JointJS removeAttr() kills all ES6 objects
|
||||
const idx = attr.lastIndexOf('/');
|
||||
const propertyConatiner = idx < 0 ? cell.attributes.attrs : cell.attr(attr.substring(0, idx));
|
||||
const key = idx < 0 ? attr : attr.substr(idx + 1);
|
||||
delete propertyConatiner[key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -248,9 +248,7 @@ export namespace Properties {
|
||||
if (currentValue !== undefined && currentValue !== null) {
|
||||
// Remove attr doesn't fire appropriate event. Set default value first as a workaround to schedule DSL resync
|
||||
this.cell.attr(property.attr, property.defaultValue === undefined ? null : property.defaultValue);
|
||||
// Bug in JointJS removeAttr() kills all ES6 objects
|
||||
// this.cell.removeAttr(property.attr);
|
||||
Flo.removeAttr(this.cell, property.attr);
|
||||
this.cell.removeAttr(property.attr);
|
||||
}
|
||||
} else {
|
||||
this.cell.attr(property.attr, property.value);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { dia } from 'jointjs';
|
||||
import { Flo } from './flo-common';
|
||||
import EditorDescriptor = Flo.ViewerDescriptor;
|
||||
import * as _ from 'lodash';
|
||||
import * as _$ from 'jquery';
|
||||
const joint: any = Flo.joint;
|
||||
@@ -31,6 +30,15 @@ const DECORATION_ICON_MAP: Map<string, string> = new Map<string, string>();
|
||||
const ERROR = 'error';
|
||||
DECORATION_ICON_MAP.set(ERROR, 'icons/error.svg');
|
||||
|
||||
|
||||
joint.util.cloneDeep = (obj: any) => {
|
||||
return _.cloneDeep(obj, (o) => {
|
||||
if (_.isObject(o) && !_.isPlainObject(o)) {
|
||||
return o;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
joint.util.filter.redscale = (args: Shapes.FilterOptions) => {
|
||||
|
||||
let amount = Number.isFinite(args.amount) ? args.amount : 1;
|
||||
|
||||
Reference in New Issue
Block a user