Add global variables support to InputComponent

This commit is contained in:
anovazzi1 2024-02-05 18:58:37 -03:00
commit 476a670eb9

View file

@ -1,6 +1,7 @@
import { Listbox, Transition } from "@headlessui/react"; import { Listbox, Transition } from "@headlessui/react";
import * as Form from "@radix-ui/react-form"; import * as Form from "@radix-ui/react-form";
import { Fragment, useEffect, useRef, useState } from "react"; import { Fragment, useEffect, useRef, useState } from "react";
import { useGlobalVariablesStore } from "../../stores/globalVariables";
import { InputComponentType } from "../../types/components"; import { InputComponentType } from "../../types/components";
import { handleKeyDown } from "../../utils/reactflowUtils"; import { handleKeyDown } from "../../utils/reactflowUtils";
import { classNames } from "../../utils/utils"; import { classNames } from "../../utils/utils";
@ -26,13 +27,12 @@ export default function InputComponent({
const [pwdVisible, setPwdVisible] = useState(false); const [pwdVisible, setPwdVisible] = useState(false);
const refInput = useRef<HTMLInputElement>(null); const refInput = useRef<HTMLInputElement>(null);
const [showOptions, setShowOptions] = useState<boolean>(false); const [showOptions, setShowOptions] = useState<boolean>(false);
const [filteredOpts, setFilteredValue] = useState<string[]>([ const globalVariablesEntries = useGlobalVariablesStore(
"key", (state) => state.globalVariablesEntries
"key2", );
"key3", const [filteredOpts, setFilteredValue] = useState<string[]>(
"key4", globalVariablesEntries
"key5", );
]);
// Clear component state // Clear component state
useEffect(() => { useEffect(() => {