주요 변경사항: - 격자 설정을 편집 탭에서 항상 표시 (해상도 설정 하단) - 그리드 컬럼 수 동적 조정 가능 (1-24) - 컴포넌트 생성 시 현재 그리드 컬럼 수 기반 자동 계산 - 컴포넌트 너비가 설정한 컬럼 수대로 정확히 표시되도록 수정 수정된 파일: - ScreenDesigner: 컴포넌트 드롭 시 gridColumns와 style.width 동적 계산 - UnifiedPropertiesPanel: 격자 설정 UI 통합, 차지 컬럼 수 설정 시 width 자동 계산 - RealtimePreviewDynamic: getWidth 우선순위 수정, DOM 크기 디버깅 로그 추가 - 8개 컴포넌트: componentStyle.width를 항상 100%로 고정 * ButtonPrimaryComponent * TextInputComponent * NumberInputComponent * TextareaBasicComponent * DateInputComponent * TableListComponent * CardDisplayComponent 문제 해결: - 컴포넌트 내부에서 component.style.width를 재사용하여 이중 축소 발생 - 해결: 부모 컨테이너(RealtimePreviewDynamic)가 width 제어, 컴포넌트는 항상 100% - 결과: 파란 테두리와 내부 콘텐츠가 동일한 크기로 정확히 표시
106 lines
3.5 KiB
TypeScript
106 lines
3.5 KiB
TypeScript
"use client";
|
|
|
|
import React from "react";
|
|
import { Card, CardContent, CardHeader } from "@/components/ui/card";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Label } from "@/components/ui/label";
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Trash2 } from "lucide-react";
|
|
import { NumberingRulePart, CodePartType, GenerationMethod, CODE_PART_TYPE_OPTIONS } from "@/types/numbering-rule";
|
|
import { AutoConfigPanel } from "./AutoConfigPanel";
|
|
import { ManualConfigPanel } from "./ManualConfigPanel";
|
|
|
|
interface NumberingRuleCardProps {
|
|
part: NumberingRulePart;
|
|
onUpdate: (updates: Partial<NumberingRulePart>) => void;
|
|
onDelete: () => void;
|
|
isPreview?: boolean;
|
|
}
|
|
|
|
export const NumberingRuleCard: React.FC<NumberingRuleCardProps> = ({
|
|
part,
|
|
onUpdate,
|
|
onDelete,
|
|
isPreview = false,
|
|
}) => {
|
|
return (
|
|
<Card className="border-border bg-card">
|
|
<CardHeader className="pb-3">
|
|
<div className="flex items-center justify-between">
|
|
<Badge variant="outline" className="text-xs sm:text-sm">
|
|
규칙 {part.order}
|
|
</Badge>
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
onClick={onDelete}
|
|
className="text-destructive h-7 w-7 sm:h-8 sm:w-8"
|
|
disabled={isPreview}
|
|
>
|
|
<Trash2 className="h-3 w-3 sm:h-4 sm:w-4" />
|
|
</Button>
|
|
</div>
|
|
</CardHeader>
|
|
|
|
<CardContent className="space-y-3 sm:space-y-4">
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">구분 유형</Label>
|
|
<Select
|
|
value={part.partType}
|
|
onValueChange={(value) => onUpdate({ partType: value as CodePartType })}
|
|
disabled={isPreview}
|
|
>
|
|
<SelectTrigger className="h-8 text-xs sm:h-10 sm:text-sm">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{CODE_PART_TYPE_OPTIONS.map((option) => (
|
|
<SelectItem key={option.value} value={option.value} className="text-xs sm:text-sm">
|
|
{option.label}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
</div>
|
|
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">생성 방식</Label>
|
|
<Select
|
|
value={part.generationMethod}
|
|
onValueChange={(value) => onUpdate({ generationMethod: value as GenerationMethod })}
|
|
disabled={isPreview}
|
|
>
|
|
<SelectTrigger className="h-8 text-xs sm:h-10 sm:text-sm">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectItem value="auto" className="text-xs sm:text-sm">
|
|
자동 생성
|
|
</SelectItem>
|
|
<SelectItem value="manual" className="text-xs sm:text-sm">
|
|
직접 입력
|
|
</SelectItem>
|
|
</SelectContent>
|
|
</Select>
|
|
</div>
|
|
|
|
{part.generationMethod === "auto" ? (
|
|
<AutoConfigPanel
|
|
partType={part.partType}
|
|
config={part.autoConfig}
|
|
onChange={(autoConfig) => onUpdate({ autoConfig })}
|
|
isPreview={isPreview}
|
|
/>
|
|
) : (
|
|
<ManualConfigPanel
|
|
config={part.manualConfig}
|
|
onChange={(manualConfig) => onUpdate({ manualConfig })}
|
|
isPreview={isPreview}
|
|
/>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
};
|