@dualbox/editor 1.0.72 → 1.0.73
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/html/editor.html +1 -1
- package/js/dist/GraphEditor.js +430 -395
- package/js/dist/GraphEditor.min.js +429 -394
- package/js/src/c/GraphController.js +66 -67
- package/js/src/m/GraphModel.js +34 -9
- package/js/src/m/History.js +23 -6
- package/js/src/v/GraphView.js +4 -0
- package/js/src/v/templates/editMainSettings.vue +1 -1
- package/js/src/v/templates/editNodeSettings.vue +4 -3
- package/js/src/v/templates/editValue.vue +123 -125
- package/js/src/v/templates/graphNode.vue +185 -200
- package/js/src/v/templates/main.vue +192 -175
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<style>
|
|
2
2
|
.card-ui {
|
|
3
|
-
background-color: #bff2ca!important;
|
|
3
|
+
background-color: #bff2ca !important;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.card-loop {
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.card-input {
|
|
13
|
-
background-color: #f5d76e!important;
|
|
13
|
+
background-color: #f5d76e !important;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.card-output {
|
|
17
|
-
background-color: #ffb3a7!important;
|
|
17
|
+
background-color: #ffb3a7 !important;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.box-inputs {
|
|
@@ -33,26 +33,25 @@
|
|
|
33
33
|
text-align: right;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.dualbox-graph-canvas .card,
|
|
36
|
+
.dualbox-graph-canvas .card,
|
|
37
|
+
.card-node {
|
|
37
38
|
/*border: 1px solid #dddddd;*/
|
|
38
39
|
box-shadow: 1px 1px 5px #716f6f;
|
|
39
40
|
opacity: 1;
|
|
40
41
|
cursor: pointer;
|
|
41
42
|
z-index: 20;
|
|
42
43
|
position: absolute;
|
|
43
|
-
|
|
44
44
|
-webkit-transition: -webkit-box-shadow 0.15s ease-in;
|
|
45
45
|
-moz-transition: -moz-box-shadow 0.15s ease-in;
|
|
46
46
|
-o-transition: -o-box-shadow 0.15s ease-in;
|
|
47
47
|
transition: box-shadow 0.15s ease-in;
|
|
48
|
-
|
|
49
48
|
color: #4d4d4d;
|
|
50
49
|
user-select: none;
|
|
51
50
|
padding: 0px 8px 0px 8px;
|
|
52
|
-
overflow:hidden;
|
|
51
|
+
overflow: hidden;
|
|
53
52
|
background-color: #fff;
|
|
54
53
|
-moz-border-radius: 3px;
|
|
55
|
-
border-radius:3px;
|
|
54
|
+
border-radius: 3px;
|
|
56
55
|
font-size: 14px;
|
|
57
56
|
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
58
57
|
}
|
|
@@ -71,7 +70,7 @@
|
|
|
71
70
|
.card-node hr {
|
|
72
71
|
margin-top: 2px;
|
|
73
72
|
margin-bottom: 2px;
|
|
74
|
-
border-color: rgba(0,0,0,0.1);
|
|
73
|
+
border-color: rgba(0, 0, 0, 0.1);
|
|
75
74
|
margin-left: -8px;
|
|
76
75
|
margin-right: -8px;
|
|
77
76
|
}
|
|
@@ -81,7 +80,8 @@
|
|
|
81
80
|
box-shadow: 1px 1px 10px #80b2fc;
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
.card-node.selected,
|
|
83
|
+
.card-node.selected,
|
|
84
|
+
.card-node.selected:hover {
|
|
85
85
|
border-color: #0066ff;
|
|
86
86
|
box-shadow: 1px 1px 10px #0066ff;
|
|
87
87
|
}
|
|
@@ -91,19 +91,19 @@
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
.input-not-resolvable {
|
|
94
|
-
color: #dd6666!important;
|
|
94
|
+
color: #dd6666 !important;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.card-node .title {
|
|
98
|
-
vertical-align:top;
|
|
98
|
+
vertical-align: top;
|
|
99
99
|
font-weight: bold;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
.card-node .subtitle {
|
|
103
|
-
color
|
|
103
|
+
color: #929292;
|
|
104
104
|
font-size: 11px;
|
|
105
105
|
font-style: italic;
|
|
106
|
-
vertical-align:center;
|
|
106
|
+
vertical-align: center;
|
|
107
107
|
font-family: tahoma, sans-serif;
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
.card-node .output {
|
|
116
116
|
font-size: 13px;
|
|
117
117
|
color: #8c8c8c;
|
|
118
|
-
text-align:right;
|
|
118
|
+
text-align: right;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.card-node .jtk-endpoint.active svg circle {
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
.types {
|
|
150
|
-
color: #6c757d!important;
|
|
150
|
+
color: #6c757d !important;
|
|
151
151
|
opacity: 0.7;
|
|
152
152
|
pointer-events: none;
|
|
153
153
|
}
|
|
@@ -212,10 +212,10 @@ span.feedback {
|
|
|
212
212
|
|
|
213
213
|
.event-dock {
|
|
214
214
|
background-color: rgb(136, 137, 138);
|
|
215
|
-
background-color:
|
|
215
|
+
background-color: #a6a6a6;
|
|
216
216
|
width: calc(100% + 18px);
|
|
217
217
|
height: 12px;
|
|
218
|
-
z-index: 3!important;
|
|
218
|
+
z-index: 3 !important;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
.event-dock-top {
|
|
@@ -234,15 +234,16 @@ span.feedback {
|
|
|
234
234
|
border-bottom-left-radius: 4px;
|
|
235
235
|
border-bottom-right-radius: 4px;
|
|
236
236
|
margin-top: 4px;
|
|
237
|
-
height: 11px;
|
|
237
|
+
height: 11px;
|
|
238
|
+
/* shorter because of box-shadow */
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
.event-label {
|
|
241
242
|
z-index: 21;
|
|
242
243
|
padding-left: 15px;
|
|
243
|
-
transform: rotate(-90deg) translate(0%, -50%)!important;
|
|
244
|
+
transform: rotate(-90deg) translate(0%, -50%) !important;
|
|
244
245
|
transform-origin: 0% 0%;
|
|
245
|
-
color: #6c757d!important;
|
|
246
|
+
color: #6c757d !important;
|
|
246
247
|
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
247
248
|
font-size: 14px;
|
|
248
249
|
opacity: 0.7;
|
|
@@ -250,7 +251,7 @@ span.feedback {
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
.transparent {
|
|
253
|
-
opacity: 0.3!important;
|
|
254
|
+
opacity: 0.3 !important;
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
.card-node {
|
|
@@ -262,7 +263,7 @@ span.feedback {
|
|
|
262
263
|
top: 0;
|
|
263
264
|
right: 0;
|
|
264
265
|
margin-top: -22px;
|
|
265
|
-
color: #f4ad42!important;
|
|
266
|
+
color: #f4ad42 !important;
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
.card-problem {
|
|
@@ -270,35 +271,33 @@ span.feedback {
|
|
|
270
271
|
top: 0;
|
|
271
272
|
left: 0;
|
|
272
273
|
margin-top: -22px;
|
|
273
|
-
color: red!important;
|
|
274
|
+
color: red !important;
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
.card-snapshot {
|
|
277
|
-
|
|
278
|
-
}
|
|
277
|
+
.card-snapshot {}
|
|
279
278
|
|
|
280
279
|
.card-snapshot-idle {
|
|
281
|
-
border: 2px solid gray!important;
|
|
282
|
-
box-shadow: 1px 1px 5px gray!important;
|
|
283
|
-
opacity: 0.7!important;
|
|
280
|
+
border: 2px solid gray !important;
|
|
281
|
+
box-shadow: 1px 1px 5px gray !important;
|
|
282
|
+
opacity: 0.7 !important;
|
|
284
283
|
}
|
|
285
284
|
|
|
286
285
|
.card-snapshot-computing {
|
|
287
|
-
border: 2px solid darkgreen!important;
|
|
288
|
-
box-shadow: 1px 1px 5px darkgreen!important;
|
|
289
|
-
opacity: 1!important;
|
|
286
|
+
border: 2px solid darkgreen !important;
|
|
287
|
+
box-shadow: 1px 1px 5px darkgreen !important;
|
|
288
|
+
opacity: 1 !important;
|
|
290
289
|
}
|
|
291
290
|
|
|
292
291
|
.card-snapshot-awaiting-data {
|
|
293
|
-
border: 2px solid blue!important;
|
|
294
|
-
box-shadow: 1px 1px 5px blue!important;
|
|
295
|
-
opacity: 0.7!important;
|
|
292
|
+
border: 2px solid blue !important;
|
|
293
|
+
box-shadow: 1px 1px 5px blue !important;
|
|
294
|
+
opacity: 0.7 !important;
|
|
296
295
|
}
|
|
297
296
|
|
|
298
297
|
.card-snapshot-ready {
|
|
299
|
-
border: 2px solid lightgreen!important;
|
|
300
|
-
box-shadow: 1px 1px 5px lightgreen!important;
|
|
301
|
-
opacity: 1!important;
|
|
298
|
+
border: 2px solid lightgreen !important;
|
|
299
|
+
box-shadow: 1px 1px 5px lightgreen !important;
|
|
300
|
+
opacity: 1 !important;
|
|
302
301
|
}
|
|
303
302
|
|
|
304
303
|
.card-status {
|
|
@@ -307,29 +306,29 @@ span.feedback {
|
|
|
307
306
|
right: 0;
|
|
308
307
|
left: 0;
|
|
309
308
|
margin-bottom: -26px;
|
|
310
|
-
color: #f4ad42!important;
|
|
309
|
+
color: #f4ad42 !important;
|
|
311
310
|
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
312
311
|
font-weight: bold;
|
|
313
312
|
text-align: center;
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
.card-status-idle {
|
|
317
|
-
color: gray!important;
|
|
316
|
+
color: gray !important;
|
|
318
317
|
min-width: 85px;
|
|
319
318
|
}
|
|
320
319
|
|
|
321
320
|
.card-status-computing {
|
|
322
|
-
color: darkgreen!important;
|
|
321
|
+
color: darkgreen !important;
|
|
323
322
|
min-width: 110px;
|
|
324
323
|
}
|
|
325
324
|
|
|
326
325
|
.card-status-awaiting-data {
|
|
327
|
-
color: blue!important;
|
|
326
|
+
color: blue !important;
|
|
328
327
|
min-width: 85px;
|
|
329
328
|
}
|
|
330
329
|
|
|
331
330
|
.card-status-ready {
|
|
332
|
-
color: lightgreen!important;
|
|
331
|
+
color: lightgreen !important;
|
|
333
332
|
min-width: 85px;
|
|
334
333
|
}
|
|
335
334
|
|
|
@@ -345,7 +344,8 @@ span.name {
|
|
|
345
344
|
</style>
|
|
346
345
|
|
|
347
346
|
<template>
|
|
348
|
-
<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) }"
|
|
347
|
+
<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) }"
|
|
348
|
+
v-bind:id="getId()" v-bind:data-id="getId()" v-bind:data-name="pkg.name" style="overflow: visible;">
|
|
349
349
|
<div v-if="n.hasComment()">
|
|
350
350
|
<div class="card-comment" data-toggle="tooltip" data-placement="top" :title="n.getComment()">
|
|
351
351
|
<i class="fas fa-comment-alt" data-container="body"></i>
|
|
@@ -393,9 +393,8 @@ span.name {
|
|
|
393
393
|
<div class="card-top">
|
|
394
394
|
<div class="d-flex">
|
|
395
395
|
<span class="title" style="white-space: nowrap; margin-right: 5px;">
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
<i v-if="n.isParallel()" class="fas fa-server" style="color: orange;" title="this module is computed in a web worker"></i>
|
|
396
|
+
<span v-if="n.isMetanode()" class="badge badge-secondary"><b>META</b></span> {{n.graphId}}
|
|
397
|
+
<i v-if="n.isParallel()" class="fas fa-server" style="color: orange;" title="this module is computed in a web worker"></i>
|
|
399
398
|
</span>
|
|
400
399
|
|
|
401
400
|
<div class="ml-auto">
|
|
@@ -404,23 +403,23 @@ span.name {
|
|
|
404
403
|
</div>
|
|
405
404
|
</div>
|
|
406
405
|
<div v-if="!n.isInput() && !n.isOutput()" class="card-center">
|
|
407
|
-
<hr style="margin-bottom: 5px;"/>
|
|
406
|
+
<hr style="margin-bottom: 5px;" />
|
|
408
407
|
<div class="dualbox-io" style="overflow: visible;">
|
|
409
408
|
<div class="inputs" style="display: inline-block; float: left;">
|
|
410
409
|
<div class="box-inputs">
|
|
411
410
|
<div class="types">
|
|
412
411
|
<span class="type" v-for="key in getVisibleInputs()" v-bind:data-key="key">
|
|
413
|
-
|
|
414
|
-
|
|
412
|
+
{{ n.getInputType(key) }}
|
|
413
|
+
</span>
|
|
415
414
|
</div>
|
|
416
415
|
<div class="points">
|
|
417
416
|
<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>
|
|
418
417
|
</div>
|
|
419
418
|
<div class="names">
|
|
420
419
|
<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">
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
420
|
+
<span v-if="n.hasIterator(key)"><{{key}}></span>
|
|
421
|
+
<span v-else>{{key}}</span>
|
|
422
|
+
<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>
|
|
424
423
|
</span>
|
|
425
424
|
</div>
|
|
426
425
|
</div>
|
|
@@ -429,13 +428,13 @@ span.name {
|
|
|
429
428
|
<div class="box-outputs">
|
|
430
429
|
<div class="names">
|
|
431
430
|
<span class="name" v-for="key in getVisibleOutputs()" v-bind:class="{feedback: n.isFeedbackTarget(key)}" v-bind:data-output="key">
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
<span v-if="n.hasLoop() && n.hasFeedback(key)">{{key}}</span>
|
|
432
|
+
<span v-else-if="n.hasLoop() && !n.hasFeedback(key)"><{{key}}></span>
|
|
433
|
+
<span v-else>{{key}}</span>
|
|
435
434
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
<span v-if="n.hasCacheActivated()">
|
|
436
|
+
<i class="fa fa-hdd" title="This module has cache activated"></i>
|
|
437
|
+
</span>
|
|
439
438
|
</span>
|
|
440
439
|
</div>
|
|
441
440
|
<div class="points">
|
|
@@ -443,15 +442,15 @@ span.name {
|
|
|
443
442
|
</div>
|
|
444
443
|
<div class="types">
|
|
445
444
|
<span class="type" v-for="key in getVisibleOutputs()" v-bind:data-key="key">
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
{{ n.getOutputType(key) }}
|
|
446
|
+
</span>
|
|
448
447
|
</div>
|
|
449
448
|
</div>
|
|
450
449
|
</div>
|
|
451
450
|
</div>
|
|
452
451
|
</div>
|
|
453
452
|
|
|
454
|
-
<hr style="margin-top: 5px;"/>
|
|
453
|
+
<hr style="margin-top: 5px;" />
|
|
455
454
|
<div class="card-bottom">
|
|
456
455
|
<span class="subtitle">{{ shortName }}</span>
|
|
457
456
|
|
|
@@ -460,8 +459,8 @@ span.name {
|
|
|
460
459
|
</div>
|
|
461
460
|
|
|
462
461
|
<!--
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
<div v-if="n.isUI()" class="event-dock event-dock-bottom"></div>
|
|
463
|
+
-->
|
|
465
464
|
</div>
|
|
466
465
|
</div>
|
|
467
466
|
</template>
|
|
@@ -476,25 +475,24 @@ $.fn.fixCardDisplay = function() {
|
|
|
476
475
|
var offsetPoint = 12;
|
|
477
476
|
var offsetBorder = parseInt($(this).css("border-top-width"));
|
|
478
477
|
|
|
479
|
-
if(
|
|
478
|
+
if ($(this).find('.box-inputs').height() === 0 && $(this).find('.box-outputs').height() === 0) {
|
|
480
479
|
// if this card has no input/output, remove the card center
|
|
481
480
|
$(this).find('.card-center').remove();
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
481
|
+
} else {
|
|
484
482
|
// else, adjust the input/output display for endpoints
|
|
485
483
|
// 1) translate inputs by the right amount of pixels to have the circle on the line
|
|
486
484
|
var boxInputs = $(this).find('.box-inputs');
|
|
487
485
|
|
|
488
486
|
// fix css names width
|
|
489
487
|
var namesDiv = boxInputs.find('.names');
|
|
490
|
-
namesDiv.css('width', (namesDiv.width()+1) + 'px');
|
|
488
|
+
namesDiv.css('width', (namesDiv.width() + 1) + 'px');
|
|
491
489
|
|
|
492
490
|
// translate inputs to the left
|
|
493
|
-
var translateLeft = boxInputs.find('.types').width() + offsetPoint + offsetBorder/2;
|
|
491
|
+
var translateLeft = boxInputs.find('.types').width() + offsetPoint + offsetBorder / 2;
|
|
494
492
|
$(this).find('.box-inputs').css('transform', 'translateX(-' + translateLeft + 'px)');
|
|
495
493
|
|
|
496
494
|
// adjust inputs main div width
|
|
497
|
-
$(this).find('.inputs').width(
|
|
495
|
+
$(this).find('.inputs').width($(this).find('.inputs').width() - translateLeft + 10 /* margin */ );
|
|
498
496
|
|
|
499
497
|
|
|
500
498
|
// 2) translate outputs by the right amount of pixels to have the circle on the line
|
|
@@ -505,11 +503,11 @@ $.fn.fixCardDisplay = function() {
|
|
|
505
503
|
namesDiv.css('width', (namesDiv.width() + 1) + 'px');
|
|
506
504
|
|
|
507
505
|
// translate inputs to the right
|
|
508
|
-
var translateRight = boxOutputs.find('.types').width() + offsetPoint + offsetBorder/2;
|
|
506
|
+
var translateRight = boxOutputs.find('.types').width() + offsetPoint + offsetBorder / 2;
|
|
509
507
|
$(this).find('.box-outputs').css('transform', 'translateX(' + translateRight + 'px)');
|
|
510
508
|
|
|
511
509
|
// adjust output main div width
|
|
512
|
-
$(this).find('.outputs').width(
|
|
510
|
+
$(this).find('.outputs').width($(this).find('.outputs').width() - translateRight + 10 /* margin */ );
|
|
513
511
|
|
|
514
512
|
// fix io width
|
|
515
513
|
//$('.dualbox-io').css('width', (($(this).find('.inputs').width() + $(this).find('.outputs').width()) + "px"));
|
|
@@ -527,25 +525,25 @@ $.fn.fixWidth = function() {
|
|
|
527
525
|
}
|
|
528
526
|
|
|
529
527
|
// find position of element relative to an ancestor matching selector
|
|
530
|
-
$.fn.positionFrom = function(
|
|
528
|
+
$.fn.positionFrom = function(selector) {
|
|
531
529
|
var ancestor = $(this).closest(selector);
|
|
532
530
|
var offset = $(this).offset();
|
|
533
531
|
var ancestorOffset = ancestor.offset();
|
|
534
532
|
return {
|
|
535
|
-
top:
|
|
533
|
+
top: offset.top - ancestorOffset.top,
|
|
536
534
|
left: offset.left - ancestorOffset.left,
|
|
537
535
|
}
|
|
538
536
|
}
|
|
539
537
|
|
|
540
538
|
export default {
|
|
541
539
|
props: [
|
|
542
|
-
"id",
|
|
543
|
-
"pkg",
|
|
544
|
-
"n",
|
|
540
|
+
"id", // the module id
|
|
541
|
+
"pkg", // the module package.json
|
|
542
|
+
"n", // the GraphNode object (from model)
|
|
545
543
|
"example", // true if this vue is used as an example display (no need to connect)
|
|
546
544
|
"displayEvents", // true if events should be displayed
|
|
547
545
|
],
|
|
548
|
-
data: function
|
|
546
|
+
data: function() {
|
|
549
547
|
return {
|
|
550
548
|
shortName: "",
|
|
551
549
|
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>',
|
|
@@ -555,7 +553,8 @@ export default {
|
|
|
555
553
|
//console.log('[UPDATING] ' + this.n.getUniqId());
|
|
556
554
|
},
|
|
557
555
|
destroyed: function() {
|
|
558
|
-
|
|
556
|
+
this.deactivateTooltip();
|
|
557
|
+
$('.tooltip').remove();
|
|
559
558
|
},
|
|
560
559
|
created: function() {
|
|
561
560
|
this.initialized = false;
|
|
@@ -563,10 +562,9 @@ export default {
|
|
|
563
562
|
|
|
564
563
|
//console.log('[CREATED] ' + this.n.getUniqId());
|
|
565
564
|
// We compute the shortname of our box
|
|
566
|
-
if(
|
|
565
|
+
if (this.n.isInput() || this.n.isOutput()) {
|
|
567
566
|
this.shortName = this.n.getType();
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
567
|
+
} else {
|
|
570
568
|
this.shortName = dbutils.shortName(this.pkg.name);
|
|
571
569
|
}
|
|
572
570
|
},
|
|
@@ -576,7 +574,7 @@ export default {
|
|
|
576
574
|
div.fixCardDisplay();
|
|
577
575
|
div.ready(() => {
|
|
578
576
|
//if( !this.example ) {
|
|
579
|
-
|
|
577
|
+
div.fixWidth();
|
|
580
578
|
//}
|
|
581
579
|
});
|
|
582
580
|
this.activateTooltip();
|
|
@@ -593,7 +591,7 @@ export default {
|
|
|
593
591
|
this.assignContextMenu();
|
|
594
592
|
|
|
595
593
|
$(this.$el).fixCardDisplay();
|
|
596
|
-
$(this.$el).ready(()=>{
|
|
594
|
+
$(this.$el).ready(() => {
|
|
597
595
|
$(this.$el).fixWidth();
|
|
598
596
|
this.activateTooltip();
|
|
599
597
|
});
|
|
@@ -628,11 +626,11 @@ export default {
|
|
|
628
626
|
|
|
629
627
|
this.initialized = false;
|
|
630
628
|
|
|
631
|
-
if(
|
|
629
|
+
if (!this.example) {
|
|
632
630
|
// if we have a position, set it
|
|
633
631
|
var def = this.n.getDef();
|
|
634
632
|
var position = _.get(def, ["graph", "position"]);
|
|
635
|
-
if(
|
|
633
|
+
if (position) {
|
|
636
634
|
var jsPlumbElement = self.$parent.jsPlumbInstance.getElement(id);
|
|
637
635
|
self.$parent.jsPlumbInstance.setPosition(jsPlumbElement, position);
|
|
638
636
|
}
|
|
@@ -640,7 +638,7 @@ export default {
|
|
|
640
638
|
// This needs to be registered before draggable
|
|
641
639
|
div.on('mousedown', function(e) {
|
|
642
640
|
// if this div is not selected already, deselect the other divs
|
|
643
|
-
if(
|
|
641
|
+
if (!self.$parent.selector.isSelected(this)) {
|
|
644
642
|
self.$parent.selector.deselect();
|
|
645
643
|
}
|
|
646
644
|
});
|
|
@@ -648,7 +646,7 @@ export default {
|
|
|
648
646
|
await this.initializeJsPlumb();
|
|
649
647
|
|
|
650
648
|
div.click(function(e) {
|
|
651
|
-
if(
|
|
649
|
+
if (e.ctrlKey) {
|
|
652
650
|
view.selector.toggleSelection(this);
|
|
653
651
|
}
|
|
654
652
|
});
|
|
@@ -671,29 +669,29 @@ export default {
|
|
|
671
669
|
var id = this.getId();
|
|
672
670
|
var view = this.view;
|
|
673
671
|
|
|
674
|
-
if(
|
|
672
|
+
if (!this.example) {
|
|
675
673
|
// If this node was never initialized in this jsplumb instance, do it
|
|
676
|
-
if(
|
|
674
|
+
if (!_.get(this.$parent.jsPlumbInstance, ["initializedNodes", id])) {
|
|
677
675
|
_.set(this.$parent.jsPlumbInstance, ["initializedNodes", id], true); // initialized
|
|
678
676
|
|
|
679
|
-
if(
|
|
677
|
+
if (this.n.isInput() || this.n.isOutput()) {
|
|
680
678
|
var type = "*";
|
|
681
679
|
var input = "value";
|
|
682
680
|
var output = "value";
|
|
683
|
-
var offsetTop = $(div).find('.card-top').height() + 12 /* hr size */
|
|
684
|
-
|
|
685
|
-
var uuid = [
|
|
686
|
-
var ep = this.$parent.jsPlumbInstance.addEndpoint(id,
|
|
687
|
-
isSource
|
|
688
|
-
isTarget
|
|
689
|
-
uuid
|
|
690
|
-
anchor
|
|
691
|
-
maxConnections
|
|
692
|
-
parameters
|
|
681
|
+
var offsetTop = $(div).find('.card-top').height() + 12 /* hr size */ - 3;
|
|
682
|
+
|
|
683
|
+
var uuid = [id, "input", input].join('#');
|
|
684
|
+
var ep = this.$parent.jsPlumbInstance.addEndpoint(id, {
|
|
685
|
+
isSource: false,
|
|
686
|
+
isTarget: true,
|
|
687
|
+
uuid: uuid,
|
|
688
|
+
anchor: [0, 0, -1, 0, 0, offsetTop],
|
|
689
|
+
maxConnections: 1,
|
|
690
|
+
parameters: {
|
|
693
691
|
type: "data",
|
|
694
|
-
target
|
|
695
|
-
id
|
|
696
|
-
input
|
|
692
|
+
target: {
|
|
693
|
+
id: id,
|
|
694
|
+
input: output
|
|
697
695
|
}
|
|
698
696
|
}
|
|
699
697
|
}, this.$parent.style.inputEndpoint);
|
|
@@ -715,27 +713,25 @@ export default {
|
|
|
715
713
|
// bind context menu to the endpoint
|
|
716
714
|
$(ep.canvas).addClass('capture-right-click');
|
|
717
715
|
$(ep.canvas).ready(function() {
|
|
718
|
-
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='"+id.trim()+"'][data-input='" + input + "']", [
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
},
|
|
725
|
-
]);
|
|
716
|
+
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='" + id.trim() + "'][data-input='" + input + "']", [{
|
|
717
|
+
name: 'Create input for here',
|
|
718
|
+
fn: () => {
|
|
719
|
+
view.c.createInputFromConnection(id, input);
|
|
720
|
+
}
|
|
721
|
+
}, ]);
|
|
726
722
|
});
|
|
727
723
|
|
|
728
|
-
var uuid = [
|
|
724
|
+
var uuid = [id, "output", output].join('#');
|
|
729
725
|
var ep = this.$parent.jsPlumbInstance.addEndpoint(id, {
|
|
730
|
-
isSource
|
|
731
|
-
isTarget
|
|
732
|
-
uuid
|
|
733
|
-
anchor
|
|
734
|
-
parameters
|
|
726
|
+
isSource: true,
|
|
727
|
+
isTarget: false,
|
|
728
|
+
uuid: uuid,
|
|
729
|
+
anchor: [1, 0, 1, 0, 0, offsetTop],
|
|
730
|
+
parameters: {
|
|
735
731
|
type: "data",
|
|
736
|
-
source
|
|
737
|
-
id
|
|
738
|
-
output
|
|
732
|
+
source: {
|
|
733
|
+
id: id,
|
|
734
|
+
output: output
|
|
739
735
|
}
|
|
740
736
|
}
|
|
741
737
|
}, this.$parent.style.outputEndpoint);
|
|
@@ -757,37 +753,34 @@ export default {
|
|
|
757
753
|
// bind context menu to the endpoint
|
|
758
754
|
$(ep.canvas).addClass('capture-right-click');
|
|
759
755
|
$(ep.canvas).ready(function() {
|
|
760
|
-
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='"+id.trim()+"'][data-output='" + output.trim() + "']", [
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
},
|
|
767
|
-
]);
|
|
756
|
+
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='" + id.trim() + "'][data-output='" + output.trim() + "']", [{
|
|
757
|
+
name: 'Create output for here',
|
|
758
|
+
fn: () => {
|
|
759
|
+
view.c.createOutputFromConnection(id, output);
|
|
760
|
+
}
|
|
761
|
+
}, ]);
|
|
768
762
|
});
|
|
769
|
-
}
|
|
770
|
-
else {
|
|
763
|
+
} else {
|
|
771
764
|
// add input endoints
|
|
772
|
-
div.find('.box-inputs').find('.point').each(
|
|
765
|
+
div.find('.box-inputs').find('.point').each(function(index) {
|
|
773
766
|
$(this).css('visibility', 'hidden').css('opacity', '0'); // replaced by jsPlumb point
|
|
774
767
|
|
|
775
768
|
var input = div.find('.box-inputs').find('.name').eq(index).attr('data-input').trim();
|
|
776
769
|
var type = view.m.getNode(id).getInputType(input);
|
|
777
770
|
|
|
778
|
-
var offsetTop = $(this).positionFrom('.card').top + $(this).height()/2 - 3;
|
|
779
|
-
var uuid = [
|
|
780
|
-
var ep = self.$parent.jsPlumbInstance.addEndpoint(id,
|
|
781
|
-
isSource
|
|
782
|
-
isTarget
|
|
783
|
-
uuid
|
|
784
|
-
anchor
|
|
785
|
-
maxConnections
|
|
786
|
-
parameters
|
|
771
|
+
var offsetTop = $(this).positionFrom('.card').top + $(this).height() / 2 - 3;
|
|
772
|
+
var uuid = [id, "input", $(this).data('key')].join('#');
|
|
773
|
+
var ep = self.$parent.jsPlumbInstance.addEndpoint(id, {
|
|
774
|
+
isSource: false,
|
|
775
|
+
isTarget: true,
|
|
776
|
+
uuid: uuid,
|
|
777
|
+
anchor: [0, 0, -1, 0, 0, offsetTop],
|
|
778
|
+
maxConnections: 1,
|
|
779
|
+
parameters: {
|
|
787
780
|
type: "data",
|
|
788
|
-
target
|
|
789
|
-
id
|
|
790
|
-
input
|
|
781
|
+
target: {
|
|
782
|
+
id: id,
|
|
783
|
+
input: $(this).data('key')
|
|
791
784
|
}
|
|
792
785
|
}
|
|
793
786
|
}, self.$parent.style.inputEndpoint);
|
|
@@ -808,36 +801,34 @@ export default {
|
|
|
808
801
|
// bind context menu to the endpoint
|
|
809
802
|
$(ep.canvas).addClass('capture-right-click');
|
|
810
803
|
$(ep.canvas).ready(function() {
|
|
811
|
-
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='"+id.trim()+"'][data-input='" + input.trim() + "']", [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
},
|
|
818
|
-
]);
|
|
804
|
+
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='" + id.trim() + "'][data-input='" + input.trim() + "']", [{
|
|
805
|
+
name: 'Create input for here',
|
|
806
|
+
fn: () => {
|
|
807
|
+
view.c.createInputFromConnection(id, input);
|
|
808
|
+
}
|
|
809
|
+
}, ]);
|
|
819
810
|
});
|
|
820
811
|
});
|
|
821
812
|
|
|
822
813
|
// add output endpoints
|
|
823
|
-
div.find('.box-outputs').find('.point').each(
|
|
814
|
+
div.find('.box-outputs').find('.point').each(function(index) {
|
|
824
815
|
$(this).css('visibility', 'hidden').css('opacity', '0'); // replaced by jsPlumb point
|
|
825
816
|
|
|
826
817
|
var output = div.find('.box-outputs').find('.name').eq(index).attr('data-output').trim();
|
|
827
818
|
var type = view.m.getNode(id).getOutputType(output);
|
|
828
819
|
|
|
829
|
-
var offsetTop = $(this).positionFrom('.card').top + $(this).height()/2 - 3;
|
|
830
|
-
var uuid = [
|
|
820
|
+
var offsetTop = $(this).positionFrom('.card').top + $(this).height() / 2 - 3;
|
|
821
|
+
var uuid = [id, "output", $(this).data('key')].join('#');
|
|
831
822
|
var ep = self.$parent.jsPlumbInstance.addEndpoint(id, {
|
|
832
|
-
isSource
|
|
833
|
-
isTarget
|
|
834
|
-
uuid
|
|
835
|
-
anchor
|
|
836
|
-
parameters
|
|
823
|
+
isSource: true,
|
|
824
|
+
isTarget: false,
|
|
825
|
+
uuid: uuid,
|
|
826
|
+
anchor: [1, 0, 1, 0, 0, offsetTop],
|
|
827
|
+
parameters: {
|
|
837
828
|
type: "data",
|
|
838
|
-
source
|
|
839
|
-
id
|
|
840
|
-
output
|
|
829
|
+
source: {
|
|
830
|
+
id: id,
|
|
831
|
+
output: $(this).data('key')
|
|
841
832
|
}
|
|
842
833
|
}
|
|
843
834
|
}, self.$parent.style.outputEndpoint);
|
|
@@ -858,47 +849,45 @@ export default {
|
|
|
858
849
|
// bind context menu to the endpoint
|
|
859
850
|
$(ep.canvas).addClass('capture-right-click');
|
|
860
851
|
$(ep.canvas).ready(function() {
|
|
861
|
-
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='"+id.trim()+"'][data-output='" + output.trim() + "']", [
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
},
|
|
868
|
-
]);
|
|
852
|
+
var menu = new ContextMenu(".jtk-endpoint-anchor[data-node='" + id.trim() + "'][data-output='" + output.trim() + "']", [{
|
|
853
|
+
name: 'Create output for here',
|
|
854
|
+
fn: () => {
|
|
855
|
+
view.c.createOutputFromConnection(id, output);
|
|
856
|
+
}
|
|
857
|
+
}, ]);
|
|
869
858
|
});
|
|
870
859
|
});
|
|
871
860
|
|
|
872
|
-
if(
|
|
861
|
+
if (this.n.isUI() && this.displayEvents) {
|
|
873
862
|
// Make this a target for events
|
|
874
863
|
this.$parent.jsPlumbInstance.makeTarget(id, {
|
|
875
|
-
isSource:false,
|
|
876
|
-
isTarget:true,
|
|
864
|
+
isSource: false,
|
|
865
|
+
isTarget: true,
|
|
877
866
|
uniqueEndpoint: false,
|
|
878
|
-
anchor:"Continuous",
|
|
867
|
+
anchor: "Continuous",
|
|
879
868
|
uuid: id + "#event-in",
|
|
880
|
-
paintStyle:{ fill:"green", radius: 3, stroke: "#727272", strokeWidth: 1 },
|
|
869
|
+
paintStyle: { fill: "green", radius: 3, stroke: "#727272", strokeWidth: 1 },
|
|
881
870
|
parameters: {
|
|
882
871
|
type: "event",
|
|
883
|
-
target: { "id"
|
|
872
|
+
target: { "id": id }
|
|
884
873
|
},
|
|
885
874
|
}, self.$parent.style.eventEndpoint);
|
|
886
875
|
|
|
887
876
|
// Create an enpoint to create a new event
|
|
888
|
-
var ep = this.$parent.jsPlumbInstance.addEndpoint(id,
|
|
889
|
-
isSource
|
|
890
|
-
isTarget
|
|
891
|
-
uuid
|
|
892
|
-
anchor
|
|
893
|
-
parameters
|
|
877
|
+
var ep = this.$parent.jsPlumbInstance.addEndpoint(id, {
|
|
878
|
+
isSource: true,
|
|
879
|
+
isTarget: false,
|
|
880
|
+
uuid: id + "#event-out",
|
|
881
|
+
anchor: [1, 1, 0, 1, 0, -10],
|
|
882
|
+
parameters: {
|
|
894
883
|
type: "event",
|
|
895
|
-
source: { "id"
|
|
884
|
+
source: { "id": id }
|
|
896
885
|
},
|
|
897
|
-
paintStyle:{ fill:"green", radius: 3, stroke: "#727272", strokeWidth: 1 },
|
|
886
|
+
paintStyle: { fill: "green", radius: 3, stroke: "#727272", strokeWidth: 1 },
|
|
898
887
|
}, this.$parent.style.eventEndpoint);
|
|
899
888
|
|
|
900
889
|
// Add overlay here so we don't mess with splitConnection
|
|
901
|
-
ep.addOverlay(["PlainArrow", { width:15, length:15, location:1, id:"arrow" }]);
|
|
890
|
+
ep.addOverlay(["PlainArrow", { width: 15, length: 15, location: 1, id: "arrow" }]);
|
|
902
891
|
|
|
903
892
|
$(ep.canvas).attr('data-toggle', "tooltip");
|
|
904
893
|
$(ep.canvas).attr('data-trigger', "hover");
|
|
@@ -925,7 +914,7 @@ export default {
|
|
|
925
914
|
// resize the canvas if necessary
|
|
926
915
|
self.$parent.canvasSizeHandler.debouncedResize();
|
|
927
916
|
|
|
928
|
-
if(
|
|
917
|
+
if (self.$parent.selector.isMultipleSelectionActive()) {
|
|
929
918
|
// We just dropped a bunch of divs, ajust all their positions
|
|
930
919
|
self.view.m.batch(() => {
|
|
931
920
|
self.$parent.selector.each(div => {
|
|
@@ -933,8 +922,7 @@ export default {
|
|
|
933
922
|
view.m.getNode($(div).attr('id')).setPosition(pos);
|
|
934
923
|
});
|
|
935
924
|
});
|
|
936
|
-
}
|
|
937
|
-
else {
|
|
925
|
+
} else {
|
|
938
926
|
// We just dropped this one, set the new position in the graph model
|
|
939
927
|
var el = self.$parent.jsPlumbInstance.getElement(id);
|
|
940
928
|
$(el).ready(function() {
|
|
@@ -954,15 +942,13 @@ export default {
|
|
|
954
942
|
var id = this.getId();
|
|
955
943
|
|
|
956
944
|
// Create a contextmenu for the div
|
|
957
|
-
var contextOptions = [
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
this.view.c.removeBox(id);
|
|
962
|
-
}
|
|
945
|
+
var contextOptions = [{
|
|
946
|
+
name: 'Remove this box',
|
|
947
|
+
fn: () => {
|
|
948
|
+
this.view.c.removeBox(id);
|
|
963
949
|
}
|
|
964
|
-
];
|
|
965
|
-
if(
|
|
950
|
+
}];
|
|
951
|
+
if (this.n.isModule() || this.n.isUI()) {
|
|
966
952
|
contextOptions.push({
|
|
967
953
|
name: 'Duplicate this box',
|
|
968
954
|
fn: () => {
|
|
@@ -973,7 +959,7 @@ export default {
|
|
|
973
959
|
var nodeMenu = new ContextMenu("#" + id, contextOptions);
|
|
974
960
|
},
|
|
975
961
|
|
|
976
|
-
htmlentities: function(
|
|
962
|
+
htmlentities: function(s) {
|
|
977
963
|
return this.view.utils.htmlentities(s);
|
|
978
964
|
},
|
|
979
965
|
|
|
@@ -1017,5 +1003,4 @@ export default {
|
|
|
1017
1003
|
}
|
|
1018
1004
|
}
|
|
1019
1005
|
}
|
|
1020
|
-
|
|
1021
1006
|
</script>
|