|
|
|
@ -26,9 +26,11 @@ type Option = {
|
|
|
|
icon: React.JSX.Element
|
|
|
|
icon: React.JSX.Element
|
|
|
|
}
|
|
|
|
}
|
|
|
|
type FileUploaderInAttachmentProps = {
|
|
|
|
type FileUploaderInAttachmentProps = {
|
|
|
|
|
|
|
|
isDisabled?: boolean
|
|
|
|
fileConfig: FileUpload
|
|
|
|
fileConfig: FileUpload
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const FileUploaderInAttachment = ({
|
|
|
|
const FileUploaderInAttachment = ({
|
|
|
|
|
|
|
|
isDisabled,
|
|
|
|
fileConfig,
|
|
|
|
fileConfig,
|
|
|
|
}: FileUploaderInAttachmentProps) => {
|
|
|
|
}: FileUploaderInAttachmentProps) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
@ -89,16 +91,18 @@ const FileUploaderInAttachment = ({
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
{!isDisabled && (
|
|
|
|
<div className='flex items-center space-x-1'>
|
|
|
|
<div className='flex items-center space-x-1'>
|
|
|
|
{options.map(renderOption)}
|
|
|
|
{options.map(renderOption)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
<div className='mt-1 space-y-1'>
|
|
|
|
<div className='mt-1 space-y-1'>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
files.map(file => (
|
|
|
|
files.map(file => (
|
|
|
|
<FileItem
|
|
|
|
<FileItem
|
|
|
|
key={file.id}
|
|
|
|
key={file.id}
|
|
|
|
file={file}
|
|
|
|
file={file}
|
|
|
|
showDeleteAction
|
|
|
|
showDeleteAction={!isDisabled}
|
|
|
|
showDownloadAction={false}
|
|
|
|
showDownloadAction={false}
|
|
|
|
onRemove={() => handleRemoveFile(file.id)}
|
|
|
|
onRemove={() => handleRemoveFile(file.id)}
|
|
|
|
onReUpload={() => handleReUploadFile(file.id)}
|
|
|
|
onReUpload={() => handleReUploadFile(file.id)}
|
|
|
|
@ -114,18 +118,20 @@ type FileUploaderInAttachmentWrapperProps = {
|
|
|
|
value?: FileEntity[]
|
|
|
|
value?: FileEntity[]
|
|
|
|
onChange: (files: FileEntity[]) => void
|
|
|
|
onChange: (files: FileEntity[]) => void
|
|
|
|
fileConfig: FileUpload
|
|
|
|
fileConfig: FileUpload
|
|
|
|
|
|
|
|
isDisabled?: boolean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const FileUploaderInAttachmentWrapper = ({
|
|
|
|
const FileUploaderInAttachmentWrapper = ({
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
onChange,
|
|
|
|
onChange,
|
|
|
|
fileConfig,
|
|
|
|
fileConfig,
|
|
|
|
|
|
|
|
isDisabled,
|
|
|
|
}: FileUploaderInAttachmentWrapperProps) => {
|
|
|
|
}: FileUploaderInAttachmentWrapperProps) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<FileContextProvider
|
|
|
|
<FileContextProvider
|
|
|
|
value={value}
|
|
|
|
value={value}
|
|
|
|
onChange={onChange}
|
|
|
|
onChange={onChange}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<FileUploaderInAttachment fileConfig={fileConfig} />
|
|
|
|
<FileUploaderInAttachment isDisabled={isDisabled} fileConfig={fileConfig} />
|
|
|
|
</FileContextProvider>
|
|
|
|
</FileContextProvider>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|