file value

pull/21369/head
jZonG 12 months ago
parent f9060c5c14
commit f338b51afd

@ -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>
) )
} }

@ -207,6 +207,7 @@ const ValueContent = ({
number_limits: currentVar.value_type === 'file' ? 1 : (fileFeature as any).fileUploadConfig?.workflow_file_upload_limit || 5, number_limits: currentVar.value_type === 'file' ? 1 : (fileFeature as any).fileUploadConfig?.workflow_file_upload_limit || 5,
fileUploadConfig: (fileFeature as any).fileUploadConfig, fileUploadConfig: (fileFeature as any).fileUploadConfig,
}} }}
isDisabled={textEditorDisabled}
/> />
</div> </div>
)} )}

Loading…
Cancel
Save