merge check NodeData and TreeGraphData

This commit is contained in:
codetypes committed 2024-07-23 13:19:42 +08:00
1 parent 6d6fdf8c07
commit 54c0ff7356
5 files changed
+113 -126

No files matched your search

+3 -12
View File
@@ -1,5 +1,6 @@
import { EditNode, EditTree, useWorkspace } from "@/contexts/workspace-context";
import { NodeArg, NodeArgType, NodeModel, TreeGraphData } from "@/misc/b3type";
import { checkOneof } from "@/misc/b3util";
import { Hotkey, isMacos } from "@/misc/keys";
import { EditOutlined } from "@ant-design/icons";
import {
@@ -337,12 +338,7 @@ const NodeInspector: FC = () => {
const arg = def.args?.find((a) => a.oneof && v.startsWith(a.oneof));
if (arg) {
const argName = `args.${arg.name}`;
const argValue = getFieldValue(argName) ?? "";
value = value ?? "";
if (
(value === "" && argValue === "") ||
(value !== "" && argValue !== "")
) {
if (!checkOneof(getFieldValue(argName), value)) {
if (!isFieldValidating(argName)) {
setFieldValue(`input.${i}`, value);
validateFields([argName]);
@@ -420,12 +416,7 @@ const NodeInspector: FC = () => {
);
}
const inputName = `input.${idx}`;
const inputValue = getFieldValue(inputName) ?? "";
value = value ?? "";
if (
(value === "" && inputValue === "") ||
(value !== "" && inputValue !== "")
) {
if (!checkOneof(getFieldValue(inputName), value)) {
if (!isFieldValidating(inputName)) {
setFieldValue(`args.${v.name}`, value);
validateFields([inputName]);
+15 -8
View File
@@ -214,22 +214,22 @@ export const Menu: FC<LayoutProps> = () => {
},
},
{
id: 'menu.edit.cut',
label: t('cut'),
id: "menu.edit.cut",
label: t("cut"),
enabled: enabled,
accelerator: Hotkey.Cut,
click: () => {
getFocusedWebContents()?.cut()
}
getFocusedWebContents()?.cut();
},
},
{
id: 'menu.edit.selectAll',
label: t('selectAll'),
id: "menu.edit.selectAll",
label: t("selectAll"),
enabled: enabled,
accelerator: Hotkey.SelectAll,
click: () => {
getFocusedWebContents()?.selectAll()
}
getFocusedWebContents()?.selectAll();
},
},
{ type: "separator" },
{
@@ -273,6 +273,13 @@ export const Menu: FC<LayoutProps> = () => {
getFocusedWebContents()?.openDevTools();
},
},
{
id: "menu.view.console",
label: t("console"),
click: () => {
getFocusedWebContents()?.openDevTools();
},
},
{ type: "separator" },
{
id: "menu.view.actualSize",