forked from linkong/planet
release: bump version to 0.52.0
This commit is contained in:
1 parent
b15d097b9c
commit
b87cb310fd
70 files changed
+5589
-2187
No files matched your search
@@ -0,0 +1,107 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { Button, Input, Tooltip, type InputProps } from 'antd'
|
||||
|
||||
export function PlugConnectIcon() {
|
||||
return (
|
||||
<svg width="1em" height="1em" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path
|
||||
d="M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M3 21l2.5 -2.5"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M18.5 5.5l2.5 -2.5"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M10 11l-2 2"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M13 14l-2 2"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
interface ConnectionTestInputProps extends Omit<InputProps, 'suffix'> {
|
||||
testTitle?: ReactNode
|
||||
testing?: boolean
|
||||
testDisabled?: boolean
|
||||
onTest?: () => void
|
||||
extraSuffix?: ReactNode
|
||||
}
|
||||
|
||||
export default function ConnectionTestInput({
|
||||
testTitle = '测试连接',
|
||||
testing = false,
|
||||
testDisabled = false,
|
||||
disabled,
|
||||
onTest,
|
||||
extraSuffix,
|
||||
...inputProps
|
||||
}: ConnectionTestInputProps) {
|
||||
const actionDisabled = disabled || testDisabled
|
||||
|
||||
return (
|
||||
<Input
|
||||
{...inputProps}
|
||||
disabled={disabled}
|
||||
suffix={(
|
||||
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 2 }}>
|
||||
<Tooltip title={testTitle}>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
icon={<PlugConnectIcon />}
|
||||
loading={testing}
|
||||
disabled={actionDisabled}
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
if (!actionDisabled) {
|
||||
onTest?.()
|
||||
}
|
||||
}}
|
||||
aria-label="测试连接"
|
||||
/>
|
||||
</Tooltip>
|
||||
{extraSuffix}
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user