You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/web/app/components/datasets/metadata/edit-metadat-batch/input-combined.tsx

48 lines
1.1 KiB
TypeScript

'use client'
import type { FC } from 'react'
import React from 'react'
import { DataType } from '../types'
import Input from '@/app/components/base/input'
import { InputNumber } from '@/app/components/base/input-number'
import cn from '@/utils/classnames'
type Props = {
type: DataType
value: any
onChange: (value: any) => void
}
const InputCombined: FC<Props> = ({
type,
value,
onChange,
}) => {
const className = 'grow p-0.5 h-6 text-xs'
if (type === DataType.time)
return <div className='grow text-xs'>Datepicker placeholder</div>
if (type === DataType.number) {
return (
<div className='grow text-[0]'>
<InputNumber
className={cn(className, 'rounded-l-md')}
value={value}
onChange={onChange}
size='sm'
controlWrapClassName='overflow-hidden'
controlClassName='pt-0 pb-0'
/>
</div>
)
}
return (
<Input
className={cn(className, 'rounded-md')}
value={value}
onChange={e => onChange(e.target.value)}
>
</Input>
)
}
export default React.memo(InputCombined)