[as] feat: 필수 첨부 파일 업로드 가능한 확장자 제한
This commit is contained in:
@@ -19,3 +19,14 @@ export function createEtcUploadKey(file: File): string {
|
||||
export function isEtcFileKey(fileKey: string): boolean {
|
||||
return fileKey.startsWith(ETC_FILE_KEY_PREFIX);
|
||||
}
|
||||
|
||||
export function toFileAccept(rmrk: string | null | undefined): string {
|
||||
if (!rmrk?.trim()) return "";
|
||||
|
||||
return rmrk
|
||||
.split(",")
|
||||
.map((ext) => ext.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
.map((ext) => (ext.startsWith(".") ? ext : `.${ext}`))
|
||||
.join(",");
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
createUploadKey,
|
||||
type FieldPrefix,
|
||||
isEtcFileKey,
|
||||
toFileAccept,
|
||||
} from "../lib/attachments-form-utils";
|
||||
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
@@ -373,7 +374,8 @@ function AttachmentsFormSection({
|
||||
<h3 className="mb-4 text-xl font-semibold">필수 첨부파일</h3>
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="60%" />
|
||||
<col width="50%" />
|
||||
<col width="10%" />
|
||||
<col width="40%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
@@ -381,6 +383,7 @@ function AttachmentsFormSection({
|
||||
<TableHead className="w-[30rem]" align="left">
|
||||
파일명
|
||||
</TableHead>
|
||||
<TableHead>파일 확장자</TableHead>
|
||||
<TableHead>업로드된 파일</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -401,6 +404,7 @@ function AttachmentsFormSection({
|
||||
>
|
||||
{file.esntlAtchFileNm}
|
||||
</TableHead>
|
||||
<TableCell align="center">{file.esntlAtchFileRmrk}</TableCell>
|
||||
<TableCell className="space-y-2">
|
||||
{uploadedFiles[file.esntlAtchFileId]?.length > 0 ? (
|
||||
<div className="space-y-1">
|
||||
@@ -432,6 +436,7 @@ function AttachmentsFormSection({
|
||||
<input
|
||||
type="file"
|
||||
className="hidden"
|
||||
accept={toFileAccept(file.esntlAtchFileRmrk) || undefined}
|
||||
onChange={(e) => {
|
||||
void handleEssentialFileUpload(
|
||||
file.esntlAtchFileId,
|
||||
|
||||
Reference in New Issue
Block a user