From bbc3094e932e3d193d3223448c789461f4afc058 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 29 Oct 2025 07:46:57 +0000
Subject: (대표님) 데이터룸 관련 변경사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/form-data/spreadJS-dialog.tsx | 38 +++++++++++++++++---------------
 1 file changed, 20 insertions(+), 18 deletions(-)

(limited to 'components/form-data/spreadJS-dialog.tsx')

diff --git a/components/form-data/spreadJS-dialog.tsx b/components/form-data/spreadJS-dialog.tsx
index 1249ebd5..0d1c258e 100644
--- a/components/form-data/spreadJS-dialog.tsx
+++ b/components/form-data/spreadJS-dialog.tsx
@@ -210,7 +210,7 @@ export function TemplateViewDialog({
       length: Array.isArray(templateData) ? templateData.length : 'N/A',
       data: templateData
     });
-    
+
     // 템플릿 데이터가 없거나 빈 배열인 경우 기본 GRD_LIST 템플릿 생성
     if (!templateData || (Array.isArray(templateData) && templateData.length === 0)) {
       // columnsJSON이 있으면 기본 GRD_LIST 템플릿 생성
@@ -291,7 +291,7 @@ export function TemplateViewDialog({
     }
 
     setAvailableTemplates(validTemplates);
-    
+
     // 🔍 최종 availableTemplates 로깅
     console.log('📋 availableTemplates set:', validTemplates.map(t => ({
       TMPL_ID: t.TMPL_ID,
@@ -302,7 +302,7 @@ export function TemplateViewDialog({
     if (validTemplates.length > 0) {
       // 🔍 현재 선택된 템플릿이 availableTemplates에 있는지 확인
       const selectedExists = selectedTemplateId && validTemplates.some(t => t.TMPL_ID === selectedTemplateId);
-      
+
       if (!selectedExists) {
         // 선택된 템플릿이 없거나 유효하지 않으면 첫 번째 템플릿 선택
         const firstTemplate = validTemplates[0];
@@ -325,13 +325,13 @@ export function TemplateViewDialog({
 
   const handleTemplateChange = (templateId: string) => {
     const template = availableTemplates.find(t => t?.TMPL_ID === templateId);
-    
+
     // 🔍 템플릿과 TMPL_ID 검증
     if (!template || !template.TMPL_ID) {
       console.error('❌ Template not found or invalid TMPL_ID:', templateId);
       return;
     }
-    
+
     const templateTypeToSet = determineTemplateType(template);
     setSelectedTemplateId(templateId);
     setTemplateType(templateTypeToSet);
@@ -349,9 +349,9 @@ export function TemplateViewDialog({
       availableCount: availableTemplates.length,
       availableIds: availableTemplates.map(t => t?.TMPL_ID)
     });
-    
+
     const found = availableTemplates.find(t => t?.TMPL_ID === selectedTemplateId);
-    
+
     if (!found && selectedTemplateId) {
       console.warn('⚠️ Selected template not found:', {
         searching: selectedTemplateId,
@@ -365,7 +365,7 @@ export function TemplateViewDialog({
         TYPE: found.TMPL_TYPE
       });
     }
-    
+
     return found;
   }, [availableTemplates, selectedTemplateId]);
 
@@ -1370,7 +1370,7 @@ export function TemplateViewDialog({
     // 🔍 안전성 검증: availableTemplates가 있고, selectedTemplateId가 없을 때만 실행
     if (!selectedTemplateId && availableTemplates.length > 0) {
       const only = availableTemplates[0];
-      
+
       // 🔍 TMPL_ID 검증
       if (!only || !only.TMPL_ID) {
         console.error('❌ First template has no TMPL_ID:', only);
@@ -1378,17 +1378,17 @@ export function TemplateViewDialog({
       }
 
       const type = determineTemplateType(only);
-      
+
       // 🔍 type이 null이 아닐 때만 진행
       if (!type) {
         console.warn('⚠️ Could not determine template type for:', only);
         return;
       }
-  
+
       // 선택되어 있지 않다면 자동 선택
       setSelectedTemplateId(only.TMPL_ID);
       setTemplateType(type);
-  
+
       // 이미 스프레드가 마운트되어 있다면 즉시 초기화
       if (currentSpread) {
         initSpread(currentSpread, only);
@@ -1602,7 +1602,7 @@ export function TemplateViewDialog({
                     {availableTemplates[0]?.NAME || 'Unnamed'} ({availableTemplates[0]?.TMPL_TYPE || 'Unknown'})
                   </span>
                 </div>
-              ) : null}  
+              ) : null}
 
               {selectedTemplate && (
                 <div className="flex items-center gap-4 text-sm">
@@ -1666,11 +1666,13 @@ export function TemplateViewDialog({
           />
 
           {selectedTemplate && isClient && isDataValid ? (
-            <SpreadSheets
-              key={`${templateType}-${selectedTemplate?.TMPL_ID || 'unknown'}-${selectedTemplateId}`}
-              workbookInitialized={initSpread}
-              hostStyle={hostStyle}
-            />
+            <div style={{ height: '100%', width: '100%', position: 'relative' }}>
+              <SpreadSheets
+                key={`${templateType}-${selectedTemplate?.TMPL_ID || 'unknown'}-${selectedTemplateId}`}
+                workbookInitialized={initSpread}
+                hostStyle={hostStyle}
+              />
+            </div>
           ) : (
             <div className="flex items-center justify-center h-full text-muted-foreground">
               {!isClient ? (
-- 
cgit v1.2.3

