update old handle as string to json format and types to easily use the new id as json
This commit is contained in:
parent
6604ef5351
commit
1e3c918880
3 changed files with 17 additions and 12 deletions
|
|
@ -62,7 +62,9 @@ export default function ParameterComponent({
|
||||||
|
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
let disabled =
|
let disabled =
|
||||||
reactFlowInstance?.getEdges().some((e) => e.targetHandle === id) ?? false;
|
reactFlowInstance
|
||||||
|
?.getEdges()
|
||||||
|
.some((e) => e.targetHandle === JSON.stringify(id)) ?? false;
|
||||||
|
|
||||||
const { data: myData } = useContext(typesContext);
|
const { data: myData } = useContext(typesContext);
|
||||||
|
|
||||||
|
|
@ -205,7 +207,7 @@ export default function ParameterComponent({
|
||||||
<Handle
|
<Handle
|
||||||
type={left ? "target" : "source"}
|
type={left ? "target" : "source"}
|
||||||
position={left ? Position.Left : Position.Right}
|
position={left ? Position.Left : Position.Right}
|
||||||
id={id}
|
id={JSON.stringify(id)}
|
||||||
isValidConnection={(connection) =>
|
isValidConnection={(connection) =>
|
||||||
isValidConnection(connection, reactFlowInstance)
|
isValidConnection(connection, reactFlowInstance)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,14 +194,12 @@ export default function GenericNode({
|
||||||
data.node.template[t].type
|
data.node.template[t].type
|
||||||
}
|
}
|
||||||
required={data.node.template[t].required}
|
required={data.node.template[t].required}
|
||||||
id={
|
id={{
|
||||||
(data.node.template[t].input_types?.join(";") ??
|
inputTypes: data.node.template[t].input_types,
|
||||||
data.node.template[t].type) +
|
type: data.node.template[t].type,
|
||||||
"|" +
|
id: data.id,
|
||||||
t +
|
fieldName: t,
|
||||||
"|" +
|
}}
|
||||||
data.id
|
|
||||||
}
|
|
||||||
left={true}
|
left={true}
|
||||||
type={data.node.template[t].type}
|
type={data.node.template[t].type}
|
||||||
optionalHandle={data.node.template[t].input_types}
|
optionalHandle={data.node.template[t].input_types}
|
||||||
|
|
@ -230,7 +228,11 @@ export default function GenericNode({
|
||||||
: data.type
|
: data.type
|
||||||
}
|
}
|
||||||
tooltipTitle={data.node.base_classes.join("\n")}
|
tooltipTitle={data.node.base_classes.join("\n")}
|
||||||
id={[data.type, data.id, ...data.node.base_classes].join("|")}
|
id={{
|
||||||
|
baseClasses: data.node.base_classes,
|
||||||
|
id: data.id,
|
||||||
|
dataType: data.type,
|
||||||
|
}}
|
||||||
type={data.node.base_classes.join("|")}
|
type={data.node.base_classes.join("|")}
|
||||||
left={false}
|
left={false}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { ReactElement, ReactNode } from "react";
|
||||||
import { APIClassType } from "../api";
|
import { APIClassType } from "../api";
|
||||||
import { NodeDataType } from "../flow/index";
|
import { NodeDataType } from "../flow/index";
|
||||||
import { typesContextType } from "../typesContext";
|
import { typesContextType } from "../typesContext";
|
||||||
|
import { sourceHandleType, targetHandleType } from "./../flow/index";
|
||||||
export type InputComponentType = {
|
export type InputComponentType = {
|
||||||
value: string;
|
value: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
|
@ -29,7 +30,7 @@ export type ParameterComponentType = {
|
||||||
data: NodeDataType;
|
data: NodeDataType;
|
||||||
setData: (value: NodeDataType) => void;
|
setData: (value: NodeDataType) => void;
|
||||||
title: string;
|
title: string;
|
||||||
id: string;
|
id: sourceHandleType | targetHandleType;
|
||||||
color: string;
|
color: string;
|
||||||
left: boolean;
|
left: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue