@dualbox/editor 1.0.79 → 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 +489 -248
- package/js/dist/GraphEditor.min.js +488 -247
- package/js/src/m/GraphModel.js +25 -0
- package/js/src/v/templates/graphNode.vue +481 -265
- package/package.json +1 -1
package/js/src/m/GraphModel.js
CHANGED
|
@@ -1012,6 +1012,29 @@ class GraphNode {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
|
+
checkTypeMatch(type, val) {
|
|
1016
|
+
let lowercaseType = type.toLowerCase();
|
|
1017
|
+
switch (lowercaseType) {
|
|
1018
|
+
case "string":
|
|
1019
|
+
if (typeof val !== "string") {
|
|
1020
|
+
throw "Expected string type but got " + type;
|
|
1021
|
+
}
|
|
1022
|
+
break;
|
|
1023
|
+
case "number":
|
|
1024
|
+
if (typeof val !== "number") {
|
|
1025
|
+
throw "Expected number type but got " + type;
|
|
1026
|
+
}
|
|
1027
|
+
break;
|
|
1028
|
+
case "boolean":
|
|
1029
|
+
if (typeof val !== "boolean") {
|
|
1030
|
+
throw "Expected boolean type but got " + type;
|
|
1031
|
+
}
|
|
1032
|
+
break;
|
|
1033
|
+
default:
|
|
1034
|
+
break;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1015
1038
|
getInputDefaultValue(inputName) {
|
|
1016
1039
|
var pkg = this.getPackage();
|
|
1017
1040
|
var pkgDefault = pkg && pkg.dualbox && pkg.dualbox.input && pkg.dualbox.input[inputName] && pkg.dualbox.input[inputName].value;
|
|
@@ -1025,6 +1048,7 @@ class GraphNode {
|
|
|
1025
1048
|
}
|
|
1026
1049
|
|
|
1027
1050
|
setInputDefaultValue(inputName, val) {
|
|
1051
|
+
this.checkTypeMatch(this.getInputType(inputName), val);
|
|
1028
1052
|
this.def.defaultInputs = this.def.defaultInputs || {};
|
|
1029
1053
|
this.def.defaultInputs[inputName] = val;
|
|
1030
1054
|
this.m.save();
|
|
@@ -1103,6 +1127,7 @@ class GraphNode {
|
|
|
1103
1127
|
}
|
|
1104
1128
|
|
|
1105
1129
|
setAttributeValue(attrName, val) {
|
|
1130
|
+
this.checkTypeMatch(this.getAttributeType(attrName), val);
|
|
1106
1131
|
this.def.attr = this.def.attr || {};
|
|
1107
1132
|
this.def.attr[attrName] = val;
|
|
1108
1133
|
this.m.save();
|