"use client"; import React, { useState, useEffect } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "@/components/ui/dialog"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Separator } from "@/components/ui/separator"; import { Plus, Trash2, Settings as SettingsIcon, Check, ChevronsUpDown } from "lucide-react"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command"; import { cn } from "@/lib/utils"; import { FormFieldConfig, LinkedFieldMapping, FIELD_TYPE_OPTIONS, SELECT_OPTION_TYPE_OPTIONS, LINKED_FIELD_DISPLAY_FORMAT_OPTIONS, } from "../types"; import { apiClient } from "@/lib/api/client"; import { getCascadingRelations, getCascadingRelationByCode, CascadingRelation } from "@/lib/api/cascadingRelation"; // 카테고리 컬럼 타입 (table_column_category_values 용) interface CategoryColumnOption { tableName: string; columnName: string; columnLabel: string; valueCount: number; // 조합키: tableName.columnName key: string; } // 도움말 텍스트 컴포넌트 const HelpText = ({ children }: { children: React.ReactNode }) => (
{children}
); /** * 부모 화면에서 전달 가능한 필드 타입 * 유니버셜 폼 모달에서 "부모에서 값 받기" 설정 시 선택 가능한 필드 목록 */ export interface AvailableParentField { name: string; // 필드명 (columnName) label: string; // 표시 라벨 sourceComponent?: string; // 출처 컴포넌트 (예: "TableList", "SplitPanelLayout2") sourceTable?: string; // 출처 테이블명 } // 섹션별 필드 그룹 interface SectionFieldGroup { sectionId: string; sectionTitle: string; fields: FormFieldConfig[]; } interface FieldDetailSettingsModalProps { open: boolean; onOpenChange: (open: boolean) => void; field: FormFieldConfig; onSave: (updates: Partial