diff --git a/src/behavior3 b/src/behavior3
index 9039934..98117af 160000
--- a/src/behavior3
+++ b/src/behavior3
@@ -1 +1 @@
-Subproject commit 903993458f6a45423d60b8db864f82cd618d1bc6
+Subproject commit 98117afec4a5fe7ef4bebc8443b5439714fb7f7e
diff --git a/src/components/inspector.tsx b/src/components/inspector.tsx
index bc8b810..2d61a07 100644
--- a/src/components/inspector.tsx
+++ b/src/components/inspector.tsx
@@ -1,5 +1,15 @@
import { EditNode, EditTree, useWorkspace } from "@/contexts/workspace-context";
-import { NodeModel, TreeGraphData } from "@/misc/b3type";
+import {
+ isBoolType,
+ isEnumType,
+ isExprType,
+ isFloatType,
+ isIntType,
+ isJsonType,
+ isStringType,
+ NodeModel,
+ TreeGraphData,
+} from "@/misc/b3type";
import {
checkNodeArgValue,
checkOneof,
@@ -132,14 +142,14 @@ const NodeInspector: FC = () => {
form.setFieldValue(
name,
(Array.isArray(value) ? value : []).map((item) => {
- if (type === "json") {
+ if (isJsonType(type)) {
return item === null ? "null" : JSON.stringify(item ?? arg.default, null, 2);
} else {
return item;
}
})
);
- } else if (type === "json") {
+ } else if (isJsonType(type)) {
form.setFieldValue(
name,
value === null ? "null" : JSON.stringify(value ?? arg.default, null, 2)
@@ -249,7 +259,7 @@ const NodeInspector: FC = () => {
const arr: unknown[] = [];
if (Array.isArray(value)) {
value.forEach((item) => {
- if (type === "json") {
+ if (isJsonType(type)) {
try {
arr.push(item === "null" ? null : JSON.parse(item));
} catch {
@@ -261,7 +271,7 @@ const NodeInspector: FC = () => {
});
}
data.args[arg.name] = arr;
- } else if (type === "json") {
+ } else if (isJsonType(type)) {
try {
data.args[arg.name] = value === "null" ? null : JSON.parse(value);
} catch {
@@ -546,9 +556,9 @@ const NodeInspector: FC = () => {
validateTrigger={["onChange", "onBlur"]}
style={{ width: "100%", marginBottom: 5 }}
initialValue={
- type === "boolean" ? arg.default ?? false : arg.default
+ isBoolType(type) ? arg.default ?? false : arg.default
}
- valuePropName={type === "boolean" ? "checked" : undefined}
+ valuePropName={isBoolType(type) ? "checked" : undefined}
rules={[
{
required,
@@ -556,7 +566,7 @@ const NodeInspector: FC = () => {
},
() => ({
validator(_, value) {
- if (type === "json") {
+ if (isJsonType(type)) {
try {
if (value !== "null") {
JSON.parse(value);
@@ -576,29 +586,29 @@ const NodeInspector: FC = () => {
}),
]}
>
- {type === "string" && (
+ {isStringType(type) && (
)}
- {type === "json" && (
+ {isJsonType(type) && (
)}
- {type === "int" && (
+ {isIntType(type) && (
)}
- {type === "float" && (
+ {isFloatType(type) && (
)}
- {type === "boolean" && (
+ {isBoolType(type) && (
)}
- {type === "code" && (
+ {isExprType(type) && (
)}
- {type === "enum" && (
+ {isEnumType(type) && (