mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 02:46:52 +08:00
feat: support assistant frontend (#2139)
Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
@@ -9,6 +9,9 @@ type InputProps = {
|
||||
validated?: boolean
|
||||
className?: string
|
||||
disabled?: boolean
|
||||
type?: string
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
const Input: FC<InputProps> = ({
|
||||
value,
|
||||
@@ -18,7 +21,19 @@ const Input: FC<InputProps> = ({
|
||||
validated,
|
||||
className,
|
||||
disabled,
|
||||
type = 'text',
|
||||
min,
|
||||
max,
|
||||
}) => {
|
||||
const toLimit = (v: string) => {
|
||||
if (min !== undefined && parseFloat(v) < min) {
|
||||
onChange(`${min}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (max !== undefined && parseFloat(v) > max)
|
||||
onChange(`${max}`)
|
||||
}
|
||||
return (
|
||||
<div className='relative'>
|
||||
<input
|
||||
@@ -34,9 +49,13 @@ const Input: FC<InputProps> = ({
|
||||
`}
|
||||
placeholder={placeholder || ''}
|
||||
onChange={e => onChange(e.target.value)}
|
||||
onBlur={e => toLimit(e.target.value)}
|
||||
onFocus={onFocus}
|
||||
value={value || ''}
|
||||
disabled={disabled}
|
||||
type={type}
|
||||
min={min}
|
||||
max={max}
|
||||
/>
|
||||
{
|
||||
validated && (
|
||||
|
||||
Reference in New Issue
Block a user