diff --git a/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index f55dc430a..3b5f3e109 100644 --- a/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/space_flow/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -8,6 +8,7 @@ import { import { useEffect, useRef, useState } from "react"; import InputComponent from "../../../../components/inputComponent"; import ToggleComponent from "../../../../components/toggleComponent"; +import InputListComponent from "../../../../components/inputListComponent"; export default function ParameterComponent({ left, @@ -23,6 +24,12 @@ export default function ParameterComponent({ const ref = useRef(null); const updateNodeInternals = useUpdateNodeInternals(); const [position, setPosition] = useState(0); + function updatePos(){ + if (ref.current && ref.current.offsetTop && ref.current.clientHeight) { + setPosition(ref.current.offsetTop + ref.current.clientHeight / 2); + updateNodeInternals(data.id); + } + } useEffect(() => { if (ref.current && ref.current.offsetTop && ref.current.clientHeight) { setPosition(ref.current.offsetTop + ref.current.clientHeight / 2); @@ -60,12 +67,23 @@ export default function ParameterComponent({ {left === true && type === "str" ? (
+ {/* data.node.template[name].list */false ? + { + data.node.template[name].value = t; + updatePos(); + }} + /> + : { data.node.template[name].value = t; }} /> + } +
) : left === true && type === "bool" ? (
diff --git a/space_flow/src/CustomNodes/GenericNode/index.tsx b/space_flow/src/CustomNodes/GenericNode/index.tsx index e47938cf5..0e1a71542 100644 --- a/space_flow/src/CustomNodes/GenericNode/index.tsx +++ b/space_flow/src/CustomNodes/GenericNode/index.tsx @@ -72,7 +72,7 @@ export default function GenericNode({ data }) { (" " + b))} + title={data.name} tooltipTitle={"Type: str"} id={data.name + "|" + data.id + data.node.base_classes.map((b) => ("|" + b))} type={'str'} diff --git a/space_flow/src/components/inputListComponent/index.tsx b/space_flow/src/components/inputListComponent/index.tsx index 0e08e56d5..05dfdd232 100644 --- a/space_flow/src/components/inputListComponent/index.tsx +++ b/space_flow/src/components/inputListComponent/index.tsx @@ -1,29 +1,49 @@ +import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { useState } from "react"; -var _ = require('lodash'); +var _ = require("lodash"); -export default function InputListComponent({value, onChange}){ - const [inputList, setInputList] = useState(value ?? []); +export default function InputListComponent({ value, onChange }) { + const [inputList, setInputList] = useState(value ?? [""]); - return ( - <> - {inputList.map((i, idx) =>( - { - setInputList((old) => { - let newInputList = _.cloneDeep(old); - newInputList[idx] = e.target.value; - return newInputList; - }); - onChange(inputList); - }} - /> - ))} - - - ); -} \ No newline at end of file + return ( +
+ {inputList.map((i, idx) => ( +
+ { + setInputList((old) => { + let newInputList = _.cloneDeep(old); + newInputList[idx] = e.target.value; + return newInputList; + }); + onChange(inputList); + }} + /> + {idx === inputList.length - 1 ? + + : } +
+ ))} +
+ ); +}