From f64279d08466740a794f8788b66ed78ec7e06bd1 Mon Sep 17 00:00:00 2001 From: leeheejin Date: Tue, 13 Jan 2026 10:04:05 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=EC=97=B0=EC=86=8D=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table-category/CategoryValueAddDialog.tsx | 82 ++++++++++++++----- .../table-category/CategoryValueManager.tsx | 4 +- 2 files changed, 63 insertions(+), 23 deletions(-) diff --git a/frontend/components/table-category/CategoryValueAddDialog.tsx b/frontend/components/table-category/CategoryValueAddDialog.tsx index 9d962b22..303022bd 100644 --- a/frontend/components/table-category/CategoryValueAddDialog.tsx +++ b/frontend/components/table-category/CategoryValueAddDialog.tsx @@ -14,6 +14,7 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { Badge } from "@/components/ui/badge"; +import { Checkbox } from "@/components/ui/checkbox"; import { TableCategoryValue } from "@/types/tableCategoryValue"; // 기본 색상 팔레트 @@ -51,6 +52,7 @@ export const CategoryValueAddDialog: React.FC< const [valueLabel, setValueLabel] = useState(""); const [description, setDescription] = useState(""); const [color, setColor] = useState("none"); + const [continuousAdd, setContinuousAdd] = useState(false); // 연속 입력 체크박스 // 라벨에서 코드 자동 생성 (항상 고유한 코드 생성) const generateCode = (): string => { @@ -60,6 +62,12 @@ export const CategoryValueAddDialog: React.FC< return `CATEGORY_${timestamp}${random}`; }; + const resetForm = () => { + setValueLabel(""); + setDescription(""); + setColor("none"); + }; + const handleSubmit = () => { if (!valueLabel.trim()) { return; @@ -77,14 +85,28 @@ export const CategoryValueAddDialog: React.FC< isDefault: false, } as TableCategoryValue); - // 초기화 - setValueLabel(""); - setDescription(""); - setColor("none"); + // 연속 입력 체크되어 있으면 폼만 초기화하고 모달 유지 + if (continuousAdd) { + resetForm(); + } else { + // 연속 입력 아니면 모달 닫기 + resetForm(); + onOpenChange(false); + } + }; + + const handleClose = () => { + resetForm(); + onOpenChange(false); }; return ( - + { + if (!isOpen) { + resetForm(); + } + onOpenChange(isOpen); + }}> @@ -165,24 +187,42 @@ export const CategoryValueAddDialog: React.FC< - - - + + {/* 연속 입력 체크박스 */} +
+ setContinuousAdd(checked as boolean)} + /> + +
+ +
+ + +
); }; - diff --git a/frontend/components/table-category/CategoryValueManager.tsx b/frontend/components/table-category/CategoryValueManager.tsx index 98d23bae..aba04d6a 100644 --- a/frontend/components/table-category/CategoryValueManager.tsx +++ b/frontend/components/table-category/CategoryValueManager.tsx @@ -123,7 +123,7 @@ export const CategoryValueManager: React.FC = ({ if (response.success && response.data) { await loadCategoryValues(); - setIsAddDialogOpen(false); + // 모달 닫기는 CategoryValueAddDialog에서 연속 입력 체크박스로 제어 toast({ title: "성공", description: "카테고리 값이 추가되었습니다", @@ -142,7 +142,7 @@ export const CategoryValueManager: React.FC = ({ title: "오류", description: error.message || "카테고리 값 추가에 실패했습니다", variant: "destructive", - }); + }); } };