diff --git a/packages/web_ui/src/components/InputPartialVersion.tsx b/packages/web_ui/src/components/InputPartialVersion.tsx index 250b5de6..5ec13bb7 100644 --- a/packages/web_ui/src/components/InputPartialVersion.tsx +++ b/packages/web_ui/src/components/InputPartialVersion.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from "react"; -import { TreeSelect } from "antd"; +import { Button, Divider, Input, TreeSelect } from "antd"; import * as lib from "@clusterio/lib"; import { InputComponentProps } from "../BaseWebPlugin"; @@ -16,6 +16,7 @@ export default function InputPartialVersion ( ) { const fieldDefinition = props.fieldDefinition || defaultFieldDefinition; const [versions, setVersions] = useState(lib.ApiVersions); + const [customVersion, setCustomVersion] = useState(""); const control = useContext(ControlContext); const account = useAccount(); @@ -64,5 +65,36 @@ export default function InputPartialVersion ( allowClear={fieldDefinition.optional} className={props.className} disabled={props.disabled} + popupRender={(menu) => { + const isValid = lib.isPartialVersion(customVersion); + + return ( + <> + {menu} + +
+ setCustomVersion(e.target.value)} + /> + +
+ + ); + }} />; } diff --git a/packages/web_ui/src/components/InputTargetVersion.tsx b/packages/web_ui/src/components/InputTargetVersion.tsx index 3e52d33d..85fa4255 100644 --- a/packages/web_ui/src/components/InputTargetVersion.tsx +++ b/packages/web_ui/src/components/InputTargetVersion.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from "react"; -import { TreeSelect } from "antd"; +import { Button, Divider, Input, TreeSelect } from "antd"; import * as lib from "@clusterio/lib"; import { InputComponentProps } from "../BaseWebPlugin"; @@ -16,6 +16,7 @@ export default function InputTargetVersion ( ) { const fieldDefinition = props.fieldDefinition || defaultFieldDefinition; const [versions, setVersions] = useState(lib.ApiVersions); + const [customVersion, setCustomVersion] = useState(""); const control = useContext(ControlContext); const account = useAccount(); @@ -67,5 +68,36 @@ export default function InputTargetVersion ( allowClear={fieldDefinition.optional} className={props.className} disabled={props.disabled} + popupRender={(menu) => { + const isValid = lib.isPartialVersion(customVersion); + + return ( + <> + {menu} + +
+ setCustomVersion(e.target.value)} + /> + +
+ + ); + }} />; }