summaryrefslogtreecommitdiff
path: root/components/form-data/spreadJS-dialog.tsx
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-09-19 07:51:27 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-09-19 07:51:27 +0000
commit9ecdfb23fe3df6a5df86782385002c562dfc1198 (patch)
tree4188cb7e6bf2c862d9c86a59d79946bd41217227 /components/form-data/spreadJS-dialog.tsx
parentb67861fbb424c7ad47ad1538f75e2945bd8890c5 (diff)
(대표님) rfq 히스토리, swp 등
Diffstat (limited to 'components/form-data/spreadJS-dialog.tsx')
-rw-r--r--components/form-data/spreadJS-dialog.tsx32
1 files changed, 17 insertions, 15 deletions
diff --git a/components/form-data/spreadJS-dialog.tsx b/components/form-data/spreadJS-dialog.tsx
index fbeceaf3..19c9a616 100644
--- a/components/form-data/spreadJS-dialog.tsx
+++ b/components/form-data/spreadJS-dialog.tsx
@@ -362,15 +362,20 @@ const editableFieldsCount = React.useMemo(() => {
});
}, []);
- const createCellStyle = React.useCallback((isEditable: boolean) => {
- const style = new GC.Spread.Sheets.Style();
+ const createCellStyle = React.useCallback((activeSheet: any, row: number, col: number, isEditable: boolean) => {
+ // 기존 스타일 가져오기 (없으면 새로 생성)
+ const existingStyle = activeSheet.getStyle(row, col) || new GC.Spread.Sheets.Style();
+
+ // backColor만 수정
if (isEditable) {
- style.backColor = "#bbf7d0";
+ existingStyle.backColor = "#bbf7d0";
} else {
- style.backColor = "#e5e7eb";
- style.foreColor = "#4b5563";
+ existingStyle.backColor = "#e5e7eb";
+ // 읽기 전용일 때만 텍스트 색상 변경 (선택사항)
+ existingStyle.foreColor = "#4b5563";
}
- return style;
+
+ return existingStyle;
}, []);
const setBatchStyles = React.useCallback((
@@ -379,14 +384,11 @@ const editableFieldsCount = React.useMemo(() => {
) => {
console.log(`🎨 Setting ${stylesToSet.length} styles in batch`);
- const editableStyle = createCellStyle(true);
- const readonlyStyle = createCellStyle(false);
-
// 🔧 개별 셀별로 스타일과 잠금 상태 설정 (편집 권한 보장)
stylesToSet.forEach(({row, col, isEditable}) => {
try {
const cell = activeSheet.getCell(row, col);
- const style = isEditable ? editableStyle : readonlyStyle;
+ const style = createCellStyle(activeSheet, row, col, isEditable);
activeSheet.setStyle(row, col, style);
cell.locked(!isEditable); // 편집 가능하면 잠금 해제
@@ -854,14 +856,14 @@ const createGrdListTableOptimized = React.useCallback((activeSheet: any, templat
}
// 편집 가능 스타일 재적용
- const editableStyle = createCellStyle(true);
+ const editableStyle = createCellStyle(activeSheet, cellPos.row, cellPos.col, true);
activeSheet.setStyle(cellPos.row, cellPos.col, editableStyle);
console.log(`🔓 Cell [${cellPos.row}, ${cellPos.col}] ${mapping.attId} set as EDITABLE`);
} else {
// 읽기 전용 셀
cell.locked(true);
- const readonlyStyle = createCellStyle(false);
+ const readonlyStyle = createCellStyle(activeSheet, cellPos.row, cellPos.col, false);
activeSheet.setStyle(cellPos.row, cellPos.col, readonlyStyle);
}
} catch (error) {
@@ -972,7 +974,7 @@ const createGrdListTableOptimized = React.useCallback((activeSheet: any, templat
toast.warning(`Invalid value in ${exactMapping.attId}: ${errorMessage}`, { duration: 5000 });
} else {
// ✅ 정상 스타일 복원
- const normalStyle = createCellStyle(exactMapping.isEditable);
+ const normalStyle = createCellStyle(activeSheet, info.row, info.col, exactMapping.isEditable);
activeSheet.setStyle(info.row, info.col, normalStyle);
cell.locked(!exactMapping.isEditable);
}
@@ -1132,7 +1134,7 @@ const createGrdListTableOptimized = React.useCallback((activeSheet: any, templat
const cell = activeSheet.getCell(cellPos.row, cellPos.col);
cell.value(value ?? null);
- const style = createCellStyle(isEditable);
+ const style = createCellStyle(activeSheet, cellPos.row, cellPos.col, isEditable);
activeSheet.setStyle(cellPos.row, cellPos.col, style);
const columnConfig = columnsJSON.find(col => col.key === ATT_ID);
@@ -1173,7 +1175,7 @@ const createGrdListTableOptimized = React.useCallback((activeSheet: any, templat
setIsInitializing(false);
setLoadingProgress(null);
}
- }, [selectedTemplate, templateType, selectedRow, tableData, updateProgress, getSafeActiveSheet, createGrdListTableOptimized, setBatchValues, setBatchStyles, setupSheetProtectionAndEvents, setCellMappings]);
+ }, [selectedTemplate, templateType, selectedRow, tableData, updateProgress, getSafeActiveSheet, createGrdListTableOptimized, setBatchValues, setBatchStyles, setupSheetProtectionAndEvents, setCellMappings, createCellStyle, isFieldEditable, columnsJSON, setupOptimizedListValidation, parseCellAddress, ensureRowCapacity, getCellAddress]);
const handleSaveChanges = React.useCallback(async () => {
if (!currentSpread || !hasChanges) {