feat(IOInputField): add support for fileLoader input type and IOFileInput component

The IOInputField component now supports a new input type called "fileLoader". When the input type is "fileLoader", the component renders an IOFileInput component. The IOFileInput component takes a field prop which is used to set the initial value of the file path. The updateValue function is passed to the IOFileInput component to update the value of the file path in the node's template.
This commit is contained in:
anovazzi1 2024-01-30 18:19:21 -03:00
commit 924c817c50

View file

@ -1,6 +1,7 @@
import { cloneDeep } from "lodash";
import useFlowStore from "../../stores/flowStore";
import { IOInputProps } from "../../types/components";
import IOFileInput from "../IOInputs/FileInput";
import { Textarea } from "../ui/textarea";
export default function IOInputField({
@ -30,7 +31,18 @@ export default function IOInputField({
/>
);
case "fileLoader":
// return <IOFileInput />;
return (
<IOFileInput
field={node.data.node!.template["file_path"]["value"]}
updateValue={(e) => {
if (node) {
let newNode = cloneDeep(node);
newNode.data.node!.template["file_path"].value = e;
setNode(node.id, newNode);
}
}}
/>
);
default:
return (