import { Form, FormInstance } from "antd"; import { Input } from "@/components/ui/input"; import { FormDialog } from "@/components/FormDialog"; import { countryCodeMap } from "@/data"; import { DIALOGTYPE } from "../../index"; import "./index.scss"; import { DefaultLink } from "./pathChoose"; import { Button } from "@/components/ui/button"; import { Switch } from "@/components/ui/switch"; export interface DialogConfig { title: string; desc: string; successText: string; } const IpPortInput = ({ value, onChange, }: { value?: { port: string; ip: string }; onChange?: (data: { port: string; ip: string }) => void; }) => { const [ipAndPort, setIpAndPort] = useState<{ port: string; ip: string; }>(value ? value : { port: "", ip: "" }); const handleChagne = ({ key, val }: { key: "port" | "ip"; val: string }) => { const newValue = value ? { ...value } : { port: "", ip: "" }; newValue[key] = val; onChange?.(newValue); }; useEffect(() => { if (value) { setIpAndPort(value); } }, [value]); return (
{ handleChagne?.({ key: "ip", val: e.target.value }); }} /> { handleChagne?.({ key: "port", val: e.target.value }); }} />
); }; const SwitchComponent = ({ value, onChange, }: { value?: boolean; onChange?: (data: boolean) => void; }) => { const [checked, setChecked] = useState(value); return (
{ setChecked(e); onChange?.(e); }} />
是否为出口节点
); }; const NodeForm = ({ form }: { form: FormInstance }) => { return (
{/*
uid
*/}
); }; const NetworkForm = ({ form }: { form: FormInstance }) => { return (
key)} /> key)} />
); }; export const FormAlertDialog = ({ open, setOpen, successHandle, dialogLoading, form, type, canSubmit, handleSelectFile, }: { open: boolean; setOpen: (open: boolean) => void; successHandle: () => void; dialogLoading: boolean; canSubmit: boolean; form: FormInstance; type: DialogConfig; handleSelectFile: () => void; }) => { const showDialog = (open: boolean) => { setOpen(open); }; return ( {open && type.title === DIALOGTYPE.ADDNode.title ? ( ) : ( )} ); };