@dualbox/editor 1.0.80 → 1.0.82
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 +53 -21
- package/js/dist/GraphEditor.min.js +52 -20
- package/js/src/m/DualboxUtils.js +9 -2
- package/js/src/m/GraphModel.js +17 -1
- package/js/src/v/templates/editMainSettings.vue +5 -0
- package/js/src/v/templates/editValue.vue +17 -14
- package/js/src/v/templates/main.vue +1 -1
- package/package.json +1 -1
package/js/src/m/DualboxUtils.js
CHANGED
|
@@ -30,7 +30,14 @@ class DualboxUtils {
|
|
|
30
30
|
return packageName.indexOf('dualbox-module-') !== -1 ||
|
|
31
31
|
packageName.indexOf('dualbox-core-') !== -1;
|
|
32
32
|
}
|
|
33
|
-
}
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
isLibrary(packageName) {
|
|
35
|
+
return packageName === "@dualbox/dualbox" || packageName.indexOf('dualbox-lib-') !== -1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
isType(packageName) {
|
|
39
|
+
return packageName.indexOf('dualbox-type-') !== -1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
36
42
|
|
|
43
|
+
export default new DualboxUtils();
|
package/js/src/m/GraphModel.js
CHANGED
|
@@ -415,6 +415,20 @@ class GraphModel {
|
|
|
415
415
|
return instances;
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
+
// add pkg dependencies (lib, types, etc) to app graph
|
|
419
|
+
addDependencies(pkg) {
|
|
420
|
+
_.each(pkg.dependencies, async (dependencyVersion, dependencyName) => {
|
|
421
|
+
if (utils.isLibrary(dependencyName) || utils.isType(dependencyName)) {
|
|
422
|
+
console.log('[*] Adding dependency: ' + dependencyName);
|
|
423
|
+
// await this.e.loadPackage(dependencyName, dependencyVersion); // Is this better ?
|
|
424
|
+
await this.e.loadPackage(dependencyName); // or should we just load the last version ?
|
|
425
|
+
let pkg = this.e.packages[dependencyName]
|
|
426
|
+
this.data.root.libs[pkg.name] = pkg.version;
|
|
427
|
+
await this.addDependencies(pkg);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
|
|
418
432
|
addNode(id, pkg) {
|
|
419
433
|
console.log('adding node: ' + id);
|
|
420
434
|
|
|
@@ -430,6 +444,7 @@ class GraphModel {
|
|
|
430
444
|
return false;
|
|
431
445
|
}
|
|
432
446
|
var node = this.getCurrentMetanode().modules[id] = desc;
|
|
447
|
+
this.addDependencies(pkg); // async but no pb
|
|
433
448
|
} else if (utils.isUI(pkg.name)) {
|
|
434
449
|
this.ensure('ui');
|
|
435
450
|
if (this.getCurrentMetanode().ui[id]) {
|
|
@@ -437,6 +452,7 @@ class GraphModel {
|
|
|
437
452
|
return false;
|
|
438
453
|
}
|
|
439
454
|
var node = this.getCurrentMetanode().ui[id] = desc;
|
|
455
|
+
this.addDependencies(pkg); // async but no pb
|
|
440
456
|
} else {
|
|
441
457
|
// may be a metanode
|
|
442
458
|
var nodeDef = idx(this.getCurrentMetanode(), o => o.metanodes[pkg.name]);
|
|
@@ -1695,7 +1711,7 @@ class GraphNode {
|
|
|
1695
1711
|
|
|
1696
1712
|
// return true if the node is in a metanode
|
|
1697
1713
|
isInMetanode() {
|
|
1698
|
-
return this.m.getCurrentMetanodeName() !=
|
|
1714
|
+
return this.m.getCurrentMetanodeName() != this.m.data.windows[0][0];
|
|
1699
1715
|
}
|
|
1700
1716
|
|
|
1701
1717
|
// Works only is this.isInMetanode() == true
|
|
@@ -543,7 +543,12 @@ export default {
|
|
|
543
543
|
});
|
|
544
544
|
|
|
545
545
|
var index = parseInt($(e.target).attr('data-index'));
|
|
546
|
+
|
|
547
|
+
// set event target
|
|
546
548
|
this.view.c.setEventTarget( "#application-" + $(e.target).attr('dualbox-target') + '-' + $(e.target).attr('data-event'), index, target);
|
|
549
|
+
|
|
550
|
+
// also set event name, to ensure we don't have a set event that doesn't exist on this node
|
|
551
|
+
this.view.c.setEventName( "#application-" + $(e.target).attr('dualbox-target') + '-' + $(e.target).attr('data-event'), index, targetEvents[0]);
|
|
547
552
|
this.onEdited();
|
|
548
553
|
},
|
|
549
554
|
|
|
@@ -217,21 +217,23 @@ export default {
|
|
|
217
217
|
var templateType = null;
|
|
218
218
|
if (resolvedType.startsWith("array")) {
|
|
219
219
|
templateType = "array";
|
|
220
|
-
this.deserializedValue = this.v || [];
|
|
220
|
+
this.deserializedValue = _.clone(this.v || []);
|
|
221
221
|
} else if (resolvedType.startsWith("map")) {
|
|
222
222
|
templateType = "map";
|
|
223
|
-
this.deserializedValue =
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
this.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
this.deserializedValue = _.clone(
|
|
224
|
+
window.DualBox.Type.deserialize(
|
|
225
|
+
this.v || {
|
|
226
|
+
metadata: {
|
|
227
|
+
type:
|
|
228
|
+
"Map<String," +
|
|
229
|
+
this.firstLetterUppercase(
|
|
230
|
+
this.getEmbeddedType(resolvedType)
|
|
231
|
+
) +
|
|
232
|
+
">"
|
|
233
|
+
},
|
|
234
|
+
data: {}
|
|
235
|
+
}
|
|
236
|
+
)
|
|
235
237
|
);
|
|
236
238
|
}
|
|
237
239
|
|
|
@@ -298,7 +300,8 @@ export default {
|
|
|
298
300
|
this.$forceUpdate();
|
|
299
301
|
|
|
300
302
|
if (this.isTemplateType()) {
|
|
301
|
-
|
|
303
|
+
let value = _.clone(this.deserializedValue);
|
|
304
|
+
this.emit(this.serialize(value));
|
|
302
305
|
this.emitted = true;
|
|
303
306
|
} else if (this.isObjectType()) {
|
|
304
307
|
// emit the result to the parent Vue
|