From 924c817c50715c4816035526554e5e667b573f28 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 30 Jan 2024 18:19:21 -0300 Subject: [PATCH] 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. --- src/frontend/src/components/IOInputField/index.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/components/IOInputField/index.tsx b/src/frontend/src/components/IOInputField/index.tsx index 890e397d8..e0974a5ff 100644 --- a/src/frontend/src/components/IOInputField/index.tsx +++ b/src/frontend/src/components/IOInputField/index.tsx @@ -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 ; + return ( + { + if (node) { + let newNode = cloneDeep(node); + newNode.data.node!.template["file_path"].value = e; + setNode(node.id, newNode); + } + }} + /> + ); default: return (