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:
parent
0f23df1c8d
commit
924c817c50
1 changed files with 13 additions and 1 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue