@dualbox/editor 1.0.78 → 1.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/dist/GraphEditor.js +554 -269
- package/js/dist/GraphEditor.min.js +553 -268
- package/js/src/m/GraphModel.js +90 -21
- package/js/src/v/templates/graphNode.vue +481 -265
- package/package.json +4 -4
|
@@ -44508,6 +44508,29 @@ class GraphNode {
|
|
|
44508
44508
|
}
|
|
44509
44509
|
}
|
|
44510
44510
|
|
|
44511
|
+
checkTypeMatch(type, val) {
|
|
44512
|
+
let lowercaseType = type.toLowerCase();
|
|
44513
|
+
switch (lowercaseType) {
|
|
44514
|
+
case "string":
|
|
44515
|
+
if (typeof val !== "string") {
|
|
44516
|
+
throw "Expected string type but got " + type;
|
|
44517
|
+
}
|
|
44518
|
+
break;
|
|
44519
|
+
case "number":
|
|
44520
|
+
if (typeof val !== "number") {
|
|
44521
|
+
throw "Expected number type but got " + type;
|
|
44522
|
+
}
|
|
44523
|
+
break;
|
|
44524
|
+
case "boolean":
|
|
44525
|
+
if (typeof val !== "boolean") {
|
|
44526
|
+
throw "Expected boolean type but got " + type;
|
|
44527
|
+
}
|
|
44528
|
+
break;
|
|
44529
|
+
default:
|
|
44530
|
+
break;
|
|
44531
|
+
}
|
|
44532
|
+
}
|
|
44533
|
+
|
|
44511
44534
|
getInputDefaultValue(inputName) {
|
|
44512
44535
|
var pkg = this.getPackage();
|
|
44513
44536
|
var pkgDefault = pkg && pkg.dualbox && pkg.dualbox.input && pkg.dualbox.input[inputName] && pkg.dualbox.input[inputName].value;
|
|
@@ -44521,6 +44544,7 @@ class GraphNode {
|
|
|
44521
44544
|
}
|
|
44522
44545
|
|
|
44523
44546
|
setInputDefaultValue(inputName, val) {
|
|
44547
|
+
this.checkTypeMatch(this.getInputType(inputName), val);
|
|
44524
44548
|
this.def.defaultInputs = this.def.defaultInputs || {};
|
|
44525
44549
|
this.def.defaultInputs[inputName] = val;
|
|
44526
44550
|
this.m.save();
|
|
@@ -44599,6 +44623,7 @@ class GraphNode {
|
|
|
44599
44623
|
}
|
|
44600
44624
|
|
|
44601
44625
|
setAttributeValue(attrName, val) {
|
|
44626
|
+
this.checkTypeMatch(this.getAttributeType(attrName), val);
|
|
44602
44627
|
this.def.attr = this.def.attr || {};
|
|
44603
44628
|
this.def.attr[attrName] = val;
|
|
44604
44629
|
this.m.save();
|
|
@@ -45397,34 +45422,78 @@ class GraphNode {
|
|
|
45397
45422
|
// Deep search and replaces the given property value "prevVal" with "newVal"
|
|
45398
45423
|
|
|
45399
45424
|
// remove the ui of id "id" from interface
|
|
45400
|
-
var removeFromInterface = (o, id) => {
|
|
45401
|
-
|
|
45402
|
-
|
|
45403
|
-
|
|
45404
|
-
|
|
45405
|
-
|
|
45406
|
-
|
|
45407
|
-
|
|
45408
|
-
|
|
45409
|
-
|
|
45410
|
-
|
|
45411
|
-
|
|
45412
|
-
|
|
45413
|
-
|
|
45414
|
-
|
|
45425
|
+
// var removeFromInterface = (o, id) => {
|
|
45426
|
+
// let newObject = _.clone(o);
|
|
45427
|
+
|
|
45428
|
+
// if (typeof o === "object" || typeof o === "array") {
|
|
45429
|
+
// for (let [key, val] of Object.entries(o)) {
|
|
45430
|
+
// let nodeId = _.get(val, ["attributes", "dataset", "node"]);
|
|
45431
|
+
// if (nodeId == id) {
|
|
45432
|
+
// _.unset(newObject, key);
|
|
45433
|
+
// } else {
|
|
45434
|
+
// newObject[key] = removeFromInterface(val, id);
|
|
45435
|
+
// }
|
|
45436
|
+
// }
|
|
45437
|
+
// }
|
|
45438
|
+
|
|
45439
|
+
// return newObject;
|
|
45440
|
+
// }
|
|
45441
|
+
// app.interface = removeFromInterface(app.interface, this.id);
|
|
45442
|
+
|
|
45443
|
+
var getUIPath = (o, id, path = []) => {
|
|
45444
|
+
let p = lodash.clone(path);
|
|
45445
|
+
let identification = ["attributes", "dataset", "node"];
|
|
45446
|
+
|
|
45447
|
+
if (typeof o === "object" || typeof o === "array") {
|
|
45448
|
+
for (let [key, val] of Object.entries(o)) {
|
|
45449
|
+
let nodeId = lodash.get(val, identification);
|
|
45450
|
+
if (nodeId == id) {
|
|
45451
|
+
return path.concat(key);
|
|
45415
45452
|
} else {
|
|
45416
|
-
|
|
45453
|
+
let fullpath = getUIPath(val, id, path.concat(key));
|
|
45454
|
+
if (fullpath !== null) {
|
|
45455
|
+
return fullpath;
|
|
45456
|
+
}
|
|
45417
45457
|
}
|
|
45418
45458
|
}
|
|
45419
|
-
}
|
|
45459
|
+
} else {
|
|
45460
|
+
return null;
|
|
45461
|
+
}
|
|
45420
45462
|
|
|
45421
|
-
if
|
|
45422
|
-
|
|
45463
|
+
// if we arrive here, we didn't find a valid path parcouring children nodes
|
|
45464
|
+
return null;
|
|
45465
|
+
};
|
|
45466
|
+
|
|
45467
|
+
var removePath = (json, path) => {
|
|
45468
|
+
if (isNaN(parseInt(lodash.last(path)))) {
|
|
45469
|
+
lodash.unset(json, path); // not an array
|
|
45423
45470
|
} else {
|
|
45424
|
-
|
|
45471
|
+
// Check if it's an object or an element in an array
|
|
45472
|
+
if (path.length > 1) {
|
|
45473
|
+
let p = lodash.clone(path);
|
|
45474
|
+
let last = p.pop();
|
|
45475
|
+
|
|
45476
|
+
let parent = lodash.get(json, p);
|
|
45477
|
+
if (Array.isArray(parent)) {
|
|
45478
|
+
// Array, use _.remove instead
|
|
45479
|
+
lodash.remove(parent, (v, k) => k == last);
|
|
45480
|
+
lodash.set(json, p, parent);
|
|
45481
|
+
} else {
|
|
45482
|
+
lodash.unset(json, path); // not an array
|
|
45483
|
+
}
|
|
45484
|
+
} else {
|
|
45485
|
+
lodash.unset(json, path); // not an array
|
|
45486
|
+
}
|
|
45425
45487
|
}
|
|
45488
|
+
|
|
45489
|
+
return json;
|
|
45426
45490
|
};
|
|
45427
|
-
|
|
45491
|
+
|
|
45492
|
+
let UIFullPath = getUIPath(app.interface, this.id);
|
|
45493
|
+
console.log("Found UI " + this.id + " at path " + UIFullPath);
|
|
45494
|
+
if (UIFullPath !== null) {
|
|
45495
|
+
app.interface = removePath(app.interface, UIFullPath);
|
|
45496
|
+
}
|
|
45428
45497
|
|
|
45429
45498
|
// remove this node from all app events (API) using it
|
|
45430
45499
|
var removeFromAppEvents = (o, id) => {
|
|
@@ -46460,53 +46529,92 @@ $.fn.fixCardDisplay = function() {
|
|
|
46460
46529
|
var offsetPoint = 12;
|
|
46461
46530
|
var offsetBorder = parseInt($(this).css("border-top-width"));
|
|
46462
46531
|
|
|
46463
|
-
if
|
|
46532
|
+
// if we have width or height set to 0, we are not ready yet to
|
|
46533
|
+
// execute this function. Postpone it.
|
|
46534
|
+
if( $(this).width() === 0 || $(this).height() === 0 ) {
|
|
46535
|
+
setTimeout(() => {
|
|
46536
|
+
$(this).fixCardDisplay();
|
|
46537
|
+
}, 50);
|
|
46538
|
+
return;
|
|
46539
|
+
}
|
|
46540
|
+
|
|
46541
|
+
if (
|
|
46542
|
+
$(this)
|
|
46543
|
+
.find(".box-inputs")
|
|
46544
|
+
.height() === 0 &&
|
|
46545
|
+
$(this)
|
|
46546
|
+
.find(".box-outputs")
|
|
46547
|
+
.height() === 0
|
|
46548
|
+
) {
|
|
46464
46549
|
// if this card has no input/output, remove the card center
|
|
46465
|
-
$(this)
|
|
46550
|
+
$(this)
|
|
46551
|
+
.find(".card-center")
|
|
46552
|
+
.remove();
|
|
46466
46553
|
} else {
|
|
46467
46554
|
// else, adjust the input/output display for endpoints
|
|
46468
46555
|
// 1) translate inputs by the right amount of pixels to have the circle on the line
|
|
46469
|
-
var boxInputs = $(this).find(
|
|
46556
|
+
var boxInputs = $(this).find(".box-inputs");
|
|
46470
46557
|
|
|
46471
46558
|
// fix css names width
|
|
46472
|
-
var namesDiv = boxInputs.find(
|
|
46473
|
-
namesDiv.css(
|
|
46559
|
+
var namesDiv = boxInputs.find(".names");
|
|
46560
|
+
namesDiv.css("width", namesDiv.width() + 1 + "px");
|
|
46474
46561
|
|
|
46475
46562
|
// translate inputs to the left
|
|
46476
|
-
var translateLeft =
|
|
46477
|
-
|
|
46563
|
+
var translateLeft =
|
|
46564
|
+
boxInputs.find(".types").width() + offsetPoint + offsetBorder / 2;
|
|
46565
|
+
$(this)
|
|
46566
|
+
.find(".box-inputs")
|
|
46567
|
+
.css("transform", "translateX(-" + translateLeft + "px)");
|
|
46478
46568
|
|
|
46479
46569
|
// adjust inputs main div width
|
|
46480
|
-
$(this)
|
|
46481
|
-
|
|
46570
|
+
$(this)
|
|
46571
|
+
.find(".inputs")
|
|
46572
|
+
.width(
|
|
46573
|
+
$(this)
|
|
46574
|
+
.find(".inputs")
|
|
46575
|
+
.width() -
|
|
46576
|
+
translateLeft +
|
|
46577
|
+
10 /* margin */
|
|
46578
|
+
);
|
|
46482
46579
|
|
|
46483
46580
|
// 2) translate outputs by the right amount of pixels to have the circle on the line
|
|
46484
|
-
var boxOutputs = $(this).find(
|
|
46581
|
+
var boxOutputs = $(this).find(".box-outputs");
|
|
46485
46582
|
|
|
46486
46583
|
// fix css names with
|
|
46487
|
-
var namesDiv = boxOutputs.find(
|
|
46488
|
-
namesDiv.css(
|
|
46584
|
+
var namesDiv = boxOutputs.find(".names");
|
|
46585
|
+
namesDiv.css("width", namesDiv.width() + 1 + "px");
|
|
46489
46586
|
|
|
46490
46587
|
// translate inputs to the right
|
|
46491
|
-
var translateRight =
|
|
46492
|
-
|
|
46588
|
+
var translateRight =
|
|
46589
|
+
boxOutputs.find(".types").width() + offsetPoint + offsetBorder / 2;
|
|
46590
|
+
$(this)
|
|
46591
|
+
.find(".box-outputs")
|
|
46592
|
+
.css("transform", "translateX(" + translateRight + "px)");
|
|
46493
46593
|
|
|
46494
46594
|
// adjust output main div width
|
|
46495
|
-
$(this)
|
|
46595
|
+
$(this)
|
|
46596
|
+
.find(".outputs")
|
|
46597
|
+
.width(
|
|
46598
|
+
$(this)
|
|
46599
|
+
.find(".outputs")
|
|
46600
|
+
.width() -
|
|
46601
|
+
translateRight +
|
|
46602
|
+
10 /* margin */
|
|
46603
|
+
);
|
|
46496
46604
|
|
|
46497
46605
|
// fix io width
|
|
46498
46606
|
//$('.dualbox-io').css('width', (($(this).find('.inputs').width() + $(this).find('.outputs').width()) + "px"));
|
|
46499
46607
|
}
|
|
46500
|
-
};
|
|
46501
46608
|
|
|
46502
|
-
|
|
46503
|
-
|
|
46504
|
-
|
|
46505
|
-
|
|
46506
|
-
|
|
46507
|
-
|
|
46508
|
-
|
|
46509
|
-
|
|
46609
|
+
$(this).ready(() => {
|
|
46610
|
+
// take the current width and add it as a css property
|
|
46611
|
+
var width = $(this).width();
|
|
46612
|
+
width += parseInt($(this).css("padding-right"));
|
|
46613
|
+
width += parseInt($(this).css("padding-left"));
|
|
46614
|
+
width += parseInt($(this).css("border-left-width"));
|
|
46615
|
+
width += parseInt($(this).css("border-right-width"));
|
|
46616
|
+
$(this).css("width", Math.ceil(width) + "px");
|
|
46617
|
+
});
|
|
46510
46618
|
};
|
|
46511
46619
|
|
|
46512
46620
|
// find position of element relative to an ancestor matching selector
|
|
@@ -46516,8 +46624,8 @@ $.fn.positionFrom = function(selector) {
|
|
|
46516
46624
|
var ancestorOffset = ancestor.offset();
|
|
46517
46625
|
return {
|
|
46518
46626
|
top: offset.top - ancestorOffset.top,
|
|
46519
|
-
left: offset.left - ancestorOffset.left
|
|
46520
|
-
}
|
|
46627
|
+
left: offset.left - ancestorOffset.left
|
|
46628
|
+
};
|
|
46521
46629
|
};
|
|
46522
46630
|
|
|
46523
46631
|
var script = {
|
|
@@ -46526,20 +46634,21 @@ var script = {
|
|
|
46526
46634
|
"pkg", // the module package.json
|
|
46527
46635
|
"n", // the GraphNode object (from model)
|
|
46528
46636
|
"example", // true if this vue is used as an example display (no need to connect)
|
|
46529
|
-
"displayEvents"
|
|
46637
|
+
"displayEvents" // true if events should be displayed
|
|
46530
46638
|
],
|
|
46531
46639
|
data: function() {
|
|
46532
46640
|
return {
|
|
46533
46641
|
shortName: "",
|
|
46534
|
-
point:
|
|
46535
|
-
|
|
46642
|
+
point:
|
|
46643
|
+
'<svg width="14" height="14" pointer-events="all" position="absolute" version="1.1" xmlns="http://www.w3.org/1999/xhtml"><circle cx="7" cy="7" r="5" version="1.1" xmlns="http://www.w3.org/1999/xhtml" fill="#ffffff" stroke="#727272" style="" stroke-width="2"></circle></svg>'
|
|
46644
|
+
};
|
|
46536
46645
|
},
|
|
46537
46646
|
beforeUpdate: function() {
|
|
46538
46647
|
//console.log('[UPDATING] ' + this.n.getUniqId());
|
|
46539
46648
|
},
|
|
46540
46649
|
destroyed: function() {
|
|
46541
46650
|
this.deactivateTooltip();
|
|
46542
|
-
$(
|
|
46651
|
+
$(".tooltip").remove();
|
|
46543
46652
|
},
|
|
46544
46653
|
created: function() {
|
|
46545
46654
|
this.initialized = false;
|
|
@@ -46557,11 +46666,6 @@ var script = {
|
|
|
46557
46666
|
//console.log('[MOUNTED] ' + this.n.getUniqId());
|
|
46558
46667
|
var div = $(this.$el);
|
|
46559
46668
|
div.fixCardDisplay();
|
|
46560
|
-
div.ready(() => {
|
|
46561
|
-
//if( !this.example ) {
|
|
46562
|
-
div.fixWidth();
|
|
46563
|
-
//}
|
|
46564
|
-
});
|
|
46565
46669
|
this.activateTooltip();
|
|
46566
46670
|
return await this.initialize();
|
|
46567
46671
|
},
|
|
@@ -46577,7 +46681,6 @@ var script = {
|
|
|
46577
46681
|
|
|
46578
46682
|
$(this.$el).fixCardDisplay();
|
|
46579
46683
|
$(this.$el).ready(() => {
|
|
46580
|
-
$(this.$el).fixWidth();
|
|
46581
46684
|
this.activateTooltip();
|
|
46582
46685
|
});
|
|
46583
46686
|
return await this.initialize();
|
|
@@ -46592,15 +46695,19 @@ var script = {
|
|
|
46592
46695
|
getId: function() {
|
|
46593
46696
|
// if this is an example graphNode, change our "id" to "id-junk"
|
|
46594
46697
|
// to avoid connection jsplumb conflicts with the real node
|
|
46595
|
-
return this.example ? this.id +
|
|
46698
|
+
return this.example ? this.id + "-junk" : this.id;
|
|
46596
46699
|
},
|
|
46597
46700
|
|
|
46598
46701
|
activateTooltip: function() {
|
|
46599
|
-
$(this.$el)
|
|
46702
|
+
$(this.$el)
|
|
46703
|
+
.find('[data-toggle="tooltip"]')
|
|
46704
|
+
.tooltip();
|
|
46600
46705
|
},
|
|
46601
46706
|
|
|
46602
46707
|
deactivateTooltip: function() {
|
|
46603
|
-
$(this.$el)
|
|
46708
|
+
$(this.$el)
|
|
46709
|
+
.find('[data-toggle="tooltip"]')
|
|
46710
|
+
.tooltip("dispose");
|
|
46604
46711
|
},
|
|
46605
46712
|
|
|
46606
46713
|
initialize: async function() {
|
|
@@ -46616,12 +46723,17 @@ var script = {
|
|
|
46616
46723
|
var def = this.n.getDef();
|
|
46617
46724
|
var position = lodash.get(def, ["graph", "position"]);
|
|
46618
46725
|
if (position) {
|
|
46619
|
-
var jsPlumbElement = self.$parent.jsPlumbInstance.getElement(
|
|
46620
|
-
|
|
46726
|
+
var jsPlumbElement = self.$parent.jsPlumbInstance.getElement(
|
|
46727
|
+
id
|
|
46728
|
+
);
|
|
46729
|
+
self.$parent.jsPlumbInstance.setPosition(
|
|
46730
|
+
jsPlumbElement,
|
|
46731
|
+
position
|
|
46732
|
+
);
|
|
46621
46733
|
}
|
|
46622
46734
|
|
|
46623
46735
|
// This needs to be registered before draggable
|
|
46624
|
-
div.on(
|
|
46736
|
+
div.on("mousedown", function(e) {
|
|
46625
46737
|
// if this div is not selected already, deselect the other divs
|
|
46626
46738
|
if (!self.$parent.selector.isSelected(this)) {
|
|
46627
46739
|
self.$parent.selector.deselect();
|
|
@@ -46656,228 +46768,387 @@ var script = {
|
|
|
46656
46768
|
|
|
46657
46769
|
if (!this.example) {
|
|
46658
46770
|
// If this node was never initialized in this jsplumb instance, do it
|
|
46659
|
-
if (
|
|
46660
|
-
lodash.
|
|
46771
|
+
if (
|
|
46772
|
+
!lodash.get(this.$parent.jsPlumbInstance, [
|
|
46773
|
+
"initializedNodes",
|
|
46774
|
+
id
|
|
46775
|
+
])
|
|
46776
|
+
) {
|
|
46777
|
+
lodash.set(
|
|
46778
|
+
this.$parent.jsPlumbInstance,
|
|
46779
|
+
["initializedNodes", id],
|
|
46780
|
+
true
|
|
46781
|
+
); // initialized
|
|
46661
46782
|
|
|
46662
46783
|
if (this.n.isInput() || this.n.isOutput()) {
|
|
46663
46784
|
var input = "value";
|
|
46664
46785
|
var output = "value";
|
|
46665
|
-
var offsetTop =
|
|
46666
|
-
|
|
46667
|
-
|
|
46668
|
-
|
|
46669
|
-
|
|
46670
|
-
|
|
46671
|
-
|
|
46672
|
-
|
|
46673
|
-
|
|
46674
|
-
|
|
46675
|
-
|
|
46676
|
-
|
|
46677
|
-
|
|
46678
|
-
|
|
46786
|
+
var offsetTop =
|
|
46787
|
+
$(div)
|
|
46788
|
+
.find(".card-top")
|
|
46789
|
+
.height() +
|
|
46790
|
+
12 /* hr size */ -
|
|
46791
|
+
3;
|
|
46792
|
+
|
|
46793
|
+
var uuid = [id, "input", input].join("#");
|
|
46794
|
+
var ep = this.$parent.jsPlumbInstance.addEndpoint(
|
|
46795
|
+
id,
|
|
46796
|
+
{
|
|
46797
|
+
isSource: false,
|
|
46798
|
+
isTarget: true,
|
|
46799
|
+
uuid: uuid,
|
|
46800
|
+
anchor: [0, 0, -1, 0, 0, offsetTop],
|
|
46801
|
+
maxConnections: 1,
|
|
46802
|
+
parameters: {
|
|
46803
|
+
type: "data",
|
|
46804
|
+
target: {
|
|
46805
|
+
id: id,
|
|
46806
|
+
input: output
|
|
46807
|
+
}
|
|
46679
46808
|
}
|
|
46680
|
-
}
|
|
46681
|
-
|
|
46809
|
+
},
|
|
46810
|
+
this.$parent.style.inputEndpoint
|
|
46811
|
+
);
|
|
46682
46812
|
|
|
46683
46813
|
// add data to the endpoint div so we can identify it easier
|
|
46684
|
-
$(ep.canvas).attr(
|
|
46685
|
-
$(ep.canvas).attr(
|
|
46686
|
-
$(ep.canvas).attr(
|
|
46814
|
+
$(ep.canvas).attr("data-node", id);
|
|
46815
|
+
$(ep.canvas).attr("data-type", "input");
|
|
46816
|
+
$(ep.canvas).attr("data-input", input);
|
|
46687
46817
|
|
|
46688
46818
|
// bind tooltip
|
|
46689
|
-
$(ep.canvas).attr(
|
|
46690
|
-
$(ep.canvas).attr(
|
|
46691
|
-
$(ep.canvas).attr(
|
|
46692
|
-
$(ep.canvas).attr(
|
|
46693
|
-
var inputType = view.m
|
|
46694
|
-
|
|
46819
|
+
$(ep.canvas).attr("data-toggle", "tooltip");
|
|
46820
|
+
$(ep.canvas).attr("data-trigger", "hover");
|
|
46821
|
+
$(ep.canvas).attr("data-placement", "left");
|
|
46822
|
+
$(ep.canvas).attr("data-html", "true");
|
|
46823
|
+
var inputType = view.m
|
|
46824
|
+
.getNode(id)
|
|
46825
|
+
.getInputType("value");
|
|
46826
|
+
$(ep.canvas).attr(
|
|
46827
|
+
"title",
|
|
46828
|
+
"Type: <b>" + inputType + "</b>"
|
|
46829
|
+
);
|
|
46695
46830
|
$(ep.canvas).tooltip();
|
|
46696
46831
|
|
|
46697
46832
|
// bind context menu to the endpoint
|
|
46698
|
-
$(ep.canvas).addClass(
|
|
46833
|
+
$(ep.canvas).addClass("capture-right-click");
|
|
46699
46834
|
$(ep.canvas).ready(function() {
|
|
46700
|
-
var menu = new ContextMenu(
|
|
46701
|
-
|
|
46702
|
-
|
|
46703
|
-
|
|
46704
|
-
|
|
46705
|
-
|
|
46835
|
+
var menu = new ContextMenu(
|
|
46836
|
+
".jtk-endpoint-anchor[data-node='" +
|
|
46837
|
+
id.trim() +
|
|
46838
|
+
"'][data-input='" +
|
|
46839
|
+
input +
|
|
46840
|
+
"']",
|
|
46841
|
+
[
|
|
46842
|
+
{
|
|
46843
|
+
name: "Create input for here",
|
|
46844
|
+
fn: () => {
|
|
46845
|
+
view.c.createInputFromConnection(
|
|
46846
|
+
id,
|
|
46847
|
+
input
|
|
46848
|
+
);
|
|
46849
|
+
}
|
|
46850
|
+
}
|
|
46851
|
+
]
|
|
46852
|
+
);
|
|
46706
46853
|
});
|
|
46707
46854
|
|
|
46708
|
-
var uuid = [id, "output", output].join(
|
|
46709
|
-
var ep = this.$parent.jsPlumbInstance.addEndpoint(
|
|
46710
|
-
|
|
46711
|
-
|
|
46712
|
-
|
|
46713
|
-
|
|
46714
|
-
|
|
46715
|
-
|
|
46716
|
-
|
|
46717
|
-
|
|
46718
|
-
|
|
46855
|
+
var uuid = [id, "output", output].join("#");
|
|
46856
|
+
var ep = this.$parent.jsPlumbInstance.addEndpoint(
|
|
46857
|
+
id,
|
|
46858
|
+
{
|
|
46859
|
+
isSource: true,
|
|
46860
|
+
isTarget: false,
|
|
46861
|
+
uuid: uuid,
|
|
46862
|
+
anchor: [1, 0, 1, 0, 0, offsetTop],
|
|
46863
|
+
parameters: {
|
|
46864
|
+
type: "data",
|
|
46865
|
+
source: {
|
|
46866
|
+
id: id,
|
|
46867
|
+
output: output
|
|
46868
|
+
}
|
|
46719
46869
|
}
|
|
46720
|
-
}
|
|
46721
|
-
|
|
46870
|
+
},
|
|
46871
|
+
this.$parent.style.outputEndpoint
|
|
46872
|
+
);
|
|
46722
46873
|
|
|
46723
46874
|
// add data to the endpoint div so we can identify it easier
|
|
46724
|
-
$(ep.canvas).attr(
|
|
46725
|
-
$(ep.canvas).attr(
|
|
46726
|
-
$(ep.canvas).attr(
|
|
46875
|
+
$(ep.canvas).attr("data-node", id);
|
|
46876
|
+
$(ep.canvas).attr("data-type", "output");
|
|
46877
|
+
$(ep.canvas).attr("data-output", output);
|
|
46727
46878
|
|
|
46728
46879
|
// bind tooltip
|
|
46729
|
-
$(ep.canvas).attr(
|
|
46730
|
-
$(ep.canvas).attr(
|
|
46731
|
-
$(ep.canvas).attr(
|
|
46732
|
-
$(ep.canvas).attr(
|
|
46733
|
-
var outputType = view.m
|
|
46734
|
-
|
|
46880
|
+
$(ep.canvas).attr("data-toggle", "tooltip");
|
|
46881
|
+
$(ep.canvas).attr("data-trigger", "hover");
|
|
46882
|
+
$(ep.canvas).attr("data-placement", "right");
|
|
46883
|
+
$(ep.canvas).attr("data-html", "true");
|
|
46884
|
+
var outputType = view.m
|
|
46885
|
+
.getNode(id)
|
|
46886
|
+
.getOutputType("value");
|
|
46887
|
+
$(ep.canvas).attr(
|
|
46888
|
+
"title",
|
|
46889
|
+
"Type: <b>" + outputType + "</b>"
|
|
46890
|
+
);
|
|
46735
46891
|
$(ep.canvas).tooltip();
|
|
46736
46892
|
|
|
46737
46893
|
// bind context menu to the endpoint
|
|
46738
|
-
$(ep.canvas).addClass(
|
|
46894
|
+
$(ep.canvas).addClass("capture-right-click");
|
|
46739
46895
|
$(ep.canvas).ready(function() {
|
|
46740
|
-
var menu = new ContextMenu(
|
|
46741
|
-
|
|
46742
|
-
|
|
46743
|
-
|
|
46744
|
-
|
|
46745
|
-
|
|
46896
|
+
var menu = new ContextMenu(
|
|
46897
|
+
".jtk-endpoint-anchor[data-node='" +
|
|
46898
|
+
id.trim() +
|
|
46899
|
+
"'][data-output='" +
|
|
46900
|
+
output.trim() +
|
|
46901
|
+
"']",
|
|
46902
|
+
[
|
|
46903
|
+
{
|
|
46904
|
+
name: "Create output for here",
|
|
46905
|
+
fn: () => {
|
|
46906
|
+
view.c.createOutputFromConnection(
|
|
46907
|
+
id,
|
|
46908
|
+
output
|
|
46909
|
+
);
|
|
46910
|
+
}
|
|
46911
|
+
}
|
|
46912
|
+
]
|
|
46913
|
+
);
|
|
46746
46914
|
});
|
|
46747
46915
|
} else {
|
|
46748
46916
|
// add input endoints
|
|
46749
|
-
div.find(
|
|
46750
|
-
|
|
46751
|
-
|
|
46752
|
-
|
|
46753
|
-
|
|
46754
|
-
|
|
46755
|
-
|
|
46756
|
-
|
|
46757
|
-
|
|
46758
|
-
|
|
46759
|
-
|
|
46760
|
-
|
|
46761
|
-
|
|
46762
|
-
|
|
46763
|
-
|
|
46764
|
-
|
|
46765
|
-
|
|
46766
|
-
|
|
46767
|
-
|
|
46768
|
-
|
|
46769
|
-
|
|
46770
|
-
|
|
46771
|
-
|
|
46772
|
-
|
|
46773
|
-
|
|
46774
|
-
|
|
46775
|
-
|
|
46776
|
-
|
|
46777
|
-
|
|
46778
|
-
|
|
46779
|
-
|
|
46780
|
-
|
|
46781
|
-
|
|
46782
|
-
|
|
46783
|
-
|
|
46917
|
+
div.find(".box-inputs")
|
|
46918
|
+
.find(".point")
|
|
46919
|
+
.each(function(index) {
|
|
46920
|
+
$(this)
|
|
46921
|
+
.css("visibility", "hidden")
|
|
46922
|
+
.css("opacity", "0"); // replaced by jsPlumb point
|
|
46923
|
+
|
|
46924
|
+
var input = div
|
|
46925
|
+
.find(".box-inputs")
|
|
46926
|
+
.find(".name")
|
|
46927
|
+
.eq(index)
|
|
46928
|
+
.attr("data-input")
|
|
46929
|
+
.trim();
|
|
46930
|
+
var type = view.m
|
|
46931
|
+
.getNode(id)
|
|
46932
|
+
.getInputType(input);
|
|
46933
|
+
|
|
46934
|
+
var offsetTop =
|
|
46935
|
+
$(this).positionFrom(".card").top +
|
|
46936
|
+
$(this).height() / 2 -
|
|
46937
|
+
3;
|
|
46938
|
+
var uuid = [
|
|
46939
|
+
id,
|
|
46940
|
+
"input",
|
|
46941
|
+
$(this).data("key")
|
|
46942
|
+
].join("#");
|
|
46943
|
+
var ep = self.$parent.jsPlumbInstance.addEndpoint(
|
|
46944
|
+
id,
|
|
46945
|
+
{
|
|
46946
|
+
isSource: false,
|
|
46947
|
+
isTarget: true,
|
|
46948
|
+
uuid: uuid,
|
|
46949
|
+
anchor: [0, 0, -1, 0, 0, offsetTop],
|
|
46950
|
+
maxConnections: 1,
|
|
46951
|
+
parameters: {
|
|
46952
|
+
type: "data",
|
|
46953
|
+
target: {
|
|
46954
|
+
id: id,
|
|
46955
|
+
input: $(this).data("key")
|
|
46956
|
+
}
|
|
46957
|
+
}
|
|
46958
|
+
},
|
|
46959
|
+
self.$parent.style.inputEndpoint
|
|
46960
|
+
);
|
|
46784
46961
|
|
|
46785
|
-
|
|
46786
|
-
|
|
46787
|
-
|
|
46788
|
-
|
|
46789
|
-
|
|
46790
|
-
|
|
46791
|
-
|
|
46792
|
-
|
|
46793
|
-
|
|
46962
|
+
// add data to the endpoint div so we can identify it easier
|
|
46963
|
+
$(ep.canvas).attr("data-node", id);
|
|
46964
|
+
$(ep.canvas).attr("data-type", "input");
|
|
46965
|
+
$(ep.canvas).attr("data-input", input);
|
|
46966
|
+
|
|
46967
|
+
// bind tooltip
|
|
46968
|
+
$(ep.canvas).attr("data-toggle", "tooltip");
|
|
46969
|
+
$(ep.canvas).attr("data-trigger", "hover");
|
|
46970
|
+
$(ep.canvas).attr("data-placement", "left");
|
|
46971
|
+
$(ep.canvas).attr("data-html", "true");
|
|
46972
|
+
$(ep.canvas).attr(
|
|
46973
|
+
"title",
|
|
46974
|
+
"Type: <b>" + type + "</b>"
|
|
46975
|
+
);
|
|
46976
|
+
$(ep.canvas).tooltip();
|
|
46977
|
+
|
|
46978
|
+
// bind context menu to the endpoint
|
|
46979
|
+
$(ep.canvas).addClass("capture-right-click");
|
|
46980
|
+
$(ep.canvas).ready(function() {
|
|
46981
|
+
var menu = new ContextMenu(
|
|
46982
|
+
".jtk-endpoint-anchor[data-node='" +
|
|
46983
|
+
id.trim() +
|
|
46984
|
+
"'][data-input='" +
|
|
46985
|
+
input.trim() +
|
|
46986
|
+
"']",
|
|
46987
|
+
[
|
|
46988
|
+
{
|
|
46989
|
+
name: "Create input for here",
|
|
46990
|
+
fn: () => {
|
|
46991
|
+
view.c.createInputFromConnection(
|
|
46992
|
+
id,
|
|
46993
|
+
input
|
|
46994
|
+
);
|
|
46995
|
+
}
|
|
46996
|
+
}
|
|
46997
|
+
]
|
|
46998
|
+
);
|
|
46999
|
+
});
|
|
46794
47000
|
});
|
|
46795
|
-
});
|
|
46796
47001
|
|
|
46797
47002
|
// add output endpoints
|
|
46798
|
-
div.find(
|
|
46799
|
-
|
|
46800
|
-
|
|
46801
|
-
|
|
46802
|
-
|
|
46803
|
-
|
|
46804
|
-
|
|
46805
|
-
|
|
46806
|
-
|
|
46807
|
-
|
|
46808
|
-
|
|
46809
|
-
|
|
46810
|
-
|
|
46811
|
-
|
|
46812
|
-
|
|
46813
|
-
|
|
46814
|
-
|
|
46815
|
-
|
|
46816
|
-
|
|
46817
|
-
|
|
46818
|
-
|
|
46819
|
-
|
|
46820
|
-
|
|
46821
|
-
|
|
46822
|
-
|
|
46823
|
-
|
|
46824
|
-
|
|
46825
|
-
|
|
46826
|
-
|
|
46827
|
-
|
|
46828
|
-
|
|
46829
|
-
|
|
46830
|
-
|
|
46831
|
-
|
|
47003
|
+
div.find(".box-outputs")
|
|
47004
|
+
.find(".point")
|
|
47005
|
+
.each(function(index) {
|
|
47006
|
+
$(this)
|
|
47007
|
+
.css("visibility", "hidden")
|
|
47008
|
+
.css("opacity", "0"); // replaced by jsPlumb point
|
|
47009
|
+
|
|
47010
|
+
var output = div
|
|
47011
|
+
.find(".box-outputs")
|
|
47012
|
+
.find(".name")
|
|
47013
|
+
.eq(index)
|
|
47014
|
+
.attr("data-output")
|
|
47015
|
+
.trim();
|
|
47016
|
+
var type = view.m
|
|
47017
|
+
.getNode(id)
|
|
47018
|
+
.getOutputType(output);
|
|
47019
|
+
|
|
47020
|
+
var offsetTop =
|
|
47021
|
+
$(this).positionFrom(".card").top +
|
|
47022
|
+
$(this).height() / 2 -
|
|
47023
|
+
3;
|
|
47024
|
+
var uuid = [
|
|
47025
|
+
id,
|
|
47026
|
+
"output",
|
|
47027
|
+
$(this).data("key")
|
|
47028
|
+
].join("#");
|
|
47029
|
+
var ep = self.$parent.jsPlumbInstance.addEndpoint(
|
|
47030
|
+
id,
|
|
47031
|
+
{
|
|
47032
|
+
isSource: true,
|
|
47033
|
+
isTarget: false,
|
|
47034
|
+
uuid: uuid,
|
|
47035
|
+
anchor: [1, 0, 1, 0, 0, offsetTop],
|
|
47036
|
+
parameters: {
|
|
47037
|
+
type: "data",
|
|
47038
|
+
source: {
|
|
47039
|
+
id: id,
|
|
47040
|
+
output: $(this).data("key")
|
|
47041
|
+
}
|
|
47042
|
+
}
|
|
47043
|
+
},
|
|
47044
|
+
self.$parent.style.outputEndpoint
|
|
47045
|
+
);
|
|
46832
47046
|
|
|
46833
|
-
|
|
46834
|
-
|
|
46835
|
-
|
|
46836
|
-
|
|
46837
|
-
|
|
46838
|
-
|
|
46839
|
-
|
|
46840
|
-
|
|
46841
|
-
|
|
47047
|
+
// add data to the endpoint div so we can identify it easier
|
|
47048
|
+
$(ep.canvas).attr("data-node", id);
|
|
47049
|
+
$(ep.canvas).attr("data-type", "output");
|
|
47050
|
+
$(ep.canvas).attr("data-output", output);
|
|
47051
|
+
|
|
47052
|
+
// bind tooltip
|
|
47053
|
+
$(ep.canvas).attr("data-toggle", "tooltip");
|
|
47054
|
+
$(ep.canvas).attr("data-trigger", "hover");
|
|
47055
|
+
$(ep.canvas).attr("data-placement", "right");
|
|
47056
|
+
$(ep.canvas).attr("data-html", "true");
|
|
47057
|
+
$(ep.canvas).attr(
|
|
47058
|
+
"title",
|
|
47059
|
+
"Type: <b>" + type + "</b>"
|
|
47060
|
+
);
|
|
47061
|
+
$(ep.canvas).tooltip();
|
|
47062
|
+
|
|
47063
|
+
// bind context menu to the endpoint
|
|
47064
|
+
$(ep.canvas).addClass("capture-right-click");
|
|
47065
|
+
$(ep.canvas).ready(function() {
|
|
47066
|
+
var menu = new ContextMenu(
|
|
47067
|
+
".jtk-endpoint-anchor[data-node='" +
|
|
47068
|
+
id.trim() +
|
|
47069
|
+
"'][data-output='" +
|
|
47070
|
+
output.trim() +
|
|
47071
|
+
"']",
|
|
47072
|
+
[
|
|
47073
|
+
{
|
|
47074
|
+
name: "Create output for here",
|
|
47075
|
+
fn: () => {
|
|
47076
|
+
view.c.createOutputFromConnection(
|
|
47077
|
+
id,
|
|
47078
|
+
output
|
|
47079
|
+
);
|
|
47080
|
+
}
|
|
47081
|
+
}
|
|
47082
|
+
]
|
|
47083
|
+
);
|
|
47084
|
+
});
|
|
46842
47085
|
});
|
|
46843
|
-
});
|
|
46844
47086
|
|
|
46845
47087
|
if (this.n.isUI() && this.displayEvents) {
|
|
46846
47088
|
// Make this a target for events
|
|
46847
|
-
this.$parent.jsPlumbInstance.makeTarget(
|
|
46848
|
-
|
|
46849
|
-
|
|
46850
|
-
|
|
46851
|
-
|
|
46852
|
-
|
|
46853
|
-
|
|
46854
|
-
|
|
46855
|
-
|
|
46856
|
-
|
|
47089
|
+
this.$parent.jsPlumbInstance.makeTarget(
|
|
47090
|
+
id,
|
|
47091
|
+
{
|
|
47092
|
+
isSource: false,
|
|
47093
|
+
isTarget: true,
|
|
47094
|
+
uniqueEndpoint: false,
|
|
47095
|
+
anchor: "Continuous",
|
|
47096
|
+
uuid: id + "#event-in",
|
|
47097
|
+
paintStyle: {
|
|
47098
|
+
fill: "green",
|
|
47099
|
+
radius: 3,
|
|
47100
|
+
stroke: "#727272",
|
|
47101
|
+
strokeWidth: 1
|
|
47102
|
+
},
|
|
47103
|
+
parameters: {
|
|
47104
|
+
type: "event",
|
|
47105
|
+
target: { id: id }
|
|
47106
|
+
}
|
|
46857
47107
|
},
|
|
46858
|
-
|
|
47108
|
+
self.$parent.style.eventEndpoint
|
|
47109
|
+
);
|
|
46859
47110
|
|
|
46860
47111
|
// Create an enpoint to create a new event
|
|
46861
|
-
var ep = this.$parent.jsPlumbInstance.addEndpoint(
|
|
46862
|
-
|
|
46863
|
-
|
|
46864
|
-
|
|
46865
|
-
|
|
46866
|
-
|
|
46867
|
-
|
|
46868
|
-
|
|
47112
|
+
var ep = this.$parent.jsPlumbInstance.addEndpoint(
|
|
47113
|
+
id,
|
|
47114
|
+
{
|
|
47115
|
+
isSource: true,
|
|
47116
|
+
isTarget: false,
|
|
47117
|
+
uuid: id + "#event-out",
|
|
47118
|
+
anchor: [1, 1, 0, 1, 0, -10],
|
|
47119
|
+
parameters: {
|
|
47120
|
+
type: "event",
|
|
47121
|
+
source: { id: id }
|
|
47122
|
+
},
|
|
47123
|
+
paintStyle: {
|
|
47124
|
+
fill: "green",
|
|
47125
|
+
radius: 3,
|
|
47126
|
+
stroke: "#727272",
|
|
47127
|
+
strokeWidth: 1
|
|
47128
|
+
}
|
|
46869
47129
|
},
|
|
46870
|
-
|
|
46871
|
-
|
|
47130
|
+
this.$parent.style.eventEndpoint
|
|
47131
|
+
);
|
|
46872
47132
|
|
|
46873
47133
|
// Add overlay here so we don't mess with splitConnection
|
|
46874
|
-
ep.addOverlay([
|
|
46875
|
-
|
|
46876
|
-
|
|
46877
|
-
|
|
46878
|
-
|
|
46879
|
-
|
|
46880
|
-
|
|
47134
|
+
ep.addOverlay([
|
|
47135
|
+
"PlainArrow",
|
|
47136
|
+
{
|
|
47137
|
+
width: 15,
|
|
47138
|
+
length: 15,
|
|
47139
|
+
location: 1,
|
|
47140
|
+
id: "arrow"
|
|
47141
|
+
}
|
|
47142
|
+
]);
|
|
47143
|
+
|
|
47144
|
+
$(ep.canvas).attr("data-toggle", "tooltip");
|
|
47145
|
+
$(ep.canvas).attr("data-trigger", "hover");
|
|
47146
|
+
$(ep.canvas).attr("data-placement", "bottom");
|
|
47147
|
+
$(ep.canvas).attr("data-html", "true");
|
|
47148
|
+
$(ep.canvas).attr(
|
|
47149
|
+
"title",
|
|
47150
|
+
"Connect from here ito add an event that will be triggered when this box is done computing."
|
|
47151
|
+
);
|
|
46881
47152
|
$(ep.canvas).tooltip();
|
|
46882
47153
|
}
|
|
46883
47154
|
}
|
|
@@ -46898,19 +47169,29 @@ var script = {
|
|
|
46898
47169
|
// resize the canvas if necessary
|
|
46899
47170
|
self.$parent.canvasSizeHandler.debouncedResize();
|
|
46900
47171
|
|
|
46901
|
-
if (
|
|
47172
|
+
if (
|
|
47173
|
+
self.$parent.selector.isMultipleSelectionActive()
|
|
47174
|
+
) {
|
|
46902
47175
|
// We just dropped a bunch of divs, ajust all their positions
|
|
46903
47176
|
self.view.m.batch(() => {
|
|
46904
47177
|
self.$parent.selector.each(div => {
|
|
46905
|
-
var pos = self.$parent.jsPlumbInstance.getPosition(
|
|
46906
|
-
|
|
47178
|
+
var pos = self.$parent.jsPlumbInstance.getPosition(
|
|
47179
|
+
div
|
|
47180
|
+
);
|
|
47181
|
+
view.m
|
|
47182
|
+
.getNode($(div).attr("id"))
|
|
47183
|
+
.setPosition(pos);
|
|
46907
47184
|
});
|
|
46908
47185
|
});
|
|
46909
47186
|
} else {
|
|
46910
47187
|
// We just dropped this one, set the new position in the graph model
|
|
46911
|
-
var el = self.$parent.jsPlumbInstance.getElement(
|
|
47188
|
+
var el = self.$parent.jsPlumbInstance.getElement(
|
|
47189
|
+
id
|
|
47190
|
+
);
|
|
46912
47191
|
$(el).ready(function() {
|
|
46913
|
-
var pos = self.$parent.jsPlumbInstance.getPosition(
|
|
47192
|
+
var pos = self.$parent.jsPlumbInstance.getPosition(
|
|
47193
|
+
el
|
|
47194
|
+
);
|
|
46914
47195
|
view.m.getNode(id).setPosition(pos);
|
|
46915
47196
|
});
|
|
46916
47197
|
}
|
|
@@ -46919,22 +47200,26 @@ var script = {
|
|
|
46919
47200
|
}
|
|
46920
47201
|
}
|
|
46921
47202
|
|
|
46922
|
-
return new Promise(
|
|
47203
|
+
return new Promise(resolve =>
|
|
47204
|
+
this.$parent.jsPlumbInstance.ready(resolve)
|
|
47205
|
+
);
|
|
46923
47206
|
},
|
|
46924
47207
|
|
|
46925
47208
|
assignContextMenu: function() {
|
|
46926
47209
|
var id = this.getId();
|
|
46927
47210
|
|
|
46928
47211
|
// Create a contextmenu for the div
|
|
46929
|
-
var contextOptions = [
|
|
46930
|
-
|
|
46931
|
-
|
|
46932
|
-
|
|
47212
|
+
var contextOptions = [
|
|
47213
|
+
{
|
|
47214
|
+
name: "Remove this box",
|
|
47215
|
+
fn: () => {
|
|
47216
|
+
this.view.c.removeBox(id);
|
|
47217
|
+
}
|
|
46933
47218
|
}
|
|
46934
|
-
|
|
47219
|
+
];
|
|
46935
47220
|
if (this.n.isModule() || this.n.isUI()) {
|
|
46936
47221
|
contextOptions.push({
|
|
46937
|
-
name:
|
|
47222
|
+
name: "Duplicate this box",
|
|
46938
47223
|
fn: () => {
|
|
46939
47224
|
this.view.c.duplicateBox(id);
|
|
46940
47225
|
}
|
|
@@ -46948,15 +47233,15 @@ var script = {
|
|
|
46948
47233
|
},
|
|
46949
47234
|
|
|
46950
47235
|
getVisibleInputs: function() {
|
|
46951
|
-
return this.n.getInputsNames().filter(
|
|
47236
|
+
return this.n.getInputsNames().filter(inputName => {
|
|
46952
47237
|
return this.n.isInputVisible(inputName);
|
|
46953
|
-
})
|
|
47238
|
+
});
|
|
46954
47239
|
},
|
|
46955
47240
|
|
|
46956
47241
|
getVisibleOutputs: function() {
|
|
46957
|
-
return this.n.getOutputsNames().filter(
|
|
47242
|
+
return this.n.getOutputsNames().filter(outputName => {
|
|
46958
47243
|
return this.n.isOutputVisible(outputName);
|
|
46959
|
-
})
|
|
47244
|
+
});
|
|
46960
47245
|
},
|
|
46961
47246
|
|
|
46962
47247
|
enterMetanode: function(e) {
|
|
@@ -46983,9 +47268,9 @@ var script = {
|
|
|
46983
47268
|
}
|
|
46984
47269
|
},
|
|
46985
47270
|
watch: {
|
|
46986
|
-
|
|
47271
|
+
app: {
|
|
46987
47272
|
handler: () => {
|
|
46988
|
-
console.log(
|
|
47273
|
+
console.log("graphVue.app changed");
|
|
46989
47274
|
},
|
|
46990
47275
|
deep: true
|
|
46991
47276
|
}
|
|
@@ -47303,7 +47588,7 @@ var __vue_render__ = function() {
|
|
|
47303
47588
|
_c("b", [_vm._v("META")])
|
|
47304
47589
|
])
|
|
47305
47590
|
: _vm._e(),
|
|
47306
|
-
_vm._v(" " + _vm._s(_vm.n.graphId) + "\n
|
|
47591
|
+
_vm._v(" " + _vm._s(_vm.n.graphId) + "\n "),
|
|
47307
47592
|
_vm.n.isParallel()
|
|
47308
47593
|
? _c("i", {
|
|
47309
47594
|
staticClass: "fas fa-server",
|
|
@@ -47356,9 +47641,9 @@ var __vue_render__ = function() {
|
|
|
47356
47641
|
{ staticClass: "type", attrs: { "data-key": key } },
|
|
47357
47642
|
[
|
|
47358
47643
|
_vm._v(
|
|
47359
|
-
"\n
|
|
47644
|
+
"\n " +
|
|
47360
47645
|
_vm._s(_vm.n.getInputType(key)) +
|
|
47361
|
-
"\n
|
|
47646
|
+
"\n "
|
|
47362
47647
|
)
|
|
47363
47648
|
]
|
|
47364
47649
|
)
|
|
@@ -47458,7 +47743,7 @@ var __vue_render__ = function() {
|
|
|
47458
47743
|
_vm.n.hasCacheActivated()
|
|
47459
47744
|
? _c("span", [
|
|
47460
47745
|
_vm._v(
|
|
47461
|
-
"\n
|
|
47746
|
+
"\n "
|
|
47462
47747
|
),
|
|
47463
47748
|
_c("i", {
|
|
47464
47749
|
staticClass: "fa fa-hdd",
|
|
@@ -47499,9 +47784,9 @@ var __vue_render__ = function() {
|
|
|
47499
47784
|
{ staticClass: "type", attrs: { "data-key": key } },
|
|
47500
47785
|
[
|
|
47501
47786
|
_vm._v(
|
|
47502
|
-
"\n
|
|
47787
|
+
"\n " +
|
|
47503
47788
|
_vm._s(_vm.n.getOutputType(key)) +
|
|
47504
|
-
"\n
|
|
47789
|
+
"\n "
|
|
47505
47790
|
)
|
|
47506
47791
|
]
|
|
47507
47792
|
)
|
|
@@ -47546,7 +47831,7 @@ __vue_render__._withStripped = true;
|
|
|
47546
47831
|
/* style */
|
|
47547
47832
|
const __vue_inject_styles__ = function (inject) {
|
|
47548
47833
|
if (!inject) return
|
|
47549
|
-
inject("data-v-c892dbee_0", { source: "\n.card-ui {\r\n background-color: #bff2ca !important;\n}\n.card-loop {\r\n /* background-color: #e5e8ea!important; */\r\n border: 5px double #dddddd;\r\n border-width: 4px;\n}\n.card-input {\r\n background-color: #f5d76e !important;\n}\n.card-output {\r\n background-color: #ffb3a7 !important;\n}\n.box-inputs {\r\n float: left;\r\n padding-left: 2px;\r\n padding-right: 5px;\r\n vertical-align: top;\r\n text-align: left;\n}\n.box-outputs {\r\n float: right;\r\n padding-left: 5px;\r\n padding-right: 2px;\r\n vertical-align: top;\r\n text-align: right;\n}\n.dualbox-graph-canvas .card,\r\n.card-node {\r\n /*border: 1px solid #dddddd;*/\r\n box-shadow: 1px 1px 5px #716f6f;\r\n opacity: 1;\r\n cursor: pointer;\r\n z-index: 20;\r\n position: absolute;\r\n -webkit-transition: -webkit-box-shadow 0.15s ease-in;\r\n -moz-transition: -moz-box-shadow 0.15s ease-in;\r\n -o-transition: -o-box-shadow 0.15s ease-in;\r\n transition: box-shadow 0.15s ease-in;\r\n color: #4d4d4d;\r\n user-select: none;\r\n padding: 0px 8px 0px 8px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n -moz-border-radius: 3px;\r\n border-radius: 3px;\r\n font-size: 14px;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n}\n.card-node .card-top {\r\n padding-top: 2px;\n}\n.card-node .card-bottom {\r\n padding-bottom: 2px;\r\n text-align: center;\r\n line-height: 14px;\r\n white-space: nowrap;\n}\n.card-node hr {\r\n margin-top: 2px;\r\n margin-bottom: 2px;\r\n border-color: rgba(0, 0, 0, 0.1);\r\n margin-left: -8px;\r\n margin-right: -8px;\n}\n.card-node:hover {\r\n border-color: #80b2fc;\r\n box-shadow: 1px 1px 10px #80b2fc;\n}\n.card-node.selected,\r\n.card-node.selected:hover {\r\n border-color: #0066ff;\r\n box-shadow: 1px 1px 10px #0066ff;\n}\n.card-node-incomplete {\r\n box-shadow: 1px 1px 5px #dd6666 !important;\n}\n.input-not-resolvable {\r\n color: #dd6666 !important;\n}\n.card-node .title {\r\n vertical-align: top;\r\n font-weight: bold;\n}\n.card-node .subtitle {\r\n color: #929292;\r\n font-size: 11px;\r\n font-style: italic;\r\n vertical-align: center;\r\n font-family: tahoma, sans-serif;\n}\n.card-node .input {\r\n font-size: 13px;\r\n color: #8c8c8c;\n}\n.card-node .output {\r\n font-size: 13px;\r\n color: #8c8c8c;\r\n text-align: right;\n}\n.card-node .jtk-endpoint.active svg circle {\r\n /* fill: #99ff33 */\r\n stroke: #59b300;\n}\n.point {\r\n /* display: inline-block; */\r\n display: none;\r\n position: relative;\r\n top: 3px;\r\n margin-right: 5px;\r\n margin-left: 5px;\n}\n.dualbox-io {\r\n overflow: visible;\r\n margin-left: -8px;\r\n margin-right: -8px;\n}\n.box-inputs {\r\n display: flex;\r\n justify-content: space-between;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\n}\n.types {\r\n color: #6c757d !important;\r\n opacity: 0.7;\r\n pointer-events: none;\n}\n.box-inputs .types {\r\n display: inline-block;\n}\n.box-inputs .name {\r\n display: inline-block;\n}\n.box-inputs .type {\r\n display: block;\r\n text-align: right;\n}\n.box-inputs .point {\r\n display: block;\n}\n.box-inputs .name {\r\n display: block;\n}\n.box-outputs {\r\n display: flex;\r\n justify-content: center;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\n}\n.box-outputs .types {\r\n display: inline-block;\n}\n.box-outputs .point {\r\n display: inline-block;\n}\n.box-outputs .name {\r\n display: inline-block;\n}\n.box-outputs .type {\r\n display: block;\r\n text-align: left;\n}\n.box-outputs .point {\r\n display: block;\n}\n.box-outputs .name {\r\n display: block;\n}\nspan.feedback {\r\n font-weight: bold;\n}\n.event-dock {\r\n background-color: rgb(136, 137, 138);\r\n background-color: #a6a6a6;\r\n width: calc(100% + 18px);\r\n height: 12px;\r\n z-index: 3 !important;\n}\n.event-dock-top {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-top: -3px;\r\n border-top-left-radius: 4px;\r\n border-top-right-radius: 4px;\r\n margin-bottom: 4px;\n}\n.event-dock-bottom {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-bottom: -3px;\r\n border-bottom-left-radius: 4px;\r\n border-bottom-right-radius: 4px;\r\n margin-top: 4px;\r\n height: 11px;\r\n /* shorter because of box-shadow */\n}\n.event-label {\r\n z-index: 21;\r\n padding-left: 15px;\r\n transform: rotate(-90deg) translate(0%, -50%) !important;\r\n transform-origin: 0% 0%;\r\n color: #6c757d !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-size: 14px;\r\n opacity: 0.7;\r\n cursor: pointer;\n}\n.transparent {\r\n opacity: 0.3 !important;\n}\n.card-node {\r\n position: relative;\n}\n.card-comment {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n margin-top: -22px;\r\n color: #f4ad42 !important;\n}\n.card-problem {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n margin-top: -22px;\r\n color: red !important;\n}\n.card-snapshot {}\n.card-snapshot-idle {\r\n border: 2px solid gray !important;\r\n box-shadow: 1px 1px 5px gray !important;\r\n opacity: 0.7 !important;\n}\n.card-snapshot-computing {\r\n border: 2px solid darkgreen !important;\r\n box-shadow: 1px 1px 5px darkgreen !important;\r\n opacity: 1 !important;\n}\n.card-snapshot-awaiting-data {\r\n border: 2px solid blue !important;\r\n box-shadow: 1px 1px 5px blue !important;\r\n opacity: 0.7 !important;\n}\n.card-snapshot-ready {\r\n border: 2px solid lightgreen !important;\r\n box-shadow: 1px 1px 5px lightgreen !important;\r\n opacity: 1 !important;\n}\n.card-status {\r\n position: absolute;\r\n bottom: 0;\r\n right: 0;\r\n left: 0;\r\n margin-bottom: -26px;\r\n color: #f4ad42 !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-weight: bold;\r\n text-align: center;\n}\n.card-status-idle {\r\n color: gray !important;\r\n min-width: 85px;\n}\n.card-status-computing {\r\n color: darkgreen !important;\r\n min-width: 110px;\n}\n.card-status-awaiting-data {\r\n color: blue !important;\r\n min-width: 85px;\n}\n.card-status-ready {\r\n color: lightgreen !important;\r\n min-width: 85px;\n}\n.btn-snapshot-details {\r\n position: relative;\r\n margin-top: -2px;\r\n color: inherit;\n}\nspan.name {\r\n overflow-wrap: normal;\n}\r\n", map: {"version":3,"sources":["C:\\Users\\maxim\\Projects\\dualbox\\editor\\js\\src\\v\\templates\\graphNode.vue"],"names":[],"mappings":";AACA;IACA,oCAAA;AACA;AAEA;IACA,yCAAA;IACA,0BAAA;IACA,iBAAA;AACA;AAEA;IACA,oCAAA;AACA;AAEA;IACA,oCAAA;AACA;AAEA;IACA,WAAA;IACA,iBAAA;IACA,kBAAA;IACA,mBAAA;IACA,gBAAA;AACA;AAEA;IACA,YAAA;IACA,iBAAA;IACA,kBAAA;IACA,mBAAA;IACA,iBAAA;AACA;AAEA;;IAEA,6BAAA;IACA,+BAAA;IACA,UAAA;IACA,eAAA;IACA,WAAA;IACA,kBAAA;IACA,oDAAA;IACA,8CAAA;IACA,0CAAA;IACA,oCAAA;IACA,cAAA;IACA,iBAAA;IACA,wBAAA;IACA,gBAAA;IACA,sBAAA;IACA,uBAAA;IACA,kBAAA;IACA,eAAA;IACA,2DAAA;AACA;AAEA;IACA,gBAAA;AACA;AAEA;IACA,mBAAA;IACA,kBAAA;IACA,iBAAA;IACA,mBAAA;AACA;AAEA;IACA,eAAA;IACA,kBAAA;IACA,gCAAA;IACA,iBAAA;IACA,kBAAA;AACA;AAEA;IACA,qBAAA;IACA,gCAAA;AACA;AAEA;;IAEA,qBAAA;IACA,gCAAA;AACA;AAEA;IACA,0CAAA;AACA;AAEA;IACA,yBAAA;AACA;AAEA;IACA,mBAAA;IACA,iBAAA;AACA;AAEA;IACA,cAAA;IACA,eAAA;IACA,kBAAA;IACA,sBAAA;IACA,+BAAA;AACA;AAEA;IACA,eAAA;IACA,cAAA;AACA;AAEA;IACA,eAAA;IACA,cAAA;IACA,iBAAA;AACA;AAEA;IACA,kBAAA;IACA,eAAA;AACA;AAEA;IACA,2BAAA;IACA,aAAA;IACA,kBAAA;IACA,QAAA;IACA,iBAAA;IACA,gBAAA;AACA;AAEA;IACA,iBAAA;IACA,iBAAA;IACA,kBAAA;AACA;AAEA;IACA,aAAA;IACA,8BAAA;IACA,kBAAA;IACA,UAAA;IACA,oBAAA;AACA;AAEA;IACA,yBAAA;IACA,YAAA;IACA,oBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,cAAA;IACA,iBAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,aAAA;IACA,uBAAA;IACA,kBAAA;IACA,UAAA;IACA,oBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,cAAA;IACA,gBAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,iBAAA;AACA;AAEA;IACA,oCAAA;IACA,yBAAA;IACA,wBAAA;IACA,YAAA;IACA,qBAAA;AACA;AAEA;IACA,iBAAA;IACA,kBAAA;IACA,gBAAA;IACA,2BAAA;IACA,4BAAA;IACA,kBAAA;AACA;AAEA;IACA,iBAAA;IACA,kBAAA;IACA,mBAAA;IACA,8BAAA;IACA,+BAAA;IACA,eAAA;IACA,YAAA;IACA,kCAAA;AACA;AAEA;IACA,WAAA;IACA,kBAAA;IACA,wDAAA;IACA,uBAAA;IACA,yBAAA;IACA,2DAAA;IACA,eAAA;IACA,YAAA;IACA,eAAA;AACA;AAEA;IACA,uBAAA;AACA;AAEA;IACA,kBAAA;AACA;AAEA;IACA,kBAAA;IACA,MAAA;IACA,QAAA;IACA,iBAAA;IACA,yBAAA;AACA;AAEA;IACA,kBAAA;IACA,MAAA;IACA,OAAA;IACA,iBAAA;IACA,qBAAA;AACA;AAEA,gBAAA;AAEA;IACA,iCAAA;IACA,uCAAA;IACA,uBAAA;AACA;AAEA;IACA,sCAAA;IACA,4CAAA;IACA,qBAAA;AACA;AAEA;IACA,iCAAA;IACA,uCAAA;IACA,uBAAA;AACA;AAEA;IACA,uCAAA;IACA,6CAAA;IACA,qBAAA;AACA;AAEA;IACA,kBAAA;IACA,SAAA;IACA,QAAA;IACA,OAAA;IACA,oBAAA;IACA,yBAAA;IACA,2DAAA;IACA,iBAAA;IACA,kBAAA;AACA;AAEA;IACA,sBAAA;IACA,eAAA;AACA;AAEA;IACA,2BAAA;IACA,gBAAA;AACA;AAEA;IACA,sBAAA;IACA,eAAA;AACA;AAEA;IACA,4BAAA;IACA,eAAA;AACA;AAEA;IACA,kBAAA;IACA,gBAAA;IACA,cAAA;AACA;AAEA;IACA,qBAAA;AACA","file":"graphNode.vue","sourcesContent":["<style>\r\n.card-ui {\r\n background-color: #bff2ca !important;\r\n}\r\n\r\n.card-loop {\r\n /* background-color: #e5e8ea!important; */\r\n border: 5px double #dddddd;\r\n border-width: 4px;\r\n}\r\n\r\n.card-input {\r\n background-color: #f5d76e !important;\r\n}\r\n\r\n.card-output {\r\n background-color: #ffb3a7 !important;\r\n}\r\n\r\n.box-inputs {\r\n float: left;\r\n padding-left: 2px;\r\n padding-right: 5px;\r\n vertical-align: top;\r\n text-align: left;\r\n}\r\n\r\n.box-outputs {\r\n float: right;\r\n padding-left: 5px;\r\n padding-right: 2px;\r\n vertical-align: top;\r\n text-align: right;\r\n}\r\n\r\n.dualbox-graph-canvas .card,\r\n.card-node {\r\n /*border: 1px solid #dddddd;*/\r\n box-shadow: 1px 1px 5px #716f6f;\r\n opacity: 1;\r\n cursor: pointer;\r\n z-index: 20;\r\n position: absolute;\r\n -webkit-transition: -webkit-box-shadow 0.15s ease-in;\r\n -moz-transition: -moz-box-shadow 0.15s ease-in;\r\n -o-transition: -o-box-shadow 0.15s ease-in;\r\n transition: box-shadow 0.15s ease-in;\r\n color: #4d4d4d;\r\n user-select: none;\r\n padding: 0px 8px 0px 8px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n -moz-border-radius: 3px;\r\n border-radius: 3px;\r\n font-size: 14px;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.card-node .card-top {\r\n padding-top: 2px;\r\n}\r\n\r\n.card-node .card-bottom {\r\n padding-bottom: 2px;\r\n text-align: center;\r\n line-height: 14px;\r\n white-space: nowrap;\r\n}\r\n\r\n.card-node hr {\r\n margin-top: 2px;\r\n margin-bottom: 2px;\r\n border-color: rgba(0, 0, 0, 0.1);\r\n margin-left: -8px;\r\n margin-right: -8px;\r\n}\r\n\r\n.card-node:hover {\r\n border-color: #80b2fc;\r\n box-shadow: 1px 1px 10px #80b2fc;\r\n}\r\n\r\n.card-node.selected,\r\n.card-node.selected:hover {\r\n border-color: #0066ff;\r\n box-shadow: 1px 1px 10px #0066ff;\r\n}\r\n\r\n.card-node-incomplete {\r\n box-shadow: 1px 1px 5px #dd6666 !important;\r\n}\r\n\r\n.input-not-resolvable {\r\n color: #dd6666 !important;\r\n}\r\n\r\n.card-node .title {\r\n vertical-align: top;\r\n font-weight: bold;\r\n}\r\n\r\n.card-node .subtitle {\r\n color: #929292;\r\n font-size: 11px;\r\n font-style: italic;\r\n vertical-align: center;\r\n font-family: tahoma, sans-serif;\r\n}\r\n\r\n.card-node .input {\r\n font-size: 13px;\r\n color: #8c8c8c;\r\n}\r\n\r\n.card-node .output {\r\n font-size: 13px;\r\n color: #8c8c8c;\r\n text-align: right;\r\n}\r\n\r\n.card-node .jtk-endpoint.active svg circle {\r\n /* fill: #99ff33 */\r\n stroke: #59b300;\r\n}\r\n\r\n.point {\r\n /* display: inline-block; */\r\n display: none;\r\n position: relative;\r\n top: 3px;\r\n margin-right: 5px;\r\n margin-left: 5px;\r\n}\r\n\r\n.dualbox-io {\r\n overflow: visible;\r\n margin-left: -8px;\r\n margin-right: -8px;\r\n}\r\n\r\n.box-inputs {\r\n display: flex;\r\n justify-content: space-between;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\r\n}\r\n\r\n.types {\r\n color: #6c757d !important;\r\n opacity: 0.7;\r\n pointer-events: none;\r\n}\r\n\r\n.box-inputs .types {\r\n display: inline-block;\r\n}\r\n\r\n.box-inputs .name {\r\n display: inline-block;\r\n}\r\n\r\n.box-inputs .type {\r\n display: block;\r\n text-align: right;\r\n}\r\n\r\n.box-inputs .point {\r\n display: block;\r\n}\r\n\r\n.box-inputs .name {\r\n display: block;\r\n}\r\n\r\n.box-outputs {\r\n display: flex;\r\n justify-content: center;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\r\n}\r\n\r\n.box-outputs .types {\r\n display: inline-block;\r\n}\r\n\r\n.box-outputs .point {\r\n display: inline-block;\r\n}\r\n\r\n.box-outputs .name {\r\n display: inline-block;\r\n}\r\n\r\n.box-outputs .type {\r\n display: block;\r\n text-align: left;\r\n}\r\n\r\n.box-outputs .point {\r\n display: block;\r\n}\r\n\r\n.box-outputs .name {\r\n display: block;\r\n}\r\n\r\nspan.feedback {\r\n font-weight: bold;\r\n}\r\n\r\n.event-dock {\r\n background-color: rgb(136, 137, 138);\r\n background-color: #a6a6a6;\r\n width: calc(100% + 18px);\r\n height: 12px;\r\n z-index: 3 !important;\r\n}\r\n\r\n.event-dock-top {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-top: -3px;\r\n border-top-left-radius: 4px;\r\n border-top-right-radius: 4px;\r\n margin-bottom: 4px;\r\n}\r\n\r\n.event-dock-bottom {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-bottom: -3px;\r\n border-bottom-left-radius: 4px;\r\n border-bottom-right-radius: 4px;\r\n margin-top: 4px;\r\n height: 11px;\r\n /* shorter because of box-shadow */\r\n}\r\n\r\n.event-label {\r\n z-index: 21;\r\n padding-left: 15px;\r\n transform: rotate(-90deg) translate(0%, -50%) !important;\r\n transform-origin: 0% 0%;\r\n color: #6c757d !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-size: 14px;\r\n opacity: 0.7;\r\n cursor: pointer;\r\n}\r\n\r\n.transparent {\r\n opacity: 0.3 !important;\r\n}\r\n\r\n.card-node {\r\n position: relative;\r\n}\r\n\r\n.card-comment {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n margin-top: -22px;\r\n color: #f4ad42 !important;\r\n}\r\n\r\n.card-problem {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n margin-top: -22px;\r\n color: red !important;\r\n}\r\n\r\n.card-snapshot {}\r\n\r\n.card-snapshot-idle {\r\n border: 2px solid gray !important;\r\n box-shadow: 1px 1px 5px gray !important;\r\n opacity: 0.7 !important;\r\n}\r\n\r\n.card-snapshot-computing {\r\n border: 2px solid darkgreen !important;\r\n box-shadow: 1px 1px 5px darkgreen !important;\r\n opacity: 1 !important;\r\n}\r\n\r\n.card-snapshot-awaiting-data {\r\n border: 2px solid blue !important;\r\n box-shadow: 1px 1px 5px blue !important;\r\n opacity: 0.7 !important;\r\n}\r\n\r\n.card-snapshot-ready {\r\n border: 2px solid lightgreen !important;\r\n box-shadow: 1px 1px 5px lightgreen !important;\r\n opacity: 1 !important;\r\n}\r\n\r\n.card-status {\r\n position: absolute;\r\n bottom: 0;\r\n right: 0;\r\n left: 0;\r\n margin-bottom: -26px;\r\n color: #f4ad42 !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-weight: bold;\r\n text-align: center;\r\n}\r\n\r\n.card-status-idle {\r\n color: gray !important;\r\n min-width: 85px;\r\n}\r\n\r\n.card-status-computing {\r\n color: darkgreen !important;\r\n min-width: 110px;\r\n}\r\n\r\n.card-status-awaiting-data {\r\n color: blue !important;\r\n min-width: 85px;\r\n}\r\n\r\n.card-status-ready {\r\n color: lightgreen !important;\r\n min-width: 85px;\r\n}\r\n\r\n.btn-snapshot-details {\r\n position: relative;\r\n margin-top: -2px;\r\n color: inherit;\r\n}\r\n\r\nspan.name {\r\n overflow-wrap: normal;\r\n}\r\n</style>\r\n\r\n<template>\r\n <div class=\"jtk-node card card-node contextmenu\" v-bind:class=\"{ 'card-loop': n.hasLoop(), 'card-ui': n.isUI(), 'card-metanode': n.isMetanode(), 'card-input': n.isInput(), 'card-output': n.isOutput(), 'card-snapshot': n.hasSnapshot(), 'card-snapshot-idle': n.hasSnapshot() && n.isSnapshotStatus(0), 'card-snapshot-computing': n.hasSnapshot() && n.isSnapshotStatus(1), 'card-snapshot-awaiting-data': n.hasSnapshot() && n.isSnapshotStatus(2), 'card-snapshot-ready': n.hasSnapshot() && n.isSnapshotStatus(3) }\"\r\n v-bind:id=\"getId()\" v-bind:data-id=\"getId()\" v-bind:data-name=\"pkg.name\" style=\"overflow: visible;\">\r\n <div v-if=\"n.hasComment()\">\r\n <div class=\"card-comment\" data-toggle=\"tooltip\" data-placement=\"top\" :title=\"n.getComment()\">\r\n <i class=\"fas fa-comment-alt\" data-container=\"body\"></i>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.hasSnapshot()\">\r\n <div class=\"card-status\">\r\n <div v-if=\"n.isSnapshotStatus(0)\">\r\n <div class=\"card-status-idle\">\r\n <span>IDLE</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.isSnapshotStatus(1)\">\r\n <div class=\"card-status-computing\">\r\n <span>COMPUTING</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.isSnapshotStatus(2)\">\r\n <div class=\"card-status-awaiting-data\">\r\n <span>WAITING</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.isSnapshotStatus(3)\">\r\n <div class=\"card-status-ready\">\r\n <span>READY</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"!example && n.isUI() && !n.isOnAPanel()\">\r\n <div @click=\"registerToPanel\" class=\"card-problem\">\r\n <i class=\"fas fa-exclamation-circle\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"top\" data-content=\"This UI is not set in a panel. It won't have any effect. Go to the Interface tab to add it to a panel.\"></i>\r\n </div>\r\n </div>\r\n\r\n <div class=\"card-top\">\r\n <div class=\"d-flex\">\r\n <span class=\"title\" style=\"white-space: nowrap; margin-right: 5px;\">\r\n <span v-if=\"n.isMetanode()\" class=\"badge badge-secondary\"><b>META</b></span> {{n.graphId}}\r\n <i v-if=\"n.isParallel()\" class=\"fas fa-server\" style=\"color: orange;\" title=\"this module is computed in a web worker\"></i>\r\n </span>\r\n\r\n <div class=\"ml-auto\">\r\n <button class=\"btn btn-outline-secondary btn-outline-discrete btn-editor-xs btn-settings\" v-on:click=\"openNodeSettings\"><i class=\"fas fa-cog\"></i></button>\r\n </div>\r\n </div>\r\n </div>\r\n <div v-if=\"!n.isInput() && !n.isOutput()\" class=\"card-center\">\r\n <hr style=\"margin-bottom: 5px;\" />\r\n <div class=\"dualbox-io\" style=\"overflow: visible;\">\r\n <div class=\"inputs\" style=\"display: inline-block; float: left;\">\r\n <div class=\"box-inputs\">\r\n <div class=\"types\">\r\n <span class=\"type\" v-for=\"key in getVisibleInputs()\" v-bind:data-key=\"key\">\r\n {{ n.getInputType(key) }}\r\n </span>\r\n </div>\r\n <div class=\"points\">\r\n <div class=\"point\" v-for=\"key in getVisibleInputs()\" v-bind:data-key=\"key\" v-bind:data-type=\"n.getInputDef(key).type\" v-html=\"point\"></div>\r\n </div>\r\n <div class=\"names\">\r\n <span class=\"name\" v-for=\"key in getVisibleInputs()\" :class=\"{'feedback': n.isFeedbackTarget(key), 'input-not-resolvable': !example && !n.isInputResolvable(key) }\" v-bind:data-input=\"key\">\r\n <span v-if=\"n.hasIterator(key)\"><{{key}}></span>\r\n <span v-else>{{key}}</span>\r\n <small v-if=\"!n.isInputConst(key)\" data-toggle=\"tooltip\" data-trigger=\"hover\" title=\"this value will be cloned at execution time\"><i class=\"fas fa-clone transparent\"></i></small>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"outputs\" style=\"display: inline-block; float: right\">\r\n <div class=\"box-outputs\">\r\n <div class=\"names\">\r\n <span class=\"name\" v-for=\"key in getVisibleOutputs()\" v-bind:class=\"{feedback: n.isFeedbackTarget(key)}\" v-bind:data-output=\"key\">\r\n <span v-if=\"n.hasLoop() && n.hasFeedback(key)\">{{key}}</span>\r\n <span v-else-if=\"n.hasLoop() && !n.hasFeedback(key)\"><{{key}}></span>\r\n <span v-else>{{key}}</span>\r\n\r\n <span v-if=\"n.hasCacheActivated()\">\r\n <i class=\"fa fa-hdd\" title=\"This module has cache activated\"></i>\r\n </span>\r\n </span>\r\n </div>\r\n <div class=\"points\">\r\n <div class=\"point\" v-for=\"key in getVisibleOutputs()\" v-bind:data-key=\"key\" v-bind:data-type=\"n.getOutputDef(key).type\" v-html=\"point\"></div>\r\n </div>\r\n <div class=\"types\">\r\n <span class=\"type\" v-for=\"key in getVisibleOutputs()\" v-bind:data-key=\"key\">\r\n {{ n.getOutputType(key) }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <hr style=\"margin-top: 5px;\" />\r\n <div class=\"card-bottom\">\r\n <span class=\"subtitle\">{{ shortName }}</span>\r\n\r\n <div v-if=\"n.isMetanode()\" class=\"d-inline-block\">\r\n <button class=\"btn btn-outline-secondary btn-outline-discrete btn-editor-xs btn-enter-metanode\" v-on:click=\"enterMetanode\"><i class=\"fas fa-sign-in-alt\"></i></button>\r\n </div>\r\n\r\n <!--\r\n <div v-if=\"n.isUI()\" class=\"event-dock event-dock-bottom\"></div>\r\n -->\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport ContextMenu from '../ContextMenu';\r\nimport _ from 'lodash-es';\r\nimport dbutils from '../../m/DualboxUtils';\r\n\r\n// fix inputs types and output types position relatively to the div\r\n$.fn.fixCardDisplay = function() {\r\n var offsetPoint = 12;\r\n var offsetBorder = parseInt($(this).css(\"border-top-width\"));\r\n\r\n if ($(this).find('.box-inputs').height() === 0 && $(this).find('.box-outputs').height() === 0) {\r\n // if this card has no input/output, remove the card center\r\n $(this).find('.card-center').remove();\r\n } else {\r\n // else, adjust the input/output display for endpoints\r\n // 1) translate inputs by the right amount of pixels to have the circle on the line\r\n var boxInputs = $(this).find('.box-inputs');\r\n\r\n // fix css names width\r\n var namesDiv = boxInputs.find('.names');\r\n namesDiv.css('width', (namesDiv.width() + 1) + 'px');\r\n\r\n // translate inputs to the left\r\n var translateLeft = boxInputs.find('.types').width() + offsetPoint + offsetBorder / 2;\r\n $(this).find('.box-inputs').css('transform', 'translateX(-' + translateLeft + 'px)');\r\n\r\n // adjust inputs main div width\r\n $(this).find('.inputs').width($(this).find('.inputs').width() - translateLeft + 10 /* margin */ );\r\n\r\n\r\n // 2) translate outputs by the right amount of pixels to have the circle on the line\r\n var boxOutputs = $(this).find('.box-outputs');\r\n\r\n // fix css names with\r\n var namesDiv = boxOutputs.find('.names');\r\n namesDiv.css('width', (namesDiv.width() + 1) + 'px');\r\n\r\n // translate inputs to the right\r\n var translateRight = boxOutputs.find('.types').width() + offsetPoint + offsetBorder / 2;\r\n $(this).find('.box-outputs').css('transform', 'translateX(' + translateRight + 'px)');\r\n\r\n // adjust output main div width\r\n $(this).find('.outputs').width($(this).find('.outputs').width() - translateRight + 10 /* margin */ );\r\n\r\n // fix io width\r\n //$('.dualbox-io').css('width', (($(this).find('.inputs').width() + $(this).find('.outputs').width()) + \"px\"));\r\n }\r\n}\r\n\r\n// take the current width and add it as a css property\r\n$.fn.fixWidth = function() {\r\n var width = $(this).width();\r\n width += parseInt($(this).css('padding-right'));\r\n width += parseInt($(this).css('padding-left'));\r\n width += parseInt($(this).css('border-left-width'));\r\n width += parseInt($(this).css('border-right-width'));\r\n $(this).css('width', Math.ceil(width) + 'px');\r\n}\r\n\r\n// find position of element relative to an ancestor matching selector\r\n$.fn.positionFrom = function(selector) {\r\n var ancestor = $(this).closest(selector);\r\n var offset = $(this).offset();\r\n var ancestorOffset = ancestor.offset();\r\n return {\r\n top: offset.top - ancestorOffset.top,\r\n left: offset.left - ancestorOffset.left,\r\n }\r\n}\r\n\r\nexport default {\r\n props: [\r\n \"id\", // the module id\r\n \"pkg\", // the module package.json\r\n \"n\", // the GraphNode object (from model)\r\n \"example\", // true if this vue is used as an example display (no need to connect)\r\n \"displayEvents\", // true if events should be displayed\r\n ],\r\n data: function() {\r\n return {\r\n shortName: \"\",\r\n point: '<svg width=\"14\" height=\"14\" pointer-events=\"all\" position=\"absolute\" version=\"1.1\" xmlns=\"http://www.w3.org/1999/xhtml\"><circle cx=\"7\" cy=\"7\" r=\"5\" version=\"1.1\" xmlns=\"http://www.w3.org/1999/xhtml\" fill=\"#ffffff\" stroke=\"#727272\" style=\"\" stroke-width=\"2\"></circle></svg>',\r\n }\r\n },\r\n beforeUpdate: function() {\r\n //console.log('[UPDATING] ' + this.n.getUniqId());\r\n },\r\n destroyed: function() {\r\n this.deactivateTooltip();\r\n $('.tooltip').remove();\r\n },\r\n created: function() {\r\n this.initialized = false;\r\n this.view = window.dualboxEditor.v;\r\n\r\n //console.log('[CREATED] ' + this.n.getUniqId());\r\n // We compute the shortname of our box\r\n if (this.n.isInput() || this.n.isOutput()) {\r\n this.shortName = this.n.getType();\r\n } else {\r\n this.shortName = dbutils.shortName(this.pkg.name);\r\n }\r\n },\r\n mounted: async function() {\r\n //console.log('[MOUNTED] ' + this.n.getUniqId());\r\n var div = $(this.$el);\r\n div.fixCardDisplay();\r\n div.ready(() => {\r\n //if( !this.example ) {\r\n div.fixWidth();\r\n //}\r\n });\r\n this.activateTooltip();\r\n return await this.initialize();\r\n },\r\n beforeUpdate: function() {\r\n this.deactivateTooltip();\r\n },\r\n updated: async function() {\r\n //console.log('[UPDATED] ' + this.n.getUniqId());\r\n\r\n // we reset jsPlumb before app update (in graph.vue)\r\n // so we need to initialize again\r\n this.assignContextMenu();\r\n\r\n $(this.$el).fixCardDisplay();\r\n $(this.$el).ready(() => {\r\n $(this.$el).fixWidth();\r\n this.activateTooltip();\r\n });\r\n return await this.initialize();\r\n },\r\n activate: function() {\r\n this.activateTooltip();\r\n },\r\n deactivate: function() {\r\n this.deactivateTooltip();\r\n },\r\n methods: {\r\n getId: function() {\r\n // if this is an example graphNode, change our \"id\" to \"id-junk\"\r\n // to avoid connection jsplumb conflicts with the real node\r\n return this.example ? this.id + '-junk' : this.id;\r\n },\r\n\r\n activateTooltip: function() {\r\n $(this.$el).find('[data-toggle=\"tooltip\"]').tooltip();\r\n },\r\n\r\n deactivateTooltip: function() {\r\n $(this.$el).find('[data-toggle=\"tooltip\"]').tooltip(\"dispose\");\r\n },\r\n\r\n initialize: async function() {\r\n var self = this;\r\n var div = $(this.$el);\r\n var id = this.getId();\r\n var view = this.view;\r\n\r\n this.initialized = false;\r\n\r\n if (!this.example) {\r\n // if we have a position, set it\r\n var def = this.n.getDef();\r\n var position = _.get(def, [\"graph\", \"position\"]);\r\n if (position) {\r\n var jsPlumbElement = self.$parent.jsPlumbInstance.getElement(id);\r\n self.$parent.jsPlumbInstance.setPosition(jsPlumbElement, position);\r\n }\r\n\r\n // This needs to be registered before draggable\r\n div.on('mousedown', function(e) {\r\n // if this div is not selected already, deselect the other divs\r\n if (!self.$parent.selector.isSelected(this)) {\r\n self.$parent.selector.deselect();\r\n }\r\n });\r\n\r\n await this.initializeJsPlumb();\r\n\r\n div.click(function(e) {\r\n if (e.ctrlKey) {\r\n view.selector.toggleSelection(this);\r\n }\r\n });\r\n\r\n this.assignContextMenu();\r\n }\r\n\r\n return new Promise(resolve => {\r\n div.ready(() => {\r\n //console.log('[INITIALIZED] ' + this.n.getUniqId());\r\n this.initialized = true;\r\n resolve();\r\n });\r\n });\r\n },\r\n\r\n initializeJsPlumb: function() {\r\n var self = this;\r\n var div = $(this.$el);\r\n var id = this.getId();\r\n var view = this.view;\r\n\r\n if (!this.example) {\r\n // If this node was never initialized in this jsplumb instance, do it\r\n if (!_.get(this.$parent.jsPlumbInstance, [\"initializedNodes\", id])) {\r\n _.set(this.$parent.jsPlumbInstance, [\"initializedNodes\", id], true); // initialized\r\n\r\n if (this.n.isInput() || this.n.isOutput()) {\r\n var type = \"*\";\r\n var input = \"value\";\r\n var output = \"value\";\r\n var offsetTop = $(div).find('.card-top').height() + 12 /* hr size */ - 3;\r\n\r\n var uuid = [id, \"input\", input].join('#');\r\n var ep = this.$parent.jsPlumbInstance.addEndpoint(id, {\r\n isSource: false,\r\n isTarget: true,\r\n uuid: uuid,\r\n anchor: [0, 0, -1, 0, 0, offsetTop],\r\n maxConnections: 1,\r\n parameters: {\r\n type: \"data\",\r\n target: {\r\n id: id,\r\n input: output\r\n }\r\n }\r\n }, this.$parent.style.inputEndpoint);\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr('data-node', id);\r\n $(ep.canvas).attr('data-type', 'input');\r\n $(ep.canvas).attr('data-input', input);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr('data-toggle', \"tooltip\");\r\n $(ep.canvas).attr('data-trigger', \"hover\");\r\n $(ep.canvas).attr('data-placement', \"left\");\r\n $(ep.canvas).attr('data-html', \"true\");\r\n var inputType = view.m.getNode(id).getInputType(\"value\");\r\n $(ep.canvas).attr('title', \"Type: <b>\" + inputType + \"</b>\");\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass('capture-right-click');\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\".jtk-endpoint-anchor[data-node='\" + id.trim() + \"'][data-input='\" + input + \"']\", [{\r\n name: 'Create input for here',\r\n fn: () => {\r\n view.c.createInputFromConnection(id, input);\r\n }\r\n }, ]);\r\n });\r\n\r\n var uuid = [id, \"output\", output].join('#');\r\n var ep = this.$parent.jsPlumbInstance.addEndpoint(id, {\r\n isSource: true,\r\n isTarget: false,\r\n uuid: uuid,\r\n anchor: [1, 0, 1, 0, 0, offsetTop],\r\n parameters: {\r\n type: \"data\",\r\n source: {\r\n id: id,\r\n output: output\r\n }\r\n }\r\n }, this.$parent.style.outputEndpoint);\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr('data-node', id);\r\n $(ep.canvas).attr('data-type', \"output\");\r\n $(ep.canvas).attr('data-output', output);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr('data-toggle', \"tooltip\");\r\n $(ep.canvas).attr('data-trigger', \"hover\");\r\n $(ep.canvas).attr('data-placement', \"right\");\r\n $(ep.canvas).attr('data-html', \"true\");\r\n var outputType = view.m.getNode(id).getOutputType(\"value\");\r\n $(ep.canvas).attr('title', \"Type: <b>\" + outputType + \"</b>\");\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass('capture-right-click');\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\".jtk-endpoint-anchor[data-node='\" + id.trim() + \"'][data-output='\" + output.trim() + \"']\", [{\r\n name: 'Create output for here',\r\n fn: () => {\r\n view.c.createOutputFromConnection(id, output);\r\n }\r\n }, ]);\r\n });\r\n } else {\r\n // add input endoints\r\n div.find('.box-inputs').find('.point').each(function(index) {\r\n $(this).css('visibility', 'hidden').css('opacity', '0'); // replaced by jsPlumb point\r\n\r\n var input = div.find('.box-inputs').find('.name').eq(index).attr('data-input').trim();\r\n var type = view.m.getNode(id).getInputType(input);\r\n\r\n var offsetTop = $(this).positionFrom('.card').top + $(this).height() / 2 - 3;\r\n var uuid = [id, \"input\", $(this).data('key')].join('#');\r\n var ep = self.$parent.jsPlumbInstance.addEndpoint(id, {\r\n isSource: false,\r\n isTarget: true,\r\n uuid: uuid,\r\n anchor: [0, 0, -1, 0, 0, offsetTop],\r\n maxConnections: 1,\r\n parameters: {\r\n type: \"data\",\r\n target: {\r\n id: id,\r\n input: $(this).data('key')\r\n }\r\n }\r\n }, self.$parent.style.inputEndpoint);\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr('data-node', id);\r\n $(ep.canvas).attr('data-type', 'input');\r\n $(ep.canvas).attr('data-input', input);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr('data-toggle', \"tooltip\");\r\n $(ep.canvas).attr('data-trigger', \"hover\");\r\n $(ep.canvas).attr('data-placement', \"left\");\r\n $(ep.canvas).attr('data-html', \"true\");\r\n $(ep.canvas).attr('title', \"Type: <b>\" + type + \"</b>\");\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass('capture-right-click');\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\".jtk-endpoint-anchor[data-node='\" + id.trim() + \"'][data-input='\" + input.trim() + \"']\", [{\r\n name: 'Create input for here',\r\n fn: () => {\r\n view.c.createInputFromConnection(id, input);\r\n }\r\n }, ]);\r\n });\r\n });\r\n\r\n // add output endpoints\r\n div.find('.box-outputs').find('.point').each(function(index) {\r\n $(this).css('visibility', 'hidden').css('opacity', '0'); // replaced by jsPlumb point\r\n\r\n var output = div.find('.box-outputs').find('.name').eq(index).attr('data-output').trim();\r\n var type = view.m.getNode(id).getOutputType(output);\r\n\r\n var offsetTop = $(this).positionFrom('.card').top + $(this).height() / 2 - 3;\r\n var uuid = [id, \"output\", $(this).data('key')].join('#');\r\n var ep = self.$parent.jsPlumbInstance.addEndpoint(id, {\r\n isSource: true,\r\n isTarget: false,\r\n uuid: uuid,\r\n anchor: [1, 0, 1, 0, 0, offsetTop],\r\n parameters: {\r\n type: \"data\",\r\n source: {\r\n id: id,\r\n output: $(this).data('key')\r\n }\r\n }\r\n }, self.$parent.style.outputEndpoint);\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr('data-node', id);\r\n $(ep.canvas).attr('data-type', \"output\");\r\n $(ep.canvas).attr('data-output', output);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr('data-toggle', \"tooltip\");\r\n $(ep.canvas).attr('data-trigger', \"hover\");\r\n $(ep.canvas).attr('data-placement', \"right\");\r\n $(ep.canvas).attr('data-html', \"true\");\r\n $(ep.canvas).attr('title', \"Type: <b>\" + type + \"</b>\");\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass('capture-right-click');\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\".jtk-endpoint-anchor[data-node='\" + id.trim() + \"'][data-output='\" + output.trim() + \"']\", [{\r\n name: 'Create output for here',\r\n fn: () => {\r\n view.c.createOutputFromConnection(id, output);\r\n }\r\n }, ]);\r\n });\r\n });\r\n\r\n if (this.n.isUI() && this.displayEvents) {\r\n // Make this a target for events\r\n this.$parent.jsPlumbInstance.makeTarget(id, {\r\n isSource: false,\r\n isTarget: true,\r\n uniqueEndpoint: false,\r\n anchor: \"Continuous\",\r\n uuid: id + \"#event-in\",\r\n paintStyle: { fill: \"green\", radius: 3, stroke: \"#727272\", strokeWidth: 1 },\r\n parameters: {\r\n type: \"event\",\r\n target: { \"id\": id }\r\n },\r\n }, self.$parent.style.eventEndpoint);\r\n\r\n // Create an enpoint to create a new event\r\n var ep = this.$parent.jsPlumbInstance.addEndpoint(id, {\r\n isSource: true,\r\n isTarget: false,\r\n uuid: id + \"#event-out\",\r\n anchor: [1, 1, 0, 1, 0, -10],\r\n parameters: {\r\n type: \"event\",\r\n source: { \"id\": id }\r\n },\r\n paintStyle: { fill: \"green\", radius: 3, stroke: \"#727272\", strokeWidth: 1 },\r\n }, this.$parent.style.eventEndpoint);\r\n\r\n // Add overlay here so we don't mess with splitConnection\r\n ep.addOverlay([\"PlainArrow\", { width: 15, length: 15, location: 1, id: \"arrow\" }]);\r\n\r\n $(ep.canvas).attr('data-toggle', \"tooltip\");\r\n $(ep.canvas).attr('data-trigger', \"hover\");\r\n $(ep.canvas).attr('data-placement', \"bottom\");\r\n $(ep.canvas).attr('data-html', \"true\");\r\n $(ep.canvas).attr('title', \"Connect from here ito add an event that will be triggered when this box is done computing.\");\r\n $(ep.canvas).tooltip();\r\n }\r\n }\r\n\r\n // Make the div draggable\r\n this.$parent.jsPlumbInstance.draggable(div, {\r\n //containment:true, // not allowed outside of container div\r\n drag: function(e) {\r\n // TODO: bug. After a repaint(), jsPlumb seems to be broken (connections dont follow on div drag)\r\n // It doesn't occur on jsPlumb.reset() instead of creating another instance on beforeUpdate(),\r\n // (as it should be), but we can't do that, because JsPlumb is broken on zoom otherwise...\r\n // One of thoses problem may be fixed later by updating jsPlumb...\r\n // Note: this \"fix\" may affect performances on drag, maybe a setTimeout will do\r\n //self.$parent.jsPlumbInstance.repaintEverything();\r\n self.$parent.jsPlumbInstance.repaint(id);\r\n },\r\n stop: function(e) {\r\n // resize the canvas if necessary\r\n self.$parent.canvasSizeHandler.debouncedResize();\r\n\r\n if (self.$parent.selector.isMultipleSelectionActive()) {\r\n // We just dropped a bunch of divs, ajust all their positions\r\n self.view.m.batch(() => {\r\n self.$parent.selector.each(div => {\r\n var pos = self.$parent.jsPlumbInstance.getPosition(div);\r\n view.m.getNode($(div).attr('id')).setPosition(pos);\r\n });\r\n });\r\n } else {\r\n // We just dropped this one, set the new position in the graph model\r\n var el = self.$parent.jsPlumbInstance.getElement(id);\r\n $(el).ready(function() {\r\n var pos = self.$parent.jsPlumbInstance.getPosition(el);\r\n view.m.getNode(id).setPosition(pos);\r\n });\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n return new Promise((resolve) => this.$parent.jsPlumbInstance.ready(resolve));\r\n },\r\n\r\n assignContextMenu: function() {\r\n var id = this.getId();\r\n\r\n // Create a contextmenu for the div\r\n var contextOptions = [{\r\n name: 'Remove this box',\r\n fn: () => {\r\n this.view.c.removeBox(id);\r\n }\r\n }];\r\n if (this.n.isModule() || this.n.isUI()) {\r\n contextOptions.push({\r\n name: 'Duplicate this box',\r\n fn: () => {\r\n this.view.c.duplicateBox(id);\r\n }\r\n });\r\n }\r\n var nodeMenu = new ContextMenu(\"#\" + id, contextOptions);\r\n },\r\n\r\n htmlentities: function(s) {\r\n return this.view.utils.htmlentities(s);\r\n },\r\n\r\n getVisibleInputs: function() {\r\n return this.n.getInputsNames().filter((inputName) => {\r\n return this.n.isInputVisible(inputName);\r\n })\r\n },\r\n\r\n getVisibleOutputs: function() {\r\n return this.n.getOutputsNames().filter((outputName) => {\r\n return this.n.isOutputVisible(outputName);\r\n })\r\n },\r\n\r\n enterMetanode: function(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n this.view.c.enterMetanode(this.id);\r\n },\r\n\r\n openNodeSettings: function(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.view.openBoxSettings(this.id);\r\n },\r\n\r\n openSnapshotDetails: async function(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n await this.view.openDebug(this.id);\r\n },\r\n\r\n registerToPanel: async function(e) {\r\n await this.view.c.registerNodeToInterface(this.id);\r\n }\r\n },\r\n watch: {\r\n 'app': {\r\n handler: () => {\r\n console.log('graphVue.app changed');\r\n },\r\n deep: true\r\n }\r\n }\r\n}\r\n</script>\r\n"]}, media: undefined });
|
|
47834
|
+
inject("data-v-4f0778c6_0", { source: "\n.card-ui {\r\n background-color: #bff2ca !important;\n}\n.card-loop {\r\n /* background-color: #e5e8ea!important; */\r\n border: 5px double #dddddd;\r\n border-width: 4px;\n}\n.card-input {\r\n background-color: #f5d76e !important;\n}\n.card-output {\r\n background-color: #ffb3a7 !important;\n}\n.box-inputs {\r\n float: left;\r\n padding-left: 2px;\r\n padding-right: 5px;\r\n vertical-align: top;\r\n text-align: left;\n}\n.box-outputs {\r\n float: right;\r\n padding-left: 5px;\r\n padding-right: 2px;\r\n vertical-align: top;\r\n text-align: right;\n}\n.dualbox-graph-canvas .card,\r\n.card-node {\r\n /*border: 1px solid #dddddd;*/\r\n box-shadow: 1px 1px 5px #716f6f;\r\n opacity: 1;\r\n cursor: pointer;\r\n z-index: 20;\r\n position: absolute;\r\n -webkit-transition: -webkit-box-shadow 0.15s ease-in;\r\n -moz-transition: -moz-box-shadow 0.15s ease-in;\r\n -o-transition: -o-box-shadow 0.15s ease-in;\r\n transition: box-shadow 0.15s ease-in;\r\n color: #4d4d4d;\r\n user-select: none;\r\n padding: 0px 8px 0px 8px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n -moz-border-radius: 3px;\r\n border-radius: 3px;\r\n font-size: 14px;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n}\n.card-node .card-top {\r\n padding-top: 2px;\n}\n.card-node .card-bottom {\r\n padding-bottom: 2px;\r\n text-align: center;\r\n line-height: 14px;\r\n white-space: nowrap;\n}\n.card-node hr {\r\n margin-top: 2px;\r\n margin-bottom: 2px;\r\n border-color: rgba(0, 0, 0, 0.1);\r\n margin-left: -8px;\r\n margin-right: -8px;\n}\n.card-node:hover {\r\n border-color: #80b2fc;\r\n box-shadow: 1px 1px 10px #80b2fc;\n}\n.card-node.selected,\r\n.card-node.selected:hover {\r\n border-color: #0066ff;\r\n box-shadow: 1px 1px 10px #0066ff;\n}\n.card-node-incomplete {\r\n box-shadow: 1px 1px 5px #dd6666 !important;\n}\n.input-not-resolvable {\r\n color: #dd6666 !important;\n}\n.card-node .title {\r\n vertical-align: top;\r\n font-weight: bold;\n}\n.card-node .subtitle {\r\n color: #929292;\r\n font-size: 11px;\r\n font-style: italic;\r\n vertical-align: center;\r\n font-family: tahoma, sans-serif;\n}\n.card-node .input {\r\n font-size: 13px;\r\n color: #8c8c8c;\n}\n.card-node .output {\r\n font-size: 13px;\r\n color: #8c8c8c;\r\n text-align: right;\n}\n.card-node .jtk-endpoint.active svg circle {\r\n /* fill: #99ff33 */\r\n stroke: #59b300;\n}\n.point {\r\n /* display: inline-block; */\r\n display: none;\r\n position: relative;\r\n top: 3px;\r\n margin-right: 5px;\r\n margin-left: 5px;\n}\n.dualbox-io {\r\n overflow: visible;\r\n margin-left: -8px;\r\n margin-right: -8px;\n}\n.box-inputs {\r\n display: flex;\r\n justify-content: space-between;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\n}\n.types {\r\n color: #6c757d !important;\r\n opacity: 0.7;\r\n pointer-events: none;\n}\n.box-inputs .types {\r\n display: inline-block;\n}\n.box-inputs .name {\r\n display: inline-block;\n}\n.box-inputs .type {\r\n display: block;\r\n text-align: right;\n}\n.box-inputs .point {\r\n display: block;\n}\n.box-inputs .name {\r\n display: block;\n}\n.box-outputs {\r\n display: flex;\r\n justify-content: center;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\n}\n.box-outputs .types {\r\n display: inline-block;\n}\n.box-outputs .point {\r\n display: inline-block;\n}\n.box-outputs .name {\r\n display: inline-block;\n}\n.box-outputs .type {\r\n display: block;\r\n text-align: left;\n}\n.box-outputs .point {\r\n display: block;\n}\n.box-outputs .name {\r\n display: block;\n}\nspan.feedback {\r\n font-weight: bold;\n}\n.event-dock {\r\n background-color: rgb(136, 137, 138);\r\n background-color: #a6a6a6;\r\n width: calc(100% + 18px);\r\n height: 12px;\r\n z-index: 3 !important;\n}\n.event-dock-top {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-top: -3px;\r\n border-top-left-radius: 4px;\r\n border-top-right-radius: 4px;\r\n margin-bottom: 4px;\n}\n.event-dock-bottom {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-bottom: -3px;\r\n border-bottom-left-radius: 4px;\r\n border-bottom-right-radius: 4px;\r\n margin-top: 4px;\r\n height: 11px;\r\n /* shorter because of box-shadow */\n}\n.event-label {\r\n z-index: 21;\r\n padding-left: 15px;\r\n transform: rotate(-90deg) translate(0%, -50%) !important;\r\n transform-origin: 0% 0%;\r\n color: #6c757d !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-size: 14px;\r\n opacity: 0.7;\r\n cursor: pointer;\n}\n.transparent {\r\n opacity: 0.3 !important;\n}\n.card-node {\r\n position: relative;\n}\n.card-comment {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n margin-top: -22px;\r\n color: #f4ad42 !important;\n}\n.card-problem {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n margin-top: -22px;\r\n color: red !important;\n}\n.card-snapshot {\n}\n.card-snapshot-idle {\r\n border: 2px solid gray !important;\r\n box-shadow: 1px 1px 5px gray !important;\r\n opacity: 0.7 !important;\n}\n.card-snapshot-computing {\r\n border: 2px solid darkgreen !important;\r\n box-shadow: 1px 1px 5px darkgreen !important;\r\n opacity: 1 !important;\n}\n.card-snapshot-awaiting-data {\r\n border: 2px solid blue !important;\r\n box-shadow: 1px 1px 5px blue !important;\r\n opacity: 0.7 !important;\n}\n.card-snapshot-ready {\r\n border: 2px solid lightgreen !important;\r\n box-shadow: 1px 1px 5px lightgreen !important;\r\n opacity: 1 !important;\n}\n.card-status {\r\n position: absolute;\r\n bottom: 0;\r\n right: 0;\r\n left: 0;\r\n margin-bottom: -26px;\r\n color: #f4ad42 !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-weight: bold;\r\n text-align: center;\n}\n.card-status-idle {\r\n color: gray !important;\r\n min-width: 85px;\n}\n.card-status-computing {\r\n color: darkgreen !important;\r\n min-width: 110px;\n}\n.card-status-awaiting-data {\r\n color: blue !important;\r\n min-width: 85px;\n}\n.card-status-ready {\r\n color: lightgreen !important;\r\n min-width: 85px;\n}\n.btn-snapshot-details {\r\n position: relative;\r\n margin-top: -2px;\r\n color: inherit;\n}\nspan.name {\r\n overflow-wrap: normal;\n}\r\n", map: {"version":3,"sources":["C:\\Users\\maxim\\Projects\\dualbox\\editor\\js\\src\\v\\templates\\graphNode.vue"],"names":[],"mappings":";AACA;IACA,oCAAA;AACA;AAEA;IACA,yCAAA;IACA,0BAAA;IACA,iBAAA;AACA;AAEA;IACA,oCAAA;AACA;AAEA;IACA,oCAAA;AACA;AAEA;IACA,WAAA;IACA,iBAAA;IACA,kBAAA;IACA,mBAAA;IACA,gBAAA;AACA;AAEA;IACA,YAAA;IACA,iBAAA;IACA,kBAAA;IACA,mBAAA;IACA,iBAAA;AACA;AAEA;;IAEA,6BAAA;IACA,+BAAA;IACA,UAAA;IACA,eAAA;IACA,WAAA;IACA,kBAAA;IACA,oDAAA;IACA,8CAAA;IACA,0CAAA;IACA,oCAAA;IACA,cAAA;IACA,iBAAA;IACA,wBAAA;IACA,gBAAA;IACA,sBAAA;IACA,uBAAA;IACA,kBAAA;IACA,eAAA;IACA,2DAAA;AACA;AAEA;IACA,gBAAA;AACA;AAEA;IACA,mBAAA;IACA,kBAAA;IACA,iBAAA;IACA,mBAAA;AACA;AAEA;IACA,eAAA;IACA,kBAAA;IACA,gCAAA;IACA,iBAAA;IACA,kBAAA;AACA;AAEA;IACA,qBAAA;IACA,gCAAA;AACA;AAEA;;IAEA,qBAAA;IACA,gCAAA;AACA;AAEA;IACA,0CAAA;AACA;AAEA;IACA,yBAAA;AACA;AAEA;IACA,mBAAA;IACA,iBAAA;AACA;AAEA;IACA,cAAA;IACA,eAAA;IACA,kBAAA;IACA,sBAAA;IACA,+BAAA;AACA;AAEA;IACA,eAAA;IACA,cAAA;AACA;AAEA;IACA,eAAA;IACA,cAAA;IACA,iBAAA;AACA;AAEA;IACA,kBAAA;IACA,eAAA;AACA;AAEA;IACA,2BAAA;IACA,aAAA;IACA,kBAAA;IACA,QAAA;IACA,iBAAA;IACA,gBAAA;AACA;AAEA;IACA,iBAAA;IACA,iBAAA;IACA,kBAAA;AACA;AAEA;IACA,aAAA;IACA,8BAAA;IACA,kBAAA;IACA,UAAA;IACA,oBAAA;AACA;AAEA;IACA,yBAAA;IACA,YAAA;IACA,oBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,cAAA;IACA,iBAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,aAAA;IACA,uBAAA;IACA,kBAAA;IACA,UAAA;IACA,oBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,qBAAA;AACA;AAEA;IACA,cAAA;IACA,gBAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,cAAA;AACA;AAEA;IACA,iBAAA;AACA;AAEA;IACA,oCAAA;IACA,yBAAA;IACA,wBAAA;IACA,YAAA;IACA,qBAAA;AACA;AAEA;IACA,iBAAA;IACA,kBAAA;IACA,gBAAA;IACA,2BAAA;IACA,4BAAA;IACA,kBAAA;AACA;AAEA;IACA,iBAAA;IACA,kBAAA;IACA,mBAAA;IACA,8BAAA;IACA,+BAAA;IACA,eAAA;IACA,YAAA;IACA,kCAAA;AACA;AAEA;IACA,WAAA;IACA,kBAAA;IACA,wDAAA;IACA,uBAAA;IACA,yBAAA;IACA,2DAAA;IACA,eAAA;IACA,YAAA;IACA,eAAA;AACA;AAEA;IACA,uBAAA;AACA;AAEA;IACA,kBAAA;AACA;AAEA;IACA,kBAAA;IACA,MAAA;IACA,QAAA;IACA,iBAAA;IACA,yBAAA;AACA;AAEA;IACA,kBAAA;IACA,MAAA;IACA,OAAA;IACA,iBAAA;IACA,qBAAA;AACA;AAEA;AACA;AAEA;IACA,iCAAA;IACA,uCAAA;IACA,uBAAA;AACA;AAEA;IACA,sCAAA;IACA,4CAAA;IACA,qBAAA;AACA;AAEA;IACA,iCAAA;IACA,uCAAA;IACA,uBAAA;AACA;AAEA;IACA,uCAAA;IACA,6CAAA;IACA,qBAAA;AACA;AAEA;IACA,kBAAA;IACA,SAAA;IACA,QAAA;IACA,OAAA;IACA,oBAAA;IACA,yBAAA;IACA,2DAAA;IACA,iBAAA;IACA,kBAAA;AACA;AAEA;IACA,sBAAA;IACA,eAAA;AACA;AAEA;IACA,2BAAA;IACA,gBAAA;AACA;AAEA;IACA,sBAAA;IACA,eAAA;AACA;AAEA;IACA,4BAAA;IACA,eAAA;AACA;AAEA;IACA,kBAAA;IACA,gBAAA;IACA,cAAA;AACA;AAEA;IACA,qBAAA;AACA","file":"graphNode.vue","sourcesContent":["<style>\r\n.card-ui {\r\n background-color: #bff2ca !important;\r\n}\r\n\r\n.card-loop {\r\n /* background-color: #e5e8ea!important; */\r\n border: 5px double #dddddd;\r\n border-width: 4px;\r\n}\r\n\r\n.card-input {\r\n background-color: #f5d76e !important;\r\n}\r\n\r\n.card-output {\r\n background-color: #ffb3a7 !important;\r\n}\r\n\r\n.box-inputs {\r\n float: left;\r\n padding-left: 2px;\r\n padding-right: 5px;\r\n vertical-align: top;\r\n text-align: left;\r\n}\r\n\r\n.box-outputs {\r\n float: right;\r\n padding-left: 5px;\r\n padding-right: 2px;\r\n vertical-align: top;\r\n text-align: right;\r\n}\r\n\r\n.dualbox-graph-canvas .card,\r\n.card-node {\r\n /*border: 1px solid #dddddd;*/\r\n box-shadow: 1px 1px 5px #716f6f;\r\n opacity: 1;\r\n cursor: pointer;\r\n z-index: 20;\r\n position: absolute;\r\n -webkit-transition: -webkit-box-shadow 0.15s ease-in;\r\n -moz-transition: -moz-box-shadow 0.15s ease-in;\r\n -o-transition: -o-box-shadow 0.15s ease-in;\r\n transition: box-shadow 0.15s ease-in;\r\n color: #4d4d4d;\r\n user-select: none;\r\n padding: 0px 8px 0px 8px;\r\n overflow: hidden;\r\n background-color: #fff;\r\n -moz-border-radius: 3px;\r\n border-radius: 3px;\r\n font-size: 14px;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.card-node .card-top {\r\n padding-top: 2px;\r\n}\r\n\r\n.card-node .card-bottom {\r\n padding-bottom: 2px;\r\n text-align: center;\r\n line-height: 14px;\r\n white-space: nowrap;\r\n}\r\n\r\n.card-node hr {\r\n margin-top: 2px;\r\n margin-bottom: 2px;\r\n border-color: rgba(0, 0, 0, 0.1);\r\n margin-left: -8px;\r\n margin-right: -8px;\r\n}\r\n\r\n.card-node:hover {\r\n border-color: #80b2fc;\r\n box-shadow: 1px 1px 10px #80b2fc;\r\n}\r\n\r\n.card-node.selected,\r\n.card-node.selected:hover {\r\n border-color: #0066ff;\r\n box-shadow: 1px 1px 10px #0066ff;\r\n}\r\n\r\n.card-node-incomplete {\r\n box-shadow: 1px 1px 5px #dd6666 !important;\r\n}\r\n\r\n.input-not-resolvable {\r\n color: #dd6666 !important;\r\n}\r\n\r\n.card-node .title {\r\n vertical-align: top;\r\n font-weight: bold;\r\n}\r\n\r\n.card-node .subtitle {\r\n color: #929292;\r\n font-size: 11px;\r\n font-style: italic;\r\n vertical-align: center;\r\n font-family: tahoma, sans-serif;\r\n}\r\n\r\n.card-node .input {\r\n font-size: 13px;\r\n color: #8c8c8c;\r\n}\r\n\r\n.card-node .output {\r\n font-size: 13px;\r\n color: #8c8c8c;\r\n text-align: right;\r\n}\r\n\r\n.card-node .jtk-endpoint.active svg circle {\r\n /* fill: #99ff33 */\r\n stroke: #59b300;\r\n}\r\n\r\n.point {\r\n /* display: inline-block; */\r\n display: none;\r\n position: relative;\r\n top: 3px;\r\n margin-right: 5px;\r\n margin-left: 5px;\r\n}\r\n\r\n.dualbox-io {\r\n overflow: visible;\r\n margin-left: -8px;\r\n margin-right: -8px;\r\n}\r\n\r\n.box-inputs {\r\n display: flex;\r\n justify-content: space-between;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\r\n}\r\n\r\n.types {\r\n color: #6c757d !important;\r\n opacity: 0.7;\r\n pointer-events: none;\r\n}\r\n\r\n.box-inputs .types {\r\n display: inline-block;\r\n}\r\n\r\n.box-inputs .name {\r\n display: inline-block;\r\n}\r\n\r\n.box-inputs .type {\r\n display: block;\r\n text-align: right;\r\n}\r\n\r\n.box-inputs .point {\r\n display: block;\r\n}\r\n\r\n.box-inputs .name {\r\n display: block;\r\n}\r\n\r\n.box-outputs {\r\n display: flex;\r\n justify-content: center;\r\n position: relative;\r\n padding: 0;\r\n pointer-events: none;\r\n}\r\n\r\n.box-outputs .types {\r\n display: inline-block;\r\n}\r\n\r\n.box-outputs .point {\r\n display: inline-block;\r\n}\r\n\r\n.box-outputs .name {\r\n display: inline-block;\r\n}\r\n\r\n.box-outputs .type {\r\n display: block;\r\n text-align: left;\r\n}\r\n\r\n.box-outputs .point {\r\n display: block;\r\n}\r\n\r\n.box-outputs .name {\r\n display: block;\r\n}\r\n\r\nspan.feedback {\r\n font-weight: bold;\r\n}\r\n\r\n.event-dock {\r\n background-color: rgb(136, 137, 138);\r\n background-color: #a6a6a6;\r\n width: calc(100% + 18px);\r\n height: 12px;\r\n z-index: 3 !important;\r\n}\r\n\r\n.event-dock-top {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-top: -3px;\r\n border-top-left-radius: 4px;\r\n border-top-right-radius: 4px;\r\n margin-bottom: 4px;\r\n}\r\n\r\n.event-dock-bottom {\r\n margin-left: -9px;\r\n margin-right: -9px;\r\n margin-bottom: -3px;\r\n border-bottom-left-radius: 4px;\r\n border-bottom-right-radius: 4px;\r\n margin-top: 4px;\r\n height: 11px;\r\n /* shorter because of box-shadow */\r\n}\r\n\r\n.event-label {\r\n z-index: 21;\r\n padding-left: 15px;\r\n transform: rotate(-90deg) translate(0%, -50%) !important;\r\n transform-origin: 0% 0%;\r\n color: #6c757d !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-size: 14px;\r\n opacity: 0.7;\r\n cursor: pointer;\r\n}\r\n\r\n.transparent {\r\n opacity: 0.3 !important;\r\n}\r\n\r\n.card-node {\r\n position: relative;\r\n}\r\n\r\n.card-comment {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n margin-top: -22px;\r\n color: #f4ad42 !important;\r\n}\r\n\r\n.card-problem {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n margin-top: -22px;\r\n color: red !important;\r\n}\r\n\r\n.card-snapshot {\r\n}\r\n\r\n.card-snapshot-idle {\r\n border: 2px solid gray !important;\r\n box-shadow: 1px 1px 5px gray !important;\r\n opacity: 0.7 !important;\r\n}\r\n\r\n.card-snapshot-computing {\r\n border: 2px solid darkgreen !important;\r\n box-shadow: 1px 1px 5px darkgreen !important;\r\n opacity: 1 !important;\r\n}\r\n\r\n.card-snapshot-awaiting-data {\r\n border: 2px solid blue !important;\r\n box-shadow: 1px 1px 5px blue !important;\r\n opacity: 0.7 !important;\r\n}\r\n\r\n.card-snapshot-ready {\r\n border: 2px solid lightgreen !important;\r\n box-shadow: 1px 1px 5px lightgreen !important;\r\n opacity: 1 !important;\r\n}\r\n\r\n.card-status {\r\n position: absolute;\r\n bottom: 0;\r\n right: 0;\r\n left: 0;\r\n margin-bottom: -26px;\r\n color: #f4ad42 !important;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n font-weight: bold;\r\n text-align: center;\r\n}\r\n\r\n.card-status-idle {\r\n color: gray !important;\r\n min-width: 85px;\r\n}\r\n\r\n.card-status-computing {\r\n color: darkgreen !important;\r\n min-width: 110px;\r\n}\r\n\r\n.card-status-awaiting-data {\r\n color: blue !important;\r\n min-width: 85px;\r\n}\r\n\r\n.card-status-ready {\r\n color: lightgreen !important;\r\n min-width: 85px;\r\n}\r\n\r\n.btn-snapshot-details {\r\n position: relative;\r\n margin-top: -2px;\r\n color: inherit;\r\n}\r\n\r\nspan.name {\r\n overflow-wrap: normal;\r\n}\r\n</style>\r\n\r\n<template>\r\n <div class=\"jtk-node card card-node contextmenu\" v-bind:class=\"{ 'card-loop': n.hasLoop(), 'card-ui': n.isUI(), 'card-metanode': n.isMetanode(), 'card-input': n.isInput(), 'card-output': n.isOutput(), 'card-snapshot': n.hasSnapshot(), 'card-snapshot-idle': n.hasSnapshot() && n.isSnapshotStatus(0), 'card-snapshot-computing': n.hasSnapshot() && n.isSnapshotStatus(1), 'card-snapshot-awaiting-data': n.hasSnapshot() && n.isSnapshotStatus(2), 'card-snapshot-ready': n.hasSnapshot() && n.isSnapshotStatus(3) }\" v-bind:id=\"getId()\" v-bind:data-id=\"getId()\" v-bind:data-name=\"pkg.name\" style=\"overflow: visible;\">\r\n <div v-if=\"n.hasComment()\">\r\n <div class=\"card-comment\" data-toggle=\"tooltip\" data-placement=\"top\" :title=\"n.getComment()\">\r\n <i class=\"fas fa-comment-alt\" data-container=\"body\"></i>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.hasSnapshot()\">\r\n <div class=\"card-status\">\r\n <div v-if=\"n.isSnapshotStatus(0)\">\r\n <div class=\"card-status-idle\">\r\n <span>IDLE</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.isSnapshotStatus(1)\">\r\n <div class=\"card-status-computing\">\r\n <span>COMPUTING</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.isSnapshotStatus(2)\">\r\n <div class=\"card-status-awaiting-data\">\r\n <span>WAITING</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"n.isSnapshotStatus(3)\">\r\n <div class=\"card-status-ready\">\r\n <span>READY</span>\r\n <button class=\"btn btn-editor-xs btn-outline-secondary btn-outline-discrete btn-snapshot-details d-inline-block\" data-id=\"getId()\" v-on:click=\"openSnapshotDetails\"><i class=\"fas fa-info-circle\"></i></button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div v-if=\"!example && n.isUI() && !n.isOnAPanel()\">\r\n <div @click=\"registerToPanel\" class=\"card-problem\">\r\n <i class=\"fas fa-exclamation-circle\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"top\" data-content=\"This UI is not set in a panel. It won't have any effect. Go to the Interface tab to add it to a panel.\"></i>\r\n </div>\r\n </div>\r\n\r\n <div class=\"card-top\">\r\n <div class=\"d-flex\">\r\n <span class=\"title\" style=\"white-space: nowrap; margin-right: 5px;\">\r\n <span v-if=\"n.isMetanode()\" class=\"badge badge-secondary\"><b>META</b></span> {{n.graphId}}\r\n <i v-if=\"n.isParallel()\" class=\"fas fa-server\" style=\"color: orange;\" title=\"this module is computed in a web worker\"></i>\r\n </span>\r\n\r\n <div class=\"ml-auto\">\r\n <button class=\"btn btn-outline-secondary btn-outline-discrete btn-editor-xs btn-settings\" v-on:click=\"openNodeSettings\"><i class=\"fas fa-cog\"></i></button>\r\n </div>\r\n </div>\r\n </div>\r\n <div v-if=\"!n.isInput() && !n.isOutput()\" class=\"card-center\">\r\n <hr style=\"margin-bottom: 5px;\" />\r\n <div class=\"dualbox-io\" style=\"overflow: visible;\">\r\n <div class=\"inputs\" style=\"display: inline-block; float: left;\">\r\n <div class=\"box-inputs\">\r\n <div class=\"types\">\r\n <span class=\"type\" v-for=\"key in getVisibleInputs()\" v-bind:data-key=\"key\">\r\n {{ n.getInputType(key) }}\r\n </span>\r\n </div>\r\n <div class=\"points\">\r\n <div class=\"point\" v-for=\"key in getVisibleInputs()\" v-bind:data-key=\"key\" v-bind:data-type=\"n.getInputDef(key).type\" v-html=\"point\"></div>\r\n </div>\r\n <div class=\"names\">\r\n <span class=\"name\" v-for=\"key in getVisibleInputs()\" :class=\"{'feedback': n.isFeedbackTarget(key), 'input-not-resolvable': !example && !n.isInputResolvable(key) }\" v-bind:data-input=\"key\">\r\n <span v-if=\"n.hasIterator(key)\"><{{key}}></span>\r\n <span v-else>{{key}}</span>\r\n <small v-if=\"!n.isInputConst(key)\" data-toggle=\"tooltip\" data-trigger=\"hover\" title=\"this value will be cloned at execution time\"><i class=\"fas fa-clone transparent\"></i></small>\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"outputs\" style=\"display: inline-block; float: right\">\r\n <div class=\"box-outputs\">\r\n <div class=\"names\">\r\n <span class=\"name\" v-for=\"key in getVisibleOutputs()\" v-bind:class=\"{feedback: n.isFeedbackTarget(key)}\" v-bind:data-output=\"key\">\r\n <span v-if=\"n.hasLoop() && n.hasFeedback(key)\">{{key}}</span>\r\n <span v-else-if=\"n.hasLoop() && !n.hasFeedback(key)\"><{{key}}></span>\r\n <span v-else>{{key}}</span>\r\n\r\n <span v-if=\"n.hasCacheActivated()\">\r\n <i class=\"fa fa-hdd\" title=\"This module has cache activated\"></i>\r\n </span>\r\n </span>\r\n </div>\r\n <div class=\"points\">\r\n <div class=\"point\" v-for=\"key in getVisibleOutputs()\" v-bind:data-key=\"key\" v-bind:data-type=\"n.getOutputDef(key).type\" v-html=\"point\"></div>\r\n </div>\r\n <div class=\"types\">\r\n <span class=\"type\" v-for=\"key in getVisibleOutputs()\" v-bind:data-key=\"key\">\r\n {{ n.getOutputType(key) }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <hr style=\"margin-top: 5px;\" />\r\n <div class=\"card-bottom\">\r\n <span class=\"subtitle\">{{ shortName }}</span>\r\n\r\n <div v-if=\"n.isMetanode()\" class=\"d-inline-block\">\r\n <button class=\"btn btn-outline-secondary btn-outline-discrete btn-editor-xs btn-enter-metanode\" v-on:click=\"enterMetanode\"><i class=\"fas fa-sign-in-alt\"></i></button>\r\n </div>\r\n\r\n <!--\r\n <div v-if=\"n.isUI()\" class=\"event-dock event-dock-bottom\"></div>\r\n -->\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport ContextMenu from \"../ContextMenu\";\r\nimport _ from \"lodash-es\";\r\nimport dbutils from \"../../m/DualboxUtils\";\r\n\r\n// fix inputs types and output types position relatively to the div\r\n$.fn.fixCardDisplay = function() {\r\n var offsetPoint = 12;\r\n var offsetBorder = parseInt($(this).css(\"border-top-width\"));\r\n\r\n // if we have width or height set to 0, we are not ready yet to\r\n // execute this function. Postpone it.\r\n if( $(this).width() === 0 || $(this).height() === 0 ) {\r\n setTimeout(() => {\r\n $(this).fixCardDisplay();\r\n }, 50);\r\n return;\r\n }\r\n\r\n if (\r\n $(this)\r\n .find(\".box-inputs\")\r\n .height() === 0 &&\r\n $(this)\r\n .find(\".box-outputs\")\r\n .height() === 0\r\n ) {\r\n // if this card has no input/output, remove the card center\r\n $(this)\r\n .find(\".card-center\")\r\n .remove();\r\n } else {\r\n // else, adjust the input/output display for endpoints\r\n // 1) translate inputs by the right amount of pixels to have the circle on the line\r\n var boxInputs = $(this).find(\".box-inputs\");\r\n\r\n // fix css names width\r\n var namesDiv = boxInputs.find(\".names\");\r\n namesDiv.css(\"width\", namesDiv.width() + 1 + \"px\");\r\n\r\n // translate inputs to the left\r\n var translateLeft =\r\n boxInputs.find(\".types\").width() + offsetPoint + offsetBorder / 2;\r\n $(this)\r\n .find(\".box-inputs\")\r\n .css(\"transform\", \"translateX(-\" + translateLeft + \"px)\");\r\n\r\n // adjust inputs main div width\r\n $(this)\r\n .find(\".inputs\")\r\n .width(\r\n $(this)\r\n .find(\".inputs\")\r\n .width() -\r\n translateLeft +\r\n 10 /* margin */\r\n );\r\n\r\n // 2) translate outputs by the right amount of pixels to have the circle on the line\r\n var boxOutputs = $(this).find(\".box-outputs\");\r\n\r\n // fix css names with\r\n var namesDiv = boxOutputs.find(\".names\");\r\n namesDiv.css(\"width\", namesDiv.width() + 1 + \"px\");\r\n\r\n // translate inputs to the right\r\n var translateRight =\r\n boxOutputs.find(\".types\").width() + offsetPoint + offsetBorder / 2;\r\n $(this)\r\n .find(\".box-outputs\")\r\n .css(\"transform\", \"translateX(\" + translateRight + \"px)\");\r\n\r\n // adjust output main div width\r\n $(this)\r\n .find(\".outputs\")\r\n .width(\r\n $(this)\r\n .find(\".outputs\")\r\n .width() -\r\n translateRight +\r\n 10 /* margin */\r\n );\r\n\r\n // fix io width\r\n //$('.dualbox-io').css('width', (($(this).find('.inputs').width() + $(this).find('.outputs').width()) + \"px\"));\r\n }\r\n\r\n $(this).ready(() => {\r\n // take the current width and add it as a css property\r\n var width = $(this).width();\r\n width += parseInt($(this).css(\"padding-right\"));\r\n width += parseInt($(this).css(\"padding-left\"));\r\n width += parseInt($(this).css(\"border-left-width\"));\r\n width += parseInt($(this).css(\"border-right-width\"));\r\n $(this).css(\"width\", Math.ceil(width) + \"px\");\r\n });\r\n};\r\n\r\n// find position of element relative to an ancestor matching selector\r\n$.fn.positionFrom = function(selector) {\r\n var ancestor = $(this).closest(selector);\r\n var offset = $(this).offset();\r\n var ancestorOffset = ancestor.offset();\r\n return {\r\n top: offset.top - ancestorOffset.top,\r\n left: offset.left - ancestorOffset.left\r\n };\r\n};\r\n\r\nexport default {\r\n props: [\r\n \"id\", // the module id\r\n \"pkg\", // the module package.json\r\n \"n\", // the GraphNode object (from model)\r\n \"example\", // true if this vue is used as an example display (no need to connect)\r\n \"displayEvents\" // true if events should be displayed\r\n ],\r\n data: function() {\r\n return {\r\n shortName: \"\",\r\n point:\r\n '<svg width=\"14\" height=\"14\" pointer-events=\"all\" position=\"absolute\" version=\"1.1\" xmlns=\"http://www.w3.org/1999/xhtml\"><circle cx=\"7\" cy=\"7\" r=\"5\" version=\"1.1\" xmlns=\"http://www.w3.org/1999/xhtml\" fill=\"#ffffff\" stroke=\"#727272\" style=\"\" stroke-width=\"2\"></circle></svg>'\r\n };\r\n },\r\n beforeUpdate: function() {\r\n //console.log('[UPDATING] ' + this.n.getUniqId());\r\n },\r\n destroyed: function() {\r\n this.deactivateTooltip();\r\n $(\".tooltip\").remove();\r\n },\r\n created: function() {\r\n this.initialized = false;\r\n this.view = window.dualboxEditor.v;\r\n\r\n //console.log('[CREATED] ' + this.n.getUniqId());\r\n // We compute the shortname of our box\r\n if (this.n.isInput() || this.n.isOutput()) {\r\n this.shortName = this.n.getType();\r\n } else {\r\n this.shortName = dbutils.shortName(this.pkg.name);\r\n }\r\n },\r\n mounted: async function() {\r\n //console.log('[MOUNTED] ' + this.n.getUniqId());\r\n var div = $(this.$el);\r\n div.fixCardDisplay();\r\n this.activateTooltip();\r\n return await this.initialize();\r\n },\r\n beforeUpdate: function() {\r\n this.deactivateTooltip();\r\n },\r\n updated: async function() {\r\n //console.log('[UPDATED] ' + this.n.getUniqId());\r\n\r\n // we reset jsPlumb before app update (in graph.vue)\r\n // so we need to initialize again\r\n this.assignContextMenu();\r\n\r\n $(this.$el).fixCardDisplay();\r\n $(this.$el).ready(() => {\r\n this.activateTooltip();\r\n });\r\n return await this.initialize();\r\n },\r\n activate: function() {\r\n this.activateTooltip();\r\n },\r\n deactivate: function() {\r\n this.deactivateTooltip();\r\n },\r\n methods: {\r\n getId: function() {\r\n // if this is an example graphNode, change our \"id\" to \"id-junk\"\r\n // to avoid connection jsplumb conflicts with the real node\r\n return this.example ? this.id + \"-junk\" : this.id;\r\n },\r\n\r\n activateTooltip: function() {\r\n $(this.$el)\r\n .find('[data-toggle=\"tooltip\"]')\r\n .tooltip();\r\n },\r\n\r\n deactivateTooltip: function() {\r\n $(this.$el)\r\n .find('[data-toggle=\"tooltip\"]')\r\n .tooltip(\"dispose\");\r\n },\r\n\r\n initialize: async function() {\r\n var self = this;\r\n var div = $(this.$el);\r\n var id = this.getId();\r\n var view = this.view;\r\n\r\n this.initialized = false;\r\n\r\n if (!this.example) {\r\n // if we have a position, set it\r\n var def = this.n.getDef();\r\n var position = _.get(def, [\"graph\", \"position\"]);\r\n if (position) {\r\n var jsPlumbElement = self.$parent.jsPlumbInstance.getElement(\r\n id\r\n );\r\n self.$parent.jsPlumbInstance.setPosition(\r\n jsPlumbElement,\r\n position\r\n );\r\n }\r\n\r\n // This needs to be registered before draggable\r\n div.on(\"mousedown\", function(e) {\r\n // if this div is not selected already, deselect the other divs\r\n if (!self.$parent.selector.isSelected(this)) {\r\n self.$parent.selector.deselect();\r\n }\r\n });\r\n\r\n await this.initializeJsPlumb();\r\n\r\n div.click(function(e) {\r\n if (e.ctrlKey) {\r\n view.selector.toggleSelection(this);\r\n }\r\n });\r\n\r\n this.assignContextMenu();\r\n }\r\n\r\n return new Promise(resolve => {\r\n div.ready(() => {\r\n //console.log('[INITIALIZED] ' + this.n.getUniqId());\r\n this.initialized = true;\r\n resolve();\r\n });\r\n });\r\n },\r\n\r\n initializeJsPlumb: function() {\r\n var self = this;\r\n var div = $(this.$el);\r\n var id = this.getId();\r\n var view = this.view;\r\n\r\n if (!this.example) {\r\n // If this node was never initialized in this jsplumb instance, do it\r\n if (\r\n !_.get(this.$parent.jsPlumbInstance, [\r\n \"initializedNodes\",\r\n id\r\n ])\r\n ) {\r\n _.set(\r\n this.$parent.jsPlumbInstance,\r\n [\"initializedNodes\", id],\r\n true\r\n ); // initialized\r\n\r\n if (this.n.isInput() || this.n.isOutput()) {\r\n var type = \"*\";\r\n var input = \"value\";\r\n var output = \"value\";\r\n var offsetTop =\r\n $(div)\r\n .find(\".card-top\")\r\n .height() +\r\n 12 /* hr size */ -\r\n 3;\r\n\r\n var uuid = [id, \"input\", input].join(\"#\");\r\n var ep = this.$parent.jsPlumbInstance.addEndpoint(\r\n id,\r\n {\r\n isSource: false,\r\n isTarget: true,\r\n uuid: uuid,\r\n anchor: [0, 0, -1, 0, 0, offsetTop],\r\n maxConnections: 1,\r\n parameters: {\r\n type: \"data\",\r\n target: {\r\n id: id,\r\n input: output\r\n }\r\n }\r\n },\r\n this.$parent.style.inputEndpoint\r\n );\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr(\"data-node\", id);\r\n $(ep.canvas).attr(\"data-type\", \"input\");\r\n $(ep.canvas).attr(\"data-input\", input);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr(\"data-toggle\", \"tooltip\");\r\n $(ep.canvas).attr(\"data-trigger\", \"hover\");\r\n $(ep.canvas).attr(\"data-placement\", \"left\");\r\n $(ep.canvas).attr(\"data-html\", \"true\");\r\n var inputType = view.m\r\n .getNode(id)\r\n .getInputType(\"value\");\r\n $(ep.canvas).attr(\r\n \"title\",\r\n \"Type: <b>\" + inputType + \"</b>\"\r\n );\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass(\"capture-right-click\");\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\r\n \".jtk-endpoint-anchor[data-node='\" +\r\n id.trim() +\r\n \"'][data-input='\" +\r\n input +\r\n \"']\",\r\n [\r\n {\r\n name: \"Create input for here\",\r\n fn: () => {\r\n view.c.createInputFromConnection(\r\n id,\r\n input\r\n );\r\n }\r\n }\r\n ]\r\n );\r\n });\r\n\r\n var uuid = [id, \"output\", output].join(\"#\");\r\n var ep = this.$parent.jsPlumbInstance.addEndpoint(\r\n id,\r\n {\r\n isSource: true,\r\n isTarget: false,\r\n uuid: uuid,\r\n anchor: [1, 0, 1, 0, 0, offsetTop],\r\n parameters: {\r\n type: \"data\",\r\n source: {\r\n id: id,\r\n output: output\r\n }\r\n }\r\n },\r\n this.$parent.style.outputEndpoint\r\n );\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr(\"data-node\", id);\r\n $(ep.canvas).attr(\"data-type\", \"output\");\r\n $(ep.canvas).attr(\"data-output\", output);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr(\"data-toggle\", \"tooltip\");\r\n $(ep.canvas).attr(\"data-trigger\", \"hover\");\r\n $(ep.canvas).attr(\"data-placement\", \"right\");\r\n $(ep.canvas).attr(\"data-html\", \"true\");\r\n var outputType = view.m\r\n .getNode(id)\r\n .getOutputType(\"value\");\r\n $(ep.canvas).attr(\r\n \"title\",\r\n \"Type: <b>\" + outputType + \"</b>\"\r\n );\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass(\"capture-right-click\");\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\r\n \".jtk-endpoint-anchor[data-node='\" +\r\n id.trim() +\r\n \"'][data-output='\" +\r\n output.trim() +\r\n \"']\",\r\n [\r\n {\r\n name: \"Create output for here\",\r\n fn: () => {\r\n view.c.createOutputFromConnection(\r\n id,\r\n output\r\n );\r\n }\r\n }\r\n ]\r\n );\r\n });\r\n } else {\r\n // add input endoints\r\n div.find(\".box-inputs\")\r\n .find(\".point\")\r\n .each(function(index) {\r\n $(this)\r\n .css(\"visibility\", \"hidden\")\r\n .css(\"opacity\", \"0\"); // replaced by jsPlumb point\r\n\r\n var input = div\r\n .find(\".box-inputs\")\r\n .find(\".name\")\r\n .eq(index)\r\n .attr(\"data-input\")\r\n .trim();\r\n var type = view.m\r\n .getNode(id)\r\n .getInputType(input);\r\n\r\n var offsetTop =\r\n $(this).positionFrom(\".card\").top +\r\n $(this).height() / 2 -\r\n 3;\r\n var uuid = [\r\n id,\r\n \"input\",\r\n $(this).data(\"key\")\r\n ].join(\"#\");\r\n var ep = self.$parent.jsPlumbInstance.addEndpoint(\r\n id,\r\n {\r\n isSource: false,\r\n isTarget: true,\r\n uuid: uuid,\r\n anchor: [0, 0, -1, 0, 0, offsetTop],\r\n maxConnections: 1,\r\n parameters: {\r\n type: \"data\",\r\n target: {\r\n id: id,\r\n input: $(this).data(\"key\")\r\n }\r\n }\r\n },\r\n self.$parent.style.inputEndpoint\r\n );\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr(\"data-node\", id);\r\n $(ep.canvas).attr(\"data-type\", \"input\");\r\n $(ep.canvas).attr(\"data-input\", input);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr(\"data-toggle\", \"tooltip\");\r\n $(ep.canvas).attr(\"data-trigger\", \"hover\");\r\n $(ep.canvas).attr(\"data-placement\", \"left\");\r\n $(ep.canvas).attr(\"data-html\", \"true\");\r\n $(ep.canvas).attr(\r\n \"title\",\r\n \"Type: <b>\" + type + \"</b>\"\r\n );\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass(\"capture-right-click\");\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\r\n \".jtk-endpoint-anchor[data-node='\" +\r\n id.trim() +\r\n \"'][data-input='\" +\r\n input.trim() +\r\n \"']\",\r\n [\r\n {\r\n name: \"Create input for here\",\r\n fn: () => {\r\n view.c.createInputFromConnection(\r\n id,\r\n input\r\n );\r\n }\r\n }\r\n ]\r\n );\r\n });\r\n });\r\n\r\n // add output endpoints\r\n div.find(\".box-outputs\")\r\n .find(\".point\")\r\n .each(function(index) {\r\n $(this)\r\n .css(\"visibility\", \"hidden\")\r\n .css(\"opacity\", \"0\"); // replaced by jsPlumb point\r\n\r\n var output = div\r\n .find(\".box-outputs\")\r\n .find(\".name\")\r\n .eq(index)\r\n .attr(\"data-output\")\r\n .trim();\r\n var type = view.m\r\n .getNode(id)\r\n .getOutputType(output);\r\n\r\n var offsetTop =\r\n $(this).positionFrom(\".card\").top +\r\n $(this).height() / 2 -\r\n 3;\r\n var uuid = [\r\n id,\r\n \"output\",\r\n $(this).data(\"key\")\r\n ].join(\"#\");\r\n var ep = self.$parent.jsPlumbInstance.addEndpoint(\r\n id,\r\n {\r\n isSource: true,\r\n isTarget: false,\r\n uuid: uuid,\r\n anchor: [1, 0, 1, 0, 0, offsetTop],\r\n parameters: {\r\n type: \"data\",\r\n source: {\r\n id: id,\r\n output: $(this).data(\"key\")\r\n }\r\n }\r\n },\r\n self.$parent.style.outputEndpoint\r\n );\r\n\r\n // add data to the endpoint div so we can identify it easier\r\n $(ep.canvas).attr(\"data-node\", id);\r\n $(ep.canvas).attr(\"data-type\", \"output\");\r\n $(ep.canvas).attr(\"data-output\", output);\r\n\r\n // bind tooltip\r\n $(ep.canvas).attr(\"data-toggle\", \"tooltip\");\r\n $(ep.canvas).attr(\"data-trigger\", \"hover\");\r\n $(ep.canvas).attr(\"data-placement\", \"right\");\r\n $(ep.canvas).attr(\"data-html\", \"true\");\r\n $(ep.canvas).attr(\r\n \"title\",\r\n \"Type: <b>\" + type + \"</b>\"\r\n );\r\n $(ep.canvas).tooltip();\r\n\r\n // bind context menu to the endpoint\r\n $(ep.canvas).addClass(\"capture-right-click\");\r\n $(ep.canvas).ready(function() {\r\n var menu = new ContextMenu(\r\n \".jtk-endpoint-anchor[data-node='\" +\r\n id.trim() +\r\n \"'][data-output='\" +\r\n output.trim() +\r\n \"']\",\r\n [\r\n {\r\n name: \"Create output for here\",\r\n fn: () => {\r\n view.c.createOutputFromConnection(\r\n id,\r\n output\r\n );\r\n }\r\n }\r\n ]\r\n );\r\n });\r\n });\r\n\r\n if (this.n.isUI() && this.displayEvents) {\r\n // Make this a target for events\r\n this.$parent.jsPlumbInstance.makeTarget(\r\n id,\r\n {\r\n isSource: false,\r\n isTarget: true,\r\n uniqueEndpoint: false,\r\n anchor: \"Continuous\",\r\n uuid: id + \"#event-in\",\r\n paintStyle: {\r\n fill: \"green\",\r\n radius: 3,\r\n stroke: \"#727272\",\r\n strokeWidth: 1\r\n },\r\n parameters: {\r\n type: \"event\",\r\n target: { id: id }\r\n }\r\n },\r\n self.$parent.style.eventEndpoint\r\n );\r\n\r\n // Create an enpoint to create a new event\r\n var ep = this.$parent.jsPlumbInstance.addEndpoint(\r\n id,\r\n {\r\n isSource: true,\r\n isTarget: false,\r\n uuid: id + \"#event-out\",\r\n anchor: [1, 1, 0, 1, 0, -10],\r\n parameters: {\r\n type: \"event\",\r\n source: { id: id }\r\n },\r\n paintStyle: {\r\n fill: \"green\",\r\n radius: 3,\r\n stroke: \"#727272\",\r\n strokeWidth: 1\r\n }\r\n },\r\n this.$parent.style.eventEndpoint\r\n );\r\n\r\n // Add overlay here so we don't mess with splitConnection\r\n ep.addOverlay([\r\n \"PlainArrow\",\r\n {\r\n width: 15,\r\n length: 15,\r\n location: 1,\r\n id: \"arrow\"\r\n }\r\n ]);\r\n\r\n $(ep.canvas).attr(\"data-toggle\", \"tooltip\");\r\n $(ep.canvas).attr(\"data-trigger\", \"hover\");\r\n $(ep.canvas).attr(\"data-placement\", \"bottom\");\r\n $(ep.canvas).attr(\"data-html\", \"true\");\r\n $(ep.canvas).attr(\r\n \"title\",\r\n \"Connect from here ito add an event that will be triggered when this box is done computing.\"\r\n );\r\n $(ep.canvas).tooltip();\r\n }\r\n }\r\n\r\n // Make the div draggable\r\n this.$parent.jsPlumbInstance.draggable(div, {\r\n //containment:true, // not allowed outside of container div\r\n drag: function(e) {\r\n // TODO: bug. After a repaint(), jsPlumb seems to be broken (connections dont follow on div drag)\r\n // It doesn't occur on jsPlumb.reset() instead of creating another instance on beforeUpdate(),\r\n // (as it should be), but we can't do that, because JsPlumb is broken on zoom otherwise...\r\n // One of thoses problem may be fixed later by updating jsPlumb...\r\n // Note: this \"fix\" may affect performances on drag, maybe a setTimeout will do\r\n //self.$parent.jsPlumbInstance.repaintEverything();\r\n self.$parent.jsPlumbInstance.repaint(id);\r\n },\r\n stop: function(e) {\r\n // resize the canvas if necessary\r\n self.$parent.canvasSizeHandler.debouncedResize();\r\n\r\n if (\r\n self.$parent.selector.isMultipleSelectionActive()\r\n ) {\r\n // We just dropped a bunch of divs, ajust all their positions\r\n self.view.m.batch(() => {\r\n self.$parent.selector.each(div => {\r\n var pos = self.$parent.jsPlumbInstance.getPosition(\r\n div\r\n );\r\n view.m\r\n .getNode($(div).attr(\"id\"))\r\n .setPosition(pos);\r\n });\r\n });\r\n } else {\r\n // We just dropped this one, set the new position in the graph model\r\n var el = self.$parent.jsPlumbInstance.getElement(\r\n id\r\n );\r\n $(el).ready(function() {\r\n var pos = self.$parent.jsPlumbInstance.getPosition(\r\n el\r\n );\r\n view.m.getNode(id).setPosition(pos);\r\n });\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n return new Promise(resolve =>\r\n this.$parent.jsPlumbInstance.ready(resolve)\r\n );\r\n },\r\n\r\n assignContextMenu: function() {\r\n var id = this.getId();\r\n\r\n // Create a contextmenu for the div\r\n var contextOptions = [\r\n {\r\n name: \"Remove this box\",\r\n fn: () => {\r\n this.view.c.removeBox(id);\r\n }\r\n }\r\n ];\r\n if (this.n.isModule() || this.n.isUI()) {\r\n contextOptions.push({\r\n name: \"Duplicate this box\",\r\n fn: () => {\r\n this.view.c.duplicateBox(id);\r\n }\r\n });\r\n }\r\n var nodeMenu = new ContextMenu(\"#\" + id, contextOptions);\r\n },\r\n\r\n htmlentities: function(s) {\r\n return this.view.utils.htmlentities(s);\r\n },\r\n\r\n getVisibleInputs: function() {\r\n return this.n.getInputsNames().filter(inputName => {\r\n return this.n.isInputVisible(inputName);\r\n });\r\n },\r\n\r\n getVisibleOutputs: function() {\r\n return this.n.getOutputsNames().filter(outputName => {\r\n return this.n.isOutputVisible(outputName);\r\n });\r\n },\r\n\r\n enterMetanode: function(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n this.view.c.enterMetanode(this.id);\r\n },\r\n\r\n openNodeSettings: function(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n this.view.openBoxSettings(this.id);\r\n },\r\n\r\n openSnapshotDetails: async function(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n await this.view.openDebug(this.id);\r\n },\r\n\r\n registerToPanel: async function(e) {\r\n await this.view.c.registerNodeToInterface(this.id);\r\n }\r\n },\r\n watch: {\r\n app: {\r\n handler: () => {\r\n console.log(\"graphVue.app changed\");\r\n },\r\n deep: true\r\n }\r\n }\r\n};\r\n</script>\r\n"]}, media: undefined });
|
|
47550
47835
|
|
|
47551
47836
|
};
|
|
47552
47837
|
/* scoped */
|