화면 비율조정 수정
This commit is contained in:
@@ -34,7 +34,7 @@ interface RealtimePreviewProps {
|
||||
onZoneComponentDrop?: (e: React.DragEvent, zoneId: string, layoutId: string) => void; // 존별 드롭 핸들러
|
||||
onZoneClick?: (zoneId: string) => void; // 존 클릭 핸들러
|
||||
onConfigChange?: (config: any) => void; // 설정 변경 핸들러
|
||||
|
||||
|
||||
// 버튼 액션을 위한 props
|
||||
screenId?: number;
|
||||
tableName?: string;
|
||||
@@ -47,7 +47,7 @@ interface RealtimePreviewProps {
|
||||
onRefresh?: () => void;
|
||||
flowRefreshKey?: number;
|
||||
onFlowRefresh?: () => void;
|
||||
|
||||
|
||||
// 폼 데이터 관련 props
|
||||
formData?: Record<string, any>;
|
||||
onFormDataChange?: (fieldName: string, value: any) => void;
|
||||
@@ -115,24 +115,24 @@ export const RealtimePreviewDynamic: React.FC<RealtimePreviewProps> = ({
|
||||
// 플로우 위젯의 실제 높이 측정
|
||||
React.useEffect(() => {
|
||||
const isFlowWidget = component.type === "component" && (component as any).componentType === "flow-widget";
|
||||
|
||||
|
||||
if (isFlowWidget && contentRef.current) {
|
||||
const measureHeight = () => {
|
||||
if (contentRef.current) {
|
||||
// getBoundingClientRect()로 실제 렌더링된 높이 측정
|
||||
const rect = contentRef.current.getBoundingClientRect();
|
||||
const measured = rect.height;
|
||||
|
||||
|
||||
// scrollHeight도 함께 확인하여 더 큰 값 사용
|
||||
const scrollHeight = contentRef.current.scrollHeight;
|
||||
const rawHeight = Math.max(measured, scrollHeight);
|
||||
|
||||
|
||||
// 40px 단위로 올림
|
||||
const finalHeight = Math.ceil(rawHeight / 40) * 40;
|
||||
|
||||
|
||||
if (finalHeight > 0 && Math.abs(finalHeight - (actualHeight || 0)) > 10) {
|
||||
setActualHeight(finalHeight);
|
||||
|
||||
|
||||
// 컴포넌트의 실제 size.height도 업데이트 (중복 업데이트 방지)
|
||||
if (onConfigChange && finalHeight !== lastUpdatedHeight.current && finalHeight !== component.size?.height) {
|
||||
lastUpdatedHeight.current = finalHeight;
|
||||
@@ -142,11 +142,11 @@ export const RealtimePreviewDynamic: React.FC<RealtimePreviewProps> = ({
|
||||
newHeight: finalHeight,
|
||||
});
|
||||
// size는 별도 속성이므로 직접 업데이트
|
||||
const event = new CustomEvent('updateComponentSize', {
|
||||
const event = new CustomEvent("updateComponentSize", {
|
||||
detail: {
|
||||
componentId: component.id,
|
||||
height: finalHeight
|
||||
}
|
||||
height: finalHeight,
|
||||
},
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
@@ -276,10 +276,10 @@ export const RealtimePreviewDynamic: React.FC<RealtimePreviewProps> = ({
|
||||
>
|
||||
{/* 동적 컴포넌트 렌더링 */}
|
||||
<div
|
||||
ref={component.type === "component" && (component as any).componentType === "flow-widget" ? contentRef : undefined}
|
||||
className={`${component.type === "component" && (component as any).componentType === "flow-widget" ? "h-auto" : "h-full"} w-full max-w-full ${
|
||||
component.componentConfig?.type === "table-list" ? "overflow-hidden" : "overflow-visible"
|
||||
}`}
|
||||
ref={
|
||||
component.type === "component" && (component as any).componentType === "flow-widget" ? contentRef : undefined
|
||||
}
|
||||
className={`${component.type === "component" && (component as any).componentType === "flow-widget" ? "h-auto" : "h-full"} w-full max-w-full overflow-visible`}
|
||||
>
|
||||
<DynamicComponentRenderer
|
||||
component={component}
|
||||
|
||||
Reference in New Issue
Block a user