주요 변경사항: - 격자 설정을 편집 탭에서 항상 표시 (해상도 설정 하단) - 그리드 컬럼 수 동적 조정 가능 (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% - 결과: 파란 테두리와 내부 콘텐츠가 동일한 크기로 정확히 표시
153 lines
4.7 KiB
TypeScript
153 lines
4.7 KiB
TypeScript
"use client";
|
|
|
|
import React from "react";
|
|
import { Label } from "@/components/ui/label";
|
|
import { Input } from "@/components/ui/input";
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
|
import { CodePartType, DATE_FORMAT_OPTIONS } from "@/types/numbering-rule";
|
|
|
|
interface AutoConfigPanelProps {
|
|
partType: CodePartType;
|
|
config?: any;
|
|
onChange: (config: any) => void;
|
|
isPreview?: boolean;
|
|
}
|
|
|
|
export const AutoConfigPanel: React.FC<AutoConfigPanelProps> = ({
|
|
partType,
|
|
config = {},
|
|
onChange,
|
|
isPreview = false,
|
|
}) => {
|
|
// 1. 순번 (자동 증가)
|
|
if (partType === "sequence") {
|
|
return (
|
|
<div className="space-y-3 sm:space-y-4">
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">순번 자릿수</Label>
|
|
<Input
|
|
type="number"
|
|
min={1}
|
|
max={10}
|
|
value={config.sequenceLength || 3}
|
|
onChange={(e) =>
|
|
onChange({ ...config, sequenceLength: parseInt(e.target.value) || 3 })
|
|
}
|
|
disabled={isPreview}
|
|
className="h-8 text-xs sm:h-10 sm:text-sm"
|
|
/>
|
|
<p className="mt-1 text-[10px] text-muted-foreground sm:text-xs">
|
|
예: 3 → 001, 4 → 0001
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">시작 번호</Label>
|
|
<Input
|
|
type="number"
|
|
min={1}
|
|
value={config.startFrom || 1}
|
|
onChange={(e) =>
|
|
onChange({ ...config, startFrom: parseInt(e.target.value) || 1 })
|
|
}
|
|
disabled={isPreview}
|
|
className="h-8 text-xs sm:h-10 sm:text-sm"
|
|
/>
|
|
<p className="mt-1 text-[10px] text-muted-foreground sm:text-xs">
|
|
순번이 시작될 번호
|
|
</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// 2. 숫자 (고정 자릿수)
|
|
if (partType === "number") {
|
|
return (
|
|
<div className="space-y-3 sm:space-y-4">
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">숫자 자릿수</Label>
|
|
<Input
|
|
type="number"
|
|
min={1}
|
|
max={10}
|
|
value={config.numberLength || 4}
|
|
onChange={(e) =>
|
|
onChange({ ...config, numberLength: parseInt(e.target.value) || 4 })
|
|
}
|
|
disabled={isPreview}
|
|
className="h-8 text-xs sm:h-10 sm:text-sm"
|
|
/>
|
|
<p className="mt-1 text-[10px] text-muted-foreground sm:text-xs">
|
|
예: 4 → 0001, 5 → 00001
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">숫자 값</Label>
|
|
<Input
|
|
type="number"
|
|
min={0}
|
|
value={config.numberValue || 0}
|
|
onChange={(e) =>
|
|
onChange({ ...config, numberValue: parseInt(e.target.value) || 0 })
|
|
}
|
|
disabled={isPreview}
|
|
className="h-8 text-xs sm:h-10 sm:text-sm"
|
|
/>
|
|
<p className="mt-1 text-[10px] text-muted-foreground sm:text-xs">
|
|
고정으로 사용할 숫자
|
|
</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// 3. 날짜
|
|
if (partType === "date") {
|
|
return (
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">날짜 형식</Label>
|
|
<Select
|
|
value={config.dateFormat || "YYYYMMDD"}
|
|
onValueChange={(value) => onChange({ ...config, dateFormat: value })}
|
|
disabled={isPreview}
|
|
>
|
|
<SelectTrigger className="h-8 text-xs sm:h-10 sm:text-sm">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{DATE_FORMAT_OPTIONS.map((option) => (
|
|
<SelectItem key={option.value} value={option.value} className="text-xs sm:text-sm">
|
|
{option.label} ({option.example})
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
<p className="mt-1 text-[10px] text-muted-foreground sm:text-xs">
|
|
현재 날짜가 자동으로 입력됩니다
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// 4. 문자
|
|
if (partType === "text") {
|
|
return (
|
|
<div>
|
|
<Label className="text-xs font-medium sm:text-sm">텍스트 값</Label>
|
|
<Input
|
|
value={config.textValue || ""}
|
|
onChange={(e) => onChange({ ...config, textValue: e.target.value })}
|
|
placeholder="예: PRJ, CODE, PROD"
|
|
disabled={isPreview}
|
|
className="h-8 text-xs sm:h-10 sm:text-sm"
|
|
/>
|
|
<p className="mt-1 text-[10px] text-muted-foreground sm:text-xs">
|
|
고정으로 사용할 텍스트 또는 코드
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return null;
|
|
};
|