"use client"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { CheckSquare } from "lucide-react"; import { useReportDesigner } from "@/contexts/ReportDesignerContext"; import type { ComponentConfig } from "@/types/report"; interface Props { component: ComponentConfig; /** 우측 패널: "style" | 모달: "data" | 미전달: 전체 표시 (하위 호환) */ section?: "style" | "data"; } export function CheckboxProperties({ component, section }: Props) { const { updateComponent, queries, getQueryResult } = useReportDesigner(); const showStyle = !section || section === "style"; const showData = !section || section === "data"; return ( <> {/* 체크박스 스타일 — 우측 패널(section="style")에서 표시 */} {showStyle && (
체크박스 스타일
{/* 레이블 위치 */}
{/* 체크박스 크기 */}
updateComponent(component.id, { checkboxSize: Number(e.target.value) })} min={12} max={40} className="h-9" />
{/* 색상 설정 */}
updateComponent(component.id, { checkboxColor: e.target.value })} className="h-9 w-full" />
updateComponent(component.id, { checkboxBorderColor: e.target.value })} className="h-9 w-full" />
)} {/* 체크박스 데이터 — 모달(section="data")에서 표시 */} {showData && (
체크박스 데이터
{/* 체크 상태 (쿼리 연결 없을 때) */} {!component.queryId && (
updateComponent(component.id, { checkboxChecked: e.target.checked })} className="h-4 w-4 rounded border-gray-300" />
)} {/* 쿼리 연결 시 필드 선택 */} {component.queryId && (

true, "Y", 1 등 truthy 값이면 체크됨

)} {/* 레이블 텍스트 */}
updateComponent(component.id, { checkboxLabel: e.target.value })} placeholder="체크박스 옆 텍스트" className="h-9" />
{/* 쿼리 연결 안내 */} {!component.queryId && (
쿼리를 연결하면 데이터베이스 값으로 체크 상태를 결정할 수 있습니다.
)}
)} ); }